mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-09-11 12:49:18 +03:00
add flake and split evalConfig
This commit is contained in:
parent
849d527a15
commit
c4bc63d2b9
41
eval-config.nix
Normal file
41
eval-config.nix
Normal file
@ -0,0 +1,41 @@
|
||||
{ lib, system ? builtins.currentSystem or "x86_64-darwin" }:
|
||||
|
||||
{ modules
|
||||
, inputs
|
||||
, baseModules ? import ./modules/module-list.nix
|
||||
, specialArgs ? {}
|
||||
}@args:
|
||||
|
||||
let
|
||||
inputsModule = {
|
||||
_file = ./eval-config.nix;
|
||||
config = {
|
||||
_module.args.inputs = inputs;
|
||||
};
|
||||
};
|
||||
|
||||
pkgsModule = { config, inputs, ... }: {
|
||||
_file = ./eval-config.nix;
|
||||
config = {
|
||||
_module.args.pkgs = import inputs.nixpkgs config.nixpkgs;
|
||||
nixpkgs.system = system;
|
||||
};
|
||||
};
|
||||
|
||||
eval = lib.evalModules (builtins.removeAttrs args ["inputs"] // {
|
||||
modules = modules ++ [ inputsModule pkgsModule ] ++ baseModules;
|
||||
args = { inherit baseModules modules; };
|
||||
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;
|
||||
});
|
||||
|
||||
# Was moved in nixpkgs #82751, so both need to be handled here until 20.03 is deprecated.
|
||||
# https://github.com/NixOS/nixpkgs/commits/dcdd232939232d04c1132b4cc242dd3dac44be8c
|
||||
_module = eval._module or eval.config._module;
|
||||
in
|
||||
|
||||
{
|
||||
inherit (_module.args) pkgs;
|
||||
inherit (eval) options config;
|
||||
|
||||
system = eval.config.system.build.toplevel;
|
||||
}
|
25
flake.lock
Normal file
25
flake.lock
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1602411953,
|
||||
"narHash": "sha256-gbupmxRpoQZqL5NBQCJN2GI5G7XDEHHHYKhVwEj5+Ps=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f780534ea2d0c12e62607ff254b6b45f46653f7a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
28
flake.nix
Normal file
28
flake.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
# WARNING this is very much still experimental.
|
||||
description = "A collection of darwin modules";
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
|
||||
lib = {
|
||||
# TODO handle multiple architectures.
|
||||
evalConfig = import ./eval-config.nix { inherit (nixpkgs) lib; };
|
||||
|
||||
darwinSystem = { modules, inputs ? {}, ... }@args: self.lib.evalConfig (args // {
|
||||
inputs = { inherit nixpkgs; darwin = self; } // inputs;
|
||||
modules = modules ++ [
|
||||
];
|
||||
});
|
||||
};
|
||||
|
||||
darwinModules.lnl = import ./modules/examples/lnl.nix;
|
||||
darwinModules.simple = import ./modules/examples/simple.nix;
|
||||
darwinModules.ofborg = import ./modules/examples/ofborg.nix;
|
||||
darwinModules.hydra = import ./modules/examples/hydra.nix;
|
||||
|
||||
checks.x86_64-darwin.simple = (self.lib.darwinSystem {
|
||||
modules = [ self.darwinModules.simple ];
|
||||
}).system;
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user