parent
d06bcf4c97
commit
b7737f1732
@ -0,0 +1,67 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
|
||||
cfg = config.programs.qutebrowser; |
||||
|
||||
formatLine = o: n: v: |
||||
let |
||||
formatValue = v: |
||||
if builtins.isNull v then |
||||
"None" |
||||
else if builtins.isBool v then |
||||
(if v then "True" else "False") |
||||
else if builtins.isString v then |
||||
''"${v}"'' |
||||
else |
||||
builtins.toString v; |
||||
in if builtins.isAttrs v then |
||||
concatStringsSep "\n" (mapAttrsToList (formatLine "${o}${n}.") v) |
||||
else |
||||
"${o}${n} = ${formatValue v}"; |
||||
|
||||
in { |
||||
options.programs.qutebrowser = { |
||||
enable = mkEnableOption "qutebrowser"; |
||||
|
||||
settings = mkOption { |
||||
type = types.attrs; |
||||
default = { }; |
||||
description = '' |
||||
Options to add to qutebrowser <filename>config.py</filename> file. |
||||
See <link xlink:href="https://qutebrowser.org/doc/help/settings.html"/> |
||||
for options. |
||||
''; |
||||
example = literalExample '' |
||||
{ |
||||
colors = { |
||||
hints = { |
||||
bg = "#000000"; |
||||
fg = "#ffffff"; |
||||
}; |
||||
tabs.bar.bg = "#000000"; |
||||
}; |
||||
tabs.tabs_are_windows = true; |
||||
} |
||||
''; |
||||
}; |
||||
|
||||
extraConfig = mkOption { |
||||
type = types.lines; |
||||
default = ""; |
||||
description = '' |
||||
Extra lines added to qutebrowser <filename>config.py</filename> file. |
||||
''; |
||||
}; |
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
home.packages = [ pkgs.qutebrowser ]; |
||||
|
||||
xdg.configFile."qutebrowser/config.py".text = concatStringsSep "\n" ([ ] |
||||
++ mapAttrsToList (formatLine "c.") cfg.settings |
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig); |
||||
}; |
||||
} |
@ -0,0 +1 @@ |
||||
{ qutebrowser-settings = ./settings.nix; } |
@ -0,0 +1,46 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
{ |
||||
config = { |
||||
programs.qutebrowser = { |
||||
enable = true; |
||||
|
||||
settings = { |
||||
colors = { |
||||
hints = { |
||||
bg = "#000000"; |
||||
fg = "#ffffff"; |
||||
}; |
||||
tabs.bar.bg = "#000000"; |
||||
}; |
||||
tabs.tabs_are_windows = true; |
||||
}; |
||||
|
||||
extraConfig = '' |
||||
# Extra qutebrowser configuration. |
||||
''; |
||||
}; |
||||
|
||||
nixpkgs.overlays = [ |
||||
(self: super: { |
||||
qutebrowser = pkgs.writeScriptBin "dummy-qutebrowser" ""; |
||||
}) |
||||
]; |
||||
|
||||
nmt.script = '' |
||||
assertFileContent \ |
||||
home-files/.config/qutebrowser/config.py \ |
||||
${ |
||||
pkgs.writeText "qutebrowser-expected-config.py" '' |
||||
c.colors.hints.bg = "#000000" |
||||
c.colors.hints.fg = "#ffffff" |
||||
c.colors.tabs.bar.bg = "#000000" |
||||
c.tabs.tabs_are_windows = True |
||||
# Extra qutebrowser configuration. |
||||
'' |
||||
} |
||||
''; |
||||
}; |
||||
} |
Loading…
Reference in new issue