-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
78 lines (70 loc) · 2.14 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
# SPDX-FileCopyrightText: 2024 Jade Lovelace
#
# SPDX-License-Identifier: BSD-2-Clause OR MIT
{
description = "Documentation plugin for Nix";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, crane, flake-utils }:
flake-utils.lib.eachDefaultSystem
(
system:
let
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) lib;
nix-doc-for = nixVer: pkgs.callPackage ./package.nix {
craneLib = crane.lib.${system};
nix = pkgs.nixVersions.${nixVer};
};
versions = vs: builtins.listToAttrs (builtins.map
(v: {
name = "nix-doc_${v}";
value = nix-doc-for "nix_${v}";
})
vs);
shellFor = p: pkgs.mkShell {
# make rust-analyzer work
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
inputsFrom = [ p ];
# any dev tools you use in excess of the rust ones
nativeBuildInputs = with pkgs; [
rust-analyzer
clang-tools_14
] ++ lib.optional pkgs.stdenv.isLinux pkgs.bear;
} // lib.optionalAttrs pkgs.stdenv.isLinux {
# so that you can load a mismatched version of nix-doc safely
hardeningDisable = [ "relro" "bindnow" ];
RUSTFLAGS = "-Z relro-level=partial";
# this should have never been a -Z flag
RUSTC_BOOTSTRAP = "1";
};
in
{
packages = rec {
nix-doc = nix-doc-for "nix_2_19";
default = nix-doc;
} // versions [
"2_19"
"2_18"
"2_17"
"2_16"
"2_15"
"2_14"
"2_13"
];
checks = self.packages.${system};
# for debugging
inherit pkgs;
devShells = builtins.mapAttrs (k: v: shellFor v) self.packages.${system};
}
)
;
}