Retro68/nix/samples.nix

50 lines
1.8 KiB
Nix
Raw Normal View History

2022-01-02 11:12:58 +00:00
pkgs: prevPkgs: {
retro68 = prevPkgs.retro68.overrideScope' (self: prevRetro: {
samples = with pkgs;
let
individualSamples = lib.mapAttrs (key: path:
stdenv.mkDerivation {
name = "retro68.samples." + key;
src = path;
nativeBuildInputs = [ buildPackages.ninja buildPackages.cmake ];
buildInputs = [ retro68.console ];
2022-01-03 18:22:37 +00:00
installPhase = ''
mkdir $out
cp *.bin $out/
rm -f $out/*.code.bin $out/*.rsrc.bin
2022-01-03 18:22:37 +00:00
'';
2022-01-02 11:12:58 +00:00
}) ({
dialog = ../Samples/Dialog;
helloworld = ../Samples/HelloWorld;
raytracer = ../Samples/Raytracer;
2022-01-03 18:22:37 +00:00
} // lib.optionalAttrs (targetPlatform.cmakeSystemName != "RetroCarbon") {
mpwtool = ../Samples/MPWTool;
2022-01-02 11:12:58 +00:00
wdef = ../Samples/WDEF;
} // lib.optionalAttrs (targetPlatform.cmakeSystemName != "Retro68") {
sharedlibrary = ../Samples/SharedLibrary;
} // lib.optionalAttrs (targetPlatform.cmakeSystemName == "Retro68") {
2022-01-03 18:22:37 +00:00
systemextension = ../Samples/SystemExtension;
2022-01-02 11:12:58 +00:00
launcher = ../Samples/Launcher;
}) // { launchapplserver = self.launchapplserver; };
2022-01-02 11:12:58 +00:00
in runCommand "retro68.samples" { } ''
2022-01-03 18:22:37 +00:00
mkdir -p $out/
2022-01-02 11:12:58 +00:00
${lib.concatMapStrings (x: ''
2022-01-03 18:22:37 +00:00
cp -r ${lib.escapeShellArg x}/*.bin $out/
2022-01-02 11:12:58 +00:00
'') (builtins.attrValues individualSamples)}
'' // individualSamples;
launchapplserver = with pkgs;
stdenvUniversal.mkDerivation {
name = "retro68.launchapplserver";
src = ../LaunchAPPL;
nativeBuildInputs = [ buildPackages.ninja buildPackages.cmake ];
installPhase = ''
mkdir $out
cp Server/*.bin $out/
rm $out/*.code.bin $out/*.rsrc.bin
2022-01-02 11:12:58 +00:00
'';
};
});
}