changed nixy from having an upgrade to a test option

This allows you to test the configuration without building it, where as
upgrade is useless with flakes (and can be confusing with update)

Signed-off-by: Purin <118902463+Dylouwu@users.noreply.github.com>
This commit is contained in:
Purin
2025-08-25 15:12:35 +02:00
parent b98af7060b
commit f70a139bd7

View File

@@ -1,20 +1,15 @@
# - ## Nixy
#-
#- Nixy is a simple script that I use to manage my NixOS system. It's a simple script that provides a menu to rebuild, upgrade, update, collect garbage, clean boot menu, etc.
#- Nixy is a simple script that I use to manage my NixOS system. It's a simple script that provides a menu to rebuild, test, update, collect garbage, clean boot menu, etc.
#-
#- - `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;
hostname = config.var.hostname;
nixy =
pkgs.writeShellScriptBin "nixy"
nixy = pkgs.writeShellScriptBin "nixy"
# bash
''
function exec() {
@@ -27,7 +22,7 @@
# "icon;name;command"[]
apps=(
"󰑓;Rebuild;nixy rebuild"
"󰦗;Upgrade;nixy upgrade"
"󰐊;Test;nixy test"
"󰚰;Update;nixy update"
";Collect Garbage;nixy gc"
"󰍜;Clean Boot Menu;nixy cb"
@@ -54,10 +49,9 @@
[[ $1 == "" ]] && ui
if [[ $1 == "rebuild" ]];then
cd ${configDirectory} && git add .
sudo nixos-rebuild switch --flake ${configDirectory}#${hostname}
elif [[ $1 == "upgrade" ]];then
sudo nixos-rebuild switch --upgrade --flake '${configDirectory}#${hostname}'
cd ${configDirectory} && git add . && sudo nixos-rebuild switch --flake
elif [[ $1 == "test" ]];then
cd ${configDirectory} && git add . && sudo nixos-rebuild test --flake
elif [[ $1 == "update" ]];then
cd ${configDirectory} && nix flake update
elif [[ $1 == "gc" ]];then
@@ -71,4 +65,4 @@
echo "Unknown argument"
fi
'';
in {home.packages = [nixy];}
in { home.packages = [ nixy ]; }