diff options
author | Ninjatrappeur <NinjaTrappeur@users.noreply.github.com> | 2022-03-19 21:28:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-19 21:28:40 +0100 |
commit | 05417a66e7bfee5b0607a12eaf81db33a47a6afd (patch) | |
tree | 59a3290ca5c7050ede1d4964b4e8ad3e534edee1 /pkgs | |
parent | 53e4f8d2376c68dfdd614a123d5da0a8b10cf3be (diff) | |
parent | b205832efe0c92c58576ffe47851c90cd405ee4b (diff) | |
download | nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.tar nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.tar.gz nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.tar.bz2 nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.tar.lz nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.tar.xz nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.tar.zst nixpkgs-05417a66e7bfee5b0607a12eaf81db33a47a6afd.zip |
Merge pull request #164398 from NinjaTrappeur/nin/pleroma-wrappers
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/servers/pleroma/default.nix | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/pkgs/servers/pleroma/default.nix b/pkgs/servers/pleroma/default.nix index ec7de2ac57c..dd4025a76c0 100644 --- a/pkgs/servers/pleroma/default.nix +++ b/pkgs/servers/pleroma/default.nix @@ -1,7 +1,8 @@ { lib, beamPackages , fetchFromGitHub, fetchFromGitLab -, file, cmake +, file, cmake, bash , nixosTests, writeText +, cookieFile ? null , ... }: @@ -17,6 +18,34 @@ beamPackages.mixRelease rec { sha256 = "sha256-RcqqNNNCR4cxETUCyjChkpq+cQ1QzNOHHzdqBLtOc6g="; }; + preFixup = if (cookieFile != null) then '' + # There's no way to use a subprocess to cat the content of the + # file cookie using wrapProgram: it gets escaped (by design) with + # a pair of backticks :( + # We have to come up with our own custom wrapper to do this. + function wrapWithCookie () { + local hidden + hidden="$(dirname "$1")/.$(basename "$1")"-wrapped + while [ -e "$hidden" ]; do + hidden="''${hidden}_" + done + mv "$1" "''${hidden}" + + cat > "$1" << EOF + #!${bash}/bin/bash + export RELEASE_COOKIE="\$(cat "${cookieFile}")" + exec -a "\$0" "''${hidden}" "\$@" + EOF + chmod +x "$1" + } + + for f in "$out"/bin/*; do + if [[ -x "$f" ]]; then + wrapWithCookie "$f" + fi + done + '' else ""; + mixNixDeps = import ./mix.nix { inherit beamPackages lib; overrides = (final: prev: { |