summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--snippets/nix-mode/pythonpackage32
1 files changed, 32 insertions, 0 deletions
diff --git a/snippets/nix-mode/pythonpackage b/snippets/nix-mode/pythonpackage
new file mode 100644
index 0000000..5ba74b0
--- /dev/null
+++ b/snippets/nix-mode/pythonpackage
@@ -0,0 +1,32 @@
+# -*- mode: snippet -*-
+# name: pythonpackage
+# key: pythonpackage
+# --
+{ lib, python3 }:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "$1";
+  src = ./$1.py;
+  version = "0.1.0";
+  format = "other";
+
+  buildInputs = [ python3 ];
+  propagatedBuildInputs = with python3.pkgs; [
+    $2
+  ];
+
+  dontUnpack = true;
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp $src $out/bin/\${pname}
+  '';
+
+  meta = with lib; {
+    description = "$3.";
+    license = with licenses; [ mit ];
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fcuny ];
+  };
+}