aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/program.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/populate/program.nix')
-rw-r--r--pkgs/populate/program.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/populate/program.nix b/pkgs/populate/program.nix
new file mode 100644
index 0000000..06cfa07
--- /dev/null
+++ b/pkgs/populate/program.nix
@@ -0,0 +1,24 @@
+# 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;
+ # Only what cargo builds from, so changes to the Nix files or the docs
+ # don't rebuild the program.
+ src = builtins.path {
+ name = "populate-src";
+ path = ./.;
+ filter = path: type: let
+ relative = builtins.substring
+ (builtins.stringLength (toString ./.) + 1) (-1) (toString path);
+ in
+ builtins.elem relative [ "Cargo.toml" "Cargo.lock" "src" ] ||
+ builtins.substring 0 4 relative == "src/";
+ };
+ cargoLock.lockFile = ./Cargo.lock;
+}