Skip to content

rvveber/nixos-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This config structure for NixOS aims to be:

  • self-explainatory
  • minimal
  • flake based
  • multi-host compatible
  • multi-user compatible
  • easily universally extendable

It optionally includes home-manager.


Don't get discouraged by all the files in the root, they are optional development assisting tools. What is important for the NixOS configuration, is only the src directory.


Quick Start

Make this config structure your own

  1. (fork this repository)
  2. git clone <repository-uri>
  3. create configuration for your host - (be sure to have set the hostname in configuration.nix)
mkdir src/host/$(hostname)
  1. copy over your host configuration.nix and hardware-configuration.nix
cp /etc/nixos/*configuration.nix src/host/$(hostname)
  1. create src/host/$(hostname)/default.nix, that acts as entrypoint
nano src/host/$(hostname)/default.nix
  1. paste the following boilerplate and customize to your needs
{ ... }:
{
    imports = [
        ./hardware-configuration.nix
        ./configuration.nix

        # import (or create) your locale - sets keyboard and timezone stuff
        ../../module/select/locale/de_DE.nix

        # import (or create) hardware features
        ../../module/add/hardware/audio.nix
        ../../module/add/hardware/nvidia.nix

        # (optional) import development module - enables everything to further develop this config
        ../../module/add/software/development.nix
    ];
}
  1. copy the user/i directory to a directory with your username - acts as entrypoint for user configurations
cp -r src/user/i src/user/$(whoami)
  1. in the files in it, replace all occurances of the user i with your username
  2. in src/flake.nix add a new nixosConfigurations entry for your hostname and user combination (can be multiple)
    ...
    nixosConfigurations.<HOSTNAME> = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./host/<HOSTNAME>
        ./user/<USERNAME>
      ];
    };
    ...
  1. Test, that everything is working
bin/switch
  1. Done! You now have a minimal multi-host, multi-user NixOS configuration

Updating

Update the system by running bin/update and bin/switch afterwards.

Garbage Collection

Simple. Run bin/collect-garbage. Info: This deletes older boot entries too.

Development

If you enable the development module (optional) - your nix configuration will automatically be statically checked, formated, and you will get nix-lang language features.

If you'd like to enable development features in general, you'll need to add the module/add/software/development.nix module to your hosts default.nix.

Then, the various tools to assist development with nix, will be loaded automatically when you enter the directory where you cloned this repository.

Future

This repository is ever evolving, so if you have certain requests featurewise, don't hesitate to create issues. I try to keep it minimal, but i'm also using it for myself, in the future i'll create a second repository that acts as pure boilerplate and will be even more minimal than now.

About

My personal nixos-config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published