Closed dezren39 closed 1 year ago
i tried disabling watchman because of systemd, but i'm still seeing some ln errors. maybe the rest still worked?
# manual user input: accept defaults [ y, {enter}*3, y*2, n ]
user@PF3EHGYL:~$ cd buck2-nix.sl/
direnv: loading ~/buck2-nix.sl/.envrc
direnv: using flake ./buck/nix --accept-flake-config
ln: failed to create symbolic link '/nix/var/nix/gcroots/per-user/user/home-user-buck2--nix.sl-.direnv-flake--profile--121fb47f0d42ebce46b17b5df030e132bcaba6b8': No such file or directory
ln: failed to create symbolic link '/nix/var/nix/gcroots/per-user/user/home-user-buck2--nix.sl-.direnv-flake--inputs--4w4b4mxfhdc9lf3rsf4qqa9z8xnijbxl--source': No such file or directory
ln: failed to create symbolic link '/nix/var/nix/gcroots/per-user/user/home-user-buck2--nix.sl-.direnv-flake--inputs--mcqspn5p5dy263y3nfb0dfzi7inms7j0--source': No such file or directory
ln: failed to create symbolic link '/nix/var/nix/gcroots/per-user/user/home-user-buck2--nix.sl-.direnv-flake--inputs--9hi5a1jrhqsgah4ma9asmyia0105drp5--source': No such file or directory
ln: failed to create symbolic link '/nix/var/nix/gcroots/per-user/user/home-user-buck2--nix.sl-.direnv-flake--inputs--yj1wxm9hh8610iyzqnz75kvs6xl8j3my--source': No such file or directory
ln: failed to create symbolic link '/nix/var/nix/gcroots/per-user/user/home-user-buck2--nix.sl-.direnv-flake--inputs--24vhlhl99pvzg32d50yvyqrw69w9c0r8--source': No such file or directory
direnv: nix-direnv: renewed cache
direnv: watchman: not enabled, because .use_watchman is missing, and we're not in a CI build
direnv: export +AR +AS +BUCK2_TEST_DISABLE_LOG_UPLOAD +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +_PYTHON_HOST_PLATFORM +_PYTHON_SYSCONFIGDATA_NAME +__structuredAttrs +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +preferLocalBuild +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS
when inside, buck2 build
starts and completes
user@PF3EHGYL:~/buck2-nix.sl$ buck2 build ///...
watchman fresh instance event, clearing cache
Build ID: 06bc7f4c-a94c-4a5d-8c29-8be29a90a0fc
Jobs completed: 159. Time elapsed: 117.3s. Cache hits: 0%. Commands: 28 (cached: 0, remote: 0, local: 28)
BUILD SUCCEEDED
my ln issues might wsl or those chmod/chown calls i had maybe
Yeah, if you use single user mode that should work to some degree. The single-user-mode (--no-daemon
) installer should have taken care of most of that setup stuff for you, though?
Really, the installer should be turned into a static executable that's produced, and it should use https://github.com/DeterminateSystems/nix-installer/ as a library to install Nix too on top of setting up buck and the repository, frankly. But the Nix installer worked out of the box for me on Windows 11, Ubuntu 22.04, systemd=true
in /etc/wsl.conf
, in daemon/multi-user mode.
Apparently systemd
in WSL2 is apparently only supported on Windows 11. I'm not super enthusiastic about taking reports about single-user mode Nix if you have problems, because it's often busted as hell — there is no guarantee any arbitrary .nix
file will actually work when you build it without the sandbox, it could just break — Nix expressions are often written with the benefit of the sandbox purifying the environment and aren't tested otherwise. But you can try enabling sandbox = true
and see if your WSL2 kernel supports enough cgroup stuff to work in single-user mode. The daemon is really a requirement for robust builds, though.
The ln
stuff is probably because direnv
expects the Nix installation to support per-user GC links in that directory, but it probably doesn't install that properly in single user mode.
That said, I'm glad it at least built for you! That's something...
Thanks! I'll look into using systemd with nix-installer and try again on one of my w11 boxes.
awesome! systemd works with windows 10 too now, just need to reinstall with windows store and you'll get the latest updates.
i tried nix-installer and it worked great but it installed like .14 and the scripts required .15 so i used the regular nix installer except without --no-daemon, and now that systemd is enabled i now have a working multiuser nix in both win10 and win11. after that, the direnv install worked fine and so did the nix run and the direnv load on directory change.
i'll close this ticket for now. it looks like setup is basically 'run nix installer, nix-env -i direnv, nix run ..., cd ...' which is very easy
here are some notes from installing, i have gotten as far as nix run completing and then running cd, but then i dont have systemd in wsl. if i throw this in a vm or container or something it probably would do systemd right and get to working on ubuntu?
final script essentially:
full script notes of first tries