diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix index c09bd8ce861f..1ad39b0e686b 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix +++ b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix @@ -1,5 +1,6 @@ { lib, + stdenv, callPackage, installShellFiles, mkShell, @@ -12,6 +13,9 @@ withNgSuffix ? true, withReexec ? false, withShellFiles ? true, + # Very long tmp dirs lead to "too long for Unix domain socket" + # SSH ControlPath errors. Especially macOS sets long TMPDIR paths. + withTmpdir ? if stdenv.hostPlatform.isDarwin then "/tmp" else null, }: let executable = if withNgSuffix then "nixos-rebuild-ng" else "nixos-rebuild"; @@ -73,6 +77,10 @@ python3Packages.buildPythonApplication rec { pytestFlagsArray = [ "-vv" ]; + makeWrapperArgs = lib.optionals (withTmpdir != null) [ + "--set TMPDIR ${withTmpdir}" + ]; + passthru = let python-with-pkgs = python3.withPackages (