-
Notifications
You must be signed in to change notification settings - Fork 81
Compiling in NixOS
Here are the instructions to build and run (in a very precarious way) Pharo on NixOS. The instructions probably also work for any Nix installation, but it has only been tested on NixOS.
The source files should not be directly downloaded from the git repository of Pharo, because they lack some generated artifacts required for bootstrapping. Instead, they should be downloaded here.
Since out-of-build sources is encouraged, we will assume that the directory containing the source code is
located at <source-directory>, and that the current directory in what follows is the build directory.
Write the following in flake.nix, in the build directory. This assumes that you have the experimental flakes
feature enabled. Read the Nix wiki page for more information.
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let
inherit (pkgs.stdenv) mkDerivation;
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.SDL2}/lib:${pkgs.libgit2}/lib:`pwd`/build/vm
'';
packages = with pkgs; [
cmake
gcc
gnumake
openssl
SDL2
libffi
libgit2
libuuid
];
};
});
}Run the following commands, in the build directory
$ nix develop
$ cmake -B . -S <directory-sources> -DGENERATE_SOURCES_DIR=<directory-sources> -DGENERATE_SOURCES=OFF
$ cmake --build . --target installIf you have some errors about an image format not being recognised, it's not important, you can ignore that.
To launch Pharo with this setup, you still need to be in the development shell used to the build. To do so, go in the build directory (it's important to be at the root of the build directory), then run
$ nix developWhile in this shell, the VM can be invoked with pharo. You are not required to be in the build directory for
this to work.
- Compiling and repo organization
- Participate!
- Misc