chore(nix): switch to yarn2nix
This commit is contained in:
parent
a04ee45d78
commit
2fb8c6d42f
@ -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; })
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user