summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-10-18 12:57:15 +0200
committerDaiderd Jordan <daiderd@gmail.com>2020-10-21 18:30:56 +0200
commit4a31cba84c50e01c3281053b5f2bcaa2a942f796 (patch)
treeea4f6ba9d1980dcec7cb4e63c4c872f95b2e8b1e /flake.nix
parentc4bc63d2b9c92cda312e72a6b9131d43c4201d02 (diff)
add flake versions
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index 204898c..191c5fb 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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 ];
});
};