sane-backup-*: port to nix-shell
This commit is contained in:
parent
ae2e4931f3
commit
21d17c330f
|
@ -27,7 +27,6 @@ let
|
||||||
"bin"
|
"bin"
|
||||||
coreutils-full
|
coreutils-full
|
||||||
curl
|
curl
|
||||||
duplicity
|
|
||||||
file
|
file
|
||||||
findutils
|
findutils
|
||||||
git
|
git
|
||||||
|
@ -53,7 +52,6 @@ let
|
||||||
which
|
which
|
||||||
];
|
];
|
||||||
keep = {
|
keep = {
|
||||||
"/run/secrets/duplicity_passphrase" = true;
|
|
||||||
# we write here: keep it
|
# we write here: keep it
|
||||||
"/tmp/rmlint.sh" = true;
|
"/tmp/rmlint.sh" = true;
|
||||||
# intentionally escapes (into user code)
|
# intentionally escapes (into user code)
|
||||||
|
@ -77,7 +75,6 @@ let
|
||||||
|
|
||||||
# list of programs which *can* or *cannot* exec their arguments
|
# list of programs which *can* or *cannot* exec their arguments
|
||||||
execer = with pkgs; [
|
execer = with pkgs; [
|
||||||
"cannot:${duplicity}/bin/duplicity"
|
|
||||||
"cannot:${git}/bin/git"
|
"cannot:${git}/bin/git"
|
||||||
"cannot:${gocryptfs}/bin/gocryptfs"
|
"cannot:${gocryptfs}/bin/gocryptfs"
|
||||||
"cannot:${ifuse}/bin/ifuse"
|
"cannot:${ifuse}/bin/ifuse"
|
||||||
|
@ -89,7 +86,6 @@ let
|
||||||
"cannot:${sops}/bin/sops"
|
"cannot:${sops}/bin/sops"
|
||||||
"cannot:${ssh-to-age}/bin/ssh-to-age"
|
"cannot:${ssh-to-age}/bin/ssh-to-age"
|
||||||
"cannot:${systemd}/bin/systemctl"
|
"cannot:${systemd}/bin/systemctl"
|
||||||
"cannot:${transmission}/bin/transmission-remote"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -108,6 +104,16 @@ let
|
||||||
|
|
||||||
py-scripts = {
|
py-scripts = {
|
||||||
# anything added to this attrset gets symlink-joined into `sane-scripts`
|
# anything added to this attrset gets symlink-joined into `sane-scripts`
|
||||||
|
backup-ls = static-nix-shell.mkBash {
|
||||||
|
pname = "sane-backup-ls";
|
||||||
|
src = ./src;
|
||||||
|
pkgs = [ "duplicity" ];
|
||||||
|
};
|
||||||
|
backup-restore = static-nix-shell.mkBash {
|
||||||
|
pname = "sane-backup-restore";
|
||||||
|
src = ./src;
|
||||||
|
pkgs = [ "duplicity" ];
|
||||||
|
};
|
||||||
bt-add = static-nix-shell.mkBash {
|
bt-add = static-nix-shell.mkBash {
|
||||||
pname = "sane-bt-add";
|
pname = "sane-bt-add";
|
||||||
src = ./src;
|
src = ./src;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p duplicity
|
||||||
|
|
||||||
# N.B. must be run as root
|
# N.B. must be run as root
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# source the URL; hack to satisfy resholve
|
# source the URL; hack to satisfy resholve
|
||||||
external_cmd="source /run/secrets/duplicity_passphrase"
|
external_cmd="source /run/secrets/duplicity_passphrase.env"
|
||||||
$external_cmd
|
$external_cmd
|
||||||
duplicity list-current-files --archive-dir /var/lib/duplicity $DUPLICITY_URL
|
duplicity list-current-files --archive-dir /var/lib/duplicity $DUPLICITY_URL
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p duplicity
|
||||||
|
|
||||||
# N.B. must be run as root
|
# N.B. must be run as root
|
||||||
|
|
||||||
|
@ -8,6 +9,6 @@ dest_path="$1"
|
||||||
source_path="$2"
|
source_path="$2"
|
||||||
|
|
||||||
# source the URL; hack to satisfy resholve
|
# source the URL; hack to satisfy resholve
|
||||||
external_cmd="source /run/secrets/duplicity_passphrase"
|
external_cmd="source /run/secrets/duplicity_passphrase.env"
|
||||||
$external_cmd
|
$external_cmd
|
||||||
duplicity restore --archive-dir /var/lib/duplicity --file-to-restore "$source_path" $DUPLICITY_URL "$dest_path"
|
duplicity restore --archive-dir /var/lib/duplicity --file-to-restore "$source_path" $DUPLICITY_URL "$dest_path"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user