- gems = bundlerEnv {
- name = "mastodon-env";
- ruby = ruby_2_5;
- gemset = ./gemset.nix;
- gemdir = (fetchedGithub ./mastodon.json).src;
- groups = [ "default" "production" "test" "development" ];
- gemConfig = defaultGemConfig // {
- cld3 = attrs: {
- buildInputs = with pkgs; [ protobuf protobufc pkgconfig ];
- };
- idn-ruby = attrs: {
- buildInputs = with pkgs; [ libidn ];
- };
- rpam2 = attrs: {
- buildInputs = with pkgs; [ pam ];
- };
- };
- };
- yarnModules = let
- info = fetchedGithub ./mastodon.json;
- in
- pkgs.yarn2nix.mkYarnModules {
- name = "mastodon-yarn-modules";
- packageJSON = "${info.src}/package.json";
- yarnLock = "${info.src}/yarn.lock";
- yarnNix = ./yarn-packages.nix;
- pkgConfig = {
- uws = {
- postInstall = ''
- node-gyp rebuild > build_log.txt 2>&1 || true
- '';
- buildInputs = with pkgs; [ nodePackages.node-gyp ];
- };
- node-zopfli = {
- postInstall = ''
- node-pre-gyp install --fallback-to-build
- '';
- buildInputs = with pkgs; [ nodePackages.node-pre-gyp ];
- };
- node-sass = {
- buildInputs = with pkgs; [ libsass python ];
- postInstall = let
- nodeHeaders = pkgs.fetchurl {
- url = "https://nodejs.org/download/release/v${pkgs.nodejs.version}/node-v${pkgs.nodejs.version}-headers.tar.gz";
- sha256 = "12zzsf8my43b8qnlacp871ih5vqafl2vlpqp51xp6h3gckn2frwy";
- };
- in
- ''
- node scripts/build.js --tarball=${nodeHeaders}
- '';
- };
- };
- };
- mastodon = stdenv.mkDerivation (fetchedGithub ./mastodon.json // rec {
- installPhase = ''
- cp -a . $out
- cp -a ${yarnModules}/node_modules $out
- '';
- buildInputs = [ yarnModules gems ];
- });
- config = writeText "mastodon_environment" ''
- REDIS_HOST=${env.redis.host}
- REDIS_PORT=${env.redis.port}
- REDIS_DB=${env.redis.db}
- DB_HOST=${env.postgresql.socket}
- DB_USER=${env.postgresql.user}
- DB_NAME=${env.postgresql.database}
- DB_PASS=${env.postgresql.password}
- DB_PORT=${env.postgresql.port}
+ keys.mastodon = {
+ dest = "webapps/tools-mastodon";
+ user = "mastodon";
+ group = "mastodon";
+ permissions = "0400";
+ text = ''
+ REDIS_HOST=${env.redis.host}
+ REDIS_PORT=${env.redis.port}
+ REDIS_DB=${env.redis.db}
+ DB_HOST=${env.postgresql.socket}
+ DB_USER=${env.postgresql.user}
+ DB_NAME=${env.postgresql.database}
+ DB_PASS=${env.postgresql.password}
+ DB_PORT=${env.postgresql.port}