-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
155 lines (136 loc) · 4.18 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
{
description = "WRMilling Nix Configuration";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
# Hardware
hardware.url = "github:wrmilling/nixos-hardware/lenovo-y530-15ICH";
# Home manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Darwin
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Jovian (Steam Deck)
jovian = {
url = "github:Jovian-Experiments/Jovian-NixOS/development";
inputs.nixpkgs.follows = "nixpkgs";
};
# secrets through sops
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
home-manager,
sops-nix,
darwin,
...
}@inputs:
let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
secrets = import ./secrets/secrets.nix;
mkNixos =
modules:
nixpkgs.lib.nixosSystem {
modules = modules ++ [
sops-nix.nixosModules.sops
];
specialArgs = {
inherit inputs outputs secrets;
};
};
mkDarwin =
system: modules:
darwin.lib.darwinSystem {
modules = modules ++ [ ];
system = system;
specialArgs = {
inherit inputs outputs secrets;
};
};
mkHome =
pkgs: modules:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = modules ++ [
sops-nix.nixosModules.sops
];
extraSpecialArgs = {
inherit inputs outputs secrets;
};
};
in
rec {
# Custom Packages
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./custom/pkgs { inherit pkgs; }
);
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
# Devshell for bootstrapping
# Acessible through 'nix develop' or 'nix-shell' (legacy)
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./shell.nix { inherit pkgs; }
);
# Overlays
overlays = import ./custom/overlays { inherit inputs; };
# NixOS configuration entrypoint
# Available through 'nixos-rebuild switch --flake .#your-hostname'
nixosConfigurations = {
# Desktop/Laptop
bender = mkNixos [ ./hosts/bender ];
donnager = mkNixos [ ./hosts/donnager ];
enterprise = mkNixos [ ./hosts/enterprise ];
riker = mkNixos [ ./hosts/riker ];
serenity = mkNixos [ ./hosts/serenity ];
# Servers
bart = mkNixos [ ./hosts/bart ];
bob = mkNixos [ ./hosts/bob ];
goku = mkNixos [ ./hosts/goku ];
# k3s Hosts
nk3s-amd64-0 = mkNixos [ ./hosts/nk3s-amd64-0 ];
nk3s-amd64-a = mkNixos [ ./hosts/nk3s-amd64-a ];
nk3s-amd64-b = mkNixos [ ./hosts/nk3s-amd64-b ];
nk3s-amd64-c = mkNixos [ ./hosts/nk3s-amd64-c ];
nk3s-amd64-d = mkNixos [ ./hosts/nk3s-amd64-d ];
};
# nix-darwin configuration entrypoint
# Available through 'darwin-rebuild switch --flake .#your-hostname'
darwinConfigurations = {
"${secrets.hosts.work-mac.hostname}" = mkDarwin "aarch64-darwin" [ ./hosts/darwin ];
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager switch --flake .#your-username@your-hostname'
homeConfigurations = {
"${secrets.hosts.work-mac.username}@${secrets.hosts.work-mac.hostname}" =
mkHome nixpkgs.legacyPackages.aarch64-darwin
[ ./home-manager/darwin ];
};
};
}