-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
185 lines (157 loc) · 5.98 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
description = "A collection of my system configs and dotfiles.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-23-11.url = "github:NixOS/nixpkgs/nixos-23.11";
# some commit containing mysql57 and php74
nixpkgs-22-05.url = "github:NixOS/nixpkgs/695b3515251873e0a7e2021add4bba643c56cde3";
# one commit before jq 1.7 update
nixpkgs-jq-1-6.url = "github:NixOS/nixpkgs/b17d6431b00f4e002a0599e3f780bcfc525ebc3e";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:t184256/nix-on-droid";
inputs.home-manager.follows = "home-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-formatter-pack.follows = "nix-formatter-pack";
inputs.nmd.follows = "nix-formatter-pack/nmd";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
agenix-cli = {
url = "github:cole-h/agenix-cli";
inputs.nixpkgs.follows = "nixpkgs";
};
homeage = {
url = "github:jordanisaacs/homeage";
inputs.nixpkgs.follows = "nixpkgs";
};
dmenu = {
url = "github:Gerschtli/dmenu";
inputs.nixpkgs.follows = "nixpkgs";
};
dwm = {
url = "github:Gerschtli/dwm";
inputs.nixpkgs.follows = "nixpkgs";
};
dwm-status = {
url = "github:Gerschtli/dwm-status";
inputs.nixpkgs.follows = "nixpkgs";
};
teamspeak-update-notifier = {
url = "github:Gerschtli/teamspeak-update-notifier";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-formatter-pack = {
url = "github:Gerschtli/nix-formatter-pack";
inputs.nixpkgs.follows = "nixpkgs";
};
nixGL = {
url = "github:guibou/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "agenix-cli/flake-utils";
};
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
};
outputs = { self, nixpkgs, nix-formatter-pack, ... } @ inputs:
let
rootPath = self;
forEachSystem = nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-linux" ];
flakeLib = import ./flake {
inherit inputs rootPath forEachSystem;
};
formatterPackArgsFor = forEachSystem (system: {
inherit nixpkgs system;
checkFiles = [ self ];
config.tools = {
deadnix = {
enable = true;
noLambdaPatternNames = true;
};
nixpkgs-fmt.enable = true;
statix = {
enable = true;
disabledLints = [ "repeated_keys" ];
};
};
});
inherit (nixpkgs.lib) listToAttrs;
inherit (flakeLib) mkApp mkDevShellJdk mkDevShellPhp mkHome mkNixOnDroid mkNixos;
in
{
homeConfigurations = listToAttrs [
(mkHome "x86_64-linux" "tobias@gamer")
(mkHome "aarch64-darwin" "tobiashapp@bwpm-FP2CYXKY2V")
(mkHome "aarch64-darwin" "tobiashapp@R2026")
];
nixOnDroidConfigurations = listToAttrs [
(mkNixOnDroid "aarch64-linux" "pixel7a")
];
nixosConfigurations = listToAttrs [
(mkNixos "aarch64-linux" "argon")
(mkNixos "x86_64-linux" "krypton")
(mkNixos "x86_64-linux" "neon")
(mkNixos "aarch64-linux" "xenon")
];
apps = forEachSystem (system: listToAttrs [
(mkApp system "nixos-shell" {
file = ./files/apps/nixos-shell.sh;
path = pkgs: with pkgs; [ nixos-shell gawk jq git ];
})
(mkApp system "setup" {
file = ./files/apps/setup.sh;
path = pkgs: with pkgs; [ coreutils curl git gnugrep hostname jq nix openssh ];
envs._doNotClearPath = true;
})
]);
checks = forEachSystem (system: {
nix-formatter-pack-check = nix-formatter-pack.lib.mkCheck formatterPackArgsFor.${system};
});
# use like:
# $ direnv-init jdk11
# $ lorri-init jdk11
devShells = forEachSystem (system: listToAttrs [
(mkDevShellJdk system "jdk8" { jdk = pkgs: pkgs.jdk8; })
(mkDevShellJdk system "jdk11" { jdk = pkgs: pkgs.jdk11; })
(mkDevShellJdk system "jdk17" { jdk = pkgs: pkgs.jdk17; })
(mkDevShellJdk system "jdk21" { jdk = pkgs: pkgs.jdk21; })
(mkDevShellPhp system "php74" { phpVersion = "74"; })
(mkDevShellPhp system "php74-composer1" { phpVersion = "74"; composer1 = true; })
(mkDevShellPhp system "php80" { phpVersion = "80"; })
(mkDevShellPhp system "php81" { phpVersion = "81"; })
(mkDevShellPhp system "php82" { phpVersion = "82"; })
]);
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});
nixosModules.nixos-shell-vm = import ./files/nix/nixos-shell-vm.nix rootPath;
packages =
let
cachixSpecBuilder = pkgs: spec: pkgs.writeText "cachix-deploy.json" (builtins.toJSON spec);
cachixDeployOutput = builder: name: module: {
${module.pkgs.system}."cachix-deploy-spec-${name}" = cachixSpecBuilder module.pkgs {
agents.${name} = builder module;
};
};
cachixDeployOutputNixos = cachixDeployOutput (module: module.config.system.build.toplevel);
in
nixpkgs.lib.foldl
nixpkgs.lib.recursiveUpdate
{
aarch64-linux = {
rpi-firmware = import ./files/nix/rpi-firmware.nix { inherit nixpkgs; };
rpi-image = import ./files/nix/rpi-image.nix { inherit nixpkgs rootPath; };
};
x86_64-linux.installer-image = import ./files/nix/installer-image.nix { inherit nixpkgs; };
}
(nixpkgs.lib.mapAttrsToList cachixDeployOutputNixos self.nixosConfigurations);
};
}