-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
78 lines (66 loc) · 1.92 KB
/
flake.nix
File metadata and controls
78 lines (66 loc) · 1.92 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
{
description = "rootbeer - lua-based system configuration tool";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
flake-parts.url = "github:hercules-ci/flake-parts";
crane.url = "github:ipetkov/crane";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems.outPath;
perSystem =
{
pkgs,
lib,
system,
...
}:
let
craneLib = inputs.crane.mkLib pkgs;
# Include Rust sources + the lua/ directory needed by build.rs
luaFilter = path: _type: builtins.match ".*lua/.*" path != null;
src = lib.cleanSourceWith {
src = ./.;
filter = path: type: (luaFilter path type) || (craneLib.filterCargoSources path type);
};
commonArgs = {
inherit src;
strictDeps = true;
pname = "rootbeer";
version = "0.1.0";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
rootbeer = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
meta = { license = lib.licenses.mit; };
}
);
in
{
packages = {
default = rootbeer;
inherit rootbeer;
};
checks = {
rootbeer-clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- -D warnings";
}
);
rootbeer-fmt = craneLib.cargoFmt { inherit src; };
};
devShells.default = craneLib.devShell {
checks = {
inherit rootbeer;
};
packages = [ ];
};
};
};
}