aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/program.nix
blob: fbb364c6076171792738c35899190c2fcfe5e98e (plain)
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
# The program delivering sources, built from the crate in this directory.
{ rustPlatform }:

let
  cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in

rustPlatform.buildRustPackage {
  pname = cargoToml.package.name;
  inherit (cargoToml.package) version;
  # Without what cargo doesn't build from, so changes to the Nix files or
  # the docs don't rebuild the program.  By names, not by paths relative to
  # this directory: the paths the filter gets needn't start with
  # toString ./., e.g. if a symlink leads to this directory.
  src = builtins.path {
    name = "populate-src";
    path = ./.;
    filter = path: type: let
      name = baseNameOf path;
    in
      !(builtins.elem name [ ".gitignore" "docs" "target" ] ||
        builtins.match ".*\\.nix" name != null);
  };
  cargoLock.lockFile = ./Cargo.lock;
}