···586587 # Create an outline-sequalize wrapper (a wrapper around the wrapper) that
588 # has the config file's path baked in. This is necessary because there is
589- # at least one occurrence of outline calling this from its own code.
590 sequelize = pkgs.writeShellScriptBin "outline-sequelize" ''
591 exec ${cfg.package}/bin/outline-sequelize \
592 --config $RUNTIME_DIRECTORY/database.json \
···687 openssl rand -hex 32 > ${lib.escapeShellArg cfg.utilsSecretFile}
688 fi
689690- # The config file is required for the CLI, the DATABASE_URL environment
691- # variable is read by the app.
692 ${if (cfg.databaseUrl == "local") then ''
693 cat <<EOF > $RUNTIME_DIRECTORY/database.json
694 {
695- "production": {
696- "dialect": "postgres",
697 "host": "/run/postgresql",
698 "username": null,
699- "password": null
0700 }
701 }
702 EOF
703- export DATABASE_URL=${lib.escapeShellArg localPostgresqlUrl}
704- export PGSSLMODE=disable
705 '' else ''
706 cat <<EOF > $RUNTIME_DIRECTORY/database.json
707 {
···720 }
721 }
722 EOF
723- export DATABASE_URL=${lib.escapeShellArg cfg.databaseUrl}
724 ''}
725-726- cd $RUNTIME_DIRECTORY
727- ${sequelize}/bin/outline-sequelize db:migrate
728 '';
729730 script = ''
···781 RuntimeDirectoryMode = "0750";
782 # This working directory is required to find stuff like the set of
783 # onboarding files:
784- WorkingDirectory = "${cfg.package}/share/outline/build";
785 };
786 };
787 };
···586587 # Create an outline-sequalize wrapper (a wrapper around the wrapper) that
588 # has the config file's path baked in. This is necessary because there is
589+ # at least two occurrences of outline calling this from its own code.
590 sequelize = pkgs.writeShellScriptBin "outline-sequelize" ''
591 exec ${cfg.package}/bin/outline-sequelize \
592 --config $RUNTIME_DIRECTORY/database.json \
···687 openssl rand -hex 32 > ${lib.escapeShellArg cfg.utilsSecretFile}
688 fi
689690+ # The config file is required for the sequelize CLI.
0691 ${if (cfg.databaseUrl == "local") then ''
692 cat <<EOF > $RUNTIME_DIRECTORY/database.json
693 {
694+ "production-ssl-disabled": {
0695 "host": "/run/postgresql",
696 "username": null,
697+ "password": null,
698+ "dialect": "postgres"
699 }
700 }
701 EOF
00702 '' else ''
703 cat <<EOF > $RUNTIME_DIRECTORY/database.json
704 {
···717 }
718 }
719 EOF
0720 ''}
000721 '';
722723 script = ''
···774 RuntimeDirectoryMode = "0750";
775 # This working directory is required to find stuff like the set of
776 # onboarding files:
777+ WorkingDirectory = "${cfg.package}/share/outline";
778 };
779 };
780 };
+11-18
pkgs/servers/web-apps/outline/default.nix
···910stdenv.mkDerivation rec {
11 pname = "outline";
12- version = "0.68.1";
1314 src = fetchFromGitHub {
15 owner = "outline";
16 repo = "outline";
17 rev = "v${version}";
18- sha256 = "sha256-pln3cdozZPEodfXeUtTbBvhHb5yqE4uu0VKA95Zv6ro=";
19 };
2021 nativeBuildInputs = [ makeWrapper yarn2nix-moretea.fixup_yarn_lock ];
22 buildInputs = [ yarn nodejs ];
2324- # Replace the inline call to yarn with our sequalize wrapper. This should be
25- # the only occurrence:
26 # https://github.com/outline/outline/search?l=TypeScript&q=yarn
27 patches = [ ./sequelize-command.patch ];
28···43 --frozen-lockfile \
44 --ignore-engines --ignore-scripts
45 patchShebangs node_modules/
0046 yarn build
47-48- pushd server
49- cp -r config migrations onboarding ../build/server/
50- popd
5152 runHook postBuild
53 '';
···56 runHook preInstall
5758 mkdir -p $out/bin $out/share/outline
59- mv public node_modules build $out/share/outline/
6061 node_modules=$out/share/outline/node_modules
62 build=$out/share/outline/build
63-64- # On NixOS the WorkingDirectory is set to the build directory, as
65- # this contains files needed in the onboarding process. This folder
66- # must also contain the `public` folder for mail notifications to
67- # work, as it contains the mail templates.
68- ln -s $out/share/outline/public $build/public
6970 makeWrapper ${nodejs}/bin/node $out/bin/outline-server \
71 --add-flags $build/server/index.js \
···7475 makeWrapper ${nodejs}/bin/node $out/bin/outline-sequelize \
76 --add-flags $node_modules/.bin/sequelize \
77- --add-flags "--migrations-path $build/server/migrations" \
78- --add-flags "--models-path $build/server/models" \
79- --add-flags "--seeders-path $build/server/models/fixtures" \
80 --set NODE_ENV production \
81 --set NODE_PATH $node_modules
82