mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
@@ -5,13 +5,19 @@
|
||||
#- - `nixy` - UI wizard to manage the system.
|
||||
#- - `nixy rebuild` - Rebuild the system.
|
||||
#- - `nixy ...` - ... see the script for more commands.
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
configDirectory = config.var.configDirectory;
|
||||
|
||||
nixy = pkgs.writeShellScriptBin "nixy"
|
||||
nixy =
|
||||
pkgs.writeShellScriptBin "nixy"
|
||||
# bash
|
||||
''
|
||||
EXTRA_ARGS="''${@:2}"
|
||||
|
||||
function exec() {
|
||||
$@
|
||||
}
|
||||
@@ -49,11 +55,11 @@ let
|
||||
[[ $1 == "" ]] && ui
|
||||
|
||||
if [[ $1 == "rebuild" ]];then
|
||||
cd ${configDirectory} && git add . && sudo nixos-rebuild switch --flake
|
||||
cd ${configDirectory} && git add . && sudo nixos-rebuild switch --flake . $EXTRA_ARGS
|
||||
elif [[ $1 == "test" ]];then
|
||||
cd ${configDirectory} && git add . && sudo nixos-rebuild test --flake
|
||||
cd ${configDirectory} && git add . && sudo nixos-rebuild test --flake . $EXTRA_ARGS
|
||||
elif [[ $1 == "update" ]];then
|
||||
cd ${configDirectory} && nix flake update
|
||||
cd ${configDirectory} && nix flake update $EXTRA_ARGS
|
||||
elif [[ $1 == "gc" ]];then
|
||||
echo "Starting Nix garbage collection..."
|
||||
cd ${configDirectory} && \
|
||||
@@ -74,4 +80,4 @@ let
|
||||
echo "Unknown argument"
|
||||
fi
|
||||
'';
|
||||
in { home.packages = [ nixy ]; }
|
||||
in {home.packages = [nixy];}
|
||||
|
||||
Reference in New Issue
Block a user