Compare commits

...

2 Commits

Author SHA1 Message Date
Ashelyn Rose 37b2113c8c Remove setImmediate 9 months ago
Ashelyn Rose a2451e4184 Initial nix config 9 months ago

1
.gitignore vendored

@ -23,3 +23,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
dist/
/result

@ -0,0 +1,77 @@
{
"nodes": {
"nix-filter": {
"locked": {
"lastModified": 1681154353,
"narHash": "sha256-MCJ5FHOlbfQRFwN0brqPbCunLEVw05D/3sRVoNVt2tI=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "f529f42792ade8e32c4be274af6b6d60857fbee7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686547151,
"narHash": "sha256-lnu+ziAXNa3iiPtFVg9Ex7ZUcsYCb7zZVpv9OiB1iac=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4e3d46a3ea37d09c3d6dda557a0623c18ed58afe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

@ -0,0 +1,110 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/master";
nix-filter.url = "github:numtide/nix-filter";
};
outputs = {
self,
nixpkgs,
utils,
nix-filter,
}:
utils.lib.eachDefaultSystem
(system: let
pkgs = import nixpkgs {
inherit system;
};
filter = nix-filter.lib;
nodejs = pkgs.nodejs-18_x;
node_modules = pkgs.stdenv.mkDerivation {
name = "node_modules";
__noChroot = true;
src = filter {
root = ./.;
include = [
./package.json
./package-lock.json
];
};
configurePhase = ''
export HOME=$TMP
'';
buildInputs = [ nodejs ];
buildPhase = ''
${nodejs}/bin/npm ci
'';
installPhase = ''
mkdir $out
mv node_modules $out/node_modules
'';
};
in {
packages = {
default = pkgs.stdenv.mkDerivation {
name = "drowning";
src = filter {
root = ./.;
exclude = [
./node_modules
];
};
nativeBuildInputs = [ nodejs ];
configurePhase = ''
ln -sf ${node_modules}/node_modules node_modules
export HOME=$TMP
'';
buildPhase = ''npm run build'';
installPhase = ''
mkdir -p $out
mv dist/index.html $out/
mv dist/assets $out/
'';
};
};
}) // {
nixosModule = {config, lib, pkgs, ...}:
with lib;
let cfg = config.ashe.services.drowning;
pkg = self.packages.${pkgs.system}.default;
in {
options.ashe.services.drowning = {
enable = mkEnableOption "Enables the drowning site";
domain = mkOption rec {
type = types.str;
default = "drowning.ashen.earth";
example = default;
description = "The domain name to serve the Drowning Among Stars game at";
};
};
config = mkIf cfg.enable {
services.nginx.virtualHosts.${cfg.domain} = {
locations."/" = {
root = "${pkg}";
};
forceSSL = true;
enableACME = true;
};
};
};
};
}

@ -49,7 +49,7 @@ export default function Text({promptVisible: promptEnabled, handleCommand, showR
}
if(outputRef.current) {
setImmediate(() => outputRef.current.scrollTop = outputRef.current.scrollHeight)
setTimeout(() => outputRef.current.scrollTop = outputRef.current.scrollHeight, 0)
setCurrentScroll(outputRef.current.scrollHeight)
}
}
@ -100,7 +100,7 @@ export default function Text({promptVisible: promptEnabled, handleCommand, showR
// Scroll after unpaused
useEffect(() => {
setImmediate(() => outputRef.current.scrollTop = outputRef.current.scrollHeight)
setTimeout(() => outputRef.current.scrollTop = outputRef.current.scrollHeight, 0)
setCurrentScroll(outputRef.current.scrollHeight)
}, [currentPause])

@ -43,6 +43,6 @@ hints.set(Phase.returnedUpToBathroom, 'Someone locked the comms room locker. Th
hints.set(Phase.hasKey, `You've retrieved the spare key to the comms locker, and can finally get the capacitor to repair the mainframe.`)
hints.set(Phase.unlockedLocker, 'Locker is empty - whoever was in your ship made sure you wouldn\'t be able to repair it.')
setImmediate(() => {
setTimeout(() => {
game.createProperty('gamePhase', Phase.wakeUp)
})
}, 0)

@ -393,7 +393,7 @@ rules.onBeforeCommand(command => {
if(game.getProperty('gamePhase') === Phase.hasKey) {
renderer.endGame()
setImmediate(() => rules.emit('gameEnd'))
setTimeout(() => rules.emit('gameEnd'), 0)
throw new Error()
}

Loading…
Cancel
Save