-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
53 lines (47 loc) · 1.46 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
description = "Environments tailored to your projects' needs";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-anywhere = {
url = "github:numtide/nixos-anywhere";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs @ { self, nixpkgs, ... }:
let
nixpkgs-lib = nixpkgs.lib;
conch-lib = import ./lib.nix { inherit nixpkgs-lib; };
systems = [
"aarch64-darwin"
"riscv64-linux"
"x86_64-darwin"
"x86_64-linux"
];
loadModule = module: system:
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ ];
};
in
conch-lib.mkFlake {
inherit system pkgs;
userModule = module;
extraArgs = { inherit pkgs inputs system; };
};
# @todo: migrate to lib.recursiveUpdate
# also nixpkgs' lib is available through nixpkgs.lib; there's no need to import it
load = systems: module: builtins.foldl'
nixpkgs-lib.recursiveUpdate
{ }
(map (loadModule module) systems);
#load = systems: module: fold [ "devShell" "formatter" ] (loadModule module) systems;
in
{
inherit load;
templates = builtins.mapAttrs
(name: _: rec { path = ./templates + "/${name}"; description = (import "${path}/flake.nix").description; })
(builtins.readDir ./templates);
} // load systems ({ pkgs, system, ... }: { });
}