mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/pleroma: inject release cookie path to the pleroma package
We inject the release cookie path to the pleroma derivation in order to wrap pleroma_ctl with it. Doing this allows us to remove the systemd-injected RELEASE_COOKIE path, which was sadly buggy (RELEASE_COOKIE should point to the *content* of the cookie, not the file containing it). We take advantage of this to factor out the cookie path.
This commit is contained in:
parent
8b7845fee9
commit
71d9048f72
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
{ config, options, lib, pkgs, stdenv, ... }:
|
{ config, options, lib, pkgs, stdenv, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.pleroma;
|
cfg = config.services.pleroma;
|
||||||
|
cookieFile = "/var/lib/pleroma/.cookie";
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
services.pleroma = with lib; {
|
services.pleroma = with lib; {
|
||||||
|
@ -8,7 +9,7 @@ in {
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.pleroma;
|
default = pkgs.pleroma.override { inherit cookieFile; };
|
||||||
defaultText = literalExpression "pkgs.pleroma";
|
defaultText = literalExpression "pkgs.pleroma";
|
||||||
description = "Pleroma package to use.";
|
description = "Pleroma package to use.";
|
||||||
};
|
};
|
||||||
|
@ -100,7 +101,6 @@ in {
|
||||||
after = [ "network-online.target" "postgresql.service" ];
|
after = [ "network-online.target" "postgresql.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
restartTriggers = [ config.environment.etc."/pleroma/config.exs".source ];
|
restartTriggers = [ config.environment.etc."/pleroma/config.exs".source ];
|
||||||
environment.RELEASE_COOKIE = "/var/lib/pleroma/.cookie";
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
|
@ -118,10 +118,10 @@ in {
|
||||||
# Better be safe than sorry migration-wise.
|
# Better be safe than sorry migration-wise.
|
||||||
ExecStartPre =
|
ExecStartPre =
|
||||||
let preScript = pkgs.writers.writeBashBin "pleromaStartPre" ''
|
let preScript = pkgs.writers.writeBashBin "pleromaStartPre" ''
|
||||||
if [ ! -f /var/lib/pleroma/.cookie ]
|
if [ ! -f "${cookieFile}" ]
|
||||||
then
|
then
|
||||||
echo "Creating cookie file"
|
echo "Creating cookie file"
|
||||||
dd if=/dev/urandom bs=1 count=16 | hexdump -e '16/1 "%02x"' > /var/lib/pleroma/.cookie
|
dd if=/dev/urandom bs=1 count=16 | ${pkgs.hexdump}/bin/hexdump -e '16/1 "%02x"' > "${cookieFile}"
|
||||||
fi
|
fi
|
||||||
${cfg.package}/bin/pleroma_ctl migrate
|
${cfg.package}/bin/pleroma_ctl migrate
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue