Gen 423: Converted shell scripts into nix files

This commit is contained in:
pagedMov
2024-10-12 17:17:10 -04:00
parent a3614a0dc7
commit 07b2f5cab9
63 changed files with 252 additions and 500 deletions

View File

@@ -0,0 +1,36 @@
{ pkgs }:
{
homep = pkgs.writeShellScriptBin "homep" (''
#!/run/current-system/sw/bin/bash
# Ensure the package manifest is generated or updated
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
echo "Generating Nixpkgs manifest..."
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
fi
# Select packages using fzf with multi-select enabled
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
# Check if any packages were selected
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
# Append each selected package to the Nix config file
sed -i "/^\t]/i \ \t\t$package" "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix"
echo "Added $package to the Home Manager configuration."
done
echo "Packages added successfully. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
else
echo "No packages selected."
fi
'');
}