diff options
Diffstat (limited to 'modules/by-name/qu/qutebrowser/module.nix')
-rw-r--r-- | modules/by-name/qu/qutebrowser/module.nix | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/modules/by-name/qu/qutebrowser/module.nix b/modules/by-name/qu/qutebrowser/module.nix new file mode 100644 index 00000000..20ab8e4b --- /dev/null +++ b/modules/by-name/qu/qutebrowser/module.nix @@ -0,0 +1,87 @@ +{ + config, + lib, + pkgs, + self, + ... +}: let + cfg = config.soispha.programs.qutebrowser; + + qutebrowsersWithProfiles = let + xdg_data_home = config.home-manager.users.soispha.xdg.dataHome; + xdg_config_home = config.home-manager.users.soispha.xdg.configHome; + + mkQutebrowser = name: + pkgs.runCommandLocal "qutebrowser-${name}" { + nativeBuildInputs = [ + pkgs.makeBinaryWrapper + ]; + } + '' + makeWrapper ${pkgs.qutebrowser-patched} "$out/bin/qutebrowser-${name}" \ + --add-flags --no-err-windows \ + --add-flags --basedir \ + --add-flags "${xdg_data_home}/qutebrowser/${name}" \ + --add-flags --config \ + --add-flags "${xdg_config_home}/qutebrowser/config.py" \ + ''; + in + builtins.filter (val: val != null) (lib.mapAttrsToList (name: value: + if value.enable + then mkQutebrowser name + else null) + cfg.profiles); +in { + options.soispha.programs.qutebrowser = { + enable = lib.mkEnableOption "qutebrowser"; + + key = lib.mkOption { + type = lib.types.str; + description = '' + The gpg key, used when decrypting the keepassxc connection key. + ''; + }; + + profiles = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule { + options = { + enable = + (lib.mkEnableOption "this profile") + // { + default = true; + }; + }; + }); + + description = "A name enable map of profies to create besides the default `default` profile."; + default = {}; + }; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + disabledModules = [ + "${self.inputs.home-manager}/modules/programs/qutebrowser.nix" + ]; + imports = [ + ./module.hm.nix + ]; + + home.packages = qutebrowsersWithProfiles; + + programs.qutebrowser = { + enable = true; + package = pkgs.hello; # TODO: Set to null, once supported <2025-06-06> + + settings = import ./settings { + inherit lib pkgs; + cfg = config.soispha.programs.qutebrowser; + }; + + extraConfig = { + "redirects" = ./include/redirects.py; + }; + }; + }; + }; +} |