|
19 | 19 | kernelModule = import ./kernel.nix args; |
20 | 20 | in { |
21 | 21 | options = |
22 | | - { |
23 | | - projectDir = lib.mkOption { |
24 | | - type = types.path; |
25 | | - default = self + "/kernels/available/${kernelName}"; |
26 | | - defaultText = lib.literalExpression "self + \"/kernels/available/${kernelName}\""; |
27 | | - example = lib.literalExpression "self + \"/kernels/${kernelName}\""; |
28 | | - description = lib.mdDoc '' |
29 | | - Path to the root of the poetry project that provides this ${kernelName} |
30 | | - kernel. |
31 | | - ''; |
32 | | - }; |
33 | | - |
34 | | - pyproject = lib.mkOption { |
35 | | - type = types.path; |
36 | | - default = config.projectDir + "/pyproject.toml"; |
37 | | - defaultText = lib.literalExpression "kernel.${kernelName}.<name>.projectDir + \"/pyproject.toml\""; |
38 | | - example = lib.literalExpression "self + \"/kernels/${kernelName}/pyproject.toml\""; |
39 | | - description = '' |
40 | | - Path to `pyproject.toml` of the poetry project that provides this |
41 | | - ${kernelName} kernel. |
42 | | - ''; |
43 | | - }; |
44 | | - |
45 | | - poetrylock = lib.mkOption { |
46 | | - type = types.path; |
47 | | - default = config.projectDir + "/poetry.lock"; |
48 | | - defaultText = lib.literalExpression "kernel.${kernelName}.<name>.projectDir + \"/poetry.lock\""; |
49 | | - example = lib.literalExpression "self + \"/kernels/${kernelName}/poetry.lock\""; |
50 | | - description = '' |
51 | | - Path to `poetry.lock` of the poetry project that provides this |
52 | | - ${kernelName} kernel. |
53 | | - ''; |
54 | | - }; |
55 | | - |
56 | | - overrides = lib.mkOption { |
57 | | - type = types.path; |
58 | | - default = self + "/kernels/available/${kernelName}/overrides.nix"; |
59 | | - defaultText = lib.literalExpression "self + \"/kernels/available/${kernelName}/overrides.nix\""; |
60 | | - example = lib.literalExpression "self + \"/kernels/${kernelName}/overrides.nix\""; |
61 | | - description = '' |
62 | | - Path to `overrides.nix` file which provides python package overrides |
63 | | - for this ${kernelName} kernel. |
64 | | - ''; |
65 | | - }; |
66 | | - |
67 | | - withDefaultOverrides = lib.mkOption { |
68 | | - type = types.bool; |
69 | | - default = true; |
70 | | - example = lib.literalExpression "false"; |
71 | | - description = '' |
72 | | - Should we use default overrides provided by `poetry2nix`. |
73 | | - ''; |
74 | | - }; |
75 | | - |
76 | | - python = lib.mkOption { |
77 | | - type = types.str; |
78 | | - default = "python3"; |
79 | | - example = "python310"; |
80 | | - description = lib.mdDoc '' |
81 | | - Name of the python interpreter (from nixpkgs) to be used for this |
82 | | - ${kernelName} kernel. |
83 | | - ''; |
84 | | - }; |
85 | | - |
86 | | - editablePackageSources = lib.mkOption { |
87 | | - type = types.attrsOf (types.nullOr types.path); |
88 | | - default = {}; |
89 | | - example = lib.literalExpression "{}"; |
90 | | - description = '' |
91 | | - A mapping from package name to source directory, these will be |
92 | | - installed in editable mode. Note that path dependencies with `develop |
93 | | - = true` will be installed in editable mode unless explicitly passed |
94 | | - to `editablePackageSources` as `null`. |
95 | | - ''; |
96 | | - }; |
97 | | - |
98 | | - extraPackages = lib.mkOption { |
99 | | - type = types.functionTo (types.listOf types.package); |
100 | | - default = ps: []; |
101 | | - defaultText = lib.literalExpression "ps: []"; |
102 | | - example = lib.literalExpression "ps: [ps.numpy]"; |
103 | | - description = '' |
104 | | - A function taking a Python package set and returning a list of extra |
105 | | - packages to include in the environment. This is intended for |
106 | | - packages deliberately not added to `pyproject.toml` that you still |
107 | | - want to include. An example of such a package may be `pip`. |
108 | | - ''; |
109 | | - }; |
110 | | - |
111 | | - preferWheels = lib.mkOption { |
112 | | - type = types.bool; |
113 | | - default = false; |
114 | | - example = lib.literalExpression "true"; |
115 | | - description = lib.mdDoc '' |
116 | | - Use wheels rather than sdist as much as possible. |
117 | | - ''; |
118 | | - }; |
119 | | - |
120 | | - groups = lib.mkOption { |
121 | | - type = types.listOf types.str; |
122 | | - default = ["dev"]; |
123 | | - defaultText = lib.literalExpression "[\"dev\"]"; |
124 | | - example = lib.literalExpression ''["dev" "doc"]''; |
125 | | - description = lib.mdDoc '' |
126 | | - Which Poetry 1.2.0+ dependency groups to install for this ${kernelName} |
127 | | - kernel. |
128 | | - ''; |
129 | | - }; |
130 | | - |
131 | | - poetry2nix = lib.mkOption { |
132 | | - type = types.path; |
133 | | - default = self.inputs.poetry2nix; |
134 | | - defaultText = lib.literalExpression "self.inputs.poetry2nix"; |
135 | | - example = lib.literalExpression "self.inputs.poetry2nix"; |
136 | | - description = lib.mdDoc '' |
137 | | - poetry2nix flake input to be used for this ${kernelName} kernel. |
138 | | - ''; |
139 | | - }; |
140 | | - |
141 | | - ignoreCollisions = lib.mkOption { |
142 | | - type = types.bool; |
143 | | - default = false; |
144 | | - example = lib.literalExpression "true"; |
145 | | - description = lib.mdDoc '' |
146 | | - Ignore file collisions inside the environment. |
147 | | - ''; |
148 | | - }; |
149 | | - } |
| 22 | + import ./types/poetry.nix {inherit lib self config kernelName;} |
150 | 23 | // kernelModule.options; |
151 | 24 |
|
152 | 25 | config = lib.mkIf config.enable { |
|
0 commit comments