-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
204 lines (190 loc) · 6.76 KB
/
Copy pathflake.nix
File metadata and controls
204 lines (190 loc) · 6.76 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
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
{
description = "My multisystem configuration using flakes";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nur.url = "github:nix-community/NUR";
nur.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware";
homeage.url = "github:aarongpower/homeage";
homeage.inputs.nixpkgs.follows = "nixpkgs";
nix-direnv.url = "github:nix-community/nix-direnv";
nix-direnv.inputs.nixpkgs.follows = "nixpkgs";
purescript-overlay.url = "github:thomashoneyman/purescript-overlay";
purescript-overlay.inputs.nixpkgs.follows = "nixpkgs";
protrans.url = "github:massix/protrans";
protrans.inputs.nixpkgs.follows = "nixpkgs";
ghostty.url = "github:ghostty-org/ghostty";
ghostty.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{ nixpkgs
, nur
, flake-utils
, home-manager
, nixos-hardware
, homeage
, nix-direnv
, purescript-overlay
, protrans
, self
, ghostty
, ...
}:
let
allSystems = [ "x86_64-linux" "aarch64-darwin" ];
stateVersion = "24.05";
pkgSet = system: rec {
inherit system;
config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
permittedInsecurePackages = [ "electron-25.9.0" ];
};
overlays = [
(_: _: self.packages."${system}")
nix-direnv.overlays.default
purescript-overlay.overlays.default
ghostty.overlays.default
nur.overlays.default
(final: prev: {
# Workaround for nushell test failures on macOS (PR #510439 in nixpkgs fixes this but not yet in nixos-unstable)
nushell = prev.nushell.overrideAttrs (_: {
doCheck = false;
});
# Workaround for direnv build failing on MacOS due to unlinked dependency with fish shell
direnv = prev.direnv.overrideAttrs (_: {
doCheck = false;
});
kdePackages = prev.kdePackages.overrideScope (
_: kdePrev: {
plasma-workspace =
let
basePkg = kdePrev.plasma-workspace;
xdgdataPkg = final.stdenv.mkDerivation {
name = "${basePkg.name}-xdgdata";
buildInputs = [ basePkg ];
dontUnpack = true;
dontFixup = true;
dontWrapQtApps = true;
installPhase = ''
mkdir -p $out/share
( IFS=:
for DIR in $XDG_DATA_DIRS; do
if [[ -d "$DIR" ]]; then
cp -r $DIR/. $out/share/
chmod -R u+w $out/share
fi
done
)
'';
};
# undo the XDG_DATA_DIRS injection that is usually done in the qt wrapper
# script and instead inject the path of the above helper package
derivedPkg = basePkg.overrideAttrs {
preFixup = ''
for index in "''${!qtWrapperArgs[@]}"; do
if [[ ''${qtWrapperArgs[$((index+0))]} == "--prefix" ]] && [[ ''${qtWrapperArgs[$((index+1))]} == "XDG_DATA_DIRS" ]]; then
unset -v "qtWrapperArgs[$((index+0))]"
unset -v "qtWrapperArgs[$((index+1))]"
unset -v "qtWrapperArgs[$((index+2))]"
unset -v "qtWrapperArgs[$((index+3))]"
fi
done
qtWrapperArgs=("''${qtWrapperArgs[@]}")
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "${xdgdataPkg}/share")
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$out/share")
'';
};
in
derivedPkg;
}
);
})
];
pkgs = import nixpkgs {
inherit system config overlays;
};
helpers = import ./lib {
inherit home-manager homeage nixpkgs;
};
};
darwinSet = with pkgSet "aarch64-darwin"; {
homeConfigurations."mgengarelli" = helpers.mkHome {
inherit inputs stateVersion system pkgs;
username = "mgengarelli";
extraModules = [
./home/work-darwin
];
};
};
linuxSet = with (pkgSet "x86_64-linux"); {
nixosConfigurations = {
"elendil" = helpers.mkSystem {
inherit stateVersion system pkgs;
extraModules = [
./system/elendil/configuration.nix
./system/elendil/hardware-configuration.nix
./system/elendil/hardware-extension.nix
nixos-hardware.nixosModules.microsoft-surface-pro-intel
];
};
};
homeConfigurations = {
"massi@elendil" = helpers.mkHome {
inherit inputs stateVersion system pkgs;
username = "massi";
extraModules = [
protrans.homeManagerModules.default
./home/elendil
];
};
};
};
commonStuff = flake-utils.lib.eachSystem allSystems (system:
let
config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
permittedInsecurePackages = [ "electron-25.9.0" ];
};
overlays = [
purescript-overlay.overlays.default
];
pkgs = import nixpkgs {
inherit system config overlays;
};
in
{
# This is the DevShell used by this project
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
# Linters and formatters
deadnix
nixpkgs-fmt
stylua
statix
luaPackages.luacheck
yamllint
yamlfmt
actionlint
# Language servers
nixd
lua-language-server
bash-language-server
yaml-language-server
# Task runners
just
];
};
};
packages = import ./pkgs { inherit pkgs; };
});
in
commonStuff //
linuxSet //
{ homeConfigurations = linuxSet.homeConfigurations // darwinSet.homeConfigurations; };
}