pkgs/build-support: Add writePytonScript helper function
This commit is contained in:
5
pkgs/build-support/default.nix
Normal file
5
pkgs/build-support/default.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
final: prev:
|
||||
|
||||
{
|
||||
writePythonScript = final.callPackage ./writePythonScript.nix {};
|
||||
}
|
37
pkgs/build-support/writePythonScript.nix
Normal file
37
pkgs/build-support/writePythonScript.nix
Normal 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}
|
||||
'';
|
||||
}
|
@@ -1,13 +1,6 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeTextFile {
|
||||
pkgs.clerie-build-support.writePythonScript {
|
||||
name = "git-show-link";
|
||||
executable = true;
|
||||
destination = "/bin/git-show-link";
|
||||
allowSubstitutes = true;
|
||||
preferLocalBuild = false;
|
||||
text = ''
|
||||
#!${pkgs.python3.withPackages (ps: with ps; [])}/bin/python3
|
||||
${builtins.readFile ./git-show-link.py}
|
||||
'';
|
||||
text = builtins.readFile ./git-show-link.py;
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
{
|
||||
clerie-build-support = final: prev: import ./build-support final prev;
|
||||
|
||||
clerie-backup = final: prev: final.callPackage ./clerie-backup {};
|
||||
clerie-cleanup-branches = final: prev: final.callPackage ./clerie-update-nixfiles/clerie-cleanup-branches.nix {};
|
||||
clerie-keys = final: prev: final.callPackage ./clerie-keys {};
|
||||
|
Reference in New Issue
Block a user