nixos-edit: improve add cmd
This commit is contained in:
parent
75515431f8
commit
2638bb1644
2 changed files with 5 additions and 3 deletions
2
home.nix
2
home.nix
|
@ -40,8 +40,8 @@ in
|
|||
tcpdump
|
||||
hyfetch
|
||||
libreoffice
|
||||
(import ./traewelling.script.nix)
|
||||
#marker.pkgs.end#
|
||||
(import ./traewelling.script.nix)
|
||||
] ++ (with pkgs; [
|
||||
freecad
|
||||
nheko
|
||||
|
|
|
@ -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 .
|
||||
|
|
Loading…
Add table
Reference in a new issue