From a3fea2f5cc8525d5cca2c38f481dddc83a8e3070 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 16 Jul 2024 22:17:07 +0200 Subject: [PATCH] Configure nix during setup --- scripts/Arch/OS/setup.fish | 2 +- scripts/Common/OS/install.fish | 10 ++++------ scripts/Common/Software/nix/main.fish | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 scripts/Common/Software/nix/main.fish diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 2c5d0165..c72a87e4 100644 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -86,7 +86,7 @@ begin and arch-chroot "$mountDir" mkinitcpio -P and runHook installDrivers "Installing drivers..." || true - and pacstrap -K "$mountDir" fish jq nix tmux + and runInOS fish "$tempDir/../../Common/Software/nix/main.fish" configure user and arch-chroot "$mountDir" bash "$tempDir/../Software/sudo/install.sh" and arch-chroot "$mountDir" bash "$tempDir/../Software/GRUB/install.sh" diff --git a/scripts/Common/OS/install.fish b/scripts/Common/OS/install.fish index e15d9107..6f494dc8 100644 --- a/scripts/Common/OS/install.fish +++ b/scripts/Common/OS/install.fish @@ -3,14 +3,12 @@ set -l dir (status dirname) source "$dir/../Scripts/config.fish" source "$dir/../Scripts/hooks.fish" -function copyNixConfig -V dir - set -l configFile ~/.config/nix/nix.conf - mkdir -p (dirname "$configFile") - cp "$dir/../../../archiso/airootfs/root/.config/nix/nix.conf" "$configFile" +function configureNix -V dir + source "$dir/../Software/nix/main.fish" configure user end if [ (id -u) -eq 0 ] - copyNixConfig + configureNix set -l name (getConfig valhalla.setupUser.name) set -l sudoConfig "/etc/sudoers.d/PortValhalla" @@ -34,7 +32,7 @@ if [ (id -u) -eq 0 ] rm "$sudoConfig" userdel -r "$name" else - copyNixConfig + configureNix source "$dir/../Software/bash/main.fish" runHook initialize || true runHook installDrivers || true diff --git a/scripts/Common/Software/nix/main.fish b/scripts/Common/Software/nix/main.fish new file mode 100644 index 00000000..2850973c --- /dev/null +++ b/scripts/Common/Software/nix/main.fish @@ -0,0 +1,15 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../../Scripts/software.fish" + + function configureSW -V dir -a scope + if [ "$scope" = "user" ] + set -l configFile ~/.config/nix/nix.conf + mkdir -p (dirname "$configFile") + cp "$dir/../../../../archiso/airootfs/root/.config/nix/nix.conf" "$configFile" + end + end + + runInstaller $argv +end