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

Error " 'fromHexString' missing" when configuring touchpad #306

Open
MichaelBrunn3r opened this issue Aug 8, 2024 · 17 comments
Open

Error " 'fromHexString' missing" when configuring touchpad #306

MichaelBrunn3r opened this issue Aug 8, 2024 · 17 comments

Comments

@MichaelBrunn3r
Copy link

Nix fails to evaluate this config ...

programs.plasma.input.touchpads = [
  {
    enable = true;
    name = "PIXA3854:00 093A:0274 Touchpad";
    vendorId = "093a";
    productId = "0274";
    naturalScroll = true;
  }
];

... with the error:

error: attribute 'fromHexString' missing

at /nix/store/fbcw9dxpgfkv7h1pl6bm0llkpvpa1v2z-source/modules/input.nix:158:40:

  157|       touchName = touchpad.name;
  158|       touchVendor = builtins.toString (lib.fromHexString touchpad.vendorId);
     |                                        ^
  159|       touchProduct = builtins.toString (lib.fromHexString touchpad.productId);

As I understand, the code expects lib to contain a fromHexString function, but it is missing. Could this be because of I misconfigured plasma-manager and it gets evaluated with an invalid lib argument?

Is it possible that the code uses lib.trivial.fromHexString from the unstable channel? https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.trivial.fromHexString

That would make sense, because the flake configuration example uses the unstable channel. Is there a way to configure plasma-manager to use the unstable channel without having it as a default for all my packages?

Something like this does not seem to work :/

inputs = {
  nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
  nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
  home-manager = {
    url = github:nix-community/home-manager/release-24.05;
    inputs.nixpkgs.follows = "nixpkgs-unstable";
  };
  plasma-manager = {
    url = "github:nix-community/plasma-manager";
    inputs.nixpkgs.follows = "nixpkgs-unstable";
    inputs.home-manager.follows = "home-manager";
  };
};
@HeitorAugustoLN
Copy link
Member

What is your current nixpkgs-unstable commit?

@HeitorAugustoLN
Copy link
Member

HeitorAugustoLN commented Aug 8, 2024

This function was added like 2 months ago, so maybe running:

nix flake lock --update-input nixpkgs-unstable could fix it

@MichaelBrunn3r
Copy link
Author

My unstable channel was not up to date, now it is at cb9a96f23c491c081b38eab96d22fa958043c9fa, 3 (?) days old. Didn't fix the issue unfortunately

@MichaelBrunn3r
Copy link
Author

MichaelBrunn3r commented Aug 9, 2024

That's strange, it looks like plasma-manager gets the correct nixpkgs input in the repl:

> :lf .

> inputs.plasma-manager.inputs.nixpkgs.rev
"cb9a96f23c491c081b38eab96d22fa958043c9fa" # This is the 3 day old unstable commit

> inputs.plasma-manager.inputs.nixpkgs.lib.trivial.fromHexString
«lambda @ /nix/store/4cpakzyvfw1rmm9v5i3387x6jd2h1v86-source/lib/trivial.nix:1098:19»

Could the problem be that the code calls lib.fromHexString instead of lib.trivial.fromHexString?

Edit: No, lib.fromHexString exists as well

> inputs.plasma-manager.inputs.nixpkgs.lib.fromHexString
«lambda @ /nix/store/4cpakzyvfw1rmm9v5i3387x6jd2h1v86-source/lib/trivial.nix:1098:19»

@MichaelBrunn3r
Copy link
Author

MichaelBrunn3r commented Aug 9, 2024

Hm, home-manager does not seem to use the correct version:

home-manager.users.michael = {lib, ...}: {
  some.random.option = lib.version;
}
repl> nixosConfigurations.<conf>.config.home-manager.users.michael.some.random.option = "24.05.20240805.883180e"

If it was using the unstable nixpkgs, it would be "24.11.20240804.cb9a96f".

That means I configured home-manager incorrectly, I guess.

I configured my home-manager to use the unstable nixpkgs:

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

And I include its module like this:

outputs = inputs @ {
  self,
  nixpkgs,
  nixpkgs-unstable,
  home-manager,
  plasma-manager,
  ...
}:  {
  nixosConfigurations.<conf> = nixpkgs.lib.nixosSystem {
    system = "x86_64-linux";
    modules =
      [
        home-manager.nixosModules.home-manager
        {
          home-manager.sharedModules = [
            plasma-manager.homeManagerModules.plasma-manager
          ];
        }
      ];
  };
};

I set my stateVersion to 24.11:

config = {
  home-manager = {
    useUserPackages = true;
    useGlobalPkgs = true;

    users.michael = {...}: {
      home.stateVersion = "24.11";
    };
  };
};

@HeitorAugustoLN
Copy link
Member

I think you might need to add an unstable home manager input, so you can make plasma manager follow it?

@MichaelBrunn3r
Copy link
Author

Completely switching to unstable works, but I want to use the stable channel:

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

And regarding your idea, I thought my home-manager was already unstable

home-manager = {
  url = github:nix-community/home-manager; # i.e. straight from master instead of  .../release-24.05
  inputs.nixpkgs.follows = "nixpkgs";
};

Or do you mean I have to have both a stable and unstable home-manager?

@HeitorAugustoLN
Copy link
Member

I meant that you should have both, one for normal usage, and unstable for plasma-manager

@MichaelBrunn3r
Copy link
Author

MichaelBrunn3r commented Aug 9, 2024

Like this?

inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager = {
      url = github:nix-community/home-manager/release-24.05;
      inputs.nixpkgs.follows = "nixpkgs";
    };
    home-manager-unstable = {
      url = github:nix-community/home-manager;
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
    plasma-manager = {
      url = "github:nix-community/plasma-manager";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
      inputs.home-manager.follows = "home-manager-unstable";
    };
  };

Didn't work.

I think I will spin up a VM and start a config from scratch, maybe my flake is just unpredictable.

@HeitorAugustoLN
Copy link
Member

Yes, i thought it would work

@HeitorAugustoLN
Copy link
Member

I think that for it to work, the configuration needs to be in the used with the unstable version of the home manager module

@HeitorAugustoLN
Copy link
Member

I think the possible solution here would be using a standalone home manager configuration for plasma manager with the unstable home manager input

@MichaelBrunn3r
Copy link
Author

How would I configure this? I don't understand how that's different from what I did.
But I think I spent to much time on this already anywaus. It sounds like I would to change my flake config (a lot?) just to fix this version incompatibility. I think I'm fine with just waiting for the 24.11 release.

In the meantime doing it via the configFile option does what I want:

home-manager.users.michael = {
  programs.plasma = {
          configFile.kcminputrc."Libinput/2362/628/PIXA3854:00 093A:0274 Touchpad"."NaturalScroll" = true;
  };
};

@HeitorAugustoLN
Copy link
Member

It is better to manually configure this, doing this workaround would be really hacky

@HeitorAugustoLN
Copy link
Member

@magnouvean maybe we should start doing branches for fixed releases, starting from 24.11 to avoid problems like this?

@magnouvean
Copy link
Collaborator

That would be a good solution. Hopefully it wouldn't take too much work though such that we could realistically maintain both branches. We should probaby take inspiration from home-manager for how they do this.

@HeitorAugustoLN
Copy link
Member

That would be a good solution. Hopefully it wouldn't take too much work though such that we could realistically maintain both branches. We should probaby take inspiration from home-manager for how they do this.

It would be relatively simple. We can create a github action that automatically backports to the current fixed release based on a label, that is basically what home-manager does (besides using a label), they ensure that the change is backwards compatible, and then if it is, it gets backported, if it is not, it gets only in the master branch

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

3 participants