-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathflake.nix
More file actions
73 lines (64 loc) · 2.3 KB
/
flake.nix
File metadata and controls
73 lines (64 loc) · 2.3 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
{
description = "Operate on a remote computer through file and process manipulation";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
# Include standard Cargo sources plus:
# - patches/ directory ([patch.crates-io] path dependency)
# - README.md files (referenced by include_str! in lib crates)
# - .toml files in src/ (embedded default config)
src = lib.cleanSourceWith {
src = ./.;
filter = path: type:
(craneLib.filterCargoSources path type)
|| (builtins.match ".*patches/.*" path != null)
|| (builtins.match ".*README\\.md$" path != null)
|| (builtins.match ".*/src/.*\\.toml$" path != null);
};
commonArgs = {
inherit src;
strictDeps = true;
buildInputs = lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
libiconv
apple-sdk_15
]);
# Crane's mkDummySrc replaces all .rs files with stubs during the
# deps-only build. The [patch.crates-io] path dependency under
# patches/nix-0.29.0 must keep its real source so dependent crates
# (russh-cryptovec) can resolve its public API.
dummySrc = craneLib.mkDummySrc {
inherit src;
extraDummyScript = ''
rm -rf $out/patches
cp -r --no-preserve=mode ${src}/patches $out/patches
'';
};
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
distant = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
doCheck = false; # Tests require network/Docker
});
in
{
packages = {
default = distant;
distant = distant;
};
devShells.default = craneLib.devShell {
packages = lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
libiconv
apple-sdk_15
]);
};
}
);
}