hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
305 stars 48 forks source link

Build fail on NixOS #256

Closed ArtemChandragupta closed 2 months ago

ArtemChandragupta commented 2 months ago

I use NixOS unstable + flakes

error: builder for '/nix/store/1rix44lszl2vhq6m7qa5r3764f7zcmb6-xdg-desktop-portal-hyprland-1.3.3.drv' failed with exit code 1;
       last 10 log lines:
       > -- Generating done (0.0s)
       > CMake Warning:
       >   Manually-specified variables were not used by the project:
       >
       >     BUILD_TESTING
       >     CMAKE_EXPORT_NO_PACKAGE_REGISTRY
       >     CMAKE_POLICY_DEFAULT_CMP0025
       >
       > 
       > CMake Generate step failed.  Build files cannot be regenerated correctly.
       For full logs, run 'nix log /nix/store/1rix44lszl2vhq6m7qa5r3764f7zcmb6-xdg-desktop-portal-hyprland-1.3.3.drv'.

Log:

``` nix log /nix/store/1rix44lszl2vhq6m7qa5r3764f7zcmb6-xdg-desktop-portal-hyprland-1.3.3.drv warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/1rix44lszl2vhq6m7qa5r3764f7zcmb6-xdg-desktop-portal-hyprland-1.3.3.drv^*' Running phase: qtPreHook @nix { "action": "setPhase", "phase": "qtPreHook" } Running phase: unpackPhase @nix { "action": "setPhase", "phase": "unpackPhase" } unpacking source archive /nix/store/79n1c2k1n6cs6wzc1yw9j968z5f8k6ps-source source root is source Running phase: patchPhase @nix { "action": "setPhase", "phase": "patchPhase" } Running phase: updateAutotoolsGnuConfigScriptsPhase @nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" } Running phase: configurePhase @nix { "action": "setPhase", "phase": "configurePhase" } fixing cmake files... cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAK> -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /nix/store/gxpdysvlj9l6bfin03k6yq0s922pk7pg-gcc-wrapper-13.3.0/bin/gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /nix/store/gxpdysvlj9l6bfin03k6yq0s922pk7pg-gcc-wrapper-13.3.0/bin/g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring XDPH in Release with CMake -- Checking deps... -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Found OpenGL: /nix/store/jz5imlpjk5a01224mimn6bsp9v0wrlgb-libglvnd-1.7.0/lib/libOpenGL.so -- Found WrapOpenGL: TRUE -- Found XKB: /nix/store/rnlflxkgglrdiii7wl7k99893zr4iamc-libxkbcommon-1.7.0/lib/libxkbcommon.so (found suitable version "1.7.0", minimum required is "0.5.0") -- Found WrapVulkanHeaders: /nix/store/v0qw5vwbbhz0s32g8prvgpd8zy26vziz-vulkan-headers-1.3.283.0/include -- Found PkgConfig: /nix/store/fcmc82gp5qc0s8qvcw4c0w46c67zd295-pkg-config-wrapper-0.29.2/bin/pkg-config (found version "0.29.2") -- Checking for modules 'wayland-client;wayland-protocols;wayland-scanner;libpipewire-0.3;libspa-0.2;libdrm;gbm;hyprlang>=0.2.0' -- Found wayland-client, version 1.23.0 -- Found wayland-protocols, version 1.36 -- Found wayland-scanner, version 1.23.0 -- Found libpipewire-0.3, version 1.2.3 -- Found libspa-0.2, version 0.2 -- Found libdrm, version 2.4.122 -- Found gbm, version 24.2.1 -- Found hyprlang, version 0.5.2 -- Checking for module 'sdbus-c++' -- Found sdbus-c++, version 1.5.0 -- Checking for module 'hyprland-protocols' -- Found hyprland-protocols, version 0.3.0 -- Found WaylandScanner at /nix/store/mq0445zflcxkh6r38afzczlpw8bax9kv-wayland-scanner-1.23.0-bin/bin/wayland-scanner -- Found wayland-protocols at //nix/store/sm9mxbw5lanjmabjgd53yps0b9j3lrc9-wayland-protocols-1.36/share/wayland-protocols -- Configuring done (3.8s) CMake Error in CMakeLists.txt: Imported target "PkgConfig::deps" includes non-existent path "/nix/store/0ikl83z4h69imxkwsly3hcm424f7wi7j-wayland-scanner-1.23.0-dev/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. ```
danielcara commented 2 months ago

I have the same issue here

$ ls /nix/store/0ikl83z4h69imxkwsly3hcm424f7wi7j-wayland-scanner-1.23.0-dev/
lib nix-support share

$ ls "/nix/store/0ikl83z4h69imxkwsly3hcm424f7wi7j-wayland-scanner-1.23.0-dev/include": No such file or directory (os error 2)
s1341 commented 2 months ago

me too. Any work around?

nimr0d commented 2 months ago

This PR fixed it for me https://github.com/NixOS/nixpkgs/pull/338836

vaxerski commented 2 months ago

@fufexan ?

ZainKergaye commented 2 months ago

Not yet working for me, I'm on unstable but maybe not going through the right process. I am using flakes with home-manager. Am I not on up to date with the current head of nixpkgs?

clemenscodes commented 2 months ago

Not yet working for me, I'm on unstable but maybe not going through the right process. I am using flakes with home-manager. Am I not on up to date with the current head of nixpkgs?

The linked PR was merged into master earlier today. It takes a while until it lands in unstable, you can use this tool to track the progress. If you want to use it right now, you can add an input for nixos-unstable-small to your flake.nix and use an overlay:

{
  inputs = {
    nixpkgs = {
      url = "github:NixOS/nixpkgs/nixos-unstable";
    };
    nixos-unstable-small = {
      url = "github:NixOS/nixpkgs/nixos-unstable-small";
    };
    flake-utils = {
      url = "github:numtide/flake-utils";
    };
  };
  outputs = { ... } @ inputs:
    inputs.flake-utils.lib.eachDefaultSystem (
      system: let
        unstable-small-pkgs = import inputs.nixos-unstable-small {inherit system;};
        pkgs = import inputs.nixpkgs {
          inherit system;
          overlays = [
            (final: prev: {
              inherit (unstable-small-pkgs) xdg-desktop-portal-hyprland;
            })
          ];
        };
      in {
        # your configuration
      }
    );
}
ZainKergaye commented 2 months ago

@clemenscodes

Thanks for explaining this, I will just be waiting until it has merged into unstable

Hoffmano commented 2 months ago

@clemenscodes

how can i adapt my flake to your code?

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    nixvim.url = "github:nix-community/nixvim";
    nixvim.inputs.nixpkgs.follows = "nixpkgs";

    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = inputs:
    let
      system = "x86_64-linux";
    in
    {
      nixosConfigurations = {
        nixos = inputs.nixpkgs.lib.nixosSystem {
          inherit system;
          specialArgs = { inherit inputs; };
          modules = [
            ./configuration.nix
            inputs.nixvim.nixosModules.nixvim
          ];
        };
      };

      homeConfigurations.hoffmano = inputs.home-manager.lib.homeManagerConfiguration {
        pkgs = inputs.nixpkgs.legacyPackages.${system};
        modules = [ ./home.nix ];
      };
    };
}
clemenscodes commented 2 months ago

@Hoffmano you could either pass the modified pkgs to specialArgs to your configuration or add the overlay to the option nixpkgs.overlays. I personally prefer the first option, for your configuration it could look like this:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    nixos-unstable-small.url = "github:NixOS/nixpkgs/nixos-unstable-small";
    nixvim.url = "github:nix-community/nixvim";
    nixvim.inputs.nixpkgs.follows = "nixpkgs";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = inputs: let
    system = "x86_64-linux";
    unstable-small-pkgs = import inputs.nixos-unstable-small {inherit system;};
    xdphOverlay = final: prev: {
      inherit (unstable-small-pkgs) xdg-desktop-portal-hyprland;
    };
    pkgs = import inputs.nixpkgs {
      inherit system;
      overlays = [xdphOverlay];
    };
  in {
    nixosConfigurations = {
      nixos = inputs.nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = {inherit inputs pkgs;};
        modules = [
          ./configuration.nix
          inputs.nixvim.nixosModules.nixvim
        ];
      };
    };

    homeConfigurations.hoffmano = inputs.home-manager.lib.homeManagerConfiguration {
      pkgs = inputs.nixpkgs.legacyPackages.${system};
      modules = [./home.nix];
    };
  };
}
ArtemChandragupta commented 2 months ago

For me doing an overlay like this (my config is very similar to example above) results into unfree software error, while I definitely allowed it as a module (not in flake) before for original nixpkgs unstable.

flake.nix: ``` { outputs = inputs: let system = "x86_64-linux"; # Hyprfix unstable-small-pkgs = import inputs.nixos-unstable-small {inherit system;}; xdphOverlay = final: prev: { inherit (unstable-small-pkgs) xdg-desktop-portal-hyprland; }; pkgs = import inputs.nixpkgs { inherit system; overlays = [xdphOverlay]; }; #Hyprfix var = { user = "artem"; host = "ThinkBook13s"; init = false; }; in { nixosConfigurations.nixos = inputs.nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs; inherit var; inherit pkgs; }; modules = [ ./configuration.nix inputs.home-manager.nixosModules.default inputs.stylix.nixosModules.stylix ]; }; }; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; nixos-unstable-small.url = "github:NixOS/nixpkgs/nixos-unstable-small"; hyprland = { type = "git"; url = "https://github.com/hyprwm/Hyprland"; submodules = true; }; nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; firefox-addons = { url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; }; ags.url = "github:Aylur/ags"; stylix.url = "github:danth/stylix"; }; } ``` module with unfree software permission: ``` { var, ... }:{ nix = { settings = { auto-optimise-store = true; experimental-features = "nix-command flakes"; }; gc = { automatic = true; dates = "weekly"; options = "--delete-older-than 7d"; }; }; programs.nh = { enable = true; flake = "/home/${var.user}/nix"; }; nixpkgs.config = { permittedInsecurePackages = []; allowUnfree = true; }; hardware.graphics.enable = true; } ```
ZainKergaye commented 2 months ago

@ArtemChandragupta I am getting the same error, not sure why either.

clemenscodes commented 2 months ago

Passing pkgs to specialArgs sets that pkgs as a global argument to all NixOS modules, which allows you to reuse that instance in every module and it makes other modules use that as well. This is essentially the same as setting the option nixpkgs.pkgs. This instance contains its own configration and the nixpkgs.config option will be ignored. See documentation here. The solution is to instantiate pkgs with that config instead:

pkgs = import inputs.nixpkgs {
  inherit system;
  overlays = [xdphOverlay];
  config = {
    permittedInsecurePackages = [];
    allowUnfree = true;
  };
};
ArtemChandragupta commented 2 months ago

Thank you very much, dear @clemenscodes. With your help I created my first overlay (and probably three other people too), which will move me a step further on a Nix path.

Nixos-unstable-small version fixes the problem, so issue is closed.