NixOS configuration
(I highly recommend making your own configuration and copy snippets from mine, but anyway…)
Get the latest NixOS 24.05 image here, do your partitions (root must be mounted at /mnt
), then run the following commands:
# move the output file of this to hosts/*/hardware-configuration.nix
nixos-generate-config
nix-shell -p git nixUnstable
git clone https://github.com/fortuneteller2k/nix-config ~
cd ~/nix-config
sudo nixos-install --flake .#starcruiser
# After rebooting
home-manager switch --flake .#moni@starcruiser
For WSL, follow the quickstart guide, then run the following commands:
nix shell nixpkgs#git
git clone https://github.com/fortuneteller2k/nix-config ~
cd ~/nix-config
sudo nixos-rebuild switch --flake .#turncoat
home-manager switch --flake .#zero@turncoat
- You probably should replace hosts/starcruiser/hardware-configuration.nix with your own with
nixos-generate-config
. - You might want to change all instances of my username to yours.
- Comment out every
__contentAddressed = true;
you find. - You might want to disable
agenix
, for my secret cannot be decrypted without my private key. See hosts/default.nix.
NixOS/nix-darwin/home-manager configuration that I use daily.
See also:
- home-manager
- flakes
- flake-parts, for the flake modules at modules/parts
- nixpkgs-f2k, my package collection
- nix-darwin, for
hosts/riscake
- NixOS-WSL, for
hosts/turncoat
Resources and configurations I used to base on:
- colemickens/nixos-flake-example
- NixOS modules on NixOS Wiki
- Writing NixOS modules
- Nix Flakes talk by Eelco Dolstra on NixCon
- flake.parts module arguments
jonringer gave a brief explanation as to why one might want to use Nix flakes.
flake-parts
allow reusable configuration powered by the module system everyone knows and loves.
See modules/parts, and it’s implementation in my system configurations and my home configurations.