feat: homebox
This commit is contained in:
parent
807b0fdb2a
commit
0daa9d00e4
BIN
.data/homebox.db
Normal file
BIN
.data/homebox.db
Normal file
Binary file not shown.
BIN
.data/homebox.db-shm
Normal file
BIN
.data/homebox.db-shm
Normal file
Binary file not shown.
BIN
.data/homebox.db-wal
Normal file
BIN
.data/homebox.db-wal
Normal file
Binary file not shown.
136
pkgs/homebox.nix
136
pkgs/homebox.nix
|
@ -1,34 +1,132 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
jq,
|
||||
moreutils,
|
||||
nodePackages,
|
||||
cacert,
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
buildNpmPackage rec {
|
||||
pname = "homebox-frontend";
|
||||
}: let
|
||||
pname = "homebox";
|
||||
version = "0.10.3";
|
||||
|
||||
src = "${fetchFromGitHub {
|
||||
owner = "hay-kot";
|
||||
repo = "homebox";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-nPMc7H8AcHnHGNn9g0xuI2TqMQPCmUBfqV/5KMdpxWU=";
|
||||
}}/frontend";
|
||||
hash = "sha256-Hej/dM0BgtRWiMOpp/SDVr3H1IbYb935T1pfX8apjpE=";
|
||||
# Inspired by: https://github.com/NixOS/nixpkgs/blob/f2d7a289c5a5ece8521dd082b81ac7e4a57c2c5c/pkgs/applications/graphics/pdfcpu/default.nix#L20-L32
|
||||
# The intention here is to write the information into files in the `src`'s
|
||||
# `$out`, and use them later in other phases (in this case `preBuild`).
|
||||
# In order to keep determinism, we also delete the `.git` directory
|
||||
# afterwards, imitating the default behavior of `leaveDotGit = false`.
|
||||
# More info about git log format can be found at `git-log(1)` manpage.
|
||||
leaveDotGit = true;
|
||||
postFetch = ''
|
||||
cd "$out"
|
||||
git log -1 --pretty=%H > "backend/COMMIT"
|
||||
git log -1 --pretty=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ' > "backend/SOURCE_DATE"
|
||||
rm -rf ".git"
|
||||
'';
|
||||
}}";
|
||||
|
||||
env.CYPRESS_INSTALL_BINARY = "0";
|
||||
npmDepsHash = "sha256-xnRBfVc/ZPRSDAe35hvXtrxnqv9/COuA0oV36n/sPTA=";
|
||||
frontend = stdenvNoCC.mkDerivation {
|
||||
pname = "${pname}-frontend";
|
||||
inherit version;
|
||||
|
||||
postPatch = ''
|
||||
ln -s ${./package-lock.json} package-lock.json
|
||||
'';
|
||||
src = "${src}/frontend";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
preBuild = ''
|
||||
export HOME=$(mktemp -d)
|
||||
export STORE_PATH=$(mktemp -d)
|
||||
|
||||
ls -la
|
||||
pnpm config set store-dir "${pnpm-deps}"
|
||||
pnpm install --offline --frozen-lockfile --shamefully-hoist
|
||||
patchShebangs node_modules/{*,.*}
|
||||
'';
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
meta = with lib; {
|
||||
pnpm build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
env.NUXT_TELEMETRY_DISABLED = 1;
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodePackages.pnpm
|
||||
#breakpointHook
|
||||
];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r .output/public/* $out/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
}
|
||||
pnpm-deps = stdenvNoCC.mkDerivation {
|
||||
pname = "${pname}-pnpm-deps";
|
||||
inherit version;
|
||||
src = "${src}/frontend";
|
||||
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
moreutils
|
||||
nodePackages.pnpm
|
||||
cacert
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
export HOME=$(mktemp -d)
|
||||
pnpm config set store-dir $out
|
||||
# This version of the package has different versions of esbuild as a dependency.
|
||||
# You can use the command below to get esbuild binaries for a specific platform and calculate hashes for that platforms. (linux, darwin for os, and x86, arm64, ia32 for cpu)
|
||||
# cat package.json | jq '.pnpm.supportedArchitectures += { "os": ["linux"], "cpu": ["arm64"] }' | sponge package.json
|
||||
pnpm install --frozen-lockfile --ignore-script
|
||||
|
||||
# Remove timestamp and sort the json files.
|
||||
rm -rf $out/v3/tmp
|
||||
for f in $(find $out -name "*.json"); do
|
||||
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
|
||||
jq --sort-keys . $f | sponge $f
|
||||
done
|
||||
'';
|
||||
|
||||
dontBuild = true;
|
||||
dontFixup = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-BVZSdc8e6v+paMzMYazEdnKSNw+OnCpjSzGSEKxVl24=";
|
||||
};
|
||||
in
|
||||
buildGoModule {
|
||||
inherit pname version;
|
||||
src = "${src}/backend";
|
||||
|
||||
vendorHash = "sha256-TtFz+dDpoMs3PAQjiYQm1+Q6prn4Hiaf7xqWt41oY7w=";
|
||||
|
||||
CGO_ENABLED = 0;
|
||||
GOOS = "linux";
|
||||
doCheck = false;
|
||||
|
||||
# options used by upstream:
|
||||
# https://github.com/simulot/immich-go/blob/0.13.2/.goreleaser.yaml
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-extldflags=-static"
|
||||
"-X main.version=${version}"
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
ldflags+=" -X main.commit=$(cat COMMIT)"
|
||||
ldflags+=" -X main.date=$(cat SOURCE_DATE)"
|
||||
mkdir -p ./app/api/static/public
|
||||
cp -r ${frontend}/* ./app/api/static/public
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
};
|
||||
}
|
||||
|
|
17038
pkgs/package-lock.json
generated
17038
pkgs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue