forked from nlewo/comin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
85 lines (81 loc) · 2.61 KB
/
flake.nix
File metadata and controls
85 lines (81 loc) · 2.61 KB
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
{
description = "Comin - GitOps for NixOS Machines";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
inputs.flake-compat = {
url = "github:NixOS/flake-compat";
flake = false;
};
outputs =
{
self,
nixpkgs,
treefmt-nix,
flake-compat,
}:
let
systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
optionsDocFor = forAllSystems (
system: import ./nix/module-options-doc.nix (nixpkgsFor."${system}")
);
treefmtStack = forAllSystems (
system:
treefmt-nix.lib.evalModule nixpkgsFor.${system} {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.nixfmt.package = nixpkgsFor.${system}.nixfmt;
}
);
in
{
overlays.default = final: prev: {
comin = final.callPackage ./nix/package.nix { };
};
formatter = forAllSystems (system: treefmtStack.${system}.config.build.wrapper);
packages = forAllSystems (system: {
comin = nixpkgsFor."${system}".callPackage ./nix/package.nix { };
default = self.packages."${system}".comin;
generate-module-options = optionsDocFor."${system}".optionsDocCommonMarkGenerator;
});
checks = forAllSystems (system: {
module-options-doc = optionsDocFor."${system}".checkOptionsDocCommonMark;
# I don't understand why nix flake check does't build packages.default
package = self.packages."${system}".comin;
formatting = treefmtStack.${system}.config.build.check self;
lint = import ./nix/lint.nix {
pkgs = nixpkgsFor."${system}";
comin = self.packages."${system}".comin;
};
});
nixosModules.comin = nixpkgs.lib.modules.importApply ./nix/module.nix { inherit self; };
darwinModules.comin = nixpkgs.lib.modules.importApply ./nix/darwin-module.nix { inherit self; };
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
nativeBuildInputs = [ treefmtStack.${system}.config.build.wrapper ];
buildInputs = with pkgs; [
go
godef
gopls
golangci-lint
protobuf
protoc-gen-go
protoc-gen-go-grpc
buf
];
};
}
);
};
}