This commit is contained in:
Morten Olsen
2023-09-21 22:45:30 +02:00
parent d783191931
commit a4432938df
4 changed files with 44 additions and 7 deletions

View File

@@ -1,7 +0,0 @@
name=$1
if [ -z "$name" ]; then
sudo nixos-rebuild switch --flake .
else
sudo nixos-rebuild switch --flake ".#$name"
fi

View File

@@ -4,6 +4,7 @@
imports = [
./locales.nix
./nix.nix
./network.nix
./security.nix
];

View File

@@ -2,4 +2,9 @@
{
networking.networkmanager.enable = true;
#
# environment.systemPackages = with pkgs; [ nfs-utils ];
# boot.initrd.kernelModules = [ "nfs" ];
# boot.initrd.supportedFilesystems = [ "nfs" ];
# services.rpcbind.enable = true;
}

38
os.sh Executable file
View File

@@ -0,0 +1,38 @@
ACTION=$1; shift
LOCATION=$PWD
function apply() {
name=$1
if [ -z "$name" ]; then
sudo nixos-rebuild switch --flake $LOCATION
else
sudo nixos-rebuild switch --flake "$LOCATION#$name"
fi
}
function upgrade() {
if git -C "$LOCATION" diff-index --quiet HEAD --; then
nix flake update --commit-lock-file "$LOCATION"
else
echo "Error: git working tree is dirty"
exit 1
fi
}
function cleanup() {
nix-collect-garbage -d
nixos-store --optimise
}
case $ACTION in
apply)
apply $1
;;
upgrade)
upgrade $1
;;
*)
echo "Usage: $0 {apply}"
exit 1
esac