-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
86 lines (84 loc) · 2.27 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
description = "A flake providing Nix/OS dns utilities";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
flake-compat,
systems,
treefmt-nix,
}:
let
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in
{
nixosModules = rec {
dns = import ./modules/nixos.nix { inherit (self) utils; };
default = dns;
};
utils = import ./utils { inherit (nixpkgs) lib; };
lib =
pkgs:
import ./lib.nix {
inherit pkgs;
inherit (nixpkgs) lib;
inherit (self) utils;
};
# __unfix__ and extend are filtered because of the fix point stuff. generate is filtered because it needs special architecture dependent treatment.
tests =
nixpkgs.lib.mapAttrs
(
name: v:
import "${./utils}/tests/${name}.nix" {
inherit self;
inherit (nixpkgs) lib;
inherit (self) utils;
}
)
(
builtins.removeAttrs self.utils [
"__unfix__"
"extend"
"generate"
]
);
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bind
glow
mdbook
nix-unit
nixdoc
statix
nixfmt-rfc-style
];
};
});
packages = eachSystem (pkgs: {
docs = import ./docs {
inherit (self) utils;
inherit (pkgs) lib;
inherit pkgs;
};
});
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
templates = {
default = {
path = ./example;
description = "A simple Nix/OS dns example";
welcomeText = ''
A simple Nix/OS dns example
'';
};
};
};
}