treewide: use writableTmpDirAsHomeHook (#378110)

This commit is contained in:
Gaétan Lepage
2025-01-31 10:34:59 +01:00
committed by GitHub
14 changed files with 65 additions and 69 deletions
@@ -5,10 +5,8 @@ export PATH
addBinToPath () {
# shellcheck disable=SC2154
if [ -d "$out/bin" ]; then
PATH="$out/bin:$PATH"
export PATH
fi
PATH="$out/bin:$PATH"
export PATH
}
# shellcheck disable=SC2154
+5 -3
View File
@@ -11,6 +11,7 @@
libgit2,
darwin,
curl,
writableTmpDirAsHomeHook,
}:
rustPlatform.buildRustPackage rec {
@@ -20,7 +21,7 @@ rustPlatform.buildRustPackage rec {
src = fetchFromGitHub {
owner = "jmacdonald";
repo = "amp";
rev = version;
tag = version;
hash = "sha256-xNadwz2agPbxvgUqrUf1+KsWTmeNh8hJIWcNwTzzM/M=";
};
@@ -48,8 +49,9 @@ rustPlatform.buildRustPackage rec {
]
);
# Tests need to write to the theme directory in HOME.
preCheck = "export HOME=`mktemp -d`";
nativeCheckInputs = [
writableTmpDirAsHomeHook
];
meta = {
description = "Modern text editor inspired by Vim";
+9 -6
View File
@@ -5,6 +5,7 @@
installShellFiles,
distrobox,
podman,
writableTmpDirAsHomeHook,
}:
buildGoModule rec {
@@ -14,7 +15,7 @@ buildGoModule rec {
src = fetchFromGitHub {
owner = "Vanilla-OS";
repo = "apx";
rev = "v${version}";
tag = "v${version}";
hash = "sha256-60z6wbbXQp7MA5l7LP/mToZftX+nbcs2Mewg5jCFwFk=";
};
@@ -26,6 +27,10 @@ buildGoModule rec {
podman
];
nativeCheckInputs = [
writableTmpDirAsHomeHook
];
ldflags = [
"-s"
"-w"
@@ -46,8 +51,6 @@ buildGoModule rec {
install -Dm444 README.md -t $out/share/docs/apx
install -Dm444 COPYING.md $out/share/licenses/apx/LICENSE
# Create a temp writable home-dir so apx outputs completions without error
export HOME=$(mktemp -d)
# apx command now works (for completions)
# though complains "Error: no such file or directory"
installShellCompletion --cmd apx \
@@ -56,12 +59,12 @@ buildGoModule rec {
--zsh <($out/bin/apx completion zsh)
'';
meta = with lib; {
meta = {
description = "Vanilla OS package manager";
homepage = "https://github.com/Vanilla-OS/apx";
changelog = "https://github.com/Vanilla-OS/apx/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
dit7ya
chewblacka
];
+2 -4
View File
@@ -3,6 +3,7 @@
lib,
fetchFromGitHub,
awscli,
writableTmpDirAsHomeHook,
}:
python3Packages.buildPythonApplication rec {
@@ -38,12 +39,9 @@ python3Packages.buildPythonApplication rec {
nativeCheckInputs = with python3Packages; [
pytestCheckHook
writableTmpDirAsHomeHook
];
preCheck = ''
export HOME=$(mktemp -d)
'';
meta = {
homepage = "https://github.com/awslabs/aws-shell";
description = "Integrated shell for working with the AWS CLI";
+4 -5
View File
@@ -10,6 +10,8 @@
nix-update-script,
testers,
awscli2,
addBinToPathHook,
writableTmpDirAsHomeHook,
}:
let
@@ -121,9 +123,11 @@ py.pkgs.buildPythonApplication rec {
];
nativeCheckInputs = with py.pkgs; [
addBinToPathHook
jsonschema
mock
pytestCheckHook
writableTmpDirAsHomeHook
];
postInstall =
@@ -136,11 +140,6 @@ py.pkgs.buildPythonApplication rec {
rm $out/bin/aws.cmd
'';
preCheck = ''
export PATH=$PATH:$out/bin
export HOME=$(mktemp -d)
'';
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
# when used in nix-shell.
postFixup = ''
+2 -4
View File
@@ -7,6 +7,7 @@
git,
cargo,
versionCheckHook,
writableTmpDirAsHomeHook,
darwin,
nix-update-script,
}:
@@ -63,6 +64,7 @@ python3Packages.buildPythonApplication rec {
++ [
cargo
versionCheckHook
writableTmpDirAsHomeHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.ps
@@ -70,10 +72,6 @@ python3Packages.buildPythonApplication rec {
versionCheckProgramArg = [ "--version" ];
preCheck = ''
export HOME=$(mktemp -d);
'';
pytestFlagsArray =
[
# AssertionError on the version metadata
+3 -2
View File
@@ -9,6 +9,7 @@
nodejs,
python3,
nixosTests,
writableTmpDirAsHomeHook,
}:
let
@@ -17,7 +18,7 @@ let
src = fetchFromGitHub {
owner = "hedgedoc";
repo = "hedgedoc";
rev = version;
tag = version;
hash = "sha256-cRIpcoD9WzLYxKYpkvhRxUmeyJR5z2QyqApzWvQND+s=";
};
@@ -31,10 +32,10 @@ let
gitMinimal # needed to download git dependencies
nodejs # needed for npm to download git dependencies
yarn
writableTmpDirAsHomeHook
];
buildPhase = ''
export HOME=$(mktemp -d)
yarn config set enableTelemetry 0
yarn config set cacheFolder $out
yarn config set --json supportedArchitectures.os '[ "linux" ]'
+2 -4
View File
@@ -12,6 +12,7 @@
mandoc,
rustfmt,
file,
writableTmpDirAsHomeHook,
# build inputs
openssl,
@@ -58,6 +59,7 @@ rustPlatform.buildRustPackage rec {
nativeCheckInputs = [
file
gnum4
writableTmpDirAsHomeHook
];
postInstall = ''
@@ -68,10 +70,6 @@ rustPlatform.buildRustPackage rec {
--prefix PATH : ${lib.makeBinPath [ gnum4 ]}
'';
preCheck = ''
export HOME=$(mktemp -d)
'';
checkFlags = [
"--skip=test_cli_subcommands" # panicking due to sandbox
];
+3 -5
View File
@@ -10,6 +10,7 @@
nix-update-script,
testers,
menulibre,
writableTmpDirAsHomeHook,
}:
python3Packages.buildPythonApplication rec {
@@ -19,7 +20,7 @@ python3Packages.buildPythonApplication rec {
src = fetchFromGitHub {
owner = "bluesabre";
repo = "menulibre";
rev = "menulibre-${version}";
tag = "menulibre-${version}";
hash = "sha256-IfsuOYP/H3r1GDWMVVSBfYvQS+01VJaAlZu+c05geWg=";
};
@@ -35,6 +36,7 @@ python3Packages.buildPythonApplication rec {
intltool
gobject-introspection
wrapGAppsHook3
writableTmpDirAsHomeHook
];
postPatch = ''
@@ -43,10 +45,6 @@ python3Packages.buildPythonApplication rec {
--replace-fail 'update_desktop_file(desktop_file, script_path)' ""
'';
preBuild = ''
export HOME=$TMPDIR
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
+16 -9
View File
@@ -1,4 +1,11 @@
{ lib, stdenv, fetchFromGitHub, buildGoModule, testers, podman-tui }:
{
lib,
stdenv,
fetchFromGitHub,
buildGoModule,
testers,
podman-tui,
}:
buildGoModule rec {
pname = "podman-tui";
@@ -15,15 +22,15 @@ buildGoModule rec {
env.CGO_ENABLED = 0;
tags = [ "containers_image_openpgp" "remote" ]
++ lib.optional stdenv.hostPlatform.isDarwin "darwin";
tags = [
"containers_image_openpgp"
"remote"
] ++ lib.optional stdenv.hostPlatform.isDarwin "darwin";
ldflags = [ "-s" "-w" ];
preCheck = ''
export USER="$(whoami)"
export HOME="$(mktemp -d)"
'';
ldflags = [
"-s"
"-w"
];
checkFlags =
let
+4 -6
View File
@@ -3,12 +3,13 @@
stdenv,
rustPlatform,
fetchFromGitHub,
git,
gitMinimal,
python3,
makeWrapper,
writeScriptBin,
versionCheckHook,
nix-update-script,
writableTmpDirAsHomeHook,
}:
rustPlatform.buildRustPackage rec {
@@ -26,19 +27,16 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-mi4pCYA0dQnv3MIpZxVVY0qLdIts/qvxS4og0Tyxk3w=";
nativeBuildInputs = [
git
gitMinimal
python3
makeWrapper
writableTmpDirAsHomeHook
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ (writeScriptBin "diskutil" "") ];
buildInputs = [
python3
];
preBuild = ''
export HOME=$(mktemp -d)
'';
postInstall = ''
mkdir -p $out/lib
cp -r $HOME/.erg/ $out/lib/erg
+1 -2
View File
@@ -14,7 +14,7 @@ buildGoModule rec {
src = fetchFromGitHub {
repo = "shopware-cli";
owner = "FriendsOfShopware";
rev = version;
tag = version;
hash = "sha256-nFjm1z7QXuUkZ4sVRY0KdFpo0SXBTmJNA28YJpAyG2w=";
};
@@ -30,7 +30,6 @@ buildGoModule rec {
vendorHash = "sha256-7DVC68tKoEwaTbF6Lkv1Ib1imZojTPW3G/QS3W6N8ys=";
postInstall = ''
export HOME="$(mktemp -d)"
installShellCompletion --cmd shopware-cli \
--bash <($out/bin/shopware-cli completion bash) \
--zsh <($out/bin/shopware-cli completion zsh) \
+4 -7
View File
@@ -1,6 +1,6 @@
{
fetchFromGitHub,
git,
gitMinimal,
glibc,
lib,
makeWrapper,
@@ -8,6 +8,7 @@
python3Packages,
squashfsTools,
stdenv,
writableTmpDirAsHomeHook,
}:
python3Packages.buildPythonApplication rec {
@@ -138,17 +139,13 @@ python3Packages.buildPythonApplication rec {
pytestCheckHook
responses
setuptools
writableTmpDirAsHomeHook
]
++ [
git
gitMinimal
squashfsTools
];
preCheck = ''
mkdir -p check-phase
export HOME="$(pwd)/check-phase"
'';
pytestFlagsArray = [ "tests/unit" ];
disabledTests = [
@@ -21,12 +21,14 @@
torch,
# tests
addBinToPathHook,
evaluate,
parameterized,
pytest7CheckHook,
transformers,
config,
cudatoolkit,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
@@ -56,19 +58,17 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
addBinToPathHook
evaluate
parameterized
pytest7CheckHook
transformers
writableTmpDirAsHomeHook
];
preCheck =
''
export HOME=$(mktemp -d)
export PATH=$out/bin:$PATH
''
+ lib.optionalString config.cudaSupport ''
export TRITON_PTXAS_PATH="${cudatoolkit}/bin/ptxas"
'';
preCheck = lib.optionalString config.cudaSupport ''
export TRITON_PTXAS_PATH="${cudatoolkit}/bin/ptxas"
'';
pytestFlagsArray = [ "tests" ];
disabledTests =
[