diff options
| author | outremonde <outremonde@vivaldi.net> | 2025-06-10 20:32:00 -0400 |
|---|---|---|
| committer | outremonde <outremonde@vivaldi.net> | 2025-06-10 20:32:00 -0400 |
| commit | 9786eb8672213344d8d1b7bdef12bc94510b20db (patch) | |
| tree | b7d79440800c92d32187ab32c636b0830c94a610 /pkgs/setup-manager | |
initialized repository
Former-commit-id: 84647f22b951a957b2b83885b612115d473f6626
Diffstat (limited to 'pkgs/setup-manager')
| -rw-r--r-- | pkgs/setup-manager/default.nix | 17 | ||||
| -rw-r--r-- | pkgs/setup-manager/setup.nu | 55 |
2 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/setup-manager/default.nix b/pkgs/setup-manager/default.nix new file mode 100644 index 0000000..2d0f08c --- /dev/null +++ b/pkgs/setup-manager/default.nix @@ -0,0 +1,17 @@ +{ + pkgs, + lib, +}: let + path = with pkgs; [ + nvd + nix-output-monitor + ]; +in + pkgs.writers.writeNuBin "setup" { + makeWrapperArgs = [ + "--prefix" + "PATH" + ":" + "${lib.makeBinPath path}" + ]; + } (builtins.readFile ./setup.nu) diff --git a/pkgs/setup-manager/setup.nu b/pkgs/setup-manager/setup.nu new file mode 100644 index 0000000..46ab637 --- /dev/null +++ b/pkgs/setup-manager/setup.nu @@ -0,0 +1,55 @@ +# Aims of this program: +# +# Subcommands: +# - sync system {system name?}: rebuild system +# - sync user {home name?}: rebuild home +# - sync all {system @ home name?}: rebuild home and system +# - update: update the flake +# - vm {system name}: create and run a test vm +# - repl: open a nix repl with flake inputs +# - gc {what to remove?}: collect garbage + +# Settings +let flake_dir = "~/Sync/setup/" | path expand + +def "main" [] {} + +# +-------------------------+ +# | Syncronization Commands | +# +-------------------------+ + +# Syncronize the system with its config. +def "main sync system" [ + sys?: string # The name of the system config to syncronize. +] { + if ($sys == null) {let sys = (hostname)} + sudo nixos-rebuild switch --flake $"($flake_dir)#($sys)" +} + +# Syncronize the userland with its config. +def "main sync user" [ + usr?: string # The name of the user config to syncronize. +] {} + +# Syncronize both the system and the userland with their configs. +def "main sync all" [ + usr_sys?: string # The name of the user and system configs to syncronize. In the format "user@system". +] {} + +# +----------------+ +# | Other Commands | +# +----------------+ + +# Update the flake lock file according to its inputs. +def "main update" [] {} + +# Create and run a test VM based on a system config. +def "main vm" [ + sys: string # The system config to base the VM on. +] {} + +# Open a nix REPL including flake inputs. +def "main repl" [] {} + +# Garbage collect the system. +def "main gc" [] {} |
