- Nix 61.3%
- Shell 34.6%
- Just 4.1%
| modules | ||
| profiles | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| Justfile | ||
| README.md | ||
system
get started (on macOS) 🏃
first, authorise SSH keys in GitLab (user profile / deploy keys).
second, install Lix using the one-liner:
$ curl -sSf -L https://install.lix.systems/lix | sh -s -- install
third, ensure Lix is installed correctly:
$ nix run nixpkgs#hello
fourth, check flake.nix: make sure there's a darwinConfigurations section for the current hostname
last, but not least, once you're ready to commit:
$ nix run nix-darwin -- switch --flake .
rebuilding 🔧
after initial setup, we can use a shorter command to rebuild the system:
$ darwin-rebuild switch --flake .
or, the even shorter:
$ just switch
Homebrew
Formulae are managed by nix-darwin's homebrew module, mostly through modules/darwin/brew.nix.
homebrew.global.brewfile is enabled, permitting use of brew bundle to preview missing packages against the current state.
List dependencies that haven't been installed:
$ brew bundle check -v
List unexpected installed dependencies:
# Needs --force to actually cleanup, see --help
$ brew bundle cleanup
get started (on NixOS) 🏃
first, download and install NixOS.
second, authorise SSH keys in GitLab (user profile / deploy keys).
third, move /etc/nixos to our home directory:
$ sudo mv /etc/nixos ~/system && sudo chown -R $USER ~/system
fourth, gently initialise the git repository while preserving nixos-generate-config output:
# this could probably be less convoluted?
$ mv {hardware-configuration.nix,configuration.nix} ..
$ git init && git remote add origin git@gitlab.canidae.systems:htw/system.git && git fetch origin
$ git reset --hard origin/main
$ mv ../hardware-configuration.nix ./modules/hardware/$(hostname).nix
fifth, check flake.nix: make sure there's a nixosConfigurations section for the current hostname (use ../configuration.nix as a reference)
last, but not least, once you're ready to commit:
$ sudo nixos-rebuild switch --flake .
notes
influences
- https://github.com/kclejeune/system
- https://github.com/i077/system
- https://xyno.space/post/nix-darwin-introduction
- https://nixcademy.com/2024/01/15/nix-on-macos/
- https://nixos.asia/en/nixos-install-flake