Merge origin/master into haskell-updates.

This commit is contained in:
Peter Simons 2021-04-23 17:15:13 +02:00
commit a8ade4385f
755 changed files with 15846 additions and 8017 deletions

3
.github/CODEOWNERS vendored
View File

@ -126,9 +126,6 @@
# Jetbrains # Jetbrains
/pkgs/applications/editors/jetbrains @edwtjo /pkgs/applications/editors/jetbrains @edwtjo
# Eclipse
/pkgs/applications/editors/eclipse @rycee
# Licenses # Licenses
/lib/licenses.nix @alyssais /lib/licenses.nix @alyssais

4
.github/labeler.yml vendored
View File

@ -5,6 +5,10 @@
- pkgs/development/libraries/agda/**/* - pkgs/development/libraries/agda/**/*
- pkgs/top-level/agda-packages.nix - pkgs/top-level/agda-packages.nix
"6.topic: bsd":
- pkgs/os-specific/bsd/**/*
- pkgs/stdenv/freebsd/**/*
"6.topic: cinnamon": "6.topic: cinnamon":
- pkgs/desktops/cinnamon/**/* - pkgs/desktops/cinnamon/**/*

29
.github/workflows/direct-push.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: "Direct Push Warning"
on:
push:
branches:
- master
- release-**
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'NixOS'
env:
GITHUB_SHA: ${{ github.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}
steps:
- name: Check if commit is a merge commit
id: ismerge
run: |
ISMERGE=$(curl -H 'Accept: application/vnd.github.groot-preview+json' -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.GITHUB_REPOSITORY }}/commits/${{ env.GITHUB_SHA }}/pulls | jq -r '.[] | select(.merge_commit_sha == "${{ env.GITHUB_SHA }}") | any')
echo "::set-output name=ismerge::$ISMERGE"
- name: Warn if the commit was a direct push
if: steps.ismerge.outputs.ismerge != 'true'
uses: peter-evans/commit-comment@v1
with:
body: |
@${{ github.actor }}, you pushed a commit directly to master/release branch
instead of going through a Pull Request.
That's highly discouraged beyond the few exceptions listed
on https://github.com/NixOS/nixpkgs/issues/118661

View File

@ -0,0 +1,13 @@
# DLib {#dlib}
[DLib](http://dlib.net/) is a modern, C++-based toolkit which provides several machine learning algorithms.
## Compiling without AVX support {#compiling-without-avx-support}
Especially older CPUs don\'t support [AVX](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms.
On the affected hardware errors like `Illegal instruction` will occur. In those cases AVX support needs to be disabled:
```nix
self: super: { dlib = super.dlib.override { avxSupport = false; }; }
```

View File

@ -1,24 +0,0 @@
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="dlib">
<title>DLib</title>
<para>
<link xlink:href="http://dlib.net/">DLib</link> is a modern, C++-based toolkit which provides several machine learning algorithms.
</para>
<section xml:id="compiling-without-avx-support">
<title>Compiling without AVX support</title>
<para>
Especially older CPUs don't support <link xlink:href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions">AVX</link> (<abbrev>Advanced Vector Extensions</abbrev>) instructions that are used by DLib to optimize their algorithms.
</para>
<para>
On the affected hardware errors like <literal>Illegal instruction</literal> will occur. In those cases AVX support needs to be disabled:
<programlisting>self: super: {
dlib = super.dlib.override { avxSupport = false; };
}</programlisting>
</para>
</section>
</section>

View File

@ -17,3 +17,29 @@ following, it's a likely sign that you need to have macFUSE installed.
Referenced from: /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs Referenced from: /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs
Reason: image not found Reason: image not found
[1] 92299 abort /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs [1] 92299 abort /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs
Package maintainers may often encounter the following error when building FUSE
packages on macOS:
checking for fuse.h... no
configure: error: No fuse.h found.
This happens on autoconf based projects that uses `AC_CHECK_HEADERS` or
`AC_CHECK_LIBS` to detect libfuse, and will occur even when the `fuse` package
is included in `buildInputs`. It happens because libfuse headers throw an error
on macOS if the `FUSE_USE_VERSION` macro is undefined. Many proejcts do define
`FUSE_USE_VERSION`, but only inside C source files. This results in the above
error at configure time because the configure script would attempt to compile
sample FUSE programs without defining `FUSE_USE_VERSION`.
There are two possible solutions for this problem in Nixpkgs:
1. Pass `FUSE_USE_VERSION` to the configure script by adding
`CFLAGS=-DFUSE_USE_VERSION=25` in `configureFlags`. The actual value would
have to match the definition used in the upstream source code.
2. Remove `AC_CHECK_HEADERS` / `AC_CHECK_LIBS` for libfuse.
However, a better solution might be to fix the build script upstream to use
`PKG_CHECK_MODULES` instead. This approach wouldn't suffer from the problem that
`AC_CHECK_HEADERS`/`AC_CHECK_LIBS` has at the price of introducing a dependency
on pkg-config.

View File

@ -6,7 +6,7 @@
This chapter contains information about how to use and maintain the Nix expressions for a number of specific packages, such as the Linux kernel or X.org. This chapter contains information about how to use and maintain the Nix expressions for a number of specific packages, such as the Linux kernel or X.org.
</para> </para>
<xi:include href="citrix.section.xml" /> <xi:include href="citrix.section.xml" />
<xi:include href="dlib.xml" /> <xi:include href="dlib.section.xml" />
<xi:include href="eclipse.section.xml" /> <xi:include href="eclipse.section.xml" />
<xi:include href="elm.section.xml" /> <xi:include href="elm.section.xml" />
<xi:include href="emacs.section.xml" /> <xi:include href="emacs.section.xml" />

View File

@ -0,0 +1,514 @@
# Coding conventions {#chap-conventions}
## Syntax {#sec-syntax}
- Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts.
- 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 its asking for trouble.
- 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"/>.
- Function calls with attribute set arguments are written as
```nix
foo {
arg = ...;
}
```
not
```nix
foo
{
arg = ...;
}
```
Also fine is
```nix
foo { arg = ...; }
```
if it's a short call.
- In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
```nix
# A long list.
list = [
elem1
elem2
elem3
];
# A long attribute set.
attrs = {
attr1 = short_expr;
attr2 =
if true then big_expr else big_expr;
};
# Combined
listOfAttrs = [
{
attr1 = 3;
attr2 = "fff";
}
{
attr1 = 5;
attr2 = "ggg";
}
];
```
- Short lists or attribute sets can be written on one line:
```nix
# A short list.
list = [ elem1 elem2 elem3 ];
# A short set.
attrs = { x = 1280; y = 1024; };
```
- Breaking in the middle of a function argument can give hard-to-read code, like
```nix
someFunction { x = 1280;
y = 1024; } otherArg
yetAnotherArg
```
(especially if the argument is very large, spanning multiple lines).
Better:
```nix
someFunction
{ x = 1280; y = 1024; }
otherArg
yetAnotherArg
```
or
```nix
let res = { x = 1280; y = 1024; };
in someFunction res otherArg yetAnotherArg
```
- The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e.
```nix
{ arg1, arg2 }:
assert system == "i686-linux";
stdenv.mkDerivation { ...
```
not
```nix
{ arg1, arg2 }:
assert system == "i686-linux";
stdenv.mkDerivation { ...
```
- Function formal arguments are written as:
```nix
{ arg1, arg2, arg3 }:
```
but if they don't fit on one line they're written as:
```nix
{ arg1, arg2, arg3
, arg4, ...
, # Some comment...
argN
}:
```
- Functions should list their expected arguments as precisely as possible. That is, write
```nix
{ stdenv, fetchurl, perl }: ...
```
instead of
```nix
args: with args; ...
```
or
```nix
{ stdenv, fetchurl, perl, ... }: ...
```
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:
```nix
{ stdenv, doCoverageAnalysis ? false, ... } @ args:
stdenv.mkDerivation (args // {
... if doCoverageAnalysis then "bla" else "" ...
})
```
instead of
```nix
args:
args.stdenv.mkDerivation (args // {
... if args ? doCoverageAnalysis && args.doCoverageAnalysis then "bla" else "" ...
})
```
- Arguments should be listed in the order they are used, with the exception of `lib`, which always goes first.
- 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.
## Package naming {#sec-package-naming}
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.
In Nixpkgs, there are generally three different names associated with a package:
- The `name` attribute of the derivation (excluding the version part). This is what most users see, in particular when using `nix-env`.
- 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`.
- The filename for (the directory containing) the Nix expression.
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`.
There are a few naming guidelines:
- The `name` attribute _should_ be identical to the upstream package name.
- The `name` attribute _must not_ contain uppercase letters — e.g., `"mplayer-1.0rc2"` instead of `"MPlayer-1.0rc2"`.
- The version part of the `name` attribute _must_ start with a digit (following a dash) — e.g., `"hello-0.3.1rc2"`.
- 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"`.
- 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.
- 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" />
## File naming and organisation {#sec-organisation}
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`.
### Hierarchy {#sec-hierarchy}
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 its a library foremost, so it goes under `pkgs/development/libraries`.
When in doubt, consider refactoring the `pkgs/` tree, e.g. creating new categories or splitting up an existing category.
**If its used to support _software development_:**
- **If its a _library_ used by other packages:**
- `development/libraries` (e.g. `libxml2`)
- **If its a _compiler_:**
- `development/compilers` (e.g. `gcc`)
- **If its an _interpreter_:**
- `development/interpreters` (e.g. `guile`)
- **If its a (set of) development _tool(s)_:**
- **If its a _parser generator_ (including lexers):**
- `development/tools/parsing` (e.g. `bison`, `flex`)
- **If its a _build manager_:**
- `development/tools/build-managers` (e.g. `gnumake`)
- **Else:**
- `development/tools/misc` (e.g. `binutils`)
- **Else:**
- `development/misc`
**If its a (set of) _tool(s)_:**
(A tool is a relatively small program, especially one intended to be used non-interactively.)
- **If its for _networking_:**
- `tools/networking` (e.g. `wget`)
- **If its for _text processing_:**
- `tools/text` (e.g. `diffutils`)
- **If its a _system utility_, i.e., something related or essential to the operation of a system:**
- `tools/system` (e.g. `cron`)
- **If its an _archiver_ (which may include a compression function):**
- `tools/archivers` (e.g. `zip`, `tar`)
- **If its a _compression_ program:**
- `tools/compression` (e.g. `gzip`, `bzip2`)
- **If its a _security_-related program:**
- `tools/security` (e.g. `nmap`, `gnupg`)
- **Else:**
- `tools/misc`
**If its a _shell_:**
- `shells` (e.g. `bash`)
**If its a _server_:**
- **If its a web server:**
- `servers/http` (e.g. `apache-httpd`)
- **If its an implementation of the X Windowing System:**
- `servers/x11` (e.g. `xorg` — this includes the client libraries and programs)
- **Else:**
- `servers/misc`
**If its a _desktop environment_:**
- `desktops` (e.g. `kde`, `gnome`, `enlightenment`)
**If its a _window manager_:**
- `applications/window-managers` (e.g. `awesome`, `stumpwm`)
**If its an _application_:**
A (typically large) program with a distinct user interface, primarily used interactively.
- **If its a _version management system_:**
- `applications/version-management` (e.g. `subversion`)
- **If its a _terminal emulator_:**
- `applications/terminal-emulators` (e.g. `alacritty` or `rxvt` or `termite`)
- **If its for _video playback / editing_:**
- `applications/video` (e.g. `vlc`)
- **If its for _graphics viewing / editing_:**
- `applications/graphics` (e.g. `gimp`)
- **If its for _networking_:**
- **If its a _mailreader_:**
- `applications/networking/mailreaders` (e.g. `thunderbird`)
- **If its a _newsreader_:**
- `applications/networking/newsreaders` (e.g. `pan`)
- **If its a _web browser_:**
- `applications/networking/browsers` (e.g. `firefox`)
- **Else:**
- `applications/networking/misc`
- **Else:**
- `applications/misc`
**If its _data_ (i.e., does not have a straight-forward executable semantics):**
- **If its a _font_:**
- `data/fonts`
- **If its an _icon theme_:**
- `data/icons`
- **If its related to _SGML/XML processing_:**
- **If its an _XML DTD_:**
- `data/sgml+xml/schemas/xml-dtd` (e.g. `docbook`)
- **If its an _XSLT stylesheet_:**
(Okay, these are executable...)
- `data/sgml+xml/stylesheets/xslt` (e.g. `docbook-xsl`)
- **If its a _theme_ for a _desktop environment_, a _window manager_ or a _display manager_:**
- `data/themes`
**If its a _game_:**
- `games`
**Else:**
- `misc`
### Versioning {#sec-versioning}
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 dont 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.
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`.
All versions of a package _must_ be included in `all-packages.nix` to make sure that they evaluate correctly.
## Fetching Sources {#sec-sources}
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.
You can find many source fetch helpers in `pkgs/build-support/fetch*`.
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:
- Bad: Uses `git://` which won't be proxied.
```nix
src = fetchgit {
url = "git://github.com/NixOS/nix.git";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
}
```
- Better: This is ok, but an archive fetch will still be faster.
```nix
src = fetchgit {
url = "https://github.com/NixOS/nix.git";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
}
```
- Best: Fetches a snapshot archive and you get the rev you want.
```nix
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc";
}
```
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`.
## Obtaining source hash {#sec-source-hashes}
Preferred source hash type is sha256. There are several ways to get it.
1. Prefetch URL (with `nix-prefetch-XXX URL`, where `XXX` is one of `url`, `git`, `hg`, `cvs`, `bzr`, `svn`). Hash is printed to stdout.
2. Prefetch by package source (with `nix-prefetch-url '<nixpkgs>' -A PACKAGE.src`, where `PACKAGE` is package attribute name). Hash is printed to stdout.
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).
3. Upstream provided hash: use it when upstream provides `sha256` or `sha512` (when upstream provides `md5`, don't use it, compute `sha256` instead).
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.
You can convert between formats with nix-hash, for example:
```ShellSession
$ nix-hash --type sha256 --to-base32 HASH
```
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.
5. Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
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.
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.
::: warning
This method has security problems. Check below for details.
:::
### Obtaining hashes securely {#sec-source-hashes-security}
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:
- `http://` URLs are not secure to prefetch hash from;
- hashes from upstream (in method 3) should be obtained via secure protocol;
- `https://` URLs are secure in methods 1, 2, 3;
- `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.
## Patches {#sec-patches}
Patches available online should be retrieved using `fetchpatch`.
```nix
patches = [
(fetchpatch {
name = "fix-check-for-using-shared-freetype-lib.patch";
url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285";
sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr";
})
];
```
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.
```nix
patches = [ ./0001-changes.patch ];
```
If you do need to do create this sort of patch file, one way to do so is with git:
1. Move to the root directory of the source code you're patching.
```ShellSession
$ cd the/program/source
```
2. If a git repository is not already present, create one and stage all of the source files.
```ShellSession
$ git init
$ git add .
```
3. Edit some files to make whatever changes need to be included in the patch.
4. Use git to create a diff, and pipe the output to a patch file:
```ShellSession
$ git diff > nixpkgs/pkgs/the/package/0001-changes.patch
```

View File

@ -1,943 +0,0 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-conventions">
<title>Coding conventions</title>
<section xml:id="sec-syntax">
<title>Syntax</title>
<itemizedlist>
<listitem>
<para>
Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts.
</para>
</listitem>
<listitem>
<para>
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 its asking for trouble.
</para>
</listitem>
<listitem>
<para>
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"/>.
</para>
</listitem>
<listitem>
<para>
Function calls with attribute set arguments are written as
<programlisting>
foo {
arg = ...;
}
</programlisting>
not
<programlisting>
foo
{
arg = ...;
}
</programlisting>
Also fine is
<programlisting>
foo { arg = ...; }
</programlisting>
if it's a short call.
</para>
</listitem>
<listitem>
<para>
In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
<programlisting>
# A long list.
list = [
elem1
elem2
elem3
];
# A long attribute set.
attrs = {
attr1 = short_expr;
attr2 =
if true then big_expr else big_expr;
};
# Combined
listOfAttrs = [
{
attr1 = 3;
attr2 = "fff";
}
{
attr1 = 5;
attr2 = "ggg";
}
];
</programlisting>
</para>
</listitem>
<listitem>
<para>
Short lists or attribute sets can be written on one line:
<programlisting>
# A short list.
list = [ elem1 elem2 elem3 ];
# A short set.
attrs = { x = 1280; y = 1024; };
</programlisting>
</para>
</listitem>
<listitem>
<para>
Breaking in the middle of a function argument can give hard-to-read code, like
<programlisting>
someFunction { x = 1280;
y = 1024; } otherArg
yetAnotherArg
</programlisting>
(especially if the argument is very large, spanning multiple lines).
</para>
<para>
Better:
<programlisting>
someFunction
{ x = 1280; y = 1024; }
otherArg
yetAnotherArg
</programlisting>
or
<programlisting>
let res = { x = 1280; y = 1024; };
in someFunction res otherArg yetAnotherArg
</programlisting>
</para>
</listitem>
<listitem>
<para>
The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e.
<programlisting>
{ arg1, arg2 }:
assert system == "i686-linux";
stdenv.mkDerivation { ...
</programlisting>
not
<programlisting>
{ arg1, arg2 }:
assert system == "i686-linux";
stdenv.mkDerivation { ...
</programlisting>
</para>
</listitem>
<listitem>
<para>
Function formal arguments are written as:
<programlisting>
{ arg1, arg2, arg3 }:
</programlisting>
but if they don't fit on one line they're written as:
<programlisting>
{ arg1, arg2, arg3
, arg4, ...
, # Some comment...
argN
}:
</programlisting>
</para>
</listitem>
<listitem>
<para>
Functions should list their expected arguments as precisely as possible. That is, write
<programlisting>
{ stdenv, fetchurl, perl }: <replaceable>...</replaceable>
</programlisting>
instead of
<programlisting>
args: with args; <replaceable>...</replaceable>
</programlisting>
or
<programlisting>
{ stdenv, fetchurl, perl, ... }: <replaceable>...</replaceable>
</programlisting>
</para>
<para>
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:
<programlisting>
{ stdenv, doCoverageAnalysis ? false, ... } @ args:
stdenv.mkDerivation (args // {
<replaceable>...</replaceable> if doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable>
})
</programlisting>
instead of
<programlisting>
args:
args.stdenv.mkDerivation (args // {
<replaceable>...</replaceable> if args ? doCoverageAnalysis &amp;&amp; args.doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable>
})
</programlisting>
</para>
</listitem>
<listitem>
<para>
Arguments should be listed in the order they are used, with the exception of <varname>lib</varname>, which always goes first.
</para>
</listitem>
<listitem>
<para>
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.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-package-naming">
<title>Package naming</title>
<para>
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.
</para>
<para>
In Nixpkgs, there are generally three different names associated with a package:
<itemizedlist>
<listitem>
<para>
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>.
</para>
</listitem>
<listitem>
<para>
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>.
</para>
</listitem>
<listitem>
<para>
The filename for (the directory containing) the Nix expression.
</para>
</listitem>
</itemizedlist>
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>.
</para>
<para>
There are a few naming guidelines:
<itemizedlist>
<listitem>
<para>
The <literal>name</literal> attribute <emphasis>should</emphasis> be identical to the upstream package name.
</para>
</listitem>
<listitem>
<para>
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>.
</para>
</listitem>
<listitem>
<para>
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>.
</para>
</listitem>
<listitem>
<para>
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>.
</para>
</listitem>
<listitem>
<para>
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.
</para>
</listitem>
<listitem>
<para>
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" />
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section xml:id="sec-organisation">
<title>File naming and organisation</title>
<para>
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>.
</para>
<section xml:id="sec-hierarchy">
<title>Hierarchy</title>
<para>
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 its a library foremost, so it goes under <filename>pkgs/development/libraries</filename>.
</para>
<para>
When in doubt, consider refactoring the <filename>pkgs/</filename> tree, e.g. creating new categories or splitting up an existing category.
</para>
<variablelist>
<varlistentry>
<term>
If its used to support <emphasis>software development</emphasis>:
</term>
<listitem>
<variablelist>
<varlistentry>
<term>
If its a <emphasis>library</emphasis> used by other packages:
</term>
<listitem>
<para>
<filename>development/libraries</filename> (e.g. <filename>libxml2</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>compiler</emphasis>:
</term>
<listitem>
<para>
<filename>development/compilers</filename> (e.g. <filename>gcc</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its an <emphasis>interpreter</emphasis>:
</term>
<listitem>
<para>
<filename>development/interpreters</filename> (e.g. <filename>guile</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a (set of) development <emphasis>tool(s)</emphasis>:
</term>
<listitem>
<variablelist>
<varlistentry>
<term>
If its a <emphasis>parser generator</emphasis> (including lexers):
</term>
<listitem>
<para>
<filename>development/tools/parsing</filename> (e.g. <filename>bison</filename>, <filename>flex</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>build manager</emphasis>:
</term>
<listitem>
<para>
<filename>development/tools/build-managers</filename> (e.g. <filename>gnumake</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>development/tools/misc</filename> (e.g. <filename>binutils</filename>)
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>development/misc</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a (set of) <emphasis>tool(s)</emphasis>:
</term>
<listitem>
<para>
(A tool is a relatively small program, especially one intended to be used non-interactively.)
</para>
<variablelist>
<varlistentry>
<term>
If its for <emphasis>networking</emphasis>:
</term>
<listitem>
<para>
<filename>tools/networking</filename> (e.g. <filename>wget</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its for <emphasis>text processing</emphasis>:
</term>
<listitem>
<para>
<filename>tools/text</filename> (e.g. <filename>diffutils</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>system utility</emphasis>, i.e., something related or essential to the operation of a system:
</term>
<listitem>
<para>
<filename>tools/system</filename> (e.g. <filename>cron</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its an <emphasis>archiver</emphasis> (which may include a compression function):
</term>
<listitem>
<para>
<filename>tools/archivers</filename> (e.g. <filename>zip</filename>, <filename>tar</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>compression</emphasis> program:
</term>
<listitem>
<para>
<filename>tools/compression</filename> (e.g. <filename>gzip</filename>, <filename>bzip2</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>security</emphasis>-related program:
</term>
<listitem>
<para>
<filename>tools/security</filename> (e.g. <filename>nmap</filename>, <filename>gnupg</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>tools/misc</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>shell</emphasis>:
</term>
<listitem>
<para>
<filename>shells</filename> (e.g. <filename>bash</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>server</emphasis>:
</term>
<listitem>
<variablelist>
<varlistentry>
<term>
If its a web server:
</term>
<listitem>
<para>
<filename>servers/http</filename> (e.g. <filename>apache-httpd</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its an implementation of the X Windowing System:
</term>
<listitem>
<para>
<filename>servers/x11</filename> (e.g. <filename>xorg</filename> — this includes the client libraries and programs)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>servers/misc</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>desktop environment</emphasis>:
</term>
<listitem>
<para>
<filename>desktops</filename> (e.g. <filename>kde</filename>, <filename>gnome</filename>, <filename>enlightenment</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>window manager</emphasis>:
</term>
<listitem>
<para>
<filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its an <emphasis>application</emphasis>:
</term>
<listitem>
<para>
A (typically large) program with a distinct user interface, primarily used interactively.
</para>
<variablelist>
<varlistentry>
<term>
If its a <emphasis>version management system</emphasis>:
</term>
<listitem>
<para>
<filename>applications/version-management</filename> (e.g. <filename>subversion</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>terminal emulator</emphasis>:
</term>
<listitem>
<para>
<filename>applications/terminal-emulators</filename> (e.g. <filename>alacritty</filename> or <filename>rxvt</filename> or <filename>termite</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its for <emphasis>video playback / editing</emphasis>:
</term>
<listitem>
<para>
<filename>applications/video</filename> (e.g. <filename>vlc</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its for <emphasis>graphics viewing / editing</emphasis>:
</term>
<listitem>
<para>
<filename>applications/graphics</filename> (e.g. <filename>gimp</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its for <emphasis>networking</emphasis>:
</term>
<listitem>
<variablelist>
<varlistentry>
<term>
If its a <emphasis>mailreader</emphasis>:
</term>
<listitem>
<para>
<filename>applications/networking/mailreaders</filename> (e.g. <filename>thunderbird</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>newsreader</emphasis>:
</term>
<listitem>
<para>
<filename>applications/networking/newsreaders</filename> (e.g. <filename>pan</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>web browser</emphasis>:
</term>
<listitem>
<para>
<filename>applications/networking/browsers</filename> (e.g. <filename>firefox</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>applications/networking/misc</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>applications/misc</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its <emphasis>data</emphasis> (i.e., does not have a straight-forward executable semantics):
</term>
<listitem>
<variablelist>
<varlistentry>
<term>
If its a <emphasis>font</emphasis>:
</term>
<listitem>
<para>
<filename>data/fonts</filename>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its an <emphasis>icon theme</emphasis>:
</term>
<listitem>
<para>
<filename>data/icons</filename>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its related to <emphasis>SGML/XML processing</emphasis>:
</term>
<listitem>
<variablelist>
<varlistentry>
<term>
If its an <emphasis>XML DTD</emphasis>:
</term>
<listitem>
<para>
<filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g. <filename>docbook</filename>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its an <emphasis>XSLT stylesheet</emphasis>:
</term>
<listitem>
<para>
(Okay, these are executable...)
</para>
<para>
<filename>data/sgml+xml/stylesheets/xslt</filename> (e.g. <filename>docbook-xsl</filename>)
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>theme</emphasis> for a <emphasis>desktop environment</emphasis>, a <emphasis>window manager</emphasis> or a <emphasis>display manager</emphasis>:
</term>
<listitem>
<para>
<filename>data/themes</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
If its a <emphasis>game</emphasis>:
</term>
<listitem>
<para>
<filename>games</filename>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Else:
</term>
<listitem>
<para>
<filename>misc</filename>
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="sec-versioning">
<title>Versioning</title>
<para>
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 dont 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.
</para>
<para>
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>.
</para>
<para>
All versions of a package <emphasis>must</emphasis> be included in <filename>all-packages.nix</filename> to make sure that they evaluate correctly.
</para>
</section>
</section>
<section xml:id="sec-sources">
<title>Fetching Sources</title>
<para>
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.
</para>
<para>
You can find many source fetch helpers in <literal>pkgs/build-support/fetch*</literal>.
</para>
<para>
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:
<itemizedlist>
<listitem>
<para>
Bad: Uses <literal>git://</literal> which won't be proxied.
<programlisting>
src = fetchgit {
url = "git://github.com/NixOS/nix.git";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
}
</programlisting>
</para>
</listitem>
<listitem>
<para>
Better: This is ok, but an archive fetch will still be faster.
<programlisting>
src = fetchgit {
url = "https://github.com/NixOS/nix.git";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
}
</programlisting>
</para>
</listitem>
<listitem>
<para>
Best: Fetches a snapshot archive and you get the rev you want.
<programlisting>
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc";
}
</programlisting>
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>.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section xml:id="sec-source-hashes">
<title>Obtaining source hash</title>
<para>
Preferred source hash type is sha256. There are several ways to get it.
</para>
<orderedlist>
<listitem>
<para>
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.
</para>
</listitem>
<listitem>
<para>
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.
</para>
<para>
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).
</para>
</listitem>
<listitem>
<para>
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).
</para>
<para>
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.
</para>
<para>
You can convert between formats with nix-hash, for example:
<screen>
<prompt>$ </prompt>nix-hash --type sha256 --to-base32 <replaceable>HASH</replaceable>
</screen>
</para>
</listitem>
<listitem>
<para>
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.
</para>
</listitem>
<listitem>
<para>
Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
</para>
<para>
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.
</para>
<para>
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.
</para>
<warning>
<para>
This method has security problems. Check below for details.
</para>
</warning>
</listitem>
</orderedlist>
<section xml:id="sec-source-hashes-security">
<title>Obtaining hashes securely</title>
<para>
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:
</para>
<itemizedlist>
<listitem>
<para>
<literal>http://</literal> URLs are not secure to prefetch hash from;
</para>
</listitem>
<listitem>
<para>
hashes from upstream (in method 3) should be obtained via secure protocol;
</para>
</listitem>
<listitem>
<para>
<literal>https://</literal> URLs are secure in methods 1, 2, 3;
</para>
</listitem>
<listitem>
<para>
<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.
</para>
</listitem>
</itemizedlist>
</section>
</section>
<section xml:id="sec-patches">
<title>Patches</title>
<para>
Patches available online should be retrieved using <literal>fetchpatch</literal>.
</para>
<para>
<programlisting>
patches = [
(fetchpatch {
name = "fix-check-for-using-shared-freetype-lib.patch";
url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285";
sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr";
})
];
</programlisting>
</para>
<para>
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.
</para>
<para>
<programlisting>
patches = [ ./0001-changes.patch ];
</programlisting>
</para>
<para>
If you do need to do create this sort of patch file, one way to do so is with git:
<orderedlist>
<listitem>
<para>
Move to the root directory of the source code you're patching.
<screen>
<prompt>$ </prompt>cd the/program/source</screen>
</para>
</listitem>
<listitem>
<para>
If a git repository is not already present, create one and stage all of the source files.
<screen>
<prompt>$ </prompt>git init
<prompt>$ </prompt>git add .</screen>
</para>
</listitem>
<listitem>
<para>
Edit some files to make whatever changes need to be included in the patch.
</para>
</listitem>
<listitem>
<para>
Use git to create a diff, and pipe the output to a patch file:
<screen>
<prompt>$ </prompt>git diff > nixpkgs/pkgs/the/package/0001-changes.patch</screen>
</para>
</listitem>
</orderedlist>
</para>
</section>
</chapter>

View File

@ -0,0 +1,24 @@
# Contributing to this documentation {#chap-contributing}
The DocBook sources of the Nixpkgs manual are in the [doc](https://github.com/NixOS/nixpkgs/tree/master/doc) subdirectory of the Nixpkgs repository.
You can quickly check your edits with `make`:
```ShellSession
$ cd /path/to/nixpkgs/doc
$ nix-shell
[nix-shell]$ make $makeFlags
```
If you experience problems, run `make debug` to help understand the docbook errors.
After making modifications to the manual, it's important to build it before committing. You can do that as follows:
```ShellSession
$ cd /path/to/nixpkgs/doc
$ nix-shell
[nix-shell]$ make clean
[nix-shell]$ nix-build .
```
If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual.html`.

View File

@ -1,30 +0,0 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-contributing">
<title>Contributing to this documentation</title>
<para>
The DocBook sources of the Nixpkgs manual are in the <filename
xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename> subdirectory of the Nixpkgs repository.
</para>
<para>
You can quickly check your edits with <command>make</command>:
</para>
<screen>
<prompt>$ </prompt>cd /path/to/nixpkgs/doc
<prompt>$ </prompt>nix-shell
<prompt>[nix-shell]$ </prompt>make $makeFlags
</screen>
<para>
If you experience problems, run <command>make debug</command> to help understand the docbook errors.
</para>
<para>
After making modifications to the manual, it's important to build it before committing. You can do that as follows:
<screen>
<prompt>$ </prompt>cd /path/to/nixpkgs/doc
<prompt>$ </prompt>nix-shell
<prompt>[nix-shell]$ </prompt>make clean
<prompt>[nix-shell]$ </prompt>nix-build .
</screen>
If the build succeeds, the manual will be in <filename>./result/share/doc/nixpkgs/manual.html</filename>.
</para>
</chapter>

View File

@ -0,0 +1,77 @@
# Quick Start to Adding a Package {#chap-quick-start}
To add a package to Nixpkgs:
1. Checkout the Nixpkgs source tree:
```ShellSession
$ git clone https://github.com/NixOS/nixpkgs
$ cd nixpkgs
```
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.
```ShellSession
$ mkdir pkgs/development/libraries/libfoo
```
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`.
```ShellSession
$ emacs pkgs/development/libraries/libfoo/default.nix
$ git add pkgs/development/libraries/libfoo/default.nix
```
You can have a look at the existing Nix expressions under `pkgs/` to see how its done. Here are some good ones:
- 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.
- 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`.
- 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`.
- 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`.
- 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.
- 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.
- JDiskReport, a Java utility: [`pkgs/tools/misc/jdiskreport/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix). Nixpkgs doesnt have a decent `stdenv` for Java yet so this is pretty ad-hoc.
- 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.
- 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.
Some notes:
- All [`meta`](#chap-meta) attributes are optional, but its still a good idea to provide at least the `description`, `homepage` and [`license`](#sec-meta-license).
- 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.
- 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).
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).
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`.
```ShellSession
$ emacs pkgs/top-level/all-packages.nix
```
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.
5. To test whether the package builds, run the following command from the root of the nixpkgs source tree:
```ShellSession
$ nix-build -A libfoo
```
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.
6. If you want to install the package into your profile (optional), do
```ShellSession
$ nix-env -f . -iA libfoo
```
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.

View File

@ -1,152 +0,0 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-quick-start">
<title>Quick Start to Adding a Package</title>
<para>
To add a package to Nixpkgs:
<orderedlist>
<listitem>
<para>
Checkout the Nixpkgs source tree:
<screen>
<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs
<prompt>$ </prompt>cd nixpkgs</screen>
</para>
</listitem>
<listitem>
<para>
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.
<screen>
<prompt>$ </prompt>mkdir pkgs/development/libraries/libfoo</screen>
</para>
</listitem>
<listitem>
<para>
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>.
<screen>
<prompt>$ </prompt>emacs pkgs/development/libraries/libfoo/default.nix
<prompt>$ </prompt>git add pkgs/development/libraries/libfoo/default.nix</screen>
</para>
<para>
You can have a look at the existing Nix expressions under <filename>pkgs/</filename> to see how its done. Here are some good ones:
<itemizedlist>
<listitem>
<para>
GNU Hello: <link
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.
</para>
</listitem>
<listitem>
<para>
GNU cpio: <link
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>.
</para>
</listitem>
<listitem>
<para>
GNU Multiple Precision arithmetic library (GMP): <link
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>.
</para>
</listitem>
<listitem>
<para>
Pan, a GTK-based newsreader: <link
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>.
</para>
</listitem>
<listitem>
<para>
Apache HTTPD: <link
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.
</para>
</listitem>
<listitem>
<para>
Thunderbird: <link
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.
</para>
</listitem>
<listitem>
<para>
JDiskReport, a Java utility: <link
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 doesnt have a decent <varname>stdenv</varname> for Java yet so this is pretty ad-hoc.
</para>
</listitem>
<listitem>
<para>
XML::Simple, a Perl module: <link
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.
</para>
</listitem>
<listitem>
<para>
Adobe Reader: <link
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
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.
</para>
</listitem>
</itemizedlist>
</para>
<para>
Some notes:
<itemizedlist>
<listitem>
<para>
All <varname linkend="chap-meta">meta</varname> attributes are optional, but its still a good idea to provide at least the <varname>description</varname>, <varname>homepage</varname> and <varname
linkend="sec-meta-license">license</varname>.
</para>
</listitem>
<listitem>
<para>
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.
</para>
</listitem>
<listitem>
<para>
A list of schemes for <literal>mirror://</literal> URLs can be found in <link
xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix"><filename>pkgs/build-support/fetchurl/mirrors.nix</filename></link>.
</para>
</listitem>
</itemizedlist>
</para>
<para>
The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the <link
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>.
</para>
</listitem>
<listitem>
<para>
Add a call to the function defined in the previous step to <link
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>.
<screen>
<prompt>$ </prompt>emacs pkgs/top-level/all-packages.nix</screen>
</para>
<para>
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.
</para>
</listitem>
<listitem>
<para>
To test whether the package builds, run the following command from the root of the nixpkgs source tree:
<screen>
<prompt>$ </prompt>nix-build -A libfoo</screen>
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.
</para>
</listitem>
<listitem>
<para>
If you want to install the package into your profile (optional), do
<screen>
<prompt>$ </prompt>nix-env -f . -iA libfoo</screen>
</para>
</listitem>
<listitem>
<para>
Optionally commit the new package and open a pull request <link
xlink:href="https://github.com/NixOS/nixpkgs/pulls">to nixpkgs</link>, or use <link
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.
</para>
</listitem>
</orderedlist>
</para>
</chapter>

View File

@ -0,0 +1,204 @@
# Reviewing contributions {#chap-reviewing-contributions}
::: warning
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).
:::
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.
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).
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.
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.
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.
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.
## Package updates {#reviewing-contributions-package-updates}
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.
It can happen that non-trivial updates include patches or more complex changes.
Reviewing process:
- Ensure that the package versioning fits the guidelines.
- Ensure that the commit text fits the guidelines.
- Ensure that the package maintainers are notified.
- [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.
- Ensure that the meta field information is correct.
- License can change with version updates, so it should be checked to match the upstream license.
- 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.
- Ensure that the code contains no typos.
- Building the package locally.
- 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.
- 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.
```ShellSession
$ git fetch origin nixos-unstable
$ git fetch origin pull/PRNUMBER/head
$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD
```
- The first command fetches the nixos-unstable branch.
- 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.
- The third command rebases the pull request changes to the nixos-unstable branch.
- 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.
```ShellSession
$ nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER"
```
- Running every binary.
Sample template for a package update review is provided below.
```markdown
##### Reviewed points
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] all depending packages build
##### Possible improvements
##### Comments
```
## New packages {#reviewing-contributions-new-packages}
New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
Review process:
- Ensure that the package versioning fits the guidelines.
- Ensure that the commit name fits the guidelines.
- Ensure that the meta fields contain correct information.
- License must match the upstream license.
- Platforms should be set (or the package will not get binary substitutes).
- Maintainers must be set. This can be the package submitter or a community member that accepts taking up maintainership of the package.
- Report detected typos.
- Ensure the package source:
- Uses mirror URLs when available.
- Uses the most appropriate functions (e.g. packages from GitHub should use `fetchFromGitHub`).
- Building the package locally.
- Running every binary.
Sample template for a new package review is provided below.
```markdown
##### Reviewed points
- [ ] package path fits guidelines
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] `meta.description` is set and fits guidelines
- [ ] `meta.license` fits upstream license
- [ ] `meta.platforms` is set
- [ ] `meta.maintainers` is set
- [ ] build time only dependencies are declared in `nativeBuildInputs`
- [ ] source is fetched using the appropriate function
- [ ] phases are respected
- [ ] patches that are remotely available are fetched with `fetchpatch`
##### Possible improvements
##### Comments
```
## Module updates {#reviewing-contributions-module-updates}
Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
Reviewing process:
- Ensure that the module maintainers are notified.
- [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.
- Ensure that the module tests, if any, are succeeding.
- Ensure that the introduced options are correct.
- Type should be appropriate (string related types differs in their merging capabilities, `optionSet` and `string` types are deprecated).
- Description, default and example should be provided.
- Ensure that option changes are backward compatible.
- `mkRenamedOptionModule` and `mkAliasOptionModule` functions provide way to make option changes backward compatible.
- Ensure that removed options are declared with `mkRemovedOptionModule`
- Ensure that changes that are not backward compatible are mentioned in release notes.
- Ensure that documentations affected by the change is updated.
Sample template for a module update review is provided below.
```markdown
##### Reviewed points
- [ ] changes are backward compatible
- [ ] removed options are declared with `mkRemovedOptionModule`
- [ ] changes that are not backward compatible are documented in release notes
- [ ] module tests succeed on ARCHITECTURE
- [ ] options types are appropriate
- [ ] options description is set
- [ ] options example is provided
- [ ] documentation affected by the changes is updated
##### Possible improvements
##### Comments
```
## New modules {#reviewing-contributions-new-modules}
New modules submissions introduce a new module to NixOS.
Reviewing process:
- Ensure that the module tests, if any, are succeeding.
- Ensure that the introduced options are correct.
- Type should be appropriate (string related types differs in their merging capabilities, `optionSet` and `string` types are deprecated).
- Description, default and example should be provided.
- Ensure that module `meta` field is present
- Maintainers should be declared in `meta.maintainers`.
- Module documentation should be declared with `meta.doc`.
- Ensure that the module respect other modules functionality.
- For example, enabling a module should not open firewall ports by default.
Sample template for a new module review is provided below.
```markdown
##### Reviewed points
- [ ] module path fits the guidelines
- [ ] module tests succeed on ARCHITECTURE
- [ ] options have appropriate types
- [ ] options have default
- [ ] options have example
- [ ] options have descriptions
- [ ] No unneeded package is added to environment.systemPackages
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc
##### Possible improvements
##### Comments
```
## Other submissions {#reviewing-contributions-other-submissions}
Other type of submissions requires different reviewing steps.
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.
Container system, boot system and library changes are some examples of the pull requests fitting this category.
## Merging pull requests {#reviewing-contributions--merging-pull-requests}
It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
<!--
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.
Please note that contributors with commit rights unactive for more than three months will have their commit rights revoked.
-->
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.
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.

View File

@ -1,488 +0,0 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="chap-reviewing-contributions">
<title>Reviewing contributions</title>
<warning>
<para>
The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link
xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
</para>
</warning>
<para>
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.
</para>
<para>
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
xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link
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>.
</para>
<para>
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.
</para>
<para>
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.
</para>
<para>
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.
</para>
<para>
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.
</para>
<section xml:id="reviewing-contributions-package-updates">
<title>Package updates</title>
<para>
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.
</para>
<para>
It can happen that non-trivial updates include patches or more complex changes.
</para>
<para>
Reviewing process:
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the package versioning fits the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the commit text fits the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the package maintainers are notified.
</para>
<itemizedlist>
<listitem>
<para>
<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.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that the meta field information is correct.
</para>
<itemizedlist>
<listitem>
<para>
License can change with version updates, so it should be checked to match the upstream license.
</para>
</listitem>
<listitem>
<para>
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.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that the code contains no typos.
</para>
</listitem>
<listitem>
<para>
Building the package locally.
</para>
<itemizedlist>
<listitem>
<para>
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.
</para>
<para>
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.
<screen>
<prompt>$ </prompt>git fetch origin nixos-unstable <co xml:id='reviewing-rebase-2' />
<prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
<prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
xml:id='reviewing-rebase-4' />
</screen>
<calloutlist>
<callout arearefs='reviewing-rebase-2'>
<para>
Fetching the nixos-unstable branch.
</para>
</callout>
<callout arearefs='reviewing-rebase-3'>
<para>
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.
</para>
</callout>
<callout arearefs='reviewing-rebase-4'>
<para>
Rebasing the pull request changes to the nixos-unstable branch.
</para>
</callout>
</calloutlist>
</para>
</listitem>
<listitem>
<para>
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.
</para>
<screen>
<prompt>$ </prompt>nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER"
</screen>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Running every binary.
</para>
</listitem>
</itemizedlist>
<example xml:id="reviewing-contributions-sample-package-update">
<title>Sample template for a package update review</title>
<screen>
##### Reviewed points
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] all depending packages build
##### Possible improvements
##### Comments
</screen>
</example>
</section>
<section xml:id="reviewing-contributions-new-packages">
<title>New packages</title>
<para>
New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
</para>
<para>
Reviewing process:
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the package versioning is fitting the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the commit name is fitting the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the meta field contains correct information.
</para>
<itemizedlist>
<listitem>
<para>
License must be checked to be fitting upstream license.
</para>
</listitem>
<listitem>
<para>
Platforms should be set or the package will not get binary substitutes.
</para>
</listitem>
<listitem>
<para>
A maintainer must be set. This can be the package submitter or a community member that accepts to take maintainership of the package.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that the code contains no typos.
</para>
</listitem>
<listitem>
<para>
Ensure the package source.
</para>
<itemizedlist>
<listitem>
<para>
Mirrors urls should be used when available.
</para>
</listitem>
<listitem>
<para>
The most appropriate function should be used (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>).
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Building the package locally.
</para>
</listitem>
<listitem>
<para>
Running every binary.
</para>
</listitem>
</itemizedlist>
<example xml:id="reviewing-contributions-sample-new-package">
<title>Sample template for a new package review</title>
<screen>
##### Reviewed points
- [ ] package path fits guidelines
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] `meta.description` is set and fits guidelines
- [ ] `meta.license` fits upstream license
- [ ] `meta.platforms` is set
- [ ] `meta.maintainers` is set
- [ ] build time only dependencies are declared in `nativeBuildInputs`
- [ ] source is fetched using the appropriate function
- [ ] phases are respected
- [ ] patches that are remotely available are fetched with `fetchpatch`
##### Possible improvements
##### Comments
</screen>
</example>
</section>
<section xml:id="reviewing-contributions-module-updates">
<title>Module updates</title>
<para>
Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
</para>
<para>
Reviewing process
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the module maintainers are notified.
</para>
<itemizedlist>
<listitem>
<para>
<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.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
<listitem>
<para>
Ensure that the introduced options are correct.
</para>
<itemizedlist>
<listitem>
<para>
Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
</para>
</listitem>
<listitem>
<para>
Description, default and example should be provided.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that option changes are backward compatible.
</para>
<itemizedlist>
<listitem>
<para>
<literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal>
</para>
</listitem>
<listitem>
<para>
Ensure that changes that are not backward compatible are mentioned in release notes.
</para>
</listitem>
<listitem>
<para>
Ensure that documentations affected by the change is updated.
</para>
</listitem>
</itemizedlist>
<example xml:id="reviewing-contributions-sample-module-update">
<title>Sample template for a module update review</title>
<screen>
##### Reviewed points
- [ ] changes are backward compatible
- [ ] removed options are declared with `mkRemovedOptionModule`
- [ ] changes that are not backward compatible are documented in release notes
- [ ] module tests succeed on ARCHITECTURE
- [ ] options types are appropriate
- [ ] options description is set
- [ ] options example is provided
- [ ] documentation affected by the changes is updated
##### Possible improvements
##### Comments
</screen>
</example>
</section>
<section xml:id="reviewing-contributions-new-modules">
<title>New modules</title>
<para>
New modules submissions introduce a new module to NixOS.
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
<listitem>
<para>
Ensure that the introduced options are correct.
</para>
<itemizedlist>
<listitem>
<para>
Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
</para>
</listitem>
<listitem>
<para>
Description, default and example should be provided.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that module <literal>meta</literal> field is present
</para>
<itemizedlist>
<listitem>
<para>
Maintainers should be declared in <literal>meta.maintainers</literal>.
</para>
</listitem>
<listitem>
<para>
Module documentation should be declared with <literal>meta.doc</literal>.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Ensure that the module respect other modules functionality.
</para>
<itemizedlist>
<listitem>
<para>
For example, enabling a module should not open firewall ports by default.
</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<example xml:id="reviewing-contributions-sample-new-module">
<title>Sample template for a new module review</title>
<screen>
##### Reviewed points
- [ ] module path fits the guidelines
- [ ] module tests succeed on ARCHITECTURE
- [ ] options have appropriate types
- [ ] options have default
- [ ] options have example
- [ ] options have descriptions
- [ ] No unneeded package is added to environment.systemPackages
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc
##### Possible improvements
##### Comments
</screen>
</example>
</section>
<section xml:id="reviewing-contributions-other-submissions">
<title>Other submissions</title>
<para>
Other type of submissions requires different reviewing steps.
</para>
<para>
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.
</para>
<para>
Container system, boot system and library changes are some examples of the pull requests fitting this category.
</para>
</section>
<section xml:id="reviewing-contributions--merging-pull-requests">
<title>Merging pull requests</title>
<para>
It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
</para>
<!--
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.
<para>Please note that contributors with commit rights unactive for more than
three months will have their commit rights revoked.</para>
-->
<para>
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.
</para>
<para>
In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link
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.
</para>
</section>
</chapter>

View File

@ -83,6 +83,52 @@ If a security fix applies to both master and a stable release then, similar to r
Critical security fixes may by-pass the staging branches and be delivered directly to release branches such as `master` and `release-*`. Critical security fixes may by-pass the staging branches and be delivered directly to release branches such as `master` and `release-*`.
## Deprecating/removing packages {#submitting-changes-deprecating-packages}
There is currently no policy when to remove a package.
Before removing a package, one should try to find a new maintainer or fix smaller issues first.
### Steps to remove a package from Nixpkgs
We use jbidwatcher as an example for a discontinued project here.
1. Have Nixpkgs checked out locally and up to date.
1. Create a new branch for your change, e.g. `git checkout -b jbidwatcher`
1. Remove the actual package including its directory, e.g. `rm -rf pkgs/applications/misc/jbidwatcher`
1. Remove the package from the list of all packages (`pkgs/top-level/all-packages.nix`).
1. Add an alias for the package name in `pkgs/top-level/aliases.nix` (There is also `pkgs/misc/vim-plugins/aliases.nix`. Package sets typically do not have aliases, so we can't add them there.)
For example in this case:
```
jbidwatcher = throw "jbidwatcher was discontinued in march 2021"; # added 2021-03-15
```
The throw message should explain in short why the package was removed for users that still have it installed.
1. Test if the changes introduced any issues by running `nix-env -qaP -f . --show-trace`. It should show the list of packages without errors.
1. Commit the changes. Explain again why the package was removed. If it was declared discontinued upstream, add a link to the source.
```ShellSession
$ git add pkgs/applications/misc/jbidwatcher/default.nix pkgs/top-level/all-packages.nix pkgs/top-level/aliases.nix
$ git commit
```
Example commit message:
```
jbidwatcher: remove
project was discontinued in march 2021. the program does not work anymore because ebay changed the login.
https://web.archive.org/web/20210315205723/http://www.jbidwatcher.com/
```
1. Push changes to your GitHub fork with `git push`
1. Create a pull request against Nixpkgs. Mention the package maintainer.
This is how the pull request looks like in this case: [https://github.com/NixOS/nixpkgs/pull/116470](https://github.com/NixOS/nixpkgs/pull/116470)
## Pull Request Template {#submitting-changes-pull-request-template} ## Pull Request Template {#submitting-changes-pull-request-template}
The pull request template helps determine what steps have been made for a contribution so far, and will help guide maintainers on the status of a change. The motivation section of the PR should include any extra details the title does not address and link any existing issues related to the pull request. The pull request template helps determine what steps have been made for a contribution so far, and will help guide maintainers on the status of a change. The motivation section of the PR should include any extra details the title does not address and link any existing issues related to the pull request.

View File

@ -116,6 +116,44 @@ The resulting package can be added to `packageOverrides` in `~/.nixpkgs/config.n
After that you can install your special grafted `myVim` or `myNeovim` packages. After that you can install your special grafted `myVim` or `myNeovim` packages.
### What if your favourite Vim plugin isn't already packaged?
If one of your favourite plugins isn't packaged, you can package it yourself:
```
{ config, pkgs, ... }:
let
easygrep = pkgs.vimUtils.buildVimPlugin {
name = "vim-easygrep";
src = pkgs.fetchFromGitHub {
owner = "dkprice";
repo = "vim-easygrep";
rev = "d0c36a77cc63c22648e792796b1815b44164653a";
sha256 = "0y2p5mz0d5fhg6n68lhfhl8p4mlwkb82q337c22djs4w5zyzggbc";
};
};
in
{
environment.systemPackages = [
(
pkgs.neovim.override {
configure = {
packages.myPlugins = with pkgs.vimPlugins; {
start = [
vim-go # already packaged plugin
easygrep # custom package
];
opt = [];
};
# ...
};
}
)
];
}
```
## Managing plugins with vim-plug ## Managing plugins with vim-plug
To use [vim-plug](https://github.com/junegunn/vim-plug) to manage your Vim To use [vim-plug](https://github.com/junegunn/vim-plug) to manage your Vim

View File

@ -32,11 +32,11 @@
</part> </part>
<part> <part>
<title>Contributing to Nixpkgs</title> <title>Contributing to Nixpkgs</title>
<xi:include href="contributing/quick-start.xml" /> <xi:include href="contributing/quick-start.chapter.xml" />
<xi:include href="contributing/coding-conventions.xml" /> <xi:include href="contributing/coding-conventions.chapter.xml" />
<xi:include href="contributing/submitting-changes.chapter.xml" /> <xi:include href="contributing/submitting-changes.chapter.xml" />
<xi:include href="contributing/vulnerability-roundup.chapter.xml" /> <xi:include href="contributing/vulnerability-roundup.chapter.xml" />
<xi:include href="contributing/reviewing-contributions.xml" /> <xi:include href="contributing/reviewing-contributions.chapter.xml" />
<xi:include href="contributing/contributing-to-documentation.xml" /> <xi:include href="contributing/contributing-to-documentation.chapter.xml" />
</part> </part>
</book> </book>

View File

@ -374,6 +374,12 @@
githubId = 786394; githubId = 786394;
name = "Alexander Krupenkin "; name = "Alexander Krupenkin ";
}; };
akshgpt7 = {
email = "akshgpt7@gmail.com";
github = "akshgpt7";
githubId = 20405311;
name = "Aksh Gupta";
};
albakham = { albakham = {
email = "dev@geber.ga"; email = "dev@geber.ga";
github = "albakham"; github = "albakham";
@ -2195,6 +2201,16 @@
githubId = 4971975; githubId = 4971975;
name = "Janne Heß"; name = "Janne Heß";
}; };
dasisdormax = {
email = "dasisdormax@mailbox.org";
github = "dasisdormax";
githubId = 3714905;
keys = [{
longkeyid = "rsa4096/0x02BA0D4480CA6C44";
fingerprint = "E59B A198 61B0 A9ED C1FA 3FB2 02BA 0D44 80CA 6C44";
}];
name = "Maximilian Wende";
};
dasj19 = { dasj19 = {
email = "daniel@serbanescu.dk"; email = "daniel@serbanescu.dk";
github = "dasj19"; github = "dasj19";
@ -4403,6 +4419,12 @@
githubId = 2588851; githubId = 2588851;
name = "Jan Solanti"; name = "Jan Solanti";
}; };
jappie = {
email = "jappieklooster@hotmail.com";
github = "jappeace";
githubId = 3874017;
name = "Jappie Klooster";
};
javaguirre = { javaguirre = {
email = "contacto@javaguirre.net"; email = "contacto@javaguirre.net";
github = "javaguirre"; github = "javaguirre";
@ -5534,6 +5556,12 @@
githubId = 4158274; githubId = 4158274;
name = "Michiel Leenaars"; name = "Michiel Leenaars";
}; };
legendofmiracles = {
email = "legendofmiracles@protonmail.com";
github = "legendofmiracles";
githubId = 30902201;
name = "legendofmiracles";
};
lejonet = { lejonet = {
email = "daniel@kuehn.se"; email = "daniel@kuehn.se";
github = "lejonet"; github = "lejonet";
@ -5984,6 +6012,12 @@
githubId = 115218; githubId = 115218;
name = "Felix Richter"; name = "Felix Richter";
}; };
malo = {
email = "mbourgon@gmail.com";
github = "malob";
githubId = 2914269;
name = "Malo Bourgon";
};
malyn = { malyn = {
email = "malyn@strangeGizmo.com"; email = "malyn@strangeGizmo.com";
github = "malyn"; github = "malyn";
@ -7235,6 +7269,16 @@
github = "obsidian-systems-maintenance"; github = "obsidian-systems-maintenance";
githubId = 80847921; githubId = 80847921;
}; };
obfusk = {
email = "flx@obfusk.net";
github = "obfusk";
githubId = 1260687;
name = "Felix C. Stegerman";
keys = [{
longkeyid = "rsa4096/0x2F9607F09B360F2D";
fingerprint = "D5E4 A51D F8D2 55B9 FAC6 A9BB 2F96 07F0 9B36 0F2D";
}];
};
odi = { odi = {
email = "oliver.dunkl@gmail.com"; email = "oliver.dunkl@gmail.com";
github = "odi"; github = "odi";
@ -7911,6 +7955,12 @@
githubId = 18549627; githubId = 18549627;
name = "Proglodyte"; name = "Proglodyte";
}; };
progval = {
email = "progval+nix@progval.net";
github = "ProgVal";
githubId = 406946;
name = "Valentin Lorentz";
};
protoben = { protoben = {
email = "protob3n@gmail.com"; email = "protob3n@gmail.com";
github = "protoben"; github = "protoben";
@ -8723,6 +8773,12 @@
githubId = 8534888; githubId = 8534888;
name = "Savanni D'Gerinel"; name = "Savanni D'Gerinel";
}; };
sayanarijit = {
email = "sayanarijit@gmail.com";
github = "sayanarijit";
githubId = 11632726;
name = "Arijit Basu";
};
sb0 = { sb0 = {
email = "sb@m-labs.hk"; email = "sb@m-labs.hk";
github = "sbourdeauducq"; github = "sbourdeauducq";
@ -9191,6 +9247,12 @@
fingerprint = "0EC3 FA89 EFBA B421 F82E 40B0 2567 6BCB FFAD 76B1"; fingerprint = "0EC3 FA89 EFBA B421 F82E 40B0 2567 6BCB FFAD 76B1";
}]; }];
}; };
sophrosyne = {
email = "joshuaortiz@tutanota.com";
github = "sophrosyne97";
githubId = 53029739;
name = "Joshua Ortiz";
};
sorki = { sorki = {
email = "srk@48.io"; email = "srk@48.io";
github = "sorki"; github = "sorki";
@ -9429,6 +9491,12 @@
githubId = 187109; githubId = 187109;
name = "Bjarki Ágúst Guðmundsson"; name = "Bjarki Ágúst Guðmundsson";
}; };
suryasr007 = {
email = "94suryateja@gmail.com";
github = "suryasr007";
githubId = 10533926;
name = "Surya Teja V";
};
suvash = { suvash = {
email = "suvash+nixpkgs@gmail.com"; email = "suvash+nixpkgs@gmail.com";
github = "suvash"; github = "suvash";
@ -9625,12 +9693,6 @@
githubId = 102685; githubId = 102685;
name = "Thomas Friese"; name = "Thomas Friese";
}; };
tavyc = {
email = "octavian.cerna@gmail.com";
github = "tavyc";
githubId = 3650609;
name = "Octavian Cerna";
};
tazjin = { tazjin = {
email = "mail@tazj.in"; email = "mail@tazj.in";
github = "tazjin"; github = "tazjin";
@ -11260,6 +11322,16 @@
github = "pulsation"; github = "pulsation";
githubId = 1838397; githubId = 1838397;
}; };
zane = {
name = "Zane van Iperen";
email = "zane@zanevaniperen.com";
github = "vs49688";
githubId = 4423262;
keys = [{
longkeyid = "rsa4096/0x68616B2D8AC4DCC5";
fingerprint = "61AE D40F 368B 6F26 9DAE 3892 6861 6B2D 8AC4 DCC5";
}];
};
zseri = { zseri = {
name = "zseri"; name = "zseri";
email = "zseri.devel@ytrizja.de"; email = "zseri.devel@ytrizja.de";

View File

@ -38,6 +38,7 @@ lua-messagepack,,,,,
lua-resty-http,,,,, lua-resty-http,,,,,
lua-resty-jwt,,,,, lua-resty-jwt,,,,,
lua-resty-openidc,,,,, lua-resty-openidc,,,,,
lua-resty-openssl,,,,,
lua-resty-session,,,,, lua-resty-session,,,,,
lua-term,,,,, lua-term,,,,,
lua-toml,,,,, lua-toml,,,,,

1 # nix name luarocks name server version luaversion maintainers
38 lua-resty-http
39 lua-resty-jwt
40 lua-resty-openidc
41 lua-resty-openssl
42 lua-resty-session
43 lua-term
44 lua-toml

View File

@ -18,7 +18,7 @@ stdenv.mkDerivation {
''; '';
meta = { meta = {
maintainers = with lib.maintainers; [ eelco rycee ]; maintainers = with lib.maintainers; [ eelco ];
description = "Utility to generate a Nix expression for a Perl package from CPAN"; description = "Utility to generate a Nix expression for a Perl package from CPAN";
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
}; };

View File

@ -460,6 +460,10 @@ def parse_args(editor: Editor):
default=30, default=30,
help="Number of concurrent processes to spawn.", help="Number of concurrent processes to spawn.",
) )
parser.add_argument(
"--no-commit", "-n", action="store_true", default=False,
help="Whether to autocommit changes"
)
return parser.parse_args() return parser.parse_args()
@ -504,24 +508,30 @@ def update_plugins(editor: Editor):
redirects = update() redirects = update()
rewrite_input(args.input_file, editor.deprecated, redirects) rewrite_input(args.input_file, editor.deprecated, redirects)
commit(nixpkgs_repo, f"{editor.name}Plugins: update", [args.outfile])
autocommit = not args.no_commit
if autocommit:
commit(nixpkgs_repo, f"{editor.name}Plugins: update", [args.outfile])
if redirects: if redirects:
update() update()
commit( if autocommit:
nixpkgs_repo, commit(
f"{editor.name}Plugins: resolve github repository redirects", nixpkgs_repo,
[args.outfile, args.input_file, editor.deprecated], f"{editor.name}Plugins: resolve github repository redirects",
) [args.outfile, args.input_file, editor.deprecated],
)
for plugin_line in args.add_plugins: for plugin_line in args.add_plugins:
rewrite_input(args.input_file, editor.deprecated, append=(plugin_line + "\n",)) rewrite_input(args.input_file, editor.deprecated, append=(plugin_line + "\n",))
update() update()
plugin = fetch_plugin_from_pluginline(plugin_line) plugin = fetch_plugin_from_pluginline(plugin_line)
commit( if autocommit:
nixpkgs_repo, commit(
"{editor}Plugins.{name}: init at {version}".format( nixpkgs_repo,
editor=editor.name, name=plugin.normalized_name, version=plugin.version "{editor}Plugins.{name}: init at {version}".format(
), editor=editor.name, name=plugin.normalized_name, version=plugin.version
[args.outfile, args.input_file], ),
) [args.outfile, args.input_file],
)

View File

@ -56,6 +56,15 @@ with lib.maintainers; {
scope = "Group registration for D. E. Shaw employees who collectively maintain packages."; scope = "Group registration for D. E. Shaw employees who collectively maintain packages.";
}; };
determinatesystems = {
# Verify additions to this team with at least one already existing member of the team.
members = [
cole-h
grahamc
];
scope = "Group registration for packages maintained by Determinate Systems.";
};
freedesktop = { freedesktop = {
members = [ jtojnar worldofpeace ]; members = [ jtojnar worldofpeace ];
scope = "Maintain Freedesktop.org packages for graphical desktop."; scope = "Maintain Freedesktop.org packages for graphical desktop.";

View File

@ -675,6 +675,11 @@ environment.systemPackages = [
Currently, the service doesn't enforce nor checks the correct number of paths to correspond to minio requirements. Currently, the service doesn't enforce nor checks the correct number of paths to correspond to minio requirements.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
All CUDA toolkit versions prior to CUDA 10 have been removed.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
@ -955,6 +960,11 @@ environment.systemPackages = [
<link linkend="opt-boot.extraSystemdUnitPaths">boot.extraSystemdUnitPaths</link> list. <link linkend="opt-boot.extraSystemdUnitPaths">boot.extraSystemdUnitPaths</link> list.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
PostgreSQL 9.5 is scheduled EOL during the 21.05 life cycle and has been removed.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
</section> </section>

View File

@ -10,7 +10,6 @@ with lib;
system.build.cloudstackImage = import ../../../lib/make-disk-image.nix { system.build.cloudstackImage = import ../../../lib/make-disk-image.nix {
inherit lib config pkgs; inherit lib config pkgs;
diskSize = 8192;
format = "qcow2"; format = "qcow2";
configFile = pkgs.writeText "configuration.nix" configFile = pkgs.writeText "configuration.nix"
'' ''

View File

@ -40,8 +40,9 @@ in {
}; };
sizeMB = mkOption { sizeMB = mkOption {
type = types.int; type = with types; either (enum [ "auto" ]) int;
default = if config.ec2.hvm then 2048 else 8192; default = "auto";
example = 8192;
description = "The size in MB of the image"; description = "The size in MB of the image";
}; };

View File

@ -12,8 +12,8 @@ with lib;
system.build.openstackImage = import ../../../lib/make-disk-image.nix { system.build.openstackImage = import ../../../lib/make-disk-image.nix {
inherit lib config; inherit lib config;
additionalSpace = "1024M";
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
diskSize = 8192;
format = "qcow2"; format = "qcow2";
configFile = pkgs.writeText "configuration.nix" configFile = pkgs.writeText "configuration.nix"
'' ''

View File

@ -18,15 +18,15 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.etc."iproute2/bpf_pinning" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/bpf_pinning"; }; environment.etc."iproute2/bpf_pinning" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/bpf_pinning"; };
environment.etc."iproute2/ematch_map" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/ematch_map"; }; environment.etc."iproute2/ematch_map" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/ematch_map"; };
environment.etc."iproute2/group" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/group"; }; environment.etc."iproute2/group" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/group"; };
environment.etc."iproute2/nl_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/nl_protos"; }; environment.etc."iproute2/nl_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/nl_protos"; };
environment.etc."iproute2/rt_dsfield" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_dsfield"; }; environment.etc."iproute2/rt_dsfield" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_dsfield"; };
environment.etc."iproute2/rt_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_protos"; }; environment.etc."iproute2/rt_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_protos"; };
environment.etc."iproute2/rt_realms" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_realms"; }; environment.etc."iproute2/rt_realms" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_realms"; };
environment.etc."iproute2/rt_scopes" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_scopes"; }; environment.etc."iproute2/rt_scopes" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_scopes"; };
environment.etc."iproute2/rt_tables" = { mode = "0644"; text = (fileContents "${pkgs.iproute}/etc/iproute2/rt_tables") environment.etc."iproute2/rt_tables" = { mode = "0644"; text = (fileContents "${pkgs.iproute2}/etc/iproute2/rt_tables")
+ (optionalString (cfg.rttablesExtraConfig != "") "\n\n${cfg.rttablesExtraConfig}"); }; + (optionalString (cfg.rttablesExtraConfig != "") "\n\n${cfg.rttablesExtraConfig}"); };
}; };
} }

View File

@ -6,6 +6,12 @@ let
ids = config.ids; ids = config.ids;
cfg = config.users; cfg = config.users;
isPasswdCompatible = str: !(hasInfix ":" str || hasInfix "\n" str);
passwdEntry = type: lib.types.addCheck type isPasswdCompatible // {
name = "passwdEntry ${type.name}";
description = "${type.description}, not containing newlines or colons";
};
# Check whether a password hash will allow login. # Check whether a password hash will allow login.
allowsLogin = hash: allowsLogin = hash:
hash == "" # login without password hash == "" # login without password
@ -54,7 +60,7 @@ let
options = { options = {
name = mkOption { name = mkOption {
type = types.str; type = passwdEntry types.str;
apply = x: assert (builtins.stringLength x < 32 || abort "Username '${x}' is longer than 31 characters which is not allowed!"); x; apply = x: assert (builtins.stringLength x < 32 || abort "Username '${x}' is longer than 31 characters which is not allowed!"); x;
description = '' description = ''
The name of the user account. If undefined, the name of the The name of the user account. If undefined, the name of the
@ -63,7 +69,7 @@ let
}; };
description = mkOption { description = mkOption {
type = types.str; type = passwdEntry types.str;
default = ""; default = "";
example = "Alice Q. User"; example = "Alice Q. User";
description = '' description = ''
@ -128,7 +134,7 @@ let
}; };
home = mkOption { home = mkOption {
type = types.path; type = passwdEntry types.path;
default = "/var/empty"; default = "/var/empty";
description = "The user's home directory."; description = "The user's home directory.";
}; };
@ -157,7 +163,7 @@ let
}; };
shell = mkOption { shell = mkOption {
type = types.nullOr (types.either types.shellPackage types.path); type = types.nullOr (types.either types.shellPackage (passwdEntry types.path));
default = pkgs.shadow; default = pkgs.shadow;
defaultText = "pkgs.shadow"; defaultText = "pkgs.shadow";
example = literalExample "pkgs.bashInteractive"; example = literalExample "pkgs.bashInteractive";
@ -217,7 +223,7 @@ let
}; };
hashedPassword = mkOption { hashedPassword = mkOption {
type = with types; nullOr str; type = with types; nullOr (passwdEntry str);
default = null; default = null;
description = '' description = ''
Specifies the hashed password for the user. Specifies the hashed password for the user.
@ -251,7 +257,7 @@ let
}; };
initialHashedPassword = mkOption { initialHashedPassword = mkOption {
type = with types; nullOr str; type = with types; nullOr (passwdEntry str);
default = null; default = null;
description = '' description = ''
Specifies the initial hashed password for the user, i.e. the Specifies the initial hashed password for the user, i.e. the
@ -323,7 +329,7 @@ let
options = { options = {
name = mkOption { name = mkOption {
type = types.str; type = passwdEntry types.str;
description = '' description = ''
The name of the group. If undefined, the name of the attribute set The name of the group. If undefined, the name of the attribute set
will be used. will be used.
@ -340,7 +346,7 @@ let
}; };
members = mkOption { members = mkOption {
type = with types; listOf str; type = with types; listOf (passwdEntry str);
default = []; default = [];
description = '' description = ''
The user names of the group members, added to the The user names of the group members, added to the

View File

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.hardware.keyboard.teck;
in
{
options.hardware.keyboard.teck = {
enable = mkEnableOption "non-root access to the firmware of TECK keyboards";
};
config = mkIf cfg.enable {
services.udev.packages = [ pkgs.teck-udev-rules ];
};
}

View File

@ -29,7 +29,7 @@ in
options.i18n = { options.i18n = {
inputMethod = { inputMethod = {
enabled = mkOption { enabled = mkOption {
type = types.nullOr (types.enum [ "ibus" "fcitx" "fcitx5" "nabi" "uim" "hime" ]); type = types.nullOr (types.enum [ "ibus" "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]);
default = null; default = null;
example = "fcitx"; example = "fcitx";
description = '' description = ''
@ -46,6 +46,7 @@ in
<listitem><para>nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5.</para></listitem> <listitem><para>nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5.</para></listitem>
<listitem><para>uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean.</para></listitem> <listitem><para>uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean.</para></listitem>
<listitem><para>hime: An extremely easy-to-use input method framework.</para></listitem> <listitem><para>hime: An extremely easy-to-use input method framework.</para></listitem>
<listitem><para>kime: Koream IME.</para></listitem>
</itemizedlist> </itemizedlist>
''; '';
}; };

View File

@ -40,6 +40,11 @@
Hime: An extremely easy-to-use input method framework. Hime: An extremely easy-to-use input method framework.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
Kime: Korean IME
</para>
</listitem>
</itemizedlist> </itemizedlist>
<section xml:id="module-services-input-methods-ibus"> <section xml:id="module-services-input-methods-ibus">
<title>IBus</title> <title>IBus</title>
@ -264,6 +269,23 @@ i18n.inputMethod = {
i18n.inputMethod = { i18n.inputMethod = {
<link linkend="opt-i18n.inputMethod.enabled">enabled</link> = "hime"; <link linkend="opt-i18n.inputMethod.enabled">enabled</link> = "hime";
}; };
</programlisting>
</section>
<section xml:id="module-services-input-methods-kime">
<title>Kime</title>
<para>
Kime is Korean IME. it's built with Rust language and let you get simple, safe, fast Korean typing
</para>
<para>
The following snippet can be used to configure Kime:
</para>
<programlisting>
i18n.inputMethod = {
<link linkend="opt-i18n.inputMethod.enabled">enabled</link> = "kime";
};
</programlisting> </programlisting>
</section> </section>
</chapter> </chapter>

View File

@ -0,0 +1,49 @@
{ config, pkgs, lib, generators, ... }:
with lib;
let
cfg = config.i18n.inputMethod.kime;
yamlFormat = pkgs.formats.yaml { };
in
{
options = {
i18n.inputMethod.kime = {
config = mkOption {
type = yamlFormat.type;
default = { };
example = literalExample ''
{
daemon = {
modules = ["Xim" "Indicator"];
};
indicator = {
icon_color = "White";
};
engine = {
hangul = {
layout = "dubeolsik";
};
};
}
'';
description = ''
kime configuration. Refer to <link xlink:href="https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md"/> for details on supported values.
'';
};
};
};
config = mkIf (config.i18n.inputMethod.enabled == "kime") {
i18n.inputMethod.package = pkgs.kime;
environment.variables = {
GTK_IM_MODULE = "kime";
QT_IM_MODULE = "kime";
XMODIFIERS = "@im=kime";
};
environment.etc."xdg/kime/config.yaml".text = replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config);
};
}

View File

@ -163,7 +163,8 @@ in
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# \$ nix search wget # \$ nix search wget
# environment.systemPackages = with pkgs; [ # environment.systemPackages = with pkgs; [
# wget vim # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# firefox # firefox
# ]; # ];

View File

@ -49,6 +49,7 @@
./hardware/i2c.nix ./hardware/i2c.nix
./hardware/sensor/hddtemp.nix ./hardware/sensor/hddtemp.nix
./hardware/sensor/iio.nix ./hardware/sensor/iio.nix
./hardware/keyboard/teck.nix
./hardware/keyboard/zsa.nix ./hardware/keyboard/zsa.nix
./hardware/ksm.nix ./hardware/ksm.nix
./hardware/ledger.nix ./hardware/ledger.nix
@ -92,6 +93,7 @@
./i18n/input-method/ibus.nix ./i18n/input-method/ibus.nix
./i18n/input-method/nabi.nix ./i18n/input-method/nabi.nix
./i18n/input-method/uim.nix ./i18n/input-method/uim.nix
./i18n/input-method/kime.nix
./installer/tools/tools.nix ./installer/tools/tools.nix
./misc/assertions.nix ./misc/assertions.nix
./misc/crashdump.nix ./misc/crashdump.nix
@ -366,6 +368,7 @@
./services/games/minecraft-server.nix ./services/games/minecraft-server.nix
./services/games/minetest-server.nix ./services/games/minetest-server.nix
./services/games/openarena.nix ./services/games/openarena.nix
./services/games/quake3-server.nix
./services/games/teeworlds.nix ./services/games/teeworlds.nix
./services/games/terraria.nix ./services/games/terraria.nix
./services/hardware/acpid.nix ./services/hardware/acpid.nix
@ -728,6 +731,7 @@
./services/networking/nar-serve.nix ./services/networking/nar-serve.nix
./services/networking/nat.nix ./services/networking/nat.nix
./services/networking/ndppd.nix ./services/networking/ndppd.nix
./services/networking/nebula.nix
./services/networking/networkmanager.nix ./services/networking/networkmanager.nix
./services/networking/nextdns.nix ./services/networking/nextdns.nix
./services/networking/nftables.nix ./services/networking/nftables.nix
@ -763,7 +767,6 @@
./services/networking/prayer.nix ./services/networking/prayer.nix
./services/networking/privoxy.nix ./services/networking/privoxy.nix
./services/networking/prosody.nix ./services/networking/prosody.nix
./services/networking/quagga.nix
./services/networking/quassel.nix ./services/networking/quassel.nix
./services/networking/quorum.nix ./services/networking/quorum.nix
./services/networking/quicktun.nix ./services/networking/quicktun.nix

View File

@ -18,6 +18,7 @@ with lib;
# Completely removed modules # Completely removed modules
(mkRemovedOptionModule [ "fonts" "fontconfig" "penultimate" ] "The corresponding package has removed from nixpkgs.") (mkRemovedOptionModule [ "fonts" "fontconfig" "penultimate" ] "The corresponding package has removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "quagga" ] "the corresponding package has been removed from nixpkgs")
(mkRemovedOptionModule [ "services" "chronos" ] "The corresponding package was removed from nixpkgs.") (mkRemovedOptionModule [ "services" "chronos" ] "The corresponding package was removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "deepin" ] "The corresponding packages were removed from nixpkgs.") (mkRemovedOptionModule [ "services" "deepin" ] "The corresponding packages were removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "firefox" "syncserver" "user" ] "") (mkRemovedOptionModule [ "services" "firefox" "syncserver" "user" ] "")

View File

@ -295,8 +295,7 @@ in
# systems! # systems!
mkDefault (if versionAtLeast config.system.stateVersion "20.03" then pkgs.postgresql_11 mkDefault (if versionAtLeast config.system.stateVersion "20.03" then pkgs.postgresql_11
else if versionAtLeast config.system.stateVersion "17.09" then pkgs.postgresql_9_6 else if versionAtLeast config.system.stateVersion "17.09" then pkgs.postgresql_9_6
else if versionAtLeast config.system.stateVersion "16.03" then pkgs.postgresql_9_5 else throw "postgresql_9_5 was removed, please upgrade your postgresql version.");
else throw "postgresql_9_4 was removed, please upgrade your postgresql version.");
services.postgresql.dataDir = mkDefault "/var/lib/postgresql/${cfg.package.psqlSchema}"; services.postgresql.dataDir = mkDefault "/var/lib/postgresql/${cfg.package.psqlSchema}";

View File

@ -5,6 +5,8 @@ with lib;
let let
cfg = config.services.redis; cfg = config.services.redis;
ulimitNofile = cfg.maxclients + 32;
mkValueString = value: mkValueString = value:
if value == true then "yes" if value == true then "yes"
else if value == false then "no" else if value == false then "no"
@ -14,8 +16,8 @@ let
listsAsDuplicateKeys = true; listsAsDuplicateKeys = true;
mkKeyValue = generators.mkKeyValueDefault { inherit mkValueString; } " "; mkKeyValue = generators.mkKeyValueDefault { inherit mkValueString; } " ";
} cfg.settings); } cfg.settings);
in
{ in {
imports = [ imports = [
(mkRemovedOptionModule [ "services" "redis" "user" ] "The redis module now is hardcoded to the redis user.") (mkRemovedOptionModule [ "services" "redis" "user" ] "The redis module now is hardcoded to the redis user.")
(mkRemovedOptionModule [ "services" "redis" "dbpath" ] "The redis module now uses /var/lib/redis as data directory.") (mkRemovedOptionModule [ "services" "redis" "dbpath" ] "The redis module now uses /var/lib/redis as data directory.")
@ -121,6 +123,12 @@ in
description = "Set the number of databases."; description = "Set the number of databases.";
}; };
maxclients = mkOption {
type = types.int;
default = 10000;
description = "Set the max number of connected clients at the same time.";
};
save = mkOption { save = mkOption {
type = with types; listOf (listOf int); type = with types; listOf (listOf int);
default = [ [900 1] [300 10] [60 10000] ]; default = [ [900 1] [300 10] [60 10000] ];
@ -253,6 +261,7 @@ in
logfile = cfg.logfile; logfile = cfg.logfile;
syslog-enabled = cfg.syslog; syslog-enabled = cfg.syslog;
databases = cfg.databases; databases = cfg.databases;
maxclients = cfg.maxclients;
save = map (d: "${toString (builtins.elemAt d 0)} ${toString (builtins.elemAt d 1)}") cfg.save; save = map (d: "${toString (builtins.elemAt d 0)} ${toString (builtins.elemAt d 1)}") cfg.save;
dbfilename = "dump.rdb"; dbfilename = "dump.rdb";
dir = "/var/lib/redis"; dir = "/var/lib/redis";
@ -295,6 +304,34 @@ in
StateDirectoryMode = "0700"; StateDirectoryMode = "0700";
# Access write directories # Access write directories
UMask = "0077"; UMask = "0077";
# Capabilities
CapabilityBoundingSet = "";
# Security
NoNewPrivileges = true;
# Process Properties
LimitNOFILE = "${toString ulimitNofile}";
# Sandboxing
ProtectSystem = "strict";
ProtectHome = true;
PrivateTmp = true;
PrivateDevices = true;
PrivateUsers = true;
ProtectClock = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
RestrictNamespaces = true;
LockPersonality = true;
MemoryDenyWriteExecute = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
PrivateMounts = true;
# System Call Filtering
SystemCallArchitectures = "native";
SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @privileged @raw-io @reboot @resources @setuid @swap";
}; };
}; };
}; };

View File

@ -0,0 +1,111 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.quake3-server;
configFile = pkgs.writeText "q3ds-extra.cfg" ''
set net_port ${builtins.toString cfg.port}
${cfg.extraConfig}
'';
defaultBaseq3 = pkgs.requireFile rec {
name = "baseq3";
hashMode = "recursive";
sha256 = "5dd8ee09eabd45e80450f31d7a8b69b846f59738726929298d8a813ce5725ed3";
message = ''
Unfortunately, we cannot download ${name} automatically.
Please purchase a legitimate copy of Quake 3 and change into the installation directory.
You can either add all relevant files to the nix-store like this:
mkdir /tmp/baseq3
cp baseq3/pak*.pk3 /tmp/baseq3
nix-store --add-fixed sha256 --recursive /tmp/baseq3
Alternatively you can set services.quake3-server.baseq3 to a path and copy the baseq3 directory into
$services.quake3-server.baseq3/.q3a/
'';
};
home = pkgs.runCommand "quake3-home" {} ''
mkdir -p $out/.q3a/baseq3
for file in ${cfg.baseq3}/*; do
ln -s $file $out/.q3a/baseq3/$(basename $file)
done
ln -s ${configFile} $out/.q3a/baseq3/nix.cfg
'';
in {
options = {
services.quake3-server = {
enable = mkEnableOption "Quake 3 dedicated server";
port = mkOption {
type = types.port;
default = 27960;
description = ''
UDP Port the server should listen on.
'';
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = ''
Open the firewall.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
seta rconPassword "superSecret" // sets RCON password for remote console
seta sv_hostname "My Quake 3 server" // name that appears in server list
'';
description = ''
Extra configuration options. Note that options changed via RCON will not be persisted. To list all possible
options, use "cvarlist 1" via RCON.
'';
};
baseq3 = mkOption {
type = types.either types.package types.path;
default = defaultBaseq3;
example = "/var/lib/q3ds";
description = ''
Path to the baseq3 files (pak*.pk3). If this is on the nix store (type = package) all .pk3 files should be saved
in the top-level directory. If this is on another filesystem (e.g /var/lib/baseq3) the .pk3 files are searched in
$baseq3/.q3a/baseq3/
'';
};
};
};
config = let
baseq3InStore = builtins.typeOf cfg.baseq3 == "set";
in mkIf cfg.enable {
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ cfg.port ];
systemd.services.q3ds = {
description = "Quake 3 dedicated server";
wantedBy = [ "multi-user.target" ];
after = [ "networking.target" ];
environment.HOME = if baseq3InStore then home else cfg.baseq3;
serviceConfig = with lib; {
Restart = "always";
DynamicUser = true;
WorkingDirectory = home;
# It is possible to alter configuration files via RCON. To ensure reproducibility we have to prevent this
ReadOnlyPaths = if baseq3InStore then home else cfg.baseq3;
ExecStartPre = optionalString (!baseq3InStore) "+${pkgs.coreutils}/bin/cp ${configFile} ${cfg.baseq3}/.q3a/baseq3/nix.cfg";
ExecStart = "${pkgs.ioquake3}/ioq3ded.x86_64 +exec nix.cfg";
};
};
};
meta.maintainers = with maintainers; [ f4814n ];
}

View File

@ -454,7 +454,7 @@ in {
}; };
meta = { meta = {
maintainers = with lib.maintainers; [ lheckemann ]; maintainers = with lib.maintainers; [ lheckemann qyliss ];
doc = ./mailman.xml; doc = ./mailman.xml;
}; };

View File

@ -204,6 +204,7 @@ with lib;
users.${cfg.user} = { users.${cfg.user} = {
description = "Nullmailer relay-only mta user"; description = "Nullmailer relay-only mta user";
group = cfg.group; group = cfg.group;
isSystemUser = true;
}; };
groups.${cfg.group} = { }; groups.${cfg.group} = { };

View File

@ -50,15 +50,10 @@ let
# List of components used in config # List of components used in config
extraComponents = filter useComponent availableComponents; extraComponents = filter useComponent availableComponents;
testedPackage = if (cfg.autoExtraComponents && cfg.config != null) package = if (cfg.autoExtraComponents && cfg.config != null)
then (cfg.package.override { inherit extraComponents; }) then (cfg.package.override { inherit extraComponents; })
else cfg.package; else cfg.package;
# overridePythonAttrs has to be applied after override
package = testedPackage.overridePythonAttrs (oldAttrs: {
doCheck = false;
});
# If you are changing this, please update the description in applyDefaultConfig # If you are changing this, please update the description in applyDefaultConfig
defaultConfig = { defaultConfig = {
homeassistant.time_zone = config.time.timeZone; homeassistant.time_zone = config.time.timeZone;
@ -188,9 +183,13 @@ in {
}; };
package = mkOption { package = mkOption {
default = pkgs.home-assistant; default = pkgs.home-assistant.overrideAttrs (oldAttrs: {
doInstallCheck = false;
});
defaultText = literalExample '' defaultText = literalExample ''
pkgs.home-assistant pkgs.home-assistant.overrideAttrs (oldAttrs: {
doInstallCheck = false;
})
''; '';
type = types.package; type = types.package;
example = literalExample '' example = literalExample ''
@ -199,12 +198,11 @@ in {
} }
''; '';
description = '' description = ''
Home Assistant package to use. Tests are automatically disabled, as they take a considerable amout of time to complete. Home Assistant package to use. By default the tests are disabled, as they take a considerable amout of time to complete.
Override <literal>extraPackages</literal> or <literal>extraComponents</literal> in order to add additional dependencies. Override <literal>extraPackages</literal> or <literal>extraComponents</literal> in order to add additional dependencies.
If you specify <option>config</option> and do not set <option>autoExtraComponents</option> If you specify <option>config</option> and do not set <option>autoExtraComponents</option>
to <literal>false</literal>, overriding <literal>extraComponents</literal> will have no effect. to <literal>false</literal>, overriding <literal>extraComponents</literal> will have no effect.
Avoid <literal>home-assistant.overridePythonAttrs</literal> if you use Avoid <literal>home-assistant.overridePythonAttrs</literal> if you use <literal>autoExtraComponents</literal>.
<literal>autoExtraComponents</literal>.
''; '';
}; };

View File

@ -214,7 +214,8 @@ in {
PrivateMounts = true; PrivateMounts = true;
SystemCallFilter = "~@aio @clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @raw-io @setuid @swap"; SystemCallFilter = "~@aio @clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @raw-io @setuid @swap";
SystemCallArchitectures = "native"; SystemCallArchitectures = "native";
RestrictAddressFamilies = "AF_INET AF_INET6"; # AF_UNIX is required to connect to a postgres socket.
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
}; };
}; };

View File

@ -296,7 +296,7 @@ in {
systemd.sockets.ipfs-api = { systemd.sockets.ipfs-api = {
wantedBy = [ "sockets.target" ]; wantedBy = [ "sockets.target" ];
# We also include "%t/ipfs.sock" because tere is no way to put the "%t" # We also include "%t/ipfs.sock" because there is no way to put the "%t"
# in the multiaddr. # in the multiaddr.
socketConfig.ListenStream = let socketConfig.ListenStream = let
fromCfg = multiaddrToListenStream cfg.apiAddress; fromCfg = multiaddrToListenStream cfg.apiAddress;

View File

@ -4,7 +4,7 @@ with lib;
let let
cfg = config.services.dnsdist; cfg = config.services.dnsdist;
configFile = pkgs.writeText "dndist.conf" '' configFile = pkgs.writeText "dnsdist.conf" ''
setLocal('${cfg.listenAddress}:${toString cfg.listenPort}') setLocal('${cfg.listenAddress}:${toString cfg.listenPort}')
${cfg.extraConfig} ${cfg.extraConfig}
''; '';

View File

@ -41,8 +41,8 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.mxisd; default = pkgs.ma1sd;
defaultText = "pkgs.mxisd"; defaultText = "pkgs.ma1sd";
description = "The mxisd/ma1sd package to use"; description = "The mxisd/ma1sd package to use";
}; };

View File

@ -0,0 +1,219 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.nebula;
enabledNetworks = filterAttrs (n: v: v.enable) cfg.networks;
format = pkgs.formats.yaml {};
nameToId = netName: "nebula-${netName}";
in
{
# Interface
options = {
services.nebula = {
networks = mkOption {
description = "Nebula network definitions.";
default = {};
type = types.attrsOf (types.submodule {
options = {
enable = mkOption {
type = types.bool;
default = true;
description = "Enable or disable this network.";
};
package = mkOption {
type = types.package;
default = pkgs.nebula;
defaultText = "pkgs.nebula";
description = "Nebula derivation to use.";
};
ca = mkOption {
type = types.path;
description = "Path to the certificate authority certificate.";
example = "/etc/nebula/ca.crt";
};
cert = mkOption {
type = types.path;
description = "Path to the host certificate.";
example = "/etc/nebula/host.crt";
};
key = mkOption {
type = types.path;
description = "Path to the host key.";
example = "/etc/nebula/host.key";
};
staticHostMap = mkOption {
type = types.attrsOf (types.listOf (types.str));
default = {};
description = ''
The static host map defines a set of hosts with fixed IP addresses on the internet (or any network).
A host can have multiple fixed IP addresses defined here, and nebula will try each when establishing a tunnel.
'';
example = literalExample ''
{ "192.168.100.1" = [ "100.64.22.11:4242" ]; }
'';
};
isLighthouse = mkOption {
type = types.bool;
default = false;
description = "Whether this node is a lighthouse.";
};
lighthouses = mkOption {
type = types.listOf types.str;
default = [];
description = ''
List of IPs of lighthouse hosts this node should report to and query from. This should be empty on lighthouse
nodes. The IPs should be the lighthouse's Nebula IPs, not their external IPs.
'';
example = ''[ "192.168.100.1" ]'';
};
listen.host = mkOption {
type = types.str;
default = "0.0.0.0";
description = "IP address to listen on.";
};
listen.port = mkOption {
type = types.port;
default = 4242;
description = "Port number to listen on.";
};
tun.disable = mkOption {
type = types.bool;
default = false;
description = ''
When tun is disabled, a lighthouse can be started without a local tun interface (and therefore without root).
'';
};
tun.device = mkOption {
type = types.nullOr types.str;
default = null;
description = "Name of the tun device. Defaults to nebula.\${networkName}.";
};
firewall.outbound = mkOption {
type = types.listOf types.attrs;
default = [];
description = "Firewall rules for outbound traffic.";
example = ''[ { port = "any"; proto = "any"; host = "any"; } ]'';
};
firewall.inbound = mkOption {
type = types.listOf types.attrs;
default = [];
description = "Firewall rules for inbound traffic.";
example = ''[ { port = "any"; proto = "any"; host = "any"; } ]'';
};
settings = mkOption {
type = format.type;
default = {};
description = ''
Nebula configuration. Refer to
<link xlink:href="https://github.com/slackhq/nebula/blob/master/examples/config.yml"/>
for details on supported values.
'';
example = literalExample ''
{
lighthouse.dns = {
host = "0.0.0.0";
port = 53;
};
}
'';
};
};
});
};
};
};
# Implementation
config = mkIf (enabledNetworks != {}) {
systemd.services = mkMerge (mapAttrsToList (netName: netCfg:
let
networkId = nameToId netName;
settings = recursiveUpdate {
pki = {
ca = netCfg.ca;
cert = netCfg.cert;
key = netCfg.key;
};
static_host_map = netCfg.staticHostMap;
lighthouse = {
am_lighthouse = netCfg.isLighthouse;
hosts = netCfg.lighthouses;
};
listen = {
host = netCfg.listen.host;
port = netCfg.listen.port;
};
tun = {
disabled = netCfg.tun.disable;
dev = if (netCfg.tun.device != null) then netCfg.tun.device else "nebula.${netName}";
};
firewall = {
inbound = netCfg.firewall.inbound;
outbound = netCfg.firewall.outbound;
};
} netCfg.settings;
configFile = format.generate "nebula-config-${netName}.yml" settings;
in
{
# Create systemd service for Nebula.
"nebula@${netName}" = {
description = "Nebula VPN service for ${netName}";
wants = [ "basic.target" ];
after = [ "basic.target" "network.target" ];
before = [ "sshd.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = mkMerge [
{
Type = "simple";
Restart = "always";
ExecStart = "${netCfg.package}/bin/nebula -config ${configFile}";
}
# The service needs to launch as root to access the tun device, if it's enabled.
(mkIf netCfg.tun.disable {
User = networkId;
Group = networkId;
})
];
};
}) enabledNetworks);
# Open the chosen ports for UDP.
networking.firewall.allowedUDPPorts =
unique (mapAttrsToList (netName: netCfg: netCfg.listen.port) enabledNetworks);
# Create the service users and groups.
users.users = mkMerge (mapAttrsToList (netName: netCfg:
mkIf netCfg.tun.disable {
${nameToId netName} = {
group = nameToId netName;
description = "Nebula service user for network ${netName}";
isSystemUser = true;
};
}) enabledNetworks);
users.groups = mkMerge (mapAttrsToList (netName: netCfg:
mkIf netCfg.tun.disable {
${nameToId netName} = {};
}) enabledNetworks);
};
}

View File

@ -1,185 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.quagga;
services = [ "babel" "bgp" "isis" "ospf6" "ospf" "pim" "rip" "ripng" ];
allServices = services ++ [ "zebra" ];
isEnabled = service: cfg.${service}.enable;
daemonName = service: if service == "zebra" then service else "${service}d";
configFile = service:
let
scfg = cfg.${service};
in
if scfg.configFile != null then scfg.configFile
else pkgs.writeText "${daemonName service}.conf"
''
! Quagga ${daemonName service} configuration
!
hostname ${config.networking.hostName}
log syslog
service password-encryption
!
${scfg.config}
!
end
'';
serviceOptions = service:
{
enable = mkEnableOption "the Quagga ${toUpper service} routing protocol";
configFile = mkOption {
type = types.nullOr types.path;
default = null;
example = "/etc/quagga/${daemonName service}.conf";
description = ''
Configuration file to use for Quagga ${daemonName service}.
By default the NixOS generated files are used.
'';
};
config = mkOption {
type = types.lines;
default = "";
example =
let
examples = {
rip = ''
router rip
network 10.0.0.0/8
'';
ospf = ''
router ospf
network 10.0.0.0/8 area 0
'';
bgp = ''
router bgp 65001
neighbor 10.0.0.1 remote-as 65001
'';
};
in
examples.${service} or "";
description = ''
${daemonName service} configuration statements.
'';
};
vtyListenAddress = mkOption {
type = types.str;
default = "127.0.0.1";
description = ''
Address to bind to for the VTY interface.
'';
};
vtyListenPort = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
TCP Port to bind to for the VTY interface.
'';
};
};
in
{
###### interface
imports = [
{
options.services.quagga = {
zebra = (serviceOptions "zebra") // {
enable = mkOption {
type = types.bool;
default = any isEnabled services;
description = ''
Whether to enable the Zebra routing manager.
The Zebra routing manager is automatically enabled
if any routing protocols are configured.
'';
};
};
};
}
{ options.services.quagga = (genAttrs services serviceOptions); }
];
###### implementation
config = mkIf (any isEnabled allServices) {
environment.systemPackages = [
pkgs.quagga # for the vtysh tool
];
users.users.quagga = {
description = "Quagga daemon user";
isSystemUser = true;
group = "quagga";
};
users.groups = {
quagga = {};
# Members of the quaggavty group can use vtysh to inspect the Quagga daemons
quaggavty = { members = [ "quagga" ]; };
};
systemd.services =
let
quaggaService = service:
let
scfg = cfg.${service};
daemon = daemonName service;
in
nameValuePair daemon ({
wantedBy = [ "multi-user.target" ];
restartTriggers = [ (configFile service) ];
serviceConfig = {
Type = "forking";
PIDFile = "/run/quagga/${daemon}.pid";
ExecStart = "@${pkgs.quagga}/libexec/quagga/${daemon} ${daemon} -d -f ${configFile service}"
+ optionalString (scfg.vtyListenAddress != "") " -A ${scfg.vtyListenAddress}"
+ optionalString (scfg.vtyListenPort != null) " -P ${toString scfg.vtyListenPort}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Restart = "on-abort";
};
} // (
if service == "zebra" then
{
description = "Quagga Zebra routing manager";
unitConfig.Documentation = "man:zebra(8)";
after = [ "network.target" ];
preStart = ''
install -m 0755 -o quagga -g quagga -d /run/quagga
${pkgs.iproute2}/bin/ip route flush proto zebra
'';
}
else
{
description = "Quagga ${toUpper service} routing daemon";
unitConfig.Documentation = "man:${daemon}(8) man:zebra(8)";
bindsTo = [ "zebra.service" ];
after = [ "network.target" "zebra.service" ];
}
));
in
listToAttrs (map quaggaService (filter isEnabled allServices));
};
meta.maintainers = with lib.maintainers; [ tavyc ];
}

View File

@ -90,10 +90,10 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.oauth2_proxy; default = pkgs.oauth2-proxy;
defaultText = "pkgs.oauth2_proxy"; defaultText = "pkgs.oauth2-proxy";
description = '' description = ''
The package that provides oauth2_proxy. The package that provides oauth2-proxy.
''; '';
}; };

View File

@ -249,7 +249,15 @@ let
+ optionalString (ssl && vhost.http2) "http2 " + optionalString (ssl && vhost.http2) "http2 "
+ optionalString vhost.default "default_server " + optionalString vhost.default "default_server "
+ optionalString (extraParameters != []) (concatStringsSep " " extraParameters) + optionalString (extraParameters != []) (concatStringsSep " " extraParameters)
+ ";"; + ";"
+ (if ssl && vhost.http3 then ''
# UDP listener for **QUIC+HTTP/3
listen ${addr}:${toString port} http3 reuseport;
# Advertise that HTTP/3 is available
add_header Alt-Svc 'h3=":443"';
# Sent when QUIC was used
add_header QUIC-Status $quic;
'' else "");
redirectListen = filter (x: !x.ssl) defaultListen; redirectListen = filter (x: !x.ssl) defaultListen;
@ -676,6 +684,7 @@ in
Defines the address and other parameters of the upstream servers. Defines the address and other parameters of the upstream servers.
''; '';
default = {}; default = {};
example = { "127.0.0.1:8000" = {}; };
}; };
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
@ -690,6 +699,14 @@ in
Defines a group of servers to use as proxy target. Defines a group of servers to use as proxy target.
''; '';
default = {}; default = {};
example = literalExample ''
"backend_server" = {
servers = { "127.0.0.1:8000" = {}; };
extraConfig = ''''
keepalive 16;
'''';
};
'';
}; };
virtualHosts = mkOption { virtualHosts = mkOption {

View File

@ -151,6 +151,19 @@ with lib;
''; '';
}; };
http3 = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable HTTP 3.
This requires using <literal>pkgs.nginxQuic</literal> package
which can be achived by setting <literal>services.nginx.package = pkgs.nginxQuic;</literal>.
Note that HTTP 3 support is experimental and
*not* yet recommended for production.
Read more at https://quic.nginx.org/
'';
};
root = mkOption { root = mkOption {
type = types.nullOr types.path; type = types.nullOr types.path;
default = null; default = null;

View File

@ -19,7 +19,7 @@ in
default = null; default = null;
example = "ondemand"; example = "ondemand";
description = '' description = ''
Configure the governor used to regulate the frequence of the Configure the governor used to regulate the frequency of the
available CPUs. By default, the kernel configures the available CPUs. By default, the kernel configures the
performance governor, although this may be overwritten in your performance governor, although this may be overwritten in your
hardware-configuration.nix file. hardware-configuration.nix file.

View File

@ -446,7 +446,8 @@ in
'') rootPools)); '') rootPools));
}; };
boot.loader.grub = mkIf inInitrd { # TODO FIXME See https://github.com/NixOS/nixpkgs/pull/99386#issuecomment-798813567. To not break people's bootloader and as probably not everybody would read release notes that thoroughly add inSystem.
boot.loader.grub = mkIf (inInitrd || inSystem) {
zfsSupport = true; zfsSupport = true;
}; };

View File

@ -9,8 +9,9 @@ in
options = { options = {
virtualisation.azureImage.diskSize = mkOption { virtualisation.azureImage.diskSize = mkOption {
type = with types; int; type = with types; either (enum [ "auto" ]) int;
default = 2048; default = "auto";
example = 2048;
description = '' description = ''
Size of disk image. Unit is MB. Size of disk image. Unit is MB.
''; '';

View File

@ -10,8 +10,9 @@ in
options = { options = {
virtualisation.digitalOceanImage.diskSize = mkOption { virtualisation.digitalOceanImage.diskSize = mkOption {
type = with types; int; type = with types; either (enum [ "auto" ]) int;
default = 4096; default = "auto";
example = 4096;
description = '' description = ''
Size of disk image. Unit is MB. Size of disk image. Unit is MB.
''; '';

View File

@ -18,8 +18,9 @@ in
options = { options = {
virtualisation.googleComputeImage.diskSize = mkOption { virtualisation.googleComputeImage.diskSize = mkOption {
type = with types; int; type = with types; either (enum [ "auto" ]) int;
default = 1536; default = "auto";
example = 1536;
description = '' description = ''
Size of disk image. Unit is MB. Size of disk image. Unit is MB.
''; '';

View File

@ -9,8 +9,9 @@ in {
options = { options = {
hyperv = { hyperv = {
baseImageSize = mkOption { baseImageSize = mkOption {
type = types.int; type = with types; either (enum [ "auto" ]) int;
default = 2048; default = "auto";
example = 2048;
description = '' description = ''
The size of the hyper-v base image in MiB. The size of the hyper-v base image in MiB.
''; '';

View File

@ -59,6 +59,18 @@ let
''; '';
}; };
environmentFiles = mkOption {
type = with types; listOf path;
default = [];
description = "Environment files for this container.";
example = literalExample ''
[
/path/to/.env
/path/to/.env.secret
]
'';
};
log-driver = mkOption { log-driver = mkOption {
type = types.str; type = types.str;
default = "journald"; default = "journald";
@ -236,6 +248,7 @@ let
] ++ optional (container.entrypoint != null) ] ++ optional (container.entrypoint != null)
"--entrypoint=${escapeShellArg container.entrypoint}" "--entrypoint=${escapeShellArg container.entrypoint}"
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment) ++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
++ map (p: "-p ${escapeShellArg p}") container.ports ++ map (p: "-p ${escapeShellArg p}") container.ports
++ optional (container.user != null) "-u ${escapeShellArg container.user}" ++ optional (container.user != null) "-u ${escapeShellArg container.user}"
++ map (v: "-v ${escapeShellArg v}") container.volumes ++ map (v: "-v ${escapeShellArg v}") container.volumes

View File

@ -11,8 +11,9 @@ in {
options = { options = {
virtualbox = { virtualbox = {
baseImageSize = mkOption { baseImageSize = mkOption {
type = types.int; type = with types; either (enum [ "auto" ]) int;
default = 50 * 1024; default = "auto";
example = 50 * 1024;
description = '' description = ''
The size of the VirtualBox base image in MiB. The size of the VirtualBox base image in MiB.
''; '';

View File

@ -18,8 +18,9 @@ in {
options = { options = {
vmware = { vmware = {
baseImageSize = mkOption { baseImageSize = mkOption {
type = types.int; type = with types; either (enum [ "auto" ]) int;
default = 2048; default = "auto";
example = 2048;
description = '' description = ''
The size of the VMWare base image in MiB. The size of the VMWare base image in MiB.
''; '';

View File

@ -262,6 +262,7 @@ in
nat.standalone = handleTest ./nat.nix { withFirewall = false; }; nat.standalone = handleTest ./nat.nix { withFirewall = false; };
ncdns = handleTest ./ncdns.nix {}; ncdns = handleTest ./ncdns.nix {};
ndppd = handleTest ./ndppd.nix {}; ndppd = handleTest ./ndppd.nix {};
nebula = handleTest ./nebula.nix {};
neo4j = handleTest ./neo4j.nix {}; neo4j = handleTest ./neo4j.nix {};
netdata = handleTest ./netdata.nix {}; netdata = handleTest ./netdata.nix {};
networking.networkd = handleTest ./networking.nix { networkd = true; }; networking.networkd = handleTest ./networking.nix { networkd = true; };
@ -341,7 +342,6 @@ in
proxy = handleTest ./proxy.nix {}; proxy = handleTest ./proxy.nix {};
pt2-clone = handleTest ./pt2-clone.nix {}; pt2-clone = handleTest ./pt2-clone.nix {};
qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {}; qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {};
quagga = handleTest ./quagga.nix {};
quorum = handleTest ./quorum.nix {}; quorum = handleTest ./quorum.nix {};
rabbitmq = handleTest ./rabbitmq.nix {}; rabbitmq = handleTest ./rabbitmq.nix {};
radarr = handleTest ./radarr.nix {}; radarr = handleTest ./radarr.nix {};

View File

@ -6,25 +6,16 @@ import ./make-test-python.nix ({ pkgs, ... } : {
}; };
nodes = { nodes = {
server_mxisd = args : { server = args : {
services.mxisd.enable = true; services.mxisd.enable = true;
services.mxisd.matrix.domain = "example.org"; services.mxisd.matrix.domain = "example.org";
}; };
server_ma1sd = args : {
services.mxisd.enable = true;
services.mxisd.matrix.domain = "example.org";
services.mxisd.package = pkgs.ma1sd;
};
}; };
testScript = '' testScript = ''
start_all() start_all()
server_mxisd.wait_for_unit("mxisd.service") server.wait_for_unit("mxisd.service")
server_mxisd.wait_for_open_port(8090) server.wait_for_open_port(8090)
server_mxisd.succeed("curl -Ssf 'http://127.0.0.1:8090/_matrix/identity/api/v1'") server.succeed("curl -Ssf 'http://127.0.0.1:8090/_matrix/identity/api/v1'")
server_ma1sd.wait_for_unit("mxisd.service")
server_ma1sd.wait_for_open_port(8090)
server_ma1sd.succeed("curl -Ssf 'http://127.0.0.1:8090/_matrix/identity/api/v1'")
''; '';
}) })

223
nixos/tests/nebula.nix Normal file
View File

@ -0,0 +1,223 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: let
# We'll need to be able to trade cert files between nodes via scp.
inherit (import ./ssh-keys.nix pkgs)
snakeOilPrivateKey snakeOilPublicKey;
makeNebulaNode = { config, ... }: name: extraConfig: lib.mkMerge [
{
# Expose nebula for doing cert signing.
environment.systemPackages = [ pkgs.nebula ];
users.users.root.openssh.authorizedKeys.keys = [ snakeOilPublicKey ];
services.openssh.enable = true;
services.nebula.networks.smoke = {
# Note that these paths won't exist when the machine is first booted.
ca = "/etc/nebula/ca.crt";
cert = "/etc/nebula/${name}.crt";
key = "/etc/nebula/${name}.key";
listen = { host = "0.0.0.0"; port = 4242; };
};
}
extraConfig
];
in
{
name = "nebula";
nodes = {
lighthouse = { ... } @ args:
makeNebulaNode args "lighthouse" {
networking.interfaces.eth1.ipv4.addresses = [{
address = "192.168.1.1";
prefixLength = 24;
}];
services.nebula.networks.smoke = {
isLighthouse = true;
firewall = {
outbound = [ { port = "any"; proto = "any"; host = "any"; } ];
inbound = [ { port = "any"; proto = "any"; host = "any"; } ];
};
};
};
node2 = { ... } @ args:
makeNebulaNode args "node2" {
networking.interfaces.eth1.ipv4.addresses = [{
address = "192.168.1.2";
prefixLength = 24;
}];
services.nebula.networks.smoke = {
staticHostMap = { "10.0.100.1" = [ "192.168.1.1:4242" ]; };
isLighthouse = false;
lighthouses = [ "10.0.100.1" ];
firewall = {
outbound = [ { port = "any"; proto = "any"; host = "any"; } ];
inbound = [ { port = "any"; proto = "any"; host = "any"; } ];
};
};
};
node3 = { ... } @ args:
makeNebulaNode args "node3" {
networking.interfaces.eth1.ipv4.addresses = [{
address = "192.168.1.3";
prefixLength = 24;
}];
services.nebula.networks.smoke = {
staticHostMap = { "10.0.100.1" = [ "192.168.1.1:4242" ]; };
isLighthouse = false;
lighthouses = [ "10.0.100.1" ];
firewall = {
outbound = [ { port = "any"; proto = "any"; host = "any"; } ];
inbound = [ { port = "any"; proto = "any"; host = "lighthouse"; } ];
};
};
};
node4 = { ... } @ args:
makeNebulaNode args "node4" {
networking.interfaces.eth1.ipv4.addresses = [{
address = "192.168.1.4";
prefixLength = 24;
}];
services.nebula.networks.smoke = {
enable = true;
staticHostMap = { "10.0.100.1" = [ "192.168.1.1:4242" ]; };
isLighthouse = false;
lighthouses = [ "10.0.100.1" ];
firewall = {
outbound = [ { port = "any"; proto = "any"; host = "lighthouse"; } ];
inbound = [ { port = "any"; proto = "any"; host = "any"; } ];
};
};
};
node5 = { ... } @ args:
makeNebulaNode args "node5" {
networking.interfaces.eth1.ipv4.addresses = [{
address = "192.168.1.5";
prefixLength = 24;
}];
services.nebula.networks.smoke = {
enable = false;
staticHostMap = { "10.0.100.1" = [ "192.168.1.1:4242" ]; };
isLighthouse = false;
lighthouses = [ "10.0.100.1" ];
firewall = {
outbound = [ { port = "any"; proto = "any"; host = "lighthouse"; } ];
inbound = [ { port = "any"; proto = "any"; host = "any"; } ];
};
};
};
};
testScript = let
setUpPrivateKey = name: ''
${name}.succeed(
"mkdir -p /root/.ssh",
"chown 700 /root/.ssh",
"cat '${snakeOilPrivateKey}' > /root/.ssh/id_snakeoil",
"chown 600 /root/.ssh/id_snakeoil",
)
'';
# From what I can tell, StrictHostKeyChecking=no is necessary for ssh to work between machines.
sshOpts = "-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oIdentityFile=/root/.ssh/id_snakeoil";
restartAndCheckNebula = name: ip: ''
${name}.systemctl("restart nebula@smoke.service")
${name}.succeed("ping -c5 ${ip}")
'';
# Create a keypair on the client node, then use the public key to sign a cert on the lighthouse.
signKeysFor = name: ip: ''
lighthouse.wait_for_unit("sshd.service")
${name}.wait_for_unit("sshd.service")
${name}.succeed(
"mkdir -p /etc/nebula",
"nebula-cert keygen -out-key /etc/nebula/${name}.key -out-pub /etc/nebula/${name}.pub",
"scp ${sshOpts} /etc/nebula/${name}.pub 192.168.1.1:/tmp/${name}.pub",
)
lighthouse.succeed(
'nebula-cert sign -ca-crt /etc/nebula/ca.crt -ca-key /etc/nebula/ca.key -name "${name}" -groups "${name}" -ip "${ip}" -in-pub /tmp/${name}.pub -out-crt /tmp/${name}.crt',
)
${name}.succeed(
"scp ${sshOpts} 192.168.1.1:/tmp/${name}.crt /etc/nebula/${name}.crt",
"scp ${sshOpts} 192.168.1.1:/etc/nebula/ca.crt /etc/nebula/ca.crt",
)
'';
in ''
start_all()
# Create the certificate and sign the lighthouse's keys.
${setUpPrivateKey "lighthouse"}
lighthouse.succeed(
"mkdir -p /etc/nebula",
'nebula-cert ca -name "Smoke Test" -out-crt /etc/nebula/ca.crt -out-key /etc/nebula/ca.key',
'nebula-cert sign -ca-crt /etc/nebula/ca.crt -ca-key /etc/nebula/ca.key -name "lighthouse" -groups "lighthouse" -ip "10.0.100.1/24" -out-crt /etc/nebula/lighthouse.crt -out-key /etc/nebula/lighthouse.key',
)
# Reboot the lighthouse and verify that the nebula service comes up on boot.
# Since rebooting takes a while, we'll just restart the service on the other nodes.
lighthouse.shutdown()
lighthouse.start()
lighthouse.wait_for_unit("nebula@smoke.service")
lighthouse.succeed("ping -c5 10.0.100.1")
# Create keys for node2's nebula service and test that it comes up.
${setUpPrivateKey "node2"}
${signKeysFor "node2" "10.0.100.2/24"}
${restartAndCheckNebula "node2" "10.0.100.2"}
# Create keys for node3's nebula service and test that it comes up.
${setUpPrivateKey "node3"}
${signKeysFor "node3" "10.0.100.3/24"}
${restartAndCheckNebula "node3" "10.0.100.3"}
# Create keys for node4's nebula service and test that it comes up.
${setUpPrivateKey "node4"}
${signKeysFor "node4" "10.0.100.4/24"}
${restartAndCheckNebula "node4" "10.0.100.4"}
# Create keys for node4's nebula service and test that it does not come up.
${setUpPrivateKey "node5"}
${signKeysFor "node5" "10.0.100.5/24"}
node5.fail("systemctl status nebula@smoke.service")
node5.fail("ping -c5 10.0.100.5")
# The lighthouse can ping node2 and node3 but not node5
lighthouse.succeed("ping -c3 10.0.100.2")
lighthouse.succeed("ping -c3 10.0.100.3")
lighthouse.fail("ping -c3 10.0.100.5")
# node2 can ping the lighthouse, but not node3 because of its inbound firewall
node2.succeed("ping -c3 10.0.100.1")
node2.fail("ping -c3 10.0.100.3")
# node3 can ping the lighthouse and node2
node3.succeed("ping -c3 10.0.100.1")
node3.succeed("ping -c3 10.0.100.2")
# node4 can ping the lighthouse but not node2 or node3
node4.succeed("ping -c3 10.0.100.1")
node4.fail("ping -c3 10.0.100.2")
node4.fail("ping -c3 10.0.100.3")
# node2 can ping node3 now that node3 pinged it first
node2.succeed("ping -c3 10.0.100.3")
# node4 can ping node2 if node2 pings it first
node2.succeed("ping -c3 10.0.100.4")
node4.succeed("ping -c3 10.0.100.2")
'';
})

View File

@ -8,7 +8,6 @@ import ./make-test-python.nix ({ pkgs, ... }: {
environment.systemPackages = with pkgs; [ dbus ]; environment.systemPackages = with pkgs; [ dbus ];
services.packagekit = { services.packagekit = {
enable = true; enable = true;
backend = "test_nop";
}; };
}; };

View File

@ -1,96 +0,0 @@
# This test runs Quagga and checks if OSPF routing works.
#
# Network topology:
# [ client ]--net1--[ router1 ]--net2--[ router2 ]--net3--[ server ]
#
# All interfaces are in OSPF Area 0.
import ./make-test-python.nix ({ pkgs, ... }:
let
ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address;
ospfConf = ''
interface eth2
ip ospf hello-interval 1
ip ospf dead-interval 5
!
router ospf
network 192.168.0.0/16 area 0
'';
in
{
name = "quagga";
meta = with pkgs.lib.maintainers; {
maintainers = [ tavyc ];
};
nodes = {
client =
{ nodes, ... }:
{
virtualisation.vlans = [ 1 ];
networking.defaultGateway = ifAddr nodes.router1 "eth1";
};
router1 =
{ ... }:
{
virtualisation.vlans = [ 1 2 ];
boot.kernel.sysctl."net.ipv4.ip_forward" = "1";
networking.firewall.extraCommands = "iptables -A nixos-fw -i eth2 -p ospf -j ACCEPT";
services.quagga.ospf = {
enable = true;
config = ospfConf;
};
};
router2 =
{ ... }:
{
virtualisation.vlans = [ 3 2 ];
boot.kernel.sysctl."net.ipv4.ip_forward" = "1";
networking.firewall.extraCommands = "iptables -A nixos-fw -i eth2 -p ospf -j ACCEPT";
services.quagga.ospf = {
enable = true;
config = ospfConf;
};
};
server =
{ nodes, ... }:
{
virtualisation.vlans = [ 3 ];
networking.defaultGateway = ifAddr nodes.router2 "eth1";
networking.firewall.allowedTCPPorts = [ 80 ];
services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.com";
};
};
testScript =
{ ... }:
''
start_all()
# Wait for the networking to start on all machines
for machine in client, router1, router2, server:
machine.wait_for_unit("network.target")
with subtest("Wait for OSPF to form adjacencies"):
for gw in router1, router2:
gw.wait_for_unit("ospfd")
gw.wait_until_succeeds("vtysh -c 'show ip ospf neighbor' | grep Full")
gw.wait_until_succeeds("vtysh -c 'show ip route' | grep '^O>'")
with subtest("Test ICMP"):
client.wait_until_succeeds("ping -c 3 server >&2")
with subtest("Test whether HTTP works"):
server.wait_for_unit("httpd")
client.succeed("curl --fail http://server/ >&2")
'';
})

View File

@ -108,7 +108,7 @@ import ./make-test-python.nix ({ pkgs, ...} :
"${pkgs.curl}/bin/curl --fail http://localhost/searx >&2" "${pkgs.curl}/bin/curl --fail http://localhost/searx >&2"
) )
fancy.succeed( fancy.succeed(
"${pkgs.curl}/bin/curl --fail http://localhost/searx/static/js/bootstrap.min.js >&2" "${pkgs.curl}/bin/curl --fail http://localhost/searx/static/themes/oscar/js/bootstrap.min.js >&2"
) )
''; '';
}) })

View File

@ -18,7 +18,7 @@ in appimageTools.wrapType2 {
install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
substituteInPlace $out/share/applications/${pname}.desktop \ substituteInPlace $out/share/applications/${pname}.desktop \
--replace "Exec=AppRun" "Exec=$out/bin/apple-music-electron" --replace 'Exec=AppRun' 'Exec=${pname}'
cp -r ${appimageContents}/usr/share/icons $out/share cp -r ${appimageContents}/usr/share/icons $out/share
''; '';

View File

@ -18,7 +18,6 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
homepage = "http://linukz.org/cd-discid.shtml"; homepage = "http://linukz.org/cd-discid.shtml";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = [ maintainers.rycee ];
platforms = platforms.unix; platforms = platforms.unix;
description = "Command-line utility to get CDDB discid information from a CD-ROM disc"; description = "Command-line utility to get CDDB discid information from a CD-ROM disc";

View File

@ -5,13 +5,13 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "hydrogen"; pname = "hydrogen";
version = "1.0.1"; version = "1.0.2";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "hydrogen-music"; owner = "hydrogen-music";
repo = pname; repo = pname;
rev = version; rev = version;
sha256 = "0snljpvbcgikhz610c325dgvayi0k512p3bglck9vvi90wsqx7l1"; sha256 = "sha256-t3f+T1QTNbuJnWmD+q0yPgQxXPXvl91lZN17pKUVFlo=";
}; };
nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ]; nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ];
@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "Advanced drum machine"; description = "Advanced drum machine";
homepage = "http://www.hydrogen-music.org"; homepage = "http://www.hydrogen-music.org";
license = licenses.gpl2; license = licenses.gpl2Plus;
platforms = platforms.linux; platforms = platforms.linux;
maintainers = with maintainers; [ goibhniu orivej ]; maintainers = with maintainers; [ goibhniu orivej ];
}; };

View File

@ -1,9 +1,9 @@
{ lib, stdenv { lib, stdenv
, fetchurl , fetchurl
, makeWrapper , makeWrapper
, alsaLib , alsaLib
, perl , perl
, withConplay ? !stdenv.targetPlatform.isWindows
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -14,35 +14,36 @@ stdenv.mkDerivation rec {
sha256 = "sha256-UCqX4Nk1vn432YczgCHY8wG641wohPKoPVnEtSRm7wY="; sha256 = "sha256-UCqX4Nk1vn432YczgCHY8wG641wohPKoPVnEtSRm7wY=";
}; };
outputs = [ "out" "conplay" ]; outputs = [ "out" ] ++ lib.optionals withConplay [ "conplay" ];
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = lib.optionals withConplay [ makeWrapper ];
buildInputs = [ perl ] ++ lib.optional (!stdenv.isDarwin) alsaLib; buildInputs = lib.optionals withConplay [ perl ]
++ lib.optionals (!stdenv.isDarwin && !stdenv.targetPlatform.isWindows) [ alsaLib ];
configureFlags = lib.optional configureFlags = lib.optional
(stdenv.hostPlatform ? mpg123) (stdenv.hostPlatform ? mpg123)
"--with-cpu=${stdenv.hostPlatform.mpg123.cpu}"; "--with-cpu=${stdenv.hostPlatform.mpg123.cpu}";
postInstall = '' postInstall = lib.optionalString withConplay ''
mkdir -p $conplay/bin mkdir -p $conplay/bin
mv scripts/conplay $conplay/bin/ mv scripts/conplay $conplay/bin/
''; '';
preFixup = '' preFixup = lib.optionalString withConplay ''
patchShebangs $conplay/bin/conplay patchShebangs $conplay/bin/conplay
''; '';
postFixup = '' postFixup = lib.optionalString withConplay ''
wrapProgram $conplay/bin/conplay \ wrapProgram $conplay/bin/conplay \
--prefix PATH : $out/bin --prefix PATH : $out/bin
''; '';
meta = { meta = with lib; {
description = "Fast console MPEG Audio Player and decoder library"; description = "Fast console MPEG Audio Player and decoder library";
homepage = "http://mpg123.org"; homepage = "https://mpg123.org";
license = lib.licenses.lgpl21; license = licenses.lgpl21;
maintainers = [ lib.maintainers.ftrvxmtrx ]; maintainers = [ maintainers.ftrvxmtrx ];
platforms = lib.platforms.unix; platforms = platforms.all;
}; };
} }

View File

@ -37,7 +37,6 @@ stdenv.mkDerivation rec {
description = "Command-line MP3 player"; description = "Command-line MP3 player";
homepage = "http://mpg321.sourceforge.net/"; homepage = "http://mpg321.sourceforge.net/";
license = licenses.gpl2; license = licenses.gpl2;
maintainers = [ maintainers.rycee ];
platforms = platforms.gnu ++ platforms.linux; platforms = platforms.gnu ++ platforms.linux;
}; };
} }

View File

@ -0,0 +1,38 @@
{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, libpulseaudio
, glib
, pango
, gtk3
}:
rustPlatform.buildRustPackage rec {
pname = "myxer";
version = "1.2.1";
src = fetchFromGitHub {
owner = "Aurailus";
repo = pname;
rev = version;
sha256 = "0bnhpzmx4yyasv0j7bp31q6jm20p0qwcia5bzmpkz1jhnc27ngix";
};
cargoSha256 = "1cyh0nk627sgyr78rcnhj7af5jcahvjkiv5sz7xwqfdhvx5kqsk5";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libpulseaudio glib pango gtk3 ];
# Currently no tests are implemented, so we avoid building the package twice
doCheck = false;
meta = with lib; {
description = "A modern Volume Mixer for PulseAudio";
homepage = "https://github.com/Aurailus/Myxer";
license = licenses.gpl3Only;
maintainers = with maintainers; [ erin ];
platforms = platforms.linux;
};
}

View File

@ -18,7 +18,7 @@ in appimageTools.wrapType2 {
install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
substituteInPlace $out/share/applications/${pname}.desktop \ substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=$out/bin/nuclear' --replace 'Exec=AppRun' 'Exec=${pname}'
cp -r ${appimageContents}/usr/share/icons $out/share cp -r ${appimageContents}/usr/share/icons $out/share
''; '';

View File

@ -25,7 +25,7 @@ in appimageTools.wrapType2 {
install -m 444 -D ${appimageContents}/plexamp.desktop $out/share/applications/plexamp.desktop install -m 444 -D ${appimageContents}/plexamp.desktop $out/share/applications/plexamp.desktop
install -m 444 -D ${appimageContents}/plexamp.png \ install -m 444 -D ${appimageContents}/plexamp.png \
$out/share/icons/hicolor/512x512/apps/plexamp.png $out/share/icons/hicolor/512x512/apps/plexamp.png
substituteInPlace $out/share/applications/plexamp.desktop \ substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}' --replace 'Exec=AppRun' 'Exec=${pname}'
''; '';

View File

@ -1,26 +1,40 @@
{ mkDerivation { mkDerivation
, lib, stdenv , lib
, stdenv
, fetchFromGitHub , fetchFromGitHub
, nix-update-script
, qmake , qmake
, qtbase , qtbase
, qtmultimedia , qtmultimedia
, libvorbis , libvorbis
, rtmidi
}: }:
mkDerivation rec { mkDerivation rec {
pname = "ptcollab"; pname = "ptcollab";
version = "0.3.5.1"; version = "0.4.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "yuxshao"; owner = "yuxshao";
repo = "ptcollab"; repo = "ptcollab";
rev = "v${version}"; rev = "v${version}";
sha256 = "1ahfxjm1chz8k65rs7rgn4s2bgippq58fjcxl8fr21pzn718wqf1"; sha256 = "1yfnf47saxxj17x0vyxihr343kp7gz3fashzky79j80sqlm6ng85";
}; };
postPatch = ''
substituteInPlace src/editor.pro \
--replace '/usr/include/rtmidi' '${rtmidi}/include/rtmidi'
'';
nativeBuildInputs = [ qmake ]; nativeBuildInputs = [ qmake ];
buildInputs = [ qtbase qtmultimedia libvorbis ]; buildInputs = [ qtbase qtmultimedia libvorbis rtmidi ];
passthru = {
updateScript = nix-update-script {
attrPath = pname;
};
};
meta = with lib; { meta = with lib; {
description = "Experimental pxtone editor where you can collaborate with friends"; description = "Experimental pxtone editor where you can collaborate with friends";

View File

@ -1,4 +1,12 @@
{ fetchFromGitLab, lib, python3Packages, gobject-introspection, gtk3, pango, wrapGAppsHook { fetchFromGitLab
, fetchpatch
, lib
, python3Packages
, gobject-introspection
, gtk3
, pango
, wrapGAppsHook
, xvfb_run
, chromecastSupport ? false , chromecastSupport ? false
, serverSupport ? false , serverSupport ? false
, keyringSupport ? true , keyringSupport ? true
@ -8,18 +16,29 @@
python3Packages.buildPythonApplication rec { python3Packages.buildPythonApplication rec {
pname = "sublime-music"; pname = "sublime-music";
version = "0.11.10"; version = "0.11.11";
format = "pyproject";
src = fetchFromGitLab { src = fetchFromGitLab {
owner = "sublime-music"; owner = "sublime-music";
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "1g78gmiywg07kaywfc9q0yab2bzxs936vb3157ni1z0flbmcwrry"; sha256 = "sha256-r4Tn/7CGDny8Aa4kF4PM5ZKMYthMJ7801X3zPdvXh4Q=";
}; };
patches = [
# Switch to poetry-core:
# https://gitlab.com/sublime-music/sublime-music/-/merge_requests/60
(fetchpatch {
name = "use-poetry-core.patch";
url = "https://gitlab.com/sublime-music/sublime-music/-/commit/9b0af19dbdfdcc5a0fa23e73bb34c7135a8c2855.patch";
sha256 = "sha256-cXG0RvrnBpme6yKWM0nfqMqoK0qPT6spflJ9AaaslVg=";
})
];
nativeBuildInputs = [ nativeBuildInputs = [
gobject-introspection gobject-introspection
python3Packages.setuptools python3Packages.poetry-core
wrapGAppsHook wrapGAppsHook
]; ];
@ -53,8 +72,14 @@ python3Packages.buildPythonApplication rec {
# https://github.com/NixOS/nixpkgs/issues/56943 # https://github.com/NixOS/nixpkgs/issues/56943
strictDeps = false; strictDeps = false;
# no tests # Use the test suite provided by the upstream project.
doCheck = false; checkInputs = with python3Packages; [
pytest
pytest-cov
];
checkPhase = "${xvfb_run}/bin/xvfb-run pytest";
# Also run the python import check for sanity
pythonImportsCheck = [ "sublime_music" ]; pythonImportsCheck = [ "sublime_music" ];
postInstall = '' postInstall = ''

View File

@ -55,7 +55,7 @@ python3.pkgs.buildPythonApplication rec {
meta = with lib; { meta = with lib; {
homepage = "https://github.com/whipper-team/whipper"; homepage = "https://github.com/whipper-team/whipper";
description = "A CD ripper aiming for accuracy over speed"; description = "A CD ripper aiming for accuracy over speed";
maintainers = with maintainers; [ rycee emily ]; maintainers = with maintainers; [ emily ];
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
platforms = platforms.linux; platforms = platforms.linux;
}; };

View File

@ -20,7 +20,7 @@ in appimageTools.wrapType2 rec {
${imagemagick}/bin/convert ${appimageContents}/${pname}.png -resize 512x512 ${pname}_512.png ${imagemagick}/bin/convert ${appimageContents}/${pname}.png -resize 512x512 ${pname}_512.png
install -m 444 -D ${pname}_512.png $out/share/icons/hicolor/512x512/apps/${pname}.png install -m 444 -D ${pname}_512.png $out/share/icons/hicolor/512x512/apps/${pname}.png
substituteInPlace $out/share/applications/${pname}.desktop \ substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun --no-sandbox %U' "Exec=$out/bin/${pname}" --replace 'Exec=AppRun --no-sandbox %U' 'Exec=${pname} %U'
''; '';
meta = with lib; { meta = with lib; {

View File

@ -12,16 +12,16 @@
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "openethereum"; pname = "openethereum";
version = "3.2.3"; version = "3.2.4";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "openethereum"; owner = "openethereum";
repo = "openethereum"; repo = "openethereum";
rev = "v${version}"; rev = "v${version}";
sha256 = "1j7wfgpnvf9pcprd53sbd3pa7yz9588z81i1bx12wmj1fja3xa0j"; sha256 = "143w0b0ff1s73qzr844l25w90d2y2z0b3w2fr5kkbc1wsnpcq7jp";
}; };
cargoSha256 = "0ha18caw8mxzrh984y2z148cmdijrjxf0rc8j4ccwvmrbdsaz1xn"; cargoSha256 = "1gm02pcfll362add8a0dcb0sk0mag8z0q23b87yb6fs870bqvhib";
LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -35,7 +35,8 @@ appimageTools.wrapType2 rec {
install -m 444 -D ${appimageContents}/${pname}.desktop $out/share/applications/${pname}.desktop install -m 444 -D ${appimageContents}/${pname}.desktop $out/share/applications/${pname}.desktop
install -m 444 -D ${appimageContents}/${pname}.png $out/share/icons/hicolor/512x512/apps/${pname}.png install -m 444 -D ${appimageContents}/${pname}.png $out/share/icons/hicolor/512x512/apps/${pname}.png
install -m 444 -D ${appimageContents}/resources/images/icons/512x512.png $out/share/icons/hicolor/512x512/apps/${pname}.png install -m 444 -D ${appimageContents}/resources/images/icons/512x512.png $out/share/icons/hicolor/512x512/apps/${pname}.png
substituteInPlace $out/share/applications/trezor-suite.desktop --replace 'Exec=AppRun' 'Exec=${pname}' substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
# symlink system binaries instead bundled ones # symlink system binaries instead bundled ones
mkdir -p $out/share/${pname}/resources/bin/{bridge,tor} mkdir -p $out/share/${pname}/resources/bin/{bridge,tor}

View File

@ -110,7 +110,6 @@ rec {
description = "Provides fast jumps to text based on initial letter"; description = "Provides fast jumps to text based on initial letter";
license = licenses.mit; license = licenses.mit;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -133,7 +132,6 @@ rec {
description = "Adds support for ANSI escape sequences in the Eclipse console"; description = "Adds support for ANSI escape sequences in the Eclipse console";
license = licenses.asl20; license = licenses.asl20;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -156,7 +154,6 @@ rec {
homepage = "https://www.antlr.org/"; homepage = "https://www.antlr.org/";
license = licenses.bsd3; license = licenses.bsd3;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -179,7 +176,6 @@ rec {
homepage = "https://www.antlr.org/"; homepage = "https://www.antlr.org/";
license = licenses.bsd3; license = licenses.bsd3;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -202,7 +198,6 @@ rec {
description = "Adds new tools to the context menu of text-based editors"; description = "Adds new tools to the context menu of text-based editors";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -225,7 +220,6 @@ rec {
description = "Show file encoding and line ending for the active editor in the eclipse status bar"; description = "Show file encoding and line ending for the active editor in the eclipse status bar";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -248,7 +242,6 @@ rec {
description = "Shows disassembled bytecode of current java editor or class file"; description = "Shows disassembled bytecode of current java editor or class file";
license = licenses.bsd2; license = licenses.bsd2;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -287,7 +280,6 @@ rec {
description = "Checkstyle integration into the Eclipse IDE"; description = "Checkstyle integration into the Eclipse IDE";
license = licenses.lgpl21; license = licenses.lgpl21;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -311,7 +303,6 @@ rec {
description = "Plugin to switch color themes conveniently and without side effects"; description = "Plugin to switch color themes conveniently and without side effects";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -386,7 +377,6 @@ rec {
description = "EclEmma is a free Java code coverage tool for Eclipse"; description = "EclEmma is a free Java code coverage tool for Eclipse";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -409,7 +399,6 @@ rec {
description = "Plugin that uses static analysis to look for bugs in Java code"; description = "Plugin that uses static analysis to look for bugs in Java code";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -482,7 +471,6 @@ rec {
homepage = "https://github.com/boothen/Json-Eclipse-Plugin"; homepage = "https://github.com/boothen/Json-Eclipse-Plugin";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -501,7 +489,6 @@ rec {
description = "Eclipse Java development tools"; description = "Eclipse Java development tools";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -524,7 +511,6 @@ rec {
description = "Provides JDT Java CodeMining"; description = "Provides JDT Java CodeMining";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -567,7 +553,6 @@ rec {
description = "The Scala IDE for Eclipse"; description = "The Scala IDE for Eclipse";
license = licenses.bsd3; license = licenses.bsd3;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -586,7 +571,6 @@ rec {
description = "Plugin that uses static analysis to look for bugs in Java code"; description = "Plugin that uses static analysis to look for bugs in Java code";
license = licenses.lgpl21; license = licenses.lgpl21;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -609,7 +593,6 @@ rec {
description = "Eclipse plugin for the TestNG testing framework"; description = "Eclipse plugin for the TestNG testing framework";
license = licenses.asl20; license = licenses.asl20;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };
@ -654,7 +637,6 @@ rec {
description = "A YAML editor plugin for Eclipse"; description = "A YAML editor plugin for Eclipse";
license = licenses.epl10; license = licenses.epl10;
platforms = platforms.all; platforms = platforms.all;
maintainers = [ maintainers.rycee ];
}; };
}; };

View File

@ -1,23 +1,25 @@
{ lib, mkDerivation, pkg-config, qmake, qttools, qtbase, qtsvg, qtx11extras, fetchFromGitHub }: { lib, mkDerivation, cmake, hunspell, pkg-config, qttools, qtbase, qtsvg, qtx11extras
, fetchFromGitHub }:
mkDerivation rec { mkDerivation rec {
pname = "featherpad"; pname = "featherpad";
version = "0.10.0"; version = "0.18.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "tsujan"; owner = "tsujan";
repo = "FeatherPad"; repo = "FeatherPad";
rev = "V${version}"; rev = "V${version}";
sha256 = "1wrbs6kni9s3x39cckm9kzpglryxn5vyarilvh9pafbzpc6rc57p"; sha256 = "0av96yx9ir1ap5adn2cvr6n5y7qjrspk73and21m65dmpwlfdiqb";
}; };
nativeBuildInputs = [ qmake pkg-config qttools ]; nativeBuildInputs = [ cmake pkg-config qttools ];
buildInputs = [ qtbase qtsvg qtx11extras ]; buildInputs = [ hunspell qtbase qtsvg qtx11extras ];
meta = with lib; { meta = with lib; {
description = "Lightweight Qt5 Plain-Text Editor for Linux"; description = "Lightweight Qt5 Plain-Text Editor for Linux";
homepage = "https://github.com/tsujan/FeatherPad"; homepage = "https://github.com/tsujan/FeatherPad";
platforms = platforms.linux; platforms = platforms.linux;
maintainers = [ maintainers.flosse ]; maintainers = [ maintainers.flosse ];
license = licenses.gpl3; license = licenses.gpl3Plus;
}; };
} }

View File

@ -1,6 +1,9 @@
{ lib, stdenv, callPackage, fetchurl { lib, stdenv, callPackage, fetchurl
, jdk, cmake, libxml2, zlib, python3, ncurses5 , jdk, cmake, libxml2, zlib, python3, ncurses5
, dotnet-sdk_3 , dotnet-sdk_3
, autoPatchelfHook
, glib
, libdbusmenu
, vmopts ? null , vmopts ? null
}: }:
@ -25,6 +28,15 @@ let
platforms = platforms.linux; platforms = platforms.linux;
}; };
}).overrideAttrs (attrs: { }).overrideAttrs (attrs: {
nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ optionals (stdenv.isLinux) [
autoPatchelfHook
];
buildInputs = (attrs.buildInputs or []) ++ optionals (stdenv.isLinux) [
python3
stdenv.cc.cc
libdbusmenu
];
dontAutoPatchelf = true;
postFixup = (attrs.postFixup or "") + optionalString (stdenv.isLinux) '' postFixup = (attrs.postFixup or "") + optionalString (stdenv.isLinux) ''
( (
cd $out/clion-${version} cd $out/clion-${version}
@ -32,45 +44,7 @@ let
rm -rf bin/cmake/linux rm -rf bin/cmake/linux
ln -s ${cmake} bin/cmake/linux ln -s ${cmake} bin/cmake/linux
lldbLibPath=$out/clion-${version}/bin/lldb/linux/lib autoPatchelf $PWD/bin
interp="$(cat $NIX_CC/nix-support/dynamic-linker)"
ln -s ${ncurses5.out}/lib/libtinfo.so.5 $lldbLibPath/libtinfo.so.5
patchelf --set-interpreter $interp \
--set-rpath "${lib.makeLibraryPath [ libxml2 zlib stdenv.cc.cc.lib ]}:$lldbLibPath" \
bin/lldb/linux/bin/lldb-server
for i in LLDBFrontend lldb lldb-argdumper; do
patchelf --set-interpreter $interp \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$lldbLibPath" \
"bin/lldb/linux/bin/$i"
done
patchelf \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$lldbLibPath" \
bin/lldb/linux/lib/python3.*/lib-dynload/zlib.cpython-*-x86_64-linux-gnu.so
patchelf \
--set-rpath "${lib.makeLibraryPath [ libxml2 zlib stdenv.cc.cc.lib python3 ]}:$lldbLibPath" \
bin/lldb/linux/lib/liblldb.so
gdbLibPath=$out/clion-${version}/bin/gdb/linux/lib
patchelf \
--set-rpath "$gdbLibPath" \
bin/gdb/linux/lib/python3.*/lib-dynload/zlib.cpython-*-x86_64-linux-gnu.so
patchelf --set-interpreter $interp \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}:$gdbLibPath" \
bin/gdb/linux/bin/gdb
patchelf --set-interpreter $interp \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$gdbLibPath" \
bin/gdb/linux/bin/gdbserver
patchelf --set-interpreter $interp \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \
bin/clang/linux/clangd
patchelf --set-interpreter $interp \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \
bin/clang/linux/clang-tidy
wrapProgram $out/bin/clion \ wrapProgram $out/bin/clion \
--set CL_JDK "${jdk}" --set CL_JDK "${jdk}"

View File

@ -17,12 +17,12 @@ let
auto-pairs-kak = buildKakounePluginFrom2Nix { auto-pairs-kak = buildKakounePluginFrom2Nix {
pname = "auto-pairs-kak"; pname = "auto-pairs-kak";
version = "2020-10-04"; version = "2021-03-28";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "alexherbo2"; owner = "alexherbo2";
repo = "auto-pairs.kak"; repo = "auto-pairs.kak";
rev = "fd735ec149ef0d9ca5f628a95b1e52858b5afbdc"; rev = "526779a26a5cf5f48e7c4f5c5fecca274968a737";
sha256 = "07795kv9njlnp6mckwv141ny2ns6wyf5r0dfjaxh9ngd105zgif1"; sha256 = "0gkhvwxyh8pdfydrj7zkfidk0drrbhvdi1fq3pkzllna3vz8q181";
}; };
meta.homepage = "https://github.com/alexherbo2/auto-pairs.kak/"; meta.homepage = "https://github.com/alexherbo2/auto-pairs.kak/";
}; };
@ -41,16 +41,28 @@ let
fzf-kak = buildKakounePluginFrom2Nix { fzf-kak = buildKakounePluginFrom2Nix {
pname = "fzf-kak"; pname = "fzf-kak";
version = "2021-03-15"; version = "2021-04-03";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "andreyorst"; owner = "andreyorst";
repo = "fzf.kak"; repo = "fzf.kak";
rev = "4e6c9a857511fccdbbc835a1c9acb205b6486a4c"; rev = "1b3a3beebbe7134e671fde2ef2f4242b34ae2c60";
sha256 = "0syhhdlsm7vg6hcd2n2acag9g562z49rbb5smh5p2gnplhmp93i0"; sha256 = "0rsd65zcizbq3isy8576gqw7mcml5ixw84padaz6ndwfif5fv701";
}; };
meta.homepage = "https://github.com/andreyorst/fzf.kak/"; meta.homepage = "https://github.com/andreyorst/fzf.kak/";
}; };
kakboard = buildKakounePluginFrom2Nix {
pname = "kakboard";
version = "2020-05-09";
src = fetchFromGitHub {
owner = "lePerdu";
repo = "kakboard";
rev = "2f13f5cd99591b76ad5cba230815b80138825120";
sha256 = "1kvnbsv20y09rlnyar87qr0h26i16qsq801krswvxcwhid7ijlvd";
};
meta.homepage = "https://github.com/lePerdu/kakboard/";
};
kakoune-buffer-switcher = buildKakounePluginFrom2Nix { kakoune-buffer-switcher = buildKakounePluginFrom2Nix {
pname = "kakoune-buffer-switcher"; pname = "kakoune-buffer-switcher";
version = "2020-12-27"; version = "2020-12-27";
@ -65,12 +77,12 @@ let
kakoune-buffers = buildKakounePluginFrom2Nix { kakoune-buffers = buildKakounePluginFrom2Nix {
pname = "kakoune-buffers"; pname = "kakoune-buffers";
version = "2020-06-11"; version = "2021-04-02";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "Delapouite"; owner = "Delapouite";
repo = "kakoune-buffers"; repo = "kakoune-buffers";
rev = "67959fbad727ba8470fe8cd6361169560f4fb532"; rev = "7832ea7a4528363482f5684f16cbcebcbec0adfd";
sha256 = "09prhzz4yzf6ryw0npd1gpcfp77681vgawpp1ilfvbf25xgbbz33"; sha256 = "196d36jww6asf5zr03l1rwg49kkv16s2d4zyryb2m3zvy7prf2bb";
}; };
meta.homepage = "https://github.com/Delapouite/kakoune-buffers/"; meta.homepage = "https://github.com/Delapouite/kakoune-buffers/";
}; };
@ -147,14 +159,26 @@ let
meta.homepage = "https://github.com/mayjs/openscad.kak/"; meta.homepage = "https://github.com/mayjs/openscad.kak/";
}; };
pandoc-kak = buildKakounePluginFrom2Nix {
pname = "pandoc-kak";
version = "2020-11-30";
src = fetchFromGitHub {
owner = "basbebe";
repo = "pandoc.kak";
rev = "63979f7e08b86d80436bbe2d9dba173a56057b97";
sha256 = "16pmmnpyxf8r7gpj8g1lwa960nscjmcl52n1a7s6xcqkp9856wxs";
};
meta.homepage = "https://github.com/basbebe/pandoc.kak/";
};
powerline-kak = buildKakounePluginFrom2Nix { powerline-kak = buildKakounePluginFrom2Nix {
pname = "powerline-kak"; pname = "powerline-kak";
version = "2021-02-25"; version = "2021-04-06";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "andreyorst"; owner = "andreyorst";
repo = "powerline.kak"; repo = "powerline.kak";
rev = "64ad98b6c85e63345563671b043960464d51c4b0"; rev = "6fa5ad383f2884f201d6e3ef07a4687c606df525";
sha256 = "09w2sk19qi64hgsyg4gb407vyppnlgk272mqbinz2r3apy6szkl3"; sha256 = "1s7ggjby0bymq48njzhdvkkarmzl44803xv0dlnzrj7q9c3xv27a";
}; };
meta.homepage = "https://github.com/andreyorst/powerline.kak/"; meta.homepage = "https://github.com/andreyorst/powerline.kak/";
}; };
@ -197,12 +221,12 @@ let
tabs-kak = buildKakounePluginFrom2Nix { tabs-kak = buildKakounePluginFrom2Nix {
pname = "tabs-kak"; pname = "tabs-kak";
version = "2021-02-16"; version = "2021-04-14";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "enricozb"; owner = "enricozb";
repo = "tabs.kak"; repo = "tabs.kak";
rev = "1aaa8cd89e404cbbd76d44ff8089de0951612fbf"; rev = "048f83455ea7c671ab06e9b9578ac25e5de1d6fb";
sha256 = "0dfz6j6yxl65jbh4xvpiy2abr2sdjyalynzhl28y7l1gzqv4ni3j"; sha256 = "0xswpsdf1bj54inl6vf2lzbjkxfc6g0fyv5kd6y9ahlh5irij8z0";
}; };
meta.homepage = "https://github.com/enricozb/tabs.kak/"; meta.homepage = "https://github.com/enricozb/tabs.kak/";
}; };

View File

@ -3,6 +3,7 @@ alexherbo2/replace-mode.kak
alexherbo2/sleuth.kak alexherbo2/sleuth.kak
andreyorst/fzf.kak andreyorst/fzf.kak
andreyorst/powerline.kak andreyorst/powerline.kak
basbebe/pandoc.kak
danr/kakoune-easymotion danr/kakoune-easymotion
Delapouite/kakoune-buffers Delapouite/kakoune-buffers
Delapouite/kakoune-registers Delapouite/kakoune-registers
@ -11,6 +12,7 @@ greenfork/active-window.kak
kakoune-editor/kakoune-extra-filetypes kakoune-editor/kakoune-extra-filetypes
kakounedotcom/connect.kak kakounedotcom/connect.kak
kakounedotcom/prelude.kak kakounedotcom/prelude.kak
lePerdu/kakboard
listentolist/kakoune-rainbow listentolist/kakoune-rainbow
mayjs/openscad.kak mayjs/openscad.kak
occivink/kakoune-buffer-switcher occivink/kakoune-buffer-switcher

View File

@ -1,5 +1,4 @@
{ stdenv, symlinkJoin, lib, makeWrapper { stdenv, symlinkJoin, lib, makeWrapper
, vimUtils
, writeText , writeText
, bundlerEnv, ruby , bundlerEnv, ruby
, nodejs , nodejs

View File

@ -36,7 +36,8 @@ stdenv.mkDerivation {
makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \ makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \
--prefix PATH : ${lib.makeBinPath [ jdk which ]} \ --prefix PATH : ${lib.makeBinPath [ jdk which ]} \
--prefix JAVA_HOME : ${jdk.home} \ --prefix JAVA_HOME : ${jdk.home} \
--add-flags "--jdkhome ${jdk.home}" --add-flags "--jdkhome ${jdk.home} \
-J-Dawt.useSystemAAFontSettings=on -J-Dswing.aatext=true"
# Extract pngs from the Apple icon image and create # Extract pngs from the Apple icon image and create
# the missing ones from the 1024x1024 image. # the missing ones from the 1024x1024 image.

View File

@ -19,11 +19,11 @@ let
isCross = stdenv.hostPlatform != stdenv.buildPlatform; isCross = stdenv.hostPlatform != stdenv.buildPlatform;
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "poke"; pname = "poke";
version = "1.1"; version = "1.2";
src = fetchurl { src = fetchurl {
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
hash = "sha256-zWjfY8dBtBYLEsvqAvJ8RxWCeUZuNEOTDSU1pFLAatY="; hash = "sha256-9hz42ltkwBoTWTc3JarRyiV/NcHJJp5NUN0GZBg932I=";
}; };
postPatch = '' postPatch = ''

View File

@ -16,7 +16,7 @@
let let
pname = "TeXmacs"; pname = "TeXmacs";
version = "1.99.18"; version = "1.99.19";
common = callPackage ./common.nix { common = callPackage ./common.nix {
inherit tex extraFonts chineseFonts japaneseFonts koreanFonts; inherit tex extraFonts chineseFonts japaneseFonts koreanFonts;
}; };
@ -26,7 +26,7 @@ mkDerivation {
src = fetchurl { src = fetchurl {
url = "https://www.texmacs.org/Download/ftp/tmftp/source/TeXmacs-${version}-src.tar.gz"; url = "https://www.texmacs.org/Download/ftp/tmftp/source/TeXmacs-${version}-src.tar.gz";
sha256 = "0il3fwgw20421aj90wg8kyhkwk6lbgb3bb2g5qamh5lk90yj725i"; sha256 = "1izwqb0z4gqiglv57mjswk6sjivny73kd2sxrf3nmj7wr12pn5m8";
}; };
nativeBuildInputs = [ cmake pkg-config ]; nativeBuildInputs = [ cmake pkg-config ];

View File

@ -24,7 +24,7 @@ let
six six
]; ];
in mkDerivation rec { in mkDerivation rec {
version = "3.16.5"; version = "3.16.6";
pname = "qgis"; pname = "qgis";
name = "${pname}-unwrapped-${version}"; name = "${pname}-unwrapped-${version}";
@ -32,7 +32,7 @@ in mkDerivation rec {
owner = "qgis"; owner = "qgis";
repo = "QGIS"; repo = "QGIS";
rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}"; rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}";
sha256 = "1xkvgj1v2jgp107jyh9xmk1dzbbqxwkqy69z56vsaa8lf9gwgn5h"; sha256 = "1vnz5kiyjircmhn4vq3fa5j2kvkxpwcsry7jc6nxl0w0dqx1zay1";
}; };
passthru = { passthru = {

View File

@ -0,0 +1,74 @@
{ stdenv
, lib
, fetchFromGitHub
, nix-update-script
, cmake
, pkg-config
, makeWrapper
, zlib
, libX11
, libXrandr
, libXinerama
, libXcursor
, libXi
, libXext
, libGLU
, alsaLib
, fontconfig
, AVFoundation
, Carbon
, Cocoa
, CoreAudio
, Kernel
, OpenGL
}:
stdenv.mkDerivation rec {
pname = "foxotron";
version = "2021-03-12";
src = fetchFromGitHub {
owner = "Gargaj";
repo = "Foxotron";
rev = version;
fetchSubmodules = true;
sha256 = "1finvbs3pbfyvm525blwgwl5jci2zjxb1923i0cm8rmf7wasaapb";
};
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
buildInputs = [ zlib ]
++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 libXrandr libXinerama libXcursor libXi libXext alsaLib fontconfig libGLU ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ AVFoundation Carbon Cocoa CoreAudio Kernel OpenGL ];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib/foxotron}
cp -R ${lib.optionalString stdenv.hostPlatform.isDarwin "Foxotron.app/Contents/MacOS/"}Foxotron \
../{config.json,Shaders,Skyboxes} $out/lib/foxotron/
wrapProgram $out/lib/foxotron/Foxotron \
--run "cd $out/lib/foxotron"
ln -s $out/{lib/foxotron,bin}/Foxotron
runHook postInstall
'';
passthru = {
updateScript = nix-update-script {
attrPath = pname;
};
};
meta = with lib; {
description = "General purpose model viewer";
longDescription = ''
ASSIMP based general purpose model viewer ("turntable") created for the
Revision 2021 3D Graphics Competition.
'';
homepage = "https://github.com/Gargaj/Foxotron";
license = licenses.publicDomain;
maintainers = with maintainers; [ OPNA2608 ];
platforms = platforms.all;
};
}

View File

@ -1,44 +0,0 @@
{ lib
, fetchurl
, appimageTools
, symlinkJoin
}:
let
pname = "runwayml";
version = "0.14.3";
name = "${pname}-${version}";
src = fetchurl {
url = "https://runway-releases.s3.amazonaws.com/Runway-${version}.AppImage";
sha256 = "1bx8j39wd2z6f32hdvmk9z77bivnizzdhn296kin2nnqgq6v6y93";
};
binary = appimageTools.wrapType2 {
name = pname;
inherit src;
};
# we only use this to extract the icon and desktop file
appimage-contents = appimageTools.extractType2 {
inherit name src;
};
in
symlinkJoin {
inherit name;
paths = [ binary ];
postBuild = ''
mkdir -p $out/share/pixmaps/ $out/share/applications
cp ${appimage-contents}/usr/share/icons/hicolor/1024x1024/apps/runway.png $out/share/pixmaps/runway.png
sed 's:Exec=AppRun:Exec=runwayml:' ${appimage-contents}/runway.desktop > $out/share/applications/runway.desktop
'';
meta = with lib; {
description = "Machine learning for creators";
homepage = "https://runwayml.com/";
license = licenses.unfree;
maintainers = with maintainers; [ prusnak ];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -11,16 +11,15 @@ let
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "brscan4"; pname = "brscan4";
version = "0.4.9-1"; version = "0.4.10-1";
src = { src = {
"i686-linux" = fetchurl { "i686-linux" = fetchurl {
url = "http://download.brother.com/welcome/dlf006646/${pname}-${version}.i386.deb"; url = "http://download.brother.com/welcome/dlf006646/${pname}-${version}.i386.deb";
sha256 = "0pkg9aqvnkpjnb9cgzf7lxw2g4jqrf2w98irkv22r0gfsfs3nwma"; sha256 = "sha256-ymIAg+rfSYP5uzsAM1hUYZacJ0PXmKEoljNtb0pgGMw=";
}; };
"x86_64-linux" = fetchurl { "x86_64-linux" = fetchurl {
url = "https://download.brother.com/welcome/dlf006645/${pname}-${version}.amd64.deb"; url = "https://download.brother.com/welcome/dlf006645/${pname}-${version}.amd64.deb";
sha256 = "0kakkl8rmsi2yr3f8vd1kk8vsl9g2ijhqil1cvvbwrhwgi0b7ai7"; sha256 = "sha256-Gpr5456MCNpyam3g2qPo7S3aEZFMaUGR8bu7YmRY8xk=";
}; };
}."${stdenv.hostPlatform.system}"; }."${stdenv.hostPlatform.system}";
@ -33,7 +32,7 @@ stdenv.mkDerivation rec {
buildInputs = [ libusb-compat-0_1 ]; buildInputs = [ libusb-compat-0_1 ];
dontBuild = true; dontBuild = true;
patchPhase = '' postPatch = ''
${myPatchElf "opt/brother/scanner/brscan4/brsaneconfig4"} ${myPatchElf "opt/brother/scanner/brscan4/brsaneconfig4"}
RPATH=${libusb-compat-0_1.out}/lib RPATH=${libusb-compat-0_1.out}/lib
@ -45,6 +44,7 @@ stdenv.mkDerivation rec {
''; '';
installPhase = with lib; '' installPhase = with lib; ''
runHook preInstall
PATH_TO_BRSCAN4="opt/brother/scanner/brscan4" PATH_TO_BRSCAN4="opt/brother/scanner/brscan4"
mkdir -p $out/$PATH_TO_BRSCAN4 mkdir -p $out/$PATH_TO_BRSCAN4
cp -rp $PATH_TO_BRSCAN4/* $out/$PATH_TO_BRSCAN4 cp -rp $PATH_TO_BRSCAN4/* $out/$PATH_TO_BRSCAN4
@ -79,6 +79,7 @@ stdenv.mkDerivation rec {
mkdir -p $out/etc/udev/rules.d mkdir -p $out/etc/udev/rules.d
cp -p ${udevRules}/etc/udev/rules.d/*.rules \ cp -p ${udevRules}/etc/udev/rules.d/*.rules \
$out/etc/udev/rules.d $out/etc/udev/rules.d
runHook postInstall
''; '';
dontStrip = true; dontStrip = true;

View File

@ -26,11 +26,11 @@
mkDerivation rec { mkDerivation rec {
pname = "calibre"; pname = "calibre";
version = "5.13.0"; version = "5.16.1";
src = fetchurl { src = fetchurl {
url = "https://download.calibre-ebook.com/${version}/${pname}-${version}.tar.xz"; url = "https://download.calibre-ebook.com/${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-GDFAZxZmkio7e7kVjhYqhNdhXIlUPJF0iMWVl0uWVCM="; hash = "sha256-lTXCW0MGNOezecaGO9c2JGU4ylwpPmBaMXTY3nLNcrE=";
}; };
patches = [ patches = [
@ -62,8 +62,6 @@ mkDerivation rec {
dontUseQmakeConfigure = true; dontUseQmakeConfigure = true;
enableParallelBuilding = true;
nativeBuildInputs = [ pkg-config qmake removeReferencesTo ]; nativeBuildInputs = [ pkg-config qmake removeReferencesTo ];
buildInputs = [ buildInputs = [

View File

@ -5,13 +5,13 @@
buildGoModule rec { buildGoModule rec {
pname = "dasel"; pname = "dasel";
version = "1.14.0"; version = "1.14.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "TomWright"; owner = "TomWright";
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "1g4a001k86myfln0xlzy8w9krwamvfchnvywpr1p3x6iw95z46w8"; sha256 = "0nxdyd0zg4w1zr8p9z2x88h36vbn7ryk7160zszdiwh5qmdlv47v";
}; };
vendorSha256 = "sha256-BdX4DO77mIf/+aBdkNVFUzClsIml1UMcgvikDbbdgcY="; vendorSha256 = "sha256-BdX4DO77mIf/+aBdkNVFUzClsIml1UMcgvikDbbdgcY=";

View File

@ -2,6 +2,7 @@
, stdenv , stdenv
, copyDesktopItems , copyDesktopItems
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
, makeDesktopItem , makeDesktopItem
, makeWrapper , makeWrapper
, fontconfig , fontconfig
@ -18,18 +19,18 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "dbeaver-ce"; pname = "dbeaver-ce";
version = "21.0.2"; # When updating also update fetchedMavenDeps.sha256 version = "21.0.3"; # When updating also update fetchedMavenDeps.sha256
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "dbeaver"; owner = "dbeaver";
repo = "dbeaver"; repo = "dbeaver";
rev = version; rev = version;
sha256 = "sha256-3EMSiEq1wdg4dxBU90RVVv0Hrf5dXPc1MPI0+WMk48k="; sha256 = "sha256-ItM8t+gqE0ccuuimfEMUddykl+xt2eZIBd3MbpreRwA=";
}; };
fetchedMavenDeps = stdenv.mkDerivation { fetchedMavenDeps = stdenv.mkDerivation {
name = "dbeaver-${version}-maven-deps"; name = "dbeaver-${version}-maven-deps";
inherit src; inherit src patches;
buildInputs = [ buildInputs = [
maven maven
@ -50,9 +51,18 @@ stdenv.mkDerivation rec {
dontFixup = true; dontFixup = true;
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = "sha256-xKlFFQXd2U513KZKQa7ttSFNX2gxVr9hNsvyaoN/rEE="; outputHash = "sha256-rsK/B39ogNu5nC41OfyAsLiwBz4gWyH+8Fj7E6+rOng=";
}; };
patches = [
# Fix eclipse-color-theme URL (https://github.com/dbeaver/dbeaver/pull/12133)
# After April 15, 2021 eclipse-color-theme.github.com no longer redirects to eclipse-color-theme.github.io
(fetchpatch {
url = "https://github.com/dbeaver/dbeaver/commit/65d65e2c2c711cc87fddcec425a6915aa80f4ced.patch";
sha256 = "sha256-pxOcRYkV/5o+tHcRhHDZ1TmZSHMnKBmkNTVAlIf9nUE=";
})
];
nativeBuildInputs = [ nativeBuildInputs = [
copyDesktopItems copyDesktopItems
makeWrapper makeWrapper

View File

@ -0,0 +1,35 @@
{ lib, stdenv, fetchFromGitHub, libX11, patches ? [ ], writeText, conf ? null }:
stdenv.mkDerivation {
pname = "dwmblocks";
version = "unstable-2020-12-27";
src = fetchFromGitHub {
owner = "torrinfail";
repo = "dwmblocks";
rev = "96cbb453e5373c05372fd4bf3faacfa53e409067";
sha256 = "00lxfxsrvhm60zzqlcwdv7xkqzya69mgpi2mr3ivzbc8s9h8nwqx";
};
buildInputs = [ libX11 ];
inherit patches;
postPatch =
let
configFile =
if lib.isDerivation conf || builtins.isPath conf
then conf else writeText "blocks.def.h" conf;
in
lib.optionalString (conf != null) "cp ${configFile} blocks.def.h";
makeFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
description = "Modular status bar for dwm written in c";
homepage = "https://github.com/torrinfail/dwmblocks";
license = licenses.isc;
maintainers = with maintainers; [ sophrosyne ];
platforms = platforms.all;
};
}

View File

@ -0,0 +1,59 @@
{ lib
, stdenv
, fetchurl
, guile
, guile-commonmark
, guile-reader
, makeWrapper
, pkg-config
}:
stdenv.mkDerivation rec {
pname = "haunt";
version = "0.2.4";
src = fetchurl {
url = "https://files.dthompson.us/${pname}/${pname}-${version}.tar.gz";
hash = "sha256-zOkICg7KmJJhPWPtJRT3C9sYB1Oig1xLtgPNGe0n3xQ=";
};
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = [
guile
guile-commonmark
guile-reader
];
postInstall = ''
wrapProgram $out/bin/haunt \
--prefix GUILE_LOAD_PATH : "$out/share/guile/site:${guile-commonmark}/share/guile/site:${guile-reader}/share/guile/site" \
--prefix GUILE_LOAD_COMPILED_PATH : "$out/share/guile/site:${guile-commonmark}/share/guile/site:${guile-reader}/share/guile/site"
'';
meta = with lib; {
homepage = "https://dthompson.us/projects/haunt.html";
description = "Guile-based static site generator";
longDescription = ''
Haunt is a simple, functional, hackable static site generator that gives
authors the ability to treat websites as Scheme programs.
By giving authors the full expressive power of Scheme, they are able to
control every aspect of the site generation process. Haunt provides a
simple, functional build system that can be easily extended for this
purpose.
Haunt has no opinion about what markup language authors should use to
write posts, though it comes with support for the popular Markdown
format. Likewise, Haunt has no opinion about how authors structure their
sites. Though it comes with support for building simple blogs or Atom
feeds, authors should feel empowered to tweak, replace, or create builders
to do things that aren't provided out-of-the-box.
'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ AndersonTorres ];
platforms = guile.meta.platforms;
};
}

View File

@ -2,13 +2,13 @@
buildGoModule rec { buildGoModule rec {
pname = "hugo"; pname = "hugo";
version = "0.82.0"; version = "0.82.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "gohugoio"; owner = "gohugoio";
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-D0bwy8LJihlfM+E3oys85yjadjZNfPv5xnq4ekaZPCU="; sha256 = "sha256-6poWFcApwCos3XvS/Wq1VJyf5xTUWtqWNFXIhjNsXVs=";
}; };
vendorSha256 = "sha256-pJBm+yyy1DbH28oVBQA+PHSDtSg3RcgbRlurrwnnEls="; vendorSha256 = "sha256-pJBm+yyy1DbH28oVBQA+PHSDtSg3RcgbRlurrwnnEls=";

View File

@ -0,0 +1,91 @@
{ lib
, fetchFromGitHub
, python3Packages
, makeWrapper
, pcre
, sqlite
, nodejs
}:
python3Packages.buildPythonApplication rec {
pname = "jiten";
version = "1.0.0";
src = fetchFromGitHub {
owner = "obfusk";
repo = "jiten";
rev = "v${version}";
sha256 = "1lg1n7f4383jdlkbma0q65yl6l159wgh886admcq7l7ap26zpqd2";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ pcre sqlite ];
propagatedBuildInputs = with python3Packages; [ click flask ];
checkInputs = [ nodejs ];
preBuild = ''
export JITEN_VERSION=${version} # override `git describe`
export JITEN_FINAL=yes # build & package *.sqlite3
'';
postPatch = ''
substituteInPlace Makefile --replace /bin/bash "$(command -v bash)"
substituteInPlace jiten/res/jmdict/Makefile --replace /bin/bash "$(command -v bash)"
'';
checkPhase = "make test";
postInstall = ''
# requires pywebview
rm $out/bin/jiten-gui
'';
meta = with lib; {
description = "Japanese android/cli/web dictionary based on jmdict/kanjidic";
longDescription = ''
Jiten is a Japanese dictionary based on JMDict/Kanjidic
Fine-grained search using regexes (regular expressions)
simple searches don't require knowledge of regexes
quick reference available in the web interface and android app
JMDict multilingual japanese dictionary
kanji, readings (romaji optional), meanings & more
meanings in english, dutch, german, french and/or spanish
pitch accent (from Wadoku)
browse by frequency/jlpt
Kanji dictionary
readings (romaji optional), meanings (english), jmdict entries, radicals & more
search using SKIP codes
search by radical
browse by frequency/level/jlpt
Example sentences (from Tatoeba)
with english, dutch, german, french and/or spanish translation
some with audio
Stroke order
input a word or sentence and see how it's written
Web interface
available online at https://jiten.obfusk.dev
light/dark mode
search history (stored locally)
tooltips to quickly see meanings and readings for kanji and words
use long press for tooltips on mobile
converts romaji to hiragana and between hiragana and katakana
can be run on your own computer
Command-line interface
'';
homepage = "https://github.com/obfusk/jiten";
license = with licenses; [
agpl3Plus # code
cc-by-sa-30 # jmdict/kanjidic
unfreeRedistributable # pitch data from wadoku is non-commercial :(
];
maintainers = [ maintainers.obfusk ];
platforms = platforms.unix;
};
}

Some files were not shown because too many files have changed in this diff Show More