Skip to content

Commit

Permalink
actual-server: init at 24.12.0
Browse files Browse the repository at this point in the history
Co-authored-by: PatrickDaG <[email protected]>
  • Loading branch information
oddlama and PatrickDaG committed Dec 14, 2024
1 parent 5505316 commit 1bbfa98
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions pkgs/by-name/ac/actual-server/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
lib,
stdenv,
stdenvNoCC,
fetchFromGitHub,
makeWrapper,
cacert,
gitMinimal,
nodejs_18,
yarn,
nixosTests,
nix-update-script,
}:
let
version = "24.12.0";
src = fetchFromGitHub {
owner = "actualbudget";
repo = "actual-server";
rev = "v${version}";
hash = "sha256-qCATfpYjDlR2LaalkF0/b5tD4HDE4aNDrLvTC4g0ctY=";
};

yarn_18 = yarn.override { nodejs = nodejs_18; };

# We cannot use fetchYarnDeps because that doesn't support yarn2/berry
# lockfiles (see https://github.com/NixOS/nixpkgs/issues/254369)
offlineCache = stdenvNoCC.mkDerivation {
name = "actual-server-${version}-offline-cache";
inherit src;

nativeBuildInputs = [
cacert # needed for git
gitMinimal # needed to download git dependencies
yarn_18
];

SUPPORTED_ARCHITECTURES = builtins.toJSON {
os = [
"darwin"
"linux"
];
cpu = [
"arm"
"arm64"
"ia32"
"x64"
];
libc = [
"glibc"
"musl"
];
};

buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
yarn config set enableTelemetry 0
yarn config set cacheFolder $out
yarn config set --json supportedArchitectures "$SUPPORTED_ARCHITECTURES"
yarn
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out
cp -r ./node_modules $out/node_modules
runHook postInstall
'';
dontFixup = true;

outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-W9cQVsceNcHNBPPlkqN9tkGQYhgwwZQwKLUAoMgNbeo=";
};
in
stdenv.mkDerivation {
pname = "actual-server";
inherit version src;

nativeBuildInputs = [
makeWrapper
yarn_18
];

installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib,lib/actual}
cp -r ${offlineCache}/node_modules/ $out/lib/actual
cp -r ./ $out/lib/actual
makeWrapper ${lib.getExe nodejs_18} "$out/bin/actual-server" \
--add-flags "$out/lib/actual/app.js" \
--set NODE_PATH "$out/node_modules"
runHook postInstall
'';

passthru = {
inherit offlineCache;
tests = nixosTests.actual;
passthru.updateScript = nix-update-script { };
};

meta = {
changelog = "https://actualbudget.org/docs/releases";
description = "Super fast privacy-focused app for managing your finances";
homepage = "https://actualbudget.org/";
mainProgram = "actual-server";
license = lib.licenses.mit;
maintainers = [
lib.maintainers.oddlama
lib.maintainers.patrickdag
];
};
}

0 comments on commit 1bbfa98

Please sign in to comment.