modules/external-storage: use s3ql from depot

This commit is contained in:
Max Headroom 2023-11-01 23:13:50 +01:00
parent 8086d5615e
commit 907bdf2c74

View file

@ -1,11 +1,7 @@
{ config, lib, pkgs, ... }: { config, depot, lib, pkgs, ... }:
let let
s3qlWithSystemd = pkgs.s3ql.overrideAttrs (old: { inherit (depot.packages) s3ql;
propagatedBuildInputs = old.propagatedBuildInputs ++ [
pkgs.python3Packages.systemd
];
});
cfg = config.services.external-storage; cfg = config.services.external-storage;
@ -105,7 +101,7 @@ in
echo Creating new S3QL filesystem on ${underlayPath} echo Creating new S3QL filesystem on ${underlayPath}
${pkgs.gnugrep}/bin/grep -m1 fs-passphrase: '${config.age.secrets."storageEncryptionKey-${name}".path}' \ ${pkgs.gnugrep}/bin/grep -m1 fs-passphrase: '${config.age.secrets."storageEncryptionKey-${name}".path}' \
| cut -d' ' -f2- \ | cut -d' ' -f2- \
| ${s3qlWithSystemd}/bin/mkfs.s3ql ${lib.escapeShellArgs commonOptions} -L '${name}' 'local://${underlayPath}' | ${s3ql}/bin/mkfs.s3ql ${lib.escapeShellArgs commonOptions} -L '${name}' 'local://${underlayPath}'
fi fi
'') '')
] ]
@ -113,14 +109,14 @@ in
"${pkgs.coreutils}/bin/install" "-dm755" fs.mountpoint "${pkgs.coreutils}/bin/install" "-dm755" fs.mountpoint
] ]
([ ([
"${s3qlWithSystemd}/bin/fsck.s3ql" "${s3ql}/bin/fsck.s3ql"
"local://${underlayPath}" "local://${underlayPath}"
"--compress" "none" "--compress" "none"
] ++ commonOptions) ] ++ commonOptions)
]; ];
ExecStart = lib.escapeShellArgs ([ ExecStart = lib.escapeShellArgs ([
"${s3qlWithSystemd}/bin/mount.s3ql" "${s3ql}/bin/mount.s3ql"
"local://${underlayPath}" "local://${underlayPath}"
fs.mountpoint fs.mountpoint
"--fs-name" "${fs.unitName}" "--fs-name" "${fs.unitName}"
@ -131,7 +127,7 @@ in
] ++ commonOptions); ] ++ commonOptions);
ExecStop = lib.escapeShellArgs [ ExecStop = lib.escapeShellArgs [
"${s3qlWithSystemd}/bin/umount.s3ql" "${s3ql}/bin/umount.s3ql"
"--log" "none" "--log" "none"
fs.mountpoint fs.mountpoint
]; ];