Hi!
I have the following problem, I want to make options specific to hostname, so I tried to create mkMerge with mkIf:
{ config, lib, pkgs, ... }:
{
programs.plasma.workspace = {
lib.mkMerge = [
(lib.mkIf ("${pkgs.inetutils}/bin/hostname" == "host-1") {
wallpaperSlideShow = {
path = ./wallpaper/Ghibli;
interval = 1800; # seconds
};
wallpaperBackground.blur = true;
wallpaperFillMode = "preserveAspectFit";
})
(lib.mkIf ("${pkgs.inetutils}/bin/hostname" == "host-2") {
wallpaper = ./wallpaper/Lexus-LS400.jpg;
wallpaperBackground.blur = true;
wallpaperFillMode = "preserveAspectFit";
})
(lib.mkIf ("${pkgs.inetutils}/bin/hostname" == "host-3") {
wallpaper = ./wallpaper/Lexus-LS400.jpg;
wallpaperBackground.blur = true;
wallpaperFillMode = "preserveAspectFit";
})
];
};
}
What is strange, I’ve managed to successfully create something similar in Hyprland config:
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
settings = {
lib.mkMerge = [
(lib.mkIf ("${pkgs.inetutils}/bin/hostname" == "host-1") {
monitor = [
"eDP-1, 1366x768@60, 0x0, 1"
"HDMI-A-1, 1920x1080@100, 0x0, 1"
];
})
(lib.mkIf ("${pkgs.inetutils}/bin/hostname" == "host-3") {
monitor = "eDP-1, 1920x1080@120, 0x0, 1";
})
];
};
As far as I can see there is only one difference, that in number of mkIf statements.
However, when I try to rebuild home-manager I get this error:
[jeansib@host-1:~]$ home-manager switch
error:
… while evaluating a branch condition
at /nix/store/alzxn3hjisc84hrlv44x6hni48crww26-source/lib/lists.nix:126:9:
125| fold' = n:
126| if n == len
| ^
127| then nul
… while calling the 'length' builtin
at /nix/store/alzxn3hjisc84hrlv44x6hni48crww26-source/lib/lists.nix:124:13:
123| let
124| len = length list;
| ^
125| fold' = n:
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: The option `programs.plasma.workspace.lib' does not exist. Definition values:
- In `/nix/store/2a3x2hwxlflr7vd4fq25hg34641b1mgh-source/plasma-manager/wallpaper.nix':
{
mkMerge = [
{
_type = "if";
condition = false;
...
[jeansib@host-1:~]$