nix/pkgs/baserow: make it configurably OSS-only
This commit is contained in:
parent
9d983e7831
commit
68e623d2eb
1 changed files with 26 additions and 15 deletions
|
@ -1,19 +1,30 @@
|
||||||
{ fetchFromGitLab
|
{ fetchFromGitLab
|
||||||
, pkgs
|
, pkgs
|
||||||
|
, lib
|
||||||
, stdenv
|
, stdenv
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, python3
|
, python3
|
||||||
, nodejs-12_x
|
, nodejs-12_x
|
||||||
|
, ossOnly ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "1.7.1";
|
version = "1.7.1";
|
||||||
src = fetchFromGitLab {
|
suffix = lib.optionalString ossOnly "-oss";
|
||||||
|
src' = fetchFromGitLab {
|
||||||
owner = "bramw";
|
owner = "bramw";
|
||||||
repo = "baserow";
|
repo = "baserow";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "0jcisfhksrins33whwq46zg4r1101xvs2r0kcf1552x39r911gdg";
|
sha256 = "0jcisfhksrins33whwq46zg4r1101xvs2r0kcf1552x39r911gdg";
|
||||||
};
|
};
|
||||||
|
src = if ossOnly then pkgs.runCommand "${src'.name}${suffix}" {} ''
|
||||||
|
cp -R ${src'} $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
rm -rf $out/premium
|
||||||
|
|
||||||
|
sed -i '/baserow_premium/d' $out/backend/src/baserow/config/settings/base.py
|
||||||
|
sed -i '/premium/d' $out/web-frontend/config/nuxt.config.base.js
|
||||||
|
'' else src';
|
||||||
web-frontend-deps = import ./web-frontend {
|
web-frontend-deps = import ./web-frontend {
|
||||||
inherit pkgs nodejs;
|
inherit pkgs nodejs;
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
|
@ -30,29 +41,27 @@ let
|
||||||
let
|
let
|
||||||
oss = import ./backend/pynixify/overlay.nix self super;
|
oss = import ./backend/pynixify/overlay.nix self super;
|
||||||
premium = import ./premium-backend/pynixify/overlay.nix self super;
|
premium = import ./premium-backend/pynixify/overlay.nix self super;
|
||||||
|
baserow-premium-backend = premium.baserow-premium-backend.overridePythonAttrs (_: {
|
||||||
|
src = "${src}/premium/backend";
|
||||||
|
});
|
||||||
in
|
in
|
||||||
oss // premium // (rec {
|
oss // (if !ossOnly then premium else {}) // {
|
||||||
baserow-backend = oss.baserow-backend.overridePythonAttrs (oldAttrs: {
|
baserow-backend = oss.baserow-backend.overridePythonAttrs (oldAttrs: {
|
||||||
src = "${src}/backend";
|
src = "${src}/backend";
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
# Yeet. Just assume everything is installed in the environment already.
|
# Yeet. Just assume everything is installed in the environment already.
|
||||||
> requirements/base.txt
|
> requirements/base.txt
|
||||||
'';
|
'';
|
||||||
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
|
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ lib.optional (!ossOnly) baserow-premium-backend;
|
||||||
baserow-premium-backend
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
baserow-premium-backend = premium.baserow-premium-backend.overridePythonAttrs (_: {
|
} // (if !ossOnly then { inherit baserow-premium-backend; } else {});
|
||||||
src = "${src}/premium/backend";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit src web-frontend-deps mjml-tcpserver-deps;
|
inherit src web-frontend-deps mjml-tcpserver-deps;
|
||||||
|
|
||||||
web-frontend = stdenv.mkDerivation {
|
web-frontend = stdenv.mkDerivation {
|
||||||
name = "baserow-web-frontend";
|
name = "baserow${suffix}-web-frontend";
|
||||||
inherit src version;
|
inherit src version;
|
||||||
buildInputs = [ nodejs ];
|
buildInputs = [ nodejs ];
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
@ -61,9 +70,13 @@ in
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
outpath="$out/share/baserow"
|
outpath="$out/share/baserow"
|
||||||
mkdir -p $outpath $outpath/premium
|
mkdir -p $outpath
|
||||||
cp -R web-frontend $outpath/web-frontend
|
cp -R web-frontend $outpath/web-frontend
|
||||||
cp -R premium/web-frontend $outpath/premium/web-frontend
|
|
||||||
|
${lib.optionalString (!ossOnly) ''
|
||||||
|
mkdir -p $outpath/premium
|
||||||
|
cp -R premium/web-frontend $outpath/premium/web-frontend
|
||||||
|
''}
|
||||||
|
|
||||||
# Disable prompts
|
# Disable prompts
|
||||||
export MINIMAL=true
|
export MINIMAL=true
|
||||||
|
@ -109,9 +122,7 @@ in
|
||||||
install -m 0755 ${./backend/gunicorn.py} $out/bin/baserow-gunicorn
|
install -m 0755 ${./backend/gunicorn.py} $out/bin/baserow-gunicorn
|
||||||
install -m 0755 ${./backend/celery.py} $out/bin/baserow-celery
|
install -m 0755 ${./backend/celery.py} $out/bin/baserow-celery
|
||||||
'';
|
'';
|
||||||
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ (with python.pkgs; [
|
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ (with python.pkgs; lib.optional (!ossOnly) baserow-premium-backend);
|
||||||
baserow-premium-backend
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mjml-tcpserver = stdenv.mkDerivation {
|
mjml-tcpserver = stdenv.mkDerivation {
|
||||||
|
|
Loading…
Reference in a new issue