-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
152 lines (135 loc) · 4.86 KB
/
flake.nix
File metadata and controls
152 lines (135 loc) · 4.86 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
description = "crdant's system configration ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-25.11-darwin";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
sops-nix.url = "github:Mic92/sops-nix";
home-manager.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
darwin.url = "github:lnl7/nix-darwin/nix-darwin-25.11";
darwin.inputs.nixpkgs.follows = "nixpkgs"; # ...
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
_1password-shell-plugins.url = "github:1Password/shell-plugins";
_1password-shell-plugins.inputs.nixpkgs.follows = "home-manager"; # ...
};
outputs = { self, nixpkgs, home-manager, darwin, ...}@inputs:
let
inherit (self) outputs;
supportedSystems = [ "aarch64-darwin" "x86_64-linux" ];
mkPkgs = system: import nixpkgs {
inherit system;
overlays = [
inputs.nur.overlays.default
];
};
# Helper function to create home configurations with profiles
mkHomeConfig = { system, username, gitEmail, profile ? "full"
, homeDirectory ? (if (mkPkgs system).stdenv.isDarwin then "/Users/${username}" else "/home/${username}")
, homeModule ? (./. + "/home/users/${username}/home.nix")
}:
home-manager.lib.homeManagerConfiguration {
pkgs = mkPkgs system;
extraSpecialArgs = {inherit inputs outputs username homeDirectory gitEmail profile;};
modules = [
homeModule
];
};
in {
overlays = import ./overlays {inherit inputs;};
nixosConfigurations = {
mash = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs outputs;};
modules = [
./systems/hosts/mash/default.nix
./home/users/crdant/crdant.nix
];
};
};
darwinConfigurations = {
"aguardiente" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs outputs;};
modules = [
./systems/hosts/aguardiente/default.nix
./home/users/crdant/crdant.nix
./home/users/crdant/darwin.nix
];
};
"grappa" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs outputs;};
modules = [
./systems/hosts/grappa/default.nix
./home/users/crdant/crdant.nix
./home/users/crdant/darwin.nix
];
};
"sochu" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs outputs;};
modules = [
./systems/hosts/sochu/default.nix
./home/users/crdant/chuck.nix
./home/users/crdant/darwin.nix
];
};
"pisco" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs outputs;};
modules = [
./systems/hosts/pisco/default.nix
./home/users/crdant/crdant.nix
./home/users/crdant/darwin.nix
./home/users/luca/luca.nix
./home/users/dewey/dewey.nix
];
};
};
homeConfigurations =
let
# User configurations with different profiles
userConfigs = {
chuck = {
gitEmail = "[email protected]";
homeModule = ./home/users/crdant/home.nix;
};
crdant = {
gitEmail = "[email protected]";
};
luca = {
gitEmail = "";
};
dewey = {
gitEmail = "";
};
};
# Available profiles
profiles = [ "full" "development" "minimal" "server" ];
# Generate configurations for each user-profile-system combination
# Names: "user@system", "user:profile@system"
generateConfigs = userConfigs: profiles:
builtins.listToAttrs (
builtins.concatLists (
builtins.map (system:
builtins.concatLists (
builtins.map (username:
let userConfig = userConfigs.${username}; in
builtins.map (profile: {
name =
let base = if profile == "full" then username else "${username}:${profile}";
in "${base}@${system}";
value = mkHomeConfig ({ inherit system username profile; } // userConfig);
}) profiles
) (builtins.attrNames userConfigs)
)
) supportedSystems
)
);
in
generateConfigs userConfigs profiles;
};
}