diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2020-10-18 12:57:15 +0200 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2020-10-21 18:30:56 +0200 |
| commit | 4a31cba84c50e01c3281053b5f2bcaa2a942f796 (patch) | |
| tree | ea4f6ba9d1980dcec7cb4e63c4c872f95b2e8b1e /flake.nix | |
| parent | c4bc63d2b9c92cda312e72a6b9131d43c4201d02 (diff) | |
add flake versions
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -2,7 +2,20 @@ # WARNING this is very much still experimental. description = "A collection of darwin modules"; - outputs = { self, nixpkgs }: { + outputs = { self, nixpkgs }: + let + versionsModule = { lib, ... }: { + _file = ./flake.nix; + config = { + system.darwinVersionSuffix = ".${nixpkgs.shortRev or "dirty"}"; + system.darwinRevision = lib.mkIf (self ? rev) self.rev; + + system.nixpkgsVersionSuffix = ".${lib.substring 0 8 (nixpkgs.lastModifiedDate or nixpkgs.lastModified or "19700101")}.${nixpkgs.shortRev or "dirty"}"; + system.nixpkgsRevision = lib.mkIf (nixpkgs ? rev) nixpkgs.rev; + }; + }; + in + { lib = { # TODO handle multiple architectures. @@ -10,8 +23,7 @@ darwinSystem = { modules, inputs ? {}, ... }@args: self.lib.evalConfig (args // { inputs = { inherit nixpkgs; darwin = self; } // inputs; - modules = modules ++ [ - ]; + modules = modules ++ [ versionsModule ]; }); }; |
