payload: {"action":"created","comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments/324671858","pull_request_review_id":288623879,"id":324671858,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyNDY3MTg1OA==","diff_hunk":"@@ -140,50 +198,70 @@ in\n     systemd.mounts = map ({ what, where }: {\n         bindsTo = [ \"unifi.service\" ];\n         partOf = [ \"unifi.service\" ];\n-        unitConfig.RequiresMountsFor = stateDir;\n         options = \"bind\";\n-        what = what;\n-        where = where;\n+        inherit what where;\n       }) mountPoints;\n \n-    systemd.tmpfiles.rules = [\n-      \"e '${stateDir}' 0700 unifi - - -\"\n-      \"d '${stateDir}/data' 0700 unifi - - -\"\n-    ];\n+    systemd.services.unifi-setup = {\n+      description = \"UniFi controller daemon - setup\";\n+      wantedBy = [ \"multi-user.target\" ];\n+      before = [ \"unifi.service\" ];\n+\n+      script = let","path":"nixos/modules/services/networking/unifi.nix","position":228,"original_position":228,"commit_id":"e9903943786fcc9be1ed3cf5a823792bb496903c","original_commit_id":"e9903943786fcc9be1ed3cf5a823792bb496903c","user":{"login":"peterhoeg","id":722550,"node_id":"MDQ6VXNlcjcyMjU1MA==","avatar_url":"https://avatars1.githubusercontent.com/u/722550?v=4","gravatar_id":"","url":"https://api.github.com/users/peterhoeg","html_url":"https://github.com/peterhoeg","followers_url":"https://api.github.com/users/peterhoeg/followers","following_url":"https://api.github.com/users/peterhoeg/following{/other_user}","gists_url":"https://api.github.com/users/peterhoeg/gists{/gist_id}","starred_url":"https://api.github.com/users/peterhoeg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterhoeg/subscriptions","organizations_url":"https://api.github.com/users/peterhoeg/orgs","repos_url":"https://api.github.com/users/peterhoeg/repos","events_url":"https://api.github.com/users/peterhoeg/events{/privacy}","received_events_url":"https://api.github.com/users/peterhoeg/received_events","type":"User","site_admin":false},"body":"We cannot drop the tmpfiles rules. The main unit pulls in the bindmounts which are mounted under /var/lib/unifi, so that directory needs to exist before. I lost about an hour of my life because I couldn't understand why it refused to start with statedirectory.... That actually leads me to another point. Any good ideas on how to document the implementation details? Just comments inside?\r\n\r\nAs for the ```unifi-setup``` vs using ```preStart```, it's become a pattern I have started using (I'll do an RFC on it) because it gives more flexibility. Once preStart has been set, you cannot add to it from the outside if the service needs to be augmented whereas using a separate -init unit does. Additionally, we should then be pulling in a ```unifi.target```. Anyway, I'll do a separate write-up on my thoughts on this.","created_at":"2019-09-16T13:24:10Z","updated_at":"2019-09-16T13:24:11Z","html_url":"https://github.com/NixOS/nixpkgs/pull/68884#discussion_r324671858","pull_request_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments/324671858"},"html":{"href":"https://github.com/NixOS/nixpkgs/pull/68884#discussion_r324671858"},"pull_request":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884"}},"in_reply_to_id":324607586},"pull_request":{"url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884","id":317773392,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE3NzczMzky","html_url":"https://github.com/NixOS/nixpkgs/pull/68884","diff_url":"https://github.com/NixOS/nixpkgs/pull/68884.diff","patch_url":"https://github.com/NixOS/nixpkgs/pull/68884.patch","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/68884","number":68884,"state":"open","locked":false,"title":"nixos/unifi: add test and additional config options [WIP]","user":{"login":"peterhoeg","id":722550,"node_id":"MDQ6VXNlcjcyMjU1MA==","avatar_url":"https://avatars1.githubusercontent.com/u/722550?v=4","gravatar_id":"","url":"https://api.github.com/users/peterhoeg","html_url":"https://github.com/peterhoeg","followers_url":"https://api.github.com/users/peterhoeg/followers","following_url":"https://api.github.com/users/peterhoeg/following{/other_user}","gists_url":"https://api.github.com/users/peterhoeg/gists{/gist_id}","starred_url":"https://api.github.com/users/peterhoeg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterhoeg/subscriptions","organizations_url":"https://api.github.com/users/peterhoeg/orgs","repos_url":"https://api.github.com/users/peterhoeg/repos","events_url":"https://api.github.com/users/peterhoeg/events{/privacy}","received_events_url":"https://api.github.com/users/peterhoeg/received_events","type":"User","site_admin":false},"body":"###### Motivation for this change\r\n\r\nThis allows having the controller listen on custom ports + to set advanced options via ```system.properties```.\r\n\r\nWe remove the ability to configure where the data is stored and just force things to be under ```/var/lib/unifi``` as someone with specific database requirements can use an external mongodb instance now and configure that to place the data in a custom location.\r\n\r\nFurthermore, we add a proper nixos test.\r\n\r\nThe thing I would love some input on is how we handle migration in case a custom ```dataDir``` was set in the past.\r\n\r\n###### Things done\r\n\r\n<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->\r\n\r\n- [x] Tested using sandboxing ([nix.useSandbox](http://nixos.org/nixos/manual/options.html#opt-nix.useSandbox) on NixOS, or option `sandbox` in [`nix.conf`](http://nixos.org/nix/manual/#sec-conf-file) on non-NixOS)\r\n- Built on platform(s)\r\n   - [x] NixOS\r\n   - [ ] macOS\r\n   - [ ] other Linux distributions\r\n- [x] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))\r\n- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nix-review --run \"nix-review wip\"`\r\n- [x] Tested execution of all binary files (usually in `./result/bin/`)\r\n- [ ] Determined the impact on package closure size (by running `nix path-info -S` before and after)\r\n- [ ] Ensured that relevant documentation is up to date\r\n- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).\r\n\r\n###### Notify maintainers\r\n\r\ncc @erictapen \r\n","created_at":"2019-09-16T08:45:03Z","updated_at":"2019-09-16T13:24:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ae88f151c438cc5915b841721c0f2c419856334","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":737642262,"node_id":"MDU6TGFiZWw3Mzc2NDIyNjI=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-darwin:%200","name":"10.rebuild-darwin: 0","color":"eeffee","default":false},{"id":737642408,"node_id":"MDU6TGFiZWw3Mzc2NDI0MDg=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-linux:%200","name":"10.rebuild-linux: 0","color":"eeffee","default":false},{"id":60265212,"node_id":"MDU6TGFiZWw2MDI2NTIxMg==","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20nixos","name":"6.topic: nixos","color":"fef2c0","default":false},{"id":290122884,"node_id":"MDU6TGFiZWwyOTAxMjI4ODQ=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/8.has:%20module%20(update)","name":"8.has: module (update)","color":"009800","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884/commits","review_comments_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884/comments","review_comment_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/68884/comments","statuses_url":"https://api.github.com/repos/NixOS/nixpkgs/statuses/e9903943786fcc9be1ed3cf5a823792bb496903c","head":{"label":"peterhoeg:f/unifi","ref":"f/unifi","sha":"e9903943786fcc9be1ed3cf5a823792bb496903c","user":{"login":"peterhoeg","id":722550,"node_id":"MDQ6VXNlcjcyMjU1MA==","avatar_url":"https://avatars1.githubusercontent.com/u/722550?v=4","gravatar_id":"","url":"https://api.github.com/users/peterhoeg","html_url":"https://github.com/peterhoeg","followers_url":"https://api.github.com/users/peterhoeg/followers","following_url":"https://api.github.com/users/peterhoeg/following{/other_user}","gists_url":"https://api.github.com/users/peterhoeg/gists{/gist_id}","starred_url":"https://api.github.com/users/peterhoeg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterhoeg/subscriptions","organizations_url":"https://api.github.com/users/peterhoeg/orgs","repos_url":"https://api.github.com/users/peterhoeg/repos","events_url":"https://api.github.com/users/peterhoeg/events{/privacy}","received_events_url":"https://api.github.com/users/peterhoeg/received_events","type":"User","site_admin":false},"repo":{"id":53913648,"node_id":"MDEwOlJlcG9zaXRvcnk1MzkxMzY0OA==","name":"nixpkgs","full_name":"peterhoeg/nixpkgs","private":false,"owner":{"login":"peterhoeg","id":722550,"node_id":"MDQ6VXNlcjcyMjU1MA==","avatar_url":"https://avatars1.githubusercontent.com/u/722550?v=4","gravatar_id":"","url":"https://api.github.com/users/peterhoeg","html_url":"https://github.com/peterhoeg","followers_url":"https://api.github.com/users/peterhoeg/followers","following_url":"https://api.github.com/users/peterhoeg/following{/other_user}","gists_url":"https://api.github.com/users/peterhoeg/gists{/gist_id}","starred_url":"https://api.github.com/users/peterhoeg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterhoeg/subscriptions","organizations_url":"https://api.github.com/users/peterhoeg/orgs","repos_url":"https://api.github.com/users/peterhoeg/repos","events_url":"https://api.github.com/users/peterhoeg/events{/privacy}","received_events_url":"https://api.github.com/users/peterhoeg/received_events","type":"User","site_admin":false},"html_url":"https://github.com/peterhoeg/nixpkgs","description":"Nix Packages collection","fork":true,"url":"https://api.github.com/repos/peterhoeg/nixpkgs","forks_url":"https://api.github.com/repos/peterhoeg/nixpkgs/forks","keys_url":"https://api.github.com/repos/peterhoeg/nixpkgs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterhoeg/nixpkgs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterhoeg/nixpkgs/teams","hooks_url":"https://api.github.com/repos/peterhoeg/nixpkgs/hooks","issue_events_url":"https://api.github.com/repos/peterhoeg/nixpkgs/issues/events{/number}","events_url":"https://api.github.com/repos/peterhoeg/nixpkgs/events","assignees_url":"https://api.github.com/repos/peterhoeg/nixpkgs/assignees{/user}","branches_url":"https://api.github.com/repos/peterhoeg/nixpkgs/branches{/branch}","tags_url":"https://api.github.com/repos/peterhoeg/nixpkgs/tags","blobs_url":"https://api.github.com/repos/peterhoeg/nixpkgs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterhoeg/nixpkgs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterhoeg/nixpkgs/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterhoeg/nixpkgs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterhoeg/nixpkgs/statuses/{sha}","languages_url":"https://api.github.com/repos/peterhoeg/nixpkgs/languages","stargazers_url":"https://api.github.com/repos/peterhoeg/nixpkgs/stargazers","contributors_url":"https://api.github.com/repos/peterhoeg/nixpkgs/contributors","subscribers_url":"https://api.github.com/repos/peterhoeg/nixpkgs/subscribers","subscription_url":"https://api.github.com/repos/peterhoeg/nixpkgs/subscription","commits_url":"https://api.github.com/repos/peterhoeg/nixpkgs/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterhoeg/nixpkgs/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterhoeg/nixpkgs/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterhoeg/nixpkgs/issues/comments{/number}","contents_url":"https://api.github.com/repos/peterhoeg/nixpkgs/contents/{+path}","compare_url":"https://api.github.com/repos/peterhoeg/nixpkgs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterhoeg/nixpkgs/merges","archive_url":"https://api.github.com/repos/peterhoeg/nixpkgs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterhoeg/nixpkgs/downloads","issues_url":"https://api.github.com/repos/peterhoeg/nixpkgs/issues{/number}","pulls_url":"https://api.github.com/repos/peterhoeg/nixpkgs/pulls{/number}","milestones_url":"https://api.github.com/repos/peterhoeg/nixpkgs/milestones{/number}","notifications_url":"https://api.github.com/repos/peterhoeg/nixpkgs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterhoeg/nixpkgs/labels{/name}","releases_url":"https://api.github.com/repos/peterhoeg/nixpkgs/releases{/id}","deployments_url":"https://api.github.com/repos/peterhoeg/nixpkgs/deployments","created_at":"2016-03-15T04:07:05Z","updated_at":"2019-09-16T08:12:21Z","pushed_at":"2019-09-16T09:08:26Z","git_url":"git://github.com/peterhoeg/nixpkgs.git","ssh_url":"git@github.com:peterhoeg/nixpkgs.git","clone_url":"https://github.com/peterhoeg/nixpkgs.git","svn_url":"https://github.com/peterhoeg/nixpkgs","homepage":null,"size":1019968,"stargazers_count":0,"watchers_count":0,"language":"Nix","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NixOS:master","ref":"master","sha":"db21aabe155a3582e3c84d646df649cc877814c2","user":{"login":"NixOS","id":487568,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ4NzU2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/487568?v=4","gravatar_id":"","url":"https://api.github.com/users/NixOS","html_url":"https://github.com/NixOS","followers_url":"https://api.github.com/users/NixOS/followers","following_url":"https://api.github.com/users/NixOS/following{/other_user}","gists_url":"https://api.github.com/users/NixOS/gists{/gist_id}","starred_url":"https://api.github.com/users/NixOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NixOS/subscriptions","organizations_url":"https://api.github.com/users/NixOS/orgs","repos_url":"https://api.github.com/users/NixOS/repos","events_url":"https://api.github.com/users/NixOS/events{/privacy}","received_events_url":"https://api.github.com/users/NixOS/received_events","type":"Organization","site_admin":false},"repo":{"id":4542716,"node_id":"MDEwOlJlcG9zaXRvcnk0NTQyNzE2","name":"nixpkgs","full_name":"NixOS/nixpkgs","private":false,"owner":{"login":"NixOS","id":487568,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ4NzU2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/487568?v=4","gravatar_id":"","url":"https://api.github.com/users/NixOS","html_url":"https://github.com/NixOS","followers_url":"https://api.github.com/users/NixOS/followers","following_url":"https://api.github.com/users/NixOS/following{/other_user}","gists_url":"https://api.github.com/users/NixOS/gists{/gist_id}","starred_url":"https://api.github.com/users/NixOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NixOS/subscriptions","organizations_url":"https://api.github.com/users/NixOS/orgs","repos_url":"https://api.github.com/users/NixOS/repos","events_url":"https://api.github.com/users/NixOS/events{/privacy}","received_events_url":"https://api.github.com/users/NixOS/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/NixOS/nixpkgs","description":"Nix Packages collection","fork":false,"url":"https://api.github.com/repos/NixOS/nixpkgs","forks_url":"https://api.github.com/repos/NixOS/nixpkgs/forks","keys_url":"https://api.github.com/repos/NixOS/nixpkgs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NixOS/nixpkgs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NixOS/nixpkgs/teams","hooks_url":"https://api.github.com/repos/NixOS/nixpkgs/hooks","issue_events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/events{/number}","events_url":"https://api.github.com/repos/NixOS/nixpkgs/events","assignees_url":"https://api.github.com/repos/NixOS/nixpkgs/assignees{/user}","branches_url":"https://api.github.com/repos/NixOS/nixpkgs/branches{/branch}","tags_url":"https://api.github.com/repos/NixOS/nixpkgs/tags","blobs_url":"https://api.github.com/repos/NixOS/nixpkgs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NixOS/nixpkgs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NixOS/nixpkgs/git/refs{/sha}","trees_url":"https://api.github.com/repos/NixOS/nixpkgs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NixOS/nixpkgs/statuses/{sha}","languages_url":"https://api.github.com/repos/NixOS/nixpkgs/languages","stargazers_url":"https://api.github.com/repos/NixOS/nixpkgs/stargazers","contributors_url":"https://api.github.com/repos/NixOS/nixpkgs/contributors","subscribers_url":"https://api.github.com/repos/NixOS/nixpkgs/subscribers","subscription_url":"https://api.github.com/repos/NixOS/nixpkgs/subscription","commits_url":"https://api.github.com/repos/NixOS/nixpkgs/commits{/sha}","git_commits_url":"https://api.github.com/repos/NixOS/nixpkgs/git/commits{/sha}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/comments{/number}","issue_comment_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments{/number}","contents_url":"https://api.github.com/repos/NixOS/nixpkgs/contents/{+path}","compare_url":"https://api.github.com/repos/NixOS/nixpkgs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NixOS/nixpkgs/merges","archive_url":"https://api.github.com/repos/NixOS/nixpkgs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NixOS/nixpkgs/downloads","issues_url":"https://api.github.com/repos/NixOS/nixpkgs/issues{/number}","pulls_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls{/number}","milestones_url":"https://api.github.com/repos/NixOS/nixpkgs/milestones{/number}","notifications_url":"https://api.github.com/repos/NixOS/nixpkgs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/labels{/name}","releases_url":"https://api.github.com/repos/NixOS/nixpkgs/releases{/id}","deployments_url":"https://api.github.com/repos/NixOS/nixpkgs/deployments","created_at":"2012-06-04T02:49:46Z","updated_at":"2019-09-16T13:16:26Z","pushed_at":"2019-09-16T13:17:04Z","git_url":"git://github.com/NixOS/nixpkgs.git","ssh_url":"git@github.com:NixOS/nixpkgs.git","clone_url":"https://github.com/NixOS/nixpkgs.git","svn_url":"https://github.com/NixOS/nixpkgs","homepage":null,"size":1035146,"stargazers_count":4167,"watchers_count":4167,"language":"Nix","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3986,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":4609,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3986,"open_issues":4609,"watchers":4167,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884"},"html":{"href":"https://github.com/NixOS/nixpkgs/pull/68884"},"issue":{"href":"https://api.github.com/repos/NixOS/nixpkgs/issues/68884"},"comments":{"href":"https://api.github.com/repos/NixOS/nixpkgs/issues/68884/comments"},"review_comments":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884/comments"},"review_comment":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/68884/commits"},"statuses":{"href":"https://api.github.com/repos/NixOS/nixpkgs/statuses/e9903943786fcc9be1ed3cf5a823792bb496903c"}},"author_association":"MEMBER"}}
other: {"actor":{"display_login":"peterhoeg"}}