77 lines
2.5 KiB
Nix
77 lines
2.5 KiB
Nix
{
|
|
inputs.godotjs = {
|
|
url = "github:godotjs/GodotJS";
|
|
flake = false;
|
|
};
|
|
|
|
inputs.godot4-withmodules.url = "git+https://git.xnia.org/evar/nix-godot-with-modules.git?ref=main";
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
inputs.systems.url = "github:nix-systems/default";
|
|
inputs.flake-utils = {
|
|
url = "github:numtide/flake-utils";
|
|
inputs.systems.follows = "systems";
|
|
};
|
|
|
|
outputs =
|
|
{ self, nixpkgs, godot4-withmodules, godotjs, flake-utils, ... }:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system: let
|
|
# pkgs = nixpkgs.legacyPackages.${system};
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
in
|
|
{
|
|
packages.godot_4-js-unwrapped = (godot4-withmodules.packages.${system}.godot.withModules [
|
|
{ name = "GodotJS"; path = godotjs; }
|
|
])
|
|
# TODO: This isn't vary nix-native; this should really build a v8 drv from
|
|
# source from following the instructions here at https://github.com/godotjs/GodotJS/wiki/Building-from-Source
|
|
# but I don't really feel like it right now, so let's just use some prebuilt deps.
|
|
.overrideAttrs (prev: let
|
|
godotJSDeps = pkgs.fetchurl {
|
|
url = "https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_12.4.254.21_r13/v8_12.4.254.21_r13.zip";
|
|
hash = "sha256-v+0iW9kveu3tD/QFEX+wKhZ3vbmSTVVCErY1LYfW904=";
|
|
};
|
|
in {
|
|
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.p7zip ];
|
|
postPatch = prev.postPatch +
|
|
''
|
|
7z x -omodules/GodotJS ${godotJSDeps}
|
|
'';
|
|
});
|
|
|
|
packages.godot_4-js = let inherit (self.packages.${system}) godot_4-js-unwrapped; in pkgs.symlinkJoin rec {
|
|
inherit (godot_4-js-unwrapped) name version;
|
|
pname = "godot4-js";
|
|
paths = [ godot_4-js-unwrapped ];
|
|
postBuild = ''
|
|
mv $out/bin/${godot_4-js-unwrapped.pname} $out/bin/${pname}
|
|
'';
|
|
};
|
|
|
|
devShells = {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
self.packages.${system}.godot_4-js
|
|
|
|
just
|
|
pnpm
|
|
nodejs
|
|
|
|
typescript
|
|
typescript-language-server
|
|
|
|
vscodium-fhs
|
|
(vscode-with-extensions.override {
|
|
vscodeExtensions = with vscode-extensions; [
|
|
|
|
];
|
|
})
|
|
];
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|