aboutsummaryrefslogtreecommitdiff
path: root/pkgs/yo.nix
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-01-26 22:04:40 -0600
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-01-26 22:04:40 -0600
commitc81952cbcb6c6f1b41c2b6e2a366891991cceaee (patch)
tree5f3ca17c5c056a61a1aa996652bfe7643b3d276a /pkgs/yo.nix
parent90e48cf8b17139019c3849a8a1740d13f2a79791 (diff)
poor replacement for nh
Diffstat (limited to 'pkgs/yo.nix')
-rw-r--r--pkgs/yo.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/yo.nix b/pkgs/yo.nix
new file mode 100644
index 0000000..b98926a
--- /dev/null
+++ b/pkgs/yo.nix
@@ -0,0 +1,33 @@
+{pkgs, ...}: let
+ yo = pkgs.writeText "yo.lua" ''
+ local verb
+
+ local flags = {}
+ if arg[2] ~= nil then
+ for a = 2, #arg do
+ table.insert(flags, a)
+ end
+ end
+
+ if arg[1] == "deploy" or arg[1] == "dep" or arg[1] == "d" then
+ cmd = ("${pkgs.deploy-rs}/bin/deploy-rs --skip-checks %s -- --log-format internal-json |& ${pkgs.nix-output-monitor}/bin/nom --json"):format(table.concat(flags, " "))
+ print("+ "..cmd)
+ os.execute(cmd)
+ elseif arg[1] == "switch" or arg[1] == "sw" or arg[1] == "s" then
+ verb = "switch"
+ elseif arg[1] == "boot" or arg[1] == "b" then
+ verb = "boot"
+ elseif arg[1] == "test" or arg[1] == "t" then
+ verb = "test"
+ end
+
+ if verb then
+ cmd = ("run0 sh -c 'nixos-rebuild %s --flake /home/collin/nixos %s --log-format internal-json |& ${pkgs.nix-output-monitor}/bin/nom --json'"):format(verb, table.concat(flags, " "))
+ print("+ "..cmd)
+ os.execute(cmd)
+ end
+ '';
+in
+ pkgs.writeShellScriptBin "yo" ''
+ exec ${pkgs.lua}/bin/lua ${yo} "$@"
+ ''