Home-manager switch --flake error

when i use home-manager switch --flake i get output :

error: builder for '/nix/store/v4svzlqz4w7am727cdkdy12803ir2aj1-hyprland-0.40.0+date=2024-05-29_a60c728.drv' failed with exit code 1;
       last 10 log lines:
       > --   No package 'libdisplay-info' found
       > --   No package 'libliftoff' found
       > CMake Error at /nix/store/g84xzgbaf74alskp78qcf7ia32yvxhi8-cmake-3.27.7/share/cmake-3.27/Modules/FindPkgConfig.cmake:607 (message):
       >   A required package was not found
       > Call Stack (most recent call first):
       >   /nix/store/g84xzgbaf74alskp78qcf7ia32yvxhi8-cmake-3.27.7/share/cmake-3.27/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
       >   CMakeLists.txt:111 (pkg_check_modules)
       >
       >
       > -- Configuring incomplete, errors occurred!
       For full logs, run 'nix log /nix/store/v4svzlqz4w7am727cdkdy12803ir2aj1-hyprland-0.40.0+date=2024-05-29_a60c728.drv'.
error: 1 dependencies of derivation '/nix/store/20kgvwj3fhnm93gxagn6mj634hdmx89n-activation-script.drv' failed to build
error: 1 dependencies of derivation '/nix/store/249rakgb9isz1r5yyainlyw4xr36d5hk-home-manager-generation.drv' failed to build

Here is my flake.nix

{

 description = "system flake";

 inputs = {
  nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

  home-manager = {
   url = "github:nix-community/home-manager/release-23.11";
   inputs.nixpkgs.follows = "nixpkgs";
   };
   
  hyprland = {
   url = "github:hyprwm/Hyprland";
   inputs.nixpkgs.follows = "nixpkgs";
   };

  hyprland-plugins = {
   url = "github:hyprwm/hyprland-plugins";
   inputs.hyprland.follows = "hyprland";
   };
  };

outputs = { nixpkgs, home-manager, hyprland, ... }: {
       nixosConfigurations.NixOS = nixpkgs.lib.nixosSystem {
            system = "x86_64-linux";
            modules = [ ./configuration.nix ];
       };
     homeConfigurations.user = home-manager.lib.homeManagerConfiguration {
          pkgs = nixpkgs.legacyPackages."x86_64-linux";
          modules = [ 
          ./home.nix
          hyprland.homeManagerModules.default
          {wayland.windowManager.hyprland.enable = true;}
           ];
        };
  
 };
  
}

According to this Hyprland 0.40.0 commit, the input url needs to be changed:

From this commit on, you’ll have to change the Hyprland flake url to
git+https://github.com/hyprwm/Hyprland?submodules=1

Don’t know if it’s also the same for hyprland-plugins, but does this make a difference?

I have brought flake.nix to this form

{

 description = "system flake";

 inputs = {
  nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

  home-manager = {
   url = "github:nix-community/home-manager/release-23.11";
   inputs.nixpkgs.follows = "nixpkgs";
   };
   
  hyprland = {
   url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
   inputs.nixpkgs.follows = "nixpkgs";
   };

  # hyprland-plugins = {
  #  url = "github:hyprwm/hyprland-plugins";
  #  url = "git+https://github.com/hyprwm/hyprland-plugins?submodules=1";
  #  inputs.hyprland.follows = "hyprland";
  #  };
   };

outputs = { nixpkgs, home-manager, hyprland, ... }: {
       nixosConfigurations.NixOS = nixpkgs.lib.nixosSystem {
            system = "x86_64-linux";
            modules = [ ./configuration.nix ];
       };
     homeConfigurations.user = home-manager.lib.homeManagerConfiguration {
          pkgs = nixpkgs.legacyPackages."x86_64-linux";
          modules = [ 
          ./home.nix
          hyprland.homeManagerModules.default
          {wayland.windowManager.hyprland.enable = true;}
           ];
        };
  
 };
  
}

But error remained

I think the system is trying to use the derivation from NixOS 23.11 since you specified that it should follow nixpkgs, but that won’t work as Hyprland 0.40.0 is unstable and needs the derivation from nixos-unstable.

You can therefore try removing the following line:

  hyprland = {
   url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
-  inputs.nixpkgs.follows = "nixpkgs";
   };

If you see in the official Hyprland flake installation, the hyprland input doesn’t follow nixpkgs as well.

Now it work propertly, but i can’t install Hyprland plugins using HM

error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'home-manager-generation'
         whose name attribute is located at /nix/store/f6lbic2a83c51ygb2czksw9gv8x6w5wg-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'

         at /nix/store/f6lbic2a83c51ygb2czksw9gv8x6w5wg-source/pkgs/build-support/trivial-builders/default.nix:87:14:

           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attribute 'inputs' missing

       at /nix/store/f6lbic2a83c51ygb2czksw9gv8x6w5wg-source/lib/modules.nix:506:28:

          505|         builtins.addErrorContext (context name)
          506|           (args.${name} or config._module.args.${name})
             |                            ^
          507|       ) (lib.functionArgs f);

i think problem in my home. nix

#...
{inputs, pkgs, ... }: {
 wayland.windowManager.hyprland = {
  enable = true;

#Plugins

  plugins = [
   inputs.hyprland-plugins.packages.${pkgs.system}.hyprbars  
   ];
#...

Because if i comment this lines

#  plugins = [
#  inputs.hyprland-plugins.packages.${pkgs.system}.hyprbars  
#  ];

it does not output errors

In order to use flake inputs inside configuration files, you have to pass it in specialArgs for NixOS and extraSpecialArgs for home-manager:

- outputs = { nixpkgs, home-manager, hyprland, ... }: {
+ outputs = { nixpkgs, home-manager, hyprland, ... }@inputs: {
       nixosConfigurations.NixOS = nixpkgs.lib.nixosSystem {
            system = "x86_64-linux";
+           specialArgs = { inherit inputs; };
            modules = [ ./configuration.nix ];
       };
     homeConfigurations.user = home-manager.lib.homeManagerConfiguration {
          pkgs = nixpkgs.legacyPackages."x86_64-linux";
+         extraSpecialArgs = { inherit inputs; };
          modules = [ 
          ./home.nix
          hyprland.homeManagerModules.default
          {wayland.windowManager.hyprland.enable = true;}
           ];
        };
  
 };
  
}
error: undefined variable 'inputs'

       at /nix/store/d875wnj2py30ygqy1c8aqmwb0hj08vpm-source/flake.nix:26:28:

           25|             system = "x86_64-linux";
           26|             specialArgs = { inherit inputs; };
             |                            ^
           27|             modules = [ ./configuration.nix ];

Do I need to replace “inputs” with a specific url?

Oops, I forgot, you need to add inputs to the outputs as well:

-    outputs = { nixpkgs, home-manager, hyprland, ... }: {
+    outputs = { nixpkgs, home-manager, hyprland, ... }@inputs: {