-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
95 lines (90 loc) · 2.45 KB
/
flake.nix
File metadata and controls
95 lines (90 loc) · 2.45 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
{
description = "A Rust EXI codec";
inputs = {
utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
w3c-testsuite = {
url = "github:w3c/exi-testsuite";
flake = false;
};
};
outputs = {
self,
nixpkgs,
nixpkgs-unstable,
utils,
crane,
fenix,
w3c-testsuite,
}:
utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [fenix.overlays.default];
};
pkgs-unstable = import nixpkgs-unstable {
inherit system;
};
rust = (pkgs.fenix.stable.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
]);
craneLib = (crane.mkLib pkgs).overrideToolchain (_: rust);
src = craneLib.cleanCargoSource ./.;
commonArgs = {
inherit src;
strictDeps = true;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
individualCrateArgs = commonArgs // {
inherit cargoArtifacts;
inherit (craneLib.crateNameFromCargoToml { inherit src; }) version;
# NB: we disable tests since we'll run them all via cargo-nextest
doCheck = false;
};
fileSetForCrate = crate: pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./src
crate
];
};
exicmd = craneLib.buildPackage (individualCrateArgs // {
pname = "exicmd";
cargoExtraArgs = "-p exicmd";
src = fileSetForCrate ./exicmd;
});
testData = "${w3c-testsuite}/data/interop";
in rec {
packages.default = exicmd;
apps.default = utils.lib.mkApp {drv = packages.default;};
# Provide a dev env with rust and rust-analyzer
devShells.default = craneLib.devShell {
#checks = self.checks.${system};
packages = [ pkgs.rust-analyzer pkgs.exificient];
};
formatter = pkgs.alejandra;
checks.interop = (pkgs.runCommand "interop_tests" {
src = ./.;
nativeBuildInputs = [
packages.default
pkgs-unstable.exificient
pkgs.oils-for-unix
pkgs.difftastic
# For xmllint
pkgs.libxml2
];
} ''
$src/test/interop.ysh ${testData}/builtInGrammar
'');
});
}