-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
153 lines (132 loc) · 3.59 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
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs-master.url = "github:nixos/nixpkgs?ref=master";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
utils.url = "github:numtide/flake-utils";
agenix.url = "github:ryantm/agenix";
nixos-hardware.url = "github:NixOS/nixos-hardware?ref=master";
agenix-rekey = {
url = "github:oddlama/agenix-rekey";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-ext = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
niri = {
url = "github:sodiboo/niri-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix.url = "github:danth/stylix";
impermanence.url = "github:nix-community/impermanence";
nur.url = "github:nix-community/NUR";
};
outputs =
{
self,
nixpkgs,
utils,
agenix,
agenix-rekey,
home-manager,
nixos-hardware,
...
}@inputs:
let
mkSystem =
{
hostname,
system ? "x86_64-linux",
extraArgs ? { },
extraModules ? [ ],
extraOverlays ? [ ],
}:
let
overlays = [
agenix-rekey.overlays.default
inputs.nur.overlays.default
] ++ (builtins.attrValues self.overlays) ++ extraOverlays;
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
in
nixpkgs.lib.nixosSystem {
inherit system pkgs;
modules = [
./hosts/${hostname}
./secrets
self.nixosModules.default
agenix.nixosModules.default
agenix-rekey.nixosModules.default
home-manager.nixosModules.home-manager
] ++ extraModules;
specialArgs = {
inherit
self
inputs
hostname
;
} // extraArgs;
};
in
{
nixosConfigurations = {
t440p = mkSystem {
hostname = "t440p";
extraModules = [
nixos-hardware.nixosModules.lenovo-thinkpad-t440p
];
};
};
overlays = import ./overlays {
inherit inputs;
inherit (self) outputs;
};
nixosModules.default = ./modules;
agenix-rekey = agenix-rekey.configure {
userFlake = self;
nixosConfigurations = self.nixosConfigurations;
agePackage = p: p.age;
};
}
// utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
agenix-rekey.overlays.default
inputs.nur.overlays.default
] ++ (builtins.attrValues self.overlays);
};
in
{
packages = import ./pkgs { inherit pkgs; };
devShells.default = pkgs.mkShell {
packages = with pkgs; [
age
openpgp-card-tools
nur.repos.vizqq.age-plugin-openpgp-card
pkgs.agenix-rekey
];
};
formatter = pkgs.nixfmt-rfc-style;
}
);
}