nixos-edit: command for adding packages
This commit is contained in:
parent
b1ea84e3ad
commit
42ddb11d3c
2 changed files with 10 additions and 1 deletions
1
home.nix
1
home.nix
|
@ -41,6 +41,7 @@ in
|
|||
hyfetch
|
||||
libreoffice
|
||||
(import ./traewelling.script.nix)
|
||||
#marker.pkgs.end#
|
||||
] ++ (with pkgs; [
|
||||
freecad
|
||||
nheko
|
||||
|
|
|
@ -14,6 +14,7 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
echo " - update -- update the system"
|
||||
echo " - clean -- does housekeeping"
|
||||
echo " - init -- initialize the system (only run once)"
|
||||
echo " - add -- installs a package"
|
||||
echo
|
||||
echo "edit is the default mode."
|
||||
exit 0
|
||||
|
@ -84,7 +85,10 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
exit
|
||||
fi
|
||||
|
||||
[ "$1" = "edit" ] || [ "$1" = "" ] || [ "$1" = "push" ]
|
||||
[ "$1" = "edit" ] ||
|
||||
[ "$1" = "" ] ||
|
||||
[ "$1" = "push" ] ||
|
||||
[ "$1" = "add" ]
|
||||
PUSH=$?
|
||||
|
||||
cd /etc/nixos
|
||||
|
@ -94,6 +98,10 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
if [ "$1" = "edit" ] || [ "$1" = "" ] || [ "$1" = "test" ] ; then
|
||||
sudo hx .
|
||||
fi
|
||||
if [ "$1" = "add" ] ; then
|
||||
sed -i -E "s/#marker.pkgs.end#/$2\n #marker.pkgs.end#" home.nix
|
||||
git diff
|
||||
fi
|
||||
if [ $PUSH = 0 ] ; then
|
||||
git add .
|
||||
EDITOR=hx git commit -a || exit
|
||||
|
|
Loading…
Add table
Reference in a new issue