lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge remote-tracking branch 'nixpkgs/master' into staging-next

Conflicts:
pkgs/development/python-modules/pyvex/default.nix
pkgs/top-level/python-packages.nix

+1245 -1658
+514
doc/contributing/coding-conventions.chapter.md
··· 1 + # Coding conventions {#chap-conventions} 2 + 3 + ## Syntax {#sec-syntax} 4 + 5 + - Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts. 6 + 7 + - Do not use tab characters, i.e. configure your editor to use soft tabs. For instance, use `(setq-default indent-tabs-mode nil)` in Emacs. Everybody has different tab settings so it’s asking for trouble. 8 + 9 + - Use `lowerCamelCase` for variable names, not `UpperCamelCase`. Note, this rule does not apply to package attribute names, which instead follow the rules in <xref linkend="sec-package-naming"/>. 10 + 11 + - Function calls with attribute set arguments are written as 12 + 13 + ```nix 14 + foo { 15 + arg = ...; 16 + } 17 + ``` 18 + 19 + not 20 + 21 + ```nix 22 + foo 23 + { 24 + arg = ...; 25 + } 26 + ``` 27 + 28 + Also fine is 29 + 30 + ```nix 31 + foo { arg = ...; } 32 + ``` 33 + 34 + if it's a short call. 35 + 36 + - In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned: 37 + 38 + ```nix 39 + # A long list. 40 + list = [ 41 + elem1 42 + elem2 43 + elem3 44 + ]; 45 + 46 + # A long attribute set. 47 + attrs = { 48 + attr1 = short_expr; 49 + attr2 = 50 + if true then big_expr else big_expr; 51 + }; 52 + 53 + # Combined 54 + listOfAttrs = [ 55 + { 56 + attr1 = 3; 57 + attr2 = "fff"; 58 + } 59 + { 60 + attr1 = 5; 61 + attr2 = "ggg"; 62 + } 63 + ]; 64 + ``` 65 + 66 + - Short lists or attribute sets can be written on one line: 67 + 68 + ```nix 69 + # A short list. 70 + list = [ elem1 elem2 elem3 ]; 71 + 72 + # A short set. 73 + attrs = { x = 1280; y = 1024; }; 74 + ``` 75 + 76 + - Breaking in the middle of a function argument can give hard-to-read code, like 77 + 78 + ```nix 79 + someFunction { x = 1280; 80 + y = 1024; } otherArg 81 + yetAnotherArg 82 + ``` 83 + 84 + (especially if the argument is very large, spanning multiple lines). 85 + 86 + Better: 87 + 88 + ```nix 89 + someFunction 90 + { x = 1280; y = 1024; } 91 + otherArg 92 + yetAnotherArg 93 + ``` 94 + 95 + or 96 + 97 + ```nix 98 + let res = { x = 1280; y = 1024; }; 99 + in someFunction res otherArg yetAnotherArg 100 + ``` 101 + 102 + - The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e. 103 + 104 + ```nix 105 + { arg1, arg2 }: 106 + assert system == "i686-linux"; 107 + stdenv.mkDerivation { ... 108 + ``` 109 + 110 + not 111 + 112 + ```nix 113 + { arg1, arg2 }: 114 + assert system == "i686-linux"; 115 + stdenv.mkDerivation { ... 116 + ``` 117 + 118 + - Function formal arguments are written as: 119 + 120 + ```nix 121 + { arg1, arg2, arg3 }: 122 + ``` 123 + 124 + but if they don't fit on one line they're written as: 125 + 126 + ```nix 127 + { arg1, arg2, arg3 128 + , arg4, ... 129 + , # Some comment... 130 + argN 131 + }: 132 + ``` 133 + 134 + - Functions should list their expected arguments as precisely as possible. That is, write 135 + 136 + ```nix 137 + { stdenv, fetchurl, perl }: ... 138 + ``` 139 + 140 + instead of 141 + 142 + ```nix 143 + args: with args; ... 144 + ``` 145 + 146 + or 147 + 148 + ```nix 149 + { stdenv, fetchurl, perl, ... }: ... 150 + ``` 151 + 152 + For functions that are truly generic in the number of arguments (such as wrappers around `mkDerivation`) that have some required arguments, you should write them using an `@`-pattern: 153 + 154 + ```nix 155 + { stdenv, doCoverageAnalysis ? false, ... } @ args: 156 + 157 + stdenv.mkDerivation (args // { 158 + ... if doCoverageAnalysis then "bla" else "" ... 159 + }) 160 + ``` 161 + 162 + instead of 163 + 164 + ```nix 165 + args: 166 + 167 + args.stdenv.mkDerivation (args // { 168 + ... if args ? doCoverageAnalysis && args.doCoverageAnalysis then "bla" else "" ... 169 + }) 170 + ``` 171 + 172 + - Arguments should be listed in the order they are used, with the exception of `lib`, which always goes first. 173 + 174 + - Prefer using the top-level `lib` over its alias `stdenv.lib`. `lib` is unrelated to `stdenv`, and so `stdenv.lib` should only be used as a convenience alias when developing to avoid having to modify the function inputs just to test something out. 175 + 176 + ## Package naming {#sec-package-naming} 177 + 178 + The key words _must_, _must not_, _required_, _shall_, _shall not_, _should_, _should not_, _recommended_, _may_, and _optional_ in this section are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). Only _emphasized_ words are to be interpreted in this way. 179 + 180 + In Nixpkgs, there are generally three different names associated with a package: 181 + 182 + - The `name` attribute of the derivation (excluding the version part). This is what most users see, in particular when using `nix-env`. 183 + 184 + - The variable name used for the instantiated package in `all-packages.nix`, and when passing it as a dependency to other functions. Typically this is called the _package attribute name_. This is what Nix expression authors see. It can also be used when installing using `nix-env -iA`. 185 + 186 + - The filename for (the directory containing) the Nix expression. 187 + 188 + Most of the time, these are the same. For instance, the package `e2fsprogs` has a `name` attribute `"e2fsprogs-version"`, is bound to the variable name `e2fsprogs` in `all-packages.nix`, and the Nix expression is in `pkgs/os-specific/linux/e2fsprogs/default.nix`. 189 + 190 + There are a few naming guidelines: 191 + 192 + - The `name` attribute _should_ be identical to the upstream package name. 193 + 194 + - The `name` attribute _must not_ contain uppercase letters — e.g., `"mplayer-1.0rc2"` instead of `"MPlayer-1.0rc2"`. 195 + 196 + - The version part of the `name` attribute _must_ start with a digit (following a dash) — e.g., `"hello-0.3.1rc2"`. 197 + 198 + - If a package is not a release but a commit from a repository, then the version part of the name _must_ be the date of that (fetched) commit. The date _must_ be in `"YYYY-MM-DD"` format. Also append `"unstable"` to the name - e.g., `"pkgname-unstable-2014-09-23"`. 199 + 200 + - Dashes in the package name _should_ be preserved in new variable names, rather than converted to underscores or camel cased — e.g., `http-parser` instead of `http_parser` or `httpParser`. The hyphenated style is preferred in all three package names. 201 + 202 + - If there are multiple versions of a package, this _should_ be reflected in the variable names in `all-packages.nix`, e.g. `json-c-0-9` and `json-c-0-11`. If there is an obvious “default” version, make an attribute like `json-c = json-c-0-9;`. See also <xref linkend="sec-versioning" /> 203 + 204 + ## File naming and organisation {#sec-organisation} 205 + 206 + Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be `all-packages.nix`, not `allPackages.nix` or `AllPackages.nix`. 207 + 208 + ### Hierarchy {#sec-hierarchy} 209 + 210 + Each package should be stored in its own directory somewhere in the `pkgs/` tree, i.e. in `pkgs/category/subcategory/.../pkgname`. Below are some rules for picking the right category for a package. Many packages fall under several categories; what matters is the _primary_ purpose of a package. For example, the `libxml2` package builds both a library and some tools; but it’s a library foremost, so it goes under `pkgs/development/libraries`. 211 + 212 + When in doubt, consider refactoring the `pkgs/` tree, e.g. creating new categories or splitting up an existing category. 213 + 214 + **If it’s used to support _software development_:** 215 + 216 + - **If it’s a _library_ used by other packages:** 217 + 218 + - `development/libraries` (e.g. `libxml2`) 219 + 220 + - **If it’s a _compiler_:** 221 + 222 + - `development/compilers` (e.g. `gcc`) 223 + 224 + - **If it’s an _interpreter_:** 225 + 226 + - `development/interpreters` (e.g. `guile`) 227 + 228 + - **If it’s a (set of) development _tool(s)_:** 229 + 230 + - **If it’s a _parser generator_ (including lexers):** 231 + 232 + - `development/tools/parsing` (e.g. `bison`, `flex`) 233 + 234 + - **If it’s a _build manager_:** 235 + 236 + - `development/tools/build-managers` (e.g. `gnumake`) 237 + 238 + - **Else:** 239 + 240 + - `development/tools/misc` (e.g. `binutils`) 241 + 242 + - **Else:** 243 + 244 + - `development/misc` 245 + 246 + **If it’s a (set of) _tool(s)_:** 247 + 248 + (A tool is a relatively small program, especially one intended to be used non-interactively.) 249 + 250 + - **If it’s for _networking_:** 251 + 252 + - `tools/networking` (e.g. `wget`) 253 + 254 + - **If it’s for _text processing_:** 255 + 256 + - `tools/text` (e.g. `diffutils`) 257 + 258 + - **If it’s a _system utility_, i.e., something related or essential to the operation of a system:** 259 + 260 + - `tools/system` (e.g. `cron`) 261 + 262 + - **If it’s an _archiver_ (which may include a compression function):** 263 + 264 + - `tools/archivers` (e.g. `zip`, `tar`) 265 + 266 + - **If it’s a _compression_ program:** 267 + 268 + - `tools/compression` (e.g. `gzip`, `bzip2`) 269 + 270 + - **If it’s a _security_-related program:** 271 + 272 + - `tools/security` (e.g. `nmap`, `gnupg`) 273 + 274 + - **Else:** 275 + 276 + - `tools/misc` 277 + 278 + **If it’s a _shell_:** 279 + 280 + - `shells` (e.g. `bash`) 281 + 282 + **If it’s a _server_:** 283 + 284 + - **If it’s a web server:** 285 + 286 + - `servers/http` (e.g. `apache-httpd`) 287 + 288 + - **If it’s an implementation of the X Windowing System:** 289 + 290 + - `servers/x11` (e.g. `xorg` — this includes the client libraries and programs) 291 + 292 + - **Else:** 293 + 294 + - `servers/misc` 295 + 296 + **If it’s a _desktop environment_:** 297 + 298 + - `desktops` (e.g. `kde`, `gnome`, `enlightenment`) 299 + 300 + **If it’s a _window manager_:** 301 + 302 + - `applications/window-managers` (e.g. `awesome`, `stumpwm`) 303 + 304 + **If it’s an _application_:** 305 + 306 + A (typically large) program with a distinct user interface, primarily used interactively. 307 + 308 + - **If it’s a _version management system_:** 309 + 310 + - `applications/version-management` (e.g. `subversion`) 311 + 312 + - **If it’s a _terminal emulator_:** 313 + 314 + - `applications/terminal-emulators` (e.g. `alacritty` or `rxvt` or `termite`) 315 + 316 + - **If it’s for _video playback / editing_:** 317 + 318 + - `applications/video` (e.g. `vlc`) 319 + 320 + - **If it’s for _graphics viewing / editing_:** 321 + 322 + - `applications/graphics` (e.g. `gimp`) 323 + 324 + - **If it’s for _networking_:** 325 + 326 + - **If it’s a _mailreader_:** 327 + 328 + - `applications/networking/mailreaders` (e.g. `thunderbird`) 329 + 330 + - **If it’s a _newsreader_:** 331 + 332 + - `applications/networking/newsreaders` (e.g. `pan`) 333 + 334 + - **If it’s a _web browser_:** 335 + 336 + - `applications/networking/browsers` (e.g. `firefox`) 337 + 338 + - **Else:** 339 + 340 + - `applications/networking/misc` 341 + 342 + - **Else:** 343 + 344 + - `applications/misc` 345 + 346 + **If it’s _data_ (i.e., does not have a straight-forward executable semantics):** 347 + 348 + - **If it’s a _font_:** 349 + 350 + - `data/fonts` 351 + 352 + - **If it’s an _icon theme_:** 353 + 354 + - `data/icons` 355 + 356 + - **If it’s related to _SGML/XML processing_:** 357 + 358 + - **If it’s an _XML DTD_:** 359 + 360 + - `data/sgml+xml/schemas/xml-dtd` (e.g. `docbook`) 361 + 362 + - **If it’s an _XSLT stylesheet_:** 363 + 364 + (Okay, these are executable...) 365 + 366 + - `data/sgml+xml/stylesheets/xslt` (e.g. `docbook-xsl`) 367 + 368 + - **If it’s a _theme_ for a _desktop environment_, a _window manager_ or a _display manager_:** 369 + 370 + - `data/themes` 371 + 372 + **If it’s a _game_:** 373 + 374 + - `games` 375 + 376 + **Else:** 377 + 378 + - `misc` 379 + 380 + ### Versioning {#sec-versioning} 381 + 382 + Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be kept unless there is a good reason to do so. For instance, Nixpkgs contains several versions of GCC because other packages don’t build with the latest version of GCC. Other examples are having both the latest stable and latest pre-release version of a package, or to keep several major releases of an application that differ significantly in functionality. 383 + 384 + If there is only one version of a package, its Nix expression should be named `e2fsprogs/default.nix`. If there are multiple versions, this should be reflected in the filename, e.g. `e2fsprogs/1.41.8.nix` and `e2fsprogs/1.41.9.nix`. The version in the filename should leave out unnecessary detail. For instance, if we keep the latest Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named `firefox/2.0.nix` and `firefox/3.5.nix`, respectively (which, at a given point, might contain versions `2.0.0.20` and `3.5.4`). If a version requires many auxiliary files, you can use a subdirectory for each version, e.g. `firefox/2.0/default.nix` and `firefox/3.5/default.nix`. 385 + 386 + All versions of a package _must_ be included in `all-packages.nix` to make sure that they evaluate correctly. 387 + 388 + ## Fetching Sources {#sec-sources} 389 + 390 + There are multiple ways to fetch a package source in nixpkgs. The general guideline is that you should package reproducible sources with a high degree of availability. Right now there is only one fetcher which has mirroring support and that is `fetchurl`. Note that you should also prefer protocols which have a corresponding proxy environment variable. 391 + 392 + You can find many source fetch helpers in `pkgs/build-support/fetch*`. 393 + 394 + In the file `pkgs/top-level/all-packages.nix` you can find fetch helpers, these have names on the form `fetchFrom*`. The intention of these are to provide snapshot fetches but using the same api as some of the version controlled fetchers from `pkgs/build-support/`. As an example going from bad to good: 395 + 396 + - Bad: Uses `git://` which won't be proxied. 397 + 398 + ```nix 399 + src = fetchgit { 400 + url = "git://github.com/NixOS/nix.git"; 401 + rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae"; 402 + sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg"; 403 + } 404 + ``` 405 + 406 + - Better: This is ok, but an archive fetch will still be faster. 407 + 408 + ```nix 409 + src = fetchgit { 410 + url = "https://github.com/NixOS/nix.git"; 411 + rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae"; 412 + sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg"; 413 + } 414 + ``` 415 + 416 + - Best: Fetches a snapshot archive and you get the rev you want. 417 + 418 + ```nix 419 + src = fetchFromGitHub { 420 + owner = "NixOS"; 421 + repo = "nix"; 422 + rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae"; 423 + sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc"; 424 + } 425 + ``` 426 + 427 + Find the value to put as `sha256` by running `nix run -f '<nixpkgs>' nix-prefetch-github -c nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix` or `nix-prefetch-url --unpack https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz`. 428 + 429 + ## Obtaining source hash {#sec-source-hashes} 430 + 431 + Preferred source hash type is sha256. There are several ways to get it. 432 + 433 + 1. Prefetch URL (with `nix-prefetch-XXX URL`, where `XXX` is one of `url`, `git`, `hg`, `cvs`, `bzr`, `svn`). Hash is printed to stdout. 434 + 435 + 2. Prefetch by package source (with `nix-prefetch-url '<nixpkgs>' -A PACKAGE.src`, where `PACKAGE` is package attribute name). Hash is printed to stdout. 436 + 437 + This works well when you've upgraded existing package version and want to find out new hash, but is useless if package can't be accessed by attribute or package has multiple sources (`.srcs`, architecture-dependent sources, etc). 438 + 439 + 3. Upstream provided hash: use it when upstream provides `sha256` or `sha512` (when upstream provides `md5`, don't use it, compute `sha256` instead). 440 + 441 + A little nuance is that `nix-prefetch-*` tools produce hash encoded with `base32`, but upstream usually provides hexadecimal (`base16`) encoding. Fetchers understand both formats. Nixpkgs does not standardize on any one format. 442 + 443 + You can convert between formats with nix-hash, for example: 444 + 445 + ```ShellSession 446 + $ nix-hash --type sha256 --to-base32 HASH 447 + ``` 448 + 449 + 4. Extracting hash from local source tarball can be done with `sha256sum`. Use `nix-prefetch-url file:///path/to/tarball` if you want base32 hash. 450 + 451 + 5. Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints. 452 + 453 + For package updates it is enough to change one symbol to make hash fake. For new packages, you can use `lib.fakeSha256`, `lib.fakeSha512` or any other fake hash. 454 + 455 + This is last resort method when reconstructing source URL is non-trivial and `nix-prefetch-url -A` isn't applicable (for example, [one of `kodi` dependencies](https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73")). The easiest way then would be replace hash with a fake one and rebuild. Nix build will fail and error message will contain desired hash. 456 + 457 + ::: warning 458 + This method has security problems. Check below for details. 459 + ::: 460 + 461 + ### Obtaining hashes securely {#sec-source-hashes-security} 462 + 463 + Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead of fetching source you can fetch malware, and instead of source hash you get hash of malware. Here are security considerations for this scenario: 464 + 465 + - `http://` URLs are not secure to prefetch hash from; 466 + 467 + - hashes from upstream (in method 3) should be obtained via secure protocol; 468 + 469 + - `https://` URLs are secure in methods 1, 2, 3; 470 + 471 + - `https://` URLs are not secure in method 5. When obtaining hashes with fake hash method, TLS checks are disabled. So refetch source hash from several different networks to exclude MITM scenario. Alternatively, use fake hash method to make Nix error, but instead of extracting hash from error, extract `https://` URL and prefetch it with method 1. 472 + 473 + ## Patches {#sec-patches} 474 + 475 + Patches available online should be retrieved using `fetchpatch`. 476 + 477 + ```nix 478 + patches = [ 479 + (fetchpatch { 480 + name = "fix-check-for-using-shared-freetype-lib.patch"; 481 + url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285"; 482 + sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr"; 483 + }) 484 + ]; 485 + ``` 486 + 487 + Otherwise, you can add a `.patch` file to the `nixpkgs` repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to `nixpkgs` should be added in this way. 488 + 489 + ```nix 490 + patches = [ ./0001-changes.patch ]; 491 + ``` 492 + 493 + If you do need to do create this sort of patch file, one way to do so is with git: 494 + 495 + 1. Move to the root directory of the source code you're patching. 496 + 497 + ```ShellSession 498 + $ cd the/program/source 499 + ``` 500 + 501 + 2. If a git repository is not already present, create one and stage all of the source files. 502 + 503 + ```ShellSession 504 + $ git init 505 + $ git add . 506 + ``` 507 + 508 + 3. Edit some files to make whatever changes need to be included in the patch. 509 + 510 + 4. Use git to create a diff, and pipe the output to a patch file: 511 + 512 + ```ShellSession 513 + $ git diff > nixpkgs/pkgs/the/package/0001-changes.patch 514 + ```
-943
doc/contributing/coding-conventions.xml
··· 1 - <chapter xmlns="http://docbook.org/ns/docbook" 2 - xmlns:xlink="http://www.w3.org/1999/xlink" 3 - xml:id="chap-conventions"> 4 - <title>Coding conventions</title> 5 - <section xml:id="sec-syntax"> 6 - <title>Syntax</title> 7 - 8 - <itemizedlist> 9 - <listitem> 10 - <para> 11 - Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts. 12 - </para> 13 - </listitem> 14 - <listitem> 15 - <para> 16 - Do not use tab characters, i.e. configure your editor to use soft tabs. For instance, use <literal>(setq-default indent-tabs-mode nil)</literal> in Emacs. Everybody has different tab settings so it’s asking for trouble. 17 - </para> 18 - </listitem> 19 - <listitem> 20 - <para> 21 - Use <literal>lowerCamelCase</literal> for variable names, not <literal>UpperCamelCase</literal>. Note, this rule does not apply to package attribute names, which instead follow the rules in <xref linkend="sec-package-naming"/>. 22 - </para> 23 - </listitem> 24 - <listitem> 25 - <para> 26 - Function calls with attribute set arguments are written as 27 - <programlisting> 28 - foo { 29 - arg = ...; 30 - } 31 - </programlisting> 32 - not 33 - <programlisting> 34 - foo 35 - { 36 - arg = ...; 37 - } 38 - </programlisting> 39 - Also fine is 40 - <programlisting> 41 - foo { arg = ...; } 42 - </programlisting> 43 - if it's a short call. 44 - </para> 45 - </listitem> 46 - <listitem> 47 - <para> 48 - In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned: 49 - <programlisting> 50 - # A long list. 51 - list = [ 52 - elem1 53 - elem2 54 - elem3 55 - ]; 56 - 57 - # A long attribute set. 58 - attrs = { 59 - attr1 = short_expr; 60 - attr2 = 61 - if true then big_expr else big_expr; 62 - }; 63 - 64 - # Combined 65 - listOfAttrs = [ 66 - { 67 - attr1 = 3; 68 - attr2 = "fff"; 69 - } 70 - { 71 - attr1 = 5; 72 - attr2 = "ggg"; 73 - } 74 - ]; 75 - </programlisting> 76 - </para> 77 - </listitem> 78 - <listitem> 79 - <para> 80 - Short lists or attribute sets can be written on one line: 81 - <programlisting> 82 - # A short list. 83 - list = [ elem1 elem2 elem3 ]; 84 - 85 - # A short set. 86 - attrs = { x = 1280; y = 1024; }; 87 - </programlisting> 88 - </para> 89 - </listitem> 90 - <listitem> 91 - <para> 92 - Breaking in the middle of a function argument can give hard-to-read code, like 93 - <programlisting> 94 - someFunction { x = 1280; 95 - y = 1024; } otherArg 96 - yetAnotherArg 97 - </programlisting> 98 - (especially if the argument is very large, spanning multiple lines). 99 - </para> 100 - <para> 101 - Better: 102 - <programlisting> 103 - someFunction 104 - { x = 1280; y = 1024; } 105 - otherArg 106 - yetAnotherArg 107 - </programlisting> 108 - or 109 - <programlisting> 110 - let res = { x = 1280; y = 1024; }; 111 - in someFunction res otherArg yetAnotherArg 112 - </programlisting> 113 - </para> 114 - </listitem> 115 - <listitem> 116 - <para> 117 - The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e. 118 - <programlisting> 119 - { arg1, arg2 }: 120 - assert system == "i686-linux"; 121 - stdenv.mkDerivation { ... 122 - </programlisting> 123 - not 124 - <programlisting> 125 - { arg1, arg2 }: 126 - assert system == "i686-linux"; 127 - stdenv.mkDerivation { ... 128 - </programlisting> 129 - </para> 130 - </listitem> 131 - <listitem> 132 - <para> 133 - Function formal arguments are written as: 134 - <programlisting> 135 - { arg1, arg2, arg3 }: 136 - </programlisting> 137 - but if they don't fit on one line they're written as: 138 - <programlisting> 139 - { arg1, arg2, arg3 140 - , arg4, ... 141 - , # Some comment... 142 - argN 143 - }: 144 - </programlisting> 145 - </para> 146 - </listitem> 147 - <listitem> 148 - <para> 149 - Functions should list their expected arguments as precisely as possible. That is, write 150 - <programlisting> 151 - { stdenv, fetchurl, perl }: <replaceable>...</replaceable> 152 - </programlisting> 153 - instead of 154 - <programlisting> 155 - args: with args; <replaceable>...</replaceable> 156 - </programlisting> 157 - or 158 - <programlisting> 159 - { stdenv, fetchurl, perl, ... }: <replaceable>...</replaceable> 160 - </programlisting> 161 - </para> 162 - <para> 163 - For functions that are truly generic in the number of arguments (such as wrappers around <varname>mkDerivation</varname>) that have some required arguments, you should write them using an <literal>@</literal>-pattern: 164 - <programlisting> 165 - { stdenv, doCoverageAnalysis ? false, ... } @ args: 166 - 167 - stdenv.mkDerivation (args // { 168 - <replaceable>...</replaceable> if doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable> 169 - }) 170 - </programlisting> 171 - instead of 172 - <programlisting> 173 - args: 174 - 175 - args.stdenv.mkDerivation (args // { 176 - <replaceable>...</replaceable> if args ? doCoverageAnalysis &amp;&amp; args.doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable> 177 - }) 178 - </programlisting> 179 - </para> 180 - </listitem> 181 - <listitem> 182 - <para> 183 - Arguments should be listed in the order they are used, with the exception of <varname>lib</varname>, which always goes first. 184 - </para> 185 - </listitem> 186 - <listitem> 187 - <para> 188 - Prefer using the top-level <varname>lib</varname> over its alias <literal>stdenv.lib</literal>. <varname>lib</varname> is unrelated to <varname>stdenv</varname>, and so <literal>stdenv.lib</literal> should only be used as a convenience alias when developing to avoid having to modify the function inputs just to test something out. 189 - </para> 190 - </listitem> 191 - </itemizedlist> 192 - </section> 193 - <section xml:id="sec-package-naming"> 194 - <title>Package naming</title> 195 - 196 - <para> 197 - The key words <emphasis>must</emphasis>, <emphasis>must not</emphasis>, <emphasis>required</emphasis>, <emphasis>shall</emphasis>, <emphasis>shall not</emphasis>, <emphasis>should</emphasis>, <emphasis>should not</emphasis>, <emphasis>recommended</emphasis>, <emphasis>may</emphasis>, and <emphasis>optional</emphasis> in this section are to be interpreted as described in <link xlink:href="https://tools.ietf.org/html/rfc2119">RFC 2119</link>. Only <emphasis>emphasized</emphasis> words are to be interpreted in this way. 198 - </para> 199 - 200 - <para> 201 - In Nixpkgs, there are generally three different names associated with a package: 202 - <itemizedlist> 203 - <listitem> 204 - <para> 205 - The <varname>name</varname> attribute of the derivation (excluding the version part). This is what most users see, in particular when using <command>nix-env</command>. 206 - </para> 207 - </listitem> 208 - <listitem> 209 - <para> 210 - The variable name used for the instantiated package in <filename>all-packages.nix</filename>, and when passing it as a dependency to other functions. Typically this is called the <emphasis>package attribute name</emphasis>. This is what Nix expression authors see. It can also be used when installing using <command>nix-env -iA</command>. 211 - </para> 212 - </listitem> 213 - <listitem> 214 - <para> 215 - The filename for (the directory containing) the Nix expression. 216 - </para> 217 - </listitem> 218 - </itemizedlist> 219 - Most of the time, these are the same. For instance, the package <literal>e2fsprogs</literal> has a <varname>name</varname> attribute <literal>"e2fsprogs-<replaceable>version</replaceable>"</literal>, is bound to the variable name <varname>e2fsprogs</varname> in <filename>all-packages.nix</filename>, and the Nix expression is in <filename>pkgs/os-specific/linux/e2fsprogs/default.nix</filename>. 220 - </para> 221 - 222 - <para> 223 - There are a few naming guidelines: 224 - <itemizedlist> 225 - <listitem> 226 - <para> 227 - The <literal>name</literal> attribute <emphasis>should</emphasis> be identical to the upstream package name. 228 - </para> 229 - </listitem> 230 - <listitem> 231 - <para> 232 - The <literal>name</literal> attribute <emphasis>must not</emphasis> contain uppercase letters — e.g., <literal>"mplayer-1.0rc2"</literal> instead of <literal>"MPlayer-1.0rc2"</literal>. 233 - </para> 234 - </listitem> 235 - <listitem> 236 - <para> 237 - The version part of the <literal>name</literal> attribute <emphasis>must</emphasis> start with a digit (following a dash) — e.g., <literal>"hello-0.3.1rc2"</literal>. 238 - </para> 239 - </listitem> 240 - <listitem> 241 - <para> 242 - If a package is not a release but a commit from a repository, then the version part of the name <emphasis>must</emphasis> be the date of that (fetched) commit. The date <emphasis>must</emphasis> be in <literal>"YYYY-MM-DD"</literal> format. Also append <literal>"unstable"</literal> to the name - e.g., <literal>"pkgname-unstable-2014-09-23"</literal>. 243 - </para> 244 - </listitem> 245 - <listitem> 246 - <para> 247 - Dashes in the package name <emphasis>should</emphasis> be preserved in new variable names, rather than converted to underscores or camel cased — e.g., <varname>http-parser</varname> instead of <varname>http_parser</varname> or <varname>httpParser</varname>. The hyphenated style is preferred in all three package names. 248 - </para> 249 - </listitem> 250 - <listitem> 251 - <para> 252 - If there are multiple versions of a package, this <emphasis>should</emphasis> be reflected in the variable names in <filename>all-packages.nix</filename>, e.g. <varname>json-c-0-9</varname> and <varname>json-c-0-11</varname>. If there is an obvious “default” version, make an attribute like <literal>json-c = json-c-0-9;</literal>. See also <xref linkend="sec-versioning" /> 253 - </para> 254 - </listitem> 255 - </itemizedlist> 256 - </para> 257 - </section> 258 - <section xml:id="sec-organisation"> 259 - <title>File naming and organisation</title> 260 - 261 - <para> 262 - Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be <filename>all-packages.nix</filename>, not <filename>allPackages.nix</filename> or <filename>AllPackages.nix</filename>. 263 - </para> 264 - 265 - <section xml:id="sec-hierarchy"> 266 - <title>Hierarchy</title> 267 - 268 - <para> 269 - Each package should be stored in its own directory somewhere in the <filename>pkgs/</filename> tree, i.e. in <filename>pkgs/<replaceable>category</replaceable>/<replaceable>subcategory</replaceable>/<replaceable>...</replaceable>/<replaceable>pkgname</replaceable></filename>. Below are some rules for picking the right category for a package. Many packages fall under several categories; what matters is the <emphasis>primary</emphasis> purpose of a package. For example, the <literal>libxml2</literal> package builds both a library and some tools; but it’s a library foremost, so it goes under <filename>pkgs/development/libraries</filename>. 270 - </para> 271 - 272 - <para> 273 - When in doubt, consider refactoring the <filename>pkgs/</filename> tree, e.g. creating new categories or splitting up an existing category. 274 - </para> 275 - 276 - <variablelist> 277 - <varlistentry> 278 - <term> 279 - If it’s used to support <emphasis>software development</emphasis>: 280 - </term> 281 - <listitem> 282 - <variablelist> 283 - <varlistentry> 284 - <term> 285 - If it’s a <emphasis>library</emphasis> used by other packages: 286 - </term> 287 - <listitem> 288 - <para> 289 - <filename>development/libraries</filename> (e.g. <filename>libxml2</filename>) 290 - </para> 291 - </listitem> 292 - </varlistentry> 293 - <varlistentry> 294 - <term> 295 - If it’s a <emphasis>compiler</emphasis>: 296 - </term> 297 - <listitem> 298 - <para> 299 - <filename>development/compilers</filename> (e.g. <filename>gcc</filename>) 300 - </para> 301 - </listitem> 302 - </varlistentry> 303 - <varlistentry> 304 - <term> 305 - If it’s an <emphasis>interpreter</emphasis>: 306 - </term> 307 - <listitem> 308 - <para> 309 - <filename>development/interpreters</filename> (e.g. <filename>guile</filename>) 310 - </para> 311 - </listitem> 312 - </varlistentry> 313 - <varlistentry> 314 - <term> 315 - If it’s a (set of) development <emphasis>tool(s)</emphasis>: 316 - </term> 317 - <listitem> 318 - <variablelist> 319 - <varlistentry> 320 - <term> 321 - If it’s a <emphasis>parser generator</emphasis> (including lexers): 322 - </term> 323 - <listitem> 324 - <para> 325 - <filename>development/tools/parsing</filename> (e.g. <filename>bison</filename>, <filename>flex</filename>) 326 - </para> 327 - </listitem> 328 - </varlistentry> 329 - <varlistentry> 330 - <term> 331 - If it’s a <emphasis>build manager</emphasis>: 332 - </term> 333 - <listitem> 334 - <para> 335 - <filename>development/tools/build-managers</filename> (e.g. <filename>gnumake</filename>) 336 - </para> 337 - </listitem> 338 - </varlistentry> 339 - <varlistentry> 340 - <term> 341 - Else: 342 - </term> 343 - <listitem> 344 - <para> 345 - <filename>development/tools/misc</filename> (e.g. <filename>binutils</filename>) 346 - </para> 347 - </listitem> 348 - </varlistentry> 349 - </variablelist> 350 - </listitem> 351 - </varlistentry> 352 - <varlistentry> 353 - <term> 354 - Else: 355 - </term> 356 - <listitem> 357 - <para> 358 - <filename>development/misc</filename> 359 - </para> 360 - </listitem> 361 - </varlistentry> 362 - </variablelist> 363 - </listitem> 364 - </varlistentry> 365 - <varlistentry> 366 - <term> 367 - If it’s a (set of) <emphasis>tool(s)</emphasis>: 368 - </term> 369 - <listitem> 370 - <para> 371 - (A tool is a relatively small program, especially one intended to be used non-interactively.) 372 - </para> 373 - <variablelist> 374 - <varlistentry> 375 - <term> 376 - If it’s for <emphasis>networking</emphasis>: 377 - </term> 378 - <listitem> 379 - <para> 380 - <filename>tools/networking</filename> (e.g. <filename>wget</filename>) 381 - </para> 382 - </listitem> 383 - </varlistentry> 384 - <varlistentry> 385 - <term> 386 - If it’s for <emphasis>text processing</emphasis>: 387 - </term> 388 - <listitem> 389 - <para> 390 - <filename>tools/text</filename> (e.g. <filename>diffutils</filename>) 391 - </para> 392 - </listitem> 393 - </varlistentry> 394 - <varlistentry> 395 - <term> 396 - If it’s a <emphasis>system utility</emphasis>, i.e., something related or essential to the operation of a system: 397 - </term> 398 - <listitem> 399 - <para> 400 - <filename>tools/system</filename> (e.g. <filename>cron</filename>) 401 - </para> 402 - </listitem> 403 - </varlistentry> 404 - <varlistentry> 405 - <term> 406 - If it’s an <emphasis>archiver</emphasis> (which may include a compression function): 407 - </term> 408 - <listitem> 409 - <para> 410 - <filename>tools/archivers</filename> (e.g. <filename>zip</filename>, <filename>tar</filename>) 411 - </para> 412 - </listitem> 413 - </varlistentry> 414 - <varlistentry> 415 - <term> 416 - If it’s a <emphasis>compression</emphasis> program: 417 - </term> 418 - <listitem> 419 - <para> 420 - <filename>tools/compression</filename> (e.g. <filename>gzip</filename>, <filename>bzip2</filename>) 421 - </para> 422 - </listitem> 423 - </varlistentry> 424 - <varlistentry> 425 - <term> 426 - If it’s a <emphasis>security</emphasis>-related program: 427 - </term> 428 - <listitem> 429 - <para> 430 - <filename>tools/security</filename> (e.g. <filename>nmap</filename>, <filename>gnupg</filename>) 431 - </para> 432 - </listitem> 433 - </varlistentry> 434 - <varlistentry> 435 - <term> 436 - Else: 437 - </term> 438 - <listitem> 439 - <para> 440 - <filename>tools/misc</filename> 441 - </para> 442 - </listitem> 443 - </varlistentry> 444 - </variablelist> 445 - </listitem> 446 - </varlistentry> 447 - <varlistentry> 448 - <term> 449 - If it’s a <emphasis>shell</emphasis>: 450 - </term> 451 - <listitem> 452 - <para> 453 - <filename>shells</filename> (e.g. <filename>bash</filename>) 454 - </para> 455 - </listitem> 456 - </varlistentry> 457 - <varlistentry> 458 - <term> 459 - If it’s a <emphasis>server</emphasis>: 460 - </term> 461 - <listitem> 462 - <variablelist> 463 - <varlistentry> 464 - <term> 465 - If it’s a web server: 466 - </term> 467 - <listitem> 468 - <para> 469 - <filename>servers/http</filename> (e.g. <filename>apache-httpd</filename>) 470 - </para> 471 - </listitem> 472 - </varlistentry> 473 - <varlistentry> 474 - <term> 475 - If it’s an implementation of the X Windowing System: 476 - </term> 477 - <listitem> 478 - <para> 479 - <filename>servers/x11</filename> (e.g. <filename>xorg</filename> — this includes the client libraries and programs) 480 - </para> 481 - </listitem> 482 - </varlistentry> 483 - <varlistentry> 484 - <term> 485 - Else: 486 - </term> 487 - <listitem> 488 - <para> 489 - <filename>servers/misc</filename> 490 - </para> 491 - </listitem> 492 - </varlistentry> 493 - </variablelist> 494 - </listitem> 495 - </varlistentry> 496 - <varlistentry> 497 - <term> 498 - If it’s a <emphasis>desktop environment</emphasis>: 499 - </term> 500 - <listitem> 501 - <para> 502 - <filename>desktops</filename> (e.g. <filename>kde</filename>, <filename>gnome</filename>, <filename>enlightenment</filename>) 503 - </para> 504 - </listitem> 505 - </varlistentry> 506 - <varlistentry> 507 - <term> 508 - If it’s a <emphasis>window manager</emphasis>: 509 - </term> 510 - <listitem> 511 - <para> 512 - <filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>) 513 - </para> 514 - </listitem> 515 - </varlistentry> 516 - <varlistentry> 517 - <term> 518 - If it’s an <emphasis>application</emphasis>: 519 - </term> 520 - <listitem> 521 - <para> 522 - A (typically large) program with a distinct user interface, primarily used interactively. 523 - </para> 524 - <variablelist> 525 - <varlistentry> 526 - <term> 527 - If it’s a <emphasis>version management system</emphasis>: 528 - </term> 529 - <listitem> 530 - <para> 531 - <filename>applications/version-management</filename> (e.g. <filename>subversion</filename>) 532 - </para> 533 - </listitem> 534 - </varlistentry> 535 - <varlistentry> 536 - <term> 537 - If it’s a <emphasis>terminal emulator</emphasis>: 538 - </term> 539 - <listitem> 540 - <para> 541 - <filename>applications/terminal-emulators</filename> (e.g. <filename>alacritty</filename> or <filename>rxvt</filename> or <filename>termite</filename>) 542 - </para> 543 - </listitem> 544 - </varlistentry> 545 - <varlistentry> 546 - <term> 547 - If it’s for <emphasis>video playback / editing</emphasis>: 548 - </term> 549 - <listitem> 550 - <para> 551 - <filename>applications/video</filename> (e.g. <filename>vlc</filename>) 552 - </para> 553 - </listitem> 554 - </varlistentry> 555 - <varlistentry> 556 - <term> 557 - If it’s for <emphasis>graphics viewing / editing</emphasis>: 558 - </term> 559 - <listitem> 560 - <para> 561 - <filename>applications/graphics</filename> (e.g. <filename>gimp</filename>) 562 - </para> 563 - </listitem> 564 - </varlistentry> 565 - <varlistentry> 566 - <term> 567 - If it’s for <emphasis>networking</emphasis>: 568 - </term> 569 - <listitem> 570 - <variablelist> 571 - <varlistentry> 572 - <term> 573 - If it’s a <emphasis>mailreader</emphasis>: 574 - </term> 575 - <listitem> 576 - <para> 577 - <filename>applications/networking/mailreaders</filename> (e.g. <filename>thunderbird</filename>) 578 - </para> 579 - </listitem> 580 - </varlistentry> 581 - <varlistentry> 582 - <term> 583 - If it’s a <emphasis>newsreader</emphasis>: 584 - </term> 585 - <listitem> 586 - <para> 587 - <filename>applications/networking/newsreaders</filename> (e.g. <filename>pan</filename>) 588 - </para> 589 - </listitem> 590 - </varlistentry> 591 - <varlistentry> 592 - <term> 593 - If it’s a <emphasis>web browser</emphasis>: 594 - </term> 595 - <listitem> 596 - <para> 597 - <filename>applications/networking/browsers</filename> (e.g. <filename>firefox</filename>) 598 - </para> 599 - </listitem> 600 - </varlistentry> 601 - <varlistentry> 602 - <term> 603 - Else: 604 - </term> 605 - <listitem> 606 - <para> 607 - <filename>applications/networking/misc</filename> 608 - </para> 609 - </listitem> 610 - </varlistentry> 611 - </variablelist> 612 - </listitem> 613 - </varlistentry> 614 - <varlistentry> 615 - <term> 616 - Else: 617 - </term> 618 - <listitem> 619 - <para> 620 - <filename>applications/misc</filename> 621 - </para> 622 - </listitem> 623 - </varlistentry> 624 - </variablelist> 625 - </listitem> 626 - </varlistentry> 627 - <varlistentry> 628 - <term> 629 - If it’s <emphasis>data</emphasis> (i.e., does not have a straight-forward executable semantics): 630 - </term> 631 - <listitem> 632 - <variablelist> 633 - <varlistentry> 634 - <term> 635 - If it’s a <emphasis>font</emphasis>: 636 - </term> 637 - <listitem> 638 - <para> 639 - <filename>data/fonts</filename> 640 - </para> 641 - </listitem> 642 - </varlistentry> 643 - <varlistentry> 644 - <term> 645 - If it’s an <emphasis>icon theme</emphasis>: 646 - </term> 647 - <listitem> 648 - <para> 649 - <filename>data/icons</filename> 650 - </para> 651 - </listitem> 652 - </varlistentry> 653 - <varlistentry> 654 - <term> 655 - If it’s related to <emphasis>SGML/XML processing</emphasis>: 656 - </term> 657 - <listitem> 658 - <variablelist> 659 - <varlistentry> 660 - <term> 661 - If it’s an <emphasis>XML DTD</emphasis>: 662 - </term> 663 - <listitem> 664 - <para> 665 - <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g. <filename>docbook</filename>) 666 - </para> 667 - </listitem> 668 - </varlistentry> 669 - <varlistentry> 670 - <term> 671 - If it’s an <emphasis>XSLT stylesheet</emphasis>: 672 - </term> 673 - <listitem> 674 - <para> 675 - (Okay, these are executable...) 676 - </para> 677 - <para> 678 - <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g. <filename>docbook-xsl</filename>) 679 - </para> 680 - </listitem> 681 - </varlistentry> 682 - </variablelist> 683 - </listitem> 684 - </varlistentry> 685 - <varlistentry> 686 - <term> 687 - If it’s a <emphasis>theme</emphasis> for a <emphasis>desktop environment</emphasis>, a <emphasis>window manager</emphasis> or a <emphasis>display manager</emphasis>: 688 - </term> 689 - <listitem> 690 - <para> 691 - <filename>data/themes</filename> 692 - </para> 693 - </listitem> 694 - </varlistentry> 695 - </variablelist> 696 - </listitem> 697 - </varlistentry> 698 - <varlistentry> 699 - <term> 700 - If it’s a <emphasis>game</emphasis>: 701 - </term> 702 - <listitem> 703 - <para> 704 - <filename>games</filename> 705 - </para> 706 - </listitem> 707 - </varlistentry> 708 - <varlistentry> 709 - <term> 710 - Else: 711 - </term> 712 - <listitem> 713 - <para> 714 - <filename>misc</filename> 715 - </para> 716 - </listitem> 717 - </varlistentry> 718 - </variablelist> 719 - </section> 720 - 721 - <section xml:id="sec-versioning"> 722 - <title>Versioning</title> 723 - 724 - <para> 725 - Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be kept unless there is a good reason to do so. For instance, Nixpkgs contains several versions of GCC because other packages don’t build with the latest version of GCC. Other examples are having both the latest stable and latest pre-release version of a package, or to keep several major releases of an application that differ significantly in functionality. 726 - </para> 727 - 728 - <para> 729 - If there is only one version of a package, its Nix expression should be named <filename>e2fsprogs/default.nix</filename>. If there are multiple versions, this should be reflected in the filename, e.g. <filename>e2fsprogs/1.41.8.nix</filename> and <filename>e2fsprogs/1.41.9.nix</filename>. The version in the filename should leave out unnecessary detail. For instance, if we keep the latest Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named <filename>firefox/2.0.nix</filename> and <filename>firefox/3.5.nix</filename>, respectively (which, at a given point, might contain versions <literal>2.0.0.20</literal> and <literal>3.5.4</literal>). If a version requires many auxiliary files, you can use a subdirectory for each version, e.g. <filename>firefox/2.0/default.nix</filename> and <filename>firefox/3.5/default.nix</filename>. 730 - </para> 731 - 732 - <para> 733 - All versions of a package <emphasis>must</emphasis> be included in <filename>all-packages.nix</filename> to make sure that they evaluate correctly. 734 - </para> 735 - </section> 736 - </section> 737 - <section xml:id="sec-sources"> 738 - <title>Fetching Sources</title> 739 - 740 - <para> 741 - There are multiple ways to fetch a package source in nixpkgs. The general guideline is that you should package reproducible sources with a high degree of availability. Right now there is only one fetcher which has mirroring support and that is <literal>fetchurl</literal>. Note that you should also prefer protocols which have a corresponding proxy environment variable. 742 - </para> 743 - 744 - <para> 745 - You can find many source fetch helpers in <literal>pkgs/build-support/fetch*</literal>. 746 - </para> 747 - 748 - <para> 749 - In the file <literal>pkgs/top-level/all-packages.nix</literal> you can find fetch helpers, these have names on the form <literal>fetchFrom*</literal>. The intention of these are to provide snapshot fetches but using the same api as some of the version controlled fetchers from <literal>pkgs/build-support/</literal>. As an example going from bad to good: 750 - <itemizedlist> 751 - <listitem> 752 - <para> 753 - Bad: Uses <literal>git://</literal> which won't be proxied. 754 - <programlisting> 755 - src = fetchgit { 756 - url = "git://github.com/NixOS/nix.git"; 757 - rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae"; 758 - sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg"; 759 - } 760 - </programlisting> 761 - </para> 762 - </listitem> 763 - <listitem> 764 - <para> 765 - Better: This is ok, but an archive fetch will still be faster. 766 - <programlisting> 767 - src = fetchgit { 768 - url = "https://github.com/NixOS/nix.git"; 769 - rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae"; 770 - sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg"; 771 - } 772 - </programlisting> 773 - </para> 774 - </listitem> 775 - <listitem> 776 - <para> 777 - Best: Fetches a snapshot archive and you get the rev you want. 778 - <programlisting> 779 - src = fetchFromGitHub { 780 - owner = "NixOS"; 781 - repo = "nix"; 782 - rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae"; 783 - sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc"; 784 - } 785 - </programlisting> 786 - Find the value to put as <literal>sha256</literal> by running <literal>nix run -f '&lt;nixpkgs&gt;' nix-prefetch-github -c nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix</literal> or <literal>nix-prefetch-url --unpack https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz</literal>. 787 - </para> 788 - </listitem> 789 - </itemizedlist> 790 - </para> 791 - </section> 792 - <section xml:id="sec-source-hashes"> 793 - <title>Obtaining source hash</title> 794 - 795 - <para> 796 - Preferred source hash type is sha256. There are several ways to get it. 797 - </para> 798 - 799 - <orderedlist> 800 - <listitem> 801 - <para> 802 - Prefetch URL (with <literal>nix-prefetch-<replaceable>XXX</replaceable> <replaceable>URL</replaceable></literal>, where <replaceable>XXX</replaceable> is one of <literal>url</literal>, <literal>git</literal>, <literal>hg</literal>, <literal>cvs</literal>, <literal>bzr</literal>, <literal>svn</literal>). Hash is printed to stdout. 803 - </para> 804 - </listitem> 805 - <listitem> 806 - <para> 807 - Prefetch by package source (with <literal>nix-prefetch-url '&lt;nixpkgs&gt;' -A <replaceable>PACKAGE</replaceable>.src</literal>, where <replaceable>PACKAGE</replaceable> is package attribute name). Hash is printed to stdout. 808 - </para> 809 - <para> 810 - This works well when you've upgraded existing package version and want to find out new hash, but is useless if package can't be accessed by attribute or package has multiple sources (<literal>.srcs</literal>, architecture-dependent sources, etc). 811 - </para> 812 - </listitem> 813 - <listitem> 814 - <para> 815 - Upstream provided hash: use it when upstream provides <literal>sha256</literal> or <literal>sha512</literal> (when upstream provides <literal>md5</literal>, don't use it, compute <literal>sha256</literal> instead). 816 - </para> 817 - <para> 818 - A little nuance is that <literal>nix-prefetch-*</literal> tools produce hash encoded with <literal>base32</literal>, but upstream usually provides hexadecimal (<literal>base16</literal>) encoding. Fetchers understand both formats. Nixpkgs does not standardize on any one format. 819 - </para> 820 - <para> 821 - You can convert between formats with nix-hash, for example: 822 - <screen> 823 - <prompt>$ </prompt>nix-hash --type sha256 --to-base32 <replaceable>HASH</replaceable> 824 - </screen> 825 - </para> 826 - </listitem> 827 - <listitem> 828 - <para> 829 - Extracting hash from local source tarball can be done with <literal>sha256sum</literal>. Use <literal>nix-prefetch-url file:///path/to/tarball </literal> if you want base32 hash. 830 - </para> 831 - </listitem> 832 - <listitem> 833 - <para> 834 - Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints. 835 - </para> 836 - <para> 837 - For package updates it is enough to change one symbol to make hash fake. For new packages, you can use <literal>lib.fakeSha256</literal>, <literal>lib.fakeSha512</literal> or any other fake hash. 838 - </para> 839 - <para> 840 - This is last resort method when reconstructing source URL is non-trivial and <literal>nix-prefetch-url -A</literal> isn't applicable (for example, <link xlink:href="https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73"> one of <literal>kodi</literal> dependencies</link>). The easiest way then would be replace hash with a fake one and rebuild. Nix build will fail and error message will contain desired hash. 841 - </para> 842 - <warning> 843 - <para> 844 - This method has security problems. Check below for details. 845 - </para> 846 - </warning> 847 - </listitem> 848 - </orderedlist> 849 - 850 - <section xml:id="sec-source-hashes-security"> 851 - <title>Obtaining hashes securely</title> 852 - 853 - <para> 854 - Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead of fetching source you can fetch malware, and instead of source hash you get hash of malware. Here are security considerations for this scenario: 855 - </para> 856 - 857 - <itemizedlist> 858 - <listitem> 859 - <para> 860 - <literal>http://</literal> URLs are not secure to prefetch hash from; 861 - </para> 862 - </listitem> 863 - <listitem> 864 - <para> 865 - hashes from upstream (in method 3) should be obtained via secure protocol; 866 - </para> 867 - </listitem> 868 - <listitem> 869 - <para> 870 - <literal>https://</literal> URLs are secure in methods 1, 2, 3; 871 - </para> 872 - </listitem> 873 - <listitem> 874 - <para> 875 - <literal>https://</literal> URLs are not secure in method 5. When obtaining hashes with fake hash method, TLS checks are disabled. So refetch source hash from several different networks to exclude MITM scenario. Alternatively, use fake hash method to make Nix error, but instead of extracting hash from error, extract <literal>https://</literal> URL and prefetch it with method 1. 876 - </para> 877 - </listitem> 878 - </itemizedlist> 879 - </section> 880 - </section> 881 - <section xml:id="sec-patches"> 882 - <title>Patches</title> 883 - 884 - <para> 885 - Patches available online should be retrieved using <literal>fetchpatch</literal>. 886 - </para> 887 - 888 - <para> 889 - <programlisting> 890 - patches = [ 891 - (fetchpatch { 892 - name = "fix-check-for-using-shared-freetype-lib.patch"; 893 - url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285"; 894 - sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr"; 895 - }) 896 - ]; 897 - </programlisting> 898 - </para> 899 - 900 - <para> 901 - Otherwise, you can add a <literal>.patch</literal> file to the <literal>nixpkgs</literal> repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to <literal>nixpkgs</literal> should be added in this way. 902 - </para> 903 - 904 - <para> 905 - <programlisting> 906 - patches = [ ./0001-changes.patch ]; 907 - </programlisting> 908 - </para> 909 - 910 - <para> 911 - If you do need to do create this sort of patch file, one way to do so is with git: 912 - <orderedlist> 913 - <listitem> 914 - <para> 915 - Move to the root directory of the source code you're patching. 916 - <screen> 917 - <prompt>$ </prompt>cd the/program/source</screen> 918 - </para> 919 - </listitem> 920 - <listitem> 921 - <para> 922 - If a git repository is not already present, create one and stage all of the source files. 923 - <screen> 924 - <prompt>$ </prompt>git init 925 - <prompt>$ </prompt>git add .</screen> 926 - </para> 927 - </listitem> 928 - <listitem> 929 - <para> 930 - Edit some files to make whatever changes need to be included in the patch. 931 - </para> 932 - </listitem> 933 - <listitem> 934 - <para> 935 - Use git to create a diff, and pipe the output to a patch file: 936 - <screen> 937 - <prompt>$ </prompt>git diff > nixpkgs/pkgs/the/package/0001-changes.patch</screen> 938 - </para> 939 - </listitem> 940 - </orderedlist> 941 - </para> 942 - </section> 943 - </chapter>
+24
doc/contributing/contributing-to-documentation.chapter.md
··· 1 + # Contributing to this documentation {#chap-contributing} 2 + 3 + The DocBook sources of the Nixpkgs manual are in the [doc](https://github.com/NixOS/nixpkgs/tree/master/doc) subdirectory of the Nixpkgs repository. 4 + 5 + You can quickly check your edits with `make`: 6 + 7 + ```ShellSession 8 + $ cd /path/to/nixpkgs/doc 9 + $ nix-shell 10 + [nix-shell]$ make $makeFlags 11 + ``` 12 + 13 + If you experience problems, run `make debug` to help understand the docbook errors. 14 + 15 + After making modifications to the manual, it's important to build it before committing. You can do that as follows: 16 + 17 + ```ShellSession 18 + $ cd /path/to/nixpkgs/doc 19 + $ nix-shell 20 + [nix-shell]$ make clean 21 + [nix-shell]$ nix-build . 22 + ``` 23 + 24 + If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual.html`.
-30
doc/contributing/contributing-to-documentation.xml
··· 1 - <chapter xmlns="http://docbook.org/ns/docbook" 2 - xmlns:xlink="http://www.w3.org/1999/xlink" 3 - xml:id="chap-contributing"> 4 - <title>Contributing to this documentation</title> 5 - <para> 6 - The DocBook sources of the Nixpkgs manual are in the <filename 7 - xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename> subdirectory of the Nixpkgs repository. 8 - </para> 9 - <para> 10 - You can quickly check your edits with <command>make</command>: 11 - </para> 12 - <screen> 13 - <prompt>$ </prompt>cd /path/to/nixpkgs/doc 14 - <prompt>$ </prompt>nix-shell 15 - <prompt>[nix-shell]$ </prompt>make $makeFlags 16 - </screen> 17 - <para> 18 - If you experience problems, run <command>make debug</command> to help understand the docbook errors. 19 - </para> 20 - <para> 21 - After making modifications to the manual, it's important to build it before committing. You can do that as follows: 22 - <screen> 23 - <prompt>$ </prompt>cd /path/to/nixpkgs/doc 24 - <prompt>$ </prompt>nix-shell 25 - <prompt>[nix-shell]$ </prompt>make clean 26 - <prompt>[nix-shell]$ </prompt>nix-build . 27 - </screen> 28 - If the build succeeds, the manual will be in <filename>./result/share/doc/nixpkgs/manual.html</filename>. 29 - </para> 30 - </chapter>
+77
doc/contributing/quick-start.chapter.md
··· 1 + # Quick Start to Adding a Package {#chap-quick-start} 2 + 3 + To add a package to Nixpkgs: 4 + 5 + 1. Checkout the Nixpkgs source tree: 6 + 7 + ```ShellSession 8 + $ git clone https://github.com/NixOS/nixpkgs 9 + $ cd nixpkgs 10 + ``` 11 + 12 + 2. Find a good place in the Nixpkgs tree to add the Nix expression for your package. For instance, a library package typically goes into `pkgs/development/libraries/pkgname`, while a web browser goes into `pkgs/applications/networking/browsers/pkgname`. See <xref linkend="sec-organisation" /> for some hints on the tree organisation. Create a directory for your package, e.g. 13 + 14 + ```ShellSession 15 + $ mkdir pkgs/development/libraries/libfoo 16 + ``` 17 + 18 + 3. In the package directory, create a Nix expression — a piece of code that describes how to build the package. In this case, it should be a _function_ that is called with the package dependencies as arguments, and returns a build of the package in the Nix store. The expression should usually be called `default.nix`. 19 + 20 + ```ShellSession 21 + $ emacs pkgs/development/libraries/libfoo/default.nix 22 + $ git add pkgs/development/libraries/libfoo/default.nix 23 + ``` 24 + 25 + You can have a look at the existing Nix expressions under `pkgs/` to see how it’s done. Here are some good ones: 26 + 27 + - GNU Hello: [`pkgs/applications/misc/hello/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix). Trivial package, which specifies some `meta` attributes which is good practice. 28 + 29 + - GNU cpio: [`pkgs/tools/archivers/cpio/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/archivers/cpio/default.nix). Also a simple package. The generic builder in `stdenv` does everything for you. It has no dependencies beyond `stdenv`. 30 + 31 + - GNU Multiple Precision arithmetic library (GMP): [`pkgs/development/libraries/gmp/5.1.x.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix). Also done by the generic builder, but has a dependency on `m4`. 32 + 33 + - Pan, a GTK-based newsreader: [`pkgs/applications/networking/newsreaders/pan/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix). Has an optional dependency on `gtkspell`, which is only built if `spellCheck` is `true`. 34 + 35 + - Apache HTTPD: [`pkgs/servers/http/apache-httpd/2.4.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix). A bunch of optional features, variable substitutions in the configure flags, a post-install hook, and miscellaneous hackery. 36 + 37 + - Thunderbird: [`pkgs/applications/networking/mailreaders/thunderbird/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix). Lots of dependencies. 38 + 39 + - JDiskReport, a Java utility: [`pkgs/tools/misc/jdiskreport/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix). Nixpkgs doesn’t have a decent `stdenv` for Java yet so this is pretty ad-hoc. 40 + 41 + - XML::Simple, a Perl module: [`pkgs/top-level/perl-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix) (search for the `XMLSimple` attribute). Most Perl modules are so simple to build that they are defined directly in `perl-packages.nix`; no need to make a separate file for them. 42 + 43 + - Adobe Reader: [`pkgs/applications/misc/adobe-reader/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix). Shows how binary-only packages can be supported. In particular the [builder](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh) uses `patchelf` to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime. 44 + 45 + Some notes: 46 + 47 + - All [`meta`](#chap-meta) attributes are optional, but it’s still a good idea to provide at least the `description`, `homepage` and [`license`](#sec-meta-license). 48 + 49 + - You can use `nix-prefetch-url url` to get the SHA-256 hash of source distributions. There are similar commands as `nix-prefetch-git` and `nix-prefetch-hg` available in `nix-prefetch-scripts` package. 50 + 51 + - A list of schemes for `mirror://` URLs can be found in [`pkgs/build-support/fetchurl/mirrors.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix). 52 + 53 + The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the [chapter on writing Nix expressions](https://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions). 54 + 55 + 4. Add a call to the function defined in the previous step to [`pkgs/top-level/all-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix) with some descriptive name for the variable, e.g. `libfoo`. 56 + 57 + ```ShellSession 58 + $ emacs pkgs/top-level/all-packages.nix 59 + ``` 60 + 61 + The attributes in that file are sorted by category (like “Development / Libraries”) that more-or-less correspond to the directory structure of Nixpkgs, and then by attribute name. 62 + 63 + 5. To test whether the package builds, run the following command from the root of the nixpkgs source tree: 64 + 65 + ```ShellSession 66 + $ nix-build -A libfoo 67 + ``` 68 + 69 + where `libfoo` should be the variable name defined in the previous step. You may want to add the flag `-K` to keep the temporary build directory in case something fails. If the build succeeds, a symlink `./result` to the package in the Nix store is created. 70 + 71 + 6. If you want to install the package into your profile (optional), do 72 + 73 + ```ShellSession 74 + $ nix-env -f . -iA libfoo 75 + ``` 76 + 77 + 7. Optionally commit the new package and open a pull request [to nixpkgs](https://github.com/NixOS/nixpkgs/pulls), or use [the Patches category](https://discourse.nixos.org/t/about-the-patches-category/477) on Discourse for sending a patch without a GitHub account.
-152
doc/contributing/quick-start.xml
··· 1 - <chapter xmlns="http://docbook.org/ns/docbook" 2 - xmlns:xlink="http://www.w3.org/1999/xlink" 3 - xml:id="chap-quick-start"> 4 - <title>Quick Start to Adding a Package</title> 5 - <para> 6 - To add a package to Nixpkgs: 7 - <orderedlist> 8 - <listitem> 9 - <para> 10 - Checkout the Nixpkgs source tree: 11 - <screen> 12 - <prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs 13 - <prompt>$ </prompt>cd nixpkgs</screen> 14 - </para> 15 - </listitem> 16 - <listitem> 17 - <para> 18 - Find a good place in the Nixpkgs tree to add the Nix expression for your package. For instance, a library package typically goes into <filename>pkgs/development/libraries/<replaceable>pkgname</replaceable></filename>, while a web browser goes into <filename>pkgs/applications/networking/browsers/<replaceable>pkgname</replaceable></filename>. See <xref linkend="sec-organisation" /> for some hints on the tree organisation. Create a directory for your package, e.g. 19 - <screen> 20 - <prompt>$ </prompt>mkdir pkgs/development/libraries/libfoo</screen> 21 - </para> 22 - </listitem> 23 - <listitem> 24 - <para> 25 - In the package directory, create a Nix expression — a piece of code that describes how to build the package. In this case, it should be a <emphasis>function</emphasis> that is called with the package dependencies as arguments, and returns a build of the package in the Nix store. The expression should usually be called <filename>default.nix</filename>. 26 - <screen> 27 - <prompt>$ </prompt>emacs pkgs/development/libraries/libfoo/default.nix 28 - <prompt>$ </prompt>git add pkgs/development/libraries/libfoo/default.nix</screen> 29 - </para> 30 - <para> 31 - You can have a look at the existing Nix expressions under <filename>pkgs/</filename> to see how it’s done. Here are some good ones: 32 - <itemizedlist> 33 - <listitem> 34 - <para> 35 - GNU Hello: <link 36 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix"><filename>pkgs/applications/misc/hello/default.nix</filename></link>. Trivial package, which specifies some <varname>meta</varname> attributes which is good practice. 37 - </para> 38 - </listitem> 39 - <listitem> 40 - <para> 41 - GNU cpio: <link 42 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/archivers/cpio/default.nix"><filename>pkgs/tools/archivers/cpio/default.nix</filename></link>. Also a simple package. The generic builder in <varname>stdenv</varname> does everything for you. It has no dependencies beyond <varname>stdenv</varname>. 43 - </para> 44 - </listitem> 45 - <listitem> 46 - <para> 47 - GNU Multiple Precision arithmetic library (GMP): <link 48 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix"><filename>pkgs/development/libraries/gmp/5.1.x.nix</filename></link>. Also done by the generic builder, but has a dependency on <varname>m4</varname>. 49 - </para> 50 - </listitem> 51 - <listitem> 52 - <para> 53 - Pan, a GTK-based newsreader: <link 54 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix"><filename>pkgs/applications/networking/newsreaders/pan/default.nix</filename></link>. Has an optional dependency on <varname>gtkspell</varname>, which is only built if <varname>spellCheck</varname> is <literal>true</literal>. 55 - </para> 56 - </listitem> 57 - <listitem> 58 - <para> 59 - Apache HTTPD: <link 60 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix"><filename>pkgs/servers/http/apache-httpd/2.4.nix</filename></link>. A bunch of optional features, variable substitutions in the configure flags, a post-install hook, and miscellaneous hackery. 61 - </para> 62 - </listitem> 63 - <listitem> 64 - <para> 65 - Thunderbird: <link 66 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/default.nix</filename></link>. Lots of dependencies. 67 - </para> 68 - </listitem> 69 - <listitem> 70 - <para> 71 - JDiskReport, a Java utility: <link 72 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix"><filename>pkgs/tools/misc/jdiskreport/default.nix</filename></link>. Nixpkgs doesn’t have a decent <varname>stdenv</varname> for Java yet so this is pretty ad-hoc. 73 - </para> 74 - </listitem> 75 - <listitem> 76 - <para> 77 - XML::Simple, a Perl module: <link 78 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link> (search for the <varname>XMLSimple</varname> attribute). Most Perl modules are so simple to build that they are defined directly in <filename>perl-packages.nix</filename>; no need to make a separate file for them. 79 - </para> 80 - </listitem> 81 - <listitem> 82 - <para> 83 - Adobe Reader: <link 84 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix"><filename>pkgs/applications/misc/adobe-reader/default.nix</filename></link>. Shows how binary-only packages can be supported. In particular the <link 85 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh">builder</link> uses <command>patchelf</command> to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime. 86 - </para> 87 - </listitem> 88 - </itemizedlist> 89 - </para> 90 - <para> 91 - Some notes: 92 - <itemizedlist> 93 - <listitem> 94 - <para> 95 - All <varname linkend="chap-meta">meta</varname> attributes are optional, but it’s still a good idea to provide at least the <varname>description</varname>, <varname>homepage</varname> and <varname 96 - linkend="sec-meta-license">license</varname>. 97 - </para> 98 - </listitem> 99 - <listitem> 100 - <para> 101 - You can use <command>nix-prefetch-url</command> <replaceable>url</replaceable> to get the SHA-256 hash of source distributions. There are similar commands as <command>nix-prefetch-git</command> and <command>nix-prefetch-hg</command> available in <literal>nix-prefetch-scripts</literal> package. 102 - </para> 103 - </listitem> 104 - <listitem> 105 - <para> 106 - A list of schemes for <literal>mirror://</literal> URLs can be found in <link 107 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix"><filename>pkgs/build-support/fetchurl/mirrors.nix</filename></link>. 108 - </para> 109 - </listitem> 110 - </itemizedlist> 111 - </para> 112 - <para> 113 - The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the <link 114 - xlink:href="https://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions">chapter on writing Nix expressions</link>. 115 - </para> 116 - </listitem> 117 - <listitem> 118 - <para> 119 - Add a call to the function defined in the previous step to <link 120 - xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix"><filename>pkgs/top-level/all-packages.nix</filename></link> with some descriptive name for the variable, e.g. <varname>libfoo</varname>. 121 - <screen> 122 - <prompt>$ </prompt>emacs pkgs/top-level/all-packages.nix</screen> 123 - </para> 124 - <para> 125 - The attributes in that file are sorted by category (like “Development / Libraries”) that more-or-less correspond to the directory structure of Nixpkgs, and then by attribute name. 126 - </para> 127 - </listitem> 128 - <listitem> 129 - <para> 130 - To test whether the package builds, run the following command from the root of the nixpkgs source tree: 131 - <screen> 132 - <prompt>$ </prompt>nix-build -A libfoo</screen> 133 - where <varname>libfoo</varname> should be the variable name defined in the previous step. You may want to add the flag <option>-K</option> to keep the temporary build directory in case something fails. If the build succeeds, a symlink <filename>./result</filename> to the package in the Nix store is created. 134 - </para> 135 - </listitem> 136 - <listitem> 137 - <para> 138 - If you want to install the package into your profile (optional), do 139 - <screen> 140 - <prompt>$ </prompt>nix-env -f . -iA libfoo</screen> 141 - </para> 142 - </listitem> 143 - <listitem> 144 - <para> 145 - Optionally commit the new package and open a pull request <link 146 - xlink:href="https://github.com/NixOS/nixpkgs/pulls">to nixpkgs</link>, or use <link 147 - xlink:href="https://discourse.nixos.org/t/about-the-patches-category/477"> the Patches category</link> on Discourse for sending a patch without a GitHub account. 148 - </para> 149 - </listitem> 150 - </orderedlist> 151 - </para> 152 - </chapter>
+204
doc/contributing/reviewing-contributions.chapter.md
··· 1 + # Reviewing contributions {#chap-reviewing-contributions} 2 + 3 + ::: warning 4 + The following section is a draft, and the policy for reviewing is still being discussed in issues such as [#11166](https://github.com/NixOS/nixpkgs/issues/11166) and [#20836](https://github.com/NixOS/nixpkgs/issues/20836). 5 + ::: 6 + 7 + The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project. 8 + 9 + The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the [most recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) and the [least recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc) updated pull requests. We highly encourage looking at [this list of ready to merge, unreviewed pull requests](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone). 10 + 11 + When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work. 12 + 13 + GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution. 14 + 15 + pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review. 16 + 17 + All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking. 18 + 19 + ## Package updates {#reviewing-contributions-package-updates} 20 + 21 + A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash. 22 + 23 + It can happen that non-trivial updates include patches or more complex changes. 24 + 25 + Reviewing process: 26 + 27 + - Ensure that the package versioning fits the guidelines. 28 + - Ensure that the commit text fits the guidelines. 29 + - Ensure that the package maintainers are notified. 30 + - [CODEOWNERS](https://help.github.com/articles/about-codeowners) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers. 31 + - Ensure that the meta field information is correct. 32 + - License can change with version updates, so it should be checked to match the upstream license. 33 + - If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package. 34 + - Ensure that the code contains no typos. 35 + - Building the package locally. 36 + - pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds. 37 + - It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone. 38 + ```ShellSession 39 + $ git fetch origin nixos-unstable 40 + $ git fetch origin pull/PRNUMBER/head 41 + $ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD 42 + ``` 43 + - The first command fetches the nixos-unstable branch. 44 + - The second command fetches the pull request changes, `PRNUMBER` is the number at the end of the pull request title and `BASEBRANCH` the base branch of the pull request. 45 + - The third command rebases the pull request changes to the nixos-unstable branch. 46 + - The [nixpkgs-review](https://github.com/Mic92/nixpkgs-review) tool can be used to review a pull request content in a single command. `PRNUMBER` should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url. 47 + ```ShellSession 48 + $ nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER" 49 + ``` 50 + - Running every binary. 51 + 52 + Sample template for a package update review is provided below. 53 + 54 + ```markdown 55 + ##### Reviewed points 56 + 57 + - [ ] package name fits guidelines 58 + - [ ] package version fits guidelines 59 + - [ ] package build on ARCHITECTURE 60 + - [ ] executables tested on ARCHITECTURE 61 + - [ ] all depending packages build 62 + 63 + ##### Possible improvements 64 + 65 + ##### Comments 66 + ``` 67 + 68 + ## New packages {#reviewing-contributions-new-packages} 69 + 70 + New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package. 71 + 72 + Review process: 73 + 74 + - Ensure that the package versioning fits the guidelines. 75 + - Ensure that the commit name fits the guidelines. 76 + - Ensure that the meta fields contain correct information. 77 + - License must match the upstream license. 78 + - Platforms should be set (or the package will not get binary substitutes). 79 + - Maintainers must be set. This can be the package submitter or a community member that accepts taking up maintainership of the package. 80 + - Report detected typos. 81 + - Ensure the package source: 82 + - Uses mirror URLs when available. 83 + - Uses the most appropriate functions (e.g. packages from GitHub should use `fetchFromGitHub`). 84 + - Building the package locally. 85 + - Running every binary. 86 + 87 + Sample template for a new package review is provided below. 88 + 89 + ```markdown 90 + ##### Reviewed points 91 + 92 + - [ ] package path fits guidelines 93 + - [ ] package name fits guidelines 94 + - [ ] package version fits guidelines 95 + - [ ] package build on ARCHITECTURE 96 + - [ ] executables tested on ARCHITECTURE 97 + - [ ] `meta.description` is set and fits guidelines 98 + - [ ] `meta.license` fits upstream license 99 + - [ ] `meta.platforms` is set 100 + - [ ] `meta.maintainers` is set 101 + - [ ] build time only dependencies are declared in `nativeBuildInputs` 102 + - [ ] source is fetched using the appropriate function 103 + - [ ] phases are respected 104 + - [ ] patches that are remotely available are fetched with `fetchpatch` 105 + 106 + ##### Possible improvements 107 + 108 + ##### Comments 109 + ``` 110 + 111 + ## Module updates {#reviewing-contributions-module-updates} 112 + 113 + Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options. 114 + 115 + Reviewing process: 116 + 117 + - Ensure that the module maintainers are notified. 118 + - [CODEOWNERS](https://help.github.com/articles/about-codeowners/) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers. 119 + - Ensure that the module tests, if any, are succeeding. 120 + - Ensure that the introduced options are correct. 121 + - Type should be appropriate (string related types differs in their merging capabilities, `optionSet` and `string` types are deprecated). 122 + - Description, default and example should be provided. 123 + - Ensure that option changes are backward compatible. 124 + - `mkRenamedOptionModule` and `mkAliasOptionModule` functions provide way to make option changes backward compatible. 125 + - Ensure that removed options are declared with `mkRemovedOptionModule` 126 + - Ensure that changes that are not backward compatible are mentioned in release notes. 127 + - Ensure that documentations affected by the change is updated. 128 + 129 + Sample template for a module update review is provided below. 130 + 131 + ```markdown 132 + ##### Reviewed points 133 + 134 + - [ ] changes are backward compatible 135 + - [ ] removed options are declared with `mkRemovedOptionModule` 136 + - [ ] changes that are not backward compatible are documented in release notes 137 + - [ ] module tests succeed on ARCHITECTURE 138 + - [ ] options types are appropriate 139 + - [ ] options description is set 140 + - [ ] options example is provided 141 + - [ ] documentation affected by the changes is updated 142 + 143 + ##### Possible improvements 144 + 145 + ##### Comments 146 + ``` 147 + 148 + ## New modules {#reviewing-contributions-new-modules} 149 + 150 + New modules submissions introduce a new module to NixOS. 151 + 152 + Reviewing process: 153 + 154 + - Ensure that the module tests, if any, are succeeding. 155 + - Ensure that the introduced options are correct. 156 + - Type should be appropriate (string related types differs in their merging capabilities, `optionSet` and `string` types are deprecated). 157 + - Description, default and example should be provided. 158 + - Ensure that module `meta` field is present 159 + - Maintainers should be declared in `meta.maintainers`. 160 + - Module documentation should be declared with `meta.doc`. 161 + - Ensure that the module respect other modules functionality. 162 + - For example, enabling a module should not open firewall ports by default. 163 + 164 + Sample template for a new module review is provided below. 165 + 166 + ```markdown 167 + ##### Reviewed points 168 + 169 + - [ ] module path fits the guidelines 170 + - [ ] module tests succeed on ARCHITECTURE 171 + - [ ] options have appropriate types 172 + - [ ] options have default 173 + - [ ] options have example 174 + - [ ] options have descriptions 175 + - [ ] No unneeded package is added to environment.systemPackages 176 + - [ ] meta.maintainers is set 177 + - [ ] module documentation is declared in meta.doc 178 + 179 + ##### Possible improvements 180 + 181 + ##### Comments 182 + ``` 183 + 184 + ## Other submissions {#reviewing-contributions-other-submissions} 185 + 186 + Other type of submissions requires different reviewing steps. 187 + 188 + If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints. 189 + 190 + Container system, boot system and library changes are some examples of the pull requests fitting this category. 191 + 192 + ## Merging pull requests {#reviewing-contributions--merging-pull-requests} 193 + 194 + It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests. 195 + 196 + <!-- 197 + The following paragraphs about how to deal with unactive contributors is just a proposition and should be modified to what the community agrees to be the right policy. 198 + 199 + Please note that contributors with commit rights unactive for more than three months will have their commit rights revoked. 200 + --> 201 + 202 + Please see the discussion in [GitHub nixpkgs issue #50105](https://github.com/NixOS/nixpkgs/issues/50105) for information on how to proceed to be granted this level of access. 203 + 204 + In a case a contributor definitively leaves the Nix community, they should create an issue or post on [Discourse](https://discourse.nixos.org) with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
-488
doc/contributing/reviewing-contributions.xml
··· 1 - <chapter xmlns="http://docbook.org/ns/docbook" 2 - xmlns:xlink="http://www.w3.org/1999/xlink" 3 - xmlns:xi="http://www.w3.org/2001/XInclude" 4 - version="5.0" 5 - xml:id="chap-reviewing-contributions"> 6 - <title>Reviewing contributions</title> 7 - <warning> 8 - <para> 9 - The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link 10 - xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link 11 - xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>. 12 - </para> 13 - </warning> 14 - <para> 15 - The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project. 16 - </para> 17 - <para> 18 - The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the <link 19 - xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link 20 - xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least recently</link> updated pull requests. We highly encourage looking at <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone"> this list of ready to merge, unreviewed pull requests</link>. 21 - </para> 22 - <para> 23 - When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work. 24 - </para> 25 - <para> 26 - GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution. 27 - </para> 28 - <para> 29 - pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review. 30 - </para> 31 - <para> 32 - All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking. 33 - </para> 34 - <section xml:id="reviewing-contributions-package-updates"> 35 - <title>Package updates</title> 36 - 37 - <para> 38 - A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash. 39 - </para> 40 - 41 - <para> 42 - It can happen that non-trivial updates include patches or more complex changes. 43 - </para> 44 - 45 - <para> 46 - Reviewing process: 47 - </para> 48 - 49 - <itemizedlist> 50 - <listitem> 51 - <para> 52 - Ensure that the package versioning fits the guidelines. 53 - </para> 54 - </listitem> 55 - <listitem> 56 - <para> 57 - Ensure that the commit text fits the guidelines. 58 - </para> 59 - </listitem> 60 - <listitem> 61 - <para> 62 - Ensure that the package maintainers are notified. 63 - </para> 64 - <itemizedlist> 65 - <listitem> 66 - <para> 67 - <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers. 68 - </para> 69 - </listitem> 70 - </itemizedlist> 71 - </listitem> 72 - <listitem> 73 - <para> 74 - Ensure that the meta field information is correct. 75 - </para> 76 - <itemizedlist> 77 - <listitem> 78 - <para> 79 - License can change with version updates, so it should be checked to match the upstream license. 80 - </para> 81 - </listitem> 82 - <listitem> 83 - <para> 84 - If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package. 85 - </para> 86 - </listitem> 87 - </itemizedlist> 88 - </listitem> 89 - <listitem> 90 - <para> 91 - Ensure that the code contains no typos. 92 - </para> 93 - </listitem> 94 - <listitem> 95 - <para> 96 - Building the package locally. 97 - </para> 98 - <itemizedlist> 99 - <listitem> 100 - <para> 101 - pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds. 102 - </para> 103 - <para> 104 - It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone. 105 - <screen> 106 - <prompt>$ </prompt>git fetch origin nixos-unstable <co xml:id='reviewing-rebase-2' /> 107 - <prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' /> 108 - <prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co 109 - xml:id='reviewing-rebase-4' /> 110 - </screen> 111 - <calloutlist> 112 - <callout arearefs='reviewing-rebase-2'> 113 - <para> 114 - Fetching the nixos-unstable branch. 115 - </para> 116 - </callout> 117 - <callout arearefs='reviewing-rebase-3'> 118 - <para> 119 - Fetching the pull request changes, <varname>PRNUMBER</varname> is the number at the end of the pull request title and <varname>BASEBRANCH</varname> the base branch of the pull request. 120 - </para> 121 - </callout> 122 - <callout arearefs='reviewing-rebase-4'> 123 - <para> 124 - Rebasing the pull request changes to the nixos-unstable branch. 125 - </para> 126 - </callout> 127 - </calloutlist> 128 - </para> 129 - </listitem> 130 - <listitem> 131 - <para> 132 - The <link xlink:href="https://github.com/Mic92/nixpkgs-review">nixpkgs-review</link> tool can be used to review a pull request content in a single command. <varname>PRNUMBER</varname> should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url. 133 - </para> 134 - <screen> 135 - <prompt>$ </prompt>nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER" 136 - </screen> 137 - </listitem> 138 - </itemizedlist> 139 - </listitem> 140 - <listitem> 141 - <para> 142 - Running every binary. 143 - </para> 144 - </listitem> 145 - </itemizedlist> 146 - 147 - <example xml:id="reviewing-contributions-sample-package-update"> 148 - <title>Sample template for a package update review</title> 149 - <screen> 150 - ##### Reviewed points 151 - 152 - - [ ] package name fits guidelines 153 - - [ ] package version fits guidelines 154 - - [ ] package build on ARCHITECTURE 155 - - [ ] executables tested on ARCHITECTURE 156 - - [ ] all depending packages build 157 - 158 - ##### Possible improvements 159 - 160 - ##### Comments 161 - 162 - </screen> 163 - </example> 164 - </section> 165 - <section xml:id="reviewing-contributions-new-packages"> 166 - <title>New packages</title> 167 - 168 - <para> 169 - New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package. 170 - </para> 171 - 172 - <para> 173 - Review process: 174 - </para> 175 - 176 - <itemizedlist> 177 - <listitem> 178 - <para> 179 - Ensure that the package versioning fits the guidelines. 180 - </para> 181 - </listitem> 182 - <listitem> 183 - <para> 184 - Ensure that the commit name fits the guidelines. 185 - </para> 186 - </listitem> 187 - <listitem> 188 - <para> 189 - Ensure that the meta fields contain correct information. 190 - </para> 191 - <itemizedlist> 192 - <listitem> 193 - <para> 194 - License must match the upstream license. 195 - </para> 196 - </listitem> 197 - <listitem> 198 - <para> 199 - Platforms should be set (or the package will not get binary substitutes). 200 - </para> 201 - </listitem> 202 - <listitem> 203 - <para> 204 - Maintainers must be set. This can be the package submitter or a community member that accepts taking up maintainership of the package. 205 - </para> 206 - </listitem> 207 - </itemizedlist> 208 - </listitem> 209 - <listitem> 210 - <para> 211 - Report detected typos. 212 - </para> 213 - </listitem> 214 - <listitem> 215 - <para> 216 - Ensure the package source: 217 - </para> 218 - <itemizedlist> 219 - <listitem> 220 - <para> 221 - Uses mirror URLs when available. 222 - </para> 223 - </listitem> 224 - <listitem> 225 - <para> 226 - Uses the most appropriate functions (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>). 227 - </para> 228 - </listitem> 229 - </itemizedlist> 230 - </listitem> 231 - <listitem> 232 - <para> 233 - Building the package locally. 234 - </para> 235 - </listitem> 236 - <listitem> 237 - <para> 238 - Running every binary. 239 - </para> 240 - </listitem> 241 - </itemizedlist> 242 - 243 - <example xml:id="reviewing-contributions-sample-new-package"> 244 - <title>Sample template for a new package review</title> 245 - <screen> 246 - ##### Reviewed points 247 - 248 - - [ ] package path fits guidelines 249 - - [ ] package name fits guidelines 250 - - [ ] package version fits guidelines 251 - - [ ] package build on ARCHITECTURE 252 - - [ ] executables tested on ARCHITECTURE 253 - - [ ] `meta.description` is set and fits guidelines 254 - - [ ] `meta.license` fits upstream license 255 - - [ ] `meta.platforms` is set 256 - - [ ] `meta.maintainers` is set 257 - - [ ] build time only dependencies are declared in `nativeBuildInputs` 258 - - [ ] source is fetched using the appropriate function 259 - - [ ] phases are respected 260 - - [ ] patches that are remotely available are fetched with `fetchpatch` 261 - 262 - ##### Possible improvements 263 - 264 - ##### Comments 265 - 266 - </screen> 267 - </example> 268 - </section> 269 - <section xml:id="reviewing-contributions-module-updates"> 270 - <title>Module updates</title> 271 - 272 - <para> 273 - Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options. 274 - </para> 275 - 276 - <para> 277 - Reviewing process 278 - </para> 279 - 280 - <itemizedlist> 281 - <listitem> 282 - <para> 283 - Ensure that the module maintainers are notified. 284 - </para> 285 - <itemizedlist> 286 - <listitem> 287 - <para> 288 - <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers. 289 - </para> 290 - </listitem> 291 - </itemizedlist> 292 - </listitem> 293 - <listitem> 294 - <para> 295 - Ensure that the module tests, if any, are succeeding. 296 - </para> 297 - </listitem> 298 - <listitem> 299 - <para> 300 - Ensure that the introduced options are correct. 301 - </para> 302 - <itemizedlist> 303 - <listitem> 304 - <para> 305 - Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated). 306 - </para> 307 - </listitem> 308 - <listitem> 309 - <para> 310 - Description, default and example should be provided. 311 - </para> 312 - </listitem> 313 - </itemizedlist> 314 - </listitem> 315 - <listitem> 316 - <para> 317 - Ensure that option changes are backward compatible. 318 - </para> 319 - <itemizedlist> 320 - <listitem> 321 - <para> 322 - <literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible. 323 - </para> 324 - </listitem> 325 - </itemizedlist> 326 - </listitem> 327 - <listitem> 328 - <para> 329 - Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal> 330 - </para> 331 - </listitem> 332 - <listitem> 333 - <para> 334 - Ensure that changes that are not backward compatible are mentioned in release notes. 335 - </para> 336 - </listitem> 337 - <listitem> 338 - <para> 339 - Ensure that documentations affected by the change is updated. 340 - </para> 341 - </listitem> 342 - </itemizedlist> 343 - 344 - <example xml:id="reviewing-contributions-sample-module-update"> 345 - <title>Sample template for a module update review</title> 346 - <screen> 347 - ##### Reviewed points 348 - 349 - - [ ] changes are backward compatible 350 - - [ ] removed options are declared with `mkRemovedOptionModule` 351 - - [ ] changes that are not backward compatible are documented in release notes 352 - - [ ] module tests succeed on ARCHITECTURE 353 - - [ ] options types are appropriate 354 - - [ ] options description is set 355 - - [ ] options example is provided 356 - - [ ] documentation affected by the changes is updated 357 - 358 - ##### Possible improvements 359 - 360 - ##### Comments 361 - 362 - </screen> 363 - </example> 364 - </section> 365 - <section xml:id="reviewing-contributions-new-modules"> 366 - <title>New modules</title> 367 - 368 - <para> 369 - New modules submissions introduce a new module to NixOS. 370 - </para> 371 - 372 - <itemizedlist> 373 - <listitem> 374 - <para> 375 - Ensure that the module tests, if any, are succeeding. 376 - </para> 377 - </listitem> 378 - <listitem> 379 - <para> 380 - Ensure that the introduced options are correct. 381 - </para> 382 - <itemizedlist> 383 - <listitem> 384 - <para> 385 - Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated). 386 - </para> 387 - </listitem> 388 - <listitem> 389 - <para> 390 - Description, default and example should be provided. 391 - </para> 392 - </listitem> 393 - </itemizedlist> 394 - </listitem> 395 - <listitem> 396 - <para> 397 - Ensure that module <literal>meta</literal> field is present 398 - </para> 399 - <itemizedlist> 400 - <listitem> 401 - <para> 402 - Maintainers should be declared in <literal>meta.maintainers</literal>. 403 - </para> 404 - </listitem> 405 - <listitem> 406 - <para> 407 - Module documentation should be declared with <literal>meta.doc</literal>. 408 - </para> 409 - </listitem> 410 - </itemizedlist> 411 - </listitem> 412 - <listitem> 413 - <para> 414 - Ensure that the module respect other modules functionality. 415 - </para> 416 - <itemizedlist> 417 - <listitem> 418 - <para> 419 - For example, enabling a module should not open firewall ports by default. 420 - </para> 421 - </listitem> 422 - </itemizedlist> 423 - </listitem> 424 - </itemizedlist> 425 - 426 - <example xml:id="reviewing-contributions-sample-new-module"> 427 - <title>Sample template for a new module review</title> 428 - <screen> 429 - ##### Reviewed points 430 - 431 - - [ ] module path fits the guidelines 432 - - [ ] module tests succeed on ARCHITECTURE 433 - - [ ] options have appropriate types 434 - - [ ] options have default 435 - - [ ] options have example 436 - - [ ] options have descriptions 437 - - [ ] No unneeded package is added to environment.systemPackages 438 - - [ ] meta.maintainers is set 439 - - [ ] module documentation is declared in meta.doc 440 - 441 - ##### Possible improvements 442 - 443 - ##### Comments 444 - 445 - </screen> 446 - </example> 447 - </section> 448 - <section xml:id="reviewing-contributions-other-submissions"> 449 - <title>Other submissions</title> 450 - 451 - <para> 452 - Other type of submissions requires different reviewing steps. 453 - </para> 454 - 455 - <para> 456 - If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints. 457 - </para> 458 - 459 - <para> 460 - Container system, boot system and library changes are some examples of the pull requests fitting this category. 461 - </para> 462 - </section> 463 - <section xml:id="reviewing-contributions--merging-pull-requests"> 464 - <title>Merging pull requests</title> 465 - 466 - <para> 467 - It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests. 468 - </para> 469 - 470 - <!-- 471 - The following paragraphs about how to deal with unactive contributors is just a 472 - proposition and should be modified to what the community agrees to be the right 473 - policy. 474 - 475 - <para>Please note that contributors with commit rights unactive for more than 476 - three months will have their commit rights revoked.</para> 477 - --> 478 - 479 - <para> 480 - Please see the discussion in <link xlink:href="https://github.com/NixOS/nixpkgs/issues/50105">GitHub nixpkgs issue #50105</link> for information on how to proceed to be granted this level of access. 481 - </para> 482 - 483 - <para> 484 - In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link 485 - xlink:href="https://discourse.nixos.org">Discourse</link> with references of packages and modules they maintain so the maintainership can be taken over by other contributors. 486 - </para> 487 - </section> 488 - </chapter>
+4 -4
doc/manual.xml
··· 32 32 </part> 33 33 <part> 34 34 <title>Contributing to Nixpkgs</title> 35 - <xi:include href="contributing/quick-start.xml" /> 36 - <xi:include href="contributing/coding-conventions.xml" /> 35 + <xi:include href="contributing/quick-start.chapter.xml" /> 36 + <xi:include href="contributing/coding-conventions.chapter.xml" /> 37 37 <xi:include href="contributing/submitting-changes.chapter.xml" /> 38 38 <xi:include href="contributing/vulnerability-roundup.chapter.xml" /> 39 - <xi:include href="contributing/reviewing-contributions.xml" /> 40 - <xi:include href="contributing/contributing-to-documentation.xml" /> 39 + <xi:include href="contributing/reviewing-contributions.chapter.xml" /> 40 + <xi:include href="contributing/contributing-to-documentation.chapter.xml" /> 41 41 </part> 42 42 </book>
+6
maintainers/maintainer-list.nix
··· 7955 7955 githubId = 18549627; 7956 7956 name = "Proglodyte"; 7957 7957 }; 7958 + progval = { 7959 + email = "progval+nix@progval.net"; 7960 + github = "ProgVal"; 7961 + githubId = 406946; 7962 + name = "Valentin Lorentz"; 7963 + }; 7958 7964 protoben = { 7959 7965 email = "protob3n@gmail.com"; 7960 7966 github = "protoben";
+3 -3
pkgs/applications/misc/xplr/default.nix
··· 2 2 3 3 rustPlatform.buildRustPackage rec { 4 4 name = "xplr"; 5 - version = "0.5.5"; 5 + version = "0.5.6"; 6 6 7 7 src = fetchFromGitHub { 8 8 owner = "sayanarijit"; 9 9 repo = name; 10 10 rev = "v${version}"; 11 - sha256 = "06n1f4ccvy3bpw0js164rjclp0qy72mwdqm5hmvnpws6ixv78biw"; 11 + sha256 = "070jyii2p7qk6gij47n5i9a8bal5iijgn8cv79mrija3pgddniaz"; 12 12 }; 13 13 14 - cargoSha256 = "0n9sgvqb194s5bzacr7dqw9cy4z9d63wzcxr19pv9pxpafjwlh0z"; 14 + cargoSha256 = "113f0hbgy8c9gxl70b6frr0klfc8rm5klgwls7fgbb643rdh03b9"; 15 15 16 16 meta = with lib; { 17 17 description = "A hackable, minimal, fast TUI file explorer";
+3 -3
pkgs/applications/networking/browsers/chromium/upstream-info.json
··· 31 31 } 32 32 }, 33 33 "dev": { 34 - "version": "91.0.4472.19", 35 - "sha256": "0p51cxz0dm9ss9k7b91c0nd560mgi2x4qdcpg12vdf8x24agai5x", 36 - "sha256bin64": "1x1901f5782c6aj6sbj8i4hhj545vjl4pplf35i4bjbcaxq3ckli", 34 + "version": "92.0.4484.7", 35 + "sha256": "1111b1vj4zqcz57c65pjbxjilvv2ps8cjz2smxxz0vjd432q2fdf", 36 + "sha256bin64": "0qb5bngp3vwn7py38bn80k43safm395qda760nd5kzfal6c98fi1", 37 37 "deps": { 38 38 "gn": { 39 39 "version": "2021-04-06",
+3 -2
pkgs/applications/office/libreoffice/wrapper.sh
··· 2 2 export JAVA_HOME="${JAVA_HOME:-@jdk@}" 3 3 #export SAL_USE_VCLPLUGIN="${SAL_USE_VCLPLUGIN:-gen}" 4 4 5 - if uname | grep Linux > /dev/null && 5 + if uname | grep Linux > /dev/null && 6 6 ! ( test -n "$DBUS_SESSION_BUS_ADDRESS" ); then 7 7 dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus" 8 8 if ! test -d "$dbus_tmp_dir" && test -d "/run"; then ··· 14 14 fi 15 15 dbus_socket_dir="$(mktemp -d -p "$dbus_tmp_dir")" 16 16 "@dbus@"/bin/dbus-daemon --nopidfile --nofork --config-file "@dbus@"/share/dbus-1/session.conf --address "unix:path=$dbus_socket_dir/session" &> /dev/null & 17 + dbus_pid=$! 17 18 export DBUS_SESSION_BUS_ADDRESS="unix:path=$dbus_socket_dir/session" 18 19 fi 19 20 ··· 27 28 "@libreoffice@/bin/$(basename "$0")" "$@" 28 29 code="$?" 29 30 30 - test -n "$dbus_socket_dir" && rm -rf "$dbus_socket_dir" 31 + test -n "$dbus_socket_dir" && { rm -rf "$dbus_socket_dir"; kill $dbus_pid; } 31 32 exit "$code"
+3 -3
pkgs/applications/office/trilium/default.nix
··· 19 19 maintainers = with maintainers; [ fliegendewurst ]; 20 20 }; 21 21 22 - version = "0.46.7"; 22 + version = "0.46.9"; 23 23 24 24 desktopSource = { 25 25 url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz"; 26 - sha256 = "0saqj32jcb9ga418bpdxy93hf1z8nmwzf76rfgnnac7286ciyinr"; 26 + sha256 = "1qpk5z8w4wbkxs1lpnz3g8w30zygj4wxxlwj6gp1pip09xgiksm9"; 27 27 }; 28 28 29 29 serverSource = { 30 30 url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz"; 31 - sha256 = "0b9bbm1iyaa5wf758085m6kfbq4li1iimj11ryf9xv9fzrbc4gvs"; 31 + sha256 = "1n8g7l6hiw9bhzylvzlfcn2pk4i8pqkqp9lj3lcxwwqb8va52phg"; 32 32 }; 33 33 34 34 in {
+2 -2
pkgs/applications/science/logic/potassco/clingo.nix
··· 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "clingo"; 5 - version = "5.4.1"; 5 + version = "5.5.0"; 6 6 7 7 src = fetchzip { 8 8 url = "https://github.com/potassco/clingo/archive/v${version}.tar.gz"; 9 - sha256 = "1f0q5f71s696ywxcjlfz7z134m1h7i39j9sfdv8hlw2w3g5nppc3"; 9 + sha256 = "sha256-6xKtNi5IprjaFNadfk8kKjKzuPRanUjycLWCytnk0mU="; 10 10 }; 11 11 12 12 nativeBuildInputs = [ cmake ];
+153
pkgs/development/compilers/mrustc/bootstrap.nix
··· 1 + { lib, stdenv 2 + , fetchurl 3 + , mrustc 4 + , mrustc-minicargo 5 + , rust 6 + , llvm_7 7 + , llvmPackages_7 8 + , libffi 9 + , cmake 10 + , python3 11 + , zlib 12 + , libxml2 13 + , openssl 14 + , pkg-config 15 + , curl 16 + , which 17 + , time 18 + }: 19 + 20 + let 21 + rustcVersion = "1.29.0"; 22 + rustcSrc = fetchurl { 23 + url = "https://static.rust-lang.org/dist/rustc-${rustcVersion}-src.tar.gz"; 24 + sha256 = "1sb15znckj8pc8q3g7cq03pijnida6cg64yqmgiayxkzskzk9sx4"; 25 + }; 26 + rustcDir = "rustc-${rustcVersion}-src"; 27 + in 28 + 29 + stdenv.mkDerivation rec { 30 + pname = "mrustc-bootstrap"; 31 + version = "${mrustc.version}_${rustcVersion}"; 32 + 33 + inherit (mrustc) src; 34 + postUnpack = "tar -xf ${rustcSrc} -C source/"; 35 + 36 + # the rust build system complains that nix alters the checksums 37 + dontFixLibtool = true; 38 + 39 + patches = [ 40 + ./patches/0001-use-shared-llvm.patch 41 + ./patches/0002-dont-build-llvm.patch 42 + ./patches/0003-echo-newlines.patch 43 + ./patches/0004-increase-parallelism.patch 44 + ]; 45 + 46 + postPatch = '' 47 + echo "applying patch ./rustc-${rustcVersion}-src.patch" 48 + patch -p0 -d ${rustcDir}/ < rustc-${rustcVersion}-src.patch 49 + 50 + for p in ${lib.concatStringsSep " " llvmPackages_7.compiler-rt.patches}; do 51 + echo "applying patch $p" 52 + patch -p1 -d ${rustcDir}/src/libcompiler_builtins/compiler-rt < $p 53 + done 54 + ''; 55 + 56 + # rustc unfortunately needs cmake to compile llvm-rt but doesn't 57 + # use it for the normal build. This disables cmake in Nix. 58 + dontUseCmakeConfigure = true; 59 + 60 + strictDeps = true; 61 + nativeBuildInputs = [ 62 + cmake 63 + mrustc 64 + mrustc-minicargo 65 + pkg-config 66 + python3 67 + time 68 + which 69 + ]; 70 + buildInputs = [ 71 + # for rustc 72 + llvm_7 libffi zlib libxml2 73 + # for cargo 74 + openssl curl 75 + ]; 76 + 77 + makeFlags = [ 78 + # Use shared mrustc/minicargo/llvm instead of rebuilding them 79 + "MRUSTC=${mrustc}/bin/mrustc" 80 + "MINICARGO=${mrustc-minicargo}/bin/minicargo" 81 + "LLVM_CONFIG=${llvm_7}/bin/llvm-config" 82 + "RUSTC_TARGET=${rust.toRustTarget stdenv.targetPlatform}" 83 + ]; 84 + 85 + buildPhase = '' 86 + runHook preBuild 87 + 88 + local flagsArray=( 89 + PARLEVEL=$NIX_BUILD_CORES 90 + ${toString makeFlags} 91 + ) 92 + 93 + echo minicargo.mk: libs 94 + make -f minicargo.mk "''${flagsArray[@]}" LIBS 95 + 96 + echo minicargo.mk: deps 97 + mkdir -p output/cargo-build 98 + # minicargo has concurrency issues when running these; let's build them 99 + # without parallelism 100 + for crate in regex regex-0.2.11 curl-sys 101 + do 102 + echo "building $crate" 103 + minicargo ${rustcDir}/src/vendor/$crate \ 104 + --vendor-dir ${rustcDir}/src/vendor \ 105 + --output-dir output/cargo-build -L output/ 106 + done 107 + 108 + echo minicargo.mk: rustc 109 + make -f minicargo.mk "''${flagsArray[@]}" output/rustc 110 + 111 + echo minicargo.mk: cargo 112 + make -f minicargo.mk "''${flagsArray[@]}" output/cargo 113 + 114 + echo run_rustc 115 + make -C run_rustc "''${flagsArray[@]}" 116 + 117 + unset flagsArray 118 + 119 + runHook postBuild 120 + ''; 121 + 122 + doCheck = true; 123 + checkPhase = '' 124 + runHook preCheck 125 + run_rustc/output/prefix/bin/hello_world | grep "hello, world" 126 + runHook postCheck 127 + ''; 128 + 129 + installPhase = '' 130 + runHook preInstall 131 + mkdir -p $out/bin/ $out/lib/ 132 + cp run_rustc/output/prefix/bin/cargo $out/bin/cargo 133 + cp run_rustc/output/prefix/bin/rustc_binary $out/bin/rustc 134 + 135 + cp -r run_rustc/output/prefix/lib/* $out/lib/ 136 + cp $out/lib/rustlib/${rust.toRustTarget stdenv.targetPlatform}/lib/*.so $out/lib/ 137 + runHook postInstall 138 + ''; 139 + 140 + meta = with lib; { 141 + inherit (src.meta) homepage; 142 + description = "A minimal build of Rust"; 143 + longDescription = '' 144 + A minimal build of Rust, built from source using mrustc. 145 + This is useful for bootstrapping the main Rust compiler without 146 + an initial binary toolchain download. 147 + ''; 148 + maintainers = with maintainers; [ progval r-burns ]; 149 + license = with licenses; [ mit asl20 ]; 150 + platforms = [ "x86_64-linux" ]; 151 + }; 152 + } 153 +
+53
pkgs/development/compilers/mrustc/default.nix
··· 1 + { lib, stdenv 2 + , fetchFromGitHub 3 + , zlib 4 + }: 5 + 6 + let 7 + version = "0.9"; 8 + tag = "v${version}"; 9 + rev = "15773561e40ca5c8cffe0a618c544b6cfdc5ad7e"; 10 + in 11 + 12 + stdenv.mkDerivation rec { 13 + pname = "mrustc"; 14 + inherit version; 15 + 16 + # Always update minicargo.nix and bootstrap.nix in lockstep with this 17 + src = fetchFromGitHub { 18 + owner = "thepowersgang"; 19 + repo = "mrustc"; 20 + rev = tag; 21 + sha256 = "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"; 22 + }; 23 + 24 + postPatch = '' 25 + sed -i 's/\$(shell git show --pretty=%H -s)/${rev}/' Makefile 26 + sed -i 's/\$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/${tag}/' Makefile 27 + sed -i 's/\$(shell git diff-index --quiet HEAD; echo $$?)/0/' Makefile 28 + ''; 29 + 30 + strictDeps = true; 31 + buildInputs = [ zlib ]; 32 + enableParallelBuilding = true; 33 + 34 + installPhase = '' 35 + runHook preInstall 36 + mkdir -p $out/bin 37 + cp bin/mrustc $out/bin 38 + runHook postInstall 39 + ''; 40 + 41 + meta = with lib; { 42 + description = "Mutabah's Rust Compiler"; 43 + longDescription = '' 44 + In-progress alternative rust compiler, written in C++. 45 + Capable of building a fully-working copy of rustc, 46 + but not yet suitable for everyday use. 47 + ''; 48 + inherit (src.meta) homepage; 49 + license = licenses.mit; 50 + maintainers = with maintainers; [ progval r-burns ]; 51 + platforms = [ "x86_64-linux" ]; 52 + }; 53 + }
+39
pkgs/development/compilers/mrustc/minicargo.nix
··· 1 + { lib, stdenv 2 + , makeWrapper 3 + , mrustc 4 + }: 5 + 6 + stdenv.mkDerivation rec { 7 + pname = "mrustc-minicargo"; 8 + inherit (mrustc) src version; 9 + 10 + strictDeps = true; 11 + nativeBuildInputs = [ makeWrapper ]; 12 + 13 + enableParallelBuilding = true; 14 + makefile = "minicargo.mk"; 15 + makeFlags = [ "tools/bin/minicargo" ]; 16 + 17 + installPhase = '' 18 + runHook preInstall 19 + mkdir -p $out/bin 20 + cp tools/bin/minicargo $out/bin 21 + 22 + # without it, minicargo defaults to "<minicargo_path>/../../bin/mrustc" 23 + wrapProgram "$out/bin/minicargo" --set MRUSTC_PATH ${mrustc}/bin/mrustc 24 + runHook postInstall 25 + ''; 26 + 27 + meta = with lib; { 28 + description = "A minimalist builder for Rust"; 29 + longDescription = '' 30 + A minimalist builder for Rust, similar to Cargo but written in C++. 31 + Designed to work with mrustc to build Rust projects 32 + (like the Rust compiler itself). 33 + ''; 34 + inherit (src.meta) homepage; 35 + license = licenses.mit; 36 + maintainers = with maintainers; [ progval r-burns ]; 37 + platforms = [ "x86_64-linux" ]; 38 + }; 39 + }
+12
pkgs/development/compilers/mrustc/patches/0001-use-shared-llvm.patch
··· 1 + --- a/rustc-1.29.0-src/src/librustc_llvm/lib.rs 2 + --- b/rustc-1.29.0-src/src/librustc_llvm/lib.rs 3 + @@ -23,6 +23,9 @@ 4 + #![feature(link_args)] 5 + #![feature(static_nobundle)] 6 + 7 + +// https://github.com/rust-lang/rust/issues/34486 8 + +#[link(name = "ffi")] extern {} 9 + + 10 + // See librustc_cratesio_shim/Cargo.toml for a comment explaining this. 11 + #[allow(unused_extern_crates)] 12 + extern crate rustc_cratesio_shim;
+14
pkgs/development/compilers/mrustc/patches/0002-dont-build-llvm.patch
··· 1 + --- a/minicargo.mk 2 + +++ b/minicargo.mk 3 + @@ -116,11 +116,6 @@ 4 + LLVM_CMAKE_OPTS += CMAKE_BUILD_TYPE=RelWithDebInfo 5 + 6 + 7 + -$(LLVM_CONFIG): $(RUSTCSRC)build/Makefile 8 + - $Vcd $(RUSTCSRC)build && $(MAKE) 9 + -$(RUSTCSRC)build/Makefile: $(RUSTCSRC)src/llvm/CMakeLists.txt 10 + - @mkdir -p $(RUSTCSRC)build 11 + - $Vcd $(RUSTCSRC)build && cmake $(addprefix -D , $(LLVM_CMAKE_OPTS)) ../src/llvm 12 + 13 + 14 + #
+13
pkgs/development/compilers/mrustc/patches/0003-echo-newlines.patch
··· 1 + --- a/run_rustc/Makefile 2 + +++ b/run_rustc/Makefile 3 + @@ -103,7 +103,9 @@ 4 + else 5 + cp $(OUTDIR)build-rustc/release/rustc_binary $(BINDIR)rustc_binary 6 + endif 7 + - echo '#!/bin/sh\nd=$$(dirname $$0)\nLD_LIBRARY_PATH="$(abspath $(LIBDIR))" $$d/rustc_binary $$@' >$@ 8 + + echo '#!$(shell which bash)' > $@ 9 + + echo 'd=$$(dirname $$0)' >> $@ 10 + + echo 'LD_LIBRARY_PATH="$(abspath $(LIBDIR))" $$d/rustc_binary $$@' >> $@ 11 + chmod +x $@ 12 + 13 + $(BINDIR)hello_world: $(RUST_SRC)test/run-pass/hello.rs $(LIBDIR)libstd.rlib $(BINDIR)rustc
+28
pkgs/development/compilers/mrustc/patches/0004-increase-parallelism.patch
··· 1 + --- a/run_rustc/Makefile 2 + +++ b/run_rustc/Makefile 3 + @@ -79,14 +79,14 @@ 4 + @mkdir -p $(OUTDIR)build-std 5 + @mkdir -p $(LIBDIR) 6 + @echo [CARGO] $(RUST_SRC)libstd/Cargo.toml 7 + - $VCARGO_TARGET_DIR=$(OUTDIR)build-std RUSTC=$(BINDIR_S)rustc $(CARGO_ENV) $(BINDIR)cargo build --manifest-path $(RUST_SRC)libstd/Cargo.toml -j 1 --release --features panic-unwind 8 + + $VCARGO_TARGET_DIR=$(OUTDIR)build-std RUSTC=$(BINDIR_S)rustc $(CARGO_ENV) $(BINDIR)cargo build --manifest-path $(RUST_SRC)libstd/Cargo.toml -j $(NIX_BUILD_CORES) --release --features panic-unwind 9 + $Vcp --remove-destination $(OUTDIR)build-std/release/deps/*.rlib $(LIBDIR) 10 + $Vcp --remove-destination $(OUTDIR)build-std/release/deps/*.so $(LIBDIR) 11 + # libtest 12 + $(LIBDIR)libtest.rlib: $(BINDIR)rustc_m $(LIBDIR)libstd.rlib $(CARGO_HOME)config 13 + @mkdir -p $(OUTDIR)build-test 14 + @echo [CARGO] $(RUST_SRC)libtest/Cargo.toml 15 + - $VCARGO_TARGET_DIR=$(OUTDIR)build-test RUSTC=$(BINDIR)rustc_m $(CARGO_ENV) $(BINDIR)cargo build --manifest-path $(RUST_SRC)libtest/Cargo.toml -j 1 --release 16 + + $VCARGO_TARGET_DIR=$(OUTDIR)build-test RUSTC=$(BINDIR)rustc_m $(CARGO_ENV) $(BINDIR)cargo build --manifest-path $(RUST_SRC)libtest/Cargo.toml -j $(NIX_BUILD_CORES) --release 17 + @mkdir -p $(LIBDIR) 18 + $Vcp --remove-destination $(OUTDIR)build-test/release/deps/*.rlib $(LIBDIR) 19 + $Vcp --remove-destination $(OUTDIR)build-test/release/deps/*.so $(LIBDIR) 20 + @@ -95,7 +95,7 @@ 21 + $(BINDIR)rustc: $(BINDIR)rustc_m $(BINDIR)cargo $(CARGO_HOME)config $(LIBDIR)libtest.rlib 22 + @mkdir -p $(PREFIX)tmp 23 + @echo [CARGO] $(RUST_SRC)rustc/Cargo.toml 24 + - $V$(RUSTC_ENV_VARS) TMPDIR=$(abspath $(PREFIX)tmp) CARGO_TARGET_DIR=$(OUTDIR)build-rustc RUSTC=$(BINDIR)rustc_m RUSTC_ERROR_METADATA_DST=$(abspath $(PREFIX)) $(CARGO_ENV) $(BINDIR)cargo build --manifest-path $(RUST_SRC)rustc/Cargo.toml --release -j 1 25 + + $V$(RUSTC_ENV_VARS) TMPDIR=$(abspath $(PREFIX)tmp) CARGO_TARGET_DIR=$(OUTDIR)build-rustc RUSTC=$(BINDIR)rustc_m RUSTC_ERROR_METADATA_DST=$(abspath $(PREFIX)) $(CARGO_ENV) $(BINDIR)cargo build --manifest-path $(RUST_SRC)rustc/Cargo.toml --release -j $(NIX_BUILD_CORES) 26 + cp $(OUTDIR)build-rustc/release/deps/*.so $(LIBDIR) 27 + cp $(OUTDIR)build-rustc/release/deps/*.rlib $(LIBDIR) 28 + ifeq ($(RUSTC_VERSION),1.19.0)
+4
pkgs/development/libraries/freeimage/default.nix
··· 29 29 30 30 preInstall = '' 31 31 mkdir -p $INCDIR $INSTALLDIR 32 + '' 33 + # Workaround for Makefiles.osx not using ?= 34 + + lib.optionalString stdenv.isDarwin '' 35 + makeFlagsArray+=( "INCDIR=$INCDIR" "INSTALLDIR=$INSTALLDIR" ) 32 36 ''; 33 37 34 38 postInstall = lib.optionalString (!stdenv.isDarwin) ''
+2 -2
pkgs/development/python-modules/ailment/default.nix
··· 7 7 8 8 buildPythonPackage rec { 9 9 pname = "ailment"; 10 - version = "9.0.6281"; 10 + version = "9.0.6790"; 11 11 disabled = pythonOlder "3.6"; 12 12 13 13 src = fetchFromGitHub { 14 14 owner = "angr"; 15 15 repo = pname; 16 16 rev = "v${version}"; 17 - sha256 = "sha256-IFUGtTO+DY8FIxLgvmwM/y/RQr42T9sABPpnJMILkqg="; 17 + sha256 = "sha256-RcLa18JqQ7c8u+fhyNHmJEXt/Lg73JDAImtUtiaZbTw="; 18 18 }; 19 19 20 20 propagatedBuildInputs = [ pyvex ];
+2 -3
pkgs/development/python-modules/angr/default.nix
··· 18 18 , protobuf 19 19 , psutil 20 20 , pycparser 21 - , pkgs 22 21 , pythonOlder 23 22 , pyvex 24 23 , sqlalchemy ··· 43 42 44 43 buildPythonPackage rec { 45 44 pname = "angr"; 46 - version = "9.0.6281"; 45 + version = "9.0.6790"; 47 46 disabled = pythonOlder "3.6"; 48 47 49 48 src = fetchFromGitHub { 50 49 owner = pname; 51 50 repo = pname; 52 51 rev = "v${version}"; 53 - sha256 = "10i4qdk8f342gzxiwy0pjdc35lc4q5ab7l5q420ca61cgdvxkk4r"; 52 + sha256 = "sha256-PRghK/BdgxGpPuinkGr+rREza1pQXz2gxnXiSmxBSTc="; 54 53 }; 55 54 56 55 propagatedBuildInputs = [
+2 -2
pkgs/development/python-modules/archinfo/default.nix
··· 7 7 8 8 buildPythonPackage rec { 9 9 pname = "archinfo"; 10 - version = "9.0.6281"; 10 + version = "9.0.6790"; 11 11 12 12 src = fetchFromGitHub { 13 13 owner = "angr"; 14 14 repo = pname; 15 15 rev = "v${version}"; 16 - sha256 = "sha256-ZO2P53RdR3cYhDbtrdGJnadFZgKkBdDi5gR/CB7YTpI="; 16 + sha256 = "sha256-A4WvRElahRv/XmlmS4WexMqm8FIZ1SSUnbdoAWWECMk="; 17 17 }; 18 18 19 19 checkInputs = [
+2 -2
pkgs/development/python-modules/claripy/default.nix
··· 13 13 14 14 buildPythonPackage rec { 15 15 pname = "claripy"; 16 - version = "9.0.6281"; 16 + version = "9.0.6790"; 17 17 disabled = pythonOlder "3.6"; 18 18 19 19 src = fetchFromGitHub { 20 20 owner = "angr"; 21 21 repo = pname; 22 22 rev = "v${version}"; 23 - sha256 = "sha256-gvo8I6LQRAEUa7QiV5Sugrt+e2SmGkkKfsGn/IKz+Mk="; 23 + sha256 = "sha256-GpWHj3bNgr7nQoIKM4VQtVkbObxqw6QkuEmfmPEiJmE="; 24 24 }; 25 25 26 26 # Use upstream z3 implementation
+4 -2
pkgs/development/python-modules/cle/default.nix
··· 15 15 16 16 let 17 17 # The binaries are following the argr projects release cycle 18 - version = "9.0.6281"; 18 + version = "9.0.6790"; 19 19 20 20 # Binary files from https://github.com/angr/binaries (only used for testing and only here) 21 21 binaries = fetchFromGitHub { ··· 35 35 owner = "angr"; 36 36 repo = pname; 37 37 rev = "v${version}"; 38 - sha256 = "0f2zc02dljmgp6ny6ja6917j08kqhwckncan860dq4xv93g61rmg"; 38 + sha256 = "sha256-zQggVRdc8fV1ulFnOlzYLvSOSOP3+dY8j+6lo+pXSkM="; 39 39 }; 40 40 41 41 propagatedBuildInputs = [ ··· 64 64 "test_ppc_rel24_relocation" 65 65 "test_ppc_addr16_ha_relocation" 66 66 "test_ppc_addr16_lo_relocation" 67 + # Binary not found, seems to be missing in the current binaries release 68 + "test_plt_full_relro" 67 69 ]; 68 70 69 71 pythonImportsCheck = [ "cle" ];
+39
pkgs/development/python-modules/openerz-api/default.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , fetchFromGitHub 4 + , pytestCheckHook 5 + , pythonOlder 6 + , requests 7 + , testfixtures 8 + }: 9 + 10 + buildPythonPackage rec { 11 + pname = "openerz-api"; 12 + version = "0.1.0"; 13 + disabled = pythonOlder "3.6"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "misialq"; 17 + repo = pname; 18 + rev = "v${version}"; 19 + sha256 = "10kxsmaz2rn26jijaxmdmhx8vjdz8hrhlrvd39gc8yvqbjwhi3nw"; 20 + }; 21 + 22 + propagatedBuildInputs = [ 23 + requests 24 + ]; 25 + 26 + checkInputs = [ 27 + pytestCheckHook 28 + testfixtures 29 + ]; 30 + 31 + pythonImportsCheck = [ "openerz_api" ]; 32 + 33 + meta = with lib; { 34 + description = "Python module to interact with the OpenERZ API"; 35 + homepage = "https://github.com/misialq/openerz-api"; 36 + license = with licenses; [ mit ]; 37 + maintainers = with maintainers; [ fab ]; 38 + }; 39 + }
+4 -5
pkgs/development/python-modules/pyvex/default.nix
··· 11 11 12 12 buildPythonPackage rec { 13 13 pname = "pyvex"; 14 - version = "9.0.6588"; 14 + version = "9.0.6790"; 15 15 16 16 src = fetchPypi { 17 17 inherit pname version; 18 - sha256 = "a77d29a5fffb8ddeed092a586086c46d489a5214a1b06829f51068486b3b6be3"; 18 + sha256 = "sha256-bqOLHGlLQ12nYzbv9H9nJ0/Q5APJb/9B82YtHk3IvYQ="; 19 19 }; 20 20 21 21 propagatedBuildInputs = [ ··· 26 26 pycparser 27 27 ]; 28 28 29 - postPatch = '' 30 - substituteInPlace pyvex_c/Makefile \ 31 - --replace "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" 29 + preBuild = '' 30 + export CC=${stdenv.cc.targetPrefix}cc 32 31 ''; 33 32 34 33 # No tests are available on PyPI, GitHub release has tests
+11 -2
pkgs/development/tools/rust/cargo-make/default.nix
··· 1 - { lib, stdenv, fetchurl, runCommand, fetchCrate, rustPlatform, Security, openssl, pkg-config 1 + { lib 2 + , stdenv 3 + , fetchurl 4 + , runCommand 5 + , fetchCrate 6 + , rustPlatform 7 + , Security 8 + , openssl 9 + , pkg-config 2 10 , SystemConfiguration 11 + , libiconv 3 12 }: 4 13 5 14 rustPlatform.buildRustPackage rec { ··· 14 23 nativeBuildInputs = [ pkg-config ]; 15 24 16 25 buildInputs = [ openssl ] 17 - ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ]; 26 + ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration libiconv ]; 18 27 19 28 cargoSha256 = "sha256-Upegh3W31sTaXl0iHZ3HiYs9urgXH/XhC0vQBAWvDIc="; 20 29
+1 -1
pkgs/servers/home-assistant/component-packages.nix
··· 590 590 "openalpr_cloud" = ps: with ps; [ ]; 591 591 "openalpr_local" = ps: with ps; [ ]; 592 592 "opencv" = ps: with ps; [ numpy ]; # missing inputs: opencv-python-headless 593 - "openerz" = ps: with ps; [ ]; # missing inputs: openerz-api 593 + "openerz" = ps: with ps; [ openerz-api ]; 594 594 "openevse" = ps: with ps; [ ]; # missing inputs: openevsewifi 595 595 "openexchangerates" = ps: with ps; [ ]; 596 596 "opengarage" = ps: with ps; [ ]; # missing inputs: open-garage
+1
pkgs/servers/home-assistant/default.nix
··· 332 332 "number" 333 333 "omnilogic" 334 334 "ondilo_ico" 335 + "openerz" 335 336 "ozw" 336 337 "panel_custom" 337 338 "panel_iframe"
+5 -4
pkgs/tools/misc/broot/default.nix
··· 1 - { lib, stdenv 1 + { lib 2 + , stdenv 2 3 , rustPlatform 3 4 , fetchCrate 4 5 , installShellFiles ··· 11 12 12 13 rustPlatform.buildRustPackage rec { 13 14 pname = "broot"; 14 - version = "1.2.0"; 15 + version = "1.2.9"; 15 16 16 17 src = fetchCrate { 17 18 inherit pname version; 18 - sha256 = "1mqaynrqaas82f5957lx31x80v74zwmwmjxxlbywajb61vh00d38"; 19 + sha256 = "sha256-5tM8ywLBPPjCKEfXIfUZ5aF4t9YpYA3tzERxC1NEsso="; 19 20 }; 20 21 21 - cargoHash = "sha256-ffFS1myFjoQ6768D4zUytN6F9paWeJJFPFugCrfh4iU="; 22 + cargoHash = "sha256-P5ukwtRUpIJIqJjwTXIB2xRnpyLkzMeBMHmUz4Ery3s="; 22 23 23 24 nativeBuildInputs = [ 24 25 makeWrapper
+7 -5
pkgs/tools/security/bettercap/default.nix
··· 10 10 11 11 buildGoModule rec { 12 12 pname = "bettercap"; 13 - version = "2.30.2"; 13 + version = "2.31.0"; 14 14 15 15 src = fetchFromGitHub { 16 16 owner = pname; 17 17 repo = pname; 18 18 rev = "v${version}"; 19 - sha256 = "sha256-5CAWMW0u/8BUn/8JJBApyHGH+/Tz8hzAmSChoT2gFr8="; 19 + sha256 = "sha256-PmS4ox1ZaHrBGJAdNByott61rEvfmR1ZJ12ut0MGtrc="; 20 20 }; 21 21 22 - vendorSha256 = "sha256-fApxHxdzEEc+M+U5f0271VgrkXTGkUD75BpDXpVYd5k="; 22 + vendorSha256 = "sha256-3j64Z4BQhAbUtoHJ6IT1SCsKxSeYZRxSO3K2Nx9Vv4w="; 23 23 24 24 doCheck = false; 25 25 ··· 30 30 meta = with lib; { 31 31 description = "A man in the middle tool"; 32 32 longDescription = '' 33 - BetterCAP is a powerful, flexible and portable tool created to perform various types of MITM attacks against a network, manipulate HTTP, HTTPS and TCP traffic in realtime, sniff for credentials and much more. 33 + BetterCAP is a powerful, flexible and portable tool created to perform various 34 + types of MITM attacks against a network, manipulate HTTP, HTTPS and TCP traffic 35 + in realtime, sniff for credentials and much more. 34 36 ''; 35 37 homepage = "https://www.bettercap.org/"; 36 - license = with licenses; gpl3; 38 + license = with licenses; [ gpl3Only ]; 37 39 maintainers = with maintainers; [ y0no ]; 38 40 }; 39 41 }
+4
pkgs/top-level/all-packages.nix
··· 11322 11322 }; 11323 11323 rust = rust_1_51; 11324 11324 11325 + mrustc = callPackage ../development/compilers/mrustc { }; 11326 + mrustc-minicargo = callPackage ../development/compilers/mrustc/minicargo.nix { }; 11327 + mrustc-bootstrap = callPackage ../development/compilers/mrustc/bootstrap.nix { }; 11328 + 11325 11329 rustPackages_1_45 = rust_1_45.packages.stable; 11326 11330 rustPackages_1_51 = rust_1_51.packages.stable; 11327 11331 rustPackages = rustPackages_1_51;
+2
pkgs/top-level/python-packages.nix
··· 4568 4568 pythonPackages = self; 4569 4569 }); 4570 4570 4571 + openerz-api = callPackage ../development/python-modules/openerz-api { }; 4572 + 4571 4573 openhomedevice = callPackage ../development/python-modules/openhomedevice { }; 4572 4574 4573 4575 openidc-client = callPackage ../development/python-modules/openidc-client { };