Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antimatter-dimensions: init at 0-unstable-2024-05-11 #317242

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,11 @@
githubId = 858965;
name = "Andrew Morsillo";
};
amozeo = {
email = "[email protected]";
githubId = 37040543;
name = "Wroclaw";
};
amyipdev = {
email = "[email protected]";
github = "amyipdev";
Expand Down
14 changes: 14 additions & 0 deletions pkgs/by-name/an/antimatter-dimensions/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { app, BrowserWindow } = require('electron');
amozeo marked this conversation as resolved.
Show resolved Hide resolved

app.setName(process.env.ELECTRON_APP_NAME || 'Antimatter Dimensions');

app.whenReady().then(() => {
const mainWindow = new BrowserWindow({
autoHideMenuBar: true,
});
mainWindow.loadFile('index.html');
});

app.on('window-all-closed', () => {
app.quit();
});
82 changes: 82 additions & 0 deletions pkgs/by-name/an/antimatter-dimensions/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{ buildNpmPackage
, copyDesktopItems
, electron
, fetchFromGitHub
, lib
, makeDesktopItem
, unstableGitUpdater
, writeScriptBin
, electronAppName ? "Antimatter Dimensions"
}:

let
# build doesn't provide app.js, only index.html as entry point.
# app.js is used to change the directory where data is stored
# instead of default Electron. This workaround will be removed
# when this file will be available in upstream repository.
dummyElectronApp = ./app.js;
in
buildNpmPackage rec {
JohnRTitor marked this conversation as resolved.
Show resolved Hide resolved
pname = "antimatter-dimensions";
version = "0-unstable-2024-05-11";
src = fetchFromGitHub {
owner = "IvarK";
repo = "AntimatterDimensionsSourceCode";
rev = "b3a254af60207a03d04473bb81726e921f5b2c61";
hash = "sha256-+G9mNilt5Ewja5P+Bt312EcCJknMu7FOMn5b4FseAyQ=";
};
nativeBuildInputs = [
copyDesktopItems
# build script calls git to get git hash, message and author
# since fetchFromGitHub doesn't provide this information
# and in order to keep determinism (#8567), create a dummy git
(writeScriptBin "git" ''
echo "unknown"
'')
];

npmDepsHash = "sha256-aG+oysgitQvdFM0QyzJ3DBxsanBHYI+UPJPhj6bf00Q=";
npmFlags = [ "--legacy-peer-deps" ];
npmBuildScript = "build:release";

installPhase = ''
runHook preInstall

mkdir -p $out/share/antimatter-dimensions
cp -Tr dist $out/share/antimatter-dimensions
mkdir -p $out/share/icons/hicolor/256x256/apps
ln -rs $out/share/antimatter-dimensions/icon.png $out/share/icons/hicolor/256x256/apps/antimatter-dimensions.png
cp ${dummyElectronApp} $out/share/antimatter-dimensions/app.js

makeWrapper ${lib.getExe electron} $out/bin/antimatter-dimensions \
--add-flags $out/share/antimatter-dimensions/app.js \
--set ELECTRON_APP_NAME "${electronAppName}"

runHook postInstall
'';

desktopItems = [
(makeDesktopItem {
name = "antimatter-dimensions";
exec = "antimatter-dimensions";
icon = "antimatter-dimensions";
desktopName = electronAppName;
comment = meta.description;
categories = [ "Game" ];
terminal = false;
})
];

amozeo marked this conversation as resolved.
Show resolved Hide resolved
passthru.updateScript = unstableGitUpdater {
hardcodeZeroVersion = true;
};

meta = {
homepage = "https://github.com/IvarK/AntimatterDimensionsSourceCode";
description = "Idle incremental game with multiple prestige layers.";
license = lib.licenses.mit;
mainProgram = "antimatter-dimensions";
maintainers = with lib.maintainers; [ amozeo ];
inherit (electron.meta) platforms;
};
}