1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-10 23:00:39 +02:00

feat: update flake and add actual

This commit is contained in:
oddlama 2024-10-11 01:49:04 +02:00
parent 4cbbd2f871
commit f535c8d557
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
36 changed files with 845 additions and 208 deletions

92
pkgs/actual-server.nix Normal file
View file

@ -0,0 +1,92 @@
{
lib,
stdenv,
stdenvNoCC,
fetchFromGitHub,
makeWrapper,
cacert,
gitMinimal,
nodejs,
yarn,
}: let
version = "24.10.1";
src = fetchFromGitHub {
owner = "actualbudget";
repo = "actual-server";
rev = "v${version}";
hash = "sha256-VJAD+lNamwuYmiPJLXkum6piGi5zLOHBp8cUeZagb4s=";
};
# 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
];
SUPPORTED_ARCHITECTURES = builtins.toJSON {
os = ["darwin" "linux"];
cpu = ["arm" "arm64" "ia32" "x64"];
libc = ["glibc" "musl"];
};
buildPhase = ''
export HOME=$(mktemp -d)
yarn config set enableTelemetry 0
yarn config set cacheFolder $out
yarn config set --json supportedArchitectures "$SUPPORTED_ARCHITECTURES"
yarn
'';
installPhase = ''
mkdir -p $out
cp -r ./node_modules $out/node_modules
'';
dontFixup = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-eNpOS21pkamugoYVhzsEnstxeVN/J06yDZcshfr0Ek4=";
};
in
stdenv.mkDerivation {
pname = "actual-server";
inherit version src;
nativeBuildInputs = [
makeWrapper
yarn
];
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} "$out/bin/actual-server" \
--add-flags "$out/app.js" \
--chdir $out/lib/actual \
--set NODE_PATH "$out/node_modules"
runHook postInstall
'';
passthru = {
inherit offlineCache;
};
meta = with lib; {
description = "A super fast privacy-focused app for managing your finances";
homepage = "https://actualbudget.com/";
license = licenses.mit;
mainProgram = "actual-server";
maintainers = with maintainers; [patrickdag oddlama];
};
}

View file

@ -7,6 +7,7 @@ _inputs: [
awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix {};
segoe-ui-ttf = prev.callPackage ./segoe-ui-ttf.nix {};
zsh-histdb-skim = prev.callPackage ./zsh-skim-histdb.nix {};
actual-server = prev.callPackage ./actual-server.nix {};
neovim-clean = prev.neovim-unwrapped.overrideAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [prev.makeWrapper];
postInstall =