Fix nix flake and use gcc as compiler

This commit is contained in:
2026-07-26 19:04:49 +01:00
parent edad8ff5cd
commit 9f4c345c74
3 changed files with 36 additions and 45 deletions
+27 -36
View File
@@ -1,5 +1,5 @@
{
description = "game engine";
description = "Project Misth";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -10,15 +10,13 @@
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
staticPkgs = pkgs.pkgsStatic;
mruby = staticPkgs.stdenv.mkDerivation {
mruby = pkgs.stdenv.mkDerivation {
pname = "mruby";
version = "0.0.1";
src = staticPkgs.lib.cleanSourceWith {
src = pkgs.lib.cleanSourceWith {
src = ./libs;
name = "mruby-src";
};
@@ -30,7 +28,6 @@
nativeBuildInputs = with pkgs; [
ruby
gnumake
clang
];
buildPhase = ''
@@ -49,25 +46,24 @@
'';
};
game-engine = staticPkgs.stdenv.mkDerivation {
pname = "game-engine";
misth = pkgs.stdenv.mkDerivation {
pname = "misth";
version = "0.1.0";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
pkg-config
gnumake
bear
ccache
xxd
bash
];
buildInputs = [
pkgs.sdl3
pkgs.sdl3-ttf
pkgs.sdl3-image
buildInputs = with pkgs; [
sdl3
sdl3-ttf
sdl3-image
mruby
];
@@ -81,43 +77,38 @@
installPhase = ''
mkdir -p $out/bin
cp game-engine $out/bin/game-engine
cp bin/misth $out/bin/misth
'';
CC = "${pkgs.clang}/bin/clang";
CXX = "${pkgs.clang}/bin/clang++";
};
in
{
packages.${system} = {
default = game-engine;
game-engine = game-engine;
default = misth;
misth = misth;
mruby = mruby;
};
devShells.${system}.default = pkgs.mkShell {
inputsFrom = [ game-engine ];
inputsFrom = [ misth ];
packages = [
pkgs.clang-tools
pkgs.clang
pkgs.ccache
pkgs.pkg-config
pkgs.gnumake
pkgs.bear
pkgs.ruby
pkgs.xxd
packages = with pkgs; [
clang-tools
pkg-config
ccache
gnumake
bear
ruby
xxd
pkgs.sdl3
pkgs.sdl3-ttf
pkgs.sdl3-image
sdl3
sdl3-ttf
sdl3-image
];
shellHook = ''
export CC=clang
export CXX=clang++
export LD=clang
export CC="ccache gcc"
export CXX="ccache g++"
export MRBC=${mruby}/bin/mrbc
export MRUBY_INCLUDE=${mruby}/include