commit 85d45bf35658f76d4841952912cbe667147224e2 Author: Dario48 Date: Sat May 23 14:41:33 2026 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3a43f44 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..46c08a7 --- /dev/null +++ b/flake.nix @@ -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 \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 + ''; + }; + }; + }; +}