From cbee55229ce898195cf703dd466c4e5a248a8ac9 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 29 Apr 2024 15:05:49 -0700 Subject: add 'pythonpackage' snippets for nix Create the stuff I need to package python scripts. Change-Id: Icdd35555153ed3e414ed57f0c19027528373e48f --- snippets/nix-mode/pythonpackage | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 snippets/nix-mode/pythonpackage (limited to 'snippets/nix-mode/pythonpackage') 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 ]; + }; +} -- cgit 1.4.1