Add script to update system and user

This commit is contained in:
2022-01-07 19:03:31 +00:00
parent 189ef03e81
commit e2925966a0
3 changed files with 24 additions and 6 deletions

12
flake.lock generated
View File

@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1639329010, "lastModified": 1641459437,
"narHash": "sha256-k9OXwR06419/s0FAnRalUs24+8EI6GepGaatAXhBc+0=", "narHash": "sha256-z0IOcc6LLbVhyri/aTyWzRqJs3p1pBK9idOiMwCWiqs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "3d46c011d2cc2c9ca24d9b803e9daf156d9429ea", "rev": "c751aeb19e84a0a777f36fd5ea73482a066bb406",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -57,11 +57,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1639256808, "lastModified": 1641528457,
"narHash": "sha256-RRKWi6grwe5lioKUyfZNQ4ojc5kjUTX55fPNzsGH2PY=", "narHash": "sha256-FyU9E63n1W7Ql4pMnhW2/rO9OftWZ37pLppn/c1aisY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e675946ecde5606c505540de2024e2732bae4185", "rev": "ff377a78794d412a35245e05428c8f95fef3951f",
"type": "github" "type": "github"
}, },
"original": { "original": {

13
scripts/aupdate Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
if [ "$UID" -ne 0 ]; then
sudo true # Prompt user for password so it doesn't happen in the middle of the script
fi
pushd ~/.dotfiles
nix flake update
sudo nixos-rebuild switch --flake .#
hn=$(hostname)
home-manager switch --flake .#daniel-$hn
popd

View File

@@ -63,6 +63,11 @@
source = ../../scripts/update; source = ../../scripts/update;
executable = true; executable = true;
}; };
"bin/aupdate" = {
source = ../../scripts/aupdate;
executable = true;
};
}; };
packages = with pkgs; [ packages = with pkgs; [