mirror of
https://github.com/morten-olsen/nixos-config.git
synced 2026-02-08 00:36:27 +01:00
update
This commit is contained in:
7
apply.sh
7
apply.sh
@@ -1,7 +0,0 @@
|
||||
name=$1
|
||||
|
||||
if [ -z "$name" ]; then
|
||||
sudo nixos-rebuild switch --flake .
|
||||
else
|
||||
sudo nixos-rebuild switch --flake ".#$name"
|
||||
fi
|
||||
@@ -4,6 +4,7 @@
|
||||
imports = [
|
||||
./locales.nix
|
||||
./nix.nix
|
||||
./network.nix
|
||||
./security.nix
|
||||
];
|
||||
|
||||
|
||||
@@ -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
38
os.sh
Executable 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
|
||||
Reference in New Issue
Block a user