push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
{
lib,
stdenv,
makeSetupHook,
fetchFromGitHub,
libelf,
which,
pkg-config,
libglut,
avrgcc,
avrlibc,
libGLU,
libGL,
}:
let
setupHookDarwin = makeSetupHook {
name = "darwin-avr-gcc-hook";
substitutions = {
darwinSuffixSalt = stdenv.cc.suffixSalt;
avrSuffixSalt = avrgcc.suffixSalt;
};
} ./setup-hook-darwin.sh;
in
stdenv.mkDerivation rec {
pname = "simavr";
version = "1.7";
src = fetchFromGitHub {
owner = "buserror";
repo = "simavr";
rev = "v${version}";
sha256 = "0njz03lkw5374x1lxrq08irz4b86lzj2hibx46ssp7zv712pq55q";
};
makeFlags = [
"DESTDIR=$(out)"
"PREFIX="
"AVR_ROOT=${avrlibc}/avr"
"SIMAVR_VERSION=${version}"
"AVR=avr-"
];
nativeBuildInputs = [
which
pkg-config
avrgcc
]
++ lib.optional stdenv.hostPlatform.isDarwin setupHookDarwin;
buildInputs = [
libelf
libglut
libGLU
libGL
];
# remove forbidden references to $TMPDIR
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$out"/bin/*
'';
doCheck = true;
checkTarget = "-C tests run_tests";
meta = with lib; {
description = "Lean and mean Atmel AVR simulator";
mainProgram = "simavr";
homepage = "https://github.com/buserror/simavr";
license = licenses.gpl3;
platforms = platforms.unix;
maintainers = with maintainers; [ goodrone ];
};
}

View File

@@ -0,0 +1,34 @@
fixupCFlagsForDarwin() {
# Because its getting called from a Darwin stdenv, avr-gcc will pick up on
# Darwin-specific flags, and it will barf and die on -iframework in
# particular. Strip them out, so simavr can compile its test firmware.
cflagsFilter='s|-F[^ ]*||g;s|-iframework [^ ]*||g;s|-isystem [^ ]*||g;s| *| |g'
# The `CoreFoundation` reference is added by `linkSystemCoreFoundationFramework` in the
# Apple SDKs setup hook. Remove that because avr-gcc will fail due to file not found.
ldFlagsFilter='s|/nix/store/[^-]*-apple-framework-CoreFoundation[^ ]*||g'
# `cc-wrapper.sh`` supports getting flags from a system-specific salt. While it is currently a
# tuple, thats not considered a stable interface, so the derivation will provide them.
export NIX_CFLAGS_COMPILE_@darwinSuffixSalt@=${NIX_CFLAGS_COMPILE-}
export NIX_LDFLAGS_@darwinSuffixSalt@=${NIX_LDFLAGS-}
echo removing @darwinSuffixSalt@-specific flags from NIX_CFLAGS_COMPILE for @avrSuffixSalt@
export NIX_CFLAGS_COMPILE_@avrSuffixSalt@+="$(sed "$cflagsFilter" <<< "$NIX_CFLAGS_COMPILE")"
echo removing @darwinSuffixSalt@-specific flags from NIX_LDFLAGS for @avrSuffixSalt@
export NIX_LDFLAGS_@avrSuffixSalt@+="$(sed "$ldFlagsFilter;$cflagsFilter" <<< "$NIX_LDFLAGS")"
# Make sure the global flags arent accidentally influencing the platform-specific flags.
export NIX_CFLAGS_COMPILE=""
export NIX_LDFLAGS=""
}
# This is pretty hacky, but this hook _must_ run after `linkSystemCoreFoundationFramework`.
function runFixupCFlagsForDarwinLast() {
preConfigureHooks+=(fixupCFlagsForDarwin)
}
if [ -z "${dontFixupCFlagsForDarwin-}" ]; then
postUnpackHooks+=(runFixupCFlagsForDarwinLast)
fi