chore(nix): switch to yarn2nix

This commit is contained in:
Sarah Vaupel 2024-01-14 17:04:13 +01:00
parent a04ee45d78
commit 2fb8c6d42f
5 changed files with 9666 additions and 6 deletions

View File

@ -126,7 +126,7 @@
};
})
(import ./nix/maildev)
# (import ./nix/maildev)
haskell-nix.overlay
(import ./nix/uniworx { inherit inputs frontendSource backendSource; gitRevision = if self ? rev then self.rev else null; })
(import ./nix/docker { inherit self; })

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-2023 Gregor Kleen <gregor@kleen.consulting>, Steffen Jost <jost@cip.ifi.lmu.de>
# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor@kleen.consulting>, Steffen Jost <jost@cip.ifi.lmu.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

View File

@ -1,20 +1,36 @@
# SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>
# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ frontendSource, ... }: final: prev:
let
pname = "uniworx-frontend";
# extract the version from package.json (ensuring these never get out of sync)
version = (builtins.fromJSON (builtins.readFile ./../../package.json)).version;
# grab our dependencies
deps = prev.mkYarnModules {
inherit pname version;
packageJSON = ./../../package.json;
yarnLock = ./../../yarn.lock;
yarnNix = ./../../yarn.nix;
};
setupNodeDeps = ''
ln -s ${final.uniworxNodeDependencies}/lib/node_modules ./node_modules
export PATH="${final.uniworxNodeDependencies}/bin:$PATH"
'';
in {
uniworxFrontend = prev.stdenv.mkDerivation {
name = "uniworx-frontend";
inherit pname version;
srcs = [frontendSource prev.uniworxWellKnown];
sourceRoot = "source";
phases = ["unpackPhase" "checkPhase" "buildPhase" "installPhase"];
phases = ["unpackPhase" "configurePhase" "checkPhase" "buildPhase" "installPhase"];
# No build dependencies, all work has been done for you already by mkYarnModules
nativeBuildInputs = [ ];
buildInputs = [ ];
postUnpack = ''
${final.xorg.lndir}/bin/lndir -silent ../uniworx-well-known $sourceRoot
@ -29,6 +45,12 @@ in {
runHook postBuild
'';
# Grab the dependencies from the above mkYarnModules derivation
configurePhase = ''
mkdir -p $out/bin
ln -s ${deps}/node_modules $out
'';
preCheck = ''
${setupNodeDeps}
export FONTCONFIG_FILE="${final.fontconfig.out}/etc/fonts/fonts.conf"
@ -58,5 +80,8 @@ in {
( ${oldAttrs.checkPhase} ) | tee $out/test-stdout
'';
});
# Skip the unpack step (mkDerivation will complain otherwise)
dontUnpack = true;
};
}

View File

@ -3,5 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
{ ... }: final: prev: {
uniworxNodeDependencies = (prev.callPackage ../frontend {}).nodeDependencies;
uniworxNodeDependencies = pkgs.mkYarnModules {
pname = "uniworx-node-dependencies";
version = (builtins.fromJSON (builtins.readFile ./../../package.json)).version;
packageJSON = ../../package.json;
yarnLock = ../../yarn.lock;
yarnNix = ../../yarn.nix;
};
}

9629
yarn.nix Normal file

File diff suppressed because it is too large Load Diff