diff --git a/scripts/Arch/OS/install.fish b/scripts/Arch/OS/install.fish index 53f6cdea..1c7703b1 100755 --- a/scripts/Arch/OS/install.fish +++ b/scripts/Arch/OS/install.fish @@ -2,6 +2,11 @@ begin set -l dir (status dirname) + function installValhallaDeps -V dir + source "$dir/../Scripts/software.fish" + and pacinst fish git jq nix sudo tmux + end + function getDeploymentScript -V dir echo "$dir/../Scripts/deploy.fish" end diff --git a/scripts/Common/OS/install.fish b/scripts/Common/OS/install.fish index 5a5a816a..0f34dad8 100755 --- a/scripts/Common/OS/install.fish +++ b/scripts/Common/OS/install.fish @@ -5,13 +5,32 @@ source "$dir/../Scripts/config.fish" source "$dir/../Scripts/hooks.fish" if [ (id -u) -eq 0 ] - set -l name (getOSConfig setupUser.name) + set -l nixVersion nixos-24.05 set -l sudoConfig "/etc/sudoers.d/PortValhalla" + set -l channelDir /nix/var/nix/profiles/per-user/root/channels/nixpkgs rm ~/.bash_profile + if ! git status -C (status dirname) &> /dev/null + git config --system --add safe.directory (realpath "$(status dirname)/../../..") + end + if [ -z "$TMUX" ] - tmux new-session $cmdline + if [ -z "$CONFIG_NAME" ] + selectProfile config + and set -x CONFIG_NAME "$config" + end + + if [ ! -d "$channelDir" ] + mkdir -p "$channelDir" + and git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixVersion" "$channelDir" + and rm -rf "$channelDir/.git" + end + + and runHook --force installValhallaDeps 'Please set up a function `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix`, `sudo` and `tmux`.' + and tmux new-session $cmdline else + set -l name (getOSConfig setupUser.name) + begin echo "Creating setup user"