initial commit

This commit is contained in:
kolaente 2021-05-06 11:55:31 +02:00
commit f32cb421d5
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 91 additions and 0 deletions

81
default.nix Normal file
View File

@ -0,0 +1,81 @@
{ stdenv
, lib
, mkYarnPackage
, fetchgit
, python2
, pkg-config
, libsass
, nodejs
, yarn
}:
let
srcData = builtins.fromJSON (builtins.readFile ./src-frontend.json);
version = "unstable-" + builtins.head (lib.splitString "T" srcData.date);
src = fetchgit {
inherit (srcData) url rev sha256;
};
frontend-modules = mkYarnPackage rec {
name = "vikunja-frontend-modules";
inherit version src;
# cargo culted for node-sass
# https://github.com/input-output-hk/cardano-explorer/blob/7f28075951f248d2a5040dd30d8403f704474df6/nix/cardano-graphql/packages.nix
yarnPreBuild = ''
mkdir -p $HOME/.node-gyp/${nodejs.version}
echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
'';
pkgConfig = {
node-sass = {
buildInputs = [ python2 pkg-config libsass ];
# https://github.com/moretea/yarn2nix/issues/12#issuecomment-545084619
postInstall = ''
LIBSASS_EXT=auto yarn --offline run build
rm build/config.gypi
'';
};
};
preInstall = ''
# for some reason the two node_modules have non-overlapping contents
cp -r deps/vikunja-frontend/node_modules/* node_modules/
chmod -R a+w node_modules/
'';
doDist = false;
};
in stdenv.mkDerivation {
pname = "vikunja-desktop";
inherit version src;
nativeBuildInputs = [ frontend-modules yarn ];
buildPhase = ''
# Cannot use symlink or postcss-loader will crap out
cp -r ${frontend-modules}/libexec/vikunja-frontend/node_modules/ .
yarn --offline run build
sed -i 's/\/api\/v1//g' dist/index.html
'';
installPhase = ''
cp -r dist $out
'';
passthru = {
inherit frontend-modules;
};
meta = {
description = "Desktop version of the Vikunja to-do list app";
homepage = "https://vikunja.io/";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ kolaente ];
platforms = lib.platforms.all;
};
}

10
src-frontend.json Normal file
View File

@ -0,0 +1,10 @@
{
"url": "https://kolaente.dev/vikunja/frontend.git",
"rev": "fa4e53cf4a6aad708a8db6f01f063195c39c15c4",
"date": "2021-05-06T08:59:51+00:00",
"path": "/nix/store/0ysl6q05qnpqxxhh72swcwhrg3acmng0-frontend",
"sha256": "1my12qrgkqb9jqqc2dliw5cmjm6q5qkjn1lmhwbxg733ch7bnn4w",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}