1
0

pkgs/build-support: Add writePytonScript helper function

This commit is contained in:
2025-06-28 14:03:57 +02:00
parent 721f6681e1
commit eace2fabb2
4 changed files with 46 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
final: prev:
{
writePythonScript = final.callPackage ./writePythonScript.nix {};
}

View File

@@ -0,0 +1,37 @@
{
python3,
writeTextFile,
lib,
}:
{
name,
text,
runtimePackages ? ps: [],
pythonPackage ? python3,
meta ? {},
passthru ? {},
derivationArgs ? {},
}:
let
pythonWithPackages = pythonPackage.withPackages runtimePackages;
in writeTextFile {
inherit
name
meta
passthru
derivationArgs
;
executable = true;
destination = "/bin/${name}";
allowSubstitutes = true;
preferLocalBuild = false;
text = ''
#!${lib.getExe pythonWithPackages}
${text}
'';
}

View File

@@ -1,13 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.writeTextFile { pkgs.clerie-build-support.writePythonScript {
name = "git-show-link"; name = "git-show-link";
executable = true; text = builtins.readFile ./git-show-link.py;
destination = "/bin/git-show-link";
allowSubstitutes = true;
preferLocalBuild = false;
text = ''
#!${pkgs.python3.withPackages (ps: with ps; [])}/bin/python3
${builtins.readFile ./git-show-link.py}
'';
} }

View File

@@ -1,4 +1,6 @@
{ {
clerie-build-support = final: prev: import ./build-support final prev;
clerie-backup = final: prev: final.callPackage ./clerie-backup {}; clerie-backup = final: prev: final.callPackage ./clerie-backup {};
clerie-cleanup-branches = final: prev: final.callPackage ./clerie-update-nixfiles/clerie-cleanup-branches.nix {}; clerie-cleanup-branches = final: prev: final.callPackage ./clerie-update-nixfiles/clerie-cleanup-branches.nix {};
clerie-keys = final: prev: final.callPackage ./clerie-keys {}; clerie-keys = final: prev: final.callPackage ./clerie-keys {};