mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-09 05:33:25 +00:00
e0464e4788
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" ```
81 lines
1.9 KiB
Nix
81 lines
1.9 KiB
Nix
{ lib
|
|
, stdenv
|
|
, alsa-lib
|
|
, fetchFromGitHub
|
|
, libGL
|
|
, libGLU
|
|
, libX11
|
|
, libXext
|
|
, makeBinaryWrapper
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "minimacy";
|
|
version = "1.2.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ambermind";
|
|
repo = pname;
|
|
rev = version;
|
|
hash = "sha256-uA+4dnhOnv7qRE7nqew8a14DGaQblsMY2uBZ+iyLtFU=";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
|
|
|
buildInputs = [ libGL libGLU ] ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib libX11 libXext ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
env.NIX_CFLAGS_COMPILE = "-Wno-unused-result";
|
|
|
|
preBuild = ''
|
|
pushd ${if stdenv.hostPlatform.isDarwin then "macos/cmdline" else "unix"}
|
|
'';
|
|
|
|
# TODO: build graphic version for darwin
|
|
buildFlags = (if stdenv.hostPlatform.isDarwin then [ "nox" ] else [ "all" ]) ++ [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
|
|
|
postBuild = ''
|
|
popd
|
|
'';
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
|
|
bin/${if stdenv.hostPlatform.isDarwin then "minimacyMac" else "minimacy"} system/demo/demo.fun.mandelbrot.mcy
|
|
|
|
runHook postCheck
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/lib/minimacy
|
|
cp -r {README.md,LICENSE,system,rom,topLevel.mcy} $out/lib/minimacy
|
|
install bin/minimacy* -Dt $out/bin
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
postFixup = ''
|
|
for prog in $out/bin/minimacy*;
|
|
do wrapProgram $prog \
|
|
--set MINIMACY $out/lib/minimacy
|
|
done
|
|
'';
|
|
|
|
meta = {
|
|
description = "Open-source minimalist computing technology";
|
|
longDescription = ''
|
|
Minimacy is an open-source minimalist computation system based on the principle "Less is more".
|
|
It is designed and programmed by Sylvain Huet.
|
|
'';
|
|
maintainers = with lib.maintainers; [ jboy ];
|
|
homepage = "https://minimacy.net";
|
|
license = lib.licenses.gpl2;
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
|
};
|
|
}
|