Skip to content

inverted-tree/nixos-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my NixOS configurations.

This repo stores all my nix configurations. It is modular in terms of host machines, modules and users. The main branch should be regarded as a rolling release.

Note

Disk partitioning still needs to be done manually for each machine. I did not yet have the nerve to make this declarative.

Setting up a new host

To bootstrap a new machine with the configuration from withing the installer, follow the official installation guide up to the Create NixOS Config section, or just:

  • make sure networking is working:
ping -c 2 papertoilet.com
  • make sure all disks are correctly formatted and mounted:
lsblk -f

Then, after nix flakes are enabled:

export NIX_CONFIG="experimental-features = nix-command flakes"

clone this repo:

nix-shell -p git vim
git clone https://github.com/inverted-tree/nixos-config.git /mnt/etc/nixos

and generate the hardware-configuration.nix:

nixos-generate-config --root /mnt
mkdir -p /mnt/etc/nixos/hosts/<newhostname>
mv /mnt/etc/nixos/configuration.nix /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/hosts/<newhostname>

Adapt the generated config:

vim /mnt/etc/nixos/hosts/<newhostname>/configuration.nix

it should look something like the default template:

{
  imports = [
    # The hardware-dependent options
    ./hardware-configuration.nix
    # All (shared/non-specific) users
    ../../users/iamgroot.nix
    # All custom modules
    ../../modules/somemodule.nix
  ];

  nix.settings.experimental-features = [
    "nix-command"
    "flakes"
  ];

  ...
}

and then install the OS wiht the flake:

nixos-install --flake /mnt/etc/nixos#<newhostname>

Finally, set a root password and reboot.

Note

After the installation has finished and the system has rebooted, it is ready for my dotfiles. Instructions on how to sync them are in the repo's readme.


Warning

This repo mainly acts as a way to sync my configurations across host machines and make it easy to set up a new machine with minimal effort. Feel free to use my code and break your system.

About

Modular, flake-based configuration files for my nixos machines, i.e. my homelab.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages