This commit is contained in:
Dario48 2026-05-23 14:41:33 +02:00
commit 85d45bf356
3 changed files with 126 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

78
flake.lock generated Normal file
View file

@ -0,0 +1,78 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1778716662,
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nesrx": {
"flake": false,
"locked": {
"lastModified": 1657372504,
"narHash": "sha256-Nnu+Jncw7k+7sE4AL9xjbm6dNVt8ZuKW/8tdKmm4G9Q=",
"owner": "xms0g",
"repo": "nesrx",
"rev": "573e008d84bb8b6b86e7f2111211175d01ea018c",
"type": "github"
},
"original": {
"owner": "xms0g",
"repo": "nesrx",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1779357205,
"narHash": "sha256-cCO8aTqss5x9Ky8GWkpY0Hy5fyTZEbtifSUV8QjSzic=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f83fc3c307e74bc5fd5adb7eb6b8b13ffd2a36e1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1777168982,
"narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nesrx": "nesrx",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

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
'';
};
};
};
}