diff --git a/flake.nix b/flake.nix index 6845f6f..f143e1f 100644 --- a/flake.nix +++ b/flake.nix @@ -57,7 +57,9 @@ version = "${builtins.substring 0 4 self.lastModifiedDate}." + "${builtins.substring 4 2 self.lastModifiedDate}." - + "${builtins.substring 6 2 self.lastModifiedDate}-${shortRev}"; + + "${builtins.substring 6 2 self.lastModifiedDate}." + + "${builtins.substring 8 2 self.lastModifiedDate}." + + "${builtins.substring 10 2 self.lastModifiedDate}-${shortRev}"; in { nixosModules.default = { lib, ... }: { diff --git a/modules/host.nix b/modules/host.nix index 4c42b3d..6f8a1ab 100644 --- a/modules/host.nix +++ b/modules/host.nix @@ -468,7 +468,7 @@ in type = types.str; default = "dev"; description = '' - "YYYY.MM.DD-" reported by `hermenix version`. + "YYYY.MM.DD.hh.mm-" reported by `hermenix version`. `version` subcommand. Normally supplied for free by this flake's own `nixosModules.default` (from its git metadata) - the "dev" default here only shows up if this module is imported some other way. diff --git a/nu/host/migrate.nu b/nu/host/migrate.nu index a2a7af3..8f4414d 100644 --- a/nu/host/migrate.nu +++ b/nu/host/migrate.nu @@ -98,7 +98,7 @@ def "main migrate" [ # SAFETY: only ever reads from `source`; the original is never modified. def "main migrate connections" [ source: string # existing flat HERMES_HOME to copy from (read-only) - dest: string # destination HERMES_HOME folder; ignored when --to-guest is set + dest: string = "" # destination HERMES_HOME folder; not required when --to-guest is set --files: list = [config.yaml auth.json .env] # files (relative to HERMES_HOME) to copy --extra-dirs: list = [connections] # subdirectories to copy when present --rewrite-from: list = [host.docker.internal fwdesk.lab.internal castle.hub.internal] @@ -108,6 +108,11 @@ def "main migrate connections" [ --guest-user: string = "hermes" --guest-dest: string = "/var/lib/hermes" # destination inside the guest; only used with --to-guest ] { + mut to_guest = $to_guest + if $dest == "" { + $to_guest = true + note "no given — assuming --to-guest (streaming into the running guest)" + } if not ($source | path exists) { die $"source path does not exist: ($source)" } if ($rewrite_from | length) != ($rewrite_to | length) { die "--rewrite-from and --rewrite-to must have the same length" diff --git a/nu/lib/common.nu b/nu/lib/common.nu index 2fd74ed..396844d 100644 --- a/nu/lib/common.nu +++ b/nu/lib/common.nu @@ -62,8 +62,8 @@ def run-argv [argv: list] { # --------------------------------------------------------------- version --- # HERMENIX_VERSION is baked in at build time (flake.nix / modules/host.nix) -# as "YYYY.MM.DD-" from this repo's own git metadata. "dev" is -# only seen running an unwrapped checkout of the script directly. +# as "YYYY.MM.DD.hh.mm-" from this repo's own git metadata. "dev" +# is only seen running an unwrapped checkout of the script directly. def hermenix-version [] { $env.HERMENIX_VERSION? | default "dev" } diff --git a/nu/tests/common_test.nu b/nu/tests/common_test.nu index d76678a..d5e6fb2 100644 --- a/nu/tests/common_test.nu +++ b/nu/tests/common_test.nu @@ -32,7 +32,7 @@ def "hermenix-version defaults to dev when unset" [] { @test def "hermenix-version passes through when set" [] { - with-env { HERMENIX_VERSION: "2026.01.01-abc1234" } { - assert equal (hermenix-version) "2026.01.01-abc1234" + with-env { HERMENIX_VERSION: "2026.01.01.12.34-abc1234" } { + assert equal (hermenix-version) "2026.01.01.12.34-abc1234" } }