X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=virtual%2Fmodules%2Fwebsites%2Ftools%2Fdiaspora%2Fdiaspora.nix;h=798ebe6707d22a4b6245a8b3e0815710d3e7f77e;hb=b0781dbc85da7bba5a3a9209ca4d3b3900eea7b5;hp=7880ac536f4c408dc45707f634b362ac81670f53;hpb=a7f7fdae99f7617fb7fdabe1e65423e02a4982b1;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/virtual/modules/websites/tools/diaspora/diaspora.nix b/virtual/modules/websites/tools/diaspora/diaspora.nix index 7880ac5..798ebe6 100644 --- a/virtual/modules/websites/tools/diaspora/diaspora.nix +++ b/virtual/modules/websites/tools/diaspora/diaspora.nix @@ -1,13 +1,9 @@ -{ checkEnv, fetchedGithub, stdenv, defaultGemConfig, writeText, bundlerEnv, ruby_2_4, pkgs, cacert }: +{ env, fetchedGithub, stdenv, defaultGemConfig, writeText, bundlerEnv, ruby_2_4, pkgs, cacert }: let gems = bundlerEnv { name = "diaspora-env"; ruby = ruby_2_4; gemdir = ./.; - # FIXME: it fails if I don’t include all groups - #groups = [ "default" "postgresql" "production" "development" "test" ]; - # Had to remove them from gemset.nix, and remove mysql2 - # Also had to "ungroup" pg in Gemfile gemConfig = defaultGemConfig // { kostya-sigar = attrs: { buildInputs = with pkgs; [ pkgs.perl ]; @@ -16,36 +12,23 @@ let }; varDir = "/var/lib/diaspora_immae"; socketsDir = "/run/diaspora"; - buildInputs = [ gems ] ++ (with pkgs; [ - git redis imagemagick libxslt nodejs - jemalloc cacert ruby_2_4 - openssl postgresql curl libnghttp2 - pkgconfig which - ]); diaspora = stdenv.mkDerivation (fetchedGithub ./diaspora.json // rec { buildPhase = '' - export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt - export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt - patch -p1 < ${./ldap.patch} ''; installPhase = '' cp -a . $out ''; - propagatedBuildInputs = buildInputs; }); - secret_token = assert checkEnv "NIXOPS_DIASPORA_SECRET_TOKEN"; - writeText "secret_token.rb" '' - Diaspora::Application.config.secret_key_base = '${builtins.getEnv "NIXOPS_DIASPORA_SECRET_TOKEN"}' + secret_token = writeText "secret_token.rb" '' + Diaspora::Application.config.secret_key_base = '${env.secret_token}' ''; - config = - assert checkEnv "NIXOPS_DIASPORA_LDAP_PASSWORD"; - writeText "diaspora.yml" '' + config = writeText "diaspora.yml" '' configuration: environment: url: "https://diaspora.immae.eu/" - certificate_authorities: '/etc/ssl/certs/ca-certificates.crt' - redis: 'redis://localhost:6379/15' + certificate_authorities: '${cacert}/etc/ssl/certs/ca-bundle.crt' + redis: '${env.redis_url}' sidekiq: s3: assets: @@ -105,7 +88,7 @@ let skip_email_confirmation: true use_bind_dn: true bind_dn: "cn=diaspora,ou=services,dc=immae,dc=eu" - bind_pw: "${builtins.getEnv "NIXOPS_DIASPORA_LDAP_PASSWORD"}" + bind_pw: "${env.ldap.password}" search_base: "dc=immae,dc=eu" search_filter: "(&(memberOf=cn=users,cn=diaspora,ou=services,dc=immae,dc=eu)(uid=%{username}))" production: @@ -113,15 +96,13 @@ let development: environment: ''; - database_config = - assert checkEnv "NIXOPS_DIASPORA_SQL_PASSWORD"; - writeText "database.yml" '' + database_config = writeText "database.yml" '' postgresql: &postgresql adapter: postgresql host: db-1.immae.eu port: 5432 username: "diaspora" - password: "${builtins.getEnv "NIXOPS_DIASPORA_SQL_PASSWORD"}" + password: "${env.postgresql.password}" encoding: unicode common: &common <<: *postgresql @@ -164,7 +145,7 @@ let ln -sf ../../../../../${varDir}/tmp tmp ln -sf ../../../../../${varDir}/log log ''; - propagatedBuildInputs = buildInputs; + propagatedBuildInputs = [ gems pkgs.nodejs pkgs.which pkgs.git ]; }; in {