-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
135 lines (112 loc) · 3.59 KB
/
flake.nix
File metadata and controls
135 lines (112 loc) · 3.59 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
{
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/4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9";
nixos-hardware.url = "github:NixOS/nixos-hardware";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-utils = {
url = "github:numtide/flake-utils";
};
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";
flake-utils.follows = "flake-utils";
};
};
};
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";
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;
};
};
}
// inputs.flake-utils.lib.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
];
};
ci = pkgs.mkShell {
packages = [
pkgs.nix-fast-build
];
};
};
}
);
}