diff --git a/configs/cloud.nix b/configs/cloud.nix index bdadc3c..65b7f74 100644 --- a/configs/cloud.nix +++ b/configs/cloud.nix @@ -3,7 +3,9 @@ lib, pkgs, ... -}: { +}: let + inherit (import ) tmpfilesConfig; +in { imports = [ ]; @@ -12,11 +14,32 @@ dropbox.enable = false; }; - system.activationScripts.home-symlinks = '' - ln -sfn ${config.users.users.me.home}/cloud/syncthing/common/mahlzeit ${config.users.users.me.home}/mahlzeit - ln -sfn ${config.users.users.me.home}/cloud/Seafile/Wiki ${config.users.users.me.home}/notes - ln -sfn ${config.users.users.me.home}/cloud/Seafile/Uni ${config.users.users.me.home}/uni - ''; + systemd.tmpfiles.rules = map tmpfilesConfig [ + { + type = "L+"; + user = config.users.users.me.name; + group = "users"; + mode = "0755"; + argument = "${config.users.users.me.home}/cloud/Seafile/Wiki"; + path = "${config.users.users.me.home}/notes"; + } + { + type = "L+"; + user = config.users.users.me.name; + group = "users"; + mode = "0755"; + argument = "${config.users.users.me.home}/cloud/Seafile/Uni"; + path = "${config.users.users.me.home}/uni"; + } + { + type = "L+"; + user = config.users.users.me.name; + group = "users"; + mode = "0755"; + argument = "${config.users.users.me.home}/cloud/syncthing/common/mahlzeit"; + path = "${config.users.users.me.home}/mahlzeit"; + } + ]; home-manager.users.me = { services.gnome-keyring.enable = true; diff --git a/systems/makanek/hedgedoc.nix b/systems/makanek/hedgedoc.nix index 4789119..b893f0d 100644 --- a/systems/makanek/hedgedoc.nix +++ b/systems/makanek/hedgedoc.nix @@ -7,9 +7,8 @@ stateLocation = "/var/lib/codimd/state.sqlite"; nixpkgs-unstable = import {}; domain = "pad.kmein.de"; + inherit (import ) tmpfilesConfig; in { - imports = []; - services.nginx.virtualHosts.${domain} = { enableACME = true; forceSSL = true; @@ -49,11 +48,15 @@ in { }; }; - krebs.permown.${backupLocation} = { - owner = "codimd"; - group = "codimd"; - umask = "0002"; - }; + systemd.tmpfiles.rules = [ + (tmpfilesConfig { + user = "codimd"; + group = "codimd"; + mode = "0755"; + type = "d"; + path = backupLocation; + }) + ]; systemd.services.hedgedoc-backup = { description = "Hedgedoc backup service"; diff --git a/systems/zaatar/tuna.nix b/systems/zaatar/tuna.nix index 7dc740d..f5b77af 100644 --- a/systems/zaatar/tuna.nix +++ b/systems/zaatar/tuna.nix @@ -5,6 +5,7 @@ ... }: let firewall = (import ).firewall lib; + inherit (import ) tmpfilesConfig; streams = import { di-fm-key = lib.strings.fileContents ; @@ -71,22 +72,31 @@ in { extraStopCommands = firewall.removeRules rules; }; - system.activationScripts.mpd-playlists = let - makePlaylist = name: streams: pkgs.writeText "name.m3u" (lib.concatMapStringsSep "\n" (lib.getAttr "stream") streams); + systemd.tmpfiles.rules = let tags = lib.lists.unique (lib.concatMap ({tags ? [], ...}: tags) streams); - in '' - rm -rf /var/lib/mpd/playlists - install -d /var/lib/mpd/playlists - ln -sfn "${toString (makePlaylist "all" streams)}" "/var/lib/mpd/playlists/all.m3u" - ${lib.concatMapStringsSep "\n" ( - tag: let - playlistStreams = lib.filter ({tags ? [], ...}: lib.elem tag tags) streams; - in '' - ln -sfn "${toString (makePlaylist tag playlistStreams)}" "/var/lib/mpd/playlists/${tag}.m3u" - '' - ) - tags} - ''; + tagStreams = tag: map (lib.getAttr "stream") (lib.filter ({tags ? [], ...}: lib.elem tag tags) streams); + makePlaylist = name: urls: pkgs.writeText "${name}.m3u" (lib.concatStringsSep "\n" urls); + in + map (tag: + tmpfilesConfig { + type = "L+"; + path = "/var/lib/mpd/playlists/${tag}.m3u"; + mode = "0644"; + user = "mpd"; + group = "mpd"; + argument = makePlaylist tag (tagStreams tag); + }) + tags + + [ + (tmpfilesConfig { + type = "L+"; + mode = "0644"; + user = "mpd"; + group = "mpd"; + path = "/var/lib/mpd/playlist/all.m3u"; + argument = makePlaylist "all" streams; + }) + ]; services.tuna = { enable = true;