Skip to content

Commit

Permalink
firefox: add containersForce flag
Browse files Browse the repository at this point in the history
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: #4989
  • Loading branch information
slotThe committed Apr 10, 2024
1 parent b00d0e4 commit 18f89ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/programs/firefox.nix
Expand Up @@ -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 = {
Expand Down Expand Up @@ -762,6 +773,7 @@ in {

"${profilesPath}/${profile.path}/containers.json" =
mkIf (profile.containers != { }) {
force = profile.containersForce;
text = mkContainersJson profile.containers;
};

Expand Down

1 comment on commit 18f89ef

@nixos-discourse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/existing-file-is-in-the-way-of-issue-with-home-manager-when-used-in-a-configuration/43628/5

Please sign in to comment.