Skip to content

Build ‐ Linux ‐ Nix

Parracodea edited this page Mar 23, 2024 · 1 revision

Be sure to check Build for generic instructions.

On Linux/NixOS

These instructions are for Linux NixOS or other Linux distributions with Nix installed.

Nix has EmptyEpsilon in NixPkgs as empty-epsilon so it can be installed simply with nix-env -i empty-epsilon or the like. But if it is out of date or you want to build a development version follow the instructions below.

  1. Navigate to where you want EmptyEpsilon:
cd ~/wherever
mkdir -p emptyepsilon
cd emptyepsilon
  1. Create a shell.nix file with the following content:
with import <nixpkgs> {};

runCommand "dummy" { 
    nativeBuildInputs = [ cmake ];
    buildInputs = [ sfml xorg.libX11 glew gcc git ]; 
    # `git` can be remove if you already have it on your system
    # and you run the git commands before you enter a pure shell.
} ""
  1. Enter a Nix Shell:
nix-shell --pure

The --pure is optional.

  1. Clone the the git sources:
git clone git@github.com:daid/SeriousProton.git
git clone git@github.com:daid/EmptyEpsilon.git

NOTE: If you're building a specific release of EmptyEpsilon, remember to checkout the correct tag in both repositories! See Build for details.

  1. Navigate to a build directory and make:
cd EmptyEpsilon
mkdir -p _build
cd _build
cmake .. -DSERIOUS_PROTON_DIR=$PWD/../../SeriousProton/ -DCPACK_PACKAGE_VERSION="2016.05.07" -DCPACK_PACKAGE_VERSION_MAJOR=2016 -DCPACK_PACKAGE_VERSION_MINOR=05 -DCPACK_PACKAGE_VERSION_PATCH=07
make
sudo make install

Be sure you change the version flags to the correct version, or remove them (cmake ..) if you are only developing and any other build you need to connect with was built the same day.

On macOS

The default NixPkgs empty-epsilon package does not support macOS:

error: Package ‘empty-epsilon-2020.03.22’ in /nix/store/bi74sn7bc7axaw7g940988s0n8asw2jm-nixpkgs-20.09pre219796.f601ab37c2f/nixpkgs/pkgs/games/empty-epsilon/default.nix:60 is not supported on ‘x86_64-darwin’, refusing to evaluate.

To build despite this error, follow the error message's instructions:

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.

~/.config/nixpkgs/ does not exist by default; create it first.

The build might still fail:

ld: framework not found Foundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/EmptyEpsilon.dir/build.make:4395: EmptyEpsilon.app/Contents/MacOS/EmptyEpsilon] Error 1
make[1]: *** [CMakeFiles/Makefile2:153: CMakeFiles/EmptyEpsilon.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
builder for '/nix/store/4lfl24ha2xz8iv1lyapkn6f0xxg5pp9w-empty-epsilon-2020.03.22.drv' failed with exit code 2
error: build of '/nix/store/4lfl24ha2xz8iv1lyapkn6f0xxg5pp9w-empty-epsilon-2020.03.22.drv' failed

Please contribute if you can resolve this issue and provide support for building with Nix in NixPkgs.

Clone this wiki locally