-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
86 lines (77 loc) · 2.57 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
description = "A very basic flake";
inputs.nixpkgs.url = "nixpkgs/nixos-24.05";
outputs = { self, nixpkgs }: let
pkgs = nixpkgs.legacyPackages.x86_64-linux.buildPackages;
love_js =
pkgs.buildNpmPackage rec {
pname = "love.js";
version = "11.4.1w";
src = pkgs.fetchFromGitHub {
owner = "winny-"; # fork because broken package-lock.json
repo = pname;
# Upstream doesn't appear to tag their releases. So just trust me
# bro.
rev = "e11199bde1810426f3544379057ff73f0c5e0c8a";
hash = "sha256-uN1VyT8WHB7fCYfmS6PvL2QginzysYreI3JQxPLlNTg=";
};
dontNpmBuild = true;
npmDepsHash = "sha256-w5EN3qacmiASddaCCr2tDeJaG70R//Vi9eOHh7BUBdk=";
meta = with pkgs.lib; {
description = "Basically trying to adapt love.js to the latest and greatest versions of LÖVE and Emscripten.";
homepage = "https://github.com/Davidobot/love.js";
license = licenses.mit;
maintainers = with maintainers; [ winny ];
};
};
dot_love = pkgs.stdenv.mkDerivation {
pname = "super_rogue.love";
version = "0.0.1";
# Pull in the game src dir directly so valid builds don't invalidate on
# github actions edits.
src = ./src;
buildInputs = [ pkgs.zip ];
buildPhase = ''
zip -r super_rogue.love .
'';
installPhase = ''
mkdir -p $out/
cp super_rogue.love $out/
'';
};
web_src = pkgs.stdenv.mkDerivation {
pname = "super_rogue (web)";
version = "0.0.1";
src = ./.;
buildInputs = [ love_js ];
buildPhase = ''
echo Super Rogue | love.js -c ${dot_love}/super_rogue.love public
'';
installPhase = ''
cp -r public/ $out/
'';
};
love_src = pkgs.copyPathToStore ./src;
desktop = pkgs.writeShellScriptBin "super_rogue" ''
exec ${pkgs.love}/bin/love ${dot_love}/super_rogue.love
'';
# Probably better way to do this?
test = pkgs.writeShellScriptBin "super_rogue-test" ''
exec ${pkgs.love}/bin/love ${dot_love}/super_rogue.love --test --headless
'';
in {
packages.x86_64-linux.love_js = love_js;
ci.s5cmd = pkgs.s5cmd;
super_rogue = {
inherit dot_love;
inherit desktop;
inherit test;
web.src = web_src;
web.serve = pkgs.writeShellScriptBin "super_rogue" ''
echo Visit http://localhost:8080/
exec ${pkgs.busybox}/bin/busybox httpd -f -h ${web_src} -v -p 8080
'';
};
packages.x86_64-linux.default = web_src;
};
}