config/profiles/web/services/kukkee/pkg/default.nix

85 lines
2.0 KiB
Nix

# nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
{ lib
, stdenv
, pkgs
, fetchFromGitHub
, bash
, nodejs
, nodePackages
}:
let
nodeDependencies = (import ./node-composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
}).nodeDependencies.override (old: {
# access to path '/nix/store/...-source' is forbidden in restricted mode
#src = src;
#dontNpmInstall = true;
});
in stdenv.mkDerivation rec {
pname = "kukkee";
#version = "0.1.0";
version = "unstable-2022-06-19-270c8ed";
src = fetchFromGitHub {
owner = "AnandBaburajan";
repo = "Kukkee";
#rev = "v${version}";
rev = "270c8ed421c8f1100a845958430e1ebe61d86d5a";
sha256 = "CtbTKUZEPjwbLRYuC44JaeZn0Rjyn4h6tsBEWWQWJmA=";
};
buildInputs = [
nodeDependencies
];
buildPhase = ''
runHook preBuild
#export PATH="${nodeDependencies}/bin:${nodejs}/bin:$PATH"
ln -s ${nodeDependencies}/lib/node_modules .
next build
runHook postBuild
'';
installPhase = ''
runHook preInstall
# FIXME: is to possible for next.js to not run from a ".next" directory?
mkdir -p $out/share/kukkee
cp -a public .next $out/share/kukkee/
ln -s ${nodeDependencies}/lib/node_modules $out/share/kukkee/
# create next.js entrypoint
mkdir $out/bin
cat <<EOF > $out/bin/kukkee
#!${bash}/bin/bash
export PATH="${nodeDependencies}/bin:\$PATH"
exec -a kukkee next start $out/share/kukkee "\$@"
EOF
chmod +x $out/bin/kukkee
runHook postInstall
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Self-hosted Doodle alternative: a meeting poll tool.";
longDescription = ''
The free and open source meeting poll tool.
Never ask what time works for you all? again.
A self-hosted Doodle alternative.
'';
homepage = "https://kukkee.com/";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ pbsds ];
};
}