mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
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:
@@ -1,20 +1,15 @@
|
|||||||
# - ## Nixy
|
# - ## 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` - 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, ... }:
|
||||||
pkgs,
|
let
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
configDirectory = config.var.configDirectory;
|
configDirectory = config.var.configDirectory;
|
||||||
hostname = config.var.hostname;
|
|
||||||
|
|
||||||
nixy =
|
nixy = pkgs.writeShellScriptBin "nixy"
|
||||||
pkgs.writeShellScriptBin "nixy"
|
|
||||||
# bash
|
# bash
|
||||||
''
|
''
|
||||||
function exec() {
|
function exec() {
|
||||||
@@ -27,7 +22,7 @@
|
|||||||
# "icon;name;command"[]
|
# "icon;name;command"[]
|
||||||
apps=(
|
apps=(
|
||||||
";Rebuild;nixy rebuild"
|
";Rebuild;nixy rebuild"
|
||||||
";Upgrade;nixy upgrade"
|
";Test;nixy test"
|
||||||
";Update;nixy update"
|
";Update;nixy update"
|
||||||
";Collect Garbage;nixy gc"
|
";Collect Garbage;nixy gc"
|
||||||
";Clean Boot Menu;nixy cb"
|
";Clean Boot Menu;nixy cb"
|
||||||
@@ -54,10 +49,9 @@
|
|||||||
[[ $1 == "" ]] && ui
|
[[ $1 == "" ]] && ui
|
||||||
|
|
||||||
if [[ $1 == "rebuild" ]];then
|
if [[ $1 == "rebuild" ]];then
|
||||||
cd ${configDirectory} && git add .
|
cd ${configDirectory} && git add . && sudo nixos-rebuild switch --flake
|
||||||
sudo nixos-rebuild switch --flake ${configDirectory}#${hostname}
|
elif [[ $1 == "test" ]];then
|
||||||
elif [[ $1 == "upgrade" ]];then
|
cd ${configDirectory} && git add . && sudo nixos-rebuild test --flake
|
||||||
sudo nixos-rebuild switch --upgrade --flake '${configDirectory}#${hostname}'
|
|
||||||
elif [[ $1 == "update" ]];then
|
elif [[ $1 == "update" ]];then
|
||||||
cd ${configDirectory} && nix flake update
|
cd ${configDirectory} && nix flake update
|
||||||
elif [[ $1 == "gc" ]];then
|
elif [[ $1 == "gc" ]];then
|
||||||
@@ -71,4 +65,4 @@
|
|||||||
echo "Unknown argument"
|
echo "Unknown argument"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
in {home.packages = [nixy];}
|
in { home.packages = [ nixy ]; }
|
||||||
|
|||||||
Reference in New Issue
Block a user