Skip to content

Build failure: gitbutler (0.14.13) (macos) #394068

Closed

Description

@futile

Nixpkgs version

  • Unstable (25.05)

Steps to reproduce

Run NIXPKGS_ALLOW_UNFREE=1 nix build github:nixos/nixpkgs/nixos-unstable#gitbutler --impure, maybe on an aarch64 MacOS system, and the failure should occur.

Can Hydra reproduce this build failure?

Please select the Hydra Status.

Link to Hydra build job

Hydra keeps timing out when searching the build: https://hydra.nixos.org/search?query=gitbutler

Relevant log output

❯ NIXPKGS_ALLOW_UNFREE=1 nix build github:nixos/nixpkgs/nixos-unstable#gitbutler --impure

error: builder for '/nix/store/0z9zksysbipg2fsap3f5fzqrjpm7zkc5-gitbutler-0.14.13-vendor-staging.drv' failed with exit code 1;
       last 18 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/f2hpylxpxsfcm7cynsrzg9pclzw9bl4y-source
       > source root is source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: buildPhase
       > Traceback (most recent call last):
       >   File "/nix/store/1sac2dm9dbd6iwxw3pdbzh739s5pw884-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 15, in <module>
       >     import requests
       >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/__init__.py", line 164, in <module>
       >     from .api import delete, get, head, options, patch, post, put, request
       >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/api.py", line 11, in <module>
       >     from . import sessions
       >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/sessions.py", line 15, in <module>
       >     from .adapters import HTTPAdapter
       >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/adapters.py", line 81, in <module>
       >     _preloaded_ssl_context.load_verify_locations(
       > PermissionError: [Errno 13] Permission denied
       For full logs, run 'nix log /nix/store/0z9zksysbipg2fsap3f5fzqrjpm7zkc5-gitbutler-0.14.13-vendor-staging.drv'.
error: 1 dependencies of derivation '/nix/store/a4ilxlfclclnixa0x47aai9swh1qqhz2-gitbutler-0.14.13-vendor.drv' failed to build
error (ignored): error: cannot unlink '"/private/tmp/nix-build-gitbutler-pnpm-deps.drv-0"': Directory not empty
error: 1 dependencies of derivation '/nix/store/lajy2c1sh5s25h314bwvpf09gjhsidsc-gitbutler-0.14.13.drv' failed to build

Additional context

No response

System metadata

  • system: "aarch64-darwin"
  • host os: Darwin 24.3.0, macOS 15.3.2
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.24.9
  • nixpkgs: /nix/store/4m21g6b3bq78vn5skaxjmqwg7fnir87j-source

Notify maintainers

@getchoo @techknowlogick


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: build failure
    on Mar 28, 2025
  2. getchoo commented on Mar 29, 2025

    @getchoo
    Member

    Can you try enabling the sandbox in nix.conf? It seems the nix-community Hydra instance built this just fine 14h ago: https://hydra.nix-community.org/build/4432689

  3. futile commented on Mar 31, 2025

    @futile
    ContributorAuthor

    Can you try enabling the sandbox in nix.conf? It seems the nix-community Hydra instance built this just fine 14h ago: https://hydra.nix-community.org/build/4432689

    Leads to the same result for me:

    ❯ NIXPKGS_ALLOW_UNFREE=1 nix build github:nixos/nixpkgs/nixos-unstable#gitbutler --impure
    error: builder for '/nix/store/qd6l8kkg07b03yi74f8ni8k1g71mjd1z-gitbutler-0.14.13-vendor-staging.drv' failed with exit code 1;
           last 18 log lines:
           > Running phase: unpackPhase
           > unpacking source archive /nix/store/f2hpylxpxsfcm7cynsrzg9pclzw9bl4y-source
           > source root is source
           > Running phase: patchPhase
           > Running phase: updateAutotoolsGnuConfigScriptsPhase
           > Running phase: buildPhase
           > Traceback (most recent call last):
           >   File "/nix/store/1sac2dm9dbd6iwxw3pdbzh739s5pw884-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 15, in <module>
           >     import requests
           >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/__init__.py", line 164, in <module>
           >     from .api import delete, get, head, options, patch, post, put, request
           >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/api.py", line 11, in <module>
           >     from . import sessions
           >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/sessions.py", line 15, in <module>
           >     from .adapters import HTTPAdapter
           >   File "/nix/store/2kcy81nj3hb3c7ma0hg0ry8lbbd4cywa-python3-3.12.9-env/lib/python3.12/site-packages/requests/adapters.py", line 81, in <module>
           >     _preloaded_ssl_context.load_verify_locations(
           > PermissionError: [Errno 1] Operation not permitted
           For full logs, run 'nix log /nix/store/qd6l8kkg07b03yi74f8ni8k1g71mjd1z-gitbutler-0.14.13-vendor-staging.drv'.
    error: 1 dependencies of derivation '/nix/store/gv25q64rs357x98mhkim580a0vq7wk1j-gitbutler-0.14.13-vendor.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/qzf303kbm4as685p0w36xqzy2azcxx2l-gitbutler-0.14.13.drv' failed to build
    
    ❯ nix-shell -p nix-info --run "nix-info -m"
     - system: `"aarch64-darwin"`
     - host os: `Darwin 24.3.0, macOS 15.3.2`
     - multi-user?: `yes`
     - sandbox: `yes`
     - version: `nix-env (Nix) 2.24.9`
     - nixpkgs: `/nix/store/4m21g6b3bq78vn5skaxjmqwg7fnir87j-source`
    

    Adding it as a home-manager package and running home-manager switch also continues to show the same error.

    I'm not running either command with sudo, could that lead to a different result between hydra and my system?

    Here is my full /etc/nix/nix.conf for reference, since I noticed the error mentions SSL, and I'm using a custom certificate as well.

    /etc/nix/nix.conf:

    # Generated by https://github.com/DeterminateSystems/nix-installer.
    # See `/nix/nix-installer --version` for the version details.
    
    build-users-group = nixbld
    experimental-features = nix-command flakes
    always-allow-substitutes = true
    extra-trusted-substituters = https://cache.flakehub.com
    extra-trusted-public-keys = cache.flakehub.com-3:hJuILl5sVK4iKm86JzgdXW12Y2Hwd5G07qKtHTOcDCM= cache.flakehub.com-4:Asi8qIv291s0aYLyH6IOnr5Kf6+OF14WVjkE6t3xMio= cache.flakehub.com-5:zB96CRlL7tiPtzA9/WKyPkp3A2vqxqgdgyTVNGShPDU= cache.flakehub.com-6:W4EGFwAGgBj3he7c5fNh9NkOXw0PUVaxygCVKeuvaqU= cache.flakehub.com-7:mvxJ2DZVHn/kRxlIaxYNMuDG1OvMckZu32um1TadOR8= cache.flakehub.com-8:moO+OVS0mnTjBTcOUh2kYLQEd59ExzyoW1QgQ8XAARQ= cache.flakehub.com-9:wChaSeTI6TeCuV/Sg2513ZIM9i0qJaYsF+lZCXg0J6o= cache.flakehub.com-10:2GqeNlIp6AKp4EF2MVbE1kBOp9iBSyo0UPR9KoR0o1Y=
    bash-prompt-prefix = (nix:$name)\040
    max-jobs = auto
    extra-nix-path = nixpkgs=flake:nixpkgs
    upgrade-nix-store-path-url = https://install.determinate.systems/nix-upgrade/stable/universal
    ssl-cert-file = /etc/nix/MyCompanyRootCertificateCombined.pem
    download-buffer-size = 128M
    # for gitbutler, ref https://github.com/NixOS/nixpkgs/issues/394068
    sandbox = true
    
  4. TomaSajt commented on Mar 31, 2025

    @TomaSajt
    Contributor

    You have to disable (or relax) the sandbox. I know, weird.
    But the default nix sandbox profile isn't whitelisting a file that's supposed to be whitelisted.
    See #394972

  5. futile commented on Mar 31, 2025

    @futile
    ContributorAuthor

    You have to disable (or relax) the sandbox. I know, weird. But the default nix sandbox profile isn't whitelisting a file that's supposed to be whitelisted. See #394972

    Mhhm, I'm not quite sure what you mean, but I think the sandbox was disabled by default, i.e., in my initial post?

    But thanks for opening the issue, that looks very related! I'll check how I can explicitly add the $NIX_SSL_CERT_FILE file to the sandbox, ty!

  6. TomaSajt commented on Mar 31, 2025

    @TomaSajt
    Contributor

    Oh, I see, you're getting this error without the sandbox being enabled.

    Could you send in what your $NIX_SSL_CERT_FILE is in your normal shell?
    Is it /etc/nix/MyCompanyRootCertificateCombined.pem?

    Does /etc/nix/MyCompanyRootCertificateCombined.pem actually exist on your system?

    Also what is $NIX_SSL_CERT_FILE in your nix build environment?
    To find out, try applying this patch to your local checkout of nixpkgs

    diff --git a/pkgs/build-support/rust/fetch-cargo-vendor.nix b/pkgs/build-support/rust/fetch-cargo-vendor.nix
    index ce015b099382..8d10475c3487 100644
    --- a/pkgs/build-support/rust/fetch-cargo-vendor.nix
    +++ b/pkgs/build-support/rust/fetch-cargo-vendor.nix
    @@ -71,6 +71,11 @@ let
           buildPhase = ''
             runHook preBuild
    
    +        echo $NIX_SSL_CERT_FILE
    +        cat $NIX_SSL_CERT_FILE
    +        echo "Read $NIX_SSL_CERT_FILE successfully"
    +        exit 1
    +
             if [ -n "''${cargoRoot-}" ]; then
               cd "$cargoRoot"
             fi
    diff --git a/pkgs/by-name/md/mdbook/package.nix b/pkgs/by-name/md/mdbook/package.nix
    index cd6c6ebe79b9..445cd48d6aed 100644
    --- a/pkgs/by-name/md/mdbook/package.nix
    +++ b/pkgs/by-name/md/mdbook/package.nix
    @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec {
       cargoDeps = rustPlatform.fetchCargoVendor {
         inherit pname version src;
         allowGitDependencies = false;
    -    hash = "sha256-ASPRBAB+elJuyXpPQBm3WI97wD3mjoO1hw0fNHc+KAw=";
    +    hash = "";
       };
    
       nativeBuildInputs = [ installShellFiles ];

    and try building mdbook with nix-build -A mdbook

    Can it read it successfully?
    Is the path the same as in your config or your shell?

  7. futile commented on Jun 2, 2025

    @futile
    ContributorAuthor

    Oh, I see, you're getting this error without the sandbox being enabled.

    Could you send in what your $NIX_SSL_CERT_FILE is in your normal shell? Is it /etc/nix/MyCompanyRootCertificateCombined.pem?

    $ echo $NIX_SSL_CERT_FILE
    /Users/frath/.local/share/company-tool-certs/MyCompanyRootCertificateCombined.pem
    

    Does /etc/nix/MyCompanyRootCertificateCombined.pem actually exist on your system?

    $ file /etc/nix/MyCompanyRootCertificateCombined.pem
    /etc/nix/MyCompanyRootCertificateCombined.pem: symbolic link to /Users/frath/.local/share/company-tool-certs/MyCompanyRootCertificateCombined.pem
    

    Also what is $NIX_SSL_CERT_FILE in your nix build environment? To find out, try applying this patch to your local checkout of nixpkgs

    diff --git a/pkgs/build-support/rust/fetch-cargo-vendor.nix b/pkgs/build-support/rust/fetch-cargo-vendor.nix
    index ce015b099382..8d10475c3487 100644
    --- a/pkgs/build-support/rust/fetch-cargo-vendor.nix
    +++ b/pkgs/build-support/rust/fetch-cargo-vendor.nix
    @@ -71,6 +71,11 @@ let
           buildPhase = ''
             runHook preBuild
    
    +        echo $NIX_SSL_CERT_FILE
    +        cat $NIX_SSL_CERT_FILE
    +        echo "Read $NIX_SSL_CERT_FILE successfully"
    +        exit 1
    +
             if [ -n "''${cargoRoot-}" ]; then
               cd "$cargoRoot"
             fi
    diff --git a/pkgs/by-name/md/mdbook/package.nix b/pkgs/by-name/md/mdbook/package.nix
    index cd6c6ebe79b9..445cd48d6aed 100644
    --- a/pkgs/by-name/md/mdbook/package.nix
    +++ b/pkgs/by-name/md/mdbook/package.nix
    @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec {
       cargoDeps = rustPlatform.fetchCargoVendor {
         inherit pname version src;
         allowGitDependencies = false;
    -    hash = "sha256-ASPRBAB+elJuyXpPQBm3WI97wD3mjoO1hw0fNHc+KAw=";
    +    hash = "";
       };
    
       nativeBuildInputs = [ installShellFiles ];

    and try building mdbook with nix-build -A mdbook

    Uhh, well, looks like that doesn't properly use the custom certificate?

    $ nix-build -A mdbook
    warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
    these 2 derivations will be built:
      /nix/store/q978yk1jgdvq9mvk3w176k9k1ky66nxb-source.drv
      /nix/store/hnmhryfxc0y8pv47vyf0w1lxr5ym5pnp-mdbook-0.4.50.drv
    these 4 paths will be fetched (23.03 MiB download, 213.86 MiB unpacked):
      /nix/store/9kazfv9mlrk56mghh6cxfvrf7pl2k8c5-auditable-cargo-1.86.0
      /nix/store/v9kavzgzbym8adb6p7nxgid13jz76411-cargo-1.86.0
      /nix/store/rjxb9p81qrwa9p2m4sncx50cxp422k4y-mdbook-0.4.50-vendor
      /nix/store/sg9421abrr6af5kcg50gvyhlf11syhwv-rustc-wrapper-1.86.0
    copying path '/nix/store/rjxb9p81qrwa9p2m4sncx50cxp422k4y-mdbook-0.4.50-vendor' from 'https://cache.nixos.org'...
    copying path '/nix/store/sg9421abrr6af5kcg50gvyhlf11syhwv-rustc-wrapper-1.86.0' from 'https://cache.nixos.org'...
    building '/nix/store/q978yk1jgdvq9mvk3w176k9k1ky66nxb-source.drv'...
    copying path '/nix/store/v9kavzgzbym8adb6p7nxgid13jz76411-cargo-1.86.0' from 'https://cache.nixos.org'...
    
    trying https://github.com/rust-lang/mdBook/archive/refs/tags/v0.4.50.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (60) SSL certificate problem: self-signed certificate in certificate chain
    More details here: https://curl.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the webpage mentioned above.
    Warning: Problem (retrying all errors). Will retry in 1 second. 3 retries left.
    copying path '/nix/store/9kazfv9mlrk56mghh6cxfvrf7pl2k8c5-auditable-cargo-1.86.0' from 'https://cache.nixos.org'...
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (60) SSL certificate problem: self-signed certificate in certificate chain
    More details here: https://curl.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the webpage mentioned above.
    Warning: Problem (retrying all errors). Will retry in 2 seconds. 2 retries
    Warning: left.
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (60) SSL certificate problem: self-signed certificate in certificate chain
    More details here: https://curl.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the webpage mentioned above.
    Warning: Problem (retrying all errors). Will retry in 4 seconds. 1 retry left.
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (60) SSL certificate problem: self-signed certificate in certificate chain
    More details here: https://curl.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the webpage mentioned above.
    error checking the existence of https://tarballs.nixos.org/sha256/:
    curl: (60) SSL certificate problem: self-signed certificate in certificate chain
    More details here: https://curl.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the webpage mentioned above.
    error: cannot download source from any mirror
    error: builder for '/nix/store/q978yk1jgdvq9mvk3w176k9k1ky66nxb-source.drv' failed with exit code 1;
           last 25 log lines:
           > Warning: Problem (retrying all errors). Will retry in 2 seconds. 2 retries
           > Warning: left.
           >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
           > curl: (60) SSL certificate problem: self-signed certificate in certificate chain
           > More details here: https://curl.se/docs/sslcerts.html
           >
           > curl failed to verify the legitimacy of the server and therefore could not
           > establish a secure connection to it. To learn more about this situation and
           > how to fix it, please visit the webpage mentioned above.
           > Warning: Problem (retrying all errors). Will retry in 4 seconds. 1 retry left.
           >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
           > curl: (60) SSL certificate problem: self-signed certificate in certificate chain
           > More details here: https://curl.se/docs/sslcerts.html
           >
           > curl failed to verify the legitimacy of the server and therefore could not
           > establish a secure connection to it. To learn more about this situation and
           > how to fix it, please visit the webpage mentioned above.
           > error checking the existence of https://tarballs.nixos.org/sha256/:
           > curl: (60) SSL certificate problem: self-signed certificate in certificate chain
           > More details here: https://curl.se/docs/sslcerts.html
           >
           > curl failed to verify the legitimacy of the server and therefore could not
           > establish a secure connection to it. To learn more about this situation and
           > how to fix it, please visit the webpage mentioned above.
           > error: cannot download source from any mirror
           For full logs, run 'nix log /nix/store/q978yk1jgdvq9mvk3w176k9k1ky66nxb-source.drv'.
    error: 1 dependencies of derivation '/nix/store/hnmhryfxc0y8pv47vyf0w1lxr5ym5pnp-mdbook-0.4.50.drv' failed to build
    

    Can it read it successfully? Is the path the same as in your config or your shell?

    See above, errors out sadly :/

    Thanks so much for your help already! 🙏

  8. TomaSajt commented on Jun 2, 2025

    @TomaSajt
    Contributor

    Thank you for the info.

    Looking at the logs you sent, you might have accidentally removed the hash from src instead of cargoDeps.

    You don't have to send the part where it prints the entire certificate, only the part where it say that it was able to read it successfully or it got permission denied.

    Btw a "fix" for unreadable certs (#401942) was merged into staging-next, so keep an eye out for that: #412425
    (25.05 will probably only get this fix in a later staging-25.05-next cycle...)

    But maybe it's not fixed by it, since your problems seem a little bit more nuanced that that...
    In any case, once you send the logs, maybe I can figure something out.

  9. futile commented on Jun 2, 2025

    @futile
    ContributorAuthor

    Thank you for the info.

    Looking at the logs you sent, you might have accidentally removed the hash from src instead of cargoDeps.

    Ahh, the syntax of that changed in the meantime, that was also why the patch didn't apply.
    Used this now instead:

      useFetchCargoVendor = true;
      cargoHash = "";

    You don't have to send the part where it prints the entire certificate, only the part where it say that it was able to read it successfully or it got permission denied.

    So yeah, looks like it is trying to take the certificate from /etc/nix/... during the buildPhase, which should indeed not be allowed..

    $ nix-build -A mdbook
    warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
    these 3 derivations will be built:
      /nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv
      /nix/store/30n6s48n9nnql8jw8zyhjlvkj1d1yyhl-mdbook-0.4.50-vendor.drv
      /nix/store/wj0c96cd2qxcc3bfq12msn6221mz64xw-mdbook-0.4.50.drv
    building '/nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv'...
    Running phase: unpackPhase
    unpacking source archive /nix/store/g2c9xjv0wfmpwj0nbr3ay1afw44awyzd-source
    source root is source
    Running phase: patchPhase
    Running phase: updateAutotoolsGnuConfigScriptsPhase
    Running phase: buildPhase
    /etc/nix/MyCompanyRootCertificateCombined.pem
    cat: /etc/nix/MyCompanyRootCertificateCombined.pem: Operation not permitted
    error: builder for '/nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv' failed with exit code 1;
           last 8 log lines:
           > Running phase: unpackPhase
           > unpacking source archive /nix/store/g2c9xjv0wfmpwj0nbr3ay1afw44awyzd-source
           > source root is source
           > Running phase: patchPhase
           > Running phase: updateAutotoolsGnuConfigScriptsPhase
           > Running phase: buildPhase
           > /etc/nix/MyCompanyRootCertificateCombined.pem
           > cat: /etc/nix/MyCompanyRootCertificateCombined.pem: Operation not permitted
           For full logs, run 'nix log /nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv'.
    error: 1 dependencies of derivation '/nix/store/30n6s48n9nnql8jw8zyhjlvkj1d1yyhl-mdbook-0.4.50-vendor.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/wj0c96cd2qxcc3bfq12msn6221mz64xw-mdbook-0.4.50.drv' failed to build
    

    To be clear, I didn't configure the certificate itself through Nix (e.g., using cacert. in my NixOS config), but simply created the symlink at /etc/nix/MyCompanyRootCertificateCombined.pem manually.

    Btw a "fix" for unreadable certs (#401942) was merged into staging-next, so keep an eye out for that: #412425 (25.05 will probably only get this fix in a later staging-25.05-next cycle...)

    I'm on unstable, so should already have that, I think.
    My current flake input for nixpkgs:

    $ nix flake metadata
    ...
    nixpkgs: github:nixos/nixpkgs/063f43f2dbdef86376cc29ad646c45c46e93234c?narHash=sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o%3D (2025-05-23 18:48:26)
    ...
    

    But maybe it's not fixed by it, since your problems seem a little bit more nuanced that that... In any case, once you send the logs, maybe I can figure something out.

    Sure! Thank you very much! :)

  10. TomaSajt commented on Jun 2, 2025

    @TomaSajt
    Contributor

    staging-next has not been merged into unstable yet, so unstable doesn't have the fix yet.
    Also, it's a "fix" because it just falls back to the non-custom certificate if it cannot read it, which, I expect, is not what you really want.


    Also, is this happening with sandbox=true or sandbox=false?
    I expected this behaviour with sandbox=true, but not with sandbox=false.
    Can you confirm which is value you are using currently?

  11. futile commented on Jun 2, 2025

    @futile
    ContributorAuthor

    staging-next has not been merged into unstable yet, so unstable doesn't have the fix yet. Also, it's a "fix" because it just falls back to the non-custom certificate if it cannot read it, which, I expect, is not what you really want.

    Ah, got it, yeah makes sense. Yup, that probably won't work for me, because in my case the custom cert is required to download anything.

    Also, is this happening with sandbox=true or sandbox=false? I expected this behaviour with sandbox=true, but not with sandbox=false. Can you confirm which is value you are using currently?

    Actually, both. See my config that I linked earlier in this thread, which set sandbox = true.

    I just changed it to sandbox = false, then ran sudo launchctl kickstart -k system/org.nixos.nix-daemon, but the same error occurs:

    ❯ nix-shell -p nix-info --run "nix-info -m"
     - system: `"aarch64-darwin"`
     - host os: `Darwin 24.5.0, macOS 15.5`
     - multi-user?: `yes`
     - sandbox: `no`
     - version: `nix-env (Nix) 2.24.9`
     - nixpkgs: `/nix/store/khwrmv3vkmc60ig18h90rf0iadis95na-source`
    
    ❯ nix-build -A mdbook
    warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
    these 3 derivations will be built:
      /nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv
      /nix/store/30n6s48n9nnql8jw8zyhjlvkj1d1yyhl-mdbook-0.4.50-vendor.drv
      /nix/store/wj0c96cd2qxcc3bfq12msn6221mz64xw-mdbook-0.4.50.drv
    building '/nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv'...
    Running phase: unpackPhase
    unpacking source archive /nix/store/g2c9xjv0wfmpwj0nbr3ay1afw44awyzd-source
    source root is source
    Running phase: patchPhase
    Running phase: updateAutotoolsGnuConfigScriptsPhase
    Running phase: buildPhase
    /etc/nix/MyCompanyRootCertificateCombined.pem
    cat: /etc/nix/MyCompanyRootCertificateCombined.pem: Permission denied
    error: builder for '/nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv' failed with exit code 1;
           last 8 log lines:
           > Running phase: unpackPhase
           > unpacking source archive /nix/store/g2c9xjv0wfmpwj0nbr3ay1afw44awyzd-source
           > source root is source
           > Running phase: patchPhase
           > Running phase: updateAutotoolsGnuConfigScriptsPhase
           > Running phase: buildPhase
           > /etc/nix/MyCompanyRootCertificateCombined.pem
           > cat: /etc/nix/MyCompanyRootCertificateCombined.pem: Permission denied
           For full logs, run 'nix log /nix/store/pyxfdhv37lbwjj2cqrqybvkkww5gns9s-mdbook-0.4.50-vendor-staging.drv'.
    error: 1 dependencies of derivation '/nix/store/30n6s48n9nnql8jw8zyhjlvkj1d1yyhl-mdbook-0.4.50-vendor.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/wj0c96cd2qxcc3bfq12msn6221mz64xw-mdbook-0.4.50.drv' failed to build
    

    Does that make sense (somehow)? 😅

  12. TomaSajt commented on Jun 2, 2025

    @TomaSajt
    Contributor

    Can you try making the cert readable by anyone?
    I'd assume that because the real file is in your home directory, it's going to have owner-only read perms.

  13. futile commented on Jun 2, 2025

    @futile
    ContributorAuthor
    ❯ command ls -la (readlink -f /etc/nix/MyCompanyRootCertificateCombined.pem)
    -rw-r--r--  1 frath  staff  248523 Oct 18  2024 /Users/frath/.local/share/company-tool-certs/MyCompanyRootCertificateCombined.pem
    

    and

    ❯ command ls -la /etc/nix/MyCompanyRootCertificateCombined.pem
    lrwxr-xr-x  1 root  wheel  85 Oct 18  2024 /etc/nix/MyCompanyRootCertificateCombined.pem -> /Users/frath/.local/share/company-tool-certs/MyCompanyRootCertificateCombined.pem
    

    Looks like it should be readable by everybody? Or am I missing some well-known thing about unix permissions again, which is very probable? 😄

  14. TomaSajt commented on Jun 2, 2025

    @TomaSajt
    Contributor

    Maybe every parent dir needs to be readable as well... not sure
    So if thats the case, maybe but your cert into some world readable dir and symlink it into your original location. (Esentially inverting your current symlink setup)

  15. futile commented on Jun 3, 2025

    @futile
    ContributorAuthor

    Maybe every parent dir needs to be readable as well... not sure So if thats the case, maybe but your cert into some world readable dir and symlink it into your original location. (Esentially inverting your current symlink setup)

    That was it! Well, I didn't completely invert the setup, but simply copied the cert-chain to /etc/nix/MyCompanyRootCertificateCombined.pem, and now when trying to build mdbook it correctly prints the whole certificate chain from the file.

    Now gitbutler built successfully as well :)

    Thanks for your continuous help! Should I post my use-case, i.e., symlink to a non-world-readable certificate, in an existing issue or somewhere else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: build failure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions