Add cross-distribution OS package installers (Arch PKGBUILD, Debian control, RPM spec) and restructure tests.
Remove deprecated AUR and Ansible requirements installers. Introduce Nix init + wrapper scripts and full packaging (Arch/DEB/RPM). Associated conversation: https://chatgpt.com/share/693476a8-b9f0-800f-8e0c-ea5151295ce2
This commit is contained in:
48
scripts/init-nix.sh
Normal file
48
scripts/init-nix.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
echo ">>> Initializing Nix environment for package-manager..."
|
||||
|
||||
# 1. /nix Store
|
||||
if [ ! -d /nix ]; then
|
||||
echo ">>> Creating /nix store directory"
|
||||
mkdir -m 0755 /nix
|
||||
chown root:root /nix
|
||||
fi
|
||||
|
||||
# 2. nix-daemon aktivieren, falls vorhanden
|
||||
if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files | grep -q nix-daemon.service; then
|
||||
echo ">>> Enabling nix-daemon.service"
|
||||
systemctl enable --now nix-daemon.service 2>/dev/null || true
|
||||
else
|
||||
echo ">>> Warning: nix-daemon.service not found or systemctl not available."
|
||||
fi
|
||||
|
||||
# 3. Gruppe nix-users sicherstellen
|
||||
if ! getent group nix-users >/dev/null 2>&1; then
|
||||
echo ">>> Creating nix-users group"
|
||||
# Debian/RPM/Arch haben alle groupadd
|
||||
groupadd -r nix-users 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# 4. Benutzer zu nix-users hinzufügen (Best-Effort)
|
||||
|
||||
# a) Wenn loginctl vorhanden ist → alle eingeloggten User
|
||||
if command -v loginctl >/dev/null 2>&1; then
|
||||
for user in $(loginctl list-users | awk 'NR>1 {print $2}'); do
|
||||
if id "$user" >/dev/null 2>&1; then
|
||||
echo ">>> Adding user '$user' to nix-users"
|
||||
usermod -aG nix-users "$user" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
# b) Fallback: logname (typisch bei Debian)
|
||||
elif command -v logname >/dev/null 2>&1; then
|
||||
USERNAME="$(logname 2>/dev/null || true)"
|
||||
if [ -n "$USERNAME" ] && id "$USERNAME" >/dev/null 2>&1; then
|
||||
echo ">>> Adding user '$USERNAME' to nix-users"
|
||||
usermod -aG nix-users "$USERNAME" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ">>> Nix initialization for package-manager complete."
|
||||
echo ">>> You may need to log out and log back in to activate group membership."
|
||||
10
scripts/pkgmgr-wrapper.sh
Normal file
10
scripts/pkgmgr-wrapper.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Enable flakes if not already configured.
|
||||
if [[ -z "${NIX_CONFIG:-}" ]]; then
|
||||
export NIX_CONFIG="experimental-features = nix-command flakes"
|
||||
fi
|
||||
|
||||
# Run Kevin’s package manager via Nix flake
|
||||
exec nix run "github:kevinveenbirkenbach/package-manager#pkgmgr" -- "$@"
|
||||
Reference in New Issue
Block a user