summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorMichael Hoang <Enzime@users.noreply.github.com>2023-07-23 18:16:13 +1000
committerGitHub <noreply@github.com>2023-07-23 18:16:13 +1000
commit0f9058e739dbefc676dee557b4b627962268d556 (patch)
tree62416fb844ce82f4e7ff1c54d1b52824d24c8eff /modules/system
parentced9f58f874606f39a8dd301827e774e90707f10 (diff)
parent0dafe2170deb6a691255cecc212af4b1cdf8297b (diff)
Merge pull request #733 from Enzime/version
Add `darwin-version` command
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/default.nix8
-rw-r--r--modules/system/version.nix6
2 files changed, 13 insertions, 1 deletions
diff --git a/modules/system/default.nix b/modules/system/default.nix
index af90ada..0eb46a9 100644
--- a/modules/system/default.nix
+++ b/modules/system/default.nix
@@ -96,6 +96,12 @@ in
activationUserScript = cfg.activationScripts.userScript.text;
inherit (cfg) darwinLabel;
+ darwinVersionJson = (pkgs.formats.json {}).generate "darwin-version.json" (
+ filterAttrs (k: v: v != null) {
+ inherit (config.system) darwinRevision nixpkgsRevision configurationRevision darwinLabel;
+ }
+ );
+
buildCommand = ''
mkdir $out
@@ -129,7 +135,7 @@ in
echo -n "$systemConfig" > $out/systemConfig
- echo -n "$darwinLabel" > $out/darwin-version
+ ln -s $darwinVersionJson $out/darwin-version.json
echo -n "$system" > $out/system
${cfg.systemBuilderCommands}
diff --git a/modules/system/version.nix b/modules/system/version.nix
index e45f667..3effb50 100644
--- a/modules/system/version.nix
+++ b/modules/system/version.nix
@@ -108,6 +108,12 @@ in
else lib.trivial.revisionWithDefault null;
description = lib.mdDoc "The nixpkgs git revision from which this configuration was built.";
};
+
+ system.configurationRevision = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = lib.mdDoc "The Git revision of the top-level flake from which this configuration was built.";
+ };
};
config = {