mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2024-11-26 04:51:26 +00:00
nextcloud: fix secrets extraction
This commit is contained in:
parent
364a5c8076
commit
1a5a4be306
|
@ -12,8 +12,8 @@ in
|
||||||
"${db-pass-filepath} and ${admin-pass-filepath} will be removed!"
|
"${db-pass-filepath} and ${admin-pass-filepath} will be removed!"
|
||||||
)
|
)
|
||||||
''
|
''
|
||||||
rm -f ${db-pass-filepath}
|
rm -f -v ${db-pass-filepath}
|
||||||
rm -f ${admin-pass-filepath}
|
rm -f -v ${admin-pass-filepath}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,25 +16,28 @@
|
||||||
inherit (import ./common.nix config)
|
inherit (import ./common.nix config)
|
||||||
sp secrets-filepath db-pass-filepath admin-pass-filepath hostName;
|
sp secrets-filepath db-pass-filepath admin-pass-filepath hostName;
|
||||||
in
|
in
|
||||||
lib.mkIf sp.modules.nextcloud.enable
|
lib.mkIf sp.modules.nextcloud.enable {
|
||||||
{
|
|
||||||
system.activationScripts.nextcloudSecrets = ''
|
|
||||||
install -m 0440 -o nextcloud -g nextcloud -DT \
|
|
||||||
<(${pkgs.jq}/bin/jq < \
|
|
||||||
${secrets-filepath} -r '.modules.nextcloud.databasePassword') \
|
|
||||||
${db-pass-filepath}
|
|
||||||
|
|
||||||
install -m 0440 -o nextcloud -g nextcloud -DT \
|
|
||||||
<(${pkgs.jq}/bin/jq < \
|
|
||||||
${secrets-filepath} -r '.modules.nextcloud.adminPassword') \
|
|
||||||
${admin-pass-filepath}
|
|
||||||
'';
|
|
||||||
fileSystems = lib.mkIf sp.useBinds {
|
fileSystems = lib.mkIf sp.useBinds {
|
||||||
"/var/lib/nextcloud" = {
|
"/var/lib/nextcloud" = {
|
||||||
device = "/volumes/${sp.modules.nextcloud.location}/nextcloud";
|
device = "/volumes/${sp.modules.nextcloud.location}/nextcloud";
|
||||||
options = [ "bind" ];
|
options = [ "bind" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
systemd.services.nextcloud-secrets = {
|
||||||
|
before = [ "nextcloud-setup.service" ];
|
||||||
|
requiredBy = [ "nextcloud-setup.service" ];
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
path = with pkgs; [ coreutils jq ];
|
||||||
|
script = ''
|
||||||
|
install -m 0440 -o nextcloud -g nextcloud -DT \
|
||||||
|
<(jq < ${secrets-filepath} -r '.modules.nextcloud.databasePassword') \
|
||||||
|
${db-pass-filepath}
|
||||||
|
|
||||||
|
install -m 0440 -o nextcloud -g nextcloud -DT \
|
||||||
|
<(jq < ${secrets-filepath} -r '.modules.nextcloud.adminPassword') \
|
||||||
|
${admin-pass-filepath}
|
||||||
|
'';
|
||||||
|
};
|
||||||
services.nextcloud = {
|
services.nextcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.nextcloud25;
|
package = pkgs.nextcloud25;
|
||||||
|
|
Loading…
Reference in a new issue