about summary refs log tree commit diff
path: root/pkgs/sternenseemann/default.nix
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-13 23:30:40 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-13 23:42:55 +0100
commit587fcc7b89cda8abbbd1f08722b2b3e1349869c8 (patch)
tree454e8dd7d9ce0f37d311aa9b8ccc08c54dce6f2c /pkgs/sternenseemann/default.nix
parent059bee06233d1987746f625905d552e219d4bfbc (diff)
pkgs/sternenseemann/temp: add tiny temporary file/dir crate
The crate implements a safe wrapper around mkdtemp(3) and mkstemp(3)
which provide decent temporary file and directory creation. The key
feature we provide is that we wrap the resulting path in a TempFile /
TempDir struct. This allows us to implement the Drop trait such that the
temporary directory / file is automatically deleted when the value goes
out of scope in Rust which saves the programmer from cleaning up
temporary artifacts themselves.

The API is indeed very tiny currently, only implementing creation and
AsRef<Path> which should allow all necessary path / file manipulation.
Diffstat (limited to 'pkgs/sternenseemann/default.nix')
-rw-r--r--pkgs/sternenseemann/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/sternenseemann/default.nix b/pkgs/sternenseemann/default.nix
index 23845195..8ee48ce5 100644
--- a/pkgs/sternenseemann/default.nix
+++ b/pkgs/sternenseemann/default.nix
@@ -33,6 +33,12 @@ let
     };
   };
 
+  rust = callPackage ./rust {
+    inherit (profpatsch)
+      writeRustSimpleLib
+      ;
+  };
+
 in
 
 lib.fix (self: {
@@ -75,6 +81,11 @@ lib.fix (self: {
     '';
   });
 
+  inherit (rust)
+    temp
+    temp-tests
+    ;
+
   # don't bother hydra with trivial text substitution
   scripts = dontRecurseIntoAttrs (callPackage ./scripts {
     inherit (writers) writeBashBin;