NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.08k stars 14.13k forks source link

`No such file or directory` during postInstall hook of a derivation #148383

Closed DiCaius closed 2 years ago

DiCaius commented 2 years ago

Describe the bug

I had a very simple derivation, it was building fine a couple of days ago but without any changes it started throwing error: getting status of '/nix/store/22si406d5jr6vhmhybh7qvhgd3xpf7vb-texlive-mptopdf-57347': No such file or directory error during the postInstall hook.

Here's the derivation:

  materia-theme = with unstable;
    (let
      theme = {
        dark = {
          bg = "191919";
          fg = "ffffff";
          selBg = "df5f78";
          selBg2 = "d94360";
          materiaView = "212121";
          hdrBg = "d94360";
          hdrFg = "ffffff";
          materiaSurface = "414141";
          materiaColourVariant = "dark";
          roundness = "0";
          menuBg = "d94360";
          menuFg = "ffffff";
        };
        light = {
          bg = "f5f5f5";
          fg = "191919";
          selBg = "df5f78";
          selBg2 = "d94360";
          materiaView = "f0f0f0";
          hdrBg = "d94360";
          hdrFg = "ffffff";
          materiaSurface = "e0e0e0";
          materiaColourVariant = "light";
          roundness = "0";
          menuBg = "d94360";
          menuFg = "ffffff";
        };
      };
    in stdenv.mkDerivation rec {
      pname = "materia-theme";
      version = "af63425f9bbb2ac9bc4853a4357457d743c65308";
      src = fetchFromGitHub {
        owner = "nana-4";
        repo = pname;
        rev = version;
        sha256 = "sha256-+E8eJQcDw4F12MmGrCoFUeGFZzYZWQtY7PVhXVAZRFY=";
      };
      nativeBuildInputs = [
        bc
        fontconfig
        gnome.gnome-shell
        stable.inkscape
        meson
        ninja
        nodePackages.sass
        optipng
      ];
      buildInputs = [ gnome.gnome-themes-extra gdk-pixbuf librsvg wallpaper ];
      propagatedUserEnvPkgs = [ gtk-engine-murrine ];
      mesonFlags = [
        "-Dgnome_shell_version=${
          lib.versions.majorMinor gnome.gnome-shell.version
        }"
      ];
      dontBuild = true;
      postPatch = ''
        export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
        HOME=$TEMPDIR
        XDG_DATA_HOME=$TEMPDIR

        patchShebangs .

        ./change_color.sh -o MateriaNixos-Dark <(echo -e "BG=${theme.dark.bg}\nFG=${theme.dark.fg}\nSEL_BG=${theme.dark.selBg}\nSEL_BG2=${theme.dark.selBg2}\nMATERIA_VIEW=${theme.dark.materiaView}\nHDR_BG=${theme.dark.hdrBg}\nMATERIA_SURFACE=${theme.dark.materiaSurface}\nMATERIA_COLOR_VARIANT=${theme.dark.materiaColourVariant}\nROUNDNESS=${theme.dark.roundness}\nMENU_FG=${theme.dark.menuFg}\nMENU_BG=${theme.dark.menuBg}\nMATERIA_STYLE_COMPACT=False\n")

        ./change_color.sh -o MateriaNixos-Dark-Compact <(echo -e "BG=${theme.dark.bg}\nFG=${theme.dark.fg}\nSEL_BG=${theme.dark.selBg}\nSEL_BG2=${theme.dark.selBg2}\nMATERIA_VIEW=${theme.dark.materiaView}\nHDR_BG=${theme.dark.hdrBg}\nMATERIA_SURFACE=${theme.dark.materiaSurface}\nMATERIA_COLOR_VARIANT=${theme.dark.materiaColourVariant}\nROUNDNESS=${theme.dark.roundness}\nMENU_FG=${theme.dark.menuFg}\nMENU_BG=${theme.dark.menuBg}\nMATERIA_STYLE_COMPACT=True\n")

        ./change_color.sh -o MateriaNixos-Light <(echo -e "BG=${theme.light.bg}\nFG=${theme.light.fg}\nSEL_BG=${theme.light.selBg}\nSEL_BG2=${theme.light.selBg2}\nMATERIA_VIEW=${theme.light.materiaView}\nHDR_BG=${theme.light.hdrBg}\nMATERIA_SURFACE=${theme.light.materiaSurface}\nMATERIA_COLOR_VARIANT=${theme.light.materiaColourVariant}\nROUNDNESS=${theme.light.roundness}\nMENU_FG=${theme.light.menuFg}\nMENU_BG=${theme.light.menuBg}\nMATERIA_STYLE_COMPACT=False\n")

        ./change_color.sh -o MateriaNixos-Light-Compact <(echo -e "BG=${theme.light.bg}\nFG=${theme.light.fg}\nSEL_BG=${theme.light.selBg}\nSEL_BG2=${theme.light.selBg2}\nMATERIA_VIEW=${theme.light.materiaView}\nHDR_BG=${theme.light.hdrBg}\nMATERIA_SURFACE=${theme.light.materiaSurface}\nMATERIA_COLOR_VARIANT=${theme.light.materiaColourVariant}\nROUNDNESS=${theme.light.roundness}\nMENU_FG=${theme.light.menuFg}\nMENU_BG=${theme.light.menuBg}\nMATERIA_STYLE_COMPACT=True\n")
      '';
      postInstall = ''
        cp -r /build/.themes/MateriaNixos-Dark $out/share/themes/MateriaNixos-Dark
        cp -r /build/.themes/MateriaNixos-Dark-Compact $out/share/themes/MateriaNixos-Dark-Compact
        cp -r /build/.themes/MateriaNixos-Light $out/share/themes/MateiraNixos-Light
        cp -r /build/.themes/MateriaNixos-Light-Compact $out/share/themes/MateriaNixos-Light-Compact
      '';
      patches = [
        (pkgs.substituteAll {
          backgroundPath = "file://${wallpaper.gnomeFilePath}";
          src = ./greeter-background.patch;
        })
      ];
      meta = with lib; {
        description =
          "Material Design theme for GNOME/GTK based desktop environments";
        homepage = "https://github.com/nana-4/materia-theme";
        license = licenses.gpl2Only;
        platforms = platforms.all;
        maintainers = dicaius;
      };
    });

unstable points to nix-unstable nixpkgs and stable points to 21.04

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a file with the derivation
  2. Build it

Expected behavior

Build normally, the weird thing is that I can't find anywhere where this texlive-mptopdf dependency is coming from.

Screenshots

Not applicable

Additional context

None.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
DiCaius commented 2 years ago

The problem appears to be coming from the gnome-shell derivation

$ nix why-depends nixpkgs#gnome.gnome-shell nixpkgs#glibc
error: getting status of '/nix/store/22si406d5jr6vhmhybh7qvhgd3xpf7vb-texlive-mptopdf-57347': No such file or directory
veprbl commented 2 years ago

This doesn't look like a nixpkgs issue. Try running nix-store --verify --check-contents

DiCaius commented 2 years ago

@veprbl

This is the result of running the command you mentined:

reading the Nix store...
checking path existence...
path '/nix/store/22si406d5jr6vhmhybh7qvhgd3xpf7vb-texlive-mptopdf-57347' disappeared, but it still has valid referrers!
path '/nix/store/41w4iqkiy7w1px3hwk9d5hxiysv1f7sn-texlive-luaotfload-3.17' disappeared, but it still has valid referrers!
path '/nix/store/7wmg8xwc3r95rriz9ib95g5g333jb3ni-texlive-ly1-47848' disappeared, but it still has valid referrers!
path '/nix/store/88xf3a628gfr9148n3zrnidcrhmmrphm-texlive-mflogo-2.0' disappeared, but it still has valid referrers!
path '/nix/store/angdh5xq7z6m13gfagwq2g239vdz782a-texlive-mfware-57972' disappeared, but it still has valid referrers!
path '/nix/store/m23j067mjhd1f80p3pniqr9zw1yzxy0a-texlive-mfnfss-46036' disappeared, but it still has valid referrers!
path '/nix/store/r9ck3zy2c3bz2l2ghzpss5gazxlmqhzv-texlive-modes-4.2' disappeared, but it still has valid referrers!
path '/nix/store/rhf76avcxz69kmksqhgycplkw7ah1dyp-texlive-makeindex-52851' disappeared, but it still has valid referrers!
path '/nix/store/v0x9qqk4f88a8jfqs37bzpnbjj50lbj9-texlive-luatex-58702' disappeared, but it still has valid referrers!
checking link hashes...
checking store hashes...
warning: not all store errors were fixed

The error persists after running the command.

veprbl commented 2 years ago

nix-store --verify --check-contents --repair should help then

DiCaius commented 2 years ago

It did the trick. Many thanks, @veprbl !