# FIRST-TIME SETUP: # - disable notification sounds: hamburger menu in bottom-left -> preferences # - notification sounds can be handled by swaync { config, lib, pkgs, ... }: let cfg = config.sane.programs.gtkcord4; in { sane.programs.gtkcord4 = { configOption = with lib; mkOption { default = {}; type = types.submodule { options.autostart = mkOption { type = types.bool; default = true; }; }; }; packageUnwrapped = pkgs.gtkcord4.overrideAttrs (upstream: { postConfigure = (upstream.postConfigure or "") + '' # gtkcord4 uses go-keyring to interface with the org.freedesktop.secrets provider (i.e. gnome-keyring). # go-keyring hardcodes `login.keyring` as the keyring to store secrets in, instead of reading `~/.local/share/keyring/default`. # `login.keyring` seems to be a special keyring preconfigured (by gnome-keyring) to encrypt everything to the user's password. # that's redundant with my fs-level encryption and makes the keyring less inspectable, # so patch gtkcord4 to use Default_keyring instead. # see: # - # - substituteInPlace vendor/github.com/zalando/go-keyring/secret_service/secret_service.go \ --replace '"login"' '"Default_keyring"' ''; }); sandbox.method = "bwrap"; sandbox.wrapperType = "wrappedDerivation"; sandbox.net = "clearnet"; sandbox.whitelistAudio = true; sandbox.whitelistDbus = [ "user" ]; # notifications sandbox.whitelistDri = true; sandbox.whitelistWayland = true; sandbox.extraHomePaths = [ "Music" "Pictures/albums" "Pictures/cat" "Pictures/from" "Pictures/Photos" "Pictures/Screenshots" "Pictures/servo-macros" "Videos/local" "Videos/servo" "tmp" ]; persist.byStore.private = [ ".cache/gtkcord4" ".config/gtkcord4" # empty? ]; services.gtkcord4 = { description = "gtkcord4 Discord client"; after = [ "graphical-session.target" ]; # partOf = [ "graphical-session.target" ]; wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ]; serviceConfig = { ExecStart = "${cfg.package}/bin/gtkcord4"; Type = "simple"; Restart = "always"; RestartSec = "20s"; }; }; }; }