2020-08-16 08:33:44 +00:00
USER := foo-dogsquared
HOST := zilch
HOME := /home/$( USER)
DOTS := /etc/dotfiles
NIXOS_VERSION := 20.03
NIXOS_PREFIX := $( PREFIX) /etc/nixos
FLAGS := -I " config= $$ (pwd)/config " \
-I " modules= $$ (pwd)/modules " \
-I " bin= $$ (pwd)/bin " \
$( FLAGS)
config : $( NIXOS_PREFIX ) /configuration .nix
home : $( HOME ) /dotfiles
2020-08-18 16:48:02 +00:00
# The channels will be used on certain modules like in `packages/default.nix` where it will be referred to install certain packages from the unstable channel.
2020-08-16 08:33:44 +00:00
channels :
2020-08-18 16:48:02 +00:00
@sudo nix-channel --add " https://nixos.org/channels/nixos- ${ NIXOS_VERSION } " nixos
@sudo nix-channel --add "https://nixos.org/channels/nixos-unstable" nixos-unstable
@sudo nix-channel --add " https://github.com/rycee/home-manager/archive/release- ${ NIXOS_VERSION } .tar.gz " home-manager
@sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
2020-08-16 08:33:44 +00:00
update :
@sudo nix-channel --update
switch :
@sudo nixos-rebuild $( FLAGS) switch
install : channels update
2020-08-18 16:48:02 +00:00
@sudo nixos-generate-config --root " $( PREFIX) " && sudo cp --update " $( NIXOS_PREFIX) /hardware-configuration.nix " " $$ (pwd)/hosts/ $( HOST) /hardware-configuration.nix "
@echo " import \" $( DOTS) \" \" $( HOST) \" \" $$ {USER}\" " | sudo tee " ${ NIXOS_PREFIX } /configuration.nix "
2020-08-16 08:33:44 +00:00
@sudo nixos-install --root " $( PREFIX) " $( FLAGS)
@sudo rm -r " $( PREFIX) /etc/dotfiles " && sudo cp -r " $( DOTS) " " $( PREFIX) /etc/dotfiles "
@sudo nixos-enter --root " $( PREFIX) " -c chown $( USER) :users $( DOTS)
upgrade : update switch
2020-08-24 15:56:31 +00:00
rollback :
@sudo nix-env --rollback