-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathflake.nix
89 lines (77 loc) · 2.17 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
87
88
89
{
description = "🍁 Generate infrastructure and network diagrams directly from your NixOS configurations";
inputs = {
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
};
outputs = {
self,
devshell,
flake-utils,
nixpkgs,
pre-commit-hooks,
...
} @ inputs:
{
flakeModule = ./flake-module.nix;
# Expose NixOS module
nixosModules.topology = ./nixos/module.nix;
nixosModules.default = self.nixosModules.topology;
# A nixpkgs overlay that adds the parametrized builder as a package
overlays.default = self.overlays.topology;
overlays.topology = import ./pkgs/default.nix;
}
// flake-utils.lib.eachDefaultSystem (system: rec {
pkgs = import nixpkgs {
inherit system;
overlays = [
self.overlays.default
devshell.overlays.default
];
};
packages.docs = pkgs.callPackage ./pkgs/docs.nix {
flakeInputs = inputs;
flakeOutputs = self;
};
# `nix flake check`
checks.pre-commit-hooks = pre-commit-hooks.lib.${system}.run {
src = nixpkgs.lib.cleanSource ./.;
hooks = {
# Nix
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
};
};
# `nix develop`
devShells.default = pkgs.devshell.mkShell {
name = "nix-topology";
commands = [
{
package = pkgs.alejandra;
category = "formatters";
}
{
package = pkgs.deadnix;
category = "linters";
}
{
package = pkgs.statix;
category = "linters";
}
];
devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-hooks.shellHook;
};
# `nix fmt`
formatter = pkgs.alejandra;
});
}