Initialize system during installation

This commit is contained in:
Manuel Thalmann 2024-10-31 22:55:33 +01:00
parent bfcd7be17f
commit 1047b5ed69
2 changed files with 26 additions and 2 deletions

View file

@ -2,6 +2,11 @@
begin begin
set -l dir (status dirname) 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 function getDeploymentScript -V dir
echo "$dir/../Scripts/deploy.fish" echo "$dir/../Scripts/deploy.fish"
end end

View file

@ -5,13 +5,32 @@ source "$dir/../Scripts/config.fish"
source "$dir/../Scripts/hooks.fish" source "$dir/../Scripts/hooks.fish"
if [ (id -u) -eq 0 ] 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 sudoConfig "/etc/sudoers.d/PortValhalla"
set -l channelDir /nix/var/nix/profiles/per-user/root/channels/nixpkgs
rm ~/.bash_profile rm ~/.bash_profile
if ! git status -C (status dirname) &> /dev/null
git config --system --add safe.directory (realpath "$(status dirname)/../../..")
end
if [ -z "$TMUX" ] 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 else
set -l name (getOSConfig setupUser.name)
begin begin
echo "Creating setup user" echo "Creating setup user"