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 (lib.mdDoc "EVCC, the extensible EV Charge Controller with PV integration");
24 extraArgs = mkOption {
27 description = lib.mdDoc ''
28 Extra arguments to pass to the evcc executable.
34 description = lib.mdDoc ''
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 = {
45 "network-online.target"
51 environment.HOME = "/var/lib/evcc";
56 ExecStart = "${package}/bin/evcc --config ${configFile} ${escapeShellArgs cfg.extraArgs}";
57 CapabilityBoundingSet = [ "" ];
61 DevicePolicy = "closed";
63 LockPersonality = true;
64 MemoryDenyWriteExecute = true;
65 RestrictAddressFamilies = [
70 RestrictNamespaces = true;
71 RestrictRealtime = true;
76 ProtectControlGroups= true;
78 ProtectHostname = true;
79 ProtectKernelLogs = true;
80 ProtectKernelModules = true;
81 ProtectKernelTunables = true;
82 ProtectProc = "invisible";
83 StateDirectory = "evcc";
84 SystemCallArchitectures = "native";
95 meta.buildDocsInSandbox = false;