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