mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 19:51:34 +01:00
Move modules in programs/services subfolders
This commit is contained in:
parent
2ff87c8404
commit
211ca98e92
38 changed files with 0 additions and 0 deletions
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
user = config.users.users.hedgedoc.name;
|
||||
in
|
||||
{
|
||||
options.custom.services.hedgedoc.backups.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf config.custom.services.hedgedoc.backups.enable {
|
||||
security.polkit = {
|
||||
enable = true;
|
||||
extraConfig =
|
||||
let
|
||||
service = "hedgedoc.service";
|
||||
in
|
||||
''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||
action.lookup("unit") == "${service}" &&
|
||||
subject.user == "${user}") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
||||
'';
|
||||
};
|
||||
|
||||
custom.services.resticBackup.hedgedoc = {
|
||||
inherit user;
|
||||
healthchecks.enable = true;
|
||||
|
||||
extraConfig = {
|
||||
backupPrepareCommand = "${lib.getExe' pkgs.systemd "systemctl"} stop hedgedoc.service";
|
||||
backupCleanupCommand = "${lib.getExe' pkgs.systemd "systemctl"} start hedgedoc.service";
|
||||
paths = with config.services.hedgedoc.settings; [
|
||||
uploadsPath
|
||||
db.storage
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "hedgedoc-restore";
|
||||
text = ''
|
||||
sudo --user=${user} bash -c "
|
||||
systemctl stop hedgedoc.service
|
||||
restic-hedgedoc restore latest --target /
|
||||
systemctl start hedgedoc.service
|
||||
"
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue