Skip to content

Instantly share code, notes, and snippets.

@idrisr
Created June 24, 2023 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idrisr/36575395f263c1e062185d4d2e5879ae to your computer and use it in GitHub Desktop.
Save idrisr/36575395f263c1e062185d4d2e5879ae to your computer and use it in GitHub Desktop.
{
inputs.nixpkgs.url = "nixpkgs";
description = "qemu rust game of life";
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
thing = with pkgs;
stdenv.mkDerivation rec {
name = "gameoflife";
src = fetchFromGitHub {
owner = "glitzflitz";
repo = "gameoflife";
rev = "ac17b5987f845f242bc7c9f8f4aea38e8a98f92f";
hash = "sha256-LVYlVwwAWPuKpNcYDmyStlctS/OUa6wIhPXrPzBlp6A=";
};
cargoHash = "sha256-yBoaLqynvYC9ebC0zjd2FmSSd53xzn4ralihtCFubAw=";
nativeBuildInputs = [ makeWrapper qemu ];
PATH = lib.makeBinPath nativeBuildInputs;
installPhase = ''
mkdir -p $out/bin
mv ./gameoflife.bin $out/bin
mv ./README.md $out/bin
mv ./run.sh $out/bin
wrapProgram $out/bin/run.sh \
--prefix PATH : ${lib.makeBinPath nativeBuildInputs}
'';
};
in {
apps.${system}.default = {
program = "${thing}/bin/run.sh";
type = "app";
};
packages.${system}.default = thing;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment