-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
185 lines (167 loc) · 6.86 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
description = "my work flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
# https://github.com/NixOS/nixpkgs/pull/350384
nixpkgs-firefox.url = "github:booxter/nixpkgs/firefox-for-darwin";
# https://github.com/NixOS/nixpkgs/pull/352493
#nixpkgs-thunderbird.url = "github:booxter/nixpkgs/thunderbird-132-darwin";
nixpkgs-thunderbird.url = "github:booxter/nixpkgs/thunder-try-latest-with-staging";
# https://github.com/NixOS/nixpkgs/pull/348045
nixpkgs-sioyek.url = "github:b-fein/nixpkgs/sioyek-fix-darwin-build";
# https://github.com/NixOS/nixpkgs/pull/355729
nixpkgs-lima.url = "github:booxter/nixpkgs/lima";
# https://github.com/NixOS/nixpkgs/pull/252383
nixpkgs-mailsend-go.url = "github:jsoo1/nixpkgs/mailsend-go";
# TODO: post PR to nixpkgs
nixpkgs-cb_thunderlink-native.url = "github:booxter/nixpkgs/cb_thunderlink-native";
nixpkgs-2405.url = "github:NixOS/nixpkgs/release-24.05";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
system-manager.url = "github:numtide/system-manager";
system-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, ... }:
let
username = "ihrachys";
mkPkgs = system:
import inputs.nixpkgs {
inherit system;
# for vim copilot plugin
config = { allowUnfree = true; };
overlays = [
inputs.nur.overlay
(final: prev: {
inherit (inputs.nixpkgs-sioyek.legacyPackages.${prev.system})
sioyek;
})
(final: prev: {
inherit (inputs.nixpkgs-master.legacyPackages.${prev.system})
rpm;
})
(final: prev: {
inherit (inputs.nixpkgs-firefox.legacyPackages.${prev.system})
firefox-unwrapped;
})
(final: prev: {
inherit (inputs.nixpkgs-thunderbird.legacyPackages.${prev.system})
thunderbird-unwrapped;
})
(final: prev: {
inherit (inputs.nixpkgs-cb_thunderlink-native.legacyPackages.${prev.system})
cb_thunderlink-native;
})
(final: prev: {
inherit (inputs.nixpkgs-mailsend-go.legacyPackages.${prev.system})
mailsend-go;
})
(final: prev: {
inherit (inputs.nixpkgs-lima.legacyPackages.${prev.system})
lima;
})
];
};
mkHome = username: modules: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
extraSpecialArgs = { inherit inputs username; };
users."${username}".imports = modules;
};
};
globalModules = { username }: [
(mkHome username [
./modules/home-manager
inputs.nixvim.homeManagerModules.nixvim
])
];
globalModulesMacos = { system, username }: globalModules { inherit username; } ++ [
{
system.configurationRevision = self.rev or self.dirtyRev or null;
}
./modules/darwin
(home-manager system).darwinModules.home-manager
];
globalModulesSystemManager = { system, username }: globalModules { inherit username; } ++ [
./modules/system-manager
(home-manager system).nixosModules.home-manager
];
# local patches for stuff that I haven't merged upstream yet
home-manager = system: with inputs; let
src = let
pkgs = mkPkgs system;
in pkgs.applyPatches {
name = "home-manager";
src = inputs.home-manager;
# TODO: is there a fetcher for a range of commits?..
patches = [
# Embed MOZ_* and other variables into launchd environment
# https://github.com/nix-community/home-manager/pull/5801
(pkgs.fetchpatch {
url = "https://github.com/nix-community/home-manager/pull/5801/commits/0165235ea1162346397e2b600899e130b96a0e22.patch";
sha256 = "sha256-vSQFf4y7Nun1PB2msDdjOMadm/ejaX45OrM1vrXcYWE=";
})
(pkgs.fetchpatch {
url = "https://github.com/nix-community/home-manager/pull/5801/commits/c200ff63c0f99c57fac96aac667fd50b5057aec7.patch";
sha256 = "sha256-HVQ+ZhkyroSYEeXXD7/Jrv3CNYDHx24Jn+iQB34VzLQ=";
})
(pkgs.fetchpatch {
url = "https://github.com/nix-community/home-manager/pull/5801/commits/3afb17e065dcb88cb4794a16a16d44573c0b76cf.patch";
sha256 = "sha256-iu/W8eJ2bd6rXoolvuA4E8yDwDPGibraPxByXTUzXKk=";
})
(pkgs.fetchpatch {
url = "https://github.com/nix-community/home-manager/pull/5801/commits/a2bbd84dc2eba1c19a84aa917c247fc73843a387.patch";
sha256 = "sha256-lhsgTkk+5YqColAFS0Y4MBEPhIkMpuywTt7IdhE9QN4=";
})
(pkgs.fetchpatch {
url = "https://github.com/nix-community/home-manager/pull/5801/commits/d58239f42b44d42b64e1c20e6b563a72dce729bc.patch";
sha256 = "sha256-j/LBM/pEIi14H2PbAFQjUgWX0h8bd9hAXqyaG1m9uX4=";
})
# Support extensions for thunderbird profiles
# https://github.com/nix-community/home-manager/pull/6033
(pkgs.fetchpatch {
url = "https://github.com/nix-community/home-manager/commit/4d680ee96fe1b698e75804cf655c365ea4ec5433.patch";
sha256 = "sha256-17FaxrhHymgFrVE4hO5eAn7DesLZ6CBlettDfJC/ro4=";
})
# Support native hosts for thunderbird
# TODO: post upstream
(pkgs.fetchpatch {
url = "https://github.com/booxter/home-manager/commit/61b7d5db483241dc6f11c36ef00202539e957480.patch";
sha256 = "sha256-yfWd7jGjvQ4I83nzRrIyiXPLHbuP50wABSiCjoZgX0U=";
})
];
};
in
nixpkgs.lib.fix (self: (import "${src}/flake.nix").outputs { inherit self nixpkgs; });
in
{
darwinConfigurations = let
system = "aarch64-darwin";
in {
macpro = inputs.nix-darwin.lib.darwinSystem rec {
inherit system;
pkgs = mkPkgs system;
specialArgs = {
inherit username;
};
modules = (globalModulesMacos { inherit system username; }) ++ [
./hosts/macpro/configuration.nix
];
};
};
# TODO: this is still broken; haven't figured out home-manager integration yet
systemConfigs.default = let
system = "x86_64-linux";
in inputs.system-manager.lib.makeSystemConfig {
extraSpecialArgs = { inherit username; };
modules = (globalModulesSystemManager { inherit system username; });
};
};
}