{ lib, stdenv, buildGo125Module, fetchFromGitHub, fetchNpmDeps, cacert, git, go_1_25, gokrazy, enumer, mockgen, nodejs, npmHooks, nix-update-script, nixosTests, }: let version = "0.209.1"; src = fetchFromGitHub { owner = "evcc-io"; repo = "evcc"; tag = version; hash = "sha256-cIUc7+mQy9Q+monXOXO6tBmwwAjF+HLgbfo3VnJT9Dk="; }; vendorHash = "sha256-Is6hv2nkTQhugSj+CqcTiwAPvIBtNNAvWZLLWm0jU/8="; commonMeta = with lib; { license = licenses.mit; maintainers = with maintainers; [ hexa ]; }; decorate = buildGo125Module { pname = "evcc-decorate"; inherit version src vendorHash; subPackages = "cmd/decorate"; meta = commonMeta // { description = "EVCC decorate helper"; homepage = "https://github.com/evcc-io/evcc/tree/master/cmd/decorate"; }; }; in buildGo125Module rec { pname = "evcc"; inherit version src vendorHash; npmDeps = fetchNpmDeps { inherit src; hash = "sha256-0pjYFgF4PqWibIQvklZx116V+uDg+MIC7hmQxlCKSvc="; }; nativeBuildInputs = [ nodejs npmHooks.npmConfigHook ]; overrideModAttrs = _: { nativeBuildInputs = [ decorate enumer go_1_25 gokrazy git cacert mockgen ]; preBuild = '' make assets ''; }; tags = [ "release" "test" ]; ldflags = [ "-X github.com/evcc-io/evcc/util.Version=${version}" "-X github.com/evcc-io/evcc/util.Commit=${src.tag}" "-s" "-w" ]; preBuild = '' make ui ''; doCheck = !stdenv.hostPlatform.isDarwin; # darwin sandbox limitations around network access, access to /etc/protocols and likely more checkFlags = let skippedTests = [ # network access "TestOctopusConfigParse" "TestTemplates" "TestOcpp" ]; in [ "-skip=^${lib.concatStringsSep "$|^" skippedTests}$" ]; passthru = { inherit decorate; tests = { inherit (nixosTests) evcc; }; updateScript = nix-update-script { }; }; meta = commonMeta // { description = "EV Charge Controller"; homepage = "https://evcc.io"; changelog = "https://github.com/evcc-io/evcc/releases/tag/${version}"; mainProgram = "evcc"; }; }