update, improve scripts and add update script

This commit is contained in:
ChaotiCryptidz 2021-12-25 17:32:14 +00:00
parent 3e8483ddd1
commit 3b4867d58f
4 changed files with 37 additions and 13 deletions

View file

@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1640328990, "lastModified": 1640418986,
"narHash": "sha256-KQbvJx4qO9bo04tfTZuISyY4vRC5k3ZB3lyLS21XWIw=", "narHash": "sha256-a8GGtxn2iL3WAkY5H+4E0s3Q7XJt6bTOvos9qqxT5OQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ab93217a2b74a1c36bc892c14f44ee5959c33f12", "rev": "5c37ad87222cfc1ec36d6cd1364514a9efc2f7f2",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -x
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
FIRST_ARG="${1:-switch}"
shift
nixos-rebuild --flake "${SCRIPT_DIR}#$(hostname)" ${FIRST_ARG} $@

17
scripts/rebuild.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
REPO_ROOT="${SCRIPT_DIR}/.."
cd $REPO_ROOT
# re-run as root
if [ "$EUID" -ne 0 ]; then
sudo ${BASH_SOURCE[0]} $@
exit
fi
FIRST_ARG="${1:-switch}"
shift
nixos-rebuild --flake "${REPO_ROOT}#$(hostname)" ${FIRST_ARG} $@

17
scripts/update.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
REPO_ROOT="${SCRIPT_DIR}/.."
cd $REPO_ROOT
# re-run as root
if [ "$EUID" -ne 0 ]; then
sudo ${BASH_SOURCE[0]} $@
exit
fi
FIRST_ARG="${1:-switch}"
shift
nix flake update