depot/third_party/nixpkgs/pkgs/servers/home-automation/evcc/default.nix
Default email 7e47f3658e Project import generated by Copybara.
GitOrigin-RevId: 1925c603f17fc89f4c8f6bf6f631a802ad85d784
2024-09-26 11:04:55 +00:00

95 lines
1.7 KiB
Nix

{ lib
, stdenv
, buildGo123Module
, fetchFromGitHub
, fetchNpmDeps
, cacert
, git
, go_1_23
, enumer
, mockgen
, nodejs
, npmHooks
, nix-update-script
, nixosTests
}:
buildGo123Module rec {
pname = "evcc";
version = "0.130.9";
src = fetchFromGitHub {
owner = "evcc-io";
repo = "evcc";
rev = version;
hash = "sha256-g3z2yqw/84OMui5mchfqVHoR/6LdwNHgeBodf1jUtj4=";
};
vendorHash = "sha256-C2eoNmv0GSi5DV53aUwGcBOw6n2btU/HhniMyu21vLE=";
npmDeps = fetchNpmDeps {
inherit src;
hash = "sha256-60F6j87T77JEt3ej4FVTc8rnnpZSGzomrQp8VPWjv6Q=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
overrideModAttrs = _: {
nativeBuildInputs = [
enumer
go_1_23
git
cacert
mockgen
];
preBuild = ''
make assets
'';
};
tags = [
"release"
"test"
];
ldflags = [
"-X github.com/evcc-io/evcc/server.Version=${version}"
"-X github.com/evcc-io/evcc/server.Commit=${src.rev}"
"-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"
];
in
[ "-skip=^${lib.concatStringsSep "$|^" skippedTests}$" ];
passthru = {
tests = {
inherit (nixosTests) evcc;
};
updateScript = nix-update-script { };
};
meta = with lib; {
description = "EV Charge Controller";
homepage = "https://evcc.io";
changelog = "https://github.com/evcc-io/evcc/releases/tag/${version}";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
};
}