forked from danth/stylix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
229 lines (195 loc) · 6.28 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
{
inputs = {
base16-fish = {
flake = false;
url = "github:tomyun/base16-fish";
};
base16-helix = {
flake = false;
url = "github:tinted-theming/base16-helix";
};
base16-vim = {
flake = false;
url = "github:tinted-theming/base16-vim";
};
base16.url = "github:SenchoPens/base16.nix";
flake-compat = {
flake = false;
url = "github:edolstra/flake-compat";
};
flake-utils = {
inputs.systems.follows = "systems";
url = "github:numtide/flake-utils";
};
git-hooks = {
inputs = {
flake-compat.follows = "flake-compat";
nixpkgs-stable.follows = "git-hooks/nixpkgs";
nixpkgs.follows = "nixpkgs";
};
url = "github:cachix/git-hooks.nix";
};
gnome-shell = {
flake = false;
# TODO: Unlocking the input and pointing to official repository requires
# updating the patch:
# https://github.com/danth/stylix/pull/224#discussion_r1460339607.
url = "github:GNOME/gnome-shell/47.2";
};
# The 'home-manager' input is used to generate the documentation.
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Interface flake systems.
systems.url = "github:nix-systems/default";
tinted-foot = {
flake = false;
# Lock the tinted-foot input to prevent upstream breaking changes.
#
# Considering that Stylix eventually re-implements this input's
# functionality [1], it might be easiest to lock this input to avoid
# wasted maintenance effort.
#
# [1]: https://github.com/danth/stylix/issues/571
url = "github:tinted-theming/tinted-foot/fd1b924b6c45c3e4465e8a849e67ea82933fcbe4";
};
tinted-zed = {
flake = false;
url = "github:tinted-theming/base16-zed";
};
tinted-tmux = {
flake = false;
url = "github:tinted-theming/tinted-tmux";
};
tinted-kitty = {
flake = false;
# Lock the tinted-kitty input to prevent upstream breaking changes.
#
# Considering that Stylix eventually re-implements this input's
# functionality [1], it might be easiest to lock this input to avoid
# wasted maintenance effort.
#
# [1]: https://github.com/danth/stylix/issues/534
url = "github:tinted-theming/tinted-kitty/eb39e141db14baef052893285df9f266df041ff8";
};
firefox-gnome-theme = {
flake = false;
url = "github:rafaelmardojai/firefox-gnome-theme";
};
};
outputs =
{
nixpkgs,
base16,
self,
...
}@inputs:
inputs.flake-utils.lib.eachDefaultSystem (
system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
in
{
checks = lib.attrsets.unionOfDisjoint {
git-hooks = inputs.git-hooks.lib.${system}.run {
hooks = {
deadnix.enable = true;
hlint.enable = true;
nixfmt-rfc-style = {
enable = true;
settings.width = 80;
};
statix.enable = true;
stylish-haskell.enable = true;
typos.enable = true;
yamllint.enable = true;
};
src = ./.;
};
} self.packages.${system};
devShells = {
default = pkgs.mkShell {
inherit (self.checks.${system}.git-hooks) shellHook;
packages = [
inputs.home-manager.packages.${system}.default
self.checks.${system}.git-hooks.enabledPackages
];
};
ghc = pkgs.mkShell {
inputsFrom = [ self.devShells.${system}.default ];
packages = [ pkgs.ghc ];
};
};
packages =
let
universalPackages = {
docs = import ./docs { inherit pkgs inputs lib; };
nix-flake-check = pkgs.writeShellApplication {
meta.description = "A parallelized alternative to 'nix flake check'";
name = "nix-flake-check";
runtimeInputs = with pkgs; [
nix
parallel
];
text = ''
nix flake show --json --no-update-lock-file |
jq --raw-output '
((.checks."${system}" // {}) | keys) as $checks |
((.packages."${system}" // {}) | keys) as $packages |
(($checks - $packages)[] | "checks.${system}.\(.)"),
($packages[] | "packages.${system}.\(.)")
' |
parallel --halt now,fail=1 '
nix build --no-update-lock-file --verbose .#{}
'
'';
};
palette-generator = pkgs.callPackage ./palette-generator { };
};
# Testbeds are virtual machines based on NixOS, therefore they are
# only available for Linux systems.
testbedPackages = lib.optionalAttrs (lib.hasSuffix "-linux" system) (
import ./stylix/testbed.nix { inherit pkgs inputs lib; }
);
in
universalPackages // testbedPackages;
}
)
// {
nixosModules.stylix =
{ pkgs, ... }@args:
{
imports = [
(import ./stylix/nixos inputs {
inherit (self.packages.${pkgs.system}) palette-generator;
base16 = base16.lib args;
homeManagerModule = self.homeManagerModules.stylix;
})
];
};
homeManagerModules.stylix =
{ pkgs, ... }@args:
{
imports = [
(import ./stylix/hm inputs {
inherit (self.packages.${pkgs.system}) palette-generator;
base16 = base16.lib args;
})
];
};
darwinModules.stylix =
{ pkgs, ... }@args:
{
imports = [
(import ./stylix/darwin inputs {
inherit (self.packages.${pkgs.system}) palette-generator;
base16 = base16.lib args;
homeManagerModule = self.homeManagerModules.stylix;
})
];
};
};
}