aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/nixos-system.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/nixos-system.sh')
-rw-r--r--nixos/modules/nixos-system.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/modules/nixos-system.sh b/nixos/modules/nixos-system.sh
new file mode 100644
index 0000000..7a220bb
--- /dev/null
+++ b/nixos/modules/nixos-system.sh
@@ -0,0 +1,27 @@
+#!@shell@
+# Simple script handy to be used for activation
+
+while getopts "s" opt; do
+ case "$opt" in
+ s)
+ if [ ! -v NIXOS_SYSTEM_GNU_SCREEN ]; then
+ export NIXOS_SYSTEM_GNU_SCREEN=1
+ exec @out@/sw/bin/screen "$0" "$@"
+ fi
+ ;;
+ *)
+ echo "Invalid argument: $1" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
+@out@/sw/bin/nix-env --profile /nix/var/nix/profiles/system --set '@out@'
+
+@out@/bin/switch-to-configuration "$@" || {
+ echo "Switch failed!" >&2
+ read -r _
+ exit 1
+}