h,europa: wrap restic bin more intelligently

This commit is contained in:
Aaron Bieber 2023-04-17 10:43:10 -06:00
parent dbb98d94ef
commit 298facd6d2
No known key found for this signature in database
3 changed files with 24 additions and 6 deletions

View File

@ -1,9 +1,17 @@
{ pkgs }: { lib, pkgs, config, ... }:
let resticBin = "${pkgs.restic}/bin/restic"; assert (builtins.length
(lib.mapAttrsToList (a: _: a) config.services.restic.backups)) <= 1;
let
resticBin = "${pkgs.restic}/bin/restic";
cfg = config.services.restic.backups;
bkp = lib.mapAttrs' (_: lib.nameValuePair "default") cfg;
in '' in ''
#!/usr/bin/env sh #!/usr/bin/env sh
export $(cat /run/secrets/restic_env_file) set -e
${resticBin} --password-file /run/secrets/restic_password_file $@
export $(cat ${bkp.default.environmentFile})
${resticBin} -r ${bkp.default.repository} --password-file ${bkp.default.passwordFile} $@
'' ''

View File

@ -1,5 +1,10 @@
{ config, pkgs, lib, xinlib, ... }: { config, pkgs, lib, xinlib, ... }:
let let
restic = pkgs.writeScriptBin "restic" (import ../../bins/restic.nix {
inherit pkgs;
inherit lib;
inherit config;
});
myEmacs = pkgs.callPackage ../../configs/emacs.nix { }; myEmacs = pkgs.callPackage ../../configs/emacs.nix { };
peerixUser = if builtins.hasAttr "peerix" config.users.users then peerixUser = if builtins.hasAttr "peerix" config.users.users then
config.users.users.peerix.name config.users.users.peerix.name
@ -294,6 +299,8 @@ in {
}) })
(callPackage ../../pkgs/gokrazy.nix { }) (callPackage ../../pkgs/gokrazy.nix { })
(callPackage ../../pkgs/zutty.nix { }) (callPackage ../../pkgs/zutty.nix { })
restic
]; ];
# for Pharo # for Pharo

View File

@ -1,8 +1,11 @@
{ config, pkgs, isUnstable, ... }: { config, pkgs, isUnstable, ... }:
with pkgs; with pkgs;
let let
restic = pkgs.writeScriptBin "restic" restic = pkgs.writeScriptBin "restic" (import ../../bins/restic.nix {
(import ../../bins/restic.nix { inherit pkgs; }); inherit pkgs;
inherit lib;
inherit config;
});
gqrss = callPackage ../../pkgs/gqrss.nix { inherit isUnstable; }; gqrss = callPackage ../../pkgs/gqrss.nix { inherit isUnstable; };
icbirc = callPackage ../../pkgs/icbirc.nix { inherit isUnstable; }; icbirc = callPackage ../../pkgs/icbirc.nix { inherit isUnstable; };
mcchunkie = callPackage ../../pkgs/mcchunkie.nix { inherit isUnstable; }; mcchunkie = callPackage ../../pkgs/mcchunkie.nix { inherit isUnstable; };