mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-24 18:51:54 -05:00
backblaze: drop module
This commit is contained in:
parent
98f29bb022
commit
5ffd4dfc8b
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.ar.home.apps.backblaze;
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
home = {
|
||||
activation.backblazeAuthentication = lib.hm.dag.entryAfter ["reloadSystemd"] ''
|
||||
${
|
||||
if ((cfg.keyIdFile != null) && (cfg.keyFile != null))
|
||||
then
|
||||
(
|
||||
if !(builtins.pathExists "${config.xdg.configHome}/b2/account_info")
|
||||
then ''
|
||||
XDG_RUNTIME_DIR=''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}
|
||||
run --quiet ${lib.getExe pkgs.backblaze-b2} authorize_account `${lib.getExe' pkgs.coreutils "cat"} ${cfg.keyIdFile}` `${lib.getExe' pkgs.coreutils "cat"} ${cfg.keyFile}`''
|
||||
else ''run echo "backblaze: Already authenticated."''
|
||||
)
|
||||
else ''run echo "backblaze: Missing keyIDfile and keyFile."''
|
||||
}
|
||||
'';
|
||||
|
||||
packages = with pkgs; [backblaze-b2];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./alacritty
|
||||
./backblaze
|
||||
./chromium
|
||||
./emacs
|
||||
./fastfetch
|
||||
|
|
|
@ -11,22 +11,6 @@ in {
|
|||
apps = {
|
||||
alacritty.enable = lib.mkEnableOption "Alacritty terminal.";
|
||||
|
||||
backblaze = {
|
||||
enable = lib.mkEnableOption "Backblaze-b2 client with declarative authentication.";
|
||||
|
||||
keyIdFile = lib.mkOption {
|
||||
description = "Backblaze key ID.";
|
||||
default = null;
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
};
|
||||
|
||||
keyFile = lib.mkOption {
|
||||
description = "Backblaze application key.";
|
||||
default = null;
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
};
|
||||
};
|
||||
|
||||
chromium = {
|
||||
enable = lib.mkEnableOption "Chromium-based browser with default extensions.";
|
||||
package = lib.mkPackageOption pkgs "brave" {};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
|
@ -7,7 +6,6 @@
|
|||
homeDirectory = "/home/aly";
|
||||
|
||||
packages = with pkgs; [
|
||||
browsh
|
||||
curl
|
||||
];
|
||||
|
||||
|
@ -47,12 +45,6 @@
|
|||
|
||||
ar.home = {
|
||||
apps = {
|
||||
backblaze = {
|
||||
enable = true;
|
||||
keyIdFile = config.age.secrets.backblazeKeyId.path;
|
||||
keyFile = config.age.secrets.backblazeKey.path;
|
||||
};
|
||||
|
||||
fastfetch.enable = true;
|
||||
helix.enable = true;
|
||||
shell.enable = true;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
age.secrets = {
|
||||
achacegaGmail.file = ../../secrets/aly/mail/achacega_gmail.age;
|
||||
alyraffaufFastmail.file = ../../secrets/aly/mail/alyraffauf_fastmail.age;
|
||||
backblazeKeyId.file = ../../secrets/aly/backblaze/keyId.age;
|
||||
backblazeKey.file = ../../secrets/aly/backblaze/key.age;
|
||||
|
||||
transmissionRemote = {
|
||||
file = ../../secrets/aly/transmissionRemote.age;
|
||||
|
|
|
@ -33,9 +33,14 @@
|
|||
}
|
||||
];
|
||||
|
||||
users.aly = lib.mkForce {
|
||||
users.aly = lib.mkForce ({config, ...}: {
|
||||
imports = [self.homeManagerModules.aly];
|
||||
|
||||
age.secrets = {
|
||||
backblazeKeyId.file = ../../secrets/aly/backblaze/keyId.age;
|
||||
backblazeKey.file = ../../secrets/aly/backblaze/key.age;
|
||||
};
|
||||
|
||||
systemd.user = {
|
||||
services.backblaze-sync = {
|
||||
Unit.Description = "Backup to Backblaze.";
|
||||
|
@ -61,6 +66,8 @@
|
|||
['/mnt/Archive/Shows']="b2://aly-shows"
|
||||
)
|
||||
|
||||
backblaze-b2 authorize_account `cat ${config.age.secrets.backblazeKeyId.path}` `cat ${config.age.secrets.backblazeKey.path}`
|
||||
|
||||
# Recursively backup folders to B2 with sanity checks.
|
||||
for folder in "''${!backups[@]}"; do
|
||||
if [ -d "$folder" ] && [ "$(ls -A "$folder")" ]; then
|
||||
|
@ -80,6 +87,6 @@
|
|||
Unit.Description = "Daily backups to Backblaze.";
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue