Skip to content
Open
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
20 changes: 4 additions & 16 deletions nix/npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "tweag",
"owner": "nix-community",
"repo": "npmlock2nix"
},
"branch": "master",
"revision": "5c4f247688fc91d665df65f71c81e0726621aaa8",
"url": "https://github.com/tweag/npmlock2nix/archive/5c4f247688fc91d665df65f71c81e0726621aaa8.tar.gz",
"hash": "1zkrcph1vqgl0q7yi9cg0ghq1mmvhy8rlc6xvyww56i3j87cg5gn"
"revision": "330f8d574ab58cb6413141aa62bab3330871a365",
"url": "https://github.com/nix-community/npmlock2nix/archive/330f8d574ab58cb6413141aa62bab3330871a365.tar.gz",
"hash": "118qz5idib8vxvx575xd2dv1jmc7mpj2lz2zwgc8qihpxksg533h"
},
"photoprism": {
"type": "Git",
Expand Down Expand Up @@ -386,18 +386,6 @@
"url": null,
"hash": "18z5ww9lp2r93bq2pkzn0knhyc392szqv166yx8r4qv4y4is3b38"
},
"ranz2nix": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "andir",
"repo": "ranz2nix"
},
"branch": "master",
"revision": "637276c3110716d2a798e737fe62e54b37190d50",
"url": "https://github.com/andir/ranz2nix/archive/637276c3110716d2a798e737fe62e54b37190d50.tar.gz",
"hash": "0jaxw74srgabzz5sawy6nv27rpghmwxw53m5csnrhgy39a9yaki4"
},
"streetmerchant": {
"type": "Git",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion nix/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ self: super: {

photoprism = self.callPackage ./photoprism {
src = sources.photoprism;
ranz2nix = sources.ranz2nix;
npmlock2nix = (import sources.npmlock2nix { pkgs = unstable; });
# buildGo118Module = self.bui
## let
## go_1_18 = self.callPackage (unstable.path + "/pkgs/development/compilers/go/1.18.nix") {
Expand Down
59 changes: 12 additions & 47 deletions nix/packages/photoprism/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ src
, ranz2nix
, npmlock2nix
, coreutils
, stdenv
, fetchurl
Expand All @@ -11,7 +11,7 @@
, callPackage
}:
buildGo118Module {
name = "photoprism-go";
name = "photoprism";
inherit src;

subPackages = [ "cmd/photoprism" ];
Expand All @@ -30,7 +30,7 @@ buildGo118Module {
prePatch = ''
substituteInPlace internal/commands/passwd.go --replace '/bin/stty' "${coreutils}/bin/stty"
'';
vendorSha256 = "1y8vbj4nkm99qdpdm2pj25wb65416jm4cwqsp0hrjpfis1b105pl";
vendorSha256 = "1cvwhgqy49pxxypywg9gnjvisnb0dqjmzpi1nywh9afj13aivmvq";

# https://github.com/mattn/go-sqlite3/issues/803
CGO_CFLAGS = "-Wno-return-local-addr";
Expand All @@ -41,50 +41,15 @@ buildGo118Module {


passthru = rec {

frontend =
let
noderanz = callPackage ranz2nix {
nodejs = nodejs-14_x;
sourcePath = src + "/frontend";
packageOverride = name: spec:
if name == "minimist" && spec ? resolved && spec.resolved == "" && spec.version == "1.2.0" then {
resolved = "file://" + (
toString (
fetchurl {
url = "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz";
sha256 = "0w7jll4vlqphxgk9qjbdjh3ni18lkrlfaqgsm7p14xl3f7ghn3gc";
}
)
);
} else { };
};
node_modules = noderanz.patchedBuild;
in
stdenv.mkDerivation {
name = "photoprism-frontend";
nativeBuildInputs = [ nodejs-14_x ];

inherit src;

sourceRoot = "source/frontend";

postUnpack = ''
chmod -R +rw .
'';

NODE_ENV = "production";

buildPhase = ''
export HOME=$(mktemp -d)
ln -sf ${node_modules}/node_modules node_modules
ln -sf ${node_modules.lockFile} package-lock.json
npm run build
'';
installPhase = ''
cp -rv ../assets/static/build $out
'';
};
frontend = npmlock2nix.v2.build {
src = src + "/frontend";
buildCommands = [
"HOME=$(mktemp -d) npm run build"
];
installPhase = ''
cp -rv ../assets/static/build $out
'';
};

assets =
let
Expand Down