-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
154 lines (148 loc) · 5.58 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
{
description = "Chetan Bhasin's Nix configuration";
inputs = {
# Package sets
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# Environment/system management
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Other sources
flake-utils = { url = "github:numtide/flake-utils"; };
devshell = {
url = "github:numtide/devshell";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
};
outputs =
inputs@{ self, nixpkgs, darwin, home-manager, flake-utils, devshell, ... }:
let
nixpkgsConfig = with inputs; {
config = { allowUnfree = true; };
overlays = [ ];
};
darwinModules = { user, host }:
with inputs; [
# Main `nix-darwin` config
(./. + "/hosts/${host}/configuration.nix")
# `home-manager` module
home-manager.darwinModules.home-manager
{
nixpkgs = nixpkgsConfig;
# `home-manager` config
users.users.${user}.home = "/Users/${user}";
home-manager = {
useGlobalPkgs = true;
users.${user} = import (./. + "/hosts/${host}/home.nix");
};
}
];
nixosModules = { user, host }:
with inputs; [
# Main `nixos` config
(./. + "/hosts/${host}/configuration.nix")
# `home-manager` module
home-manager.nixosModules.home-manager
{
nixpkgs = nixpkgsConfig;
users.users.${user}.shell = nixpkgs.nushell;
# `home-manager` config
users.users.${user} = {
home = "/home/${user}";
isNormalUser = true;
group = "${user}";
extraGroups = [ "wheel" ];
};
users.groups.${user} = { };
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user} = import (./. + "/hosts/${host}/home.nix");
};
}
];
in
{
darwinConfigurations = {
hugh = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = darwinModules {
user = "chetan";
host = "hugh";
};
specialArgs = { inherit inputs nixpkgs; };
};
markus = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = darwinModules {
user = "chetan";
host = "markus";
};
specialArgs = { inherit inputs nixpkgs; };
};
};
colmena = {
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
overlays = [ ];
};
};
venus = {
deployment = {
targetHost = "venus";
targetUser = "chetan";
allowLocalDeployment = true;
buildOnTarget = true;
};
imports = [ inputs.snm.nixosModule ];
};
defaults = { pkgs, name, ... }: {
deployment = {
keys."tailscale.auth" = {
keyCommand = [ "sops" "--decrypt" "secrets/tailscale" ];
destDir = "/run/keys";
};
};
imports = [
(./. + "/bootconfig/${name}.nix")
(./. + "/hosts/${name}/configuration.nix")
# `home-manager` module
home-manager.nixosModules.home-manager
{
nixpkgs = nixpkgsConfig;
# `home-manager` config
users.users.chetan = {
home = "/home/chetan";
isNormalUser = true;
group = "chetan";
extraGroups = [ "wheel" ];
};
users.groups.chetan = { };
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.chetan = import (./. + "/hosts/venus/home.nix");
};
}
];
networking.hostName = "${name}";
trusted-public-keys = [ ];
users.users.root.openssh.authorizedKeys.keys = [
# chetan's mac key
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8y+WOiiqxKGRQHGdtRGL2R4Ptqs7uEXX89WwvUQTc9A2zTFjGNcQvDCP6+qw6FQgDCaLdNozojfPQxo/VqMiWf1KXvBOPMONc+AUURhPxw8lD1FSc5AsLAw68BrxnFLbYrKmJT6qr3Ap/D6NGNlJUN3m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