Patching package using override and overrideAttrs
4mon 29d ago by lemmy.blahaj.zone/u/claymorwan in nix@programming.devI'm trying to patch qt5ct and qt6ct with their kde patch, which im doing like so:
home.packages = with pkgs; [
kdePackages.qt6ct.overrideAttrs (finalAttrs: previousAttrs: {
patches = [
fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/qt6ct-shenanigans.patch?h=qt6ct-kde";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
}
];
})
libsForQt5.qt5ct.override {
patches = [
fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/qt5ct-shenanigans.patch?h=qt5ct-kde";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
}
];
}
];
but that im getting this error
error: A definition for option `home-manager.users.claymorwan.home.packages."[definition 10-entry 3]"' is not of type `package'. Definition values:
- In `/nix/store/2p2nainh0h91ijj2724bpg1pc1z8ska5-source/NixOS/modules/home/qt.nix': <function, args: {fetchurl, lib, mkDerivation, qmake, qtbase, qtsvg, qttools}>
To start with you need parens around the things in your list. Right now your list is like:
[
kdePackages.qt6ct.overrideAttrs
(...)
libsForQt5.qt5ct.override
{...}
];
So you want something like:
[
(kdePackages.qt6ct.overrideAttrs
(...))
(libsForQt5.qt5ct.override
{...})
];
o dam yea i had forgotten abt the parens, now i do get this error tho, also good to mention that both package doesn't have any patches to beguin with
error: function 'anonymous lambda' called with unexpected argument 'patches'
at /nix/store/kfcxqcxb9hcq6x33sg4cmwakbb1ifwg9-source/pkgs/tools/misc/qt5ct/default.nix:1:1:
1| {
| ^
2| mkDerivation,
Maybe you need to use overrideAttrs for both packages? it doesn't seem to take patches as an argument
yea that worked, now im getting this tho:
… while calling the 'head' builtin
at /nix/store/kfcxqcxb9hcq6x33sg4cmwakbb1ifwg9-source/lib/attrsets.nix:1713:13:
1712| if length values == 1 || pred here (elemAt values 1) (head values) then
1713| head values
| ^
1714| else
… while evaluating the attribute 'value'
at /nix/store/kfcxqcxb9hcq6x33sg4cmwakbb1ifwg9-source/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/kfcxqcxb9hcq6x33sg4cmwakbb1ifwg9-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `warnings':
… while evaluating definitions from `/nix/store/kfcxqcxb9hcq6x33sg4cmwakbb1ifwg9-source/nixos/modules/system/boot/systemd.nix':
… while evaluating the option `systemd.services.home-manager-claymorwan.serviceConfig':
… while evaluating definitions from `/nix/store/x4cardk9amcfpx2r02v8ic20aclgjxf4-source/nixos':
… while evaluating the option `home-manager.users.claymorwan.home.file."/home/claymorwan/.config/fontconfig/conf.d/10-hm-fonts.conf".source':
… while evaluating definitions from `/nix/store/x4cardk9amcfpx2r02v8ic20aclgjxf4-source/modules/files.nix':
… while evaluating the option `home-manager.users.claymorwan.home.file."/home/claymorwan/.config/fontconfig/conf.d/10-hm-fonts.conf".text':
… while evaluating definitions from `/nix/store/x4cardk9amcfpx2r02v8ic20aclgjxf4-source/modules/misc/xdg.nix':
… while evaluating the option `home-manager.users.claymorwan.xdg.configFile."fontconfig/conf.d/10-hm-fonts.conf".text':
… while evaluating definitions from `/nix/store/x4cardk9amcfpx2r02v8ic20aclgjxf4-source/modules/misc/fontconfig.nix':
… while evaluating the option `home-manager.users.claymorwan.fonts.fontconfig.configFile.fonts.text':
… while evaluating definitions from `/nix/store/x4cardk9amcfpx2r02v8ic20aclgjxf4-source/modules/misc/fontconfig.nix':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: cannot coerce a set to a string: { __functionArgs = «thunk»; __functor = «lambda __functor @ /nix/store/kfcxqcxb9hcq6x33sg4cmwakbb1ifwg9-source/lib/trivial.nix:1017:17»; override = «thunk»; tests = «thunk»; version = 1; }
Seems unrelated to the other issue, look through the stacktrace, it's complaining about home-manager.users.claymorwan.fonts.fontconfig.configFile.fonts.text
yea no idea why, only happens when i override these two packages
Are you sure that's related to the packages? It says it's evaluating font config.
well this only happens when i use the override on these packages so i suppose it is related