Stream: beginners

Topic: Nix


view this post on Zulip Luiz de Oliveira (Oct 31 2021 at 20:39):

I can't run nix-shell. It runs if I use sudo, but is it suposed to need sudo to run?

image.png

view this post on Zulip Luiz de Oliveira (Oct 31 2021 at 20:43):

Can't run the editor:
image.png

Can't install vulkan adapter:
image.png
image.png

view this post on Zulip Brian Hicks (Oct 31 2021 at 22:00):

You shouldn’t have to use sudo. How did you install Nix? It should have a nixpkgs definition be default too

view this post on Zulip Anton (Nov 01 2021 at 08:24):

Yeah I'd recommend uninstalling nix and installing with:

curl -L https://nixos.org/nix/install | sh

The installer will ask for your sudo password when it needs it.

view this post on Zulip Anton (Nov 01 2021 at 08:54):

I'll add a tip in the Request adapter error message on how to run the editor from nix.

view this post on Zulip Locria Cyber (Nov 01 2021 at 13:51):

I'm not familiar with Nix

view this post on Zulip Locria Cyber (Nov 01 2021 at 13:52):

how do I set the default linker for rust?

view this post on Zulip Anton (Nov 01 2021 at 13:55):

https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker

view this post on Zulip Locria Cyber (Nov 01 2021 at 13:56):

That's not for Nix

view this post on Zulip Locria Cyber (Nov 01 2021 at 13:57):

I found this tutorial
https://www.boronine.com/2018/02/02/Nix/#case-study-hsluv

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:09):

Who designed this language?

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:13):

I hate Nix

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:19):

I give up

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:20):

because obviously you can't create a folder whatsoever

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:20):

in pkgs.mkShell {
  name = "roc";
  buildInputs = inputs ++ darwinInputs ++ linuxInputs;

  # Additional Env vars
  LLVM_SYS_120_PREFIX = "${llvmPkgs.llvm.dev}";
  LD_LIBRARY_PATH = with pkgs;
    lib.makeLibraryPath
    ([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
  NIX_GLIBC_PATH =
    if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";

  shellHook = ''
    mkdir -p $out/bin  # permission denied
    ln -sf $mold/bin/mold $out/bin/ld
  '';
}

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:21):

the documentation of commands like mkShell is obscure. I'm not sure if the authors have written any

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:22):

The official documentation of nix-shell mentions none of how to configure the shell in Nix.

view this post on Zulip Anton (Nov 01 2021 at 14:25):

There already is a shell.nix file in the roc repo which is loaded when you execute nix-shell. From that shell you can execute cargo build, cargo test, cargo run repl... . Is there something else you are trying to configure?

view this post on Zulip Luiz de Oliveira (Nov 01 2021 at 14:33):

Brian Hicks said:

You shouldn’t have to use sudo. How did you install Nix? It should have a nixpkgs definition be default too

I just ran: curl -L https://nixos.org/nix/install | sh
From here: https://nixos.org/download.html

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:34):

I want to symlink mold to bin/ld, and Nix says I don't have permission

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:37):

The online documentation is useless: https://nixos.org/guides/dev-environment.html

view this post on Zulip Anton (Nov 01 2021 at 14:40):

I think @Folkert de Vries tested mold for roc a while ago and I think it was not faster in our case.

view this post on Zulip Folkert de Vries (Nov 01 2021 at 14:43):

can't hurt to try it again though. it really should be much faster ...

view this post on Zulip Anton (Nov 01 2021 at 14:44):

Can you just set mold to be the linker with rustflags Folkert?

view this post on Zulip Locria Cyber (Nov 01 2021 at 14:49):

I already did. Nix doesn't respect that

view this post on Zulip Folkert de Vries (Nov 01 2021 at 14:59):

I think you'd need to set some environment variable

view this post on Zulip Locria Cyber (Nov 01 2021 at 15:13):

I give up

view this post on Zulip Locria Cyber (Nov 01 2021 at 15:14):

I'll try out guix, which has better documentation

view this post on Zulip Brian Hicks (Nov 01 2021 at 15:36):

I think we might want to separate these two conversations. I'm going to proceed helping Luiz here since he opened the topic.

view this post on Zulip Brian Hicks (Nov 01 2021 at 15:38):

@Luiz de Oliveira I'm guessing you're on Linux, right? I think the move here is going to be to remove Nix completely and reinstall it (unless you have built something precious that lives in the Nix store?) Lemme try and find you some up-to-date instructions for doing that.

view this post on Zulip Brian Hicks (Nov 01 2021 at 15:40):

ah, https://nixos.org/download.html#nix-uninstall says you just have to remove /nix. However, based on your screenshots I'm guessing that some part of your profile may also be set up to try and connect to a Nix daemon instead of using the single-user mode. Since that's the case, it may be helpful to remove dotfiles starting in ~and ~/.config that have "nix" in the name.

view this post on Zulip Anton (Nov 01 2021 at 18:04):

@Luiz de Oliveira you may have ran a nix command with sudo once which could have altered permissions for some files/directories, causing you to no longer be able to execute the same command without sudo.

view this post on Zulip Notification Bot (Nov 02 2021 at 19:46):

Luiz de Oliveira has marked this topic as resolved.

view this post on Zulip Luiz de Oliveira (Nov 02 2021 at 19:47):

Yeah, it worked. I had to do a full uninstall also deleting related config and other stuff from my home directory.

view this post on Zulip Locria Cyber (Nov 03 2021 at 07:07):

Nix is really poorly designed

view this post on Zulip Locria Cyber (Nov 03 2021 at 07:07):

In here https://medium.com/att-israel/how-nix-shell-saved-our-teams-sanity-a22fe6668d0e

view this post on Zulip Locria Cyber (Nov 03 2021 at 07:07):

image.png

view this post on Zulip Locria Cyber (Nov 03 2021 at 07:08):

{ lib
, stdenv
, fetchurl
, testVersion
, hello
}:

stdenv.mkDerivation rec {
  pname = "hello";
  version = "2.10";

  src = fetchurl {
    url = "mirror://gnu/hello/${pname}-${version}.tar.gz";
    sha256 = "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i";
  };

  doCheck = true;

  passthru.tests.version =
    testVersion { package = hello; };

  meta = with lib; {
    description = "A program that produces a familiar, friendly greeting";
    longDescription = ''
      GNU Hello is a program that prints "Hello, world!" when you run it.
      It is fully customizable.
    '';
    homepage = "https://www.gnu.org/software/hello/manual/";
    changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}";
    license = licenses.gpl3Plus;
    maintainers = [ maintainers.eelco ];
    platforms = platforms.all;
  };
}

view this post on Zulip Locria Cyber (Nov 03 2021 at 07:09):

Why the derivation description itself doesn't include how to build the derivation?

view this post on Zulip Locria Cyber (Nov 03 2021 at 07:11):

On the other hand, guix assumes you use bash because it only integrates with bash, and you have to specify all the dependencies as command line arguments.

view this post on Zulip Lucas Rosa (Nov 03 2021 at 21:33):

It is tough at first but idk about poorly designed

view this post on Zulip Lucas Rosa (Nov 03 2021 at 21:33):

It definitely lacks thorough documentation

view this post on Zulip Lucas Rosa (Nov 03 2021 at 21:33):

Which is a pain

view this post on Zulip Nigel Thorne (Nov 04 2021 at 20:38):

I've been trying to spin up the nix shell too.

On osx it gets stuck with 'zig-0.8.1 is broken' (not going to work any time soon).

On Ubuntu I get a 'glibc 2.33 not found ' error. Googling it tells me the system version has to match; so I upgrade Ubuntu to hairy hippo. Now the system version matches... same error. :(

view this post on Zulip Brendan Hansknecht (Nov 04 2021 at 20:53):

Is the glibc error when loading the nix shell or when trying to running certain roc tests?

view this post on Zulip Anton (Nov 05 2021 at 08:20):

On osx it gets stuck with 'zig-0.8.1 is broken'

This should've been fixed a couple of days ago, make sure to use the latest trunk. I'm still working on making nix work on M1 macs but otherwise you should be good.

On Ubuntu I get a 'glibc 2.33 not found ' error.

Can you share the complete error? Some shells like zsh can produce this error because its dependencies were linked with a different version of glibc than what we use inside nix (I think).

view this post on Zulip Anton (Nov 05 2021 at 12:22):

Anton said:

I'm still working on making nix work on M1 macs but otherwise you should be good.

Fix for M1 macs is now available on the branch nix_M1_fix_v2

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:01):

I actually have the same problem trying nix-shell on NixOS:

patching script interpreter paths in /nix/store/jb21sa8n3nhqmiscqg8cmi7xm8qs3yns-niv-0.2.19-data
checking for references to /build/ in /nix/store/jb21sa8n3nhqmiscqg8cmi7xm8qs3yns-niv-0.2.19-data...
bash: /nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib/libc.so.6: version `GLIBC_2.33' not found (required by /nix/store/jzjqfff4cldlm2wpld313a2s1v6r3ycb-ncurses-6.2/lib/libncursesw.so.6)

view this post on Zulip Lucas Rosa (Nov 05 2021 at 13:08):

hm that’s odd

view this post on Zulip Lucas Rosa (Nov 05 2021 at 13:08):

Maybe libncurses needs to be explicitly listed?

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:12):

Oh, I think I found the problem, at least on the NixOS: https://github.com/NixOS/nixpkgs/issues/141323

view this post on Zulip Anton (Nov 05 2021 at 13:17):

We have this issue tracked as #1846.

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:21):

Anton said:

We have this issue tracked as #1846.

Ah, nice, thanks! I somehow missed it while browsing Roc issues.

view this post on Zulip Anton (Nov 05 2021 at 13:21):

Yeah, I improved the title just now :)

view this post on Zulip Lucas Rosa (Nov 05 2021 at 13:23):

oh I see it’s because ncurses IS explicitly listed

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:32):

Yep, not sure if this breaks anything down the line for the linker, but not listing ncurses explicitly in LD_LIBRARY_PATH in shell.nix does make the error disappear. I'll try building REPL in the spawned shell and see if it trips up the linker and/or loader.

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:34):

REPL and the editor started just fine. How about the tests, let's see

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:35):

FYI, I love the look and feel of the editor!

view this post on Zulip Jakub Konka (Nov 05 2021 at 13:38):

Haha, nvm, lack of ncurses in the ld path means I cannot spawn my dev tools like Vim for instance.

view this post on Zulip Lucas Rosa (Nov 05 2021 at 13:44):

aahhh makes sense

view this post on Zulip Lucas Rosa (Nov 05 2021 at 13:45):

btw if you want decent highlighting for now on roc files, setting it to coffeescript should work fine

view this post on Zulip Brendan Hansknecht (Nov 05 2021 at 16:22):

Nigel Thorne said:

On Ubuntu I get a 'glibc 2.33 not found ' error. Googling it tells me the system version has to match; so I upgrade Ubuntu to hairy hippo. Now the system version matches... same error. :(

I actually just ran into this on my machine, not sure the exact cause, but it seems related to direnv and impure environments. Disabling direnv, and then running nix-shell --pure everything works on the latest trunk.

view this post on Zulip Brendan Hansknecht (Nov 05 2021 at 16:28):

Oh, actually direnv does still work, I had just accidentally tried to use nix-shell while in direnv

view this post on Zulip Brendan Hansknecht (Nov 05 2021 at 16:29):

But either way, may relate to the issue listed here and errors like: nix-shell: /nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib/libc.so.6: version 'GLIBC_2.33' not found (required by /nix/store/7fv9v6mnlkb4ddf9kz1snknbvbfbcbx0-gcc-10.3.0-lib/lib/libstdc++.so.6)

view this post on Zulip Nigel Thorne (Nov 06 2021 at 09:10):

I checked out trunk and nix-shell worked fine. Then cargo run repl also worked fine. :) very happy. -- on ubuntu (hippo)

view this post on Zulip Leonardo Taglialegne (Nov 06 2021 at 17:49):

I too found the version 'GLIBC_2.33' not found error, which is very surprising to me considering I'm on NixOS o.O read backscroll better

view this post on Zulip Locria Cyber (Nov 08 2021 at 06:20):

Wow now I can't build with nix

> nix-shell
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
these derivations will be built:
  /nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv
these paths will be fetched (6.66 MiB download, 44.85 MiB unpacked):
  /nix/store/32r66ar7hxcc4a6hh26yx49w79bjhnw7-git-2.33.0
  /nix/store/qlhf7i79i8gqr3jm8ibf317q3v1l7wrb-openssh-8.7p1
copying path '/nix/store/qlhf7i79i8gqr3jm8ibf317q3v1l7wrb-openssh-8.7p1' from 'https://cache.nixos.org'...
building '/nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv'...
unpacking sources
unpacking source archive /nix/store/07zhrxz5nwszhzclpff6acz4psciwfx5-source
source root is source
patching sources
configuring
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/doc/DebugIR -DCMAKE_INSTALL_INFODIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/include -DCMAKE_INSTALL_SBINDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin/strip -DCMAKE_RANLIB=/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin/ranlib -DCMAKE_AR=/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/gcc
-- Check for working C compiler: /nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/gcc - broken
CMake Error at /nix/store/m33sn6h5kgfbk3z4avwmgxam1dny07i0-cmake-3.21.2/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /build/source/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/nix/store/xgp0bgw4rpnbc3vr2qdsdbixp3zy4v1l-gnumake-4.3/bin/make -f Makefile cmTC_9664f/fast && /nix/store/xgp0bgw4rpnbc3vr2qdsdbixp3zy4v1l-gnumake-4.3/bin/make  -f CMakeFiles/cmTC_9664f.dir/build.make CMakeFiles/cmTC_9664f.dir/build
    make: /bin/sh: No such file or directory
    make: *** [Makefile:127: cmTC_9664f/fast] Error 127





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!
See also "/build/source/build/CMakeFiles/CMakeOutput.log".
See also "/build/source/build/CMakeFiles/CMakeError.log".
builder for '/nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv' failed with exit code 1
error: build of '/nix/store/gvwsn2qi4cqwk2xz79pmsdv4cpa0hkgn-git-2.33.0.drv', '/nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv' failed

view this post on Zulip Locria Cyber (Nov 08 2021 at 06:21):

pain

view this post on Zulip Locria Cyber (Nov 08 2021 at 06:21):

docker it is

view this post on Zulip Anton (Nov 08 2021 at 09:32):

I did some searching, Archlinux does not allow unpriviliged user namespaces by default.
Running sudo sysctl kernel.unprivileged_userns_clone=1 and installing nix again sh <(curl -L https://nixos.org/nix/install) --daemon should fix the issue.
I'll add this tip to BUILDING_FROM_SOURCE.md

view this post on Zulip Jakub Konka (Nov 08 2021 at 10:03):

Locria Cyber said:

Wow now I can't build with nix

> nix-shell
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
these derivations will be built:
  /nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv
these paths will be fetched (6.66 MiB download, 44.85 MiB unpacked):
  /nix/store/32r66ar7hxcc4a6hh26yx49w79bjhnw7-git-2.33.0
  /nix/store/qlhf7i79i8gqr3jm8ibf317q3v1l7wrb-openssh-8.7p1
copying path '/nix/store/qlhf7i79i8gqr3jm8ibf317q3v1l7wrb-openssh-8.7p1' from 'https://cache.nixos.org'...
building '/nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv'...
unpacking sources
unpacking source archive /nix/store/07zhrxz5nwszhzclpff6acz4psciwfx5-source
source root is source
patching sources
configuring
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/doc/DebugIR -DCMAKE_INSTALL_INFODIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/include -DCMAKE_INSTALL_SBINDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin/strip -DCMAKE_RANLIB=/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin/ranlib -DCMAKE_AR=/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/da0k3xqppn4a3mkc1swb7sni4lk6nvak-debugir
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/gcc
-- Check for working C compiler: /nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/gcc - broken
CMake Error at /nix/store/m33sn6h5kgfbk3z4avwmgxam1dny07i0-cmake-3.21.2/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /build/source/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/nix/store/xgp0bgw4rpnbc3vr2qdsdbixp3zy4v1l-gnumake-4.3/bin/make -f Makefile cmTC_9664f/fast && /nix/store/xgp0bgw4rpnbc3vr2qdsdbixp3zy4v1l-gnumake-4.3/bin/make  -f CMakeFiles/cmTC_9664f.dir/build.make CMakeFiles/cmTC_9664f.dir/build
    make: /bin/sh: No such file or directory
    make: *** [Makefile:127: cmTC_9664f/fast] Error 127





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!
See also "/build/source/build/CMakeFiles/CMakeOutput.log".
See also "/build/source/build/CMakeFiles/CMakeError.log".
builder for '/nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv' failed with exit code 1
error: build of '/nix/store/gvwsn2qi4cqwk2xz79pmsdv4cpa0hkgn-git-2.33.0.drv', '/nix/store/qkwcp87v5md9b61szs34sbcagmmp31n5-debugir.drv' failed

I had the same problem with Zig's stage2 compiler - we also use CMake and by virtue of deriving stdenv in NIxOS, we use gcc instead of clang as the default compiler. I wonder if this is a gcc regression in NixOS itself.

view this post on Zulip Luiz de Oliveira (Nov 10 2021 at 02:02):

@Locria Cyber I had the same errors you were talking about in #ideas until I did this:

First, it only worked if when ran nix-shell for the first time on the project folder from Bash. I was using zsh and for some reason, it wouldn't work. So you might have to uninstall nix, install it again using bash, and then run nix-shell from bash from the project folder. If you're not using zsh then, of course, it doesn't apply.

Check these files, if they exist, try to uninstall nix and delete them too.

/var/lib/systemd/deb-systemd-helper-enabled/nix-daemon.socket.dsh-also
/var/lib/systemd/deb-systemd-helper-enabled/nix-daemon.service.dsh-also

To uninstall nix you will need to do the following things:

remove the . "$HOME/.nix-profile/etc/profile.d/nix.sh" line in your ~/.profile or ~/.bash_profile
rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}
sudo rm -rf /nix
On a multi-user install, also remove all the nixbld[0-9] users

Sources: https://github.com/NixOS/nix/issues/1402
https://github.com/NixOS/nix/issues/5485

view this post on Zulip Jarl André Hübenthal (Nov 11 2021 at 09:37):

Shouldnt we use flakes :innocent: instead of nix Shell which is not fully Isolated

view this post on Zulip Anton (Nov 11 2021 at 12:24):

Flakes sound cool! It's something I'm willing to try. There are quite a few people here with more nix experience than me, I'd love to hear their take on it!

view this post on Zulip Brian Hicks (Nov 11 2021 at 12:56):

Flakes are very cool but are not fully released yet. You have to install a different Nix command and enable experimental features.

view this post on Zulip Brian Hicks (Nov 11 2021 at 12:57):

as soon as they’re stable we should switch, though. I’ve been impressed with them so far and have switched all my machine configs to flakes.

view this post on Zulip Brian Hicks (Nov 11 2021 at 12:57):

it’s just too much of a hurdle yet though for a big shared project IMO

view this post on Zulip Anton (Nov 11 2021 at 14:02):

Thanks for the advice @Brian Hicks!

view this post on Zulip Lucas Rosa (Nov 11 2021 at 19:52):

Sounds cool

view this post on Zulip Ju Liu (Dec 06 2021 at 12:20):

haven't pulled the repo in a while. git pull, wait for nix to do its stuff, code is working. what's not to love??? :D

view this post on Zulip mostlyvoid (Mar 02 2022 at 10:42):

Hey all, how do I build the project on NixOS?
I tried git cloning it and launching nix-shell but getting this error.

bash: /nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib/libc.so.6: version `GLIBC_2.33' not found (required by /nix/store/wvh786yaz4pms5g46d74zyaxx0xamm4m-ncurses
-6.2/lib/libncursesw.so.6)

I am on a flake configured machine, if that is relevant.

view this post on Zulip Notification Bot (Mar 02 2022 at 10:43):

mostlyvoid has marked this topic as unresolved.

view this post on Zulip Anton (Mar 02 2022 at 11:52):

I get that error as well using nix from Ubuntu but the shell does successfully launch for me and I can run cargo run repl/cargo build/cargo run examples/hello-world/Hello.roc without problems.

view this post on Zulip Loric Brevet (Mar 02 2022 at 12:48):

Hey, I think your problem relates to the error raised in this issue: https://github.com/rtfeldman/roc/issues/1846

I also have it on Nix installed on Ubuntu. Does it prevent you from entering the shell?

view this post on Zulip mostlyvoid (Mar 02 2022 at 14:12):

The shell does not launch for me. If impurity is the cause of this error (as somebody pointed out in the Github issue), maybe we can have an alternative flake.nix for Nix Flakes based development? Though still marked experimental, it is kind of agreed upon that flakes are going to be part of Nix.

view this post on Zulip Loric Brevet (Mar 02 2022 at 15:06):

I am not sure what the solution could be because I don’t fully understand the problem ^^. Like why some parts of the shell.nix rely on (or fallback to) something from the underlying system? Or said differently, why do we have to bring impurities for this use case? I would have guessed that the glibc version could be fixed from within the shell.

Maybe this can be discussed more thoroughly on the issue. Especially if you think that flakes can fill the gap of this impurity

view this post on Zulip Anton (Mar 02 2022 at 15:28):

I'm good with trying out flakes. I can look at it this or next week, unless someone else wants to give it a try?

view this post on Zulip Anton (Mar 16 2022 at 18:42):

The nix flake is ready on the nix-flake branch, there is only support for Linux X86_64 for now.
I tested this on Ubuntu 20.04 and NixOS 21.11 .
Running cargo build does spam an ncurses versioning issue (#2735) but this does not appear to break anything.
Before trying this, make sure to install flakes if you have not yet done so.

view this post on Zulip Anton (Mar 16 2022 at 18:43):

Also, when using flakes you should start a shell with nix develop not nix shell.


Last updated: Jul 05 2025 at 12:14 UTC