Files
project_misth/flake.nix
T
2026-07-26 19:59:10 +01:00

131 lines
2.4 KiB
Nix

{
description = "Project Misth";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
self.submodules = true;
};
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
mruby = pkgs.stdenv.mkDerivation {
pname = "mruby";
version = "0.0.1";
src = pkgs.lib.cleanSourceWith {
src = ./libs;
name = "mruby-src";
};
patches = [
./libs/changes.patch
];
nativeBuildInputs = with pkgs; [
ruby
gnumake
];
buildPhase = ''
cd mruby
rake
'';
installPhase = ''
mkdir -p $out
cp -r build/host/lib $out/lib
cp -r build/host/include $out/include
mkdir -p $out/bin
cp build/host/bin/mrbc $out/bin/mrbc
'';
};
misth = pkgs.stdenv.mkDerivation {
pname = "misth";
version = "0.1.0";
src = ./.;
nativeBuildInputs = with pkgs; [
pkg-config
gnumake
bear
xxd
bash
];
buildInputs = with pkgs; [
sdl3
sdl3-ttf
sdl3-image
mruby
];
buildPhase = ''
make \
MRBC=${mruby}/bin/mrbc \
MRUBY_INCLUDE=${mruby}/include \
MRUBY_LIB=${mruby}/lib/libmruby.a
'';
installPhase = ''
mkdir -p $out/bin
cp bin/misth $out/bin/misth
'';
};
pythonEnv = pkgs.python3.withPackages (
ps: with ps; [
pandas
matplotlib
]
);
in
{
packages.${system} = {
default = misth;
misth = misth;
mruby = mruby;
pythonEnv = pythonEnv;
};
devShells.${system}.default = pkgs.mkShell {
inputsFrom = [ misth ];
packages = with pkgs; [
clang-tools
pkg-config
ccache
gnumake
bear
ruby
xxd
sdl3
sdl3-ttf
sdl3-image
pythonEnv
ruff
];
shellHook = ''
export CC="ccache gcc"
export CXX="ccache g++"
export MRBC=${mruby}/bin/mrbc
export MRUBY_INCLUDE=${mruby}/include
export MRUBY_LIB=${mruby}/lib/libmruby.a
'';
};
};
}