This commit is contained in:
Dario48 2026-05-23 14:41:33 +02:00
commit 85d45bf356

47
flake.nix Normal file
View file

@ -0,0 +1,47 @@
{
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 = [ ];
systems = builtins.attrNames inputs.nixpkgs.legacyPackages;
perSystem =
{
config,
system,
pkgs,
self',
...
}:
{
packages.default = 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
'';
};
};
};
}