Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The new tarballBuilder fails when HOME variable set on execution host #338

Closed
terlar opened this issue Nov 15, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@terlar
Copy link
Contributor

terlar commented Nov 15, 2023

Bug description

I discovered on my CI that sets a HOME variable that the tarballBuilder fails with:

error: opening '/github/home/.nix-channels' for writing: No such file or directory
Error: Process completed with exit code 1.

This is because my GitHub Runner has set this HOME variable.

To Reproduce

Steps to reproduce the behavior:

sudo HOME=/home/unknown nix run --print-build-logs github:nix-community/NixOS-WSL#nixosConfigurations.modern.config.system.build.tarballBuilder

Expected behavior
Successful build of tarballBuilder.

Logs

Include relevant console logs

error: opening '/github/home/.nix-channels' for writing: No such file or directory
Error: Process completed with exit code 1.

@terlar terlar added the bug Something isn't working label Nov 15, 2023
@terlar terlar changed the title The new tarballBuilder trap fails when HOME variable set on execution host The new tarballBuilder fails when HOME variable set on execution host Nov 15, 2023
@terlar
Copy link
Contributor Author

terlar commented Nov 15, 2023

This could be fixed like this:

diff --git a/modules/build-tarball.nix b/modules/build-tarball.nix
index 3d787ab..a53ac1a 100644
--- a/modules/build-tarball.nix
+++ b/modules/build-tarball.nix
@@ -76,7 +76,7 @@ in
           --substituters ""

         echo "[NixOS-WSL] Adding channel..."
-        nixos-enter --root "$root" --command 'nix-channel --add https://github.com/nix-community/NixOS-WSL/archive/refs/heads/main.tar.gz nixos-wsl'
+        nixos-enter --root "$root" --command 'HOME=/root nix-channel --add https://github.com/nix-community/NixOS-WSL/archive/refs/heads/main.tar.gz nixos-wsl'

         echo "[NixOS-WSL] Adding default config..."
         ${if cfg.configPath == null then ''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant