aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2026-01-03 20:19:33 +0000
committerDavid Morgan <djm_uk@protonmail.com>2026-01-03 20:19:33 +0000
commit4b4aab8dd1ba0c92da2d52efd96ec475b48b7b98 (patch)
tree5e083ad9e65911c64ac005598e68f3bbfefd69df
parent095f7d324fc0f0973158e565042b97a924626244 (diff)
downloaddotfiles-wip-nix-plugins.tar.gz
Fix setup script for working with rage and doaswip-nix-plugins
-rwxr-xr-xsetup-system.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/setup-system.sh b/setup-system.sh
index 4242a16..d7b0914 100755
--- a/setup-system.sh
+++ b/setup-system.sh
@@ -17,22 +17,27 @@ export NIX_CONFIG="experimental-features = nix-command flakes"
if [ $USE_NIX_PLUGINS -eq 1 ]; then
NIX_PLUGINS="$(nix build --no-link --print-out-paths "$NIX_CONF_DIR#nix-plugins")"
EXTRA_BUILTINS="$(nix store add-file "$NIX_CONF_DIR/nix-plugins/extra-builtins.nix")"
- export NIX_CONFIG="$NIX_CONFIG
-plugin-files = $NIX_PLUGINS/lib/nix/plugins
-extra-builtins-file = $EXTRA_BUILTINS"
+ export NIX_CONFIG="${NIX_CONFIG}
+plugin-files = ${NIX_PLUGINS}/lib/nix/plugins
+extra-builtins-file = ${EXTRA_BUILTINS}"
fi
if [ -x "$(command -v nixos-version)" ]; then
ln -sf $NIX_CONF_DIR /etc/nixos
- nixos-rebuild switch --sudo
+ if [ ! -f /etc/doas.conf ]; then
+ su -c "printf '%s\n' 'permit nopass keepenv $USER as root cmd rage' > /etc/doas.conf && chmod 0400 /etc/doas.conf"
+ fi
+
+
+ nix shell nixpkgs#doas nixpkgs#rage --command nixos-rebuild switch --sudo
else
[ -x "$(command -v nix)" ] || sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install)
if [ "$(uname 2> /dev/null)" = "Darwin" ]; then
ln -sf $NIX_CONF_DIR /etc/nix-darwin
-
- sudo nix run nix-darwin/master#darwin-rebuild -- switch
+ # TODO could this be improved by turning it into a single nix invocation?
+ nix shell nixpkgs#rage --command sudo nix run nix-darwin/master#darwin-rebuild -- switch
fi
fi