-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
132 lines (116 loc) · 4.26 KB
/
flake.nix
File metadata and controls
132 lines (116 loc) · 4.26 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
{
description = "crdant's system configration ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-25.05-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.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
darwin.url = "github:lnl7/nix-darwin/nix-darwin-25.05";
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;
system = builtins.currentSystem;
isDarwin = nixpkgs.legacyPackages.${system}.stdenv.isDarwin;
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.nur.overlays.default
];
};
# Helper function to create home configurations with profiles
mkHomeConfig = { username, homeDirectory, gitEmail, profile ? "full" }:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {inherit inputs outputs username homeDirectory gitEmail profile;};
modules = [
./home/users/crdant/home.nix
];
};
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/modules/base/terminfo.nix
./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/modules/base/terminfo.nix
./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/modules/base/terminfo.nix
./systems/hosts/sochu/default.nix
./home/users/crdant/chuck.nix
./home/users/crdant/darwin.nix
];
};
};
homeConfigurations =
let
# User configurations with different profiles
userConfigs = {
chuck = {
homeDirectory = if isDarwin then "/Users/chuck" else "/home/chuck";
gitEmail = "chuck@replicated.com";
};
crdant = {
homeDirectory = if isDarwin then "/Users/crdant" else "/home/crdant";
gitEmail = "chuck@crdant.io";
};
};
# Available profiles
profiles = [ "full" "development" "minimal" "server" ];
# Generate configurations for each user-profile combination
generateConfigs = userConfigs: profiles:
builtins.listToAttrs (
builtins.concatLists (
builtins.map (username:
let userConfig = userConfigs.${username}; in
builtins.map (profile: {
name = if profile == "full" then username else "${username}:${profile}";
value = mkHomeConfig {
inherit username profile;
inherit (userConfig) homeDirectory gitEmail;
};
}) profiles
) (builtins.attrNames userConfigs)
)
);
in
generateConfigs userConfigs profiles;
};
}