Add a Nix flake file
Build the frontend and cores with Nix. The trick is to prefetch the Git submodules, write a Nix description listing each submodule, and transform that into a set of packages.master
parent
e3b5eadb41
commit
7f84b6adc8
|
@ -1,3 +1,5 @@
|
|||
result
|
||||
result-*
|
||||
/build-*
|
||||
/out
|
||||
/.tup
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"url": "/home/repo/libretro-genode/cores/samples/upstream",
|
||||
"rev": "32aa98eeaad66cc3318d6e821a7a83de75603831",
|
||||
"date": "2019-03-29T12:09:35-04:00",
|
||||
"sha256": "0mp6ias7d03ajqaza50jy1lwnrv38m70ky0apg3mb5mwjcj8qils",
|
||||
"fetchSubmodules": true
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"inputs": {
|
||||
"genodepkgs": {
|
||||
"inputs": {
|
||||
"dhall-haskell": {
|
||||
"inputs": {
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-wJg4DA700SoQbEz61448sR6BgxRa1R92K3vvCV1g+HY=",
|
||||
"originalUrl": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148",
|
||||
"url": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148"
|
||||
},
|
||||
"nixpkgsStaticLinux": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-famU3pJZ4vkElV9qc71HmyRVSvcrAhfMZ0UJKpmmKP8=",
|
||||
"originalUrl": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working",
|
||||
"url": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working&rev=925aac04f4ca58aceb83beef18cb7dae0715421b"
|
||||
}
|
||||
},
|
||||
"narHash": "sha256-NGbS2bymVuCQcanlBO41I6ZjSAZSLXhACK3qQU25zUs=",
|
||||
"originalUrl": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake",
|
||||
"url": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake&rev=256810cd5adf1ae5862eed0ffdaab4cf49f6fe67"
|
||||
},
|
||||
"genode": {
|
||||
"inputs": {
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
|
||||
}
|
||||
},
|
||||
"narHash": "sha256-9/RR/CwvB1M2VSR7CrSVexYXN1YSSSE4WG4siDh0LE0=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode.git",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/genode.git?ref=master&rev=2a9178fced42cac986de07b6944afd4422d28976"
|
||||
},
|
||||
"genode-depot": {
|
||||
"inputs": {
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-Y5ZOTgInrYYoas3vM8uTPLA2DvFI9YoI6haftIKl9go=",
|
||||
"originalUrl": "nixpkgs",
|
||||
"url": "github:edolstra/nixpkgs/015c9ec3372e328ea6742b409a1e9aa26dab2b31"
|
||||
}
|
||||
},
|
||||
"narHash": "sha256-be9whulZ8unz1sq9PiFr+tuUAXlwiPEhIe0Z6jmfZiU=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode-depot.git",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/genode-depot.git?ref=master&rev=2f3162d88220bd6fa6b6fbc7c6d9fed68533a761"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
|
||||
}
|
||||
},
|
||||
"narHash": "sha256-aVnK41/uYBqDxNOZpaIwLICkrBp5qYN0gehqoOCpOcg=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genodepkgs?ref=flake",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/genodepkgs?ref=flake&rev=e92ee9b472fbc8238aa7b653eab28f50e46e0f25"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
description = "A flake for Genode Libretro packages";
|
||||
|
||||
edition = 201909;
|
||||
|
||||
inputs = {
|
||||
nixpkgs.uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode";
|
||||
genodepkgs.url = "git+https://gitea.c3d2.de/ehmry/genodepkgs?ref=flake";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, genodepkgs }:
|
||||
let
|
||||
submoduleList = import ./submodules.nix;
|
||||
|
||||
expandSubmodule = system: name:
|
||||
|
||||
let
|
||||
thisSystem = builtins.getAttr system;
|
||||
nixpkgs' = thisSystem nixpkgs.legacyPackages;
|
||||
genodepkgs' = thisSystem genodepkgs.packages;
|
||||
|
||||
libretroCommon = with builtins;
|
||||
let sm = getAttr "libretro-common" (listToAttrs submoduleList);
|
||||
in nixpkgs'.fetchgit {
|
||||
inherit (sm) url;
|
||||
inherit (sm.prefetch) rev sha256 fetchSubmodules;
|
||||
};
|
||||
|
||||
in { smPath, prefetch, url }:
|
||||
let
|
||||
|
||||
value = nixpkgs'.stdenv.mkDerivation {
|
||||
pname = name;
|
||||
version = "unstable";
|
||||
src = self;
|
||||
smSrc = nixpkgs'.fetchgit {
|
||||
inherit url;
|
||||
inherit (prefetch) rev sha256 fetchSubmodules;
|
||||
};
|
||||
|
||||
inherit libretroCommon smPath;
|
||||
|
||||
nativeBuildInputs = with nixpkgs'.buildPackages; [ tup pkgconfig ];
|
||||
|
||||
buildInputs = with genodepkgs'; [ base os libc stdcxx ];
|
||||
|
||||
configurePhase = ''
|
||||
find . -name Tupfile -delete
|
||||
mkdir -p libretro-common $smPath
|
||||
cp -r $libretroCommon/* libretro-common/
|
||||
cp -r $smSrc/* $smPath
|
||||
chmod -R +rwX libretro-common/* $smPath/
|
||||
tup init
|
||||
tup -d generate tup-builder.sh
|
||||
#echo builder generated
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out
|
||||
ln -s $out out
|
||||
pushd .
|
||||
set -v
|
||||
source tup-builder.sh
|
||||
set +v
|
||||
popd
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
|
||||
};
|
||||
in { inherit name value; };
|
||||
|
||||
expandPackagesList = system:
|
||||
map (sm: expandSubmodule system sm.name sm.value) submoduleList;
|
||||
|
||||
expandPackages = system: builtins.listToAttrs (expandPackagesList system);
|
||||
|
||||
systems = [ "x86_64-genode" ];
|
||||
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
||||
|
||||
in {
|
||||
packages = forAllSystems expandPackages;
|
||||
defaultPackage =
|
||||
forAllSystems (system: self.packages."${system}".retro_frontend);
|
||||
};
|
||||
}
|
|
@ -7,6 +7,7 @@ let readJSON = p: with builtins; fromJSON (readFile p); in [
|
|||
{ name = "mu"; value = { smPath = "cores/mu/upstream"; prefetch = readJSON ./cores/mu/upstream.json; url = "https://github.com/meepingsnesroms/Mu.git"; }; }
|
||||
{ name = "nxengine"; value = { smPath = "cores/nxengine/upstream"; prefetch = readJSON ./cores/nxengine/upstream.json; url = "https://github.com/libretro/nxengine-libretro.git"; }; }
|
||||
{ name = "oberon"; value = { smPath = "cores/oberon/upstream"; prefetch = readJSON ./cores/oberon/upstream.json; url = "https://github.com/ehmry/oberon-risc-emu.git"; }; }
|
||||
{ name = "samples"; value = { smPath = "cores/samples/upstream"; prefetch = readJSON ./cores/samples/upstream.json; url = "https://github.com/libretro/libretro-samples"; }; }
|
||||
{ name = "tyrquake"; value = { smPath = "cores/tyrquake/upstream"; prefetch = readJSON ./cores/tyrquake/upstream.json; url = "https://github.com/ehmry/tyrquake"; }; }
|
||||
{ name = "libretro-common"; value = { smPath = "libretro-common"; prefetch = readJSON ./libretro-common.json; url = "https://github.com/libretro/libretro-common.git"; }; }
|
||||
{ name = "retro_frontend"; value = { smPath = "retro_frontend"; prefetch = readJSON ./retro_frontend.json; url = "https://git.sr.ht/~ehmry/retro_frontend"; }; }
|
||||
|
|
Loading…
Reference in New Issue