From 33aa7e5c92daffce2f09639eb57cb995754fbd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 2 Apr 2019 14:15:55 +0200 Subject: Migrate yarn2nix to external repository --- nixops/modules/websites/aten/aten.nix | 16 ++++++++++------ nixops/modules/websites/aten/default.nix | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'nixops/modules/websites') diff --git a/nixops/modules/websites/aten/aten.nix b/nixops/modules/websites/aten/aten.nix index b60b00a..d9286c3 100644 --- a/nixops/modules/websites/aten/aten.nix +++ b/nixops/modules/websites/aten/aten.nix @@ -1,4 +1,4 @@ -{ lib, writeText, fetchedGitPrivate, stdenv, composerEnv, fetchurl, fetchgit, python, nodejs, libsass, yarn2nix }: +{ lib, writeText, fetchedGitPrivate, stdenv, runCommand, composerEnv, fetchurl, fetchgit, jq, python, nodejs, libsass, yarn2nixPackage }: let aten = { config }: rec { environment = config.environment; @@ -91,10 +91,15 @@ let }; yarnModules = let info = fetchedGitPrivate ./aten.json; + packagejson = runCommand "package.json" { buildInputs = [ jq ]; } '' + cat ${info.src}/package.json | jq -r '.version = "v1.0.0"|.name="aten"' > $out + ''; in - yarn2nix.mkYarnModules { - name = "aten-yarn-modules"; - packageJSON = "${info.src}/package.json"; + yarn2nixPackage.mkYarnModules rec { + name = "aten-yarn"; + pname = name; + version = "v1.0.0"; + packageJSON = packagejson; yarnLock = "${info.src}/yarn.lock"; pkgConfig = { node-sass = { @@ -123,13 +128,12 @@ let export APP_SECRET="${config.secret}" ''; postInstall = '' - cd $out ln -sf ${yarnModules}/node_modules . yarn run --offline encore production rm -rf var/{log,cache} ln -sf ${varDir}/{log,cache} var/ ''; - buildInputs = [ yarnModules yarn2nix yarn2nix.yarn ]; + buildInputs = [ yarnModules yarn2nixPackage.yarn ]; }); webRoot = "${webappDir}/public"; }; diff --git a/nixops/modules/websites/aten/default.nix b/nixops/modules/websites/aten/default.nix index 41c22ce..51a36fb 100644 --- a/nixops/modules/websites/aten/default.nix +++ b/nixops/modules/websites/aten/default.nix @@ -1,6 +1,6 @@ { lib, pkgs, config, myconfig, mylibs, ... }: let - aten = pkgs.callPackage ./aten.nix { inherit (mylibs) fetchedGitPrivate; }; + aten = pkgs.callPackage ./aten.nix { inherit (mylibs) fetchedGitPrivate yarn2nixPackage; }; aten_dev = aten { config = myconfig.env.websites.aten.integration; }; -- cgit v1.2.3