mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
qutebrowser: deduplicate platform-dependent files
This commit is contained in:
committed by
Austin Horstman
parent
f7b2bdf042
commit
db116ceb76
@@ -336,22 +336,20 @@ in
|
|||||||
greasemonkeyDir = lib.optionals (
|
greasemonkeyDir = lib.optionals (
|
||||||
cfg.greasemonkey != [ ]
|
cfg.greasemonkey != [ ]
|
||||||
) pkgs.linkFarmFromDrvs "greasemonkey-userscripts" cfg.greasemonkey;
|
) pkgs.linkFarmFromDrvs "greasemonkey-userscripts" cfg.greasemonkey;
|
||||||
|
|
||||||
|
configDir =
|
||||||
|
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||||
|
".qutebrowser"
|
||||||
|
else
|
||||||
|
"${config.xdg.configHome}/qutebrowser";
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
|
||||||
home.file.".qutebrowser/config.py" = mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
home.file."${configDir}/config.py" = {
|
||||||
text = qutebrowserConfig;
|
|
||||||
};
|
|
||||||
|
|
||||||
home.file.".qutebrowser/quickmarks" =
|
|
||||||
mkIf (cfg.quickmarks != { } && pkgs.stdenv.hostPlatform.isDarwin)
|
|
||||||
{
|
|
||||||
text = quickmarksFile;
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile."qutebrowser/config.py" = mkIf pkgs.stdenv.hostPlatform.isLinux {
|
|
||||||
text = qutebrowserConfig;
|
text = qutebrowserConfig;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
onChange = ''
|
onChange = ''
|
||||||
hash="$(echo -n "$USER" | md5sum | cut -d' ' -f1)"
|
hash="$(echo -n "$USER" | md5sum | cut -d' ' -f1)"
|
||||||
socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/qutebrowser/ipc-$hash"
|
socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/qutebrowser/ipc-$hash"
|
||||||
@@ -371,22 +369,12 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile."qutebrowser/quickmarks" =
|
home.file."${configDir}/quickmarks" = mkIf (cfg.quickmarks != { }) {
|
||||||
mkIf (cfg.quickmarks != { } && pkgs.stdenv.hostPlatform.isLinux)
|
text = quickmarksFile;
|
||||||
{
|
};
|
||||||
text = quickmarksFile;
|
|
||||||
};
|
|
||||||
|
|
||||||
home.file.".qutebrowser/greasemonkey" =
|
home.file."${configDir}/greasemonkey" = mkIf (cfg.greasemonkey != [ ]) {
|
||||||
mkIf (cfg.greasemonkey != [ ] && pkgs.stdenv.hostPlatform.isDarwin)
|
source = greasemonkeyDir;
|
||||||
{
|
};
|
||||||
source = greasemonkeyDir;
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile."qutebrowser/greasemonkey" =
|
|
||||||
mkIf (cfg.greasemonkey != [ ] && pkgs.stdenv.hostPlatform.isLinux)
|
|
||||||
{
|
|
||||||
source = greasemonkeyDir;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user