refactor!: rename bitwarden -> vaultwarden
Was renamed upstream, in NixOS 21.11.
This commit is contained in:
parent
0986d3ceab
commit
327b113a07
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env cached-nix-shell
|
#!/usr/bin/env cached-nix-shell
|
||||||
#! nix-shell -p ruby_2_7 -i "ruby -S"
|
#! nix-shell -p ruby_2_7 -i "ruby -S"
|
||||||
|
|
||||||
# A rofi client for bitwarden. Similar to passmenu, but uses rofi. (Badly)
|
# A rofi client for vaultwarden. Similar to passmenu, but uses rofi. (Badly)
|
||||||
# written in ruby because data persistence and frontend logic would be a pain to
|
# written in ruby because data persistence and frontend logic would be a pain to
|
||||||
# write in bash or zsh. I'll refactor this later perhaps. Maybe.
|
# write in bash or zsh. I'll refactor this later perhaps. Maybe.
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ module BW
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.notify message, title: nil, urgency: "normal"
|
def self.notify message, title: nil, urgency: "normal"
|
||||||
sh 'notify-send', '-u', urgency, '-a', "Bitwarden", *[title, message].compact
|
sh 'notify-send', '-u', urgency, '-a', "Vaultwarden", *[title, message].compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.error message
|
def self.error message
|
||||||
|
@ -209,7 +209,7 @@ module BW
|
||||||
when true
|
when true
|
||||||
return data[0][1]
|
return data[0][1]
|
||||||
end
|
end
|
||||||
rofi rofiData.merge(data.to_h), '-p', 'Bitwarden', '-filter', (query || "")
|
rofi rofiData.merge(data.to_h), '-p', 'Vaultwarden', '-filter', (query || "")
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_item item, field: nil
|
def show_item item, field: nil
|
||||||
|
|
|
@ -70,7 +70,7 @@ config.bind('<Ctrl+E>', 'edit-text', mode='insert')
|
||||||
config.bind('<Ctrl+E>', 'hint inputs --first ;; edit-text', mode='normal')
|
config.bind('<Ctrl+E>', 'hint inputs --first ;; edit-text', mode='normal')
|
||||||
config.bind('<Shift+Ins>', 'fake-key <Ctrl+V>', mode='insert')
|
config.bind('<Shift+Ins>', 'fake-key <Ctrl+V>', mode='insert')
|
||||||
|
|
||||||
# Bitwarden integration
|
# Vaultwarden integration
|
||||||
config.bind(";pp", 'spawn -u qute-bwmenu')
|
config.bind(";pp", 'spawn -u qute-bwmenu')
|
||||||
config.bind(";pu", 'spawn -u qute-bwmenu --field username')
|
config.bind(";pu", 'spawn -u qute-bwmenu --field username')
|
||||||
config.bind(";ps", 'spawn -u qute-bwmenu --field password')
|
config.bind(";ps", 'spawn -u qute-bwmenu --field password')
|
||||||
|
|
|
@ -11,7 +11,7 @@ with lib.my;
|
||||||
|
|
||||||
./modules/backup.nix
|
./modules/backup.nix
|
||||||
./modules/gitea.nix
|
./modules/gitea.nix
|
||||||
./modules/bitwarden.nix
|
./modules/vaultwarden.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
services.bitwarden_rs.backupDir = "/backups/bitwarden_rs";
|
services.vaultwarden.backupDir = "/backups/vaultwarden";
|
||||||
services.gitea.dump.enable = true;
|
services.gitea.dump.enable = true;
|
||||||
services.gitea.dump.backupDir = "/backups/gitea";
|
services.gitea.dump.backupDir = "/backups/gitea";
|
||||||
system.activationScripts.createBackupDir = ''
|
system.activationScripts.createBackupDir = ''
|
||||||
mkdir -m 750 -p "${config.services.bitwarden_rs.backupDir}" || true
|
mkdir -m 750 -p "${config.services.vaultwarden.backupDir}" || true
|
||||||
mkdir -m 750 -p "${config.services.gitea.dump.backupDir}" || true
|
mkdir -m 750 -p "${config.services.gitea.dump.backupDir}" || true
|
||||||
chown bitwarden_rs:bitwarden_rs "${config.services.bitwarden_rs.backupDir}"
|
chown vaultwarden:vaultwarden "${config.services.vaultwarden.backupDir}"
|
||||||
chown git:gitea "${config.services.gitea.dump.backupDir}"
|
chown git:gitea "${config.services.gitea.dump.backupDir}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
modules.services.bitwarden.enable = true;
|
modules.services.vaultwarden.enable = true;
|
||||||
|
|
||||||
services.bitwarden_rs.config = {
|
services.vaultwarden.config = {
|
||||||
signupsAllowed = false;
|
signupsAllowed = false;
|
||||||
invitationsAllowed = true;
|
invitationsAllowed = true;
|
||||||
domain = "https://p.v0.io";
|
domain = "https://p.v0.io";
|
||||||
|
@ -11,8 +11,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Inject secrets at runtime
|
# Inject secrets at runtime
|
||||||
systemd.services.bitwarden_rs.serviceConfig = {
|
systemd.services.vaultwarden.serviceConfig = {
|
||||||
EnvironmentFile = [ config.age.secrets.bitwarden-smtp-env.path ];
|
EnvironmentFile = [ config.age.secrets.vaultwarden-smtp-env.path ];
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "2s";
|
RestartSec = "2s";
|
||||||
};
|
};
|
|
@ -1,5 +1,5 @@
|
||||||
let key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINd+4ijlEHI98NLpgP/El73BmpBUfzka9ovdt8FoaVAG hlissner@home";
|
let key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINd+4ijlEHI98NLpgP/El73BmpBUfzka9ovdt8FoaVAG hlissner@home";
|
||||||
in {
|
in {
|
||||||
"bitwarden-smtp-env.age".publicKeys = [key];
|
"vaultwarden-smtp-env.age".publicKeys = [key];
|
||||||
"gitea-smtp.age".publicKeys = [key];
|
"gitea-smtp.age".publicKeys = [key];
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ with lib;
|
||||||
longitude = 12.5;
|
longitude = 12.5;
|
||||||
} else {});
|
} else {});
|
||||||
|
|
||||||
# So thw bitwarden CLI knows where to find my server.
|
# So the vaultwarden CLI knows where to find my server.
|
||||||
modules.shell.bitwarden.config.server = "p.v0.io";
|
modules.shell.vaultwarden.config.server = "p.v0.io";
|
||||||
|
|
||||||
|
|
||||||
## Not using syncthing atm
|
## Not using syncthing atm
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
};
|
};
|
||||||
shell = {
|
shell = {
|
||||||
adl.enable = true;
|
adl.enable = true;
|
||||||
bitwarden.enable = true;
|
vaultwarden.enable = true;
|
||||||
direnv.enable = true;
|
direnv.enable = true;
|
||||||
git.enable = true;
|
git.enable = true;
|
||||||
gnupg.enable = true;
|
gnupg.enable = true;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
};
|
};
|
||||||
dev = {};
|
dev = {};
|
||||||
shell = {
|
shell = {
|
||||||
bitwarden.enable = true;
|
vaultwarden.enable = true;
|
||||||
direnv.enable = true;
|
direnv.enable = true;
|
||||||
git.enable = true;
|
git.enable = true;
|
||||||
gnupg.enable = true;
|
gnupg.enable = true;
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
{ options, config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
with lib.my;
|
|
||||||
let cfg = config.modules.services.bitwarden;
|
|
||||||
in {
|
|
||||||
options.modules.services.bitwarden = {
|
|
||||||
enable = mkBoolOpt false;
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
services.bitwarden_rs.enable = true;
|
|
||||||
|
|
||||||
user.extraGroups = [ "bitwarden_rs" ];
|
|
||||||
|
|
||||||
services.fail2ban.jails.bitwarden_rs = ''
|
|
||||||
enabled = true
|
|
||||||
filter = bitwarden_rs
|
|
||||||
port = 80,443,8002
|
|
||||||
maxretry = 5
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -27,14 +27,14 @@ in {
|
||||||
|
|
||||||
# Extra filters
|
# Extra filters
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
"fail2ban/filter.d/bitwarden_rs.conf".text = ''
|
"fail2ban/filter.d/vaultwarden.conf".text = ''
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
before = common.conf
|
before = common.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
failregex = ^.*Username or password is incorrect\. Try again\. IP: <ADDR>\. Username:.*$
|
failregex = ^.*Username or password is incorrect\. Try again\. IP: <ADDR>\. Username:.*$
|
||||||
ignoreregex =
|
ignoreregex =
|
||||||
journalmatch = _SYSTEMD_UNIT=bitwarden_rs.service
|
journalmatch = _SYSTEMD_UNIT=vaultwarden.service
|
||||||
'';
|
'';
|
||||||
"fail2ban/filter.d/gitea.conf".text = ''
|
"fail2ban/filter.d/gitea.conf".text = ''
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
23
modules/services/vaultwarden.nix
Normal file
23
modules/services/vaultwarden.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ options, config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
with lib.my;
|
||||||
|
let cfg = config.modules.services.vaultwarden;
|
||||||
|
in {
|
||||||
|
options.modules.services.vaultwarden = {
|
||||||
|
enable = mkBoolOpt false;
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.vaultwarden.enable = true;
|
||||||
|
|
||||||
|
user.extraGroups = [ "vaultwarden" ];
|
||||||
|
|
||||||
|
services.fail2ban.jails.vaultwarden = ''
|
||||||
|
enabled = true
|
||||||
|
filter = vaultwarden
|
||||||
|
port = 80,443,8002
|
||||||
|
maxretry = 5
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
with lib.my;
|
with lib.my;
|
||||||
let cfg = config.modules.shell.bitwarden;
|
let cfg = config.modules.shell.vaultwarden;
|
||||||
in {
|
in {
|
||||||
options.modules.shell.bitwarden = with types; {
|
options.modules.shell.vaultwarden = with types; {
|
||||||
enable = mkBoolOpt false;
|
enable = mkBoolOpt false;
|
||||||
config = mkOpt attrs {};
|
config = mkOpt attrs {};
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ in {
|
||||||
modules.shell.zsh.rcInit = "_cache bw completion --shell zsh; compdef _bw bw;";
|
modules.shell.zsh.rcInit = "_cache bw completion --shell zsh; compdef _bw bw;";
|
||||||
|
|
||||||
system.userActivationScripts = mkIf (cfg.config != {}) {
|
system.userActivationScripts = mkIf (cfg.config != {}) {
|
||||||
initBitwarden = ''
|
initVaultwarden = ''
|
||||||
${concatStringsSep "\n" (mapAttrsToList (n: v: "bw config ${n} ${v}") cfg.config)}
|
${concatStringsSep "\n" (mapAttrsToList (n: v: "bw config ${n} ${v}") cfg.config)}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
Loading…
Reference in a new issue