-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
175 lines (171 loc) · 6.57 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
{
description = "anthr76 Flakes";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
gomod2nix.url = "github:nix-community/gomod2nix";
gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
hardware.url = "github:nixos/nixos-hardware";
sops-nix.url = "github:mic92/sops-nix";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# SSH Agent
nixpkgs-pr-169155.url =
"github:nixos/nixpkgs?ref=2f0d2186cf8c98279625db83b527b1091107c61c";
# TODO: Document this PR
nixpkgs-pr-269415.url =
"github:nixos/nixpkgs?ref=f4e7e4a19bb2ec8738caf0154ca2943776fca32b";
jovian-nixos.url = "github:Jovian-Experiments/Jovian-NixOS";
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
nix-github-actions.url = "github:nix-community/nix-github-actions";
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-flatpak.url = "github:gmodena/nix-flatpak";
};
outputs = { self, disko, gomod2nix, nix-darwin, nixpkgs, nixpkgs-unstable, home-manager, chaotic, hardware
, jovian-nixos, nix-github-actions, nix-flatpak, ... }@inputs:
let
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs systems (system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
gomod2nix.overlays.default
];
});
withPrefix = prefix:
lib.mapAttrs' (name: value: {
# Also remove special characters
name = lib.replaceStrings [ "." "@" ] [ "_" "_" ] "${prefix}${name}";
inherit value;
});
in {
githubActions = nix-github-actions.lib.mkGithubMatrix {
# aarch64-linux is not supported by GitHub
checks = nixpkgs.lib.getAttrs [ "x86_64-linux" ] self.checks;
attrPrefix = "";
};
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; });
overlays = import ./overlays { inherit inputs outputs; };
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
nixosConfigurations = {
"bkp1" = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./nixos/hosts/bkp1
chaotic.nixosModules.default
];
};
"octo" = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
chaotic.nixosModules.default
./nixos/hosts/octo
];
};
"f80" = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
chaotic.nixosModules.default
nix-flatpak.nixosModules.nix-flatpak
./nixos/hosts/f80
];
};
"lattice" = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
chaotic.nixosModules.default
hardware.nixosModules.framework-16-7040-amd
./nixos/hosts/lattice
];
};
"fw1-nwk3" = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./nixos/hosts/fw1-nwk3
chaotic.nixosModules.default
];
};
"fw1-nwk2" = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./nixos/hosts/fw1-nwk2
chaotic.nixosModules.default
];
};
};
homeConfigurations = {
"anthony@bkp1" = lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./home-manager/hosts/bkp1.nix ];
};
"steam@octo" = lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./home-manager/hosts/octo.nix ];
};
"anthony@f80" = lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./home-manager/hosts/f80.nix ];
};
"anthony@lattice" = lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./home-manager/hosts/f80.nix ];
};
"anthony@nicoles-mbp" = lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-darwin;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./home-manager/hosts/nicoles-mbp.nix ];
};
"anthony@generic" = lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./home-manager/hosts/generic.nix ];
};
};
darwinConfigurations = {
"nicoles-mbp" = nix-darwin.lib.darwinSystem {
modules = [
nix-darwin/hosts/nicoles-mbp
];
pkgs = pkgsFor.x86_64-darwin;
specialArgs = { inherit inputs outputs; };
};
};
# Run `nix flake check`
checks = forEachSystem (pkgs:
# add all the supported packages to checks
(withPrefix "pkgs-"
(lib.filterAttrs (_: x: lib.elem pkgs.system x.meta.platforms)
self.packages.${pkgs.system}))
# add the NixOS configurations with the same system
// (withPrefix "nixos-"
(lib.mapAttrs (_: x: x.config.system.build.toplevel)
(lib.filterAttrs (_: x: x.pkgs.system == pkgs.system)
self.nixosConfigurations)))
# add the Home Manager configurations with the same system
// (withPrefix "home-" (lib.mapAttrs (_: x: x.activation-script)
(lib.filterAttrs (_: x: x.pkgs.system == pkgs.system)
self.homeConfigurations))));
};
}