-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
144 lines (133 loc) · 4.47 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
{
description = "dotfiles";
nixConfig = {
substituters = [
"https://cache.nixos.org"
"https://anthonyenr1quez.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"anthonyenr1quez.cachix.org-1:Gclb+0ZEVse0quS5IhHiYRsb9QgZ7oSPRfKPNHOl3eI="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
stable.url = "github:NixOS/nixpkgs/nixos-24.11";
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
firefox-darwin = {
url = "github:bandithedoge/nixpkgs-firefox-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
mac-app-util = {
url = "github:hraban/mac-app-util";
# inputs.nixpkgs.follows = "nixpkgs"; # todo, dockutil-3.1.3 breaks on arm
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin.url = "github:catppuccin/nix";
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
# inputs.flake-compat.follows = "flake-compat";
# inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-server = {
url = "github:msteen/nixos-vscode-server";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, home-manager, nur, darwin, firefox-darwin, mac-app-util, catppuccin, nixos-wsl, vscode-server, ... }:
let
isDarwin = system:
(builtins.elem system inputs.nixpkgs.lib.platforms.darwin);
# generate a base darwin configuration with the
# specified hostname, overlays, and any extraModules applied
mkDarwinConfig =
{ system ? "x86_64-darwin"
, host
, nixpkgs ? inputs.nixpkgs
, stable ? inputs.stable # # TODO is this needed with no overlays?
, baseModules ? [
mac-app-util.darwinModules.default
home-manager.darwinModules.home-manager
(
{ pkgs, config, inputs, ... }:
{
nixpkgs.overlays = [
firefox-darwin.overlay
nur.overlays.default
];
home-manager.sharedModules = [
catppuccin.homeManagerModules.catppuccin
mac-app-util.homeManagerModules.default
nur.modules.homeManager.default
];
}
)
./modules/darwin
./hosts/darwin
./profiles
]
, profile ? "personal"
, extraModules ? [ ]
}:
inputs.darwin.lib.darwinSystem {
inherit system;
modules = baseModules ++ extraModules;
specialArgs = { inherit self inputs nixpkgs host profile; };
};
# generate a base nixos configuration with the
# specified overlays, hardware modules, and any extraModules applied
mkNixosConfig =
{ system ? "x86_64-linux"
, host
, nixpkgs ? inputs.nixpkgs
, stable ? inputs.stable
, baseModules ? [
home-manager.nixosModules.home-manager
./modules/nixos
./hosts/linux
./profiles
]
, profile ? "personal"
, extraModules ? [ ]
}:
nixpkgs.lib.nixosSystem {
inherit system;
modules = baseModules ++ extraModules;
specialArgs = { inherit self inputs nixpkgs host profile; };
};
in
{
darwinConfigurations = {
drachenflieger = mkDarwinConfig { host = "drachenflieger"; };
damascus = mkDarwinConfig { host = "damascus"; system = "aarch64-darwin"; };
MacBook-Pro-2 = mkDarwinConfig { host = "MacBook-Pro-2"; system = "aarch64-darwin"; profile = "work"; };
};
nixosConfigurations = {
mothership = mkNixosConfig {
host = "mothership";
extraModules = [
nixos-wsl.nixosModules.wsl
vscode-server.nixosModule
./modules/wsl
];
};
};
# TODO make generic with flakeutils
formatter = {
x86_64-darwin = nixpkgs.legacyPackages.x86_64-darwin.nixpkgs-fmt;
x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.nixpkgs-fmt;
};
};
}