Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix reproducible build environment #207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,38 @@ Same Steps 1-7 above<br/>
10. Choose "build > build Zelda3" in the menu to create `zelda3.exe` in the "/bin/release" subfolder<br/>
11. Configure with `zelda3.ini` in the main dir<br/>

## Compiling on Linux with Nix
1. Open a terminal
2. Clone the repo and `cd` into it
```sh
git clone https://github.com/snesrev/zelda3
cd zelda3
```
3. Place your US ROM file named `zelda3.sfc` in `zelda3/tables`
4. Enter the nix shell environment
```sh
nix-shell
```
5. Compile
```sh
make
```
6. Running the executable with the proper graphics driver
```sh
nixGL ./zelda3
```
<details>
<summary>
Advanced make usage ...
</summary>

```sh
make -j$(nproc) # run on all core
make clean all # clear gen+obj and rebuild
CC=clang make # specify compiler
```
</details>

## Installing libraries on Linux/MacOS
1. Open a terminal
2. Install pip if not already installed
Expand Down
47 changes: 47 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
with (import <nixpkgs> {});

let
nixgl = import (builtins.fetchTarball https://github.com/guibou/nixGL/archive/main.tar.gz) {};
my-py-pkgs = py-pkgs: with py-pkgs; [
pillow
pyyaml
];
py-packaged = python3.withPackages my-py-pkgs;
libPath = with pkgs; lib.makeLibraryPath [
libGL
xorg.libX11
xorg.libX11.dev
xorg.libXcursor
xorg.libXrender
xorg.libXfixes
xorg.libXi
xorg.libxcb
xorg.libXScrnSaver
xorg.libpthreadstubs
xorg.libXext
xorg.libXrandr
xorg.libXau
xorg.libXdmcp
libxkbcommon
];
in
mkShell {
buildInputs = [
py-packaged
SDL2
SDL2.dev
xorg.libX11
xorg.libX11.dev
xorg.libXcursor
xorg.libXScrnSaver
xorg.libXi
xorg.libXrandr
xorg.libxcb
libxkbcommon
libGL
gcc
nixgl.auto.nixGLDefault
];
LD_LIBRARY_PATH = libPath;
LDFLAGS = "-lpthread -lrt";
}