nixos-edit: improve add cmd

This commit is contained in:
Daniella / Tove 2024-10-23 10:08:40 +02:00
parent 75515431f8
commit 2638bb1644
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 5 additions and 3 deletions

View file

@ -40,8 +40,8 @@ in
tcpdump
hyfetch
libreoffice
(import ./traewelling.script.nix)
#marker.pkgs.end#
(import ./traewelling.script.nix)
] ++ (with pkgs; [
freecad
nheko

View file

@ -88,7 +88,6 @@ pkgs.writeShellScriptBin "nixos-edit" ''
[ "$1" = "edit" ] ||
[ "$1" = "" ] ||
[ "$1" = "push" ] ||
[ "$1" = "add" ]
PUSH=$?
cd /etc/nixos
@ -100,7 +99,10 @@ pkgs.writeShellScriptBin "nixos-edit" ''
fi
if [ "$1" = "add" ] ; then
sed -i -E "s/#marker.pkgs.end#/$2\n #marker.pkgs.end#/" home.nix
git diff
git diff home.nix
sleep 0.5
git commit -m "pkgs.user: add $2" home.nix || exit 1
git push
fi
if [ $PUSH = 0 ] ; then
git add .