forked from numtide/devshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
82 lines (73 loc) · 2.35 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
{
description = "devshell";
# To update all inputs:
# nix flake update
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
devshell = import ./. { nixpkgs = pkgs; };
in
rec {
packages = {
docs = pkgs.writeShellApplication {
name = "docs";
meta.description = ''Run mdBook server at http://localhost:3000'';
runtimeInputs = [ pkgs.mdbook ];
text = ''
cd docs
cp ${devshell.modules-docs.markdown} src/modules_schema.md
mdbook serve
'';
};
bench = pkgs.writeShellApplication {
name = "benchmark";
meta.description = ''Run benchmark'';
runtimeInputs = [ pkgs.hyperfine ];
text = ''
cd benchmark
hyperfine -w 3 \
'nix-instantiate ../shell.nix' \
'nix-instantiate ./devshell-nix.nix' \
'nix-instantiate ./devshell-toml.nix' \
'nix-instantiate ./nixpkgs-mkshell.nix'
'';
};
};
devShells.default = devshell.fromTOML ./devshell.toml;
legacyPackages = import inputs.self {
inherit system;
inputs = null;
nixpkgs = pkgs;
};
apps.default = devShells.default.flakeApp;
checks =
with pkgs.lib;
pipe (import ./tests { inherit pkgs; }) [
(collect isDerivation)
(map (x: { name = x.name or x.pname; value = x; }))
listToAttrs
];
formatter = pkgs.nixpkgs-fmt;
}
) // {
# Import this overlay into your instance of nixpkgs
overlays.default = import ./overlay.nix;
templates = rec {
toml = {
path = ./templates/toml;
description = "nix flake new my-project -t github:numtide/devshell";
};
flake-parts = {
path = ./templates/flake-parts;
description = "nix flake new my-project -t github:numtide/devshell#flake-parts";
};
default = toml;
};
lib.importTOML = import ./nix/importTOML.nix;
flakeModule = ./flake-module.nix;
}
;
}