nixpkgs/pkgs/by-name/ux/uxn/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

70 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchFromSourcehut
, SDL2
, unstableGitUpdater
}:
stdenv.mkDerivation (finalAttrs: {
pname = "uxn";
version = "1.0-unstable-2024-09-20";
src = fetchFromSourcehut {
owner = "~rabbits";
repo = "uxn";
rev = "f8c53f59b012dd56d44ae50cdf90dd1dad6cce23";
hash = "sha256-Ee4hN3OnqF/OhKieGtzT4XOhNJIhywCgP6Us0DZTVBI=";
};
outputs = [ "out" "projects" ];
nativeBuildInputs = [
SDL2
];
buildInputs = [
SDL2
];
strictDeps = true;
postPatch = ''
patchShebangs build.sh
substituteInPlace build.sh \
--replace "-L/usr/local/lib " ""
'';
buildPhase = ''
runHook preBuild
./build.sh --no-run
runHook postBuild
'';
# ./build.sh --install is meant to install in $HOME, therefore not useful for
# package maintainers
installPhase = ''
runHook preInstall
install -d $out/bin/
cp bin/uxnasm bin/uxncli bin/uxnemu $out/bin/
install -d $projects/share/uxn/
cp -r projects $projects/share/uxn/
runHook postInstall
'';
passthru.updateScript = unstableGitUpdater { };
meta = {
homepage = "https://wiki.xxiivv.com/site/uxn.html";
description = "Assembler and emulator for the Uxn stack machine";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ AndersonTorres ];
mainProgram = "uxnemu";
inherit (SDL2.meta) platforms;
broken = stdenv.hostPlatform.isDarwin;
};
})