Nixpkgs: can't build nixos-unstable: ...user-environment/share/mime/packages' does not exist!

Created on 6 Sep 2018  路  15Comments  路  Source: NixOS/nixpkgs

Issue description

I am on this commit ca2ba44cab47767c8127d1c8633e2b581644eb8f

and for some reason

  /nix/store/mykr9jcwszlm4dm11b04iqzma0mm5k7k-kernel-modules-shrunk.drv
  /nix/store/cyplzyfcfj6kbwbyxj6i865k1fasihl9-stage-1-init.sh.drv
  /nix/store/bvidg730pc3dpi75a9g8v8qgh4amf4vq-initrd.drv
  /nix/store/0lqk4xkq6ymklpfz7n2m04h9w8271js1-nixos-system-jedha-19.03.git.ca2ba44cab4.drv
building '/nix/store/2vaywry475m0m3d43pq1ky6zh7z3ryn0-system-path.drv'...
building '/nix/store/sxrkq6bcm4rb17vlwjl064scsbgz9a6h-user-environment.drv'...
building '/nix/store/s78mba4n6x37s9sssfs7nx8qybh79n82-xserver.conf.drv'...
building '/nix/store/zxj2nmjzkwi2kv8jchfy6pxmkdnf0yqn-xsession.drv'...
created 42 symlinks in user environment
Directory '/nix/store/dxmg6lfqacxl5kxq52p7887xfwpnw5c3-user-environment/share/mime/packages' does not exist!
note: keeping build directory '/tmp/nix-build-user-environment.drv-3'
builder for '/nix/store/sxrkq6bcm4rb17vlwjl064scsbgz9a6h-user-environment.drv' failed with exit code 1
note: keeping build directory '/tmp/nix-build-xserver.conf.drv-3'
note: keeping build directory '/tmp/nix-build-xsession.drv-3'
cannot build derivation '/nix/store/10s3b5mr4g0mp6kr7bkxf8f67qqi33rq-etc.drv': 1 dependencies couldn't be built

I tried reverting df05618f2a075c2c727bdcb6d44741d5d5c2ef16 to no avail (as it seemed losely related).
I also removed my overlay with a similar effect.

nixos

All 15 comments

Maybe try reverting https://github.com/NixOS/nixpkgs/pull/45058? What DE are you using?

@michaelpj you found the culprit :D (reverting #45058 fixes it) I use i3 but it is configured/installed via home-manager so that may have thrown off some assumptions ?

Hm, I think this is a bug in that PR since it shouldn't have changed anything...

I wonder if something links /share/mime/packages and assumes the parent exists when it might not?

Not at a computer now, but will try and look later.

Could you see if applying the following patch helps?

diff --git i/nixos/modules/config/xdg/mime.nix w/nixos/modules/config/xdg/mime.nix
index a21da05370e..825fb1975a5 100644
--- i/nixos/modules/config/xdg/mime.nix
+++ w/nixos/modules/config/xdg/mime.nix
@@ -15,7 +15,10 @@ with lib;
   };

   config = mkIf config.xdg.mime.enable {
-    environment.pathsToLink = [ "/share/mime" ];
+    environment.pathsToLink = [ 
+      "/share/mime" 
+      "/share/mime/packages" 
+    ];

     environment.systemPackages = [ 
       # this package also installs some useful data, as well as its utilities 

I'll be surprised if this works, since if it does I would have expected things to be broken before (nothing linked that path previously).

I've tried on another computer which exhibited the same error (same config so it makes sense) and applying the patch fixed it.

Naive question as I don't know that part of the code: wouln't adding "/share/mime" include "/share/mime/packages" ?

The /share/mime probably needs to be a directory instead of a symlink. Not sure how did it work before.

https://github.com/NixOS/nixpkgs/blob/d261df5fc15d41a4745e1f1482fd630d207d3f79/pkgs/build-support/buildenv/builder.pl#L34-L40

I'm a bit confused as to what we're supposed to put there. We do want /share/mime as it contains other things that should be linked, but we also want /share/mime/packages as that contains things that should be linked. Is it right to have both?

This error comes from update-mime-database:

https://cgit.freedesktop.org/xdg/shared-mime-info/tree/update-mime-database.c#n3703

Can someone try this patch:

```
diff --git a/nixos/modules/config/xdg/mime.nix b/nixos/modules/config/xdg/mime.nix
index f1b672234a3..5b494612874 100644
--- a/nixos/modules/config/xdg/mime.nix
+++ b/nixos/modules/config/xdg/mime.nix
@@ -24,6 +24,7 @@ with lib;

 environment.extraSetup = ''
   if [ -w $out/share/mime ]; then

  • mkdir -p $out/share/mime/packages
    XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null
    fi
    ```

That also looks plausible!

@matthewbauer the snippet makes the problem go away as well :)

Hi, I'm using nixos-unstable and run into this same issue. The fix doesn't seem to be available in master yet and therefore I can't apply it by upgrading my configuration.

I've also tried overriding the original module definition with a custom one, but I couldn't figure out how to do it.

Also in the posts above people suggested applying a path to the original module, I suppose that implies maintaining a "custom" version of nixpkgs to which we can apply changes on top?

I'm fairly new to nix, so please excuse me if the questions are silly. Thanks

Also in the posts above people suggested applying a path to the original module, I suppose that implies maintaining a "custom" version of nixpkgs to which we can apply changes on top?

If you are going to stick with nix, having a local checkout is the way to go. I have my own nixos-unstable with some patches on top of the official nixos-unstable so I cherrypicked the change. An alternative is to rollback/use previous generations.

Thanks for the quick response, really appreciate it.

I will try that, thanks! Do you have by any chance a link that explain how to do this setup? I just had a quick looking around in the nixpkgs documentation but couldn't find it, anyway I will investigate this further later today. Thanks once again!

https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages
https://nixos.org/nix-dev/2015-March/016489.html
basically you can set nix.nixPath in your configuration.nix to have nixpkgs point at your local repository.
Or you can manually specify it in most nix commands via -I nixpkgs=/home/carlos/nixpkgs

Fantastic.

Thank you so much for your help, very much appreciated!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grahamc picture grahamc  路  77Comments

grahamc picture grahamc  路  88Comments

globin picture globin  路  65Comments

worldofpeace picture worldofpeace  路  103Comments

purefn picture purefn  路  68Comments