From 21efe88b2283dcfc4825db2470cb009a0ea11eed Mon Sep 17 00:00:00 2001 From: techs-sus <92276908+techs-sus@users.noreply.github.com> Date: Mon, 24 Aug 2026 16:49:04 -0400 Subject: [PATCH] Add Nix development shell in flake and direnv support with 'use flake' (#58) Direnv allows the project environment to be automatically applied when the project is cd'd into. Other notable changes: - .gitignore: add .cache and .direnv generated by clangd and direnv respectively --- .envrc | 1 + .gitignore | 6 ++++++ flake.nix | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index f5fe5cc..8f8398f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,12 @@ Testing/ CMakeUserPresets.json *.cmake.user +# local direnv development shell cache +.direnv/ + +# clangd cache +.cache + *.o *.obj *.a diff --git a/flake.nix b/flake.nix index a54f6f4..2db4ed4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Description for the project"; + description = "Experimental Roblox compatibility runtime for Linux and FreeBSD"; inputs = { flake-parts.url = "github:hercules-ci/flake-parts"; @@ -23,8 +23,39 @@ pkgs, ... }: + let + package = pkgs.callPackage ./packaging/nix/package.nix { }; + in { - packages.default = pkgs.callPackage ./packaging/nix/package.nix { }; + packages.default = package; + devShells.default = pkgs.mkShell { + inputsFrom = [ package ]; + + # nixpkgs installs the header we need under include/libutf8proc + NIX_CFLAGS_COMPILE = "-I${pkgs.libutf8proc}/include/libutf8proc"; + + nativeBuildInputs = with pkgs; [ + cmake + git + lld + ninja + pkg-config + vulkan-headers + + llvmPackages_22.clang-tools + llvmPackages_22.libclang + + # debugging + gdb + ]; + + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath package.buildInputs}" + + # nix packages graphics drivers differently, and mocktail will still work if it cannot guarantee symbols + export MOCKTAIL_REQUIRE_REAL_GRAPHICS=0 + ''; + }; }; flake = { }; };