From fff236b4eac7152d384016fb34aefc0abcf96a73 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sat, 19 Oct 2024 02:39:35 +0200 Subject: [PATCH] better install process --- README.md | 7 +++++++ init.sh | 26 ++++++++++++++++++++++++++ nixos-edit.script.nix | 6 ++++++ 3 files changed, 39 insertions(+) create mode 100644 init.sh diff --git a/README.md b/README.md index 0dfc1c2..5fdb34f 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,13 @@ nix-shell -p git rm configuration.nix cd /mnt/etc/nixos git clone https://git.tudbut.de/tudbut/nix-setup +pushd nix-setup ; mv $(ls -a) .. ; popd exit +bash init.sh nixos-install ``` + +on the install: +```sh +nixos-edit init +``` diff --git a/init.sh b/init.sh new file mode 100644 index 0000000..4df11b7 --- /dev/null +++ b/init.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +echo this is meant to be run from the iso!!! +if [ -e "/mnt/etc/nixos" ] ; then + echo "iso detected. continue!" +else + echo "you don't appear to be in the install iso." + echo -n "are you SURE??? (y/N) " + read sure + if ! [ "$sure" = "y" ] ; then + echo "ok. exiting." + exit 0 + fi + echo "i will continue." +fi + +echo "setting up channels:" +echo deleting old +nix-channel --remove nixos +echo adding os channel +nix-channel --add "https://channels.nixos.org/nixos-unstable" nixos +echo adding pkgs channel +nix-channel --add "https://channels.nixos.org/nixpkgs-unstable" nixpkgs +echo updating +nix-channel --update +echo "all set." diff --git a/nixos-edit.script.nix b/nixos-edit.script.nix index 1f43fc6..44c4e96 100644 --- a/nixos-edit.script.nix +++ b/nixos-edit.script.nix @@ -3,6 +3,12 @@ with import {}; pkgs.writeShellScriptBin "nixos-edit" '' #!/bin/sh + if [ "$1" = "init" ] ; then + sudo chown -R tudbut: /etc/nixos + echo dir setup done + exit 0 + fi + cd /etc/nixos if [ "$1" = "pull" ] ; then git pull