added nixp,nixr,homep, and homer commands for easily installing/removing packages from the system and home configs
This commit is contained in:
8
flake.lock
generated
8
flake.lock
generated
@@ -442,11 +442,11 @@
|
||||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728554473,
|
||||
"narHash": "sha256-wzVeYNRedx8aAi8NsUvBbPJAilozHp+mC49NUKYk73c=",
|
||||
"lastModified": 1728640579,
|
||||
"narHash": "sha256-jaUDVs2vKdLLC/NCgQahnFQHGHL6HmDrwLMfxKshj3M=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "b65773bea9b912a41cfcbc789fb2e60a07e3d0c1",
|
||||
"revCount": 5325,
|
||||
"rev": "d655a10381f01212635f2eadd69e1f22930f8f06",
|
||||
"revCount": 5326,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/hyprwm/Hyprland"
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
nixcommit = pkgs.writeShellScriptBin "nixcommit" (builtins.readFile ./scripts/nixcommit.sh);
|
||||
invoke = pkgs.writeShellScriptBin "invoke" (builtins.readFile ./scripts/invoke.sh);
|
||||
nsp = pkgs.writeShellScriptBin "nsp" (builtins.readFile ./scripts/nsp.sh);
|
||||
nixp = pkgs.writeShellScriptBin "nixp" (builtins.readFile ./scripts/nixp.sh);
|
||||
nixr = pkgs.writeShellScriptBin "nixr" (builtins.readFile ./scripts/nixr.sh);
|
||||
homep = pkgs.writeShellScriptBin "homep" (builtins.readFile ./scripts/homep.sh);
|
||||
homer = pkgs.writeShellScriptBin "homer" (builtins.readFile ./scripts/homer.sh);
|
||||
|
||||
|
||||
toggle_blur = pkgs.writeScriptBin "toggle_blur" (builtins.readFile ./scripts/toggle_blur.sh);
|
||||
@@ -47,6 +51,10 @@ in {
|
||||
nsp
|
||||
wall-change
|
||||
wallpaper-picker
|
||||
nixp
|
||||
nixr
|
||||
homep
|
||||
homer
|
||||
|
||||
runbg
|
||||
music
|
||||
|
||||
30
glasshouse-desktop/home/scripts/scripts/homep.sh
Executable file
30
glasshouse-desktop/home/scripts/scripts/homep.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/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
|
||||
24
glasshouse-desktop/home/scripts/scripts/homer.sh
Executable file
24
glasshouse-desktop/home/scripts/scripts/homer.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/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
|
||||
|
||||
|
||||
|
||||
30
glasshouse-desktop/home/scripts/scripts/nixp.sh
Executable file
30
glasshouse-desktop/home/scripts/scripts/nixp.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/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/sys/packages.nix"
|
||||
echo "Added $package to the Nix 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
|
||||
24
glasshouse-desktop/home/scripts/scripts/nixr.sh
Executable file
24
glasshouse-desktop/home/scripts/scripts/nixr.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/run/current-system/sw/bin/bash
|
||||
|
||||
selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/sys/packages.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/sys/packages.nix"
|
||||
echo "Removed $package from the Nix 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