diff --git a/.github/workflows/build-nix-on-ubuntu.yml b/.github/workflows/build-nix-on-ubuntu.yml new file mode 100644 index 00000000..43dddfe4 --- /dev/null +++ b/.github/workflows/build-nix-on-ubuntu.yml @@ -0,0 +1,27 @@ +name: CMake Build (Nix on Ubuntu x86-64) + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/a127deeb889b111138f5152e54681577706ab741.tar.gz + # ^ this is also specified in the expression file, but I think using any other value here may cause superfluous downloads from the binary cache + - name: Grab dependencies and build # and move output to CWD + run: | + nix-build ./ci-build-drv.nix + cp -r "$(realpath "$PWD/result")/bin" ${{runner.workspace}} + - uses: actions/upload-artifact@v2 + with: + name: melonDS + path: ${{runner.workspace}}/bin diff --git a/ci-build-drv.nix b/ci-build-drv.nix new file mode 100644 index 00000000..69037150 --- /dev/null +++ b/ci-build-drv.nix @@ -0,0 +1,35 @@ +# mostly copied from nixpkgs: https://github.com/NixOS/nixpkgs/blob/a127deeb889b111138f5152e54681577706ab741/pkgs/misc/emulators/melonDS/default.nix +# grab updates from there (at master, maybe bump pinned nixpkgs too), though I don't expect any huge changes + +{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/a127deeb889b111138f5152e54681577706ab741.tar.gz") {} +, mkDerivation ? pkgs.stdenv.mkDerivation +, cmake ? pkgs.cmake +, pkg-config ? pkgs.pkg-config +, SDL2 ? pkgs.SDL2 +, qtbase ? pkgs.qt5.qtbase +, epoxy ? pkgs.epoxy +, libarchive ? pkgs.libarchive +, libpcap ? pkgs.libpcap +, libslirp ? pkgs.libslirp +, pcre ? pkgs.pcre +, wrapGAppsHook ? pkgs.wrapGAppsHook +}: + +mkDerivation { + name = "melonDS-git-ci"; + + src = builtins.path { path = ./.; name = "melonDS"; }; # use the directory this file is in (as opposed to downloading a source tarball) + + nativeBuildInputs = [ cmake pkg-config wrapGAppsHook ]; + buildInputs = [ + SDL2 + qtbase + epoxy + libarchive + libpcap + libslirp + pcre + ]; + + cmakeFlags = [ "-UUNIX_PORTABLE" ]; +}