feat: implement package post install script

This commit is contained in:
xeruf 2023-03-09 02:07:36 +01:00
parent be524472a9
commit dfc2b448cf
4 changed files with 14 additions and 10 deletions

View File

@ -6,7 +6,7 @@ self="$(realpath "$0")"
globalconfigdir=/etc/xdg
case "$XDG_CONFIG_DIRS" in
(""|*$configdir*);;
(""|*$globalconfigdir*);;
(*) globalconfigdir=$(echo $XDG_CONFIG_DIRS | cut -d: -f1);;
esac
@ -88,6 +88,7 @@ installpkg() {
fi
destress " $pkg_entry"
$pkg_entry
find ${dir_package} -name "post" -o -name "post_${base}" -exec {} \; | sed 's/^/ /'
)
set +e
break

0
packages/nix/arch Normal file
View File

View File

@ -1,9 +0,0 @@
#!/bin/sh -e
# See https://wiki.archlinux.org/title/Nix
sudo usermod -aG nix-users $USER
nix-env --install
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
test -f /etc/nix/nix.conf || echo "max-jobs = auto
trusted-users = root $USER" | sudo dd of=/etc/nix/nix.conf status=none
sudo systemctl enable --now nix-daemon

12
packages/nix/post_arch Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh -ex
# See https://wiki.archlinux.org/title/Nix
sudo usermod -aG nix-users $USER
sudo chown -R root:nix-users /nix
sudo chmod g+w /nix
sudo -u janek sh -c '
nix-env --install
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update'
test -f /etc/nix/nix.conf || echo "max-jobs = auto
trusted-users = root $USER" | sudo dd of=/etc/nix/nix.conf status=none
sudo systemctl enable --now nix-daemon