mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-22 20:14:37 +00:00

In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
96 lines
1.7 KiB
Nix
96 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 ];
|
|
};
|
|
}
|