-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
181 lines (166 loc) · 5.54 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
{
description = "pmc's Nix system configuration";
inputs = {
flake-utils = { url = github:numtide/flake-utils; };
nixpkgs = { url = github:nixos/nixpkgs/nixpkgs-unstable; };
nixpkgs-master = { url = github:nixos/nixpkgs; };
nixpkgs-piper-bootstrap = { url = github:piperswe/nixpkgs/piper/bootstrap-ppc64le-and-sparc64; };
nur = {
url = github:nix-community/nur;
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = github:lnl7/nix-darwin;
inputs.nixpkgs.follows = "nixpkgs";
};
hydra = {
url = github:nixos/hydra;
inputs.nixpkgs.follows = "nixpkgs";
};
gitignore = {
url = github:github/gitignore;
flake = false;
};
fish-theme-sushi = {
url = github:umayr/theme-sushi;
flake = false;
};
fish-rbenv = {
url = github:piperswe/fish-rbenv/patch-1;
flake = false;
};
nixos-hardware.url = github:nixos/nixos-hardware;
};
outputs = inputs:
let
context = inputs // inputs.self // { root = ./.; };
inherit (context)
packages
homeConfigurations
nixosConfigurations
overlay overlays
darwinConfigurations
flake-utils nixpkgs home-manager nur;
inherit (context.lib) nixpkgs-for-system supported-platforms;
in
{
lib = import ./lib context;
homeConfigurations = import ./homeConfigurations context;
rawHomeConfigurations = import ./homeConfigurations/raw.nix context;
homeModules = import ./homeModules context;
nixosConfigurations = import ./nixosConfigurations context;
nixosModules = import ./nixosModules context;
darwinConfigurations = import ./darwinConfigurations context;
darwinModules = import ./darwinModules context;
packages = import ./packages context;
devShells = context.packages;
apps = builtins.listToAttrs (builtins.map
(system: {
name = system;
value = {
update-machine = flake-utils.lib.mkApp {
drv = packages.${system}.update-machine;
};
};
})
supported-platforms.hydra);
overlay = import ./packages/overlay.nix context;
overlays = [ nur.overlay overlay ];
hydraJobs = {
packages = nixpkgs.lib.mapAttrs
(system: packages:
let
pkgs = import (nixpkgs-for-system system) {
inherit system overlays;
config.allowUnfree = true;
};
in
nixpkgs.lib.mapAttrs (packageName: package: pkgs.${packageName}) packages)
packages;
nixosConfigurations = nixpkgs.lib.mapAttrs
(name: value:
let
inherit (value.config.system) build;
getFallbacks = (fallbacks:
let
attr = builtins.head fallbacks;
in
if fallbacks == [ ]
then { }
else if build ? ${attr}
then build.${attr}
else getFallbacks (builtins.tail fallbacks));
in
getFallbacks [
"toplevel"
# # From github:nix-community/nix-generators
# "amazonImage"
# "azureImage"
# "cloudstackImage"
# "digitalOceanImage"
# "googleComputeImage"
# "hypervImage"
# "isoImage"
# "kexec_bundle"
# "kexec_tarball"
# "metadata"
# "tarball"
# "novaImage"
# "openstackImage"
# "qcow"
# "raw"
# "sdImage"
# "vagrantVirtualbox"
# "virtualBoxOVA"
# "vmwareImage"
# # Last because all configurations generate this
# "vm"
])
nixosConfigurations;
darwinConfigurations = nixpkgs.lib.mapAttrs (name: value: value.system) darwinConfigurations;
homeConfigurations =
let
buildHome = (configuration: system:
let pkgs = import (nixpkgs-for-system system) {
inherit system overlays;
config.allowUnfree = true;
};
in
{
base = (home-manager.lib.homeManagerConfiguration {
inherit configuration system pkgs;
homeDirectory = "/home/pmc";
username = "pmc";
}).config.home.activationPackage;
gui = (home-manager.lib.homeManagerConfiguration {
inherit configuration system pkgs;
extraModules = [{ withGUI = true; }];
homeDirectory = "/home/pmc";
username = "pmc";
}).config.home.activationPackage;
});
in
nixpkgs.lib.mapAttrs
(name: value:
(builtins.listToAttrs
(builtins.map
(system: {
name = system;
value = buildHome value system;
})
supported-platforms.hydra)))
homeConfigurations;
checks = (builtins.listToAttrs
(builtins.map
(system: {
name = system;
value = import ./checks context system;
})
supported-platforms.hydra));
} // (import ./hydraJobs context);
};
}