Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home manager module error #724

Open
IceDBorn opened this issue Jan 15, 2025 · 6 comments
Open

Home manager module error #724

IceDBorn opened this issue Jan 15, 2025 · 6 comments

Comments

@IceDBorn
Copy link

┃ … while evaluating an attribute content

┃ … while evaluating an attribute hyprpanel

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

┃ error: attribute 'hm' missing
┃ at /nix/store/98gbnyh5kkv72dvxy2x0cjnaqpbqsdf5-source/nix/module.nix:633:23:
┃ 632| mkIf cfg.overwrite.enable {
┃ 633| hyprpanel = lib.hm.dag.entryBefore [ "writeBoundary" ] ''
┃ | ^
┃ 634| [[ -L "${path}" ]] || rm -f "${path}"
┃ Did you mean one of id or or?

@PedroMAdorno4
Copy link

I've had the same issue before.

Did you add the overlay to your flake.nix? Its still needed, even with the home manager module. However, your don't have to include it in your environment.packages list. Here's my example:

# flake.nix
{
  description = "NixOS config";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";

    hyprpanel = {
      url = "github:Jas-SinghFSU/HyprPanel";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

  outputs = { nixpkgs, ... }@inputs:

    let
      pkgs = import nixpkgs {
        system = "x86_64-linux";
        overlays = [
          inputs.hyprpanel.overlay
        ];
        config = {
          allowUnfree = true;
        };
      };
    in
    {
      nixosConfigurations = {
        hostname = nixpkgs.lib.nixosSystem {
          specialArgs = { inherit inputs pkgs; };
          modules = [
            ./hosts/hostname/configuration.nix
            inputs.home-manager.nixosModules.default
          ];
        };
      };
    };
}

# hyprpanel.nix
{ inputs, ... }:
{
  imports = [ inputs.hyprpanel.homeManagerModules.hyprpanel ];

  programs.hyprpanel = {
    enable = true;
    overwrite.enable = true;
  };
}

@IceDBorn
Copy link
Author

I'll check and see if I had the overlay or not and I'll report back later.

@cte
Copy link

cte commented Jan 18, 2025

@PedroMAdorno4 - I followed your example and it works well, but I get the following warning when running nixos-rebuild:

evaluation warning: You have set specialArgs.pkgs, which means that options like nixpkgs.config and nixpkgs.overlays
will be ignored. If you wish to reuse an already created pkgs, which you know is configured correctly for this NixOS
configuration, please import the `nixosModules.readOnlyPkgs` module from the nixpkgs flake or 
`(modulesPath + "/misc/nixpkgs/read-only.nix"), and set `{ nixpkgs.pkgs = <your pkgs>; }`. This properly disables the
ignored options to prevent future surprises.

Are you seeing the same? Any idea how to implement the suggested fix? Thanks!

@PedroMAdorno4
Copy link

@cte I'm not sure because I don't have that warning, but you can try this perhaps:

# flake.nix
{
  description = "NixOS config";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";

    hyprpanel = {
      url = "github:Jas-SinghFSU/HyprPanel";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

  outputs = { nixpkgs, ... }@inputs:

    let
      nixpkgsConfig = {
        nixpkgs.overlays = [
          inputs.hyprpanel.overlay
        ];
        nixpkgs.config.allowUnfree = true;
      };
    in
    {
      nixosConfigurations = {
        hostname = nixpkgs.lib.nixosSystem {
          specialArgs = { inherit inputs; };
          modules = [
            ./hosts/hostname/configuration.nix
            inputs.home-manager.nixosModules.default
            nixpkgsConfig
          ];
        };
      };
    };
}

@ominit
Copy link

ominit commented Jan 18, 2025

┃ … while evaluating an attribute content ┃ ┃ … while evaluating an attribute hyprpanel ┃ ┃ (stack trace truncated; use '--show-trace' to show the full, detailed trace) ┃ ┃ error: attribute 'hm' missing ┃ at /nix/store/98gbnyh5kkv72dvxy2x0cjnaqpbqsdf5-source/nix/module.nix:633:23: ┃ 632| mkIf cfg.overwrite.enable { ┃ 633| hyprpanel = lib.hm.dag.entryBefore [ "writeBoundary" ] '' ┃ | ^ ┃ 634| [[ -L "${path}" ]] || rm -f "${path}" ┃ Did you mean one of id or or?

I am having the same error with this config

{inputs, ...}: {
  imports = [inputs.hyprpanel.homeManagerModules.hyprpanel];

  nixpkgs.overlays = [
    inputs.hyprpanel.overlay
  ];

  home-manager.users."ominit".programs.hyprpanel = {
    enable = true;
    systemd.enable = true;
    hyprland.enable = true;
  };
}

This configuration is valid though (to prove that the overlay is working)

{
  inputs,
  pkgs,
  ...
}: {
  nixpkgs.overlays = [
    inputs.hyprpanel.overlay
  ];

  users.users."ominit".packages = with pkgs; [hyprpanel];
}

@ominit
Copy link

ominit commented Jan 19, 2025

After a bit of research, it appears that the issue I was having has to do with the home manager module requiring access to the lib that is extended by home-manager. This nix configuration works.

{inputs, ...}: {
  home-manager.users."ominit" = {
    imports = [inputs.hyprpanel.homeManagerModules.hyprpanel];
    programs.hyprpanel = {
      enable = true;
      overwrite.enable = true;
      overlay.enable = true;
      hyprland.enable = true;
      settings = {
        bar.launcher.autoDetectIcon = true;
      };
    };
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants