1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
{
lib,
stdenv,
buildGo124Module,
fetchFromGitHub,
fetchNpmDeps,
cacert,
git,
go_1_24,
gokrazy,
enumer,
mockgen,
nodejs,
npmHooks,
nix-update-script,
nixosTests,
}:
let
version = "0.207.2";
src = fetchFromGitHub {
owner = "evcc-io";
repo = "evcc";
tag = version;
hash = "sha256-bBW2HU2TijUC6pn3gH23JTTGy5BWSm+V6BBsiYqi6U0=";
};
vendorHash = "sha256-VITdJ23xrO346EOlNe5uoOKcsQ76x+Yb7Vhl0/H+WTI=";
commonMeta = with lib; {
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
};
decorate = buildGo124Module {
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
buildGo124Module rec {
pname = "evcc";
inherit version src vendorHash;
npmDeps = fetchNpmDeps {
inherit src;
hash = "sha256-GB57pXfWo1lduVDPPw7TBM8qgCmTxPDxKQyD4ZZJnjE=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
overrideModAttrs = _: {
nativeBuildInputs = [
decorate
enumer
go_1_24
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";
};
}
|