about summary refs log tree commit diff
path: root/advent-of-code/writePythonBin.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-15T14·21+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-15T14·21+0000
commit456d358cd7b0701b0ca2b8571d61f255d3da1488 (patch)
treecb4aac65aa1c6600f6ef773ffd58cd8579bb5084 /advent-of-code/writePythonBin.nix
parentd480b6f08b8a6b32c58e5bbdf2f193432c50fb97 (diff)
Upload my 2019 Advent of Code attempts
Well, unexpectedly (perhaps naively so), I only made it to Day 7. I created
these before I stumbled upon the idea of the mono-repository; otherwise, I like
to think I would have more granular commits introducing this work.
Diffstat (limited to 'advent-of-code/writePythonBin.nix')
-rw-r--r--advent-of-code/writePythonBin.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/advent-of-code/writePythonBin.nix b/advent-of-code/writePythonBin.nix
new file mode 100644
index 000000000000..1730edb2ebe4
--- /dev/null
+++ b/advent-of-code/writePythonBin.nix
@@ -0,0 +1,18 @@
+{ pkgs ? import <nixpkgs> {}, ... }:
+
+{ name, deps, src }:
+
+let
+  inherit (pkgs) pythonPackages writeTextFile;
+  inherit (builtins) toFile;
+
+in writeTextFile {
+  inherit name;
+  executable = true;
+  destination = "/bin/${name}";
+
+  text = ''
+    #!/bin/sh
+    ${pkgs.python3}/bin/python3 ${src}
+  '';
+}