-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
executable file
·130 lines (118 loc) · 3.5 KB
/
flake.nix
File metadata and controls
executable file
·130 lines (118 loc) · 3.5 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
{
description = "my nix flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
darwin.url = "github:lnl7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
homebrew-cask.url = "github:homebrew/homebrew-cask";
homebrew-cask.flake = false;
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
paneru.url = "github:karinushka/paneru";
paneru.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ {
self,
nixpkgs,
home-manager,
darwin,
nix-homebrew,
homebrew-cask,
sops-nix,
...
}: let
user = {
name = "santi";
description = "Lukas Santner";
email = "lukas@santi.gg";
sshKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILds3nmPYniDOxaeLUY6B7Om/nQF04wXpIqWaHwrkriA santi"
];
};
darwinHosts = {
santibook = {
system = "aarch64-darwin";
extraModules = [./modules/darwin/desktop.nix ./modules/darwin/paneru.nix];
};
lisbon = {
system = "aarch64-darwin";
extraModules = [./modules/secrets.nix ./hosts/lisbon ./modules/darwin/server.nix];
};
};
nixosHosts = {
obsidian = {
system = "x86_64-linux";
extraModules = [./modules/secrets.nix ./hosts/obsidian ./modules/linux/server.nix];
};
};
commonModules = hostName: [
./modules/home.nix
./modules/packages.nix
({pkgs, ...}: {
programs.zsh.enable = true;
environment.shells = [pkgs.zsh];
environment.variables.EDITOR = "nvim";
nix.settings.experimental-features = ["nix-command" "flakes"];
networking.hostName = hostName;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.extraSpecialArgs = {inherit inputs user;};
})
];
makeDarwin = hostName: system: extraModules:
darwin.lib.darwinSystem {
inherit system;
specialArgs = {inherit inputs self user;};
modules =
[
home-manager.darwinModules.default
sops-nix.darwinModules.sops
nix-homebrew.darwinModules.nix-homebrew
./modules/darwin
{
networking.computerName = hostName;
networking.localHostName = hostName;
nix-homebrew = {
enable = true;
user = user.name;
autoMigrate = true;
taps = {
"homebrew/homebrew-cask" = homebrew-cask;
};
};
}
]
++ commonModules hostName
++ extraModules;
};
makeNixOS = hostName: system: extraModules:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs self user;};
modules =
[
home-manager.nixosModules.default
sops-nix.nixosModules.sops
./modules/linux
]
++ commonModules hostName
++ extraModules;
};
in {
darwinConfigurations =
builtins.mapAttrs (
name: host:
makeDarwin name host.system host.extraModules
)
darwinHosts;
nixosConfigurations =
builtins.mapAttrs (
name: host:
makeNixOS name host.system host.extraModules
)
nixosHosts;
};
}