{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/59636","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/59636/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/59636/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/59636/events","html_url":"https://github.com/NixOS/nixpkgs/issues/59636","id":433467899,"node_id":"MDU6SXNzdWU0MzM0Njc4OTk=","number":59636,"title":"nixos services.restya-board: restya-board-init.service failure","user":{"login":"gbiscuolo","id":12426520,"node_id":"MDQ6VXNlcjEyNDI2NTIw","avatar_url":"https://avatars1.githubusercontent.com/u/12426520?v=4","gravatar_id":"","url":"https://api.github.com/users/gbiscuolo","html_url":"https://github.com/gbiscuolo","followers_url":"https://api.github.com/users/gbiscuolo/followers","following_url":"https://api.github.com/users/gbiscuolo/following{/other_user}","gists_url":"https://api.github.com/users/gbiscuolo/gists{/gist_id}","starred_url":"https://api.github.com/users/gbiscuolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbiscuolo/subscriptions","organizations_url":"https://api.github.com/users/gbiscuolo/orgs","repos_url":"https://api.github.com/users/gbiscuolo/repos","events_url":"https://api.github.com/users/gbiscuolo/events{/privacy}","received_events_url":"https://api.github.com/users/gbiscuolo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-04-15T20:38:04Z","updated_at":"2019-11-22T11:52:34Z","closed_at":null,"author_association":"NONE","body":"## Issue description\r\n\r\n`restya-board-init.service` fails when installing service.restya-board using a custom `database.name` option; this is the service status:\r\n\r\n```\r\n[root@SWboard:~]# sudo systemctl status restya-board-init.service\r\n● restya-board-init.service - Restya board initialization\r\n   Loaded: loaded (/nix/store/bn4ljg4bn631ly2ii5vni3qckl7zwg0r-unit-restya-board-init.service/restya-board-init.service; enabled; vendor preset: enabled)\r\n   Active: failed (Result: exit-code) since Mon 2019-04-15 20:17:01 UTC; 6s ago\r\n  Process: 3561 ExecStart=/nix/store/yzid87chgwsswjlc5q4rvwmmvk9qhlnh-unit-script-restya-board-init-start (code=exited, status=2)\r\n Main PID: 3561 (code=exited, status=2)\r\n\r\nApr 15 20:16:54 SWboard sudo[3591]:     root : TTY=unknown ; PWD=/ ; USER=postgres ; COMMAND=/nix/store/igsfm3nkiqf0wgrhvi49mgmfc7n1290x-postgresql-9.6.12/bin/psql -U postgres -c CREATE DATABAS>\r\nApr 15 20:16:54 SWboard sudo[3591]: pam_unix(sudo:session): session opened for user postgres by (uid=0)\r\nApr 15 20:17:01 SWboard yzid87chgwsswjlc5q4rvwmmvk9qhlnh-unit-script-restya-board-init-start[3561]: CREATE DATABASE\r\nApr 15 20:17:01 SWboard sudo[3594]:     root : TTY=unknown ; PWD=/ ; USER=restya-board ; COMMAND=/nix/store/igsfm3nkiqf0wgrhvi49mgmfc7n1290x-postgresql-9.6.12/bin/psql -U restya_board -d restya>\r\nApr 15 20:17:01 SWboard sudo[3594]: pam_unix(sudo:session): session opened for user restya-board by (uid=0)\r\nApr 15 20:17:01 SWboard yzid87chgwsswjlc5q4rvwmmvk9qhlnh-unit-script-restya-board-init-start[3561]: psql: FATAL:  Peer authentication failed for user \"restya_board\"\r\nApr 15 20:17:01 SWboard sudo[3594]: pam_unix(sudo:session): session closed for user restya-board\r\nApr 15 20:17:01 SWboard systemd[1]: restya-board-init.service: Main process exited, code=exited, status=2/INVALIDARGUMENT\r\nApr 15 20:17:01 SWboard systemd[1]: restya-board-init.service: Failed with result 'exit-code'.\r\nApr 15 20:17:01 SWboard systemd[1]: Failed to start Restya board initialization.\r\n```\r\n\r\nThe issue is caused by the hardcoded database name in [`postgres.authentication` definition](https://github.com/NixOS/nixpkgs/blob/fd05e3407ea1acea58b73e3a699ba35375343e65/nixos/modules/services/web-apps/restya-board.nix#L379): the database name should be ` ${cfg.database.name}`.\r\n\r\nI have not tested it directly but looking at the module source code I'm almost sure this also applies to  `database.user` and `user` options.\r\n\r\n### Steps to reproduce\r\n\r\nUse this service declaration:\r\n\r\n```\r\n  services.restya-board = {\r\n       enable = true;\r\n       virtualHost.listenHost = \"192.168.200.13\";\r\n       virtualHost.serverName = \"xtboard.MASKED.TLD\";\r\n       database.name = \"restya_xtboard\";\r\n       timezone = \"CET\";\r\n  };\r\n```\r\n\r\n## Technical details\r\n\r\n```\r\n$ nix-shell -p nix-info --run \"nix-info -m\"\r\nthese paths will be fetched (0.05 MiB download, 0.28 MiB unpacked):\r\n  /nix/store/9z1b1ldrhxh7brsi6fxnyjm7gk8kiynv-bash-interactive-4.4-p23-dev\r\ncopying path '/nix/store/9z1b1ldrhxh7brsi6fxnyjm7gk8kiynv-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...\r\n - system: `\"x86_64-linux\"`\r\n - host os: `Linux 4.14.104, NixOS, 19.03.172138.5c52b25283a (Koi)`\r\n - multi-user?: `yes`\r\n - sandbox: `yes`\r\n - version: `nix-env (Nix) 2.2`\r\n - channels(root): `\"nixos-19.03.172138.5c52b25283a\"`\r\n - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/557503624","html_url":"https://github.com/NixOS/nixpkgs/issues/59636#issuecomment-557503624","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/59636","id":557503624,"node_id":"MDEyOklzc3VlQ29tbWVudDU1NzUwMzYyNA==","user":{"login":"aanderse","id":7755101,"node_id":"MDQ6VXNlcjc3NTUxMDE=","avatar_url":"https://avatars2.githubusercontent.com/u/7755101?v=4","gravatar_id":"","url":"https://api.github.com/users/aanderse","html_url":"https://github.com/aanderse","followers_url":"https://api.github.com/users/aanderse/followers","following_url":"https://api.github.com/users/aanderse/following{/other_user}","gists_url":"https://api.github.com/users/aanderse/gists{/gist_id}","starred_url":"https://api.github.com/users/aanderse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aanderse/subscriptions","organizations_url":"https://api.github.com/users/aanderse/orgs","repos_url":"https://api.github.com/users/aanderse/repos","events_url":"https://api.github.com/users/aanderse/events{/privacy}","received_events_url":"https://api.github.com/users/aanderse/received_events","type":"User","site_admin":false},"created_at":"2019-11-22T11:52:34Z","updated_at":"2019-11-22T11:52:34Z","author_association":"CONTRIBUTOR","body":"@gbiscuolo thanks for reporting this. I've never used this service, but I would be willing to take a look and fix this if you were willing to test it for me. Sound good?"}}
{"actor":{"display_login":"aanderse"}}