{"action":"created","comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments/85964504","pull_request_review_id":6640639,"id":85964504,"diff_hunk":"@@ -65,4 +65,68 @@ options = {\n \n </para>\n \n+<section xml:id=\"sec-option-declarations-eot\"><title>Extended Option \n+    Types</title>","path":"nixos/doc/manual/development/option-declarations.xml","position":5,"original_position":5,"commit_id":"9424bd95d28a5739f64433c52ac27771fad1a91b","original_commit_id":"9424bd95d28a5739f64433c52ac27771fad1a91b","user":{"login":"nbp","id":1179566,"avatar_url":"https://avatars.githubusercontent.com/u/1179566?v=3","gravatar_id":"","url":"https://api.github.com/users/nbp","html_url":"https://github.com/nbp","followers_url":"https://api.github.com/users/nbp/followers","following_url":"https://api.github.com/users/nbp/following{/other_user}","gists_url":"https://api.github.com/users/nbp/gists{/gist_id}","starred_url":"https://api.github.com/users/nbp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbp/subscriptions","organizations_url":"https://api.github.com/users/nbp/orgs","repos_url":"https://api.github.com/users/nbp/repos","events_url":"https://api.github.com/users/nbp/events{/privacy}","received_events_url":"https://api.github.com/users/nbp/received_events","type":"User","site_admin":false},"body":"nit: I would replace `Extended` by `Extensible`, and do the same for all the references below as well.\r\n`Extended` would apply to the result, not the property of a type.","created_at":"2016-11-01T16:24:15Z","updated_at":"2016-11-01T16:49:39Z","html_url":"https://github.com/NixOS/nixpkgs/pull/18380#discussion_r85964504","pull_request_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380","_links":{"self":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments/85964504"},"html":{"href":"https://github.com/NixOS/nixpkgs/pull/18380#discussion_r85964504"},"pull_request":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380"}}},"pull_request":{"url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380","id":84222307,"html_url":"https://github.com/NixOS/nixpkgs/pull/18380","diff_url":"https://github.com/NixOS/nixpkgs/pull/18380.diff","patch_url":"https://github.com/NixOS/nixpkgs/pull/18380.patch","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/18380","number":18380,"state":"open","locked":false,"title":"module system: type merging for enum, nullOr and listOf","user":{"login":"ericsagnes","id":367880,"avatar_url":"https://avatars.githubusercontent.com/u/367880?v=3","gravatar_id":"","url":"https://api.github.com/users/ericsagnes","html_url":"https://github.com/ericsagnes","followers_url":"https://api.github.com/users/ericsagnes/followers","following_url":"https://api.github.com/users/ericsagnes/following{/other_user}","gists_url":"https://api.github.com/users/ericsagnes/gists{/gist_id}","starred_url":"https://api.github.com/users/ericsagnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericsagnes/subscriptions","organizations_url":"https://api.github.com/users/ericsagnes/orgs","repos_url":"https://api.github.com/users/ericsagnes/repos","events_url":"https://api.github.com/users/ericsagnes/events{/privacy}","received_events_url":"https://api.github.com/users/ericsagnes/received_events","type":"User","site_admin":false},"body":"###### Motivation for this change\n\nThis adds type merging for `enum`, `nullOr` and `listOf` types.\n\nIt allow to extend type definitions for `enum`, `nullOr enum` and `listOf enum` options over multiple modules files in a decentralized manner.\n\nIdea come from https://github.com/NixOS/nixpkgs/pull/15096#issuecomment-239925597.\n#### Example use case: Input methods\n\nThis functionality can be used extend sum types defining a choice without changing the base module.\n\nThere can be only one input method enabled system-wide, so the enabled input method option is declared as an `enum` in the central input method module (`default.nix`).\nEvery input method has its own set of options and config and so is managed in its own module file.\n\nCurrently, options declarations are closed so the declaration in `default.nix` must contains all the possible choices:\n\n_default.nix_\n\n```\n  enabled = mkOption {\n    type    = types.nullOr (types.enum [ \"ibus\" \"fcitx\" \"nabi\" \"uim\" ]);\n    default = null;\n    ...\n  };\n```\n\nThat means that any addition or removal of input methods result in a change in the `enabled` declaration in `default.nix`.\n\nWith type merging, it is possible to make `enabled` a placeholder in the main module:\n\n_default.nix_:\n\n```\n  enabled = mkOption {\n    type    = types.nullOr (types.enum [ ]);\n    default = null;\n    ...\n  };\n```\n\nAnd to extend it in other input methods modules files:\n\n_ibus.nix_:\n\n```\n  enabled = mkOption {\n    type = types.nullOr (types.enum [ \"ibus\" ]);\n  };\n```\n\nAs a result, option declaration is decentralized and modularity improved.\n#### Manual\n\nIn the manual, all the files that extends or declare the type are listed in `Declared by:`, sample output:\n\n```\ni18n.inputMethod.enabled\n\n    Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices. Input methods are specially used to input Chinese, Japanese and Korean characters.\n\n    Type: null or one of \"uim\", \"nabi\", \"ibus\", \"fcitx\"\n\n    Default: null\n\n    Example: \"fcitx\"\n\n    Declared by:\n    <nixpkgs/nixos/modules/i18n/input-method/uim.nix>\n    <nixpkgs/nixos/modules/i18n/input-method/nabi.nix>\n    <nixpkgs/nixos/modules/i18n/input-method/ibus.nix>\n    <nixpkgs/nixos/modules/i18n/input-method/fcitx.nix>\n    <nixpkgs/nixos/modules/i18n/input-method/default.nix> \n```\n---\n\nThis functionality is useful for any case where modular sum types options could make sense (display managers, window managers, desktop managers modules, ...)\n\ncc @nbp\n###### Things done\n- [ ] Tested using sandboxing\n  ([nix.useSandbox](http://nixos.org/nixos/manual/options.html#opt-nix.useSandbox) on NixOS,\n    or option `build-use-sandbox` in [`nix.conf`](http://nixos.org/nix/manual/#sec-conf-file)\n    on non-NixOS)\n- Built on platform(s)\n  - [x] NixOS\n  - [ ] OS X\n  - [ ] Linux\n- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nox --run \"nox-review wip\"`\n- [ ] Tested execution of all binary files (usually in `./result/bin/`)\n- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).\n---\n","created_at":"2016-09-07T01:14:11Z","updated_at":"2016-11-01T16:49:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ac52d126221583322064a4163fa2690029c4e15","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380/commits","review_comments_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380/comments","review_comment_url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/18380/comments","statuses_url":"https://api.github.com/repos/NixOS/nixpkgs/statuses/9424bd95d28a5739f64433c52ac27771fad1a91b","head":{"label":"ericsagnes:feat/typeMerge","ref":"feat/typeMerge","sha":"9424bd95d28a5739f64433c52ac27771fad1a91b","user":{"login":"ericsagnes","id":367880,"avatar_url":"https://avatars.githubusercontent.com/u/367880?v=3","gravatar_id":"","url":"https://api.github.com/users/ericsagnes","html_url":"https://github.com/ericsagnes","followers_url":"https://api.github.com/users/ericsagnes/followers","following_url":"https://api.github.com/users/ericsagnes/following{/other_user}","gists_url":"https://api.github.com/users/ericsagnes/gists{/gist_id}","starred_url":"https://api.github.com/users/ericsagnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericsagnes/subscriptions","organizations_url":"https://api.github.com/users/ericsagnes/orgs","repos_url":"https://api.github.com/users/ericsagnes/repos","events_url":"https://api.github.com/users/ericsagnes/events{/privacy}","received_events_url":"https://api.github.com/users/ericsagnes/received_events","type":"User","site_admin":false},"repo":{"id":39763321,"name":"nixpkgs","full_name":"ericsagnes/nixpkgs","owner":{"login":"ericsagnes","id":367880,"avatar_url":"https://avatars.githubusercontent.com/u/367880?v=3","gravatar_id":"","url":"https://api.github.com/users/ericsagnes","html_url":"https://github.com/ericsagnes","followers_url":"https://api.github.com/users/ericsagnes/followers","following_url":"https://api.github.com/users/ericsagnes/following{/other_user}","gists_url":"https://api.github.com/users/ericsagnes/gists{/gist_id}","starred_url":"https://api.github.com/users/ericsagnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericsagnes/subscriptions","organizations_url":"https://api.github.com/users/ericsagnes/orgs","repos_url":"https://api.github.com/users/ericsagnes/repos","events_url":"https://api.github.com/users/ericsagnes/events{/privacy}","received_events_url":"https://api.github.com/users/ericsagnes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericsagnes/nixpkgs","description":"Nix Packages collection","fork":true,"url":"https://api.github.com/repos/ericsagnes/nixpkgs","forks_url":"https://api.github.com/repos/ericsagnes/nixpkgs/forks","keys_url":"https://api.github.com/repos/ericsagnes/nixpkgs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericsagnes/nixpkgs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericsagnes/nixpkgs/teams","hooks_url":"https://api.github.com/repos/ericsagnes/nixpkgs/hooks","issue_events_url":"https://api.github.com/repos/ericsagnes/nixpkgs/issues/events{/number}","events_url":"https://api.github.com/repos/ericsagnes/nixpkgs/events","assignees_url":"https://api.github.com/repos/ericsagnes/nixpkgs/assignees{/user}","branches_url":"https://api.github.com/repos/ericsagnes/nixpkgs/branches{/branch}","tags_url":"https://api.github.com/repos/ericsagnes/nixpkgs/tags","blobs_url":"https://api.github.com/repos/ericsagnes/nixpkgs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericsagnes/nixpkgs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericsagnes/nixpkgs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericsagnes/nixpkgs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericsagnes/nixpkgs/statuses/{sha}","languages_url":"https://api.github.com/repos/ericsagnes/nixpkgs/languages","stargazers_url":"https://api.github.com/repos/ericsagnes/nixpkgs/stargazers","contributors_url":"https://api.github.com/repos/ericsagnes/nixpkgs/contributors","subscribers_url":"https://api.github.com/repos/ericsagnes/nixpkgs/subscribers","subscription_url":"https://api.github.com/repos/ericsagnes/nixpkgs/subscription","commits_url":"https://api.github.com/repos/ericsagnes/nixpkgs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericsagnes/nixpkgs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericsagnes/nixpkgs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericsagnes/nixpkgs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericsagnes/nixpkgs/contents/{+path}","compare_url":"https://api.github.com/repos/ericsagnes/nixpkgs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericsagnes/nixpkgs/merges","archive_url":"https://api.github.com/repos/ericsagnes/nixpkgs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericsagnes/nixpkgs/downloads","issues_url":"https://api.github.com/repos/ericsagnes/nixpkgs/issues{/number}","pulls_url":"https://api.github.com/repos/ericsagnes/nixpkgs/pulls{/number}","milestones_url":"https://api.github.com/repos/ericsagnes/nixpkgs/milestones{/number}","notifications_url":"https://api.github.com/repos/ericsagnes/nixpkgs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericsagnes/nixpkgs/labels{/name}","releases_url":"https://api.github.com/repos/ericsagnes/nixpkgs/releases{/id}","deployments_url":"https://api.github.com/repos/ericsagnes/nixpkgs/deployments","created_at":"2015-07-27T08:23:03Z","updated_at":"2016-01-14T04:59:23Z","pushed_at":"2016-11-01T05:08:05Z","git_url":"git://github.com/ericsagnes/nixpkgs.git","ssh_url":"git@github.com:ericsagnes/nixpkgs.git","clone_url":"https://github.com/ericsagnes/nixpkgs.git","svn_url":"https://github.com/ericsagnes/nixpkgs","homepage":null,"size":354129,"stargazers_count":0,"watchers_count":0,"language":"Nix","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NixOS:master","ref":"master","sha":"854e00943b65396d2dadaa9d0e73bec5e34817d8","user":{"login":"NixOS","id":487568,"avatar_url":"https://avatars.githubusercontent.com/u/487568?v=3","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,"name":"nixpkgs","full_name":"NixOS/nixpkgs","owner":{"login":"NixOS","id":487568,"avatar_url":"https://avatars.githubusercontent.com/u/487568?v=3","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},"private":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":"2016-11-01T15:57:14Z","pushed_at":"2016-11-01T15:35:45Z","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":626093,"stargazers_count":1366,"watchers_count":1366,"language":"Nix","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1692,"mirror_url":null,"open_issues_count":1581,"forks":1692,"open_issues":1581,"watchers":1366,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380"},"html":{"href":"https://github.com/NixOS/nixpkgs/pull/18380"},"issue":{"href":"https://api.github.com/repos/NixOS/nixpkgs/issues/18380"},"comments":{"href":"https://api.github.com/repos/NixOS/nixpkgs/issues/18380/comments"},"review_comments":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380/comments"},"review_comment":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NixOS/nixpkgs/pulls/18380/commits"},"statuses":{"href":"https://api.github.com/repos/NixOS/nixpkgs/statuses/9424bd95d28a5739f64433c52ac27771fad1a91b"}}}}
{"actor":{"display_login":"nbp"}}