-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (84 loc) · 2.41 KB
/
flake.nix
File metadata and controls
96 lines (84 loc) · 2.41 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
{
description = "Library functions for Nix";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
haumea = {
url = "github:nix-community/haumea/v0.2.2";
inputs.nixpkgs.follows = "nixpkgs";
};
namaka = {
url = "github:nix-community/namaka/v0.2.1";
inputs = {
nixpkgs.follows = "nixpkgs";
haumea.follows = "haumea";
};
};
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
...
}: let
promoteExports = import ./src/transformers/promoteExports.nix {};
in
{
lib = nixpkgs.lib.makeExtensible (
_:
inputs.haumea.lib.load {
src = ./src;
transformer = promoteExports "exports";
inputs = {
inherit (nixpkgs) lib;
lib' = self.lib;
};
}
);
}
// flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
};
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in {
packages = {
nixdoc = pkgs.writeShellScriptBin "nixdoc-generate" ''
export IFS=$'\n'
set -o noglob
rm -f docs.md
while read -r f; do
${pkgs.lib.getExe pkgs.nixdoc} --file "$f" --category "" --description "" >> docs.md
done <<< "$(find . -name '*.nix')"
'';
};
formatter = treefmtEval.config.build.wrapper;
checks =
{
formatting = treefmtEval.config.build.check self;
}
// inputs.namaka.lib.load {
src = ./tests;
inputs = {
inherit (pkgs) lib;
lib' = self.lib;
};
};
devShells.default = pkgs.mkShell {
packages = [
inputs.namaka.packages.${system}.default
];
shellHook = ''
comment="$(tput setaf 8)"
reset="$(tput sgr0)"
printf '\n> Namaka version: %s\n\n' "$(namaka --version | awk '{print $2}')"
printf 'To run tests, use:\n'
printf '$ namaka check %s# run checks%s\n' "$comment" "$reset"
printf '$ namaka review %s# review pending snapshots%s\n\n' "$comment" "$reset"
'';
};
}
);
}