Fix broken micromamba FHS environment

Hello!

For about a month I have been using the same shell.nix file (below) to run micromamba in an FHS environment on NixOS. It is based off the script given in the Python wiki pages, but I added that targetpkgs line to allow python to interface with R.

with import <nixpkgs> {}; (pkgs.buildFHSUserEnv { name = "fhs";
          profile = ''
                set -e
                eval "$(micromamba shell hook -s bash)"
                micromamba activate betaspiral
                set +e
  
              '';
      targetPkgs = pkgs: (builtins.concatLists [ [ micromamba ] [] [pkgs.which]]);
}).env

It was working great but starting this week, when I run nix-shell it fails on building libyaml. Here is the error in full:

 
 applying patch /nix/store/1jdigwdc9g4gg9k0dnwakpd851k9xcps-libyaml-cpp-Fix-pc-paths-for-absolute-GNUInstallDirs.patchj
 can't find file to patch at input line 3
 Perhaps you used the wrong -p or --strip option?
 The text leading up to this was:
 --------------------------
 |--- a/yaml-cpp.pc.in
 |+++ b/yaml-cpp.pc.in
 --------------------------
 File to patch: 
 Skip this patch? [y] 
 Skipping patch.
 1 out of 1 hunk ignored
 error: builder for '/nix/store/0ryh5fz3yvs8s56dc1kfifnfrry8i67w-libyaml-cpp-0.6.3.drv' failed with exit code 1;
        last 10 log lines:
        > Perhaps you used the wrong -p or --strip option?
        > The text leading up to this was:
        > --------------------------
        > |--- a/yaml-cpp.pc.in
        > |+++ b/yaml-cpp.pc.in
        > --------------------------
        > File to patch:
        > Skip this patch? [y]
        > Skipping patch.
        > 1 out of 1 hunk ignored
        For full logs, run 'nix log /nix/store/0ryh5fz3yvs8s56dc1kfifnfrry8i67w-libyaml-cpp-0.6.3.drv'.
error: 1 dependencies of derivation '/nix/store/5hiw1ipv6is5j02w8sxx4qqmjazg8f0j-micromamba-0.15.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4hkql9p4myhp4dyxxr9vxp7n1wmya8gd-fhs-usr-target.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c1pzs0mc5hl7cs0m1lf4yi4qv1l505mn-fhs-fhs.drv' failed to build
error: 1 dependencies of derivation '/nix/store/x6v6nk3w7cpq7mjl1hjgwxdg3j0vb2s6-fhs-init.drv' failed to build

I was wondering how I could fix/get around this error. I am very new to Nix so any help would be greatly appreciated.

Thank you!

Garrett

your not pinning your script, so as your nixpkgs channel advances, so does everything else.

if you can find out a pervious commit of nixpkgs that worked, you should be able to rewind to a time that it worked, it’s not a fix but will get you up and running.

you can read all about it here in this excellent post.

https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs

1 Like

Thank you so much! By pinning the script I was able to get back into a working state.

Thanks again,

Garrett

1 Like

Hi, I’m the maintainer of the package for micromamba. It looks like someone changed libyamlcpp in some way that broke micromamba. I guess I’ll run a bisect later.
In the meatime pin it to 799908d71c4b74c7d0e753c3860f4686790eddc8 , that definitely works.
Definitely pin as much as you can, as nixinator says :slight_smile:

Fixed in micromamba: fix libyamlcpp dependency by mausch · Pull Request #149478 · NixOS/nixpkgs · GitHub

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. FIXED!
Things like this is why nix/OS is my favourite linux right now.