mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 02:42:59 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
54 lines
1.5 KiB
Nix
54 lines
1.5 KiB
Nix
{ stdenv, fetchFromGitLab, pkgs, lib, node-pre-gyp, nodejs_18, pkg-config
|
|
, libjpeg, pixman, cairo, pango, which, postgresql }:
|
|
|
|
let
|
|
nodejs = nodejs_18;
|
|
|
|
version = "0.1.1";
|
|
|
|
src = fetchFromGitLab {
|
|
group = "mx-puppet";
|
|
owner = "discord";
|
|
repo = "mx-puppet-discord";
|
|
rev = "v${version}";
|
|
hash = "sha256-ZhyjUt6Bz/0R4+Lq/IoY9rNjdwVE2qp4ZQLc684+T/0=";
|
|
};
|
|
|
|
myNodePackages = import ./node-composition.nix {
|
|
inherit pkgs nodejs;
|
|
inherit (stdenv.hostPlatform) system;
|
|
};
|
|
|
|
in myNodePackages.package.override {
|
|
inherit version src;
|
|
|
|
nativeBuildInputs = [ node-pre-gyp nodejs.pkgs.node-gyp-build pkg-config which ];
|
|
buildInputs = [ libjpeg pixman cairo pango postgresql ];
|
|
|
|
postRebuild = ''
|
|
# Build typescript stuff
|
|
npm run build
|
|
'';
|
|
|
|
postInstall = ''
|
|
# Make an executable to run the server
|
|
mkdir -p $out/bin
|
|
cat <<EOF > $out/bin/mx-puppet-discord
|
|
#!/bin/sh
|
|
exec ${nodejs}/bin/node $out/lib/node_modules/@mx-puppet/discord/build/index.js "\$@"
|
|
EOF
|
|
chmod +x $out/bin/mx-puppet-discord
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Discord puppeting bridge for matrix";
|
|
license = licenses.asl20;
|
|
homepage = "https://gitlab.com/mx-puppet/discord/mx-puppet-discord";
|
|
maintainers = with maintainers; [ expipiplus1 ];
|
|
platforms = platforms.unix;
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
|
|
mainProgram = "mx-puppet-discord";
|
|
};
|
|
}
|