From 18f89ef74f0d48635488ccd6a5e30dc9d48a3a87 Mon Sep 17 00:00:00 2001 From: Tony Zorman Date: Wed, 10 Apr 2024 08:29:32 +0200 Subject: [PATCH] firefox: add containersForce flag Firefox, upon exit, creates the default containers.json file in place of the one that home-manager created. This leads to errors when switching to a new profile, as home-manager is careful with overwriting existing files. The added option toggles that behaviour. Closes: https://github.com/nix-community/home-manager/issues/4989 --- modules/programs/firefox.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 8ce84fcb..cbf78fb0 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -573,6 +573,17 @@ in { }; }; + containersForce = mkOption { + type = types.bool; + default = false; + description = '' + Whether to force replace the existing containers + configuration. This is recommended since Firefox will + replace the symlink on every launch, but note that you'll + lose any existing configuration by enabling this. + ''; + }; + containers = mkOption { type = types.attrsOf (types.submodule ({ name, ... }: { options = { @@ -762,6 +773,7 @@ in { "${profilesPath}/${profile.path}/containers.json" = mkIf (profile.containers != { }) { + force = profile.containersForce; text = mkContainersJson profile.containers; };