-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
263 lines (217 loc) · 8.55 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
{
description = "Full Flake Panic!";
inputs = {
# nixpkgs = { url = "github:nixos/nixpkgs/nixos-23.05"; };
nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
# disabling this cause cause it's the same as `nixpkgs` atm (and it uses storage/network DL)
# nixpkgs-unstable = { url = "github:nixos/nixpkgs/nixos-unstable"; };
# nixpkgs-unstable = nixpkgs; # requires `inputs = rec {`. works, but duplicates the input, doesn't reference it
nixpkgs-pkgs-unstable = { url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
# disabling this cause I don't need it currently (and it uses storage/network DL)
# nixpkgs-master = { url = "github:nixos/nixpkgs/master"; };
# disabling this cause I didn't have a ~/gits/nixpkgs lying around
# nixpkgs-local = { url = "/home/felix/gits/nixpkgs"; };
# for emacsGcc; see https://gist.github.com/mjlbach/179cf58e1b6f5afcb9a99d4aaf54f549
emacs-overlay = { url = "github:nix-community/emacs-overlay"; };
nixos-hardware = { url = "github:NixOS/nixos-hardware"; };
home-manager = {
# url = "github:nix-community/home-manager/release-23.05";
url = "github:nix-community/home-manager";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
nix-alien = {
url = "github:thiagokokada/nix-alien";
};
hyprland = {
url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
# Should be the other way around (according to README.md), but don't wanna for now.
# Also, this causes local rebuilds :)
# inputs.nixpkgs.follows = "nixpkgs";
};
fish-foreign-env = {
url = "github:oh-my-fish/plugin-foreign-env";
flake = false;
};
fish-puffer-fish = {
url = "github:nickeb96/puffer-fish";
flake = false;
};
fish-tide = {
url = "github:IlanCosman/tide";
flake = false;
};
doom-emacs = {
url = "github:hlissner/doom-emacs";
flake = false;
};
wezterm-embark = {
url = "github:dmshvetsov/wezterm-embark-theme";
flake = false;
};
wezterm-git.url = "github:wez/wezterm?dir=nix";
mac-app-util.url = "github:hraban/mac-app-util";
# cf-engineering-nixpkgs = {
# url = "git+ssh://git@bitbucket.cfdata.org/~terin/engineering-nixpkgs";
# inputs.nixpkgs.follows = "nixpkgs";
# };
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
# base modules that will commonly be used by all systems
baseModules = [
# core stuff (overlays, nix config, flake registry, nix path, etc.)
./modules/core.nix
# `lib.my`
./modules/lib-my.nix
# load cachix caches; generated through `cachix use -m nixos <cache-name>`
./cachix.nix
];
system = "x86_64-linux";
in
{
packages.${system} = {
# these are here mostly for debugging, for actual use I base on the `nixpkgs`-instance of a configured system, see overlay in `core.nix`.
phinger-cursors-extended = nixpkgs.legacyPackages.${system}.callPackage ./custom-packages/phinger-cursors-extended.nix { };
};
nixosConfigurations.nixos-home = nixpkgs.lib.nixosSystem {
inherit system;
# forward flake-inputs to module arguments
specialArgs = { flake-inputs = inputs; inherit system; };
modules = baseModules ++ [
# keeping around for when I need to override 1 or more packages again
({ config, flake-inputs, system, ... }: {
nixpkgs.overlays =
[
(_: _: {
# override until https://nixpk.gs/pr-tracker.html?pr=356292 is in nixos-unstable
neovide = flake-inputs.nixpkgs-pkgs-unstable.legacyPackages.${system}.neovide;
})
];
})
# "draw the rest of the owl"
./hosts/nixos-home
];
};
nixosConfigurations.nixos-work = nixpkgs.lib.nixosSystem {
inherit system;
# forward flake-inputs to module arguments
specialArgs = { flake-inputs = inputs; inherit system; };
modules = baseModules ++ [
# "draw the rest of the owl"
./hosts/nixos-work
# use wezterm from git, because unstable currently fails to start on wayland
({ config, flake-inputs, system, ... }: {
nixpkgs.overlays =
[ (final: prev: { wezterm = flake-inputs.wezterm-git.packages.${prev.system}.default; }) ];
})
];
};
homeConfigurations."frath" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "aarch64-darwin";
config = {
# explicitly manage which unfree packages I allow in this config
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"spotify" # allowed + need music
"sublime-merge" # unfree license, but explicitly has an "unrestricted evaluation period", i.e., no time limit
];
};
overlays = [
(final: prev: {
lib = prev.lib // {
my = {
editorTools = (with final; [
# misc
multimarkdown
jq
editorconfig-core-c
# shell
shfmt
shellcheck
# python
black
python3Packages.pyflakes
python3Packages.isort
ruff-lsp
pyright
# nix
nil # nix lsp
nixd # better nix lsp?
nixpkgs-fmt
# nixfmt # don't want this for now, nixpkgs-fmt is superior :)
# go
gopls
gotools
gofumpt
gomodifytags
impl
# tex
# texlab
# typst
# typst-lsp # currently broken due to Rust 1.80 `time`-fallout
typstfmt
# typst-live
# scala
# metals
# dhall
# dhall-lsp-server # currently (2023-08-19) broken
# lua
stylua
lua-language-server
# jsonls
nodePackages.vscode-json-languageserver
]);
# TODO: put `mkWrappedWithDeps` into its own file, so we can import/use it here
# mkWrappedWithDeps = mkWrappedWithDeps final prev;
mkWrappedWithDeps =
{ pkg
, pathsToWrap
, prefix-deps ? [ ]
, suffix-deps ? [ ]
, extraWrapProgramArgs ? [ ]
, otherArgs ? { }
}:
let
prefixBinPath = prev.lib.makeBinPath prefix-deps;
suffixBinPath = prev.lib.makeBinPath suffix-deps;
in
prev.symlinkJoin ({
name = pkg.name + "-wrapped";
paths = [ pkg ];
buildInputs = [ final.makeWrapper ];
postBuild = ''
cd "$out"
for p in ${builtins.toString pathsToWrap}
do
wrapProgram "$out/$p" \
--prefix PATH : "${prefixBinPath}" \
--suffix PATH : "${suffixBinPath}" \
${builtins.toString extraWrapProgramArgs}
done
'';
} // otherArgs);
};
};
})
# inputs.cf-engineering-nixpkgs.overlay
];
};
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./hosts/hm-cf/home.nix ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
# forward flake-inputs to module arguments
extraSpecialArgs = {
flake-inputs = inputs;
system = "aarch64-darwin";
# absolute path to this flake, i.e., to break nix's isolation
thisFlakePath = "/Users/frath/nixos";
};
};
};
}