Gen 426: Shell script nix files work properly now
This commit is contained in:
29
glasshouse-desktop/home/scripts/homer.nix
Normal file
29
glasshouse-desktop/home/scripts/homer.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{ self, pkgs }:
|
||||
|
||||
|
||||
pkgs.writeShellScriptBin "homer" (''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
|
||||
selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix" | sed '1d;$d' | fzf -m)
|
||||
|
||||
if [ -n "$selected_packages" ]; then
|
||||
echo "$selected_packages" | while read -r package; do
|
||||
sed -i "/\b$package\b/d" "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix"
|
||||
echo "Removed $package from the Home Manager configuration."
|
||||
done
|
||||
|
||||
echo "Removed packages. Rebuild system config?"
|
||||
select yn in "Yes" "No"; do
|
||||
case $yn in
|
||||
"Yes" ) nixswitch;break;;
|
||||
"No" ) exit;;
|
||||
esac
|
||||
done
|
||||
|
||||
else
|
||||
echo "No packages removed."
|
||||
fi
|
||||
|
||||
|
||||
|
||||
'')
|
||||
Reference in New Issue
Block a user