tinyemu/flake.nix

45 lines
1.2 KiB
Nix

# 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; [
openssl
gnumake
emscripten
];
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 $@; }
'';
};
};
}