Create a common install script
This commit is contained in:
parent
b43c8ae947
commit
84f0e8e1c5
5 changed files with 52 additions and 1 deletions
5
profiles/ManuSurface/Arch/install.fish
Executable file
5
profiles/ManuSurface/Arch/install.fish
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../../scripts/Arch/OS/install.fish"
|
||||
end
|
|
@ -8,7 +8,7 @@ begin
|
|||
end
|
||||
|
||||
function getInstallerScript -V dir -S
|
||||
echo "$dir/install.sh"
|
||||
echo "$dir/install.fish"
|
||||
end
|
||||
|
||||
CONFIG_MODULE="$(status dirname)/config.nix" \
|
||||
|
|
3
scripts/Arch/OS/install.fish
Normal file
3
scripts/Arch/OS/install.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/env fish
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Common/OS/install.fish"
|
36
scripts/Common/OS/install.fish
Normal file
36
scripts/Common/OS/install.fish
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/env fish
|
||||
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"
|
||||
end
|
||||
|
||||
if [ (id -u) -eq 0 ]
|
||||
set -l name (getConfig valhalla.setupUser.name)
|
||||
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
||||
|
||||
runHook createUser || \
|
||||
begin
|
||||
useradd \
|
||||
--comment "PortValhalla setup user" \
|
||||
--system \
|
||||
--no-user-group \
|
||||
--groups wheel \
|
||||
--create-home \
|
||||
--uid (getConfig valhalla.setupUser.id --json) \
|
||||
"$name"
|
||||
end
|
||||
|
||||
and begin
|
||||
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
|
||||
end > "$sudoConfig"
|
||||
|
||||
and sudo --preserve-env="CONFIG_MODULE" --user "$name" "$INSTALLER_SCRIPT"
|
||||
rm "$sudoConfig"
|
||||
else
|
||||
|
||||
end
|
|
@ -22,6 +22,13 @@ begin
|
|||
and runHook setupOS || true
|
||||
and runHook autologin || true
|
||||
|
||||
# Copy `nixpkgs` channel
|
||||
and begin
|
||||
set -l channelDir /nix/var/nix/profiles/per-user/root/channels/nixpkgs
|
||||
mkdir -p (dirname "$mountDir/$channelDir")
|
||||
cp -r "$channelDir" "$mountDir/$channelDir"
|
||||
end
|
||||
|
||||
and begin
|
||||
set -l script (string escape (getCloneFile (getInstallerScript)))
|
||||
printf %s\n \
|
||||
|
|
Loading…
Reference in a new issue