`error: undefined variable 'mergeAttrsList'` when trying to set binds
ocharles opened this issue · comments
Hello! Just trying this out but got stuck when trying to create binds. I have (in my Home Manager configuration):
niri.settings = {
binds = {
"Mod+Left".action = config.lib.niri.actions.focus-left;
};
outputs."DP-3".mode = {
width = 2560;
height = 1440;
refresh = 165.0;
};
};
But this produces the error:
error:
… while calling the 'head' builtin
at /nix/store/qwcxqcxfmf6nifz3yqg6rkn2h6mf65x9-source/lib/attrsets.nix:922:11:
921| || pred here (elemAt values 1) (head values) then
922| head values
| ^
923| else
… while evaluating the attribute 'value'
at /nix/store/qwcxqcxfmf6nifz3yqg6rkn2h6mf65x9-source/lib/modules.nix:807:9:
806| in warnDeprecation opt //
807| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
808| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: undefined variable 'mergeAttrsList'
at /nix/store/35l35rk7ximl9zlqqqrk9crccbhbrzx2-source/flake.nix:353:25:
352| config.lib.niri = {
353| actions = mergeAttrsList (map ({
| ^
354| name,
Can you see anything I'm doing wrong?
Are you overriding the nixpkgs
input of this flake to nixos-23.11
? I believe that will cause this issue. You shouldn't override nixpkgs
, because this flake relies on nixos-unstable
lib, and for the packages you should be using the overlay which uses your system's nixpkgs (so you won't be depending on other packages from nixos-unstable
)
Do you mean in my Flake inputs
? I'm not doing anything there. Here's my entire flake.nix
:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
musnix = {
url = "github:musnix/musnix";
inputs.nixpkgs.follows = "nixpkgs";
};
helix = {
url = "github:helix-editor/helix";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin-kitty = {
url = "github:catppuccin/kitty";
flake = false;
};
tree-grepper = {
inputs.tree-sitter-haskell.url = "github:tree-sitter/tree-sitter-haskell";
url = "github:BrianHicks/tree-grepper";
};
jj = {
url = "github:martinvonz/jj";
inputs.nixpkgs.follows = "nixpkgs";
};
niri-flake.url = "github:sodiboo/niri-flake";
};
outputs = inputs:
let
overlays = {
nixpkgs.overlays = [
packageUpgrades
];
};
packageUpgrades = self: super: {
helix = inputs.helix.packages.x86_64-linux.default;
jj = inputs.jj.packages.x86_64-linux.default;
tree-grepper = inputs.tree-grepper.packages.x86_64-linux.tree-grepper;
kitty = (import inputs.nixpkgs-unstable { system = "x86_64-linux"; }).kitty;
inherit (inputs) catppuccin-kitty;
};
in
{
nixosConfigurations.desktop = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules =
[
overlays
inputs.home-manager.nixosModule
inputs.musnix.nixosModules.musnix
inputs.niri-flake.nixosModules.niri
./configuration.nix
];
};
homeConfigurations.ollie = inputs.home-manager.lib.homeManagerConfiguration {
# https://github.com/nix-community/home-manager/issues/2942#issuecomment-1378627909
pkgs = import inputs.nixpkgs {
config.allowUnfree = true;
system = "x86_64-linux";
};
modules = [
overlays
./home.nix
];
};
formatter.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
};
}
Oh. I see. I thought that would be the issue, but I guess not. This is actually caused by a faulty use of the lib
parameter where I should really be using my own nixpkgs.lib
input. I'm not currently able to fix it, but I will once I get back to my computer later today.
For now, a workaround is to do "Mod+Left".action.focus-left = []
. This is the underlying representation of the action functions (minus some magical pixie dust). If you need to add parameters to certain actions, put them in the array.
That works - thank you! No rush on fixing this, I have a workaround now 😄
I've pushed a change that should fix this. This flake no longer uses the lib
special arg for any functions; and should be relying entirely on the nixpkgs.lib
flake input. I thought that was already the behaviour, but i guess not...
Can you verify if it works now?
All working now - thank you!
Awesome! Closing this, then.