Nix development
Open a Python shell in a test virtual machine
-
Start the interactive test driver:
nix run .#checks.x86_64-linux.<machine-name>-test.driverInteractiveTo exit the test driver, use the
CTRL-dkey combination. -
Start all machines:
start_all() -
Open a Linux shell:
machine.shell_interact()
Nix GitOps
Nix machines run comin to implement GitOps.
Pushing commits to branches named testing-<host-name> makes comin pull
changes, apply them, but not update the bootloader to boot from the newly
generated configuration. Comin updates the bootloader when commits are pushed to
the default branch. For more info, see
Comin how-tos.
If the default branch changes, update config/nix/roles/comin/default.nix
accordingly.
Nix commands
nix flake metadata <path>: show flake metadatanix flake show <path>: show information about the flakenix fmt . -- --clear-cache: format the Nix codebasenix build .#checks.x86_64-linux.lint-treefmt-nix --verbose: run linting and formatting checksnixos-rebuild switch --flake ".#<host>" --target-host "<ssh-user>@<host>" --sudo: apply changes to host when it's not running comin.nix flake check <path>: run all flake checksnix build <path>#checks.<check-name>: run a specific checknix build <path>#<package-name>: build specific packagenix build --rebuild <path>#<package-name>: rebuild a packagenix build --print-build-logs <path>#<package-name>: print build log
nix-store --gc: clean the Nix store