10 cfg = config.services.evcc;
12 format = pkgs.formats.yaml {};
13 configFile = format.generate "evcc.yml" cfg.settings;
19 meta.maintainers = with lib.maintainers; [ hexa ];
21 options.services.evcc = with types; {
22 enable = mkEnableOption "EVCC, the extensible EV Charge Controller with PV integration";
24 extraArgs = mkOption {
28 Extra arguments to pass to the evcc executable.
35 evcc configuration as a Nix attribute set.
37 Check for possible options in the sample [evcc.dist.yaml](https://github.com/andig/evcc/blob/${package.version}/evcc.dist.yaml].
42 config = mkIf cfg.enable {
43 systemd.services.evcc = {
44 wants = [ "network-online.target" ];
46 "network-online.target"
52 environment.HOME = "/var/lib/evcc";
57 ExecStart = "${package}/bin/evcc --config ${configFile} ${escapeShellArgs cfg.extraArgs}";
58 CapabilityBoundingSet = [ "" ];
62 DevicePolicy = "closed";
64 LockPersonality = true;
65 MemoryDenyWriteExecute = true;
66 Restart = "on-failure";
67 RestrictAddressFamilies = [
72 RestrictNamespaces = true;
73 RestrictRealtime = true;
78 ProtectControlGroups= true;
80 ProtectHostname = true;
81 ProtectKernelLogs = true;
82 ProtectKernelModules = true;
83 ProtectKernelTunables = true;
84 ProtectProc = "invisible";
85 StateDirectory = "evcc";
86 SystemCallArchitectures = "native";
97 meta.buildDocsInSandbox = false;