1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

qutebrowser: fix config location on darwin (#1925)

This commit is contained in:
fortune 2021-04-29 02:41:30 +08:00 committed by GitHub
parent c0ba8c526d
commit a513fbc395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 14 deletions

View file

@ -260,16 +260,13 @@ in {
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."qutebrowser/config.py".text = concatStringsSep "\n" ([ ]
++ [
"${if cfg.loadAutoconfig then
"config.load_autoconfig()"
else
"config.load_autoconfig(False)"}"
] ++ mapAttrsToList (formatLine "c.") cfg.settings
config = let
qutebrowserConfig = concatStringsSep "\n" ([
(if cfg.loadAutoconfig then
"config.load_autoconfig()"
else
"config.load_autoconfig(False)")
] ++ mapAttrsToList (formatLine "c.") cfg.settings
++ mapAttrsToList (formatDictLine "c.aliases") cfg.aliases
++ mapAttrsToList (formatDictLine "c.url.searchengines") cfg.searchEngines
++ mapAttrsToList (formatDictLine "c.bindings.key_mappings")
@ -277,5 +274,13 @@ in {
++ optional (!cfg.enableDefaultBindings) "c.bindings.default = {}"
++ mapAttrsToList formatKeyBindings cfg.keyBindings
++ optional (cfg.extraConfig != "") cfg.extraConfig);
in mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file.".qutebrowser/config.py" =
mkIf pkgs.stdenv.hostPlatform.isDarwin { text = qutebrowserConfig; };
xdg.configFile."qutebrowser/config.py" =
mkIf pkgs.stdenv.hostPlatform.isLinux { text = qutebrowserConfig; };
};
}

View file

@ -24,9 +24,14 @@ with lib;
})
];
nmt.script = ''
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/config.py"
else
".config/qutebrowser/config.py";
in ''
assertFileContent \
home-files/.config/qutebrowser/config.py \
home-files/${qutebrowserConfig} \
${
pkgs.writeText "qutebrowser-expected-config.py" ''
config.load_autoconfig(False)

View file

@ -30,9 +30,14 @@ with lib;
})
];
nmt.script = ''
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/config.py"
else
".config/qutebrowser/config.py";
in ''
assertFileContent \
home-files/.config/qutebrowser/config.py \
home-files/${qutebrowserConfig} \
${
pkgs.writeText "qutebrowser-expected-config.py" ''
config.load_autoconfig(False)