rails: Decouple helper functions from the config variable

This commit is contained in:
Peter Jones 2019-04-08 12:45:31 -07:00
parent bd9408849d
commit 3a322a114a
No known key found for this signature in database
GPG key ID: 9DAFAA8D01941E49
4 changed files with 9 additions and 11 deletions

View file

@ -12,7 +12,7 @@ let
##############################################################################
options = import ./options.nix { inherit config lib pkgs; };
appSystemd = import ./systemd.nix { inherit config pkgs lib; };
funcs = import ./functions.nix { inherit config; };
funcs = import ./functions.nix;
scripts = import ./scripts.nix { inherit lib pkgs; };
##############################################################################

View file

@ -1,5 +1,3 @@
{ config }:
rec {
##############################################################################
@ -14,10 +12,6 @@ rec {
# Path to where the app is actually installed:
appLink = app: "${app.home}/package";
##############################################################################
# Is PostgreSQL local?
localpg = config.phoebe.services.postgresql.enable;
##############################################################################
# Packages to put in the application's PATH. FIXME:
# propagatedBuildInputs won't always be set.

View file

@ -4,7 +4,7 @@ with lib;
let
##############################################################################
functions = import ./functions.nix { inherit config; };
functions = import ./functions.nix;
##############################################################################
# Database configuration:

View file

@ -10,9 +10,13 @@ let
##############################################################################
# Helpful functions.
plib = config.phoebe.lib;
funcs = import ./functions.nix { inherit config; };
funcs = import ./functions.nix;
scripts = import ./scripts.nix { inherit lib pkgs; };
##############################################################################
# Is PostgreSQL local?
localpg = config.phoebe.services.postgresql.enable;
##############################################################################
# The main Rails service:
mainService = app: {
@ -44,8 +48,8 @@ let
after =
[ "network.target" ] ++
optional funcs.localpg "postgresql.service" ++
optional funcs.localpg "pg-accounts.service" ++
optional localpg "postgresql.service" ++
optional localpg "pg-accounts.service" ++
optional (!service.isMain) "rails-${app.name}-main" ++
plib.keyService app.database.passwordFile ++
plib.keyService app.sourcedFile ++