diff --git a/modules/misc/xdg-autostart.nix b/modules/misc/xdg-autostart.nix index 4bb58ac9f..8195acb92 100644 --- a/modules/misc/xdg-autostart.nix +++ b/modules/misc/xdg-autostart.nix @@ -51,7 +51,7 @@ in }; }; - config = mkIf (cfg.enable && cfg.entries != [ ]) { + config = mkIf (cfg.enable && (cfg.readOnly || cfg.entries != [ ])) { xdg.configFile.autostart = { source = linkedDesktopEntries; recursive = !cfg.readOnly; diff --git a/tests/modules/misc/xdg/autostart-readonly-empty.nix b/tests/modules/misc/xdg/autostart-readonly-empty.nix new file mode 100644 index 000000000..cb879bc04 --- /dev/null +++ b/tests/modules/misc/xdg/autostart-readonly-empty.nix @@ -0,0 +1,10 @@ +{ + xdg.autostart = { + enable = true; + readOnly = true; + }; + + nmt.script = '' + assertLinkExists home-files/.config/autostart + ''; +} diff --git a/tests/modules/misc/xdg/default.nix b/tests/modules/misc/xdg/default.nix index c73c2e9ab..3a43fa716 100644 --- a/tests/modules/misc/xdg/default.nix +++ b/tests/modules/misc/xdg/default.nix @@ -4,6 +4,7 @@ xdg-mime-disabled = ./mime-disabled.nix; xdg-autostart = ./autostart.nix; xdg-autostart-readonly = ./autostart-readonly.nix; + xdg-autostart-readonly-empty = ./autostart-readonly-empty.nix; xdg-local-bin-in-path = ./local-bin-in-path.nix; xdg-local-bin-not-in-path = ./local-bin-not-in-path.nix; xdg-user-dirs-mixed = ./user-dirs-mixed.nix;