nesrx-flake/flake.nix
2026-05-23 14:49:35 +02:00

50 lines
1.5 KiB
Nix

{
description = "flake for github:xms0g/nesrx";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nesrx = {
url = "github:xms0g/nesrx";
flake = false;
};
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
systems = builtins.attrNames inputs.nixpkgs.legacyPackages;
perSystem =
{
config,
system,
pkgs,
...
}:
{
overlayAttrs = {
inherit (config.packages) nesrx;
};
packages.default = config.packages.nesrx;
packages.nesrx = pkgs.stdenv.mkDerivation {
name = "nesrx";
src = "${inputs.nesrx}";
nativeBuildInputs = with pkgs; [ cmake ];
cmakeBuildType = "RelWithDebInfo";
postPatch = ''
sed -i '1s|^|#include <cstring>\n|' src/main.cpp
substituteInPlace src/rom.hpp \
--replace 'm_romfile.open(filename,' 'm_romfile.open(std::string(filename),' \
--replace 'std::ofstream ofile{m_outfile,' 'std::ofstream ofile{std::string(m_outfile),'
'';
installPhase = ''
runHook preInstall
install -Dm755 nesrx $out/bin/nesrx
runHook postInstall
'';
};
};
};
}