mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-28 02:37:09 +00:00
add flake versions
This commit is contained in:
parent
c4bc63d2b9
commit
4a31cba84c
2 changed files with 32 additions and 6 deletions
18
flake.nix
18
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 ];
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -59,6 +59,12 @@ in
|
|||
description = "The full darwin version (e.g. <literal>darwin4.master</literal>).";
|
||||
};
|
||||
|
||||
system.darwinVersionSuffix = mkOption {
|
||||
internal = true;
|
||||
type = types.str;
|
||||
description = "The short darwin version suffix (e.g. <literal>.2abdb5a</literal>).";
|
||||
};
|
||||
|
||||
system.darwinRevision = mkOption {
|
||||
internal = true;
|
||||
type = types.str;
|
||||
|
@ -78,6 +84,12 @@ in
|
|||
description = "The full nixpkgs version (e.g. <literal>16.03.1160.f2d4ee1</literal>).";
|
||||
};
|
||||
|
||||
system.nixpkgsVersionSuffix = mkOption {
|
||||
internal = true;
|
||||
type = types.str;
|
||||
description = "The short nixpkgs version suffix (e.g. <literal>.1160.f2d4ee1</literal>).";
|
||||
};
|
||||
|
||||
system.nixpkgsRevision = mkOption {
|
||||
internal = true;
|
||||
type = types.str;
|
||||
|
@ -89,12 +101,14 @@ in
|
|||
|
||||
# These defaults are set here rather than up there so that
|
||||
# changing them would not rebuild the manual
|
||||
system.darwinLabel = "${cfg.nixpkgsVersion}+${cfg.darwinVersion}";
|
||||
system.darwinVersion = "darwin" + toString cfg.stateVersion + "." + darwin.shortRev;
|
||||
system.darwinLabel = mkDefault "${cfg.nixpkgsVersion}+${cfg.darwinVersion}";
|
||||
system.darwinVersion = mkDefault "darwin${toString cfg.stateVersion}${cfg.darwinVersionSuffix}";
|
||||
system.darwinVersionSuffix = mkDefault ".${darwin.shortRev}";
|
||||
system.darwinRevision = mkIf (darwin ? rev) (mkDefault darwin.rev);
|
||||
|
||||
system.nixpkgsVersion = mkDefault (cfg.nixpkgsRelease + nixpkgsSuffix);
|
||||
system.nixpkgsVersion = mkDefault "${cfg.nixpkgsRelease}${cfg.nixpkgsVersionSuffix}";
|
||||
system.nixpkgsRelease = mkDefault (fileContents releaseFile);
|
||||
system.nixpkgsVersionSuffix = mkDefault nixpkgsSuffix;
|
||||
system.nixpkgsRevision = mkIf (nixpkgs ? rev) (mkDefault nixpkgs.rev);
|
||||
|
||||
assertions = [ { assertion = cfg.stateVersion <= defaultStateVersion; message = "system.stateVersion = ${toString cfg.stateVersion}; is not a valid value"; } ];
|
||||
|
|
Loading…
Add table
Reference in a new issue