summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-04-29 15:05:49 -0700
committerFranck Cuny <franck@fcuny.net>2024-04-29 15:05:49 -0700
commitcbee55229ce898195cf703dd466c4e5a248a8ac9 (patch)
tree2b2ccfc88d47b07da417d603c1e197b3f3202a73
parentminor tweaks for python and eldoc-box (diff)
downloademacs.d-cbee55229ce898195cf703dd466c4e5a248a8ac9.tar.gz
add 'pythonpackage' snippets for nix
Create the stuff I need to package python scripts.

Change-Id: Icdd35555153ed3e414ed57f0c19027528373e48f
-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 ];
+  };
+}