Files
slopvivors/flake.nix

112 lines
2.8 KiB
Nix

{
description = "Survivor Slop game";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ self, nixpkgs }:
let
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems =
f:
nixpkgs.lib.genAttrs allSystems (
system:
f {
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
}
);
in
{
devShells = forAllSystems (
{ pkgs }:
{
default = pkgs.mkShell {
packages = with pkgs; [
godot
gdtoolkit_4
krita
gimp
pixelorama
aseprite
];
};
}
);
packages = forAllSystems (
{ pkgs }:
{
slopvivors = pkgs.stdenv.mkDerivation {
pname = "slopvivors";
version = "0.1.0";
src = ./.;
strictDeps = true;
nativeBuildInputs = with pkgs; [
godot
];
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
mkdir -p $HOME/.local/share/godot/
ln -s ${pkgs.godot.export-template}/share/godot/export_templates "$HOME/.local/share/godot/"
mkdir -p build
godot --headless --export-release Linux ./build/slopvivors
runHook postBuild
'';
installPhase = ''
find .
install -D -m 755 -t $out/libexec ./build/slopvivors
install -D -m 644 -t $out/libexec ./build/slopvivors.pck
install -d -m 755 $out/bin
ln -s $out/libexec/slopvivors $out/bin/slopvivors
'';
};
slopvivors_web_files = pkgs.stdenv.mkDerivation {
pname = "slopvivors-web-files";
version = "0.1.0";
src = ./.;
strictDeps = true;
nativeBuildInputs = with pkgs; [
godot
godot-export-templates-bin
];
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
mkdir -p $HOME/.local/share/godot/
ln -s ${pkgs.godot-export-templates-bin}/share/godot/export_templates "$HOME/.local/share/godot/"
mkdir -p build
godot --headless --export-release Web ./build/slopvivors
runHook postBuild
'';
installPhase = ''
mkdir -p "$out"
cp ./build/* "$out"
mv ./build/slopvivors "$out"/index.html
'';
};
}
);
};
}