-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(web): switch to napalm from yarn2nix
These days, support for npm's package-lock.json seems to besser than for yarn, so let's drop yarn2nix which is not quite where it needs to be yet (we pinned an experimental branch after all) and use napalm instead. For this we have to migrate from yarn to npm completely. Using npmlock2nix would be preferrable (as it doesn't require building a Haskell registry server), but there we end up running into an unsolved issue [1]. [1]: svanderburg/node2nix#106
- Loading branch information
1 parent
caadef5
commit c3b4186
Showing
7 changed files
with
235 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
let | ||
napalmSrc = builtins.fetchTarball { | ||
url = "https://github.com/nix-community/napalm/archive/master.tar.gz"; | ||
}; | ||
in | ||
|
||
import ./pkgs.nix { inherit pkgs; } | ||
{ pkgs ? import <nixpkgs> {} | ||
, napalm ? pkgs.callPackage napalmSrc {} | ||
}: | ||
|
||
import ./pkgs.nix { inherit pkgs napalm; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,30 @@ | ||
{ stdenv, lib, fetchFromGitHub, callPackage, esbuild }: | ||
{ stdenv, lib, esbuild, napalm, nix-gitignore }: | ||
|
||
let | ||
pkgInfo = lib.importJSON ./package.json; | ||
src = yarn2nix-lib.removePrefixes [ "node_modules" "dist" ] ./.; | ||
# yarn2nixSrc = /home/lukas/src/nix/yarn2nix; | ||
yarn2nixSrc = fetchFromGitHub { | ||
owner = "sternenseemann"; | ||
repo = "yarn2nix"; | ||
rev = "b0825bbe4b40f39763d53ba0044431a44b5f25cf"; | ||
sha256 = "1q8wc5rnb00xwzcqsgb6wfkmymipf2bv1g2i33l5wyadp0hd18cp"; | ||
src = builtins.path { | ||
name = "likely-music-frontend-source"; | ||
path = ./.; | ||
filter = nix-gitignore.gitignoreFilter (builtins.readFile ../.gitignore) ./..; | ||
}; | ||
yarn2nix = import yarn2nixSrc { }; | ||
yarn2nix-lib = yarn2nix.nixLib; | ||
deps = yarn2nix-lib.callYarnLock ./yarn.lock { }; | ||
template = yarn2nix-lib.callPackageJson ./package.json { }; | ||
calledTemplate = template (yarn2nix-lib.buildNodeDeps deps); | ||
node_modules = yarn2nix-lib.linkNodeDeps { | ||
inherit (pkgInfo) name; | ||
dependencies = calledTemplate.nodeBuildInputs; | ||
}; | ||
|
||
in | ||
|
||
stdenv.mkDerivation rec { | ||
pname = pkgInfo.name; | ||
inherit (pkgInfo) version; | ||
inherit src; | ||
|
||
nativeBuildInputs = [ esbuild ]; | ||
|
||
makeFlags = [ | ||
"OFFLINE=true" | ||
napalm.buildPackage src { | ||
nativeBuildInputs = [ | ||
esbuild | ||
]; | ||
|
||
NODE_PATH = node_modules; | ||
preBuild = '' | ||
ln -s ${node_modules} node_modules | ||
''; | ||
npmCommands = "make"; | ||
|
||
installPhase = '' | ||
mkdir -p $out/share/ | ||
mv dist $out/share/${pname} | ||
runHook preInstall | ||
mkdir -p $out/share | ||
mv dist $out/share/likely-music-frontend | ||
runHook postInstall | ||
''; | ||
|
||
meta = calledTemplate.meta // { | ||
meta = { | ||
description = "Frontend of likely music, a probabilistic music notation software"; | ||
homepage = "https://github.com/sternenseemann/likely-music"; | ||
license = lib.licenses.agpl3Only; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.