Created
January 8, 2021 13:35
-
-
Save sorki/e23c3462f60e0b6a1eaa7d9fc3ac5480 to your computer and use it in GitHub Desktop.
callNode2nix.nix
This file contains hidden or 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
{ pkgs ? import <nixpkgs> {}, ... }: | |
# experiment based on https://github.com/MatrixAI/TypeScript-Demo-Lib/pull/13 | |
# needs `--option sandbox false` so not used for now | |
with pkgs; | |
let | |
callNode2nix = name: src: { nodeVersion ? builtins.elemAt (lib.versions.splitVersion nodejs.version) 0 }: | |
let | |
drv = runCommandNoCC "node2nix-${name}" { buildInputs = [ pkgs.git ]; } '' | |
mkdir $out | |
${nodePackages.node2nix}/bin/node2nix \ | |
--development \ | |
--input ${src}/package.json \ | |
--lock ${src}/package-lock.json \ | |
--node-env $out/node-env.nix \ | |
--output $out/node-packages.nix \ | |
--composition $out/default.nix \ | |
--nodejs-${nodeVersion} | |
''; | |
in (import drv { inherit pkgs nodejs; }).package; | |
name = "matrix-appservice-slack"; | |
src = pkgs.fetchFromGitHub { | |
owner = "matrix-org"; | |
repo = name; | |
rev = "1.6.1"; | |
sha256 = "0vnrgbv6lddwp9x1zd6a39hy6rq4q5xzbm7wz03kvqixw5v3hrsf"; | |
}; | |
in | |
callNode2nix name src {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment