nixpkgs/pkgs/by-name/rv/rvvm/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

52 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, SDL2
, libX11
, libXext
, guiBackend ? "sdl"
, enableSDL ? guiBackend == "sdl"
, enableX11 ? guiBackend == "x11"
}:
assert lib.assertMsg (builtins.elem guiBackend ["sdl" "x11" "none"]) "Unsupported GUI backend";
assert lib.assertMsg (!(enableSDL && enableX11)) "RVVM can have only one GUI backend at a time";
assert lib.assertMsg (stdenv.hostPlatform.isDarwin -> !enableX11) "macOS supports only SDL GUI backend";
stdenv.mkDerivation rec {
pname = "rvvm";
version = "0.6";
src = fetchFromGitHub {
owner = "LekKit";
repo = "RVVM";
rev = "v${version}";
sha256 = "sha256-5nSlKyWDAx0EeKFzzwP5+99XuJz9BHXEF1WNkRMLa9U=";
};
buildInputs = []
++ lib.optionals enableSDL [ SDL2 ]
++ lib.optionals enableX11 [ libX11 libXext ];
enableParallelBuilding = true;
buildFlags = [ "all" "lib" ];
makeFlags = [ "PREFIX=$(out)" ]
++ lib.optional enableSDL "USE_SDL=2" # Use SDL2 instead of SDL1
++ lib.optional (!enableSDL && !enableX11) "USE_FB=0";
meta = with lib; {
homepage = "https://github.com/LekKit/RVVM";
description = "RISC-V Virtual Machine";
license = with licenses; [ gpl3 /* or */ mpl20 ];
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ kamillaova ];
mainProgram = "rvvm";
};
}