tinyemu/flake.nix

51 lines
1.3 KiB
Nix
Raw Normal View History

# Template: https://nixos-and-flakes.thiscute.world/development/intro
{
description = "TinyEMU Nix Dev Shell (Flake-Based)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
};
outputs = {nixpkgs, ...}: let
# system should match the system you are running on
system = "x86_64-linux";
in {
devShells."${system}".default = let
pkgs = import nixpkgs {
inherit system;
};
in
pkgs.mkShell {
# Ref: https://github.com/NixOS/nixpkgs/issues/139943
# EM_CONFIG = pkgs.writeText ".emscripten" ''
# EMSCRIPTEN_ROOT = '${pkgs.emscripten}/share/emscripten'
# LLVM_ROOT = '${pkgs.emscripten.llvmEnv}/bin'
# BINARYEN_ROOT = '${pkgs.binaryen}'
# NODE_JS = '${pkgs.nodejs_24}/bin/node'
# CACHE = '${toString ./.cache}'
# '';
packages = with pkgs; [
# Compilation
2025-07-22 03:11:56 +10:00
gnumake
emscripten
# C Libraries
SDL # Simple DirectMedia Layer
curl
openssl
];
shell = "${pkgs.bash}/bin/bash";
shellHook = ''
export EM_CACHE=$PWD/.emscripten_cache
cp -r ${pkgs.emscripten}/share/emscripten/cache $EM_CACHE
chmod u+rwX -R $EM_CACHE
function makejs { make -f Makefile.js $@; }
'';
};
};
2025-07-22 02:58:29 +10:00
}