-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
154 lines (138 loc) · 4.39 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
description = "My NixOS configuration as a flake.";
nixConfig = {
extra-substituters = [
"https://cache.garnix.io"
];
extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
impermanence.url = "github:nix-community/impermanence/master";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs:
let
systems = [
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = inputs.nixpkgs.lib.genAttrs systems;
in
{
devShells = forAllSystems (system:
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.self.overlays.default
inputs.sops-nix.overlays.default
];
};
in
{
default = pkgs.mkShell {
name = "nixfiles";
buildInputs = with pkgs; [
git
nixVersions.latest
sops
age
ssh-to-age
nixpkgs-fmt
opentofu
generate-hostnames
jq
];
};
});
nixosConfigurations =
let
baseModules = [
inputs.home-manager.nixosModules.home-manager
inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops
./profiles/core.nix
./profiles/upgrade.nix
{
home-manager.useGlobalPkgs = true;
}
];
in
{
hazuno_m_0px_xyz = inputs.nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
pkgs = import inputs.nixpkgs {
inherit system;
config = { allowUnfree = true; };
overlays = [ inputs.self.overlays.default ];
};
modules = baseModules ++ [
./hosts/hazuno
];
specialArgs.inputs = inputs;
};
ipsmin_m_0px_xyz = inputs.nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
pkgs = import inputs.nixpkgs {
inherit system;
config = { allowUnfree = true; };
overlays = [ inputs.self.overlays.default ];
};
modules = baseModules ++ [
./hosts/ipsmin
];
specialArgs.inputs = inputs;
};
nelvte_m_0px_xyz = inputs.nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
pkgs = import inputs.nixpkgs {
inherit system;
config = { allowUnfree = true; };
overlays = [ inputs.self.overlays.default ];
};
modules = baseModules ++ [
./hosts/nelvte
];
specialArgs.inputs = inputs;
};
};
overlays.default = import ./pkgs;
checks = forAllSystems (system:
let
nixpkgsFor = system: inputs.nixpkgs.legacyPackages.${system};
pkgs = nixpkgsFor system;
in
{
"lint/deadnix" = pkgs.runCommand "lint.deadnix" { } ''
cd ${./.}
${pkgs.deadnix}/bin/deadnix --fail --hidden && touch $out
'';
"lint/editorconfig-checker" = pkgs.runCommand "lint.editorconfig-checker" { } ''
cd ${./.}
${pkgs.editorconfig-checker}/bin/editorconfig-checker && touch $out
'';
"lint/gitleaks" = pkgs.runCommand "lint.gitleaks" { } ''
cd ${./.}
${pkgs.gitleaks}/bin/gitleaks detect --verbose --no-git --redact && touch $out
'';
"lint/nixpkgs-fmt" = pkgs.runCommand "lint.nixpkgs-fmt" { } ''
cd ${./.}
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check . | tee $out
'';
"lint/statix" = pkgs.runCommand "lint.statix" { } ''
cd ${./.}
${pkgs.statix}/bin/statix check && touch $out
'';
"lint/tofu-fmt" = pkgs.runCommand "lint.tofu-fmt" { } ''
cd ${./.}
${pkgs.opentofu}/bin/tofu fmt -check -recursive -diff && touch $out
'';
});
};
}