1
Fork 0

Set up passff in favour of browserpass

This also introduces a custom `satellite.toggles` module.
This commit is contained in:
Matei Adriel 2023-11-13 04:03:14 +01:00
parent eca258cdfc
commit 6aea9045c7
No known key found for this signature in database
6 changed files with 94 additions and 67 deletions

View file

@ -12,10 +12,13 @@ in
enable = true;
};
home.packages = lib.mkIf config.programs.wofi.enable [
pkgs.wofi-pass
];
# Enable runner integration
home.packages = lib.lists.optional config.programs.wofi.enable pkgs.wofi-pass;
# Enable the firefox extension
home.file.".mozilla/native-messaging-hosts/passff.json".source =
lib.mkIf config.programs.firefox.enable
"${pkgs.passff-host}/lib/mozilla/native-messaging-hosts/passff.json";
programs.browserpass.enable = config.programs.firefox.enable;
satellite.persistence.at.data.apps.pass.directories = [ storePath ];
}

View file

@ -1,7 +1,7 @@
{ config, pkgs, inputs, ... }:
{ config, lib, pkgs, inputs, ... }:
let
# {{{ Global extensions
extensions = with inputs.firefox-addons.packages.${pkgs.system}; [
extensions = with inputs.firefox-addons.packages.${pkgs.system}; ([
buster-captcha-solver
# REASON: returns 404 for now
# bypass-paywalls-clean
@ -21,8 +21,10 @@ let
ublock-origin
unpaywall
user-agent-string-switcher
browserpass # Password store support
];
] ++
# Password store support
lib.lists.optional config.programs.password-store.enable passff
);
# }}}
in
{
@ -47,21 +49,28 @@ in
userContent = builtins.readFile ./userContent.css;
# }}}
# {{{ Extensions
extensions = with inputs.firefox-addons.packages.${pkgs.system}; extensions ++ [
augmented-steam # Adds more info to steam
blocktube # Lets you block youtube channels
dearrow # Crowdsourced clickbait remover 💀
firenvim # summon a nvim instance inside the browser
lovely-forks # displays forks on github
octolinker # github import to link thingy
octotree # github file tree
refined-github # a bunch of github modifications
return-youtube-dislikes
steam-database # adds info from steamdb on storepages
sponsorblock # skip youtube sponsors
vimium-c # vim keybinds
youtube-shorts-block
];
extensions =
with inputs.firefox-addons.packages.${pkgs.system};
with lib.lists; flatten [
extensions
# List of profile-specific extensions
[
augmented-steam # Adds more info to steam
blocktube # Lets you block youtube channels
dearrow # Crowdsourced clickbait remover 💀
lovely-forks # displays forks on github
octolinker # github import to link thingy
octotree # github file tree
refined-github # a bunch of github modifications
return-youtube-dislikes
steam-database # adds info from steamdb on storepages
sponsorblock # skip youtube sponsors
vimium-c # vim keybinds
youtube-shorts-block
]
# summons a nvim instance inside the browser
(optional config.satellite.toggles.neovim.enable firenvim)
];
# }}}
# {{{ Search engines
search.engines =

View file

@ -137,9 +137,12 @@ let
in
{
# {{{ Basic config
# Do not manage neovim via nix
# Do not manage neovim via the default home manager module
programs.neovim.enable = false;
# We still want other modules to know that we are using neovim!
satellite.toggles.neovim.enable = true;
xdg.configFile.nvim.source = config.satellite.dev.path "dotfiles/neovim";
home.sessionVariables.EDITOR = "nvim";
@ -150,49 +153,50 @@ in
];
# }}}
# {{{ Firenvim
home.file.".mozilla/native-messaging-hosts/firenvim.json".text =
let
# God knows what this does
# https://github.com/glacambre/firenvim/blob/87c9f70d3e6aa2790982aafef3c696dbe962d35b/autoload/firenvim.vim#L592
firenvim_init = pkgs.writeText "firenvim_init.vim" ''
let g:firenvim_i=[]
let g:firenvim_o=[]
let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}
let g:Firenvim_oo={t->[chansend(2,t)]+add(g:firenvim_o,t)}
let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})
let g:started_by_firenvim = v:true
'';
home.file.".mozilla/native-messaging-hosts/firenvim.json" =
lib.mkIf config.programs.firefox.enable {
text =
let
# God knows what this does
# https://github.com/glacambre/firenvim/blob/87c9f70d3e6aa2790982aafef3c696dbe962d35b/autoload/firenvim.vim#L592
firenvim_init = pkgs.writeText "firenvim_init.vim" ''
let g:firenvim_i=[]
let g:firenvim_o=[]
let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}
let g:Firenvim_oo={t->[chansend(2,t)]+add(g:firenvim_o,t)}
let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})
let g:started_by_firenvim = v:true
'';
firenvim_file_loaded = pkgs.writeText "firenvim_file_loaded.vim"
''
try
call firenvim#run()
catch /Unknown function/
call chansend(g:firenvim_c,["f\n\n\n"..json_encode({"messages":["Your plugin manager did not load the Firenvim plugin for neovim."],"version":"0.0.0"})])
call chansend(2,["Firenvim not in runtime path. &rtp="..&rtp])
qall!
catch
call chansend(g:firenvim_c,["l\n\n\n"..json_encode({"messages": ["Something went wrong when running firenvim. See troubleshooting guide."],"version":"0.0.0"})])
call chansend(2,[v:exception])
qall!
endtry
'';
in
builtins.toJSON
{
name = "firenvim";
description = "Turn your browser into a Neovim GUI.";
type = "stdio";
allowed_extensions = [ "firenvim@lacamb.re" ];
path = pkgs.writeShellScript "firenvim.sh" ''
mkdir -p /run/user/$UID/firenvim
chmod 700 /run/user/$UID/firenvim
cd /run/user/$UID/firenvim
firenvim_file_loaded = pkgs.writeText "firenvim_file_loaded.vim" ''
try
call firenvim#run()
catch /Unknown function/
call chansend(g:firenvim_c,["f\n\n\n"..json_encode({"messages":["Your plugin manager did not load the Firenvim plugin for neovim."],"version":"0.0.0"})])
call chansend(2,["Firenvim not in runtime path. &rtp="..&rtp])
qall!
catch
call chansend(g:firenvim_c,["l\n\n\n"..json_encode({"messages": ["Something went wrong when running firenvim. See troubleshooting guide."],"version":"0.0.0"})])
call chansend(2,[v:exception])
qall!
endtry
'';
in
builtins.toJSON {
name = "firenvim";
description = "Turn your browser into a Neovim GUI.";
type = "stdio";
allowed_extensions = [ "firenvim@lacamb.re" ];
path = pkgs.writeShellScript "firenvim.sh" ''
mkdir -p /run/user/$UID/firenvim
chmod 700 /run/user/$UID/firenvim
cd /run/user/$UID/firenvim
exec '${firenvim}/bin/nvim' --headless \
--cmd 'source "${firenvim_init}"' \
-S '${firenvim_file_loaded}'
'';
};
exec '${firenvim}/bin/nvim' --headless \
--cmd 'source "${firenvim_init}"' \
-S '${firenvim_file_loaded}'
'';
};
};
# }}}
}

View file

@ -4,4 +4,5 @@
# example = import ./example.nix;
lua-colorscheme = import ./lua-colorscheme.nix;
theming = import ./theming.nix;
toggles = import ./toggles.nix;
}

View file

@ -0,0 +1,10 @@
{ lib, ... }:
{
options.satellite.toggles = lib.mkOption {
default = { };
description = "Record of custom toggles to use throughput the config";
type = lib.types.attrsOf (lib.types.submodule (name: {
options.enable = lib.mkEnableOption "Toggle for ${name}";
}));
};
}

View file

@ -76,7 +76,7 @@ in
terminal = false;
name = app.displayName;
type = "Application";
exec = "firefox --name=${app.displayName} --no-remote -P \"${app.name}\" \"${app.url}\"";
exec = "firefox --name=${app.displayName} --no-remote --kiosk -P \"${app.name}\" \"${app.url}\"";
icon = app.icon;
};
in