at master 4.7 kB view raw
1{ 2 lib, 3 config, 4 options, 5 ... 6}: 7{ 8 imports = [ (import ./common.nix "nexus") ]; 9 10 options.services.libeufin.nexus.settings = lib.mkOption { 11 description = '' 12 Configuration options for the libeufin nexus config file. 13 14 For a list of all possible options, please see the man page [`libeufin-nexus.conf(5)`](https://docs.taler.net/manpages/libeufin-nexus.conf.5.html) 15 ''; 16 type = lib.types.submodule { 17 inherit (options.services.libeufin.settings.type.nestedTypes) freeformType; 18 options = { 19 nexus-ebics = { 20 # Mandatory configuration values 21 # https://docs.taler.net/libeufin/nexus-manual.html#setting-up-the-ebics-subscriber 22 # https://docs.taler.net/libeufin/setup-ebics-at-postfinance.html 23 CURRENCY = lib.mkOption { 24 description = "Name of the fiat currency."; 25 type = lib.types.nonEmptyStr; 26 example = "CHF"; 27 }; 28 HOST_BASE_URL = lib.mkOption { 29 description = "URL of the EBICS server."; 30 type = lib.types.nonEmptyStr; 31 example = "https://ebics.postfinance.ch/ebics/ebics.aspx"; 32 }; 33 BANK_DIALECT = lib.mkOption { 34 description = '' 35 Name of the following combination: EBICS version and ISO20022 36 recommendations that Nexus would honor in the communication with the 37 bank. 38 39 Currently only the "postfinance" or "gls" value is supported. 40 ''; 41 type = lib.types.enum [ 42 "postfinance" 43 "gls" 44 ]; 45 example = "postfinance"; 46 }; 47 HOST_ID = lib.mkOption { 48 description = "Name of the EBICS host."; 49 type = lib.types.nonEmptyStr; 50 example = "PFEBICS"; 51 }; 52 USER_ID = lib.mkOption { 53 description = '' 54 User ID of the EBICS subscriber. 55 56 This value must be assigned by the bank after having activated a new EBICS subscriber. 57 ''; 58 type = lib.types.nonEmptyStr; 59 example = "PFC00563"; 60 }; 61 PARTNER_ID = lib.mkOption { 62 description = '' 63 Partner ID of the EBICS subscriber. 64 65 This value must be assigned by the bank after having activated a new EBICS subscriber. 66 ''; 67 type = lib.types.nonEmptyStr; 68 example = "PFC00563"; 69 }; 70 IBAN = lib.mkOption { 71 description = "IBAN of the bank account that is associated with the EBICS subscriber."; 72 type = lib.types.nonEmptyStr; 73 example = "CH7789144474425692816"; 74 }; 75 BIC = lib.mkOption { 76 description = "BIC of the bank account that is associated with the EBICS subscriber."; 77 type = lib.types.nonEmptyStr; 78 example = "POFICHBEXXX"; 79 }; 80 NAME = lib.mkOption { 81 description = "Legal entity that is associated with the EBICS subscriber."; 82 type = lib.types.nonEmptyStr; 83 example = "John Smith S.A."; 84 }; 85 BANK_PUBLIC_KEYS_FILE = lib.mkOption { 86 type = lib.types.path; 87 default = "/var/lib/libeufin-nexus/bank-ebics-keys.json"; 88 description = '' 89 Filesystem location where Nexus should store the bank public keys. 90 ''; 91 }; 92 CLIENT_PRIVATE_KEYS_FILE = lib.mkOption { 93 type = lib.types.path; 94 default = "/var/lib/libeufin-nexus/client-ebics-keys.json"; 95 description = '' 96 Filesystem location where Nexus should store the subscriber private keys. 97 ''; 98 }; 99 }; 100 nexus-httpd = { 101 PORT = lib.mkOption { 102 type = lib.types.port; 103 default = 8084; 104 description = '' 105 The port on which libeufin-bank should listen. 106 ''; 107 }; 108 }; 109 libeufin-nexusdb-postgres = { 110 CONFIG = lib.mkOption { 111 type = lib.types.str; 112 description = '' 113 The database connection string for the libeufin-nexus database. 114 ''; 115 }; 116 }; 117 }; 118 }; 119 }; 120 121 config = 122 let 123 cfgMain = config.services.libeufin; 124 cfg = config.services.libeufin.nexus; 125 in 126 lib.mkIf cfg.enable { 127 services.libeufin.nexus.settings.libeufin-nexusdb-postgres.CONFIG = lib.mkIf ( 128 cfgMain.bank.enable && cfgMain.bank.createLocalDatabase 129 ) "postgresql:///libeufin-bank"; 130 131 systemd.services.libeufin-nexus.documentation = [ "man:libeufin-nexus(1)" ]; 132 }; 133}