Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions modules/misc/fontconfig.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,26 @@ in

};

mutablePlaceholder = lib.mkOption {
default = { };
description = ''
This can be required for Desktop Environments that will otherwise overwrite symlinks managed by home-manager.
For example, [KDE](https://bugs.kde.org/show_bug.cgi?id=498694).'';

type = lib.types.submodule {
options = {
enable = lib.mkEnableOption "a mutable placeholder config file";

file = lib.mkOption {
type = lib.types.str;
default = "${config.xdg.configHome}/fontconfig/conf.d/00-aaa-mutable.conf";
internal = true;
readOnly = true;
description = "The mutable placeholder file to create.";
};
};
};
};
};
};

Expand Down Expand Up @@ -343,5 +363,9 @@ in
source = lib.mkIf (config.source != null) config.source;
}
) cfg.configFile;

systemd.user.tmpfiles.rules = lib.mkIf cfg.mutablePlaceholder.enable [
"f ${cfg.mutablePlaceholder.file} - - - -"
];
};
}
4 changes: 4 additions & 0 deletions tests/modules/misc/fontconfig/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ lib, pkgs, ... }:
{
fontconfig-no-font-package = ./no-font-package.nix;
fontconfig-single-font-package = ./single-font-package.nix;
Expand All @@ -24,3 +25,6 @@
fontconfig-custom-rendering = ./custom-rendering.nix;
fontconfig-extra-config-files = ./extra-config-files.nix;
}
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
fontconfig-mutable-placeholder = ./mutable-placeholder.nix;
}
23 changes: 23 additions & 0 deletions tests/modules/misc/fontconfig/mutable-placeholder.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ config, realPkgs, ... }:
let
cfg = config.fonts.fontconfig.mutablePlaceholder;
in
{
fonts.fontconfig.enable = true;
fonts.fontconfig.mutablePlaceholder.enable = true;

nmt.script = ''
SYSTEMD_LOG_LEVEL=debug ${realPkgs.systemd}/bin/systemd-tmpfiles \
-E \
--root "$TEMPDIR/chroot" \
--create \
--remove \
--boot \
"$TESTED/home-files/.config/user-tmpfiles.d/home-manager.conf"

assertFileExists "$TEMPDIR/chroot/${cfg.file}"
assertFileNotRegex "$TEMPDIR/chroot/${cfg.file}" .
'';

test.stubs.systemd.outPath = null;
}