-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
166 lines (141 loc) · 4.28 KB
/
Copy pathflake.nix
File metadata and controls
166 lines (141 loc) · 4.28 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
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
{
description = "ipetkov's nixos configs";
inputs = {
# Use the nixos-unstable channel for all of our configurations, even on non-NixOS
# systems. The nixpkgs-unstable branch tends to break a bit more often than
# nixos-unstable, so trying this out to see if things are a bit smoother. Also, it is
# nice having the exact same application versions across all machines rather than
# mixing and matching branches.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Pinned because deploying to rpi is slow as molasses due to SD card I/O being crap
nixpkgs-for-rpi.url = "github:NixOS/nixpkgs/9fbb54b33e91ee4ca368e35a78e0613c720600b3";
nixos-hardware = {
url = "github:NixOS/nixos-hardware";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
home-manager = {
url = "github:nix-community/home-manager";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
nixos-pibox = {
url = "github:ipetkov/nixos-pibox";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
};
};
};
nixConfig.extra-substituters = [
"https://ipetkov.cachix.org"
];
outputs =
inputs@{ self, ... }:
let
inherit (inputs.nixpkgs) lib legacyPackages;
myPkgs = self.packages;
myLib = import ./lib {
inherit inputs lib myPkgs;
};
inherit (myLib) mkHost;
systemLinux = "x86_64-linux";
systemLinuxArm = "aarch64-linux";
eachSystem =
systems: f:
let
# Merge together the outputs for all systems.
op =
attrs: system:
let
ret = f system;
op =
attrs: key:
attrs
// {
${key} = (attrs.${key} or { }) // {
${system} = ret.${key};
};
};
in
builtins.foldl' op attrs (builtins.attrNames ret);
in
builtins.foldl' op { } systems;
eachDefaultSystem = eachSystem [
systemLinux
systemLinuxArm
];
in
{
homeManagerModules.default = import ./homeManagerModules/default.nix;
homeConfigurations = { };
nixosModules.default = import ./nixosModules/default.nix;
nixosConfigurations = {
asphodel = mkHost {
system = systemLinuxArm;
rootConfig = ./nixosConfigurations/asphodel;
};
elysium = mkHost {
system = systemLinux;
rootConfig = ./nixosConfigurations/elysium;
};
erebus = mkHost {
system = systemLinux;
rootConfig = ./nixosConfigurations/erebus;
includeHomeManager = true;
};
rpi = mkHost {
system = systemLinuxArm;
rootConfig = ./nixosConfigurations/rpi;
nixpkgs = inputs.nixpkgs-for-rpi;
};
tartarus = mkHost {
system = systemLinux;
rootConfig = ./nixosConfigurations/tartarus;
includeHomeManager = true;
};
};
}
// eachDefaultSystem (
system:
let
pkgs = legacyPackages.${system};
packages = lib.filterAttrs (_: pkg: builtins.any (x: x == system) pkg.meta.platforms) (
import ./pkgs { inherit pkgs; }
);
checksForConfigs =
configs: extract:
lib.attrsets.filterAttrs (_: p: p.system == system) (lib.attrsets.mapAttrs (_: extract) configs);
formatter = pkgs.nixfmt-tree;
in
{
inherit formatter packages;
checks = lib.lists.foldl lib.attrsets.unionOfDisjoint packages [
(checksForConfigs self.homeConfigurations (hm: hm.activationPackage))
(checksForConfigs self.nixosConfigurations (c: c.config.system.build.toplevel))
];
devShells = {
default = pkgs.mkShell {
packages = [
formatter
pkgs.zizmor
];
};
ci = pkgs.mkShell {
packages = [
pkgs.nix-fast-build
];
};
zizmor = pkgs.mkShell {
packages = [
pkgs.zizmor
];
};
};
}
);
}