{ lib, pkgs, inputs, namespace, system, target, format, virtual, systems, config, ... }: with lib; with lib.${namespace}; let cfg = config.${namespace}.services.guix; impermanence = config.${namespace}.impermanence; persist = impermanence.persistentStorage; in { options.${namespace}.services.guix = with types; { enable = mkBoolOpt false "Enable guix"; }; config = mkIf cfg.enable { services.guix = { enable = true; gc.enable = true; publish = { enable = true; port = 17333; extraArgs = [ "--advertise" "--compression=zstd:6" ]; }; }; systemd.tmpfiles.rules = [ "d /var/guix 2775 root guixbuild - -" "d /var/guix/daemon-socket 2770 root guixbuild - -" ]; environment.persistence."${persist}/guix".directories = lib.optionals impermanence.enable [ "/var/guix" ]; }; }