-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
154 lines (152 loc) · 4.37 KB
/
flake.nix
File metadata and controls
154 lines (152 loc) · 4.37 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
{
description = "nullkomma";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2511.*";
# keep-sorted start
fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*";
flake-checker = {
# must use non-flakehub inputs,
# b/c flake-checker was build with DetSys Secure Packages
# which are not available without subscription
inputs.nixpkgs.follows = "nixpkgs";
url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*";
};
# keep-sorted end
flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*";
flake-parts = {
inputs.nixpkgs-lib.follows = "nixpkgs";
url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*";
};
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.3.*";
nix-unit = {
url = "github:nix-community/nix-unit/?tag=v2.24.1";
inputs = {
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
};
};
treefmt-nix.url = "https://flakehub.com/f/numtide/treefmt-nix/0.1.*";
};
outputs =
{ flake-parts, self, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
# keep-sorted start
inputs.nix-unit.modules.flake.default
inputs.treefmt-nix.flakeModule
# keep-sorted end
];
systems = [
# keep-sorted start
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
# keep-sorted end
];
perSystem =
{
inputs',
pkgs,
self',
...
}:
{
devShells.default = pkgs.mkShell {
packages = [
# keep-sorted start
inputs'.fh.packages.default
inputs'.flake-checker.packages.default
inputs'.flake-iter.packages.default
pkgs.git
pkgs.gnumake
pkgs.nixd
pkgs.quartoMinimal
self'.formatter
# keep-sorted end
];
};
packages = {
docs = pkgs.stdenv.mkDerivation {
name = "nullkomma-docs";
src = ./.;
nativeBuildInputs = [
pkgs.writableTmpDirAsHomeHook
];
buildInputs = [
pkgs.quartoMinimal
pkgs.which
];
buildPhase = ''
make render
'';
installPhase = ''
mkdir $out
mv _site $out
'';
};
};
treefmt = {
programs = {
# keep-sorted start
actionlint.enable = true;
beautysh.enable = true;
black.enable = true;
cmake-format.enable = true;
deadnix.enable = true;
hclfmt.enable = true;
isort.enable = true;
jsonfmt.enable = true;
keep-sorted.enable = true;
mdformat.enable = true;
nixfmt.enable = true;
prettier.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
sqlfluff.enable = true;
toml-sort.enable = true;
yamlfmt.enable = true;
# keep-sorted end
};
};
nix-unit = {
inputs = {
inherit (inputs)
nixpkgs
flake-parts
nix-unit
treefmt-nix
;
};
tests = {
"test example system-specific" = {
expr = "1";
expected = "1";
};
};
};
};
flake = {
schemas = inputs.flake-schemas.schemas;
templates = rec {
base = {
description = "nullkomma template";
path = ./templates/base;
welcomeText = ''
Welcome to the nullkomma template
'';
};
default = base;
};
tests = {
"test example system-agnostic" = {
expr = "2";
expected = "2";
};
"test template welcome text" = {
expr = self.templates.default.description;
expected = "nullkomma template";
};
};
};
};
}