Last active
July 30, 2023 12:34
-
-
Save gdamjan/08901abe49baadf083034e93ed32ccbe to your computer and use it in GitHub Desktop.
matrix-appservice-irc nix build
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
# nix-build -E 'with import <nixpkgs> {}; callPackage ./default-2.nix {}' | |
{ stdenv | |
, fetchFromGitHub | |
, fetchYarnDeps | |
, fixup_yarn_lock | |
, nodejs | |
, nodejs-slim | |
, matrix-sdk-crypto-nodejs | |
}: | |
let | |
pname = "matrix-appservice-irc"; | |
version = "1.0.0"; | |
src = fetchFromGitHub { | |
owner = "gdamjan"; | |
#owner = "matrix-org"; | |
repo = pname; | |
#rev = version; | |
rev = "5e1176063369589382db9552c49107fad89f9fc6"; | |
#hash = "sha256-IlTW9OK9E7HZJVO+z2aG1z8wipwJ/FJrvmRbg2UNYX0="; | |
hash = "sha256-Hd33ZQOl35eGFp7fmsJD+xA8Ru+Bra/4QO1NDmyN8Uw="; | |
}; | |
yarnOfflineCache = fetchYarnDeps { | |
name = "${pname}-${version}-offline-cache"; | |
yarnLock = "${src}/yarn.lock"; | |
# hash = "sha256-pPZA0ckkHlbkCtgJtPgHce96nJ4PlPMLncdyNLa0ess="; | |
hash = "sha256-gq9O1qbnHsgC8DnSbTPQAUJhgb1x4g35iB+EJvB9jTs="; | |
}; | |
in | |
stdenv.mkDerivation { | |
inherit pname version src yarnOfflineCache; | |
nativeBuildInputs = [ | |
fixup_yarn_lock | |
nodejs-slim | |
nodejs.pkgs.yarn | |
nodejs.pkgs.node-gyp-build | |
]; | |
configurePhase = '' | |
runHook preConfigure | |
export HOME=$(mktemp -d) | |
yarn config --offline set yarn-offline-mirror "$yarnOfflineCache" | |
fixup_yarn_lock yarn.lock | |
yarn install --frozen-lockfile --offline --no-progress --non-interactive --ignore-scripts | |
patchShebangs node_modules/ bin/ | |
runHook postConfigure | |
''; | |
buildPhase = '' | |
runHook preBuild | |
yarn --offline build | |
runHook postBuild | |
''; | |
installPhase = '' | |
mkdir $out | |
cp package.json yarn.lock $out | |
cp app.js config.schema.yml $out | |
cp -r bin lib public $out | |
# prune dependencies to production only | |
yarn install --frozen-lockfile --offline --no-progress --non-interactive --ignore-scripts --production | |
cp -r node_modules $out | |
# replace matrix-sdk-crypto-nodejs with nixos package | |
rm -rv $out/node_modules/@matrix-org/matrix-sdk-crypto-nodejs | |
ln -sv ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs $out/node_modules/@matrix-org/ | |
''; | |
} |
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
# nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}' | |
{ mkYarnPackage | |
, fetchYarnDeps | |
, fetchFromGitHub | |
, matrix-sdk-crypto-nodejs | |
}: | |
mkYarnPackage rec { | |
pname = "matrix-appservice-irc"; | |
version = "1.0.0"; | |
distPhase = "true"; | |
src = fetchFromGitHub { | |
owner = "matrix-org"; | |
repo = pname; | |
rev = version; | |
hash = "sha256-IlTW9OK9E7HZJVO+z2aG1z8wipwJ/FJrvmRbg2UNYX0="; | |
}; | |
offlineCache = fetchYarnDeps { | |
name = "${pname}-${version}-offline-cache"; | |
yarnLock = src + "/yarn.lock"; | |
hash = "sha256-pPZA0ckkHlbkCtgJtPgHce96nJ4PlPMLncdyNLa0ess="; | |
}; | |
buildPhase = '' | |
export HOME=$(mktemp -d) | |
yarn --offline build | |
''; | |
postInstall = '' | |
rm -rv $out/libexec/matrix-appservice-irc/node_modules/@matrix-org/matrix-sdk-crypto-nodejs | |
ln -sv ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs $out/libexec/matrix-appservice-irc/node_modules/@matrix-org/ | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment