diff options
author | Andrew Dunham <andrew@du.nham.ca> | 2023-01-07 16:14:35 -0500 |
---|---|---|
committer | Andrew Dunham <andrew@du.nham.ca> | 2023-01-07 16:18:47 -0500 |
commit | 5ff79caff9bdfb167d276b72cf2ba8325e48effe (patch) | |
tree | 683e91c9615c45477ee2344df4afb2db2fe5eccf /pkgs/servers/mastodon | |
parent | f9bce7444555bf24caad325080b9c614ba8ce0e0 (diff) |
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 f949de4fbb5c5adb7f3ec085206f48a2efdd1d9a
Diffstat (limited to 'pkgs/servers/mastodon')
-rw-r--r-- | pkgs/servers/mastodon/default.nix | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pkgs/servers/mastodon/default.nix b/pkgs/servers/mastodon/default.nix index ba105959b568a..50050acf40cc5 100644 --- a/pkgs/servers/mastodon/default.nix +++ b/pkgs/servers/mastodon/default.nix @@ -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 |