mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
mastodon: pass dependencies as environment variables
This makes it much easier to override components of the Mastodon
derivation to e.g. use a fork. With this change, one can use something
like the following to install a fork (with the appropriate files):
let
src = callPackage ./source.nix { };
in
(mastodon.override {
pname = "hometown";
version = import ./version.nix;
srcOverride = src;
dependenciesDir = ./.;
}).overrideAttrs (oldAttrs: rec {
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
mastodonModules = oldAttrs.mastodonModules.overrideAttrs (oldModuleAttrs: {
inherit yarnOfflineCache;
});
});
A spiritual successor to f949de4fbb
This commit is contained in:
parent
f9bce74445
commit
5ff79caff9
@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
|
||||
# Putting the callPackage up in the arguments list also does not work.
|
||||
src = if srcOverride != null then srcOverride else callPackage ./source.nix {};
|
||||
|
||||
mastodon-gems = bundlerEnv {
|
||||
mastodonGems = bundlerEnv {
|
||||
name = "${pname}-gems-${version}";
|
||||
inherit version;
|
||||
ruby = ruby_3_0;
|
||||
@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
};
|
||||
|
||||
mastodon-modules = stdenv.mkDerivation {
|
||||
mastodonModules = stdenv.mkDerivation {
|
||||
pname = "${pname}-modules";
|
||||
inherit src version;
|
||||
|
||||
@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-fuU92fydoazSXBHwA+DG//gRgWVYQ1M3m2oNS2iwv4I=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ fixup_yarn_lock nodejs-slim yarn mastodon-gems mastodon-gems.wrappedRuby ];
|
||||
nativeBuildInputs = [ fixup_yarn_lock nodejs-slim yarn mastodonGems mastodonGems.wrappedRuby ];
|
||||
|
||||
RAILS_ENV = "production";
|
||||
NODE_ENV = "production";
|
||||
@ -79,19 +79,19 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ imagemagick ffmpeg file mastodon-gems.wrappedRuby ];
|
||||
buildInputs = [ mastodon-gems nodejs-slim ];
|
||||
propagatedBuildInputs = [ imagemagick ffmpeg file mastodonGems.wrappedRuby ];
|
||||
buildInputs = [ mastodonGems nodejs-slim ];
|
||||
|
||||
buildPhase = ''
|
||||
ln -s ${mastodon-modules}/node_modules node_modules
|
||||
ln -s ${mastodon-modules}/public/assets public/assets
|
||||
ln -s ${mastodon-modules}/public/packs public/packs
|
||||
ln -s $mastodonModules/node_modules node_modules
|
||||
ln -s $mastodonModules/public/assets public/assets
|
||||
ln -s $mastodonModules/public/packs public/packs
|
||||
|
||||
patchShebangs bin/
|
||||
for b in $(ls ${mastodon-gems}/bin/)
|
||||
for b in $(ls $mastodonGems/bin/)
|
||||
do
|
||||
if [ ! -f bin/$b ]; then
|
||||
ln -s ${mastodon-gems}/bin/$b bin/$b
|
||||
ln -s $mastodonGems/bin/$b bin/$b
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user