Error: builder for 'masterpdfeditor.drv' failed with exit code 1

Hello,

In NixOS 23.11, I had install masterpdfeditor this way because I need this particular version (paid licence key needed, specific to version):

My system is using flakes.

{ config, pkgs, lib, inputs, ... }:

{
  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    masterpdfeditor
  ];
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "masterpdfeditor"
  ];
  
   nixpkgs.overlays = [ (final: prev: {
     masterpdfeditor = prev.masterpdfeditor.overrideAttrs (old: {
       src = prev.fetchurl {
         url = "https://code-industry.net/public/master-pdf-editor-5.9.10-qt5.x86_64.tar.gz";
         sha256 = "sha256-ilJhUsr96xCbM0XNQxWGAPknKKp1jj+U1+7n1e379Lc=";
       };
     });
   })];
}

And on 23.11 it was working.
I’ve just updated to 24.11. Everything is working but building masterpdfeditor.

I get the following error :

:/etc/nixos$ sudo nixos-rebuild switch --show-trace --flake .#default
building the system configuration...
error: builder for '/nix/store/hfb7qi1jkkchr8mdc6p2k2c62fd5sa54-masterpdfeditor-5.9.82.drv' failed with exit code 1;
       last 10 log lines:
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > no Makefile or custom buildPhase, doing nothing
       > Running phase: glibPreInstallPhase
       > Running phase: glibPreInstallPhase
       > Running phase: installPhase
       > install: cannot stat 'license_en.txt': No such file or directory
       For full logs, run 'nix log /nix/store/hfb7qi1jkkchr8mdc6p2k2c62fd5sa54-masterpdfeditor-5.9.82.drv'.
error: 1 dependencies of derivation '/nix/store/0zij2dkvvfbgs2xvr9zy1xjk49ckkz9i-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/qhnmajwzl95yh15lwqprkzkkdyb1sw21-nixos-system-ThinkPadT470-24.05.20240531.805a384.drv' failed to build

$ nix log /nix/store/hfb7qi1jkkchr8mdc6p2k2c62fd5sa54-masterpdfeditor-5.9.82.drv
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/hfb7qi1jkkchr8mdc6p2k2c62fd5sa54-masterpdfeditor-5.9.82.drv^*'
@nix { "action": "setPhase", "phase": "qtPreHook" }
Running phase: qtPreHook
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/0akk964vl2m3jzra61j9fj06d44kh0pc-master-pdf-editor-5.9.10-qt5.x86_64.tar.gz
source root is master-pdf-editor-5
setting SOURCE_DATE_EPOCH to timestamp 1667987453 of file master-pdf-editor-5/templates/stamps/Square
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
no Makefile or custom buildPhase, doing nothing
@nix { "action": "setPhase", "phase": "glibPreInstallPhase" }
Running phase: glibPreInstallPhase
@nix { "action": "setPhase", "phase": "glibPreInstallPhase" }
Running phase: glibPreInstallPhase
@nix { "action": "setPhase", "phase": "installPhase" }
Running phase: installPhase
install: cannot stat 'license_en.txt': No such file or directory

$ sudo nix build -L '/nix/store/hfb7qi1jkkchr8mdc6p2k2c62fd5sa54-masterpdfeditor-5.9.82.drv^*'
[sudo] Mot de passe de thatoo : 
masterpdfeditor> Running phase: qtPreHook
masterpdfeditor> Running phase: unpackPhase
masterpdfeditor> unpacking source archive /nix/store/0akk964vl2m3jzra61j9fj06d44kh0pc-master-pdf-editor-5.9.10-qt5.x86_64.tar.gz
masterpdfeditor> source root is master-pdf-editor-5
masterpdfeditor> setting SOURCE_DATE_EPOCH to timestamp 1667987453 of file master-pdf-editor-5/templates/stamps/Square
masterpdfeditor> Running phase: patchPhase
masterpdfeditor> Running phase: updateAutotoolsGnuConfigScriptsPhase
masterpdfeditor> Running phase: configurePhase
masterpdfeditor> no configure script, doing nothing
masterpdfeditor> Running phase: buildPhase
masterpdfeditor> no Makefile or custom buildPhase, doing nothing
masterpdfeditor> Running phase: glibPreInstallPhase
masterpdfeditor> Running phase: glibPreInstallPhase
masterpdfeditor> Running phase: installPhase
masterpdfeditor> install: cannot stat 'license_en.txt': No such file or directory
error: builder for '/nix/store/hfb7qi1jkkchr8mdc6p2k2c62fd5sa54-masterpdfeditor-5.9.82.drv' failed with exit code 1

Any help?

1 Like

It looks like the license file got renamed:

I would probably just copy the expression previous to that point (nixpkgs/pkgs/applications/misc/masterpdfeditor/default.nix at 7f85233f89d71929964be7ccb9d2c9dd37cde0b9 · NixOS/nixpkgs · GitHub) and swap in your version.

1 Like

Thank you for your answer.
It sounds like a solution. Could you describe a bit more step by step what I should do?

I mean, where do I copy/paste the expression of 5.9.35 and how do I swap it in my version?

I’m trying this

{ config, pkgs, lib, inputs, ... }:

{
  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    inputs.nixpkgs_old.legacyPackages."${pkgs.system}".masterpdfeditor
  ];

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "masterpdfeditor"
  ];
  
   nixpkgs.overlays = [ (final: prev: {
     masterpdfeditor = prev.masterpdfeditor.overrideAttrs (old: {
       src = prev.fetchurl {
         url = "https://code-industry.net/public/master-pdf-editor-5.9.10-qt5.x86_64.tar.gz";
         sha256 = "sha256-ilJhUsr96xCbM0XNQxWGAPknKKp1jj+U1+7n1e379Lc=";
       };
     });
   })];
}

after I add in flake.nix file the following for nixpkgs_old :

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    nixpkgs_unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs_old.url = "github:NixOS/nixpkgs/nixos-23.11";
  };

but I get this error :

       error: Package ‘masterpdfeditor-5.9.35’ in /nix/store/yg436dyaanpmhi3bf6qizaxa3jymlsx3-source/pkgs/applications/misc/masterpdfeditor/default.nix:40 has an unfree license (‘unfreeRedistributable’), refusing to evaluate.

       a) To temporarily allow unfree packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNFREE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnfree = true; }
       in configuration.nix to override this.

       Alternatively you can configure a predicate to allow specific packages:
         { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
             "masterpdfeditor"
           ];
         }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnfree = true; }
       to ~/.config/nixpkgs/config.nix.

which doesn’t make sense because

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "masterpdfeditor"
  ];

is already there.

I tried also with such flake.nix file :

{
  description = "Thatoo's flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    nixpkgs_old.url = "github:NixOS/nixpkgs/nixos-23.11";
  };

  outputs = inputs@{ self, nixpkgs, nixpkgs_old, ... }:
  let
    OldOverlay = final: prev: {
      old = import nixpkgs_old {
        system = "x86_64-linux";
        config.allowUnfree = true;
      };
    };
  in {
    nixosConfigurations.default = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; };
      modules = [
        {
          nixpkgs = {
            overlays = [ oldOverlay ];
          };
        }
        ./configuration.nix
      ];
    };
  };
}

and I still get the same error.
I can’t make unfree available for an other channel than the stable one (nixos-24.05).