Giter Club home page Giter Club logo

nixos-configuration's Introduction

NixOS Configuration

Setup

  • Create ./ident which contains your hostname, see ident.example. The hostname is used as an identifier in setup.sh load the rest of the configuration, ie ./hosts/your-hostname/default.nix.
  • Each user needs an entry in secrets.nix, a file which provides at a hashed password created with mkpasswd. See ./secrets.nix.example. Alternatively you can enable mutable users (users.mutableUsers = true; in ./users/default.nix) and set your password with passwd.
  • I have a seperate configuration for managing my user with home-manager.

Concept

The concept behind this configuration is a simple top-down approach. Each machine has a unique configuration folder structure based on hostname, for example ./hosts/nixos-workstation or ./hosts/nixos-laptop. Shared configuration is then imported from there. Here's a quick overview:

.
├── flake.lock                         // Shouldn't appear in git, ignored by default.
├── flake.nix                          // Simple flake, the future is now.
├── hosts                              // Machine configurations sorted by hostnames
│   ├── default.nix                    // Default configuration applied to all hosts
│   ├── nixos-laptop                   // Per-machine configuration for "nixos-laptop"
│   │   ├── default.nix                // Configuration for the machine named "nixos-laptop"
│   │   └── hardware-configuration.nix // Original autogenerated hardware configuration
│   └── nixos-workstation              // Per-machine configuration for "nixos-workstation"
│       ├── default.nix                // Configuration for the machine named "nixos-workstation"
│       └── hardware-configuration.nix // Original autogenerated hardware configuration
├── ident                              // Shouldn't appear in git, ignored by default.
├── ident.example                      // Example ident file, change to your hostname and rename.
├── modules                            // My modules
│   ├── default.nix                    // List of imports
│   ├── hardware                       // Modules relating to hardware
│   │   ├── bluetooth/default.nix      // Bluetooth hardware
│   │   ├── cpu                        // Modules for CPUs
│   │   │   ├── amd/default.nix        // AMD CPU, I don't own an Intel CPU yet.
│   │   │   └── default.nix            // Applies to all CPUs
│   │   ├── default.nix                // Imports for hardware types
│   │   └── gpu                        // Modules for certain GPUs
│   │       ├── amd/default.nix        // AMD GPU
│   │       ├── default.nix            // Applies to all GPUs
│   │       └── nvidia/default.nix     // Nvidia GPU (Desktop/Proprietary)
│   └── services                       // Modules relating to services
│       ├── default.nix                // Imports for service types
│       ├── flatpak/default.nix        // Flatpak module
│       └── pipewire/default.nix       // PipeWire module
├── pkgs                               // My packages
│   ├── default.nix                    // Configure nixpkgs with our overlay
│   ├── grub2                          // Grub themes
│   │   └── virtuaverse                // virtuaverse theme
│   │       └── default.nix            // Derivation
│   └── pkgs.nix                       // List of my packages to use
├── README.md                          // This file you're reading now
├── secrets.nix                        // Shouldn't appear in git, ignored by default.
├── secrets.nix.example                // Set your hashed passwords and rename.
├── setup.sh                           // Run ./setup.sh to apply your configuration.
└── users                              // User configuration
    ├── default.nix                    // Configuration that applies to every user.
    ├── guest/default.nix              // Per-user configuration for an optional guest user
    ├── jdf/default.nix                // Per-user configuration for "jdf"
    └── root/default.nix               // Per-user configuration for root

Opinionated Style Guide

Having a good style keeps your configurations readable and maintainable which is super important for NixOS.

  • Sort alphabetically to make locating everything a breeze.
  • Options and packages should be well commented, including descriptions.
  • The nixfmt package should be used as a guide to proper formating.
  • with should always be used when appropriate, for example: hardware.pulseaudio.package = with pkgs; pulseaudioFull;

nixos-configuration's People

Contributors

joshuafern avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.