#!/bin/sh -ex
# See https://wiki.archlinux.org/title/Nix
sudo usermod -aG nix-users $USER
sudo chown -R root:nix-users /nix
sudo chmod g+w /nix
sudo -u janek sh -c '
	nix-env --install
	nix-channel --add https://nixos.org/channels/nixpkgs-unstable
	nix-channel --update'
test -f /etc/nix/nix.conf || echo "max-jobs = auto
	trusted-users = root $USER" | sudo dd of=/etc/nix/nix.conf status=none
sudo systemctl enable --now nix-daemon
