This repo is intended for managing my flock of computers through Nix.
- Ensure that CommandLineTools are installed.
- Install nix (the non-determinate systems distribution)
- Clone this repo and cd into it.
- After cloning the first time on your machine, run:
sudo nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ".#devmac"If you have made changes toflake.nixand need a rebuild, use:
nix flake update
darwin-rebuild switch --flake .#devmac
Ephem is a VMWare Fusion VM. The same instructions as for devnix will apply though. Just the machine name has to be changed.
Devnix is a parallels guest VM. After starting the nixOS installer through an ISO found here. Choose the version with the graphical installer.
Note: This keymap is not the macOS flavour of the Swiss layout, but rather the classic Swiss layout, cf. here. the # can be accessed with altGR + shift + 3. Square brackets with altGR + ü/¨ and curlies with altGR + ä / $
Then cd /etc/nixos/configuration.nix. Add this to the file:
nix = {
package = pkgs.nix;
settings.experimental-features = [ "nix-command" "flakes" ];
};(for vim as the editor just launch nix-shell -p vim)
And then rebuild your nix with sudo nixos-rebuild switch
- Navigate to
/home/nixos nix-shell -p git- Clone this repo:
git clone https://github.com/mystreamer/provision.git - Navigate to this directory.
- Set
system.stateVersioninprovision/machines/devnix/default.nixot the version in/etc/nixos/configuration.nix - Run:
nix flake update - Then
sudo nixos-rebuild switch --flake ".#devnix"
Use an nix-enabled machine to build the iso(-installer) image for the target-hardware.
A simple example how this is done can be found here.
Additional notes:
- If your nix-enabled machine (you're building from) does not have the same CPU-architecture, you may use github CI/CD to generate and download the image.
- You might need to prepend
sudoto most of the commands in the linked tutorial. - If you build the installer-image with flake enabled, you also must enable it when issuing the
nixos-installcommand.- This goes like this:
sudo nixos-install --option experimental-features "nix-command flakes"
- This goes like this:
Add the repo of the service to flake.nix.
Navigate to programs/service/git-services.nix and mkService it. Also make sure that you have the ports correctly set and each of the services has their own unique index (since that will be used to generate the NAT IP-addresses).
If github rate-limits you, generate a personal access token and set it with: export NIX_CONFIG="access-tokens = github.com=..."