-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
73 lines (72 loc) · 2.3 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
{
description = "evdev and uinput";
inputs = {
flakelib.url = "github:flakelib/fl";
nixpkgs = { };
rust = {
url = "github:arcnmx/nixexprs-rust";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, flakelib, nixpkgs, rust, ... }@inputs: let
nixlib = nixpkgs.lib;
in flakelib {
inherit inputs;
systems = [ "x86_64-linux" "aarch64-linux" ];
devShells = {
plain = {
mkShell, writeShellScriptBin, hostPlatform
, enableRust ? true, cargo
, rustTools ? [ ]
}: mkShell {
inherit rustTools;
nativeBuildInputs = nixlib.optional enableRust cargo;
};
stable = { rust'stable, outputs'devShells'plain }: outputs'devShells'plain.override {
inherit (rust'stable) mkShell;
enableRust = false;
};
dev = { rust'unstable, outputs'devShells'plain }: outputs'devShells'plain.override {
inherit (rust'unstable) mkShell;
enableRust = false;
rustTools = [ "rust-analyzer" ];
};
default = { outputs'devShells }: outputs'devShells.plain;
};
legacyPackages = {
source = { rust'builders }: rust'builders.wrapSource self.lib.crate.src;
outputHashes = { rust'builders }: rust'builders.cargoOutputHashes {
inherit (self.lib) crate;
};
};
checks = {
version = { rust'builders, source }: rust'builders.check-contents {
src = source;
patterns = [
{ path = "src/lib.rs"; docs'rs = {
inherit (self.lib.crate.package) name version;
}; }
];
};
test = { outputs'devShells'plain, rustPlatform, source, buildFeatures ? [ "serde" ] ++ self.lib.tokio-util-features }: rustPlatform.buildRustPackage {
pname = self.lib.crate.package.name;
inherit (self.lib.crate) version cargoLock;
inherit (outputs'devShells'plain.override { enableRust = false; }) buildInputs nativeBuildInputs;
src = source;
inherit buildFeatures;
buildType = "debug";
meta.name = "cargo test";
};
};
lib = {
crate = rust.lib.importCargo {
path = ./Cargo.toml;
};
inherit (self.lib.crate) version;
tokio-util-features = [ "tokio-util-0_7" "tokio-util-0_6" ];
};
config = {
name = "input-linux-rs";
};
};
}