mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-06 13:23:41 +00:00
Compare commits
7 Commits
17.09-beta
...
black@2016
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bde2351723 | ||
|
|
9e18b81ded | ||
|
|
78e9bc731b | ||
|
|
d2fd6c1621 | ||
|
|
dfa9df316b | ||
|
|
c9f9147bed | ||
|
|
6d9296c3c7 |
@@ -1,28 +0,0 @@
|
||||
# EditorConfig configuration for nixpkgs
|
||||
# http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file, utf-8 charset
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
# see https://nixos.org/nixpkgs/manual/#chap-conventions
|
||||
|
||||
# Match nix/ruby files, set indent to spaces with width of two
|
||||
[*.{nix,rb}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Match shell/python/perl scripts, set indent to spaces with width of four
|
||||
[*.{sh,py,pl}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Match diffs, avoid to trim trailing whitespace
|
||||
[*.{diff,patch}]
|
||||
trim_trailing_whitespace = false
|
||||
23
.github/CODEOWNERS
vendored
23
.github/CODEOWNERS
vendored
@@ -1,23 +0,0 @@
|
||||
# CODEOWNERS file
|
||||
#
|
||||
# This file is used to describe who owns what in this repository. This file does not
|
||||
# replace `meta.maintainers` but is instead used for other things than derivations
|
||||
# and modules, like documentation, package sets, and other assets.
|
||||
#
|
||||
# For documentation on this file, see https://help.github.com/articles/about-codeowners/
|
||||
# Mentioned users will get code review requests.
|
||||
|
||||
# Python-related code and docs
|
||||
pkgs/top-level/python-packages.nix @FRidh
|
||||
pkgs/development/interpreters/python/* @FRidh
|
||||
pkgs/development/python-modules/* @FRidh
|
||||
doc/languages-frameworks/python.md @FRidh
|
||||
|
||||
# Boostraping and core infra
|
||||
pkgs/stdenv/ @Ericson2314
|
||||
pkgs/build-support/cc-wrapper/ @Ericson2314
|
||||
|
||||
# Darwin-related
|
||||
pkgs/stdenv/darwin/* @copumpkin @LnL7
|
||||
pkgs/os-specific/darwin/* @LnL7
|
||||
pkgs/os-specific/darwin/apple-source-releases/* @copumpkin
|
||||
25
.github/CONTRIBUTING.md
vendored
25
.github/CONTRIBUTING.md
vendored
@@ -14,36 +14,19 @@ under the terms of [COPYING](../COPYING), which is an MIT-like license.
|
||||
|
||||
* Format the commits in the following way:
|
||||
|
||||
```
|
||||
(pkg-name | nixos/<module>): (from -> to | init at version | refactor | etc)
|
||||
|
||||
(Motivation for change. Additional information.)
|
||||
```
|
||||
`(pkg-name | service-name): (from -> to | init at version | refactor | etc)`
|
||||
|
||||
Examples:
|
||||
|
||||
* nginx: init at 2.0.1
|
||||
* firefox: 3.0 -> 3.1.1
|
||||
* nixos/hydra: add bazBaz option
|
||||
|
||||
Dual baz behavior is needed to do foo.
|
||||
* nixos/nginx: refactor config generation
|
||||
|
||||
The old config generation system used impure shell scripts and could break in specific circumstances (see #1234).
|
||||
* hydra service: add bazBaz option
|
||||
* nginx service: refactor config generation
|
||||
|
||||
* `meta.description` should:
|
||||
* Be capitalized
|
||||
* Not start with the package name
|
||||
* Not have a dot at the end
|
||||
|
||||
See the nixpkgs manual for more details on how to [Submit changes to nixpkgs](https://nixos.org/nixpkgs/manual/#chap-submitting-changes).
|
||||
See the nixpkgs manual for more details on how to [Submit changes to nixpkgs](http://hydra.nixos.org/job/nixpkgs/trunk/manual/latest/download-by-type/doc/manual#chap-submitting-changes).
|
||||
|
||||
## Writing good commit messages
|
||||
|
||||
In addition to writing properly formatted commit messages, it's important to include relevant information so other developers can later understand *why* a change was made. While this information usually can be found by digging code, mailing list archives, pull request discussions or upstream changes, it may require a lot of work.
|
||||
|
||||
For package version upgrades and such a one-line commit message is usually sufficient.
|
||||
|
||||
## Reviewing contributions
|
||||
|
||||
See the nixpkgs manual for more details on how to [Review contributions](https://nixos.org/nixpkgs/manual/#sec-reviewing-contributions).
|
||||
|
||||
1
.github/ISSUE_TEMPLATE.md
vendored
1
.github/ISSUE_TEMPLATE.md
vendored
@@ -11,4 +11,3 @@
|
||||
* System: (NixOS: `nixos-version`, Ubuntu/Fedora: `lsb_release -a`, ...)
|
||||
* Nix version: (run `nix-env --version`)
|
||||
* Nixpkgs version: (run `nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion`)
|
||||
* Sandboxing enabled: (run `grep build-use-sandbox /etc/nix/nix.conf`)
|
||||
|
||||
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -3,17 +3,14 @@
|
||||
|
||||
###### Things done
|
||||
|
||||
<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->
|
||||
|
||||
- [ ] Tested using sandboxing
|
||||
([nix.useSandbox](http://nixos.org/nixos/manual/options.html#opt-nix.useSandbox) on NixOS,
|
||||
or option `build-use-sandbox` in [`nix.conf`](http://nixos.org/nix/manual/#sec-conf-file)
|
||||
([nix.useChroot](http://nixos.org/nixos/manual/options.html#opt-nix.useChroot) on NixOS,
|
||||
or option `build-use-chroot` in [`nix.conf`](http://nixos.org/nix/manual/#sec-conf-file)
|
||||
on non-NixOS)
|
||||
- Built on platform(s)
|
||||
- [ ] NixOS
|
||||
- [ ] macOS
|
||||
- [ ] OS X
|
||||
- [ ] Linux
|
||||
- [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
|
||||
- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nox --run "nox-review wip"`
|
||||
- [ ] Tested execution of all binary files (usually in `./result/bin/`)
|
||||
- [ ] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).
|
||||
|
||||
6
.mention-bot
Normal file
6
.mention-bot
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"userBlacklist": [
|
||||
"civodul",
|
||||
"jhasse"
|
||||
]
|
||||
}
|
||||
21
.travis.yml
21
.travis.yml
@@ -1,35 +1,22 @@
|
||||
language: nix
|
||||
sudo: true
|
||||
# 'sudo: false' == containers that start fast, but only get 4G ram;
|
||||
# 'sudo: true' == VMs that start slow, but with 8G
|
||||
# ..as per: https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
|
||||
# Nixpkgs PR tests OOM with 4G: https://github.com/NixOS/nixpkgs/issues/24200
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
sudo: required
|
||||
sudo: false
|
||||
script:
|
||||
- ./maintainers/scripts/travis-nox-review-pr.sh nixpkgs-verify nixpkgs-manual nixpkgs-tarball nixpkgs-unstable
|
||||
- ./maintainers/scripts/travis-nox-review-pr.sh nixpkgs-verify nixpkgs-manual nixpkgs-tarball
|
||||
- ./maintainers/scripts/travis-nox-review-pr.sh nixos-options nixos-manual
|
||||
env:
|
||||
- BUILD_TYPE="Test Nixpkgs evaluation & NixOS manual build"
|
||||
- os: linux
|
||||
sudo: required
|
||||
dist: trusty
|
||||
before_script:
|
||||
- sudo mount -o remount,exec,size=2G,mode=755 /run/user
|
||||
script: ./maintainers/scripts/travis-nox-review-pr.sh nox pr
|
||||
env:
|
||||
- BUILD_TYPE="Build affected packages (Linux)"
|
||||
- os: osx
|
||||
osx_image: xcode7.3
|
||||
script: ./maintainers/scripts/travis-nox-review-pr.sh nox pr
|
||||
env:
|
||||
- BUILD_TYPE="Build affected packages (macOS)"
|
||||
git:
|
||||
depth: 1
|
||||
env:
|
||||
global:
|
||||
- GITHUB_TOKEN=5edaaf1017f691ed34e7f80878f8f5fbd071603f
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
2
COPYING
2
COPYING
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2003-2017 Eelco Dolstra and the Nixpkgs/NixOS contributors
|
||||
Copyright (c) 2003-2016 Eelco Dolstra and the Nixpkgs/NixOS contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
12
README.md
12
README.md
@@ -2,6 +2,8 @@
|
||||
|
||||
[](https://travis-ci.org/NixOS/nixpkgs)
|
||||
[](https://www.codetriage.com/nixos/nixpkgs)
|
||||
[](http://www.issuestats.com/github/nixos/nixpkgs)
|
||||
[](http://www.issuestats.com/github/nixos/nixpkgs)
|
||||
|
||||
Nixpkgs is a collection of packages for the [Nix](https://nixos.org/nix/) package
|
||||
manager. It is periodically built and tested by the [hydra](http://hydra.nixos.org/)
|
||||
@@ -13,12 +15,12 @@ build daemon as so-called channels. To get channel information via git, add
|
||||
```
|
||||
|
||||
For stability and maximum binary package support, it is recommended to maintain
|
||||
custom changes on top of one of the channels, e.g. `nixos-17.03` for the latest
|
||||
custom changes on top of one of the channels, e.g. `nixos-16.03` for the latest
|
||||
release and `nixos-unstable` for the latest successful build of master:
|
||||
|
||||
```
|
||||
% git remote update channels
|
||||
% git rebase channels/nixos-17.03
|
||||
% git rebase channels/nixos-16.03
|
||||
```
|
||||
|
||||
For pull-requests, please rebase onto nixpkgs `master`.
|
||||
@@ -32,11 +34,11 @@ For pull-requests, please rebase onto nixpkgs `master`.
|
||||
* [Manual (NixOS)](https://nixos.org/nixos/manual/)
|
||||
* [Nix Wiki](https://nixos.org/wiki/) (deprecated, see milestone ["Move the Wiki!"](https://github.com/NixOS/nixpkgs/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22Move+the+wiki%21%22))
|
||||
* [Continuous package builds for unstable/master](https://hydra.nixos.org/jobset/nixos/trunk-combined)
|
||||
* [Continuous package builds for 17.03 release](https://hydra.nixos.org/jobset/nixos/release-17.03)
|
||||
* [Continuous package builds for 16.03 release](https://hydra.nixos.org/jobset/nixos/release-16.03)
|
||||
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
|
||||
* [Tests for 17.03 release](https://hydra.nixos.org/job/nixos/release-17.03/tested#tabs-constituents)
|
||||
* [Tests for 16.03 release](https://hydra.nixos.org/job/nixos/release-16.03/tested#tabs-constituents)
|
||||
|
||||
Communication:
|
||||
|
||||
* [Mailing list](https://groups.google.com/forum/#!forum/nix-devel)
|
||||
* [Mailing list](http://lists.science.uu.nl/mailman/listinfo/nix-dev)
|
||||
* [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos)
|
||||
|
||||
12
default.nix
12
default.nix
@@ -2,17 +2,7 @@ let requiredVersion = import ./lib/minver.nix; in
|
||||
|
||||
if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
|
||||
|
||||
abort ''
|
||||
|
||||
This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:
|
||||
|
||||
- If you are running NixOS, use `nixos-rebuild' to upgrade your system.
|
||||
|
||||
- If you installed Nix using the install script (https://nixos.org/nix/install),
|
||||
it is safe to upgrade by running it again:
|
||||
|
||||
curl https://nixos.org/nix/install | sh
|
||||
''
|
||||
abort "This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade! See https://nixos.org/wiki/How_to_update_when_Nix_is_too_old_to_evaluate_Nixpkgs"
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ bound to the variable name <varname>e2fsprogs</varname> in
|
||||
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
|
||||
the version part of the name <emphasis>must</emphasis> be the date of that
|
||||
(fetched) commit. The date must 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>
|
||||
@@ -456,7 +456,7 @@ splitting up an existing category.</para>
|
||||
<varlistentry>
|
||||
<term>If it’s a <emphasis>window manager</emphasis>:</term>
|
||||
<listitem>
|
||||
<para><filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>)</para>
|
||||
<para><filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>compiz</filename>, <filename>stumpwm</filename>)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -623,7 +623,7 @@ evaluate correctly.</para>
|
||||
from bad to good:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Bad: Uses <literal>git://</literal> which won't be proxied.
|
||||
<para>Uses <literal>git://</literal> which won't be proxied.
|
||||
<programlisting>
|
||||
src = fetchgit {
|
||||
url = "git://github.com/NixOS/nix.git";
|
||||
@@ -634,7 +634,7 @@ src = fetchgit {
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Better: This is ok, but an archive fetch will still be faster.
|
||||
<para>This is ok, but an archive fetch will still be faster.
|
||||
<programlisting>
|
||||
src = fetchgit {
|
||||
url = "https://github.com/NixOS/nix.git";
|
||||
@@ -645,7 +645,7 @@ src = fetchgit {
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Best: Fetches a snapshot archive and you get the rev you want.
|
||||
<para>Fetches a snapshot archive and you get the rev you want.
|
||||
<programlisting>
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
@@ -661,9 +661,9 @@ src = fetchFromGitHub {
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-patches"><title>Patches</title>
|
||||
<para>Only patches that are unique to <literal>nixpkgs</literal> should be
|
||||
<para>Only patches that are unique to <literal>nixpkgs</literal> should be
|
||||
included in <literal>nixpkgs</literal> source.</para>
|
||||
<para>Patches available online should be retrieved using
|
||||
<para>Patches available online should be retrieved using
|
||||
<literal>fetchpatch</literal>.</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
|
||||
@@ -2,223 +2,85 @@
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-packageconfig">
|
||||
|
||||
<title>Global configuration</title>
|
||||
<title><filename>~/.nixpkgs/config.nix</filename>: global configuration</title>
|
||||
|
||||
<para>Nix comes with certain defaults about what packages can and
|
||||
cannot be installed, based on a package's metadata. By default, Nix
|
||||
will prevent installation if any of the following criteria are
|
||||
true:</para>
|
||||
<para>Nix packages can be configured to allow or deny certain options.</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>The package is thought to be broken, and has had
|
||||
its <literal>meta.broken</literal> set to
|
||||
<literal>true</literal>.</para></listitem>
|
||||
<para>To apply the configuration edit
|
||||
<filename>~/.nixpkgs/config.nix</filename> and set it like
|
||||
|
||||
<listitem><para>The package's <literal>meta.license</literal> is set
|
||||
to a license which is considered to be unfree.</para></listitem>
|
||||
|
||||
<listitem><para>The package has known security vulnerabilities but
|
||||
has not or can not be updated for some reason, and a list of issues
|
||||
has been entered in to the package's
|
||||
<literal>meta.knownVulnerabilities</literal>.</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>Note that all this is checked during evaluation already,
|
||||
and the check includes any package that is evaluated.
|
||||
In particular, all build-time dependencies are checked.
|
||||
<literal>nix-env -qa</literal> will (attempt to) hide any packages
|
||||
that would be refused.
|
||||
</para>
|
||||
|
||||
<para>Each of these criteria can be altered in the nixpkgs
|
||||
configuration.</para>
|
||||
|
||||
<para>The nixpkgs configuration for a NixOS system is set in the
|
||||
<literal>configuration.nix</literal>, as in the following example:
|
||||
<programlisting>
|
||||
{
|
||||
nixpkgs.config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
However, this does not allow unfree software for individual users.
|
||||
Their configurations are managed separately.</para>
|
||||
|
||||
<para>A user's of nixpkgs configuration is stored in a user-specific
|
||||
configuration file located at
|
||||
<filename>~/.config/nixpkgs/config.nix</filename>. For example:
|
||||
<programlisting>
|
||||
{
|
||||
allowUnfree = true;
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<section xml:id="sec-allow-broken">
|
||||
<title>Installing broken packages</title>
|
||||
and will allow the Nix package manager to install unfree licensed packages.</para>
|
||||
|
||||
<para>The configuration as listed also applies to NixOS under
|
||||
<option>nixpkgs.config</option> set.</para>
|
||||
|
||||
<para>There are two ways to try compiling a package which has been
|
||||
marked as broken.</para>
|
||||
<itemizedlist>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
For allowing the build of a broken package once, you can use an
|
||||
environment variable for a single invocation of the nix tools:
|
||||
<listitem>
|
||||
<para>Allow installing of packages that are distributed under
|
||||
unfree license by setting <programlisting>allowUnfree =
|
||||
true;</programlisting> or deny them by setting it to
|
||||
<literal>false</literal>.</para>
|
||||
|
||||
<programlisting>$ export NIXPKGS_ALLOW_BROKEN=1</programlisting>
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
For permanently allowing broken packages to be built, you may
|
||||
add <literal>allowBroken = true;</literal> to your user's
|
||||
configuration file, like this:
|
||||
<para>Same can be achieved by setting the environment variable:
|
||||
|
||||
<programlisting>
|
||||
{
|
||||
allowBroken = true;
|
||||
}
|
||||
$ export NIXPKGS_ALLOW_UNFREE=1
|
||||
</programlisting>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-allow-unfree">
|
||||
<title>Installing unfree packages</title>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<para>There are several ways to tweak how Nix handles a package
|
||||
which has been marked as unfree.</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
To temporarily allow all unfree packages, you can use an
|
||||
environment variable for a single invocation of the nix tools:
|
||||
|
||||
<programlisting>$ export NIXPKGS_ALLOW_UNFREE=1</programlisting>
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
It is possible to permanently allow individual unfree packages,
|
||||
while still blocking unfree packages by default using the
|
||||
<literal>allowUnfreePredicate</literal> configuration
|
||||
option in the user configuration file.</para>
|
||||
|
||||
<para>This option is a function which accepts a package as a
|
||||
parameter, and returns a boolean. The following example
|
||||
configuration accepts a package and always returns false:
|
||||
<programlisting>
|
||||
{
|
||||
allowUnfreePredicate = (pkg: false);
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>A more useful example, the following configuration allows
|
||||
only allows flash player and visual studio code:
|
||||
<listitem>
|
||||
<para>Whenever unfree packages are not allowed, single packages
|
||||
can still be allowed by a predicate function that accepts package
|
||||
as an argument and should return a boolean:
|
||||
|
||||
<programlisting>
|
||||
{
|
||||
allowUnfreePredicate = (pkg: elem (builtins.parseDrvName pkg.name).name [ "flashplayer" "vscode" ]);
|
||||
}
|
||||
allowUnfreePredicate = (pkg: ...);
|
||||
</programlisting>
|
||||
</para></listitem>
|
||||
|
||||
<listitem>
|
||||
<para>It is also possible to whitelist and blacklist licenses
|
||||
that are specifically acceptable or not acceptable, using
|
||||
<literal>whitelistedLicenses</literal> and
|
||||
<literal>blacklistedLicenses</literal>, respectively.
|
||||
</para>
|
||||
|
||||
<para>The following example configuration whitelists the
|
||||
licenses <literal>amd</literal> and <literal>wtfpl</literal>:
|
||||
Example to allow flash player and visual studio code only:
|
||||
|
||||
<programlisting>
|
||||
{
|
||||
whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
|
||||
}
|
||||
allowUnfreePredicate = with builtins; (pkg: elem (parseDrvName pkg.name).name [ "flashplayer" "vscode" ]);
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>The following example configuration blacklists the
|
||||
<literal>gpl3</literal> and <literal>agpl3</literal> licenses:
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Whenever unfree packages are not allowed, packages can still
|
||||
be whitelisted by their license:
|
||||
|
||||
<programlisting>
|
||||
{
|
||||
blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
|
||||
}
|
||||
whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<para>A complete list of licenses can be found in the file
|
||||
<filename>lib/licenses.nix</filename> of the nixpkgs tree.</para>
|
||||
</section>
|
||||
|
||||
|
||||
<section xml:id="sec-allow-insecure">
|
||||
<title>
|
||||
Installing insecure packages
|
||||
</title>
|
||||
|
||||
<para>There are several ways to tweak how Nix handles a package
|
||||
which has been marked as insecure.</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
To temporarily allow all insecure packages, you can use an
|
||||
environment variable for a single invocation of the nix tools:
|
||||
|
||||
<programlisting>$ export NIXPKGS_ALLOW_INSECURE=1</programlisting>
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
It is possible to permanently allow individual insecure
|
||||
packages, while still blocking other insecure packages by
|
||||
default using the <literal>permittedInsecurePackages</literal>
|
||||
configuration option in the user configuration file.</para>
|
||||
|
||||
<para>The following example configuration permits the
|
||||
installation of the hypothetically insecure package
|
||||
<literal>hello</literal>, version <literal>1.2.3</literal>:
|
||||
<programlisting>
|
||||
{
|
||||
permittedInsecurePackages = [
|
||||
"hello-1.2.3"
|
||||
];
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem><para>
|
||||
It is also possible to create a custom policy around which
|
||||
insecure packages to allow and deny, by overriding the
|
||||
<literal>allowInsecurePredicate</literal> configuration
|
||||
option.</para>
|
||||
|
||||
<para>The <literal>allowInsecurePredicate</literal> option is a
|
||||
function which accepts a package and returns a boolean, much
|
||||
like <literal>allowUnfreePredicate</literal>.</para>
|
||||
|
||||
<para>The following configuration example only allows insecure
|
||||
packages with very short names:
|
||||
<listitem>
|
||||
<para>In addition to whitelisting licenses which are denied by the
|
||||
<literal>allowUnfree</literal> setting, you can also explicitely
|
||||
deny installation of packages which have a certain license:
|
||||
|
||||
<programlisting>
|
||||
{
|
||||
allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) <= 5);
|
||||
}
|
||||
blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
|
||||
</programlisting>
|
||||
</para>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
<para>A complete list of licenses can be found in the file
|
||||
<filename>lib/licenses.nix</filename> of the nix package tree.</para>
|
||||
|
||||
<para>Note that <literal>permittedInsecurePackages</literal> is
|
||||
only checked if <literal>allowInsecurePredicate</literal> is not
|
||||
specified.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
@@ -227,7 +89,7 @@ packages via <literal>packageOverrides</literal></title>
|
||||
|
||||
<para>You can define a function called
|
||||
<varname>packageOverrides</varname> in your local
|
||||
<filename>~/.config/nixpkgs/config.nix</filename> to override nix packages. It
|
||||
<filename>~/.nixpkgs/config.nix</filename> to overide nix packages. It
|
||||
must be a function that takes pkgs as an argument and return modified
|
||||
set of packages.
|
||||
|
||||
@@ -243,218 +105,5 @@ set of packages.
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-declarative-package-management">
|
||||
<title>Declarative Package Management</title>
|
||||
|
||||
<section xml:id="sec-building-environment">
|
||||
<title>Build an environment</title>
|
||||
|
||||
<para>
|
||||
Using <literal>packageOverrides</literal>, it is possible to manage
|
||||
packages declaratively. This means that we can list all of our desired
|
||||
packages within a declarative Nix expression. For example, to have
|
||||
<literal>aspell</literal>, <literal>bc</literal>,
|
||||
<literal>ffmpeg</literal>, <literal>coreutils</literal>,
|
||||
<literal>gdb</literal>, <literal>nixUnstable</literal>,
|
||||
<literal>emscripten</literal>, <literal>jq</literal>,
|
||||
<literal>nox</literal>, and <literal>silver-searcher</literal>, we could
|
||||
use the following in <filename>~/.config/nixpkgs/config.nix</filename>:
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; {
|
||||
myPackages = pkgs.buildEnv {
|
||||
name = "my-packages";
|
||||
paths = [ aspell bc coreutils gdb ffmpeg nixUnstable emscripten jq nox silver-searcher ];
|
||||
};
|
||||
};
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
To install it into our environment, you can just run <literal>nix-env -iA
|
||||
nixpkgs.myPackages</literal>. If you want to load the packages to be built
|
||||
from a working copy of <literal>nixpkgs</literal> you just run
|
||||
<literal>nix-env -f. -iA myPackages</literal>. To explore what's been
|
||||
installed, just look through <filename>~/.nix-profile/</filename>. You can
|
||||
see that a lot of stuff has been installed. Some of this stuff is useful
|
||||
some of it isn't. Let's tell Nixpkgs to only link the stuff that we want:
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; {
|
||||
myPackages = pkgs.buildEnv {
|
||||
name = "my-packages";
|
||||
paths = [ aspell bc coreutils gdb ffmpeg nixUnstable emscripten jq nox silver-searcher ];
|
||||
pathsToLink = [ "/share" "/bin" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
<literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed
|
||||
which gets rid of the extra stuff in the profile.
|
||||
<filename>/bin</filename> and <filename>/share</filename> are good
|
||||
defaults for a user environment, getting rid of the clutter. If you are
|
||||
running on Nix on MacOS, you may want to add another path as well,
|
||||
<filename>/Applications</filename>, that makes GUI apps available.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-getting-documentation">
|
||||
<title>Getting documentation</title>
|
||||
|
||||
<para>
|
||||
After building that new environment, look through
|
||||
<filename>~/.nix-profile</filename> to make sure everything is there that
|
||||
we wanted. Discerning readers will note that some files are missing. Look
|
||||
inside <filename>~/.nix-profile/share/man/man1/</filename> to verify this.
|
||||
There are no man pages for any of the Nix tools! This is because some
|
||||
packages like Nix have multiple outputs for things like documentation (see
|
||||
section 4). Let's make Nix install those as well.
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; {
|
||||
myPackages = pkgs.buildEnv {
|
||||
name = "my-packages";
|
||||
paths = [ aspell bc coreutils ffmpeg nixUnstable emscripten jq nox silver-searcher ];
|
||||
pathsToLink = [ "/share/man" "/share/doc" /bin" ];
|
||||
extraOutputsToInstall = [ "man" "doc" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
This provides us with some useful documentation for using our packages.
|
||||
However, if we actually want those manpages to be detected by man, we need
|
||||
to set up our environment. This can also be managed within Nix
|
||||
expressions.
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; rec {
|
||||
myProfile = writeText "my-profile" ''
|
||||
export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
|
||||
'';
|
||||
myPackages = pkgs.buildEnv {
|
||||
name = "my-packages";
|
||||
paths = [
|
||||
(runCommand "profile" {} ''
|
||||
mkdir -p $out/etc/profile.d
|
||||
cp ${myProfile} $out/etc/profile.d/my-profile.sh
|
||||
'')
|
||||
aspell
|
||||
bc
|
||||
coreutils
|
||||
ffmpeg
|
||||
man
|
||||
nixUnstable
|
||||
emscripten
|
||||
jq
|
||||
nox
|
||||
silver-searcher
|
||||
];
|
||||
pathsToLink = [ "/share/man" "/share/doc" /bin" "/etc" ];
|
||||
extraOutputsToInstall = [ "man" "doc" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
For this to work fully, you must also have this script sourced when you
|
||||
are logged in. Try adding something like this to your
|
||||
<filename>~/.profile</filename> file:
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
#!/bin/sh
|
||||
if [ -d $HOME/.nix-profile/etc/profile.d ]; then
|
||||
for i in $HOME/.nix-profile/etc/profile.d/*.sh; do
|
||||
if [ -r $i ]; then
|
||||
. $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
Now just run <literal>source $HOME/.profile</literal> and you can starting
|
||||
loading man pages from your environent.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-gnu-info-setup">
|
||||
<title>GNU info setup</title>
|
||||
|
||||
<para>
|
||||
Configuring GNU info is a little bit trickier than man pages. To work
|
||||
correctly, info needs a database to be generated. This can be done with
|
||||
some small modifications to our environment scripts.
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; rec {
|
||||
myProfile = writeText "my-profile" ''
|
||||
export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
|
||||
export INFOPATH=$HOME/.nix-profile/share/info:/nix/var/nix/profiles/default/share/info:/usr/share/info
|
||||
'';
|
||||
myPackages = pkgs.buildEnv {
|
||||
name = "my-packages";
|
||||
paths = [
|
||||
(runCommand "profile" {} ''
|
||||
mkdir -p $out/etc/profile.d
|
||||
cp ${myProfile} $out/etc/profile.d/my-profile.sh
|
||||
'')
|
||||
aspell
|
||||
bc
|
||||
coreutils
|
||||
ffmpeg
|
||||
man
|
||||
nixUnstable
|
||||
emscripten
|
||||
jq
|
||||
nox
|
||||
silver-searcher
|
||||
texinfoInteractive
|
||||
];
|
||||
pathsToLink = [ "/share/man" "/share/doc" "/share/info" "/bin" "/etc" ];
|
||||
extraOutputsToInstall = [ "man" "doc" "info" ];
|
||||
postBuild = ''
|
||||
if [ -x $out/bin/install-info -a -w $out/share/info ]; then
|
||||
shopt -s nullglob
|
||||
for i in $out/share/info/*.info $out/share/info/*.info.gz; do
|
||||
$out/bin/install-info $i $out/share/info/dir
|
||||
done
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
<literal>postBuild</literal> tells Nixpkgs to run a command after building
|
||||
the environment. In this case, <literal>install-info</literal> adds the
|
||||
installed info pages to <literal>dir</literal> which is GNU info's default
|
||||
root node. Note that <literal>texinfoInteractive</literal> is added to the
|
||||
environment to give the <literal>install-info</literal> command.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-cross">
|
||||
|
||||
<title>Cross-compilation</title>
|
||||
|
||||
<section xml:id="sec-cross-intro">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
"Cross-compilation" means compiling a program on one machine for another type of machine.
|
||||
For example, a typical use of cross compilation is to compile programs for embedded devices.
|
||||
These devices often don't have the computing power and memory to compile their own programs.
|
||||
One might think that cross-compilation is a fairly niche concern, but there are advantages to being rigorous about distinguishing build-time vs run-time environments even when one is developing and deploying on the same machine.
|
||||
Nixpkgs is increasingly adopting this opinion in that packages should be written with cross-compilation in mind, and nixpkgs should evaluate in a similar way (by minimizing cross-compilation-specific special cases) whether or not one is cross-compiling.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This chapter will be organized in three parts.
|
||||
First, it will describe the basics of how to package software in a way that supports cross-compilation.
|
||||
Second, it will describe how to use Nixpkgs when cross-compiling.
|
||||
Third, it will describe the internal infrastructure supporting cross-compilation.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
<section xml:id="sec-cross-packaging">
|
||||
<title>Packaging in a cross-friendly manner</title>
|
||||
|
||||
<section>
|
||||
<title>Platform parameters</title>
|
||||
<para>
|
||||
The three GNU Autoconf platforms, <wordasword>build</wordasword>, <wordasword>host</wordasword>, and <wordasword>target</wordasword>, are historically the result of much confusion.
|
||||
<link xlink:href="https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html" /> clears this up somewhat but there is more to be said.
|
||||
An important advice to get out the way is, unless you are packaging a compiler or other build tool, just worry about the build and host platforms.
|
||||
Dealing with just two platforms usually better matches people's preconceptions, and in this case is completely correct.
|
||||
</para>
|
||||
<para>
|
||||
In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>.
|
||||
All three are always defined as attributes in the standard environment, and at the top level. That means one can get at them just like a dependency in a function that is imported with <literal>callPackage</literal>:
|
||||
<programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>, or just off <varname>stdenv</varname>:
|
||||
<programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>.
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><varname>buildPlatform</varname></term>
|
||||
<listitem><para>
|
||||
The "build platform" is the platform on which a package is built.
|
||||
Once someone has a built package, or pre-built binary package, the build platform should not matter and be safe to ignore.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>hostPlatform</varname></term>
|
||||
<listitem><para>
|
||||
The "host platform" is the platform on which a package is run.
|
||||
This is the simplest platform to understand, but also the one with the worst name.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>targetPlatform</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The "target platform" is black sheep.
|
||||
The other two intrinsically apply to all compiled software—or any build process with a notion of "build-time" followed by "run-time".
|
||||
The target platform only applies to programming tools, and even then only is a good for for some of them.
|
||||
Briefly, GCC, Binutils, GHC, and certain other tools are written in such a way such that a single build can only compile code for a single platform.
|
||||
Thus, when building them, one must think ahead about which platforms they wish to use the tool to produce machine code for, and build binaries for each.
|
||||
</para>
|
||||
<para>
|
||||
There is no fundamental need to think about the target ahead of time like this.
|
||||
LLVM, for example, was designed from the beginning with cross-compilation in mind, and so a normal LLVM binary will support every architecture that LLVM supports.
|
||||
If the tool supports modular or pluggable backends, one might imagine specifying a <emphasis>set</emphasis> of target platforms / backends one wishes to support, rather than a single one.
|
||||
</para>
|
||||
<para>
|
||||
The biggest reason for mess, if there is one, is that many compilers have the bad habit a build process that builds the compiler and standard library/runtime together.
|
||||
Then the specifying target platform is essential, because it determines the host platform of the standard library/runtime.
|
||||
Nixpkgs tries to avoid this where possible too, but still, because the concept of a target platform is so ingrained now in Autoconf and other tools, it is best to support it as is.
|
||||
Tools like LLVM that don't need up-front target platforms can safely ignore it like normal packages, and it will do no harm.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>
|
||||
The exact schema these fields follow is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up.
|
||||
You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent.
|
||||
For now, here are few fields can count on them containing:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><varname>system</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is a two-component shorthand for the platform.
|
||||
Examples of this would be "x86_64-darwin" and "i686-linux"; see <literal>lib.systems.doubles</literal> for more.
|
||||
This format isn't very standard, but has built-in support in Nix, such as the <varname>builtins.currentSystem</varname> impure string.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>config</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is a 3- or 4- component shorthand for the platform.
|
||||
Examples of this would be "x86_64-unknown-linux-gnu" and "aarch64-apple-darwin14".
|
||||
This is a standard format called the "LLVM target triple", as they are pioneered by LLVM and traditionally just used for the <varname>targetPlatform</varname>.
|
||||
This format is strictly more informative than the "Nix host double", as the previous format could analogously be termed.
|
||||
This needs a better name than <varname>config</varname>!
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>parsed</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is a nix representation of a parsed LLVM target triple with white-listed components.
|
||||
This can be specified directly, or actually parsed from the <varname>config</varname>.
|
||||
[Technically, only one need be specified and the others can be inferred, though the precision of inference may not be very good.]
|
||||
See <literal>lib.systems.parse</literal> for the exact representation.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>libc</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is a string identifying the standard C library used.
|
||||
Valid identifiers include "glibc" for GNU libc, "libSystem" for Darwin's Libsystem, and "uclibc" for µClibc.
|
||||
It should probably be refactored to use the module system, like <varname>parse</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>is*</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
These predicates are defined in <literal>lib.systems.inspect</literal>, and slapped on every platform.
|
||||
They are superior to the ones in <varname>stdenv</varname> as they force the user to be explicit about which platform they are inspecting.
|
||||
Please use these instead of those.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>platform</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is, quite frankly, a dumping ground of ad-hoc settings (it's an attribute set).
|
||||
See <literal>lib.systems.platforms</literal> for examples—there's hopefully one in there that will work verbatim for each platform that is working.
|
||||
Please help us triage these flags and give them better homes!
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Specifying Dependencies</title>
|
||||
<para>
|
||||
As mentioned in the introduction to this chapter, one can think about a build time vs run time distinction whether cross-compiling or not.
|
||||
In the case of cross-compilation, this corresponds with whether a derivation running on the native or foreign platform is produced.
|
||||
An interesting thing to think about is how this corresponds with the three Autoconf platforms.
|
||||
In the run-time case, the depending and depended-on package simply have matching build, host, and target platforms.
|
||||
But in the build-time case, one can imagine "sliding" the platforms one over.
|
||||
The depended-on package's host and target platforms (respectively) become the depending package's build and host platforms.
|
||||
This is the most important guiding principle behind cross-compilation with Nixpkgs, and will be called the <wordasword>sliding window principle</wordasword>.
|
||||
In this manner, given the 3 platforms for one package, we can determine the three platforms for all its transitive dependencies.
|
||||
</para>
|
||||
<para>
|
||||
Some examples will probably make this clearer.
|
||||
If a package is being built with a <literal>(build, host, target)</literal> platform triple of <literal>(foo, bar, bar)</literal>, then its build-time dependencies would have a triple of <literal>(foo, foo, bar)</literal>, and <emphasis>those packages'</emphasis> build-time dependencies would have triple of <literal>(foo, foo, foo)</literal>.
|
||||
In other words, it should take two "rounds" of following build-time dependency edges before one reaches a fixed point where, by the sliding window principle, the platform triple no longer changes.
|
||||
Indeed, this happens with cross compilation, where only rounds of native dependencies starting with the second necessarily coincide with native packages.
|
||||
</para>
|
||||
<note><para>
|
||||
The depending package's target platform is unconstrained by the sliding window principle, which makes sense in that one can in principle build cross compilers targeting arbitrary platforms.
|
||||
</para></note>
|
||||
<para>
|
||||
How does this work in practice? Nixpkgs is now structured so that build-time dependencies are taken from <varname>buildPackages</varname>, whereas run-time dependencies are taken from the top level attribute set.
|
||||
For example, <varname>buildPackages.gcc</varname> should be used at build time, while <varname>gcc</varname> should be used at run time.
|
||||
Now, for most of Nixpkgs's history, there was no <varname>buildPackages</varname>, and most packages have not been refactored to use it explicitly.
|
||||
Instead, one can use the four attributes used for specifying dependencies as documented in <xref linkend="ssec-stdenv-attributes"/>.
|
||||
We "splice" together the run-time and build-time package sets with <varname>callPackage</varname>, and then <varname>mkDerivation</varname> for each of four attributes pulls the right derivation out.
|
||||
This splicing can be skipped when not cross compiling as the package sets are the same, but is a bit slow for cross compiling.
|
||||
Because of this, a best-of-both-worlds solution is in the works with no splicing or explicit access of <varname>buildPackages</varname> needed.
|
||||
For now, feel free to use either method.
|
||||
</para>
|
||||
<note><para>
|
||||
There is also a "backlink" <varname>__targetPackages</varname>, yielding a package set whose <varname>buildPackages</varname> is the current package set.
|
||||
This is a hack, though, to accommodate compilers with lousy build systems.
|
||||
Please do not use this unless you are absolutely sure you are packaging such a compiler and there is no other way.
|
||||
</para></note>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
<section xml:id="sec-cross-usage">
|
||||
<title>Cross-building packages</title>
|
||||
<note><para>
|
||||
More information needs to moved from the old wiki, especially <link xlink:href="https://nixos.org/wiki/CrossCompiling" />, for this section.
|
||||
</para></note>
|
||||
<para>
|
||||
Nixpkgs can be instantiated with <varname>localSystem</varname> alone, in which case there is no cross compiling and everything is built by and for that system,
|
||||
or also with <varname>crossSystem</varname>, in which case packages run on the latter, but all building happens on the former.
|
||||
Both parameters take the same schema as the 3 (build, host, and target) platforms defined in the previous section.
|
||||
As mentioned above, <literal>lib.systems.examples</literal> has some platforms which are used as arguments for these parameters in practice.
|
||||
You can use them programmatically, or on the command line like <command>nix-build <nixpkgs> --arg crossSystem '(import <nixpkgs/lib>).systems.examples.fooBarBaz'</command>.
|
||||
</para>
|
||||
<para>
|
||||
While one is free to pass both parameters in full, there's a lot of logic to fill in missing fields.
|
||||
As discussed in the previous section, only one of <varname>system</varname>, <varname>config</varname>, and <varname>parsed</varname> is needed to infer the other two.
|
||||
Additionally, <varname>libc</varname> will be inferred from <varname>parse</varname>.
|
||||
Finally, <literal>localSystem.system</literal> is also <emphasis>impurely</emphasis> inferred based on the platform evaluation occurs.
|
||||
This means it is often not necessary to pass <varname>localSystem</varname> at all, as in the command-line example in the previous paragraph.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Many sources (manual, wiki, etc) probably mention passing <varname>system</varname>, <varname>platform</varname>, along with the optional <varname>crossSystem</varname> to nixpkgs:
|
||||
<literal>import <nixpkgs> { system = ..; platform = ..; crossSystem = ..; }</literal>.
|
||||
Passing those two instead of <varname>localSystem</varname> is still supported for compatibility, but is discouraged.
|
||||
Indeed, much of the inference we do for these parameters is motivated by compatibility as much as convenience.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
One would think that <varname>localSystem</varname> and <varname>crossSystem</varname> overlap horribly with the three <varname>*Platforms</varname> (<varname>buildPlatform</varname>, <varname>hostPlatform,</varname> and <varname>targetPlatform</varname>; see <varname>stage.nix</varname> or the manual).
|
||||
Actually, those identifiers are purposefully not used here to draw a subtle but important distinction:
|
||||
While the granularity of having 3 platforms is necessary to properly *build* packages, it is overkill for specifying the user's *intent* when making a build plan or package set.
|
||||
A simple "build vs deploy" dichotomy is adequate: the sliding window principle described in the previous section shows how to interpolate between the these two "end points" to get the 3 platform triple for each bootstrapping stage.
|
||||
That means for any package a given package set, even those not bound on the top level but only reachable via dependencies or <varname>buildPackages</varname>, the three platforms will be defined as one of <varname>localSystem</varname> or <varname>crossSystem</varname>, with the former replacing the latter as one traverses build-time dependencies.
|
||||
A last simple difference then is <varname>crossSystem</varname> should be null when one doesn't want to cross-compile, while the <varname>*Platform</varname>s are always non-null.
|
||||
<varname>localSystem</varname> is always non-null.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
<section xml:id="sec-cross-infra">
|
||||
<title>Cross-compilation infrastructure</title>
|
||||
<para>To be written.</para>
|
||||
<note><para>
|
||||
If one explores nixpkgs, they will see derivations with names like <literal>gccCross</literal>.
|
||||
Such <literal>*Cross</literal> derivations is a holdover from before we properly distinguished between the host and target platforms
|
||||
—the derivation with "Cross" in the name covered the <literal>build = host != target</literal> case, while the other covered the <literal>host = target</literal>, with build platform the same or not based on whether one was using its <literal>.nativeDrv</literal> or <literal>.crossDrv</literal>.
|
||||
This ugliness will disappear soon.
|
||||
</para></note>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
@@ -26,7 +26,7 @@ pkgs.stdenv.mkDerivation {
|
||||
extraHeader = ''xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" '';
|
||||
in ''
|
||||
{
|
||||
pandoc '${inputFile}' -w docbook ${lib.optionalString useChapters "--top-level-division=chapter"} \
|
||||
pandoc '${inputFile}' -w docbook ${lib.optionalString useChapters "--chapters"} \
|
||||
--smart \
|
||||
| sed -e 's|<ulink url=|<link xlink:href=|' \
|
||||
-e 's|</ulink>|</link>|' \
|
||||
@@ -60,22 +60,10 @@ pkgs.stdenv.mkDerivation {
|
||||
inputFile = ../pkgs/development/idris-modules/README.md;
|
||||
outputFile = "languages-frameworks/idris.xml";
|
||||
}
|
||||
+ toDocbook {
|
||||
inputFile = ../pkgs/development/node-packages/README.md;
|
||||
outputFile = "languages-frameworks/node.xml";
|
||||
}
|
||||
+ toDocbook {
|
||||
inputFile = ../pkgs/development/r-modules/README.md;
|
||||
outputFile = "languages-frameworks/r.xml";
|
||||
}
|
||||
+ toDocbook {
|
||||
inputFile = ./languages-frameworks/rust.md;
|
||||
outputFile = "./languages-frameworks/rust.xml";
|
||||
}
|
||||
+ toDocbook {
|
||||
inputFile = ./languages-frameworks/vim.md;
|
||||
outputFile = "./languages-frameworks/vim.xml";
|
||||
}
|
||||
+ ''
|
||||
echo ${lib.nixpkgsVersion} > .version
|
||||
|
||||
@@ -105,9 +93,7 @@ pkgs.stdenv.mkDerivation {
|
||||
|
||||
cp -r $dst/images $dst/epub/OEBPS
|
||||
echo "application/epub+zip" > mimetype
|
||||
manual="$dst/nixpkgs-manual.epub"
|
||||
zip -0Xq "$manual" mimetype
|
||||
cd $dst/epub && zip -Xr9D "$manual" *
|
||||
rm -rf $dst/epub
|
||||
zip -0Xq "$dst/Nixpkgs Contributors Guide - NixOS community.epub" mimetype
|
||||
zip -Xr9D "$dst/Nixpkgs Contributors Guide - NixOS community.epub" $dst/epub/*
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -8,235 +8,177 @@
|
||||
The nixpkgs repository has several utility functions to manipulate Nix expressions.
|
||||
</para>
|
||||
|
||||
<section xml:id="sec-overrides">
|
||||
<title>Overriding</title>
|
||||
<section xml:id="sec-pkgs-overridePackages">
|
||||
<title>pkgs.overridePackages</title>
|
||||
|
||||
<para>
|
||||
Sometimes one wants to override parts of
|
||||
<literal>nixpkgs</literal>, e.g. derivation attributes, the results of
|
||||
derivations or even the whole package set.
|
||||
This function inside the nixpkgs expression (<varname>pkgs</varname>)
|
||||
can be used to override the set of packages itself.
|
||||
</para>
|
||||
<para>
|
||||
Warning: this function is expensive and must not be used from within
|
||||
the nixpkgs repository.
|
||||
</para>
|
||||
<para>
|
||||
Example usage:
|
||||
|
||||
<programlisting>let
|
||||
pkgs = import <nixpkgs> {};
|
||||
newpkgs = pkgs.overridePackages (self: super: {
|
||||
foo = super.foo.override { ... };
|
||||
};
|
||||
in ...</programlisting>
|
||||
</para>
|
||||
|
||||
<section xml:id="sec-pkg-override">
|
||||
<title><pkg>.override</title>
|
||||
<para>
|
||||
The resulting <varname>newpkgs</varname> will have the new <varname>foo</varname>
|
||||
expression, and all other expressions depending on <varname>foo</varname> will also
|
||||
use the new <varname>foo</varname> expression.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The function <varname>override</varname> is usually available for all the
|
||||
derivations in the nixpkgs expression (<varname>pkgs</varname>).
|
||||
</para>
|
||||
<para>
|
||||
It is used to override the arguments passed to a function.
|
||||
</para>
|
||||
<para>
|
||||
Example usages:
|
||||
<para>
|
||||
The behavior of this function is similar to <link
|
||||
linkend="sec-modify-via-packageOverrides">config.packageOverrides</link>.
|
||||
</para>
|
||||
|
||||
<programlisting>pkgs.foo.override { arg1 = val1; arg2 = val2; ... }</programlisting>
|
||||
<programlisting>import pkgs.path { overlays = [ (self: super: {
|
||||
foo = super.foo.override { barSupport = true ; };
|
||||
})]};</programlisting>
|
||||
<programlisting>mypkg = pkgs.callPackage ./mypkg.nix {
|
||||
mydep = pkgs.mydep.override { ... };
|
||||
}</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The <varname>self</varname> parameter refers to the final package set with the
|
||||
applied overrides. Using this parameter may lead to infinite recursion if not
|
||||
used consciously.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the first example, <varname>pkgs.foo</varname> is the result of a function call
|
||||
with some default arguments, usually a derivation.
|
||||
Using <varname>pkgs.foo.override</varname> will call the same function with
|
||||
the given new arguments.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-pkg-overrideAttrs">
|
||||
<title><pkg>.overrideAttrs</title>
|
||||
|
||||
<para>
|
||||
The function <varname>overrideAttrs</varname> allows overriding the
|
||||
attribute set passed to a <varname>stdenv.mkDerivation</varname> call,
|
||||
producing a new derivation based on the original one.
|
||||
This function is available on all derivations produced by the
|
||||
<varname>stdenv.mkDerivation</varname> function, which is most packages
|
||||
in the nixpkgs expression <varname>pkgs</varname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Example usage:
|
||||
|
||||
<programlisting>helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
|
||||
separateDebugInfo = true;
|
||||
});</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the above example, the <varname>separateDebugInfo</varname> attribute is
|
||||
overridden to be true, thus building debug info for
|
||||
<varname>helloWithDebug</varname>, while all other attributes will be
|
||||
retained from the original <varname>hello</varname> package.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The argument <varname>oldAttrs</varname> is conventionally used to refer to
|
||||
the attr set originally passed to <varname>stdenv.mkDerivation</varname>.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Note that <varname>separateDebugInfo</varname> is processed only by the
|
||||
<varname>stdenv.mkDerivation</varname> function, not the generated, raw
|
||||
Nix derivation. Thus, using <varname>overrideDerivation</varname> will
|
||||
not work in this case, as it overrides only the attributes of the final
|
||||
derivation. It is for this reason that <varname>overrideAttrs</varname>
|
||||
should be preferred in (almost) all cases to
|
||||
<varname>overrideDerivation</varname>, i.e. to allow using
|
||||
<varname>sdenv.mkDerivation</varname> to process input arguments, as well
|
||||
as the fact that it is easier to use (you can use the same attribute
|
||||
names you see in your Nix code, instead of the ones generated (e.g.
|
||||
<varname>buildInputs</varname> vs <varname>nativeBuildInputs</varname>,
|
||||
and involves less typing.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section xml:id="sec-pkg-overrideDerivation">
|
||||
<title><pkg>.overrideDerivation</title>
|
||||
|
||||
<warning>
|
||||
<para>You should prefer <varname>overrideAttrs</varname> in almost all
|
||||
cases, see its documentation for the reasons why.
|
||||
<varname>overrideDerivation</varname> is not deprecated and will continue
|
||||
to work, but is less nice to use and does not have as many abilities as
|
||||
<varname>overrideAttrs</varname>.
|
||||
</para>
|
||||
</warning>
|
||||
|
||||
<warning>
|
||||
<para>Do not use this function in Nixpkgs as it evaluates a Derivation
|
||||
before modifying it, which breaks package abstraction and removes
|
||||
error-checking of function arguments. In addition, this
|
||||
evaluation-per-function application incurs a performance penalty,
|
||||
which can become a problem if many overrides are used.
|
||||
It is only intended for ad-hoc customisation, such as in
|
||||
<filename>~/.config/nixpkgs/config.nix</filename>.
|
||||
</para>
|
||||
</warning>
|
||||
|
||||
<para>
|
||||
The function <varname>overrideDerivation</varname> creates a new derivation
|
||||
based on an existing one by overriding the original's attributes with
|
||||
the attribute set produced by the specified function.
|
||||
This function is available on all
|
||||
derivations defined using the <varname>makeOverridable</varname> function.
|
||||
Most standard derivation-producing functions, such as
|
||||
<varname>stdenv.mkDerivation</varname>, are defined using this
|
||||
function, which means most packages in the nixpkgs expression,
|
||||
<varname>pkgs</varname>, have this function.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Example usage:
|
||||
|
||||
<programlisting>mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
|
||||
name = "sed-4.2.2-pre";
|
||||
src = fetchurl {
|
||||
url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2;
|
||||
sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k";
|
||||
};
|
||||
patches = [];
|
||||
});</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the above example, the <varname>name</varname>, <varname>src</varname>,
|
||||
and <varname>patches</varname> of the derivation will be overridden, while
|
||||
all other attributes will be retained from the original derivation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The argument <varname>oldAttrs</varname> is used to refer to the attribute set of
|
||||
the original derivation.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
A package's attributes are evaluated *before* being modified by
|
||||
the <varname>overrideDerivation</varname> function.
|
||||
For example, the <varname>name</varname> attribute reference
|
||||
in <varname>url = "mirror://gnu/hello/${name}.tar.gz";</varname>
|
||||
is filled-in *before* the <varname>overrideDerivation</varname> function
|
||||
modifies the attribute set. This means that overriding the
|
||||
<varname>name</varname> attribute, in this example, *will not* change the
|
||||
value of the <varname>url</varname> attribute. Instead, we need to override
|
||||
both the <varname>name</varname> *and* <varname>url</varname> attributes.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-lib-makeOverridable">
|
||||
<title>lib.makeOverridable</title>
|
||||
|
||||
<para>
|
||||
The function <varname>lib.makeOverridable</varname> is used to make the result
|
||||
of a function easily customizable. This utility only makes sense for functions
|
||||
that accept an argument set and return an attribute set.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Example usage:
|
||||
|
||||
<programlisting>f = { a, b }: { result = a+b; }
|
||||
c = lib.makeOverridable f { a = 1; b = 2; }</programlisting>
|
||||
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The variable <varname>c</varname> is the value of the <varname>f</varname> function
|
||||
applied with some default arguments. Hence the value of <varname>c.result</varname>
|
||||
is <literal>3</literal>, in this example.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The variable <varname>c</varname> however also has some additional functions, like
|
||||
<link linkend="sec-pkg-override">c.override</link> which can be used to
|
||||
override the default arguments. In this example the value of
|
||||
<varname>(c.override { a = 4; }).result</varname> is 6.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
<para>
|
||||
The <varname>super</varname> parameter refers to the old package set.
|
||||
It's equivalent to <varname>pkgs</varname> in the above example.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-generators">
|
||||
<title>Generators</title>
|
||||
<section xml:id="sec-pkg-override">
|
||||
<title><pkg>.override</title>
|
||||
|
||||
<para>
|
||||
Generators are functions that create file formats from nix
|
||||
data structures, e. g. for configuration files.
|
||||
There are generators available for: <literal>INI</literal>,
|
||||
<literal>JSON</literal> and <literal>YAML</literal>
|
||||
The function <varname>override</varname> is usually available for all the
|
||||
derivations in the nixpkgs expression (<varname>pkgs</varname>).
|
||||
</para>
|
||||
<para>
|
||||
It is used to override the arguments passed to a function.
|
||||
</para>
|
||||
<para>
|
||||
Example usages:
|
||||
|
||||
<programlisting>pkgs.foo.override { arg1 = val1; arg2 = val2; ... }</programlisting>
|
||||
<programlisting>pkgs.overridePackages (self: super: {
|
||||
foo = super.foo.override { barSupport = true ; };
|
||||
})</programlisting>
|
||||
<programlisting>mypkg = pkgs.callPackage ./mypkg.nix {
|
||||
mydep = pkgs.mydep.override { ... };
|
||||
})</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
All generators follow a similar call interface: <code>generatorName
|
||||
configFunctions data</code>, where <literal>configFunctions</literal> is a
|
||||
set of user-defined functions that format variable parts of the content.
|
||||
They each have common defaults, so often they do not need to be set
|
||||
manually. An example is <code>mkSectionName ? (name: libStr.escape [ "[" "]"
|
||||
] name)</code> from the <literal>INI</literal> generator. It gets the name
|
||||
of a section and returns a sanitized name. The default
|
||||
<literal>mkSectionName</literal> escapes <literal>[</literal> and
|
||||
<literal>]</literal> with a backslash.
|
||||
In the first example, <varname>pkgs.foo</varname> is the result of a function call
|
||||
with some default arguments, usually a derivation.
|
||||
Using <varname>pkgs.foo.override</varname> will call the same function with
|
||||
the given new arguments.
|
||||
</para>
|
||||
|
||||
<note><para>Nix store paths can be converted to strings by enclosing a
|
||||
derivation attribute like so: <code>"${drv}"</code>.</para></note>
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-pkg-overrideDerivation">
|
||||
<title><pkg>.overrideDerivation</title>
|
||||
|
||||
<warning>
|
||||
<para>Do not use this function in Nixpkgs as it evaluates a Derivation
|
||||
before modifying it, which breaks package abstraction and removes
|
||||
error-checking of function arguments. In addition, this
|
||||
evaluation-per-function application incurs a performance penalty,
|
||||
which can become a problem if many overrides are used.
|
||||
It is only intended for ad-hoc customisation, such as in
|
||||
<filename>~/.nixpkgs/config.nix</filename>.
|
||||
</para>
|
||||
</warning>
|
||||
|
||||
<para>
|
||||
Detailed documentation for each generator can be found in
|
||||
<literal>lib/generators.nix</literal>.
|
||||
The function <varname>overrideDerivation</varname> creates a new derivation
|
||||
based on an existing one by overriding the original's attributes with
|
||||
the attribute set produced by the specified function.
|
||||
This function is available on all
|
||||
derivations defined using the <varname>makeOverridable</varname> function.
|
||||
Most standard derivation-producing functions, such as
|
||||
<varname>stdenv.mkDerivation</varname>, are defined using this
|
||||
function, which means most packages in the nixpkgs expression,
|
||||
<varname>pkgs</varname>, have this function.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Example usage:
|
||||
|
||||
<programlisting>mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
|
||||
name = "sed-4.2.2-pre";
|
||||
src = fetchurl {
|
||||
url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2;
|
||||
sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k";
|
||||
};
|
||||
patches = [];
|
||||
});</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the above example, the <varname>name</varname>, <varname>src</varname>,
|
||||
and <varname>patches</varname> of the derivation will be overridden, while
|
||||
all other attributes will be retained from the original derivation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The argument <varname>oldAttrs</varname> is used to refer to the attribute set of
|
||||
the original derivation.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
A package's attributes are evaluated *before* being modified by
|
||||
the <varname>overrideDerivation</varname> function.
|
||||
For example, the <varname>name</varname> attribute reference
|
||||
in <varname>url = "mirror://gnu/hello/${name}.tar.gz";</varname>
|
||||
is filled-in *before* the <varname>overrideDerivation</varname> function
|
||||
modifies the attribute set. This means that overriding the
|
||||
<varname>name</varname> attribute, in this example, *will not* change the
|
||||
value of the <varname>url</varname> attribute. Instead, we need to override
|
||||
both the <varname>name</varname> *and* <varname>url</varname> attributes.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-lib-makeOverridable">
|
||||
<title>lib.makeOverridable</title>
|
||||
|
||||
<para>
|
||||
The function <varname>lib.makeOverridable</varname> is used to make the result
|
||||
of a function easily customizable. This utility only makes sense for functions
|
||||
that accept an argument set and return an attribute set.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Example usage:
|
||||
|
||||
<programlisting>f = { a, b }: { result = a+b; }
|
||||
c = lib.makeOverridable f { a = 1; b = 2; }</programlisting>
|
||||
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The variable <varname>c</varname> is the value of the <varname>f</varname> function
|
||||
applied with some default arguments. Hence the value of <varname>c.result</varname>
|
||||
is <literal>3</literal>, in this example.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The variable <varname>c</varname> however also has some additional functions, like
|
||||
<link linkend="sec-pkg-override">c.override</link> which can be used to
|
||||
override the default arguments. In this example the value of
|
||||
<varname>(c.override { a = 4; }).result</varname> is 6.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
@@ -353,37 +295,37 @@
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-pkgs-dockerTools">
|
||||
<title>pkgs.dockerTools</title>
|
||||
<title>pkgs.dockerTools</title>
|
||||
|
||||
<para>
|
||||
<para>
|
||||
<varname>pkgs.dockerTools</varname> is a set of functions for creating and
|
||||
manipulating Docker images according to the
|
||||
<link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#docker-image-specification-v120">
|
||||
Docker Image Specification v1.2.0
|
||||
<link xlink:href="https://github.com/docker/docker/blob/master/image/spec/v1.md#docker-image-specification-v100">
|
||||
Docker Image Specification v1.0.0
|
||||
</link>. Docker itself is not used to perform any of the operations done by these
|
||||
functions.
|
||||
</para>
|
||||
</para>
|
||||
|
||||
<warning>
|
||||
<warning>
|
||||
<para>
|
||||
The <varname>dockerTools</varname> API is unstable and may be subject to
|
||||
backwards-incompatible changes in the future.
|
||||
The <varname>dockerTools</varname> API is unstable and may be subject to
|
||||
backwards-incompatible changes in the future.
|
||||
</para>
|
||||
</warning>
|
||||
</warning>
|
||||
|
||||
<section xml:id="ssec-pkgs-dockerTools-buildImage">
|
||||
<section xml:id="ssec-pkgs-dockerTools-buildImage">
|
||||
<title>buildImage</title>
|
||||
|
||||
<para>
|
||||
This function is analogous to the <command>docker build</command> command,
|
||||
in that can used to build a Docker-compatible repository tarball containing
|
||||
a single image with one or multiple layers. As such, the result
|
||||
is suitable for being loaded in Docker with <command>docker load</command>.
|
||||
This function is analogous to the <command>docker build</command> command,
|
||||
in that can used to build a Docker-compatible repository tarball containing
|
||||
a single image with one or multiple layers. As such, the result
|
||||
is suitable for being loaded in Docker with <command>docker load</command>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The parameters of <varname>buildImage</varname> with relative example values are
|
||||
described below:
|
||||
The parameters of <varname>buildImage</varname> with relative example values are
|
||||
described below:
|
||||
</para>
|
||||
|
||||
<example xml:id='ex-dockerTools-buildImage'><title>Docker build</title>
|
||||
@@ -391,11 +333,11 @@
|
||||
buildImage {
|
||||
name = "redis"; <co xml:id='ex-dockerTools-buildImage-1' />
|
||||
tag = "latest"; <co xml:id='ex-dockerTools-buildImage-2' />
|
||||
|
||||
|
||||
fromImage = someBaseImage; <co xml:id='ex-dockerTools-buildImage-3' />
|
||||
fromImageName = null; <co xml:id='ex-dockerTools-buildImage-4' />
|
||||
fromImageTag = "latest"; <co xml:id='ex-dockerTools-buildImage-5' />
|
||||
|
||||
|
||||
contents = pkgs.redis; <co xml:id='ex-dockerTools-buildImage-6' />
|
||||
runAsRoot = '' <co xml:id='ex-dockerTools-buildImage-runAsRoot' />
|
||||
#!${stdenv.shell}
|
||||
@@ -414,147 +356,131 @@
|
||||
</example>
|
||||
|
||||
<para>The above example will build a Docker image <literal>redis/latest</literal>
|
||||
from the given base image. Loading and running this image in Docker results in
|
||||
<literal>redis-server</literal> being started automatically.
|
||||
from the given base image. Loading and running this image in Docker results in
|
||||
<literal>redis-server</literal> being started automatically.
|
||||
</para>
|
||||
|
||||
<calloutlist>
|
||||
<callout arearefs='ex-dockerTools-buildImage-1'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-1'>
|
||||
<para>
|
||||
<varname>name</varname> specifies the name of the resulting image.
|
||||
This is the only required argument for <varname>buildImage</varname>.
|
||||
<varname>name</varname> specifies the name of the resulting image.
|
||||
This is the only required argument for <varname>buildImage</varname>.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-2'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-2'>
|
||||
<para>
|
||||
<varname>tag</varname> specifies the tag of the resulting image.
|
||||
By default it's <literal>latest</literal>.
|
||||
<varname>tag</varname> specifies the tag of the resulting image.
|
||||
By default it's <literal>latest</literal>.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-3'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-3'>
|
||||
<para>
|
||||
<varname>fromImage</varname> is the repository tarball containing the base image.
|
||||
It must be a valid Docker image, such as exported by <command>docker save</command>.
|
||||
By default it's <literal>null</literal>, which can be seen as equivalent
|
||||
to <literal>FROM scratch</literal> of a <filename>Dockerfile</filename>.
|
||||
<varname>fromImage</varname> is the repository tarball containing the base image.
|
||||
It must be a valid Docker image, such as exported by <command>docker save</command>.
|
||||
By default it's <literal>null</literal>, which can be seen as equivalent
|
||||
to <literal>FROM scratch</literal> of a <filename>Dockerfile</filename>.
|
||||
</para>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-4'>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-4'>
|
||||
<para>
|
||||
<varname>fromImageName</varname> can be used to further specify
|
||||
the base image within the repository, in case it contains multiple images.
|
||||
By default it's <literal>null</literal>, in which case
|
||||
<varname>buildImage</varname> will peek the first image available
|
||||
in the repository.
|
||||
<varname>fromImageName</varname> can be used to further specify
|
||||
the base image within the repository, in case it contains multiple images.
|
||||
By default it's <literal>null</literal>, in which case
|
||||
<varname>buildImage</varname> will peek the first image available
|
||||
in the repository.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-5'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-5'>
|
||||
<para>
|
||||
<varname>fromImageTag</varname> can be used to further specify the tag
|
||||
of the base image within the repository, in case an image contains multiple tags.
|
||||
By default it's <literal>null</literal>, in which case
|
||||
<varname>buildImage</varname> will peek the first tag available for the base image.
|
||||
<varname>fromImageTag</varname> can be used to further specify the tag
|
||||
of the base image within the repository, in case an image contains multiple tags.
|
||||
By default it's <literal>null</literal>, in which case
|
||||
<varname>buildImage</varname> will peek the first tag available for the base image.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-6'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-6'>
|
||||
<para>
|
||||
<varname>contents</varname> is a derivation that will be copied in the new
|
||||
layer of the resulting image. This can be similarly seen as
|
||||
<command>ADD contents/ /</command> in a <filename>Dockerfile</filename>.
|
||||
By default it's <literal>null</literal>.
|
||||
<varname>contents</varname> is a derivation that will be copied in the new
|
||||
layer of the resulting image. This can be similarly seen as
|
||||
<command>ADD contents/ /</command> in a <filename>Dockerfile</filename>.
|
||||
By default it's <literal>null</literal>.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-runAsRoot'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-runAsRoot'>
|
||||
<para>
|
||||
<varname>runAsRoot</varname> is a bash script that will run as root
|
||||
in an environment that overlays the existing layers of the base image with
|
||||
the new resulting layer, including the previously copied
|
||||
<varname>contents</varname> derivation.
|
||||
This can be similarly seen as
|
||||
<command>RUN ...</command> in a <filename>Dockerfile</filename>.
|
||||
|
||||
<note>
|
||||
<varname>runAsRoot</varname> is a bash script that will run as root
|
||||
in an environment that overlays the existing layers of the base image with
|
||||
the new resulting layer, including the previously copied
|
||||
<varname>contents</varname> derivation.
|
||||
This can be similarly seen as
|
||||
<command>RUN ...</command> in a <filename>Dockerfile</filename>.
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Using this parameter requires the <literal>kvm</literal>
|
||||
device to be available.
|
||||
Using this parameter requires the <literal>kvm</literal>
|
||||
device to be available.
|
||||
</para>
|
||||
</note>
|
||||
</note>
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-buildImage-8'>
|
||||
<callout arearefs='ex-dockerTools-buildImage-8'>
|
||||
<para>
|
||||
<varname>config</varname> is used to specify the configuration of the
|
||||
containers that will be started off the built image in Docker.
|
||||
The available options are listed in the
|
||||
<link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions">
|
||||
Docker Image Specification v1.2.0
|
||||
</link>.
|
||||
<varname>config</varname> is used to specify the configuration of the
|
||||
containers that will be started off the built image in Docker.
|
||||
The available options are listed in the
|
||||
<link xlink:href="https://github.com/docker/docker/blob/master/image/spec/v1.md#container-runconfig-field-descriptions">
|
||||
Docker Image Specification v1.0.0
|
||||
</link>.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
</calloutlist>
|
||||
|
||||
<para>
|
||||
After the new layer has been created, its closure
|
||||
(to which <varname>contents</varname>, <varname>config</varname> and
|
||||
<varname>runAsRoot</varname> contribute) will be copied in the layer itself.
|
||||
Only new dependencies that are not already in the existing layers will be copied.
|
||||
After the new layer has been created, its closure
|
||||
(to which <varname>contents</varname>, <varname>config</varname> and
|
||||
<varname>runAsRoot</varname> contribute) will be copied in the layer itself.
|
||||
Only new dependencies that are not already in the existing layers will be copied.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At the end of the process, only one new single layer will be produced and
|
||||
added to the resulting image.
|
||||
At the end of the process, only one new single layer will be produced and
|
||||
added to the resulting image.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The resulting repository will only list the single image
|
||||
<varname>image/tag</varname>. In the case of <xref linkend='ex-dockerTools-buildImage'/>
|
||||
it would be <varname>redis/latest</varname>.
|
||||
The resulting repository will only list the single image
|
||||
<varname>image/tag</varname>. In the case of <xref linkend='ex-dockerTools-buildImage'/>
|
||||
it would be <varname>redis/latest</varname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is possible to inspect the arguments with which an image was built
|
||||
using its <varname>buildArgs</varname> attribute.
|
||||
It is possible to inspect the arguments with which an image was built
|
||||
using its <varname>buildArgs</varname> attribute.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<note>
|
||||
<para>
|
||||
If you see errors similar to <literal>getProtocolByName: does not exist (no such protocol name: tcp)</literal>
|
||||
you may need to add <literal>pkgs.iana-etc</literal> to <varname>contents</varname>.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
If you see errors similar to <literal>Error_Protocol ("certificate has unknown CA",True,UnknownCa)</literal>
|
||||
you may need to add <literal>pkgs.cacert</literal> to <varname>contents</varname>.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-pkgs-dockerTools-fetchFromRegistry">
|
||||
<section xml:id="ssec-pkgs-dockerTools-fetchFromRegistry">
|
||||
<title>pullImage</title>
|
||||
|
||||
<para>
|
||||
This function is analogous to the <command>docker pull</command> command,
|
||||
in that can be used to fetch a Docker image from a Docker registry.
|
||||
Currently only registry <literal>v1</literal> is supported.
|
||||
By default <link xlink:href="https://hub.docker.com/">Docker Hub</link>
|
||||
is used to pull images.
|
||||
This function is analogous to the <command>docker pull</command> command,
|
||||
in that can be used to fetch a Docker image from a Docker registry.
|
||||
Currently only registry <literal>v1</literal> is supported.
|
||||
By default <link xlink:href="https://hub.docker.com/">Docker Hub</link>
|
||||
is used to pull images.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Its parameters are described in the example below:
|
||||
Its parameters are described in the example below:
|
||||
</para>
|
||||
|
||||
<example xml:id='ex-dockerTools-pullImage'><title>Docker pull</title>
|
||||
@@ -572,73 +498,73 @@
|
||||
</example>
|
||||
|
||||
<calloutlist>
|
||||
<callout arearefs='ex-dockerTools-pullImage-1'>
|
||||
<callout arearefs='ex-dockerTools-pullImage-1'>
|
||||
<para>
|
||||
<varname>imageName</varname> specifies the name of the image to be downloaded,
|
||||
which can also include the registry namespace (e.g. <literal>library/debian</literal>).
|
||||
This argument is required.
|
||||
<varname>imageName</varname> specifies the name of the image to be downloaded,
|
||||
which can also include the registry namespace (e.g. <literal>library/debian</literal>).
|
||||
This argument is required.
|
||||
</para>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-pullImage-2'>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-pullImage-2'>
|
||||
<para>
|
||||
<varname>imageTag</varname> specifies the tag of the image to be downloaded.
|
||||
By default it's <literal>latest</literal>.
|
||||
<varname>imageTag</varname> specifies the tag of the image to be downloaded.
|
||||
By default it's <literal>latest</literal>.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-pullImage-3'>
|
||||
<callout arearefs='ex-dockerTools-pullImage-3'>
|
||||
<para>
|
||||
<varname>imageId</varname>, if specified this exact image will be fetched, instead
|
||||
of <varname>imageName/imageTag</varname>. However, the resulting repository
|
||||
will still be named <varname>imageName/imageTag</varname>.
|
||||
By default it's <literal>null</literal>.
|
||||
<varname>imageId</varname>, if specified this exact image will be fetched, instead
|
||||
of <varname>imageName/imageTag</varname>. However, the resulting repository
|
||||
will still be named <varname>imageName/imageTag</varname>.
|
||||
By default it's <literal>null</literal>.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-pullImage-4'>
|
||||
<callout arearefs='ex-dockerTools-pullImage-4'>
|
||||
<para>
|
||||
<varname>sha256</varname> is the checksum of the whole fetched image.
|
||||
This argument is required.
|
||||
<varname>sha256</varname> is the checksum of the whole fetched image.
|
||||
This argument is required.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>The checksum is computed on the unpacked directory, not on the final tarball.</para>
|
||||
<para>The checksum is computed on the unpacked directory, not on the final tarball.</para>
|
||||
</note>
|
||||
|
||||
</callout>
|
||||
</callout>
|
||||
|
||||
<callout arearefs='ex-dockerTools-pullImage-5'>
|
||||
<callout arearefs='ex-dockerTools-pullImage-5'>
|
||||
<para>
|
||||
In the above example the default values are shown for the variables
|
||||
<varname>indexUrl</varname> and <varname>registryVersion</varname>.
|
||||
Hence by default the Docker.io registry is used to pull the images.
|
||||
In the above example the default values are shown for the variables
|
||||
<varname>indexUrl</varname> and <varname>registryVersion</varname>.
|
||||
Hence by default the Docker.io registry is used to pull the images.
|
||||
</para>
|
||||
</callout>
|
||||
</callout>
|
||||
</calloutlist>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-pkgs-dockerTools-exportImage">
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-pkgs-dockerTools-exportImage">
|
||||
<title>exportImage</title>
|
||||
|
||||
<para>
|
||||
This function is analogous to the <command>docker export</command> command,
|
||||
in that can used to flatten a Docker image that contains multiple layers.
|
||||
It is in fact the result of the merge of all the layers of the image.
|
||||
As such, the result is suitable for being imported in Docker
|
||||
with <command>docker import</command>.
|
||||
This function is analogous to the <command>docker export</command> command,
|
||||
in that can used to flatten a Docker image that contains multiple layers.
|
||||
It is in fact the result of the merge of all the layers of the image.
|
||||
As such, the result is suitable for being imported in Docker
|
||||
with <command>docker import</command>.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
<para>
|
||||
Using this function requires the <literal>kvm</literal>
|
||||
device to be available.
|
||||
</para>
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
The parameters of <varname>exportImage</varname> are the following:
|
||||
The parameters of <varname>exportImage</varname> are the following:
|
||||
</para>
|
||||
|
||||
<example xml:id='ex-dockerTools-exportImage'><title>Docker export</title>
|
||||
@@ -647,35 +573,35 @@
|
||||
fromImage = someLayeredImage;
|
||||
fromImageName = null;
|
||||
fromImageTag = null;
|
||||
|
||||
|
||||
name = someLayeredImage.name;
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
The parameters relative to the base image have the same synopsis as
|
||||
described in <xref linkend='ssec-pkgs-dockerTools-buildImage'/>, except that
|
||||
<varname>fromImage</varname> is the only required argument in this case.
|
||||
The parameters relative to the base image have the same synopsis as
|
||||
described in <xref linkend='ssec-pkgs-dockerTools-buildImage'/>, except that
|
||||
<varname>fromImage</varname> is the only required argument in this case.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <varname>name</varname> argument is the name of the derivation output,
|
||||
which defaults to <varname>fromImage.name</varname>.
|
||||
The <varname>name</varname> argument is the name of the derivation output,
|
||||
which defaults to <varname>fromImage.name</varname>.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-pkgs-dockerTools-shadowSetup">
|
||||
<section xml:id="ssec-pkgs-dockerTools-shadowSetup">
|
||||
<title>shadowSetup</title>
|
||||
|
||||
<para>
|
||||
This constant string is a helper for setting up the base files for managing
|
||||
users and groups, only if such files don't exist already.
|
||||
It is suitable for being used in a
|
||||
<varname>runAsRoot</varname> <xref linkend='ex-dockerTools-buildImage-runAsRoot'/> script for cases like
|
||||
in the example below:
|
||||
This constant string is a helper for setting up the base files for managing
|
||||
users and groups, only if such files don't exist already.
|
||||
It is suitable for being used in a
|
||||
<varname>runAsRoot</varname> <xref linkend='ex-dockerTools-buildImage-runAsRoot'/> script for cases like
|
||||
in the example below:
|
||||
</para>
|
||||
|
||||
|
||||
<example xml:id='ex-dockerTools-shadowSetup'><title>Shadow base files</title>
|
||||
<programlisting>
|
||||
buildImage {
|
||||
@@ -694,13 +620,13 @@
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Creating base files like <literal>/etc/passwd</literal> or
|
||||
<literal>/etc/login.defs</literal> are necessary for shadow-utils to
|
||||
manipulate users and groups.
|
||||
Creating base files like <literal>/etc/passwd</literal> or
|
||||
<literal>/etc/login.defs</literal> are necessary for shadow-utils to
|
||||
manipulate users and groups.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -2,120 +2,60 @@
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="sec-beam">
|
||||
|
||||
<title>BEAM Languages (Erlang, Elixir & LFE)</title>
|
||||
<title>Beam Languages (Erlang & Elixir)</title>
|
||||
<section xml:id="beam-introduction">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
In this document and related Nix expressions, we use the term,
|
||||
<emphasis>BEAM</emphasis>, to describe the environment. BEAM is the name
|
||||
of the Erlang Virtual Machine and, as far as we're concerned, from a
|
||||
packaging perspective, all languages that run on the BEAM are
|
||||
interchangeable. That which varies, like the build system, is transparent
|
||||
to users of any given BEAM package, so we make no distinction.
|
||||
In this document and related Nix expressions we use the term
|
||||
<emphasis>Beam</emphasis> to describe the environment. Beam is
|
||||
the name of the Erlang Virtial Machine and, as far as we know,
|
||||
from a packaging perspective all languages that run on Beam are
|
||||
interchangable. The things that do change, like the build
|
||||
system, are transperant to the users of the package. So we make
|
||||
no distinction.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="beam-structure">
|
||||
<title>Structure</title>
|
||||
<para>
|
||||
All BEAM-related expressions are available via the top-level
|
||||
<literal>beam</literal> attribute, which includes:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>interpreters</literal>: a set of compilers running on the
|
||||
BEAM, including multiple Erlang/OTP versions
|
||||
(<literal>beam.interpreters.erlangR19</literal>, etc), Elixir
|
||||
(<literal>beam.interpreters.elixir</literal>) and LFE
|
||||
(<literal>beam.interpreters.lfe</literal>).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>packages</literal>: a set of package sets, each compiled with
|
||||
a specific Erlang/OTP version, e.g.
|
||||
<literal>beam.packages.erlangR19</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
The default Erlang compiler, defined by
|
||||
<literal>beam.interpreters.erlang</literal>, is aliased as
|
||||
<literal>erlang</literal>. The default BEAM package set is defined by
|
||||
<literal>beam.packages.erlang</literal> and aliased at the top level as
|
||||
<literal>beamPackages</literal>.
|
||||
</para>
|
||||
<para>
|
||||
To create a package set built with a custom Erlang version, use the
|
||||
lambda, <literal>beam.packagesWith</literal>, which accepts an Erlang/OTP
|
||||
derivation and produces a package set similar to
|
||||
<literal>beam.packages.erlang</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Many Erlang/OTP distributions available in
|
||||
<literal>beam.interpreters</literal> have versions with ODBC and/or Java
|
||||
enabled. For example, there's
|
||||
<literal>beam.interpreters.erlangR19_odbc_javac</literal>, which
|
||||
corresponds to <literal>beam.interpreters.erlangR19</literal>.
|
||||
</para>
|
||||
<para xml:id="erlang-call-package">
|
||||
We also provide the lambda,
|
||||
<literal>beam.packages.erlang.callPackage</literal>, which simplifies
|
||||
writing BEAM package definitions by injecting all packages from
|
||||
<literal>beam.packages.erlang</literal> into the top-level context.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="build-tools">
|
||||
<section xml:id="build-tools">
|
||||
<title>Build Tools</title>
|
||||
<section xml:id="build-tools-rebar3">
|
||||
<title>Rebar3</title>
|
||||
<para>
|
||||
By default, Rebar3 wants to manage its own dependencies. This is perfectly
|
||||
acceptable in the normal, non-Nix setup, but in the Nix world, it is not.
|
||||
To rectify this, we provide two versions of Rebar3:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>rebar3</literal>: patched to remove the ability to download
|
||||
anything. When not running it via <literal>nix-shell</literal> or
|
||||
<literal>nix-build</literal>, it's probably not going to work as
|
||||
desired.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>rebar3-open</literal>: the normal, unmodified Rebar3. It
|
||||
should work exactly as would any other version of Rebar3. Any Erlang
|
||||
package should rely on <literal>rebar3</literal> instead. See <xref
|
||||
linkend="rebar3-packages"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
By default Rebar3 wants to manage it's own dependencies. In the
|
||||
normal non-Nix, this is perfectly acceptable. In the Nix world it
|
||||
is not. To support this we have created two versions of rebar3,
|
||||
<literal>rebar3</literal> and <literal>rebar3-open</literal>. The
|
||||
<literal>rebar3</literal> version has been patched to remove the
|
||||
ability to download anything from it. If you are not running it a
|
||||
nix-shell or a nix-build then its probably not going to work for
|
||||
you. <literal>rebar3-open</literal> is the normal, un-modified
|
||||
rebar3. It should work exactly as would any other version of
|
||||
rebar3. Any Erlang package should rely on
|
||||
<literal>rebar3</literal> and thats really what you should be
|
||||
using too.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="build-tools-other">
|
||||
<title>Mix & Erlang.mk</title>
|
||||
<para>
|
||||
Both Mix and Erlang.mk work exactly as expected. There is a bootstrap
|
||||
process that needs to be run for both, however, which is supported by the
|
||||
<literal>buildMix</literal> and <literal>buildErlangMk</literal>
|
||||
derivations, respectively.
|
||||
Both Mix and Erlang.mk work exactly as you would expect. There
|
||||
is a bootstrap process that needs to be run for both of
|
||||
them. However, that is supported by the
|
||||
<literal>buildMix</literal> and <literal>buildErlangMk</literal> derivations.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="how-to-install-beam-packages">
|
||||
<title>How to Install BEAM Packages</title>
|
||||
<title>How to install Beam packages</title>
|
||||
<para>
|
||||
BEAM packages are not registered at the top level, simply because they are
|
||||
not relevant to the vast majority of Nix users. They are installable using
|
||||
the <literal>beam.packages.erlang</literal> attribute set (aliased as
|
||||
<literal>beamPackages</literal>), which points to packages built by the
|
||||
default Erlang/OTP version in Nixpkgs, as defined by
|
||||
<literal>beam.interpreters.erlang</literal>.
|
||||
Beam packages are not registered in the top level simply because
|
||||
they are not relevant to the vast majority of Nix users. They are
|
||||
installable using the <literal>beamPackages</literal> attribute
|
||||
set.
|
||||
|
||||
To list the available packages in
|
||||
<literal>beamPackages</literal>, use the following command:
|
||||
You can list the avialable packages in the
|
||||
<literal>beamPackages</literal> with the following command:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
@@ -129,152 +69,115 @@ beamPackages.meck meck-0.8.3
|
||||
beamPackages.rebar3-pc pc-1.1.0
|
||||
</programlisting>
|
||||
<para>
|
||||
To install any of those packages into your profile, refer to them by their
|
||||
attribute path (first column):
|
||||
To install any of those packages into your profile, refer to them by
|
||||
their attribute path (first column):
|
||||
</para>
|
||||
<programlisting>
|
||||
$ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
||||
</programlisting>
|
||||
<para>
|
||||
The attribute path of any BEAM package corresponds to the name of that
|
||||
particular package in <link xlink:href="https://hex.pm">Hex</link> or its
|
||||
OTP Application/Release name.
|
||||
The attribute path of any Beam packages corresponds to the name
|
||||
of that particular package in Hex or its OTP Application/Release name.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="packaging-beam-applications">
|
||||
<title>Packaging BEAM Applications</title>
|
||||
<title>Packaging Beam Applications</title>
|
||||
<section xml:id="packaging-erlang-applications">
|
||||
<title>Erlang Applications</title>
|
||||
<section xml:id="rebar3-packages">
|
||||
<title>Rebar3 Packages</title>
|
||||
<para>
|
||||
The Nix function, <literal>buildRebar3</literal>, defined in
|
||||
<literal>beam.packages.erlang.buildRebar3</literal> and aliased at the
|
||||
top level, can be used to build a derivation that understands how to
|
||||
build a Rebar3 project. For example, we can build <link
|
||||
xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link> as
|
||||
follows:
|
||||
There is a Nix functional called
|
||||
<literal>buildRebar3</literal>. We use this function to make a
|
||||
derivation that understands how to build the rebar3 project. For
|
||||
example, the epression we use to build the <link
|
||||
xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link>
|
||||
project follows.
|
||||
</para>
|
||||
<programlisting>
|
||||
{ stdenv, fetchFromGitHub, buildRebar3, ibrowse, jsx, erlware_commons }:
|
||||
{stdenv, fetchFromGitHub, buildRebar3, ibrowse, jsx, erlware_commons }:
|
||||
|
||||
buildRebar3 rec {
|
||||
name = "hex2nix";
|
||||
version = "0.0.1";
|
||||
buildRebar3 rec {
|
||||
name = "hex2nix";
|
||||
version = "0.0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ericbmerritt";
|
||||
repo = "hex2nix";
|
||||
rev = "${version}";
|
||||
sha256 = "1w7xjidz1l5yjmhlplfx7kphmnpvqm67w99hd2m7kdixwdxq0zqg";
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "ericbmerritt";
|
||||
repo = "hex2nix";
|
||||
rev = "${version}";
|
||||
sha256 = "1w7xjidz1l5yjmhlplfx7kphmnpvqm67w99hd2m7kdixwdxq0zqg";
|
||||
};
|
||||
|
||||
beamDeps = [ ibrowse jsx erlware_commons ];
|
||||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
Such derivations are callable with
|
||||
<literal>beam.packages.erlang.callPackage</literal> (see <xref
|
||||
linkend="erlang-call-package"/>). To call this package using the normal
|
||||
<literal>callPackage</literal>, refer to dependency packages via
|
||||
<literal>beamPackages</literal>, e.g.
|
||||
<literal>beamPackages.ibrowse</literal>.
|
||||
The only visible difference between this derivation and
|
||||
something like <literal>stdenv.mkDerivation</literal> is that we
|
||||
have added <literal>erlangDeps</literal> to the derivation. If
|
||||
you add your Beam dependencies here they will be correctly
|
||||
handled by the system.
|
||||
</para>
|
||||
<para>
|
||||
Notably, <literal>buildRebar3</literal> includes
|
||||
<literal>beamDeps</literal>, while
|
||||
<literal>stdenv.mkDerivation</literal> does not. BEAM dependencies added
|
||||
there will be correctly handled by the system.
|
||||
</para>
|
||||
<para>
|
||||
If a package needs to compile native code via Rebar3's port compilation
|
||||
mechanism, add <literal>compilePort = true;</literal> to the derivation.
|
||||
If your package needs to compile native code via Rebar's port
|
||||
compilation mechenism. You should add <literal>compilePort =
|
||||
true;</literal> to the derivation.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="erlang-mk-packages">
|
||||
<title>Erlang.mk Packages</title>
|
||||
<para>
|
||||
Erlang.mk functions similarly to Rebar3, except we use
|
||||
<literal>buildErlangMk</literal> instead of
|
||||
<literal>buildRebar3</literal>.
|
||||
Erlang.mk functions almost identically to Rebar. The only real
|
||||
difference is that <literal>buildErlangMk</literal> is called
|
||||
instead of <literal>buildRebar3</literal>
|
||||
</para>
|
||||
<programlisting>
|
||||
{ buildErlangMk, fetchHex, cowlib, ranch }:
|
||||
|
||||
buildErlangMk {
|
||||
name = "cowboy";
|
||||
version = "1.0.4";
|
||||
|
||||
src = fetchHex {
|
||||
pkg = "cowboy";
|
||||
{ buildErlangMk, fetchHex, cowlib, ranch }:
|
||||
buildErlangMk {
|
||||
name = "cowboy";
|
||||
version = "1.0.4";
|
||||
sha256 = "6a0edee96885fae3a8dd0ac1f333538a42e807db638a9453064ccfdaa6b9fdac";
|
||||
};
|
||||
src = fetchHex {
|
||||
pkg = "cowboy";
|
||||
version = "1.0.4";
|
||||
sha256 =
|
||||
"6a0edee96885fae3a8dd0ac1f333538a42e807db638a9453064ccfdaa6b9fdac";
|
||||
};
|
||||
beamDeps = [ cowlib ranch ];
|
||||
|
||||
beamDeps = [ cowlib ranch ];
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
Small, fast, modular HTTP server written in Erlang
|
||||
'';
|
||||
license = stdenv.lib.licenses.isc;
|
||||
homepage = https://github.com/ninenines/cowboy;
|
||||
};
|
||||
meta = {
|
||||
description = ''Small, fast, modular HTTP server written in
|
||||
Erlang.'';
|
||||
license = stdenv.lib.licenses.isc;
|
||||
homepage = "https://github.com/ninenines/cowboy";
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
</section>
|
||||
<section xml:id="mix-packages">
|
||||
<title>Mix Packages</title>
|
||||
<para>
|
||||
Mix functions similarly to Rebar3, except we use
|
||||
<literal>buildMix</literal> instead of <literal>buildRebar3</literal>.
|
||||
Mix functions almost identically to Rebar. The only real
|
||||
difference is that <literal>buildMix</literal> is called
|
||||
instead of <literal>buildRebar3</literal>
|
||||
</para>
|
||||
<programlisting>
|
||||
{ buildMix, fetchHex, plug, absinthe }:
|
||||
|
||||
buildMix {
|
||||
name = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchHex {
|
||||
pkg = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
sha256 = "08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
sha256 =
|
||||
"08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
};
|
||||
|
||||
beamDeps = [ plug absinthe ];
|
||||
beamDeps = [ plug absinthe];
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
A plug for Absinthe, an experimental GraphQL toolkit
|
||||
'';
|
||||
description = ''A plug for Absinthe, an experimental GraphQL
|
||||
toolkit'';
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
homepage = https://github.com/CargoSense/absinthe_plug;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
Alternatively, we can use <literal>buildHex</literal> as a shortcut:
|
||||
</para>
|
||||
<programlisting>
|
||||
{ buildHex, buildMix, plug, absinthe }:
|
||||
|
||||
buildHex {
|
||||
name = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
|
||||
sha256 = "08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
|
||||
builder = buildMix;
|
||||
|
||||
beamDeps = [ plug absinthe ];
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
A plug for Absinthe, an experimental GraphQL toolkit
|
||||
'';
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
homepage = https://github.com/CargoSense/absinthe_plug;
|
||||
homepage = "https://github.com/CargoSense/absinthe_plug";
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
@@ -282,18 +185,18 @@ $ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="how-to-develop">
|
||||
<title>How to Develop</title>
|
||||
<title>How to develop</title>
|
||||
<section xml:id="accessing-an-environment">
|
||||
<title>Accessing an Environment</title>
|
||||
<para>
|
||||
Often, we simply want to access a valid environment that contains a
|
||||
specific package and its dependencies. We can accomplish that with the
|
||||
<literal>env</literal> attribute of a derivation. For example, let's say
|
||||
we want to access an Erlang REPL with <literal>ibrowse</literal> loaded
|
||||
up. We could do the following:
|
||||
Often, all you want to do is be able to access a valid
|
||||
environment that contains a specific package and its
|
||||
dependencies. we can do that with the <literal>env</literal>
|
||||
part of a derivation. For example, lets say we want to access an
|
||||
erlang repl with ibrowse loaded up. We could do the following.
|
||||
</para>
|
||||
<programlisting>
|
||||
$ nix-shell -A beamPackages.ibrowse.env --run "erl"
|
||||
~/w/nixpkgs ❯❯❯ nix-shell -A beamPackages.ibrowse.env --run "erl"
|
||||
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
|
||||
|
||||
Eshell V7.0 (abort with ^G)
|
||||
@@ -334,19 +237,20 @@ $ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
||||
2>
|
||||
</programlisting>
|
||||
<para>
|
||||
Notice the <literal>-A beamPackages.ibrowse.env</literal>. That is the key
|
||||
to this functionality.
|
||||
Notice the <literal>-A beamPackages.ibrowse.env</literal>.That
|
||||
is the key to this functionality.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="creating-a-shell">
|
||||
<title>Creating a Shell</title>
|
||||
<para>
|
||||
Getting access to an environment often isn't enough to do real
|
||||
development. Usually, we need to create a <literal>shell.nix</literal>
|
||||
file and do our development inside of the environment specified therein.
|
||||
This file looks a lot like the packaging described above, except that
|
||||
<literal>src</literal> points to the project root and we call the package
|
||||
directly.
|
||||
development. Many times we need to create a
|
||||
<literal>shell.nix</literal> file and do our development inside
|
||||
of the environment specified by that file. This file looks a lot
|
||||
like the packageing described above. The main difference is that
|
||||
<literal>src</literal> points to project root and we call the
|
||||
package directly.
|
||||
</para>
|
||||
<programlisting>
|
||||
{ pkgs ? import "<nixpkgs"> {} }:
|
||||
@@ -360,19 +264,18 @@ let
|
||||
name = "hex2nix";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
beamDeps = [ ibrowse jsx erlware_commons ];
|
||||
erlangDeps = [ ibrowse jsx erlware_commons ];
|
||||
};
|
||||
drv = beamPackages.callPackage f {};
|
||||
|
||||
in
|
||||
|
||||
drv
|
||||
drv
|
||||
</programlisting>
|
||||
<section xml:id="building-in-a-shell">
|
||||
<title>Building in a Shell (for Mix Projects)</title>
|
||||
<title>Building in a shell</title>
|
||||
<para>
|
||||
We can leverage the support of the derivation, irrespective of the build
|
||||
derivation, by calling the commands themselves.
|
||||
We can leveral the support of the Derivation, regardless of
|
||||
which build Derivation is called by calling the commands themselv.s
|
||||
</para>
|
||||
<programlisting>
|
||||
# =============================================================================
|
||||
@@ -432,43 +335,42 @@ analyze: build plt
|
||||
|
||||
</programlisting>
|
||||
<para>
|
||||
Using a <literal>shell.nix</literal> as described (see <xref
|
||||
linkend="creating-a-shell"/>) should just work. Aside from
|
||||
If you add the <literal>shell.nix</literal> as described and
|
||||
user rebar as follows things should simply work. Aside from the
|
||||
<literal>test</literal>, <literal>plt</literal>, and
|
||||
<literal>analyze</literal>, the Make targets work just fine for all of the
|
||||
build derivations.
|
||||
<literal>analyze</literal> the talks work just fine for all of
|
||||
the build Derivations.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="generating-packages-from-hex-with-hex2nix">
|
||||
<title>Generating Packages from Hex with <literal>hex2nix</literal></title>
|
||||
<title>Generating Packages from Hex with Hex2Nix</title>
|
||||
<para>
|
||||
Updating the <link xlink:href="https://hex.pm">Hex</link> package set
|
||||
requires <link
|
||||
xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link>. Given the
|
||||
path to the Erlang modules (usually
|
||||
<literal>pkgs/development/erlang-modules</literal>), it will dump a file
|
||||
called <literal>hex-packages.nix</literal>, containing all the packages that
|
||||
use a recognized build system in <link
|
||||
xlink:href="https://hex.pm">Hex</link>. It can't be determined, however,
|
||||
whether every package is buildable.
|
||||
Updating the Hex packages requires the use of the
|
||||
<literal>hex2nix</literal> tool. Given the path to the Erlang
|
||||
modules (usually
|
||||
<literal>pkgs/development/erlang-modules</literal>). It will
|
||||
happily dump a file called
|
||||
<literal>hex-packages.nix</literal>. That file will contain all
|
||||
the packages that use a recognized build system in Hex. However,
|
||||
it can't know whether or not all those packages are buildable.
|
||||
</para>
|
||||
<para>
|
||||
To make life easier for our users, try to build every <link
|
||||
xlink:href="https://hex.pm">Hex</link> package and remove those that fail.
|
||||
To do that, simply run the following command in the root of your
|
||||
<literal>nixpkgs</literal> repository:
|
||||
To make life easier for our users, it makes good sense to go
|
||||
ahead and attempt to build all those packages and remove the
|
||||
ones that don't build. To do that, simply run the command (in
|
||||
the root of your <literal>nixpkgs</literal> repository). that follows.
|
||||
</para>
|
||||
<programlisting>
|
||||
$ nix-build -A beamPackages
|
||||
</programlisting>
|
||||
<para>
|
||||
That will attempt to build every package in
|
||||
<literal>beamPackages</literal>. Then manually remove those that fail.
|
||||
Hopefully, someone will improve <link
|
||||
xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link> in the
|
||||
future to automate the process.
|
||||
That will build every package in
|
||||
<literal>beamPackages</literal>. Then you can go through and
|
||||
manually remove the ones that fail. Hopefully, someone will
|
||||
improve <literal>hex2nix</literal> in the future to automate
|
||||
that.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -13,7 +13,7 @@ standard Go programs.
|
||||
deis = buildGoPackage rec {
|
||||
name = "deis-${version}";
|
||||
version = "1.13.0";
|
||||
|
||||
|
||||
goPackagePath = "github.com/deis/deis"; <co xml:id='ex-buildGoPackage-1' />
|
||||
subPackages = [ "client" ]; <co xml:id='ex-buildGoPackage-2' />
|
||||
|
||||
@@ -24,7 +24,7 @@ deis = buildGoPackage rec {
|
||||
sha256 = "1qv9lxqx7m18029lj8cw3k7jngvxs4iciwrypdy0gd2nnghc68sw";
|
||||
};
|
||||
|
||||
goDeps = ./deps.nix; <co xml:id='ex-buildGoPackage-3' />
|
||||
goDeps = ./deps.json; <co xml:id='ex-buildGoPackage-3' />
|
||||
|
||||
buildFlags = "--tags release"; <co xml:id='ex-buildGoPackage-4' />
|
||||
}
|
||||
@@ -56,9 +56,7 @@ the following arguments are of special significance to the function:
|
||||
<callout arearefs='ex-buildGoPackage-3'>
|
||||
<para>
|
||||
<varname>goDeps</varname> is where the Go dependencies of a Go program are listed
|
||||
as a list of package source identified by Go import path.
|
||||
It could be imported as a separate <varname>deps.nix</varname> file for
|
||||
readability. The dependency data structure is described below.
|
||||
in a JSON format described below.
|
||||
</para>
|
||||
</callout>
|
||||
|
||||
@@ -72,32 +70,23 @@ the following arguments are of special significance to the function:
|
||||
|
||||
</para>
|
||||
|
||||
<para>The <varname>goDeps</varname> attribute can be imported from a separate
|
||||
<varname>nix</varname> file that defines which Go libraries are needed and should
|
||||
be included in <varname>GOPATH</varname> for <varname>buildPhase</varname>.
|
||||
<para>The <varname>goDeps</varname> attribute should point to a JSON file that defines which Go libraries
|
||||
are needed and should be included in <varname>GOPATH</varname> for <varname>buildPhase</varname>.
|
||||
|
||||
</para>
|
||||
|
||||
<example xml:id='ex-goDeps'><title>deps.nix</title>
|
||||
<example xml:id='ex-goDeps'><title>deps.json</title>
|
||||
<programlisting>
|
||||
[ <co xml:id='ex-goDeps-1' />
|
||||
{
|
||||
goPackagePath = "gopkg.in/yaml.v2"; <co xml:id='ex-goDeps-2' />
|
||||
fetch = {
|
||||
type = "git"; <co xml:id='ex-goDeps-3' />
|
||||
url = "https://gopkg.in/yaml.v2";
|
||||
rev = "a83829b6f1293c91addabc89d0571c246397bbf4";
|
||||
sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh";
|
||||
};
|
||||
}
|
||||
{
|
||||
goPackagePath = "github.com/docopt/docopt-go";
|
||||
fetch = {
|
||||
type = "git";
|
||||
url = "https://github.com/docopt/docopt-go";
|
||||
rev = "784ddc588536785e7299f7272f39101f7faccc3f";
|
||||
sha256 = "0wwz48jl9fvl1iknvn9dqr4gfy1qs03gxaikrxxp9gry6773v3sj";
|
||||
};
|
||||
}
|
||||
{
|
||||
"goPackagePath": "gopkg.in/yaml.v2", <co xml:id='ex-goDeps-2' />
|
||||
"fetch": {
|
||||
"type": "git", <co xml:id='ex-goDeps-3' />
|
||||
"url": "https://gopkg.in/yaml.v2",
|
||||
"rev": "a83829b6f1293c91addabc89d0571c246397bbf4",
|
||||
"sha256": "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh"
|
||||
}
|
||||
}
|
||||
]
|
||||
</programlisting>
|
||||
</example>
|
||||
@@ -130,9 +119,6 @@ the following arguments are of special significance to the function:
|
||||
|
||||
</para>
|
||||
|
||||
<para>To extract dependency information from a Go package in automated way use <link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>.
|
||||
It can produce complete derivation and <varname>goDeps</varname> file for Go programs.</para>
|
||||
|
||||
<para>
|
||||
<varname>buildGoPackage</varname> produces <xref linkend='chap-multiple-output' xrefstyle="select: title" />
|
||||
where <varname>bin</varname> includes program binaries. You can test build a Go binary as follows:
|
||||
@@ -163,4 +149,7 @@ done
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>To extract dependency information from a Go package in automated way use <link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>.
|
||||
It can produce complete derivation and <varname>goDeps</varname> file for Go programs.</para>
|
||||
</section>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,15 +21,12 @@ such as Perl or Haskell. These are described in this chapter.</para>
|
||||
<xi:include href="idris.xml" /> <!-- generated from ../../pkgs/development/idris-modules/README.md -->
|
||||
<xi:include href="java.xml" />
|
||||
<xi:include href="lua.xml" />
|
||||
<xi:include href="node.xml" /> <!-- generated from ../../pkgs/development/node-packages/README.md -->
|
||||
<xi:include href="perl.xml" />
|
||||
<xi:include href="python.xml" />
|
||||
<xi:include href="qt.xml" />
|
||||
<xi:include href="r.xml" /> <!-- generated from ../../pkgs/development/r-modules/README.md -->
|
||||
<xi:include href="ruby.xml" />
|
||||
<xi:include href="rust.xml" />
|
||||
<xi:include href="texlive.xml" />
|
||||
<xi:include href="vim.xml" />
|
||||
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -157,16 +157,16 @@ expression on standard output. For example:
|
||||
|
||||
<screen>
|
||||
$ nix-generate-from-cpan XML::Simple
|
||||
XMLSimple = buildPerlPackage rec {
|
||||
name = "XML-Simple-2.22";
|
||||
XMLSimple = buildPerlPackage {
|
||||
name = "XML-Simple-2.20";
|
||||
src = fetchurl {
|
||||
url = "mirror://cpan/authors/id/G/GR/GRANTM/${name}.tar.gz";
|
||||
sha256 = "b9450ef22ea9644ae5d6ada086dc4300fa105be050a2030ebd4efd28c198eb49";
|
||||
url = mirror://cpan/authors/id/G/GR/GRANTM/XML-Simple-2.20.tar.gz;
|
||||
sha256 = "5cff13d0802792da1eb45895ce1be461903d98ec97c9c953bc8406af7294434a";
|
||||
};
|
||||
propagatedBuildInputs = [ XMLNamespaceSupport XMLSAX XMLSAXExpat ];
|
||||
meta = {
|
||||
description = "An API for simple XML files";
|
||||
license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
|
||||
description = "Easily read/write XML (esp config files)";
|
||||
license = "perl";
|
||||
};
|
||||
};
|
||||
</screen>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,53 +4,65 @@
|
||||
|
||||
<title>Qt</title>
|
||||
|
||||
<para>
|
||||
Qt is a comprehensive desktop and mobile application development toolkit for C++.
|
||||
Legacy support is available for Qt 3 and Qt 4, but all current development uses Qt 5.
|
||||
The Qt 5 packages in Nixpkgs are updated frequently to take advantage of new features,
|
||||
but older versions are typically retained until their support window ends.
|
||||
The most important consideration in packaging Qt-based software is ensuring that each package and all its dependencies use the same version of Qt 5;
|
||||
this consideration motivates most of the tools described below.
|
||||
</para>
|
||||
<para>The information in this section applies to Qt 5.5 and later.</para>
|
||||
|
||||
<section xml:id="ssec-qt-libraries"><title>Packaging Libraries for Nixpkgs</title>
|
||||
<para>Qt is an application development toolkit for C++. Although it is
|
||||
not a distinct programming language, there are special considerations
|
||||
for packaging Qt-based programs and libraries. A small set of tools
|
||||
and conventions has grown out of these considerations.</para>
|
||||
|
||||
<para>
|
||||
Whenever possible, libraries that use Qt 5 should be built with each available version.
|
||||
Packages providing libraries should be added to the top-level function <varname>mkLibsForQt5</varname>,
|
||||
which is used to build a set of libraries for every Qt 5 version.
|
||||
A special <varname>callPackage</varname> function is used in this scope to ensure that the entire dependency tree uses the same Qt 5 version.
|
||||
Import dependencies unqualified, i.e., <literal>qtbase</literal> not <literal>qt5.qtbase</literal>.
|
||||
<emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal>.
|
||||
</para>
|
||||
<section xml:id="ssec-qt-libraries"><title>Libraries</title>
|
||||
|
||||
<para>
|
||||
If a library does not support a particular version of Qt 5, it is best to mark it as broken by setting its <literal>meta.broken</literal> attribute.
|
||||
A package may be marked broken for certain versions by testing the <literal>qtbase.version</literal> attribute, which will always give the current Qt 5 version.
|
||||
<para>Packages that provide libraries should be listed in
|
||||
<varname>qt5LibsFun</varname> so that the library is built with each
|
||||
Qt version. A set of packages is provided for each version of Qt; for
|
||||
example, <varname>qt5Libs</varname> always provides libraries built
|
||||
with the latest version, <varname>qt55Libs</varname> provides
|
||||
libraries built with Qt 5.5, and so on. To avoid version conflicts, no
|
||||
top-level attributes are created for these packages.</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-qt-programs"><title>Programs</title>
|
||||
|
||||
<para>Application packages do not need to be built with every Qt
|
||||
version. To ensure consistency between the package's dependencies,
|
||||
call the package with <literal>qt5Libs.callPackage</literal> instead
|
||||
of the usual <literal>callPackage</literal>. An older version may be
|
||||
selected in case of incompatibility. For example, to build with Qt
|
||||
5.5, call the package with
|
||||
<literal>qt55Libs.callPackage</literal>.</para>
|
||||
|
||||
<para>Several environment variables must be set at runtime for Qt
|
||||
applications to function correctly, including:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para><envar>QT_PLUGIN_PATH</envar></para></listitem>
|
||||
<listitem><para><envar>QML_IMPORT_PATH</envar></para></listitem>
|
||||
<listitem><para><envar>QML2_IMPORT_PATH</envar></para></listitem>
|
||||
<listitem><para><envar>XDG_DATA_DIRS</envar></para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>To ensure that these are set correctly, the program must be wrapped by
|
||||
invoking <literal>wrapQtProgram <replaceable>program</replaceable></literal>
|
||||
during installation (for example, during
|
||||
<literal>fixupPhase</literal>). <literal>wrapQtProgram</literal>
|
||||
accepts the same options as <literal>makeWrapper</literal>.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-qt-applications"><title>Packaging Applications for Nixpkgs</title>
|
||||
<section xml:id="ssec-qt-kde"><title>KDE</title>
|
||||
|
||||
<para>
|
||||
Call your application expression using <literal>libsForQt5.callPackage</literal> instead of <literal>callPackage</literal>.
|
||||
Import dependencies unqualified, i.e., <literal>qtbase</literal> not <literal>qt5.qtbase</literal>.
|
||||
<emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Qt 5 maintains strict backward compatibility, so it is generally best to build an application package against the latest version using the <varname>libsForQt5</varname> library set.
|
||||
In case a package does not build with the latest Qt version, it is possible to pick a set pinned to a particular version, e.g. <varname>libsForQt55</varname> for Qt 5.5, if that is the latest version the package supports.
|
||||
If a package must be pinned to an older Qt version, be sure to file a bug upstream;
|
||||
because Qt is strictly backwards-compatible, any incompatibility is by definition a bug in the application.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When testing applications in Nixpkgs, it is a common practice to build the package with <literal>nix-build</literal> and run it using the created symbolic link.
|
||||
This will not work with Qt applications, however, because they have many hard runtime requirements that can only be guaranteed if the package is actually installed.
|
||||
To test a Qt application, install it with <literal>nix-env</literal> or run it inside <literal>nix-shell</literal>.
|
||||
</para>
|
||||
<para>Many of the considerations above also apply to KDE packages,
|
||||
especially the need to set the correct environment variables at
|
||||
runtime. To ensure that this is done, invoke <literal>wrapKDEProgram
|
||||
<replaceable>program</replaceable></literal> during
|
||||
installation. <literal>wrapKDEProgram</literal> also generates a
|
||||
<literal>ksycoca</literal> database so that required data and services
|
||||
can be found. Like its Qt counterpart,
|
||||
<literal>wrapKDEProgram</literal> accepts the same options as
|
||||
<literal>makeWrapper</literal>.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
|
||||
<title>Ruby</title>
|
||||
|
||||
<para>There currently is support to bundle applications that are packaged as
|
||||
Ruby gems. The utility "bundix" allows you to write a
|
||||
<filename>Gemfile</filename>, let bundler create a
|
||||
<filename>Gemfile.lock</filename>, and then convert this into a nix
|
||||
expression that contains all Gem dependencies automatically.
|
||||
</para>
|
||||
<para>There currently is support to bundle applications that are packaged as Ruby gems. The utility "bundix" allows you to write a <filename>Gemfile</filename>, let bundler create a <filename>Gemfile.lock</filename>, and then convert
|
||||
this into a nix expression that contains all Gem dependencies automatically.</para>
|
||||
|
||||
<para>For example, to package sensu, we did:</para>
|
||||
<para>For example, to package sensu, we did:</para>
|
||||
|
||||
<screen>
|
||||
<![CDATA[$ cd pkgs/servers/monitoring
|
||||
@@ -20,7 +16,8 @@ $ cd sensu
|
||||
$ cat > Gemfile
|
||||
source 'https://rubygems.org'
|
||||
gem 'sensu'
|
||||
$ $(nix-build '<nixpkgs>' -A bundix --no-out-link)/bin/bundix --magic
|
||||
$ nix-shell -p bundler --command "bundler package --path /tmp/vendor/bundle"
|
||||
$ $(nix-build '<nixpkgs>' -A bundix)/bin/bundix
|
||||
$ cat > default.nix
|
||||
{ lib, bundlerEnv, ruby }:
|
||||
|
||||
@@ -29,8 +26,9 @@ bundlerEnv rec {
|
||||
|
||||
version = (import gemset).sensu.version;
|
||||
inherit ruby;
|
||||
# expects Gemfile, Gemfile.lock and gemset.nix in the same directory
|
||||
gemdir = ./.;
|
||||
gemfile = ./Gemfile;
|
||||
lockfile = ./Gemfile.lock;
|
||||
gemset = ./gemset.nix;
|
||||
|
||||
meta = with lib; {
|
||||
description = "A monitoring framework that aims to be simple, malleable, and scalable";
|
||||
@@ -42,61 +40,15 @@ bundlerEnv rec {
|
||||
}]]>
|
||||
</screen>
|
||||
|
||||
<para>Please check in the <filename>Gemfile</filename>,
|
||||
<filename>Gemfile.lock</filename> and the
|
||||
<filename>gemset.nix</filename> so future updates can be run easily.
|
||||
<para>Please check in the <filename>Gemfile</filename>, <filename>Gemfile.lock</filename> and the <filename>gemset.nix</filename> so future updates can be run easily.
|
||||
</para>
|
||||
|
||||
<para>For tools written in Ruby - i.e. where the desire is to install
|
||||
a package and then execute e.g. <command>rake</command> at the command
|
||||
line, there is an alternative builder called <literal>bundlerApp</literal>.
|
||||
Set up the <filename>gemset.nix</filename> the same way, and then, for
|
||||
example:
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
<![CDATA[{ lib, bundlerApp }:
|
||||
|
||||
bundlerApp {
|
||||
pname = "corundum";
|
||||
gemdir = ./.;
|
||||
exes = [ "corundum-skel" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Tool and libraries for maintaining Ruby gems.";
|
||||
homepage = https://github.com/nyarly/corundum;
|
||||
license = licenses.mit;
|
||||
maintainers = [ maintainers.nyarly ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}]]>
|
||||
</screen>
|
||||
|
||||
<para>The chief advantage of <literal>bundlerApp</literal> over
|
||||
<literal>bundlerEnv</literal> is the executables introduced in the
|
||||
environment are precisely those selected in the <literal>exes</literal>
|
||||
list, as opposed to <literal>bundlerEnv</literal> which adds all the
|
||||
executables made available by gems in the gemset, which can mean e.g.
|
||||
<command>rspec</command> or <command>rake</command> in unpredictable
|
||||
versions available from various packages.
|
||||
</para>
|
||||
|
||||
<para>Resulting derivations for both builders also have two helpful
|
||||
attributes, <literal>env</literal> and <literal>wrappedRuby</literal>.
|
||||
The first one allows one to quickly drop into
|
||||
<command>nix-shell</command> with the specified environment present.
|
||||
E.g. <command>nix-shell -A sensu.env</command> would give you an
|
||||
environment with Ruby preset so it has all the libraries necessary
|
||||
for <literal>sensu</literal> in its paths. The second one can be
|
||||
used to make derivations from custom Ruby scripts which have
|
||||
<filename>Gemfile</filename>s with their dependencies specified. It is
|
||||
a derivation with <command>ruby</command> wrapped so it can find all
|
||||
the needed dependencies. For example, to make a derivation
|
||||
<literal>my-script</literal> for a <filename>my-script.rb</filename>
|
||||
(which should be placed in <filename>bin</filename>) you should run
|
||||
<command>bundix</command> as specified above and then use
|
||||
<literal>bundlerEnv</literal> like this:
|
||||
</para>
|
||||
<para>Resulting derivations also have two helpful items, <literal>env</literal> and <literal>wrapper</literal>. The first one allows one to quickly drop into
|
||||
<command>nix-shell</command> with the specified environment present. E.g. <command>nix-shell -A sensu.env</command> would give you an environment with Ruby preset
|
||||
so it has all the libraries necessary for <literal>sensu</literal> in its paths. The second one can be used to make derivations from custom Ruby scripts which have
|
||||
<filename>Gemfile</filename>s with their dependencies specified. It is a derivation with <command>ruby</command> wrapped so it can find all the needed dependencies.
|
||||
For example, to make a derivation <literal>my-script</literal> for a <filename>my-script.rb</filename> (which should be placed in <filename>bin</filename>) you should
|
||||
run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> lile this:</para>
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[let env = bundlerEnv {
|
||||
@@ -110,9 +62,13 @@ the needed dependencies. For example, to make a derivation
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
name = "my-script";
|
||||
buildInputs = [ env.wrappedRuby ];
|
||||
|
||||
buildInputs = [ env.wrapper ];
|
||||
|
||||
script = ./my-script.rb;
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
install -D -m755 $script $out/bin/my-script
|
||||
patchShebangs $out/bin/my-script
|
||||
'';
|
||||
@@ -120,3 +76,4 @@ in stdenv.mkDerivation {
|
||||
</programlisting>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
---
|
||||
title: Rust
|
||||
author: Matthias Beyer
|
||||
date: 2017-03-05
|
||||
---
|
||||
|
||||
# User's Guide to the Rust Infrastructure
|
||||
|
||||
To install the rust compiler and cargo put
|
||||
|
||||
```
|
||||
rustStable.rustc
|
||||
rustStable.cargo
|
||||
```
|
||||
|
||||
into the `environment.systemPackages` or bring them into scope with
|
||||
`nix-shell -p rustStable.rustc -p rustStable.cargo`.
|
||||
|
||||
There are also `rustBeta` and `rustNightly` package sets available.
|
||||
These are not updated very regulary. For daily builds use either rustup from
|
||||
nixpkgs or use the [Rust nightlies overlay](#using-the-rust-nightlies-overlay).
|
||||
|
||||
## Packaging Rust applications
|
||||
|
||||
Rust applications are packaged by using the `buildRustPackage` helper from `rustPlatform`:
|
||||
|
||||
```
|
||||
with rustPlatform;
|
||||
|
||||
buildRustPackage rec {
|
||||
name = "ripgrep-${version}";
|
||||
version = "0.4.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "BurntSushi";
|
||||
repo = "ripgrep";
|
||||
rev = "${version}";
|
||||
sha256 = "0y5d1n6hkw85jb3rblcxqas2fp82h3nghssa4xqrhqnz25l799pj";
|
||||
};
|
||||
|
||||
depsSha256 = "0q68qyl2h6i0qsz82z840myxlnjay8p1w5z7hfyr8fqp7wgwa9cx";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep";
|
||||
homepage = https://github.com/BurntSushi/ripgrep;
|
||||
license = with licenses; [ unlicense ];
|
||||
maintainers = [ maintainers.tailhook ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
`buildRustPackage` requires a `depsSha256` attribute which is computed over
|
||||
all crate sources of this package. Currently it is obtained by inserting a
|
||||
fake checksum into the expression and building the package once. The correct
|
||||
checksum can be then take from the failed build.
|
||||
|
||||
To install crates with nix there is also an experimental project called
|
||||
[nixcrates](https://github.com/fractalide/nixcrates).
|
||||
|
||||
## Using the Rust nightlies overlay
|
||||
|
||||
Mozilla provides an overlay for nixpkgs to bring a nightly version of Rust into scope.
|
||||
This overlay can _also_ be used to install recent unstable or stable versions
|
||||
of Rust, if desired.
|
||||
|
||||
To use this overlay, clone
|
||||
[nixpkgs-mozilla](https://github.com/mozilla/nixpkgs-mozilla),
|
||||
and create a symbolic link to the file
|
||||
[rust-overlay.nix](https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix)
|
||||
in the `~/.config/nixpkgs/overlays` directory.
|
||||
|
||||
$ git clone https://github.com/mozilla/nixpkgs-mozilla.git
|
||||
$ mkdir -p ~/.config/nixpkgs/overlays
|
||||
$ ln -s $(pwd)/nixpkgs-mozilla/rust-overlay.nix ~/.config/nixpkgs/overlays/rust-overlay.nix
|
||||
|
||||
The latest version can be installed with the following command:
|
||||
|
||||
$ nix-env -Ai nixos.rustChannels.stable.rust
|
||||
|
||||
Or using the attribute with nix-shell:
|
||||
|
||||
$ nix-shell -p nixos.rustChannels.stable.rust
|
||||
|
||||
To install the beta or nightly channel, "stable" should be substituted by
|
||||
"nightly" or "beta", or
|
||||
use the function provided by this overlay to pull a version based on a
|
||||
build date.
|
||||
|
||||
The overlay automatically updates itself as it uses the same source as
|
||||
[rustup](https://www.rustup.rs/).
|
||||
@@ -35,7 +35,6 @@ texlive.combine {
|
||||
You can list packages e.g. by <command>nix-repl</command>.
|
||||
<programlisting>
|
||||
$ nix-repl
|
||||
nix-repl> :l <nixpkgs>
|
||||
nix-repl> texlive.collection-<TAB>
|
||||
</programlisting>
|
||||
</para></listitem>
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
---
|
||||
title: User's Guide for Vim in Nixpkgs
|
||||
author: Marc Weber
|
||||
date: 2016-06-25
|
||||
---
|
||||
# User's Guide to Vim Plugins/Addons/Bundles/Scripts in Nixpkgs
|
||||
|
||||
You'll get a vim(-your-suffix) in PATH also loading the plugins you want.
|
||||
Loading can be deferred; see examples.
|
||||
|
||||
Vim packages, VAM (=vim-addon-manager) and Pathogen are supported to load
|
||||
packages.
|
||||
|
||||
## Custom configuration
|
||||
|
||||
Adding custom .vimrc lines can be done using the following code:
|
||||
|
||||
```
|
||||
vim_configurable.customize {
|
||||
name = "vim-with-plugins";
|
||||
|
||||
vimrcConfig.customRC = ''
|
||||
set hidden
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
## Vim packages
|
||||
|
||||
To store you plugins in Vim packages the following example can be used:
|
||||
|
||||
```
|
||||
vim_configurable.customize {
|
||||
vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
|
||||
# loaded on launch
|
||||
start = [ youcompleteme fugitive ];
|
||||
# manually loadable by calling `:packadd $plugin-name`
|
||||
opt = [ phpCompletion elm-vim ];
|
||||
# To automatically load a plugin when opening a filetype, add vimrc lines like:
|
||||
# autocmd FileType php :packadd phpCompletion
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## VAM
|
||||
|
||||
### dependencies by Vim plugins
|
||||
|
||||
VAM introduced .json files supporting dependencies without versioning
|
||||
assuming that "using latest version" is ok most of the time.
|
||||
|
||||
### Example
|
||||
|
||||
First create a vim-scripts file having one plugin name per line. Example:
|
||||
|
||||
"tlib"
|
||||
{'name': 'vim-addon-sql'}
|
||||
{'filetype_regex': '\%(vim)$', 'names': ['reload', 'vim-dev-plugin']}
|
||||
|
||||
Such vim-scripts file can be read by VAM as well like this:
|
||||
|
||||
call vam#Scripts(expand('~/.vim-scripts'), {})
|
||||
|
||||
Create a default.nix file:
|
||||
|
||||
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }:
|
||||
nixpkgs.vim_configurable.customize { name = "vim"; vimrcConfig.vam.pluginDictionaries = [ "vim-addon-vim2nix" ]; }
|
||||
|
||||
Create a generate.vim file:
|
||||
|
||||
ActivateAddons vim-addon-vim2nix
|
||||
let vim_scripts = "vim-scripts"
|
||||
call nix#ExportPluginsForNix({
|
||||
\ 'path_to_nixpkgs': eval('{"'.substitute(substitute(substitute($NIX_PATH, ':', ',', 'g'), '=',':', 'g'), '\([:,]\)', '"\1"',"g").'"}')["nixpkgs"],
|
||||
\ 'cache_file': '/tmp/vim2nix-cache',
|
||||
\ 'try_catch': 0,
|
||||
\ 'plugin_dictionaries': ["vim-addon-manager"]+map(readfile(vim_scripts), 'eval(v:val)')
|
||||
\ })
|
||||
|
||||
Then run
|
||||
|
||||
nix-shell -p vimUtils.vim_with_vim2nix --command "vim -c 'source generate.vim'"
|
||||
|
||||
You should get a Vim buffer with the nix derivations (output1) and vam.pluginDictionaries (output2).
|
||||
You can add your vim to your system's configuration file like this and start it by "vim-my":
|
||||
|
||||
my-vim =
|
||||
let plugins = let inherit (vimUtils) buildVimPluginFrom2Nix; in {
|
||||
copy paste output1 here
|
||||
}; in vim_configurable.customize {
|
||||
name = "vim-my";
|
||||
|
||||
vimrcConfig.vam.knownPlugins = plugins; # optional
|
||||
vimrcConfig.vam.pluginDictionaries = [
|
||||
copy paste output2 here
|
||||
];
|
||||
|
||||
# Pathogen would be
|
||||
# vimrcConfig.pathogen.knownPlugins = plugins; # plugins
|
||||
# vimrcConfig.pathogen.pluginNames = ["tlib"];
|
||||
};
|
||||
|
||||
|
||||
Sample output1:
|
||||
|
||||
"reload" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
|
||||
name = "reload";
|
||||
src = fetchgit {
|
||||
url = "git://github.com/xolox/vim-reload";
|
||||
rev = "0a601a668727f5b675cb1ddc19f6861f3f7ab9e1";
|
||||
sha256 = "0vb832l9yxj919f5hfg6qj6bn9ni57gnjd3bj7zpq7d4iv2s4wdh";
|
||||
};
|
||||
dependencies = ["nim-misc"];
|
||||
|
||||
};
|
||||
[...]
|
||||
|
||||
Sample output2:
|
||||
|
||||
[
|
||||
''vim-addon-manager''
|
||||
''tlib''
|
||||
{ "name" = ''vim-addon-sql''; }
|
||||
{ "filetype_regex" = ''\%(vim)$$''; "names" = [ ''reload'' ''vim-dev-plugin'' ]; }
|
||||
]
|
||||
|
||||
|
||||
## Important repositories
|
||||
|
||||
- [vim-pi](https://bitbucket.org/vimcommunity/vim-pi) is a plugin repository
|
||||
from VAM plugin manager meant to be used by others as well used by
|
||||
|
||||
- [vim2nix](http://github.com/MarcWeber/vim-addon-vim2nix) which generates the
|
||||
.nix code
|
||||
|
||||
@@ -13,16 +13,13 @@
|
||||
<xi:include href="quick-start.xml" />
|
||||
<xi:include href="stdenv.xml" />
|
||||
<xi:include href="multiple-output.xml" />
|
||||
<xi:include href="cross-compilation.xml" />
|
||||
<xi:include href="configuration.xml" />
|
||||
<xi:include href="functions.xml" />
|
||||
<xi:include href="meta.xml" />
|
||||
<xi:include href="languages-frameworks/index.xml" />
|
||||
<xi:include href="package-notes.xml" />
|
||||
<xi:include href="overlays.xml" />
|
||||
<xi:include href="coding-conventions.xml" />
|
||||
<xi:include href="submitting-changes.xml" />
|
||||
<xi:include href="reviewing-contributions.xml" />
|
||||
<xi:include href="contributing.xml" />
|
||||
|
||||
</book>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
<section><title>Installing a split package</title>
|
||||
<para>When installing a package via <varname>systemPackages</varname> or <command>nix-env</command> you have several options:</para>
|
||||
<warning><para>Currently <command>nix-env</command> almost always installs all outputs until https://github.com/NixOS/nix/pull/815 gets merged.</para></warning>
|
||||
<itemizedlist>
|
||||
<listitem><para>You can install particular outputs explicitly, as each is available in the Nix language as an attribute of the package. The <varname>outputs</varname> attribute contains a list of output names.</para></listitem>
|
||||
<listitem><para>You can let it use the default outputs. These are handled by <varname>meta.outputsToInstall</varname> attribute that contains a list of output names.</para>
|
||||
@@ -28,15 +29,15 @@
|
||||
|
||||
<section><title>Using a split package</title>
|
||||
<para>In the Nix language the individual outputs can be reached explicitly as attributes, e.g. <varname>coreutils.info</varname>, but the typical case is just using packages as build inputs.</para>
|
||||
<para>When a multiple-output derivation gets into a build input of another derivation, the <varname>dev</varname> output is added if it exists, otherwise the first output is added. In addition to that, <varname>propagatedBuildOutputs</varname> of that package which by default contain <varname>$outputBin</varname> and <varname>$outputLib</varname> are also added. (See <xref linkend="multiple-output-file-type-groups" />.)</para>
|
||||
<para>When a multiple-output derivation gets into a build input of another derivation, the first output is added (<varname>.dev</varname> by convention) and also <varname>propagatedBuildOutputs</varname> of that package which by default contain <varname>$outputBin</varname> and <varname>$outputLib</varname>. (See <xref linkend="multiple-output-file-type-groups" />.)</para>
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>Writing a split derivation</title>
|
||||
<para>Here you find how to write a derivation that produces multiple outputs.</para>
|
||||
<para>In nixpkgs there is a framework supporting multiple-output derivations. It tries to cover most cases by default behavior. You can find the source separated in <<filename>nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh</filename>>; it's relatively well-readable. The whole machinery is triggered by defining the <varname>outputs</varname> attribute to contain the list of desired output names (strings).</para>
|
||||
<programlisting>outputs = [ "bin" "dev" "out" "doc" ];</programlisting>
|
||||
<para>Often such a single line is enough. For each output an equally named environment variable is passed to the builder and contains the path in nix store for that output. By convention, the first output should contain the executable programs provided by the package as that output is used by Nix in string conversions, allowing references to binaries like <literal>${pkgs.perl}/bin/perl</literal> to always work. Typically you also want to have the main <varname>out</varname> output, as it catches any files that didn't get elsewhere.</para>
|
||||
<programlisting>outputs = [ "dev" "out" "bin" "doc" ];</programlisting>
|
||||
<para>Often such a single line is enough. For each output an equally named environment variable is passed to the builder and contains the path in nix store for that output. By convention, the first output should usually be <varname>dev</varname>; typically you also want to have the main <varname>out</varname> output, as it catches any files that didn't get elsewhere.</para>
|
||||
|
||||
<note><para>There is a special handling of the <varname>debug</varname> output, described at <xref linkend="stdenv-separateDebugInfo" />.</para></note>
|
||||
|
||||
@@ -44,48 +45,34 @@
|
||||
<title>File type groups</title>
|
||||
<para>The support code currently recognizes some particular kinds of outputs and either instructs the build system of the package to put files into their desired outputs or it moves the files during the fixup phase. Each group of file types has an <varname>outputFoo</varname> variable specifying the output name where they should go. If that variable isn't defined by the derivation writer, it is guessed – a default output name is defined, falling back to other possibilities if the output isn't defined.</para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><varname>
|
||||
$outputDev</varname></term><listitem><para>
|
||||
is for development-only files. These include C(++) headers, pkg-config, cmake and aclocal files. They go to <varname>dev</varname> or <varname>out</varname> by default.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</para></listitem></varlistentry>
|
||||
<varlistentry><term><varname>
|
||||
$outputBin</varname></term><listitem><para>
|
||||
is meant for user-facing binaries, typically residing in bin/. They go to <varname>bin</varname> or <varname>out</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
</para></listitem></varlistentry>
|
||||
<varlistentry><term><varname>
|
||||
$outputLib</varname></term><listitem><para>
|
||||
is meant for libraries, typically residing in <filename>lib/</filename> and <filename>libexec/</filename>. They go to <varname>lib</varname> or <varname>out</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
</para></listitem></varlistentry>
|
||||
<varlistentry><term><varname>
|
||||
$outputDoc</varname></term><listitem><para>
|
||||
is for user documentation, typically residing in <filename>share/doc/</filename>. It goes to <varname>doc</varname> or <varname>out</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
</para></listitem></varlistentry>
|
||||
<varlistentry><term><varname>
|
||||
$outputDevdoc</varname></term><listitem><para>
|
||||
is for <emphasis>developer</emphasis> documentation. Currently we count gtk-doc in there. It goes to <varname>devdoc</varname> or is removed (!) by default. This is because e.g. gtk-doc tends to be rather large and completely unused by nixpkgs users.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
$outputDocdev</varname></term><listitem><para>
|
||||
is for <emphasis>developer</emphasis> documentation. Currently we count gtk-doc and man3 pages in there. It goes to <varname>docdev</varname> or is removed (!) by default. This is because e.g. gtk-doc tends to be rather large and completely unused by nixpkgs users.
|
||||
</para></listitem></varlistentry>
|
||||
<varlistentry><term><varname>
|
||||
$outputMan</varname></term><listitem><para>
|
||||
is for man pages (except for section 3). They go to <varname>man</varname> or <varname>$outputBin</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
<varlistentry><term><varname>
|
||||
$outputDevman</varname></term><listitem><para>
|
||||
is for section 3 man pages. They go to <varname>devman</varname> or <varname>$outputMan</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
is for man pages (except for section 3). They go to <varname>man</varname> or <varname>doc</varname> or <varname>$outputBin</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
<varlistentry><term><varname>
|
||||
$outputInfo</varname></term><listitem><para>
|
||||
is for info pages. They go to <varname>info</varname> or <varname>$outputBin</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
|
||||
is for info pages. They go to <varname>info</varname> or <varname>doc</varname> or <varname>$outputMan</varname> by default.
|
||||
</para></listitem></varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
@@ -101,3 +88,4 @@
|
||||
</section><!--Writing a split derivation-->
|
||||
|
||||
</chapter>
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ stdenv.mkDerivation {
|
||||
builder = ./builder.sh;
|
||||
src = fetchurl {
|
||||
url = http://ftp.nluug.nl/gnu/binutils/binutils-2.16.1.tar.bz2;
|
||||
sha256 = "1ian3kwh2vg6hr3ymrv48s04gijs539vzrq62xr76bxbhbwnz2np";
|
||||
md5 = "6a9d529efb285071dad10e1f3d2b2967";
|
||||
};
|
||||
inherit noSysDirs;
|
||||
configureFlags = "--target=arm-linux";
|
||||
@@ -81,11 +81,11 @@ Step 2: build kernel headers for the target architecture
|
||||
assert stdenv.system == "i686-linux";
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "linux-headers-2.6.13.1-arm";
|
||||
name = "linux-headers-2.6.13.4-arm";
|
||||
builder = ./builder.sh;
|
||||
src = fetchurl {
|
||||
url = http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.1.tar.bz2;
|
||||
sha256 = "12qxmc827fjhaz53kjy7vyrzsaqcg78amiqsb3qm20z26w705lma";
|
||||
url = http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.4.tar.bz2;
|
||||
md5 = "94768d7eef90a9d8174639b2a7d3f58d";
|
||||
};
|
||||
}
|
||||
---
|
||||
@@ -152,7 +152,9 @@ stdenv.mkDerivation {
|
||||
builder = ./builder.sh;
|
||||
src = fetchurl {
|
||||
url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.0.2/gcc-core-4.0.2.tar.bz2;
|
||||
sha256 = "02fxh0asflm8825w23l2jq1wvs7hbnam0jayrivg7zdv2ifnc0rc";
|
||||
md5 = "f7781398ada62ba255486673e6274b26";
|
||||
#url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.0.2/gcc-4.0.2.tar.bz2;
|
||||
#md5 = "a659b8388cac9db2b13e056e574ceeb0";
|
||||
};
|
||||
# !!! apply only if noSysDirs is set
|
||||
patches = [./no-sys-dirs.patch ./gcc-inhibit.patch];
|
||||
|
||||
14
doc/old/update-upstream-data.txt
Normal file
14
doc/old/update-upstream-data.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Semi-automatic source information updating using "update-upstream-data.sh" script and "src-{,info-}for-*.nix"
|
||||
|
||||
1. Recognizing when a pre-existing package uses this mechanism.
|
||||
|
||||
Packages using this automatical update mechanism have src-info-for-default.nix and src-for-default.nix next to default.nix. src-info-for-default.nix describes getting the freshest source from upstream web site; src-for-default.nix is a generated file with the current data about used source. Both files define a simple attrSet.
|
||||
|
||||
src-info-for-default.nix (for a file grabbed via http) contains at least downloadPage attribute - it is the page we need to look at to find out the latest version. It also contains baseName that is used for automatical generation of package name containing version. It can contain extra data for trickier cases.
|
||||
|
||||
src-for-default.nix will contain advertisedUrl (raw URL chosen on the site; its change prompts regeneration of source data), url for fetchurl, hash, version retrieved from the download URL and suggested package name.
|
||||
|
||||
2. Updating a package
|
||||
|
||||
nixpkgs/pkgs/build-support/upstream-updater directory contains some scripts. The worker script is called update-upstream-data.sh. This script requires main expression name (e.g. default.nix). It can optionally accpet a second parameter, URL which will be used instead of getting one by parsing the downloadPage (version extraction, mirror URL creation etc. will still be run). After running the script, check src-for-default.nix (or replace default.nix with expression name, if there are seceral expressions in the directory) for new version information.
|
||||
|
||||
134
doc/overlays.xml
134
doc/overlays.xml
@@ -1,134 +0,0 @@
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-overlays">
|
||||
|
||||
<title>Overlays</title>
|
||||
|
||||
<para>This chapter describes how to extend and change Nixpkgs packages using
|
||||
overlays. Overlays are used to add layers in the fix-point used by Nixpkgs
|
||||
to compose the set of all packages.</para>
|
||||
|
||||
<para>Nixpkgs can be configured with a list of overlays, which are
|
||||
applied in order. This means that the order of the overlays can be significant
|
||||
if multiple layers override the same package.</para>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
<section xml:id="sec-overlays-install">
|
||||
<title>Installing overlays</title>
|
||||
|
||||
<para>The list of overlays is determined as follows.</para>
|
||||
|
||||
<para>If the <varname>overlays</varname> argument is not provided explicitly, we look for overlays in a path. The path
|
||||
is determined as follows:
|
||||
|
||||
<orderedlist>
|
||||
|
||||
<listitem>
|
||||
<para>First, if an <varname>overlays</varname> argument to the nixpkgs function itself is given,
|
||||
then that is used.</para>
|
||||
|
||||
<para>This can be passed explicitly when importing nipxkgs, for example
|
||||
<literal>import <nixpkgs> { overlays = [ overlay1 overlay2 ]; }</literal>.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Otherwise, if the Nix path entry <literal><nixpkgs-overlays></literal> exists, we look for overlays
|
||||
at that path, as described below.</para>
|
||||
|
||||
<para>See the section on <literal>NIX_PATH</literal> in the Nix manual for more details on how to
|
||||
set a value for <literal><nixpkgs-overlays>.</literal></para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>If one of <filename>~/.config/nixpkgs/overlays.nix</filename> and
|
||||
<filename>~/.config/nixpkgs/overlays/</filename> exists, then we look for overlays at that path, as
|
||||
described below. It is an error if both exist.</para>
|
||||
</listitem>
|
||||
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<para>If we are looking for overlays at a path, then there are two cases:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>If the path is a file, then the file is imported as a Nix expression and used as the list of
|
||||
overlays.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>If the path is a directory, then we take the content of the directory, order it
|
||||
lexicographically, and attempt to interpret each as an overlay by:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Importing the file, if it is a <literal>.nix</literal> file.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Importing a top-level <filename>default.nix</filename> file, if it is a directory.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>On a NixOS system the value of the <literal>nixpkgs.overlays</literal> option, if present,
|
||||
is passed to the system Nixpkgs directly as an argument. Note that this does not affect the overlays for
|
||||
non-NixOS operations (e.g. <literal>nix-env</literal>), which are looked up independently.</para>
|
||||
|
||||
<para>The <filename>overlays.nix</filename> option therefore provides a convenient way to use the same
|
||||
overlays for a NixOS system configuration and user configuration: the same file can be used
|
||||
as <filename>overlays.nix</filename> and imported as the value of <literal>nixpkgs.overlays</literal>.</para>
|
||||
|
||||
</section>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
<section xml:id="sec-overlays-definition">
|
||||
<title>Defining overlays</title>
|
||||
|
||||
<para>Overlays are Nix functions which accept two arguments,
|
||||
conventionally called <varname>self</varname> and <varname>super</varname>,
|
||||
and return a set of packages. For example, the following is a valid overlay.</para>
|
||||
|
||||
<programlisting>
|
||||
self: super:
|
||||
|
||||
{
|
||||
boost = super.boost.override {
|
||||
python = self.python3;
|
||||
};
|
||||
rr = super.callPackage ./pkgs/rr {
|
||||
stdenv = self.stdenv_32bit;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
<para>The first argument (<varname>self</varname>) corresponds to the final package
|
||||
set. You should use this set for the dependencies of all packages specified in your
|
||||
overlay. For example, all the dependencies of <varname>rr</varname> in the example above come
|
||||
from <varname>self</varname>, as well as the overridden dependencies used in the
|
||||
<varname>boost</varname> override.</para>
|
||||
|
||||
<para>The second argument (<varname>super</varname>)
|
||||
corresponds to the result of the evaluation of the previous stages of
|
||||
Nixpkgs. It does not contain any of the packages added by the current
|
||||
overlay, nor any of the following overlays. This set should be used either
|
||||
to refer to packages you wish to override, or to access functions defined
|
||||
in Nixpkgs. For example, the original recipe of <varname>boost</varname>
|
||||
in the above example, comes from <varname>super</varname>, as well as the
|
||||
<varname>callPackage</varname> function.</para>
|
||||
|
||||
<para>The value returned by this function should be a set similar to
|
||||
<filename>pkgs/top-level/all-packages.nix</filename>, containing
|
||||
overridden and/or new packages.</para>
|
||||
|
||||
<para>Overlays are similar to other methods for customizing Nixpkgs, in particular
|
||||
the <literal>packageOverrides</literal> attribute described in <xref linkend="sec-modify-via-packageOverrides"/>.
|
||||
Indeed, <literal>packageOverrides</literal> acts as an overlay with only the
|
||||
<varname>super</varname> argument. It is therefore appropriate for basic use,
|
||||
but overlays are more powerful and easier to distribute.</para>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
@@ -278,7 +278,7 @@ packageOverrides = pkgs: {
|
||||
</screen>
|
||||
|
||||
to your Nixpkgs configuration
|
||||
(<filename>~/.config/nixpkgs/config.nix</filename>) and install it by
|
||||
(<filename>~/.nixpkgs/config.nix</filename>) and install it by
|
||||
running <command>nix-env -f '<nixpkgs>' -iA
|
||||
myEclipse</command> and afterward run Eclipse as usual. It is
|
||||
possible to find out which plugins are available for installation
|
||||
@@ -366,33 +366,15 @@ it. Place the resulting <filename>package.nix</filename> file into
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-shell-helpers">
|
||||
<section xml:id="sec-autojump">
|
||||
|
||||
<title>Interactive shell helpers</title>
|
||||
<title>Autojump</title>
|
||||
|
||||
<para>
|
||||
Some packages provide the shell integration to be more useful. But
|
||||
unlike other systems, nix doesn't have a standard share directory
|
||||
location. This is why a bunch <command>PACKAGE-share</command>
|
||||
scripts are shipped that print the location of the corresponding
|
||||
shared folder.
|
||||
|
||||
Current list of such packages is as following:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>autojump</literal>: <command>autojump-share</command>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>fzf</literal>: <command>fzf-share</command>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
E.g. <literal>autojump</literal> can then used in the .bashrc like this:
|
||||
autojump needs the shell integration to be useful but unlike other systems,
|
||||
nix doesn't have a standard share directory location. This is why a
|
||||
<command>autojump-share</command> script is shipped that prints the location
|
||||
of the shared folder. This can then be used in the .bashrc like this:
|
||||
<screen>
|
||||
source "$(autojump-share)/autojump.bash"
|
||||
</screen>
|
||||
@@ -400,274 +382,4 @@ it. Place the resulting <filename>package.nix</filename> file into
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-steam">
|
||||
|
||||
<title>Steam</title>
|
||||
|
||||
<section xml:id="sec-steam-nix">
|
||||
|
||||
<title>Steam in Nix</title>
|
||||
|
||||
<para>
|
||||
Steam is distributed as a <filename>.deb</filename> file, for now only
|
||||
as an i686 package (the amd64 package only has documentation).
|
||||
When unpacked, it has a script called <filename>steam</filename> that
|
||||
in ubuntu (their target distro) would go to <filename>/usr/bin
|
||||
</filename>. When run for the first time, this script copies some
|
||||
files to the user's home, which include another script that is the
|
||||
ultimate responsible for launching the steam binary, which is also
|
||||
in $HOME.
|
||||
</para>
|
||||
<para>
|
||||
Nix problems and constraints:
|
||||
<itemizedlist>
|
||||
<listitem><para>We don't have <filename>/bin/bash</filename> and many
|
||||
scripts point there. Similarly for <filename>/usr/bin/python</filename>
|
||||
.</para></listitem>
|
||||
<listitem><para>We don't have the dynamic loader in <filename>/lib
|
||||
</filename>.</para></listitem>
|
||||
<listitem><para>The <filename>steam.sh</filename> script in $HOME can
|
||||
not be patched, as it is checked and rewritten by steam.</para></listitem>
|
||||
<listitem><para>The steam binary cannot be patched, it's also checked.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
The current approach to deploy Steam in NixOS is composing a FHS-compatible
|
||||
chroot environment, as documented
|
||||
<link xlink:href="http://sandervanderburg.blogspot.nl/2013/09/composing-fhs-compatible-chroot.html">here</link>.
|
||||
This allows us to have binaries in the expected paths without disrupting the system,
|
||||
and to avoid patching them to work in a non FHS environment.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-steam-play">
|
||||
|
||||
<title>How to play</title>
|
||||
|
||||
<para>
|
||||
For 64-bit systems it's important to have
|
||||
<programlisting>hardware.opengl.driSupport32Bit = true;</programlisting>
|
||||
in your <filename>/etc/nixos/configuration.nix</filename>. You'll also need
|
||||
<programlisting>hardware.pulseaudio.support32Bit = true;</programlisting>
|
||||
if you are using PulseAudio - this will enable 32bit ALSA apps integration.
|
||||
To use the Steam controller, you need to add
|
||||
<programlisting>services.udev.extraRules = ''
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"
|
||||
KERNEL=="uinput", MODE="0660", GROUP="users", OPTIONS+="static_node=uinput"
|
||||
'';</programlisting>
|
||||
to your configuration.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-steam-troub">
|
||||
|
||||
<title>Troubleshooting</title>
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>Steam fails to start. What do I do?</term>
|
||||
<listitem><para>Try to run
|
||||
<programlisting>strace steam</programlisting>
|
||||
to see what is causing steam to fail.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Using the FOSS Radeon drivers</term>
|
||||
<listitem><itemizedlist><listitem><para>
|
||||
The open source radeon drivers need a newer libc++ than is provided
|
||||
by the default runtime, which leads to a crash on launch. Use
|
||||
<programlisting>environment.systemPackages = [(pkgs.steam.override { newStdcpp = true; })];</programlisting>
|
||||
in your config if you get an error like
|
||||
<programlisting>
|
||||
libGL error: unable to load driver: radeonsi_dri.so
|
||||
libGL error: driver pointer missing
|
||||
libGL error: failed to load driver: radeonsi
|
||||
libGL error: unable to load driver: swrast_dri.so
|
||||
libGL error: failed to load driver: swrast</programlisting></para></listitem>
|
||||
<listitem><para>
|
||||
Steam ships statically linked with a version of libcrypto that
|
||||
conflics with the one dynamically loaded by radeonsi_dri.so.
|
||||
If you get the error
|
||||
<programlisting>steam.sh: line 713: 7842 Segmentation fault (core dumped)</programlisting>
|
||||
have a look at <link xlink:href="https://github.com/NixOS/nixpkgs/pull/20269">this pull request</link>.
|
||||
</para></listitem>
|
||||
|
||||
</itemizedlist></listitem></varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Java</term>
|
||||
<listitem><orderedlist>
|
||||
<listitem><para>
|
||||
There is no java in steam chrootenv by default. If you get a message like
|
||||
<programlisting>/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found</programlisting>
|
||||
You need to add
|
||||
<programlisting> steam.override { withJava = true; };</programlisting>
|
||||
to your configuration.
|
||||
</para></listitem>
|
||||
</orderedlist></listitem></varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-steam-run">
|
||||
|
||||
<title>steam-run</title>
|
||||
<para>
|
||||
The FHS-compatible chroot used for steam can also be used to run
|
||||
other linux games that expect a FHS environment.
|
||||
To do it, add
|
||||
<programlisting>pkgs.(steam.override {
|
||||
nativeOnly = true;
|
||||
newStdcpp = true;
|
||||
}).run</programlisting>
|
||||
to your configuration, rebuild, and run the game with
|
||||
<programlisting>steam-run ./foo</programlisting>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-emacs">
|
||||
|
||||
<title>Emacs</title>
|
||||
|
||||
<section xml:id="sec-emacs-config">
|
||||
|
||||
<title>Configuring Emacs</title>
|
||||
|
||||
<para>
|
||||
The Emacs package comes with some extra helpers to make it easier to
|
||||
configure. <varname>emacsWithPackages</varname> allows you to manage
|
||||
packages from ELPA. This means that you will not have to install
|
||||
that packages from within Emacs. For instance, if you wanted to use
|
||||
<literal>company</literal>, <literal>counsel</literal>,
|
||||
<literal>flycheck</literal>, <literal>ivy</literal>,
|
||||
<literal>magit</literal>, <literal>projectile</literal>, and
|
||||
<literal>use-package</literal> you could use this as a
|
||||
<filename>~/.config/nixpkgs/config.nix</filename> override:
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; {
|
||||
myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
|
||||
company
|
||||
counsel
|
||||
flycheck
|
||||
ivy
|
||||
magit
|
||||
projectile
|
||||
use-package
|
||||
]));
|
||||
}
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
You can install it like any other packages via <command>nix-env -iA
|
||||
myEmacs</command>. However, this will only install those packages.
|
||||
It will not <literal>configure</literal> them for us. To do this, we
|
||||
need to provide a configuration file. Luckily, it is possible to do
|
||||
this from within Nix! By modifying the above example, we can make
|
||||
Emacs load a custom config file. The key is to create a package that
|
||||
provide a <filename>default.el</filename> file in
|
||||
<filename>/share/emacs/site-start/</filename>. Emacs knows to load
|
||||
this file automatically when it starts.
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
{
|
||||
packageOverrides = pkgs: with pkgs; rec {
|
||||
myEmacsConfig = writeText "default.el" ''
|
||||
;; initialize package
|
||||
|
||||
(require 'package)
|
||||
(package-initialize 'noactivate)
|
||||
(eval-when-compile
|
||||
(require 'use-package))
|
||||
|
||||
;; load some packages
|
||||
|
||||
(use-package company
|
||||
:bind ("<C-tab>" . company-complete)
|
||||
:diminish company-mode
|
||||
:commands (company-mode global-company-mode)
|
||||
:defer 1
|
||||
:config
|
||||
(global-company-mode))
|
||||
|
||||
(use-package counsel
|
||||
:commands (counsel-descbinds)
|
||||
:bind (([remap execute-extended-command] . counsel-M-x)
|
||||
("C-x C-f" . counsel-find-file)
|
||||
("C-c g" . counsel-git)
|
||||
("C-c j" . counsel-git-grep)
|
||||
("C-c k" . counsel-ag)
|
||||
("C-x l" . counsel-locate)
|
||||
("M-y" . counsel-yank-pop)))
|
||||
|
||||
(use-package flycheck
|
||||
:defer 2
|
||||
:config (global-flycheck-mode))
|
||||
|
||||
(use-package ivy
|
||||
:defer 1
|
||||
:bind (("C-c C-r" . ivy-resume)
|
||||
("C-x C-b" . ivy-switch-buffer)
|
||||
:map ivy-minibuffer-map
|
||||
("C-j" . ivy-call))
|
||||
:diminish ivy-mode
|
||||
:commands ivy-mode
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
|
||||
(use-package magit
|
||||
:defer
|
||||
:if (executable-find "git")
|
||||
:bind (("C-x g" . magit-status)
|
||||
("C-x G" . magit-dispatch-popup))
|
||||
:init
|
||||
(setq magit-completing-read-function 'ivy-completing-read))
|
||||
|
||||
(use-package projectile
|
||||
:commands projectile-mode
|
||||
:bind-keymap ("C-c p" . projectile-command-map)
|
||||
:defer 5
|
||||
:config
|
||||
(projectile-global-mode))
|
||||
'';
|
||||
myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
|
||||
(runCommand "default.el" {} ''
|
||||
mkdir -p $out/share/emacs/site-lisp
|
||||
cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
|
||||
'')
|
||||
company
|
||||
counsel
|
||||
flycheck
|
||||
ivy
|
||||
magit
|
||||
projectile
|
||||
use-package
|
||||
]));
|
||||
};
|
||||
}
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
This provides a fairly full Emacs start file. It will load in
|
||||
addition to the user's presonal config. You can always disable it by
|
||||
passing <command>-q</command> to the Emacs command.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -212,7 +212,7 @@ $ nix-env -f . -iA libfoo</screen>
|
||||
|
||||
<listitem>
|
||||
<para>Optionally commit the new package and open a pull request, or send a patch to
|
||||
<literal>https://groups.google.com/forum/#!forum/nix-devel</literal>.</para>
|
||||
<literal>nix-dev@cs.uu.nl</literal>.</para>
|
||||
</listitem>
|
||||
|
||||
|
||||
|
||||
@@ -1,393 +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="sec-reviewing-contributions">
|
||||
|
||||
<title>Reviewing contributions</title>
|
||||
|
||||
<warning>
|
||||
<para>The following section is a draft and reviewing policy is still being
|
||||
discussed.</para>
|
||||
</warning>
|
||||
|
||||
<para>The nixpkgs projects 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 make any pull request that is open for
|
||||
long enough 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 these. 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.</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 members and their work.</para>
|
||||
|
||||
<para>GitHub provides reactions, they are 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 explanations so the
|
||||
submitter has directions to improve his contribution.</para>
|
||||
|
||||
<para>Pull-requests 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 his liking.</para>
|
||||
|
||||
<section><title>Package updates</title>
|
||||
|
||||
<para>A package update is the most trivial and common type of pull-request.
|
||||
These pull-requests mainly consist in 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>Add labels to the pull-request. (Requires commit
|
||||
rights)</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><literal>8.has: package (update)</literal> and any topic
|
||||
label that fit the updated package.</para></listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem><para>Ensure that the package versioning is fitting the
|
||||
guidelines.</para></listitem>
|
||||
<listitem><para>Ensure that the commit text is fitting the
|
||||
guidelines.</para></listitem>
|
||||
<listitem><para>Ensure that the package maintainers are notified.</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>mention-bot usually notify GitHub 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 contains correct
|
||||
information.</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>License can change with version updates, so it should be
|
||||
checked to be fitting 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 so building the pull-request locally as it is submitted can
|
||||
trigger a large amount of 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>
|
||||
$ git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
|
||||
xml:id='reviewing-rebase-1' />
|
||||
$ git fetch channels nixos-unstable <co xml:id='reviewing-rebase-2' />
|
||||
$ git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
|
||||
$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
|
||||
xml:id='reviewing-rebase-4' />
|
||||
</screen>
|
||||
<calloutlist>
|
||||
<callout arearefs='reviewing-rebase-1'>
|
||||
<para>This should be done only once to be able to fetch channel
|
||||
branches from the nixpkgs-channels repository.</para>
|
||||
</callout>
|
||||
<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-3'>
|
||||
<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/madjar/nox">nox</link>
|
||||
tool can be used to review a pull-request content in a single command.
|
||||
It doesn't rebase on a channel branch so it might trigger multiple
|
||||
source builds. <varname>PRNUMBER</varname> should be replaced by the
|
||||
number at the end of the pull-request title.</para>
|
||||
<screen>
|
||||
$ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
|
||||
</screen>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem><para>Running every binary.</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<example><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><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>Add labels to the pull-request. (Requires commit
|
||||
rights)</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><literal>8.has: package (new)</literal> and any topic
|
||||
label that fit the new package.</para></listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<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><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><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>Add labels to the pull-request. (Requires commit
|
||||
rights)</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><literal>8.has: module (update)</literal> and any topic
|
||||
label that fit the module.</para></listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem><para>Ensure that the module maintainers are notified.</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>Mention-bot notify GitHub users based on the submitted
|
||||
changes, but it can happen that it miss 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><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><title>New modules</title>
|
||||
|
||||
<para>New modules submissions introduce a new module to NixOS.</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>Add labels to the pull-request. (Requires commit
|
||||
rights)</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><literal>8.has: module (new)</literal> and any topic label
|
||||
that fit the module.</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 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><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 system.environmentPackages
|
||||
- [ ] meta.maintainers is set
|
||||
- [ ] module documentation is declared in meta.doc
|
||||
|
||||
##### Possible improvements
|
||||
|
||||
##### Comments
|
||||
|
||||
</screen></example>
|
||||
</section>
|
||||
|
||||
<section><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><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>
|
||||
|
||||
<para>TODO: add the procedure to request merging rights.</para>
|
||||
|
||||
<!--
|
||||
The following paragraph 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>In a case a contributor leaves definitively the Nix community, he should
|
||||
create an issue or notify the mailing list with references of packages and
|
||||
modules he maintains so the maintainership can be taken over by other
|
||||
contributors.</para>
|
||||
|
||||
</section>
|
||||
</chapter>
|
||||
271
doc/stdenv.xml
271
doc/stdenv.xml
@@ -1,4 +1,3 @@
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-stdenv">
|
||||
@@ -28,7 +27,7 @@ stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
src = fetchurl {
|
||||
url = http://example.org/libfoo-1.2.3.tar.bz2;
|
||||
sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m";
|
||||
md5 = "e1ec107956b6ddcb0b8b0679367e9ac9";
|
||||
};
|
||||
}</programlisting>
|
||||
|
||||
@@ -195,52 +194,33 @@ genericBuild
|
||||
tools.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
<variablelist>
|
||||
<title>Variables specifying dependencies</title>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>nativeBuildInputs</varname></term>
|
||||
<listitem><para>
|
||||
A list of dependencies used by the new derivation at <emphasis>build</emphasis>-time.
|
||||
I.e. these dependencies should not make it into the package's runtime-closure, though this is currently not checked.
|
||||
For each dependency <replaceable>dir</replaceable>, the directory <filename><replaceable>dir</replaceable>/bin</filename>, if it exists, is added to the <envar>PATH</envar> environment variable.
|
||||
Other environment variables are also set up via a pluggable mechanism.
|
||||
For instance, if <varname>buildInputs</varname> contains Perl, then the <filename>lib/site_perl</filename> subdirectory of each input is added to the <envar>PERL5LIB</envar> environment variable.
|
||||
See <xref linkend="ssec-setup-hooks"/> for details.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>buildInputs</varname></term>
|
||||
<listitem><para>
|
||||
A list of dependencies used by the new derivation at <emphasis>run</emphasis>-time.
|
||||
Currently, the build-time environment is modified in the exact same way as with <varname>nativeBuildInputs</varname>.
|
||||
This is problematic in that when cross-compiling, foreign executables can clobber native ones on the <envar>PATH</envar>.
|
||||
Even more confusing is static-linking.
|
||||
A statically-linked library should be listed here because ultimately that generated machine code will be used at run-time, even though a derivation containing the object files or static archives will only be used at build-time.
|
||||
A less confusing solution to this would be nice.
|
||||
</para></listitem>
|
||||
<listitem><para>A list of dependencies used by
|
||||
<literal>stdenv</literal> to set up the environment for the build.
|
||||
For each dependency <replaceable>dir</replaceable>, the directory
|
||||
<filename><replaceable>dir</replaceable>/bin</filename>, if it
|
||||
exists, is added to the <envar>PATH</envar> environment variable.
|
||||
Other environment variables are also set up via a pluggable
|
||||
mechanism. For instance, if <varname>buildInputs</varname>
|
||||
contains Perl, then the <filename>lib/site_perl</filename>
|
||||
subdirectory of each input is added to the <envar>PERL5LIB</envar>
|
||||
environment variable. See <xref linkend="ssec-setup-hooks"/> for
|
||||
details.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>propagatedNativeBuildInputs</varname></term>
|
||||
<listitem><para>
|
||||
Like <varname>nativeBuildInputs</varname>, but these dependencies are <emphasis>propagated</emphasis>:
|
||||
that is, the dependencies listed here are added to the <varname>nativeBuildInputs</varname> of any package that uses <emphasis>this</emphasis> package as a dependency.
|
||||
So if package Y has <literal>propagatedBuildInputs = [X]</literal>, and package Z has <literal>buildInputs = [Y]</literal>, then package X will appear in Z’s build environment automatically.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>propagatedBuildInputs</varname></term>
|
||||
<listitem><para>
|
||||
Like <varname>buildInputs</varname>, but propagated just like <varname>propagatedNativeBuildInputs</varname>.
|
||||
This inherits <varname>buildInputs</varname>'s flaws of clobbering native executables when cross-compiling and being confusing for static linking.
|
||||
</para></listitem>
|
||||
<listitem><para>Like <varname>buildInputs</varname>, but these
|
||||
dependencies are <emphasis>propagated</emphasis>: that is, the
|
||||
dependencies listed here are added to the
|
||||
<varname>buildInputs</varname> of any package that uses
|
||||
<emphasis>this</emphasis> package as a dependency. So if package
|
||||
Y has <literal>propagatedBuildInputs = [X]</literal>, and package
|
||||
Z has <literal>buildInputs = [Y]</literal>, then package X will
|
||||
appear in Z’s build environment automatically.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
@@ -319,13 +299,7 @@ containing some shell commands to be executed, or by redefining the
|
||||
shell function
|
||||
<varname><replaceable>name</replaceable>Phase</varname>. The former
|
||||
is convenient to override a phase from the derivation, while the
|
||||
latter is convenient from a build script.
|
||||
|
||||
However, typically one only wants to <emphasis>add</emphasis> some
|
||||
commands to a phase, e.g. by defining <literal>postInstall</literal>
|
||||
or <literal>preFixup</literal>, as skipping some of the default actions
|
||||
may have unexpected consequences.
|
||||
</para>
|
||||
latter is convenient from a build script.</para>
|
||||
|
||||
|
||||
<section xml:id="ssec-controlling-phases"><title>Controlling
|
||||
@@ -348,7 +322,7 @@ executed and in what order:
|
||||
$preInstallPhases installPhase fixupPhase $preDistPhases
|
||||
distPhase $postPhases</literal>.
|
||||
</para>
|
||||
|
||||
|
||||
<para>Usually, if you just want to add a few phases, it’s more
|
||||
convenient to set one of the variables below (such as
|
||||
<varname>preInstallPhases</varname>), as you then don’t specify
|
||||
@@ -583,8 +557,8 @@ script) if it exists.</para>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>configureFlags</varname></term>
|
||||
<listitem><para>A list of strings passed as additional arguments to the
|
||||
configure script.</para></listitem>
|
||||
<listitem><para>Additional arguments passed to the configure
|
||||
script.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -641,16 +615,6 @@ script) if it exists.</para>
|
||||
true.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>configurePlatforms</varname></term>
|
||||
<listitem><para>
|
||||
By default, when cross compiling, the configure script has <option>--build=...</option> and <option>--host=...</option> passed.
|
||||
Packages can instead pass <literal>[ "build" "host" "target" ]</literal> or a subset to control exactly which platform flags are passed.
|
||||
Compilers and other tools should use this to also pass the target platform, for example.
|
||||
Note eventually these will be passed when in native builds too, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>preConfigure</varname></term>
|
||||
<listitem><para>Hook executed at the start of the configure
|
||||
@@ -694,7 +658,7 @@ nothing.</para>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>makeFlags</varname></term>
|
||||
<listitem><para>A list of strings passed as additional flags to
|
||||
<listitem><para>Additional flags passed to
|
||||
<command>make</command>. These flags are also used by the default
|
||||
install and check phase. For setting make flags specific to the
|
||||
build phase, use <varname>buildFlags</varname> (see
|
||||
@@ -721,7 +685,7 @@ makeFlagsArray=(CFLAGS="-O0 -g" LDFLAGS="-lfoo -lbar")
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>buildFlags</varname> / <varname>buildFlagsArray</varname></term>
|
||||
<listitem><para>A list of strings passed as additional flags to
|
||||
<listitem><para>Additional flags passed to
|
||||
<command>make</command>. Like <varname>makeFlags</varname> and
|
||||
<varname>makeFlagsArray</varname>, but only used by the build
|
||||
phase.</para></listitem>
|
||||
@@ -742,7 +706,7 @@ makeFlagsArray=(CFLAGS="-O0 -g" LDFLAGS="-lfoo -lbar")
|
||||
</variablelist>
|
||||
|
||||
|
||||
<para>
|
||||
<para>
|
||||
You can set flags for <command>make</command> through the
|
||||
<varname>makeFlags</varname> variable.</para>
|
||||
|
||||
@@ -789,7 +753,7 @@ doCheck = true;</programlisting>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>checkFlags</varname> / <varname>checkFlagsArray</varname></term>
|
||||
<listitem><para>A list of strings passed as additional flags to
|
||||
<listitem><para>Additional flags passed to
|
||||
<command>make</command>. Like <varname>makeFlags</varname> and
|
||||
<varname>makeFlagsArray</varname>, but only used by the check
|
||||
phase.</para></listitem>
|
||||
@@ -809,7 +773,7 @@ doCheck = true;</programlisting>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@@ -844,7 +808,7 @@ installTargets = "install-bin install-doc";</programlisting>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>installFlags</varname> / <varname>installFlagsArray</varname></term>
|
||||
<listitem><para>A list of strings passed as additional flags to
|
||||
<listitem><para>Additional flags passed to
|
||||
<command>make</command>. Like <varname>makeFlags</varname> and
|
||||
<varname>makeFlagsArray</varname>, but only used by the install
|
||||
phase.</para></listitem>
|
||||
@@ -876,12 +840,12 @@ install phase. The default <function>fixupPhase</function> does the
|
||||
following:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
|
||||
<listitem><para>It moves the <filename>man/</filename>,
|
||||
<filename>doc/</filename> and <filename>info/</filename>
|
||||
subdirectories of <envar>$out</envar> to
|
||||
<filename>share/</filename>.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>It strips libraries and executables of debug
|
||||
information.</para></listitem>
|
||||
|
||||
@@ -1024,41 +988,6 @@ set debug-file-directory ~/.nix-profile/lib/debug
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-installCheck-phase"><title>The installCheck phase</title>
|
||||
|
||||
<para>The installCheck phase checks whether the package was installed
|
||||
correctly by running its test suite against the installed directories.
|
||||
The default <function>installCheck</function> calls <command>make
|
||||
installcheck</command>.</para>
|
||||
|
||||
<variablelist>
|
||||
<title>Variables controlling the installCheck phase</title>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>doInstallCheck</varname></term>
|
||||
<listitem><para>If set to a non-empty string, the installCheck phase is
|
||||
executed, otherwise it is skipped (default). Thus you should set
|
||||
|
||||
<programlisting>doInstallCheck = true;</programlisting>
|
||||
|
||||
in the derivation to enable install checks.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>preInstallCheck</varname></term>
|
||||
<listitem><para>Hook executed at the start of the installCheck
|
||||
phase.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>postInstallCheck</varname></term>
|
||||
<listitem><para>Hook executed at the end of the installCheck
|
||||
phase.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-distribution-phase"><title>The distribution
|
||||
phase</title>
|
||||
@@ -1127,41 +1056,13 @@ functions.</para>
|
||||
|
||||
<variablelist>
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-makeWrapper'>
|
||||
<term><function>makeWrapper</function>
|
||||
<replaceable>executable</replaceable>
|
||||
<replaceable>wrapperfile</replaceable>
|
||||
<replaceable>args</replaceable></term>
|
||||
<listitem><para>Constructs a wrapper for a program with various
|
||||
possible arguments. For example:
|
||||
|
||||
<programlisting>
|
||||
# adds `FOOBAR=baz` to `$out/bin/foo`’s environment
|
||||
makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
|
||||
|
||||
# prefixes the binary paths of `hello` and `git`
|
||||
# Be advised that paths often should be patched in directly
|
||||
# (via string replacements or in `configurePhase`).
|
||||
makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]}
|
||||
</programlisting>
|
||||
|
||||
There’s many more kinds of arguments, they are documented in
|
||||
<literal>nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh</literal>.</para>
|
||||
|
||||
<para><literal>wrapProgram</literal> is a convenience function you probably
|
||||
want to use most of the time.</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-substitute'>
|
||||
<term><function>substitute</function>
|
||||
<replaceable>infile</replaceable>
|
||||
<replaceable>outfile</replaceable>
|
||||
<replaceable>subs</replaceable></term>
|
||||
|
||||
|
||||
<listitem>
|
||||
<para>Performs string substitution on the contents of
|
||||
<replaceable>infile</replaceable>, writing the result to
|
||||
@@ -1173,7 +1074,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
|
||||
<term><option>--replace</option>
|
||||
<replaceable>s1</replaceable>
|
||||
<replaceable>s2</replaceable></term>
|
||||
<listitem><para>Replace every occurrence of the string
|
||||
<listitem><para>Replace every occurence of the string
|
||||
<replaceable>s1</replaceable> by
|
||||
<replaceable>s2</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
@@ -1181,7 +1082,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
|
||||
<varlistentry>
|
||||
<term><option>--subst-var</option>
|
||||
<replaceable>varName</replaceable></term>
|
||||
<listitem><para>Replace every occurrence of
|
||||
<listitem><para>Replace every occurence of
|
||||
<literal>@<replaceable>varName</replaceable>@</literal> by
|
||||
the contents of the environment variable
|
||||
<replaceable>varName</replaceable>. This is useful for
|
||||
@@ -1189,16 +1090,16 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
|
||||
<literal>@<replaceable>...</replaceable>@</literal> in the
|
||||
template as placeholders.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--subst-var-by</option>
|
||||
<replaceable>varName</replaceable>
|
||||
<replaceable>s</replaceable></term>
|
||||
<listitem><para>Replace every occurrence of
|
||||
<listitem><para>Replace every occurence of
|
||||
<literal>@<replaceable>varName</replaceable>@</literal> by
|
||||
the string <replaceable>s</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
@@ -1226,7 +1127,7 @@ substitute ./foo.in ./foo.out \
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-substituteInPlace'>
|
||||
<term><function>substituteInPlace</function>
|
||||
@@ -1237,12 +1138,12 @@ substitute ./foo.in ./foo.out \
|
||||
<replaceable>file</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-substituteAll'>
|
||||
<term><function>substituteAll</function>
|
||||
<replaceable>infile</replaceable>
|
||||
<replaceable>outfile</replaceable></term>
|
||||
<listitem><para>Replaces every occurrence of
|
||||
<listitem><para>Replaces every occurence of
|
||||
<literal>@<replaceable>varName</replaceable>@</literal>, where
|
||||
<replaceable>varName</replaceable> is any environment variable, in
|
||||
<replaceable>infile</replaceable>, writing the result to
|
||||
@@ -1295,42 +1196,27 @@ echo @foo@
|
||||
<term><function>stripHash</function>
|
||||
<replaceable>path</replaceable></term>
|
||||
<listitem><para>Strips the directory and hash part of a store
|
||||
path, outputting the name part to <literal>stdout</literal>.
|
||||
For example:
|
||||
|
||||
path, storing the name part in the environment variable
|
||||
<literal>strippedName</literal>. For example:
|
||||
|
||||
<programlisting>
|
||||
# prints coreutils-8.24
|
||||
stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
||||
# prints coreutils-8.24
|
||||
echo $strippedName
|
||||
</programlisting>
|
||||
|
||||
If you wish to store the result in another variable, then the
|
||||
following idiom may be useful:
|
||||
|
||||
|
||||
<programlisting>
|
||||
name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
||||
someVar=$(stripHash $name)
|
||||
someVar=$(stripHash $name; echo $strippedName)
|
||||
</programlisting>
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-wrapProgram'>
|
||||
<term><function>wrapProgram</function>
|
||||
<replaceable>executable</replaceable>
|
||||
<replaceable>makeWrapperArgs</replaceable></term>
|
||||
<listitem><para>Convenience function for <literal>makeWrapper</literal>
|
||||
that automatically creates a sane wrapper file
|
||||
|
||||
It takes all the same arguments as <literal>makeWrapper</literal>,
|
||||
except for <literal>--argv0</literal>.</para>
|
||||
|
||||
<para>It cannot be applied multiple times, since it will overwrite the wrapper
|
||||
file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
</section>
|
||||
@@ -1343,34 +1229,12 @@ someVar=$(stripHash $name)
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>CC Wrapper</term>
|
||||
<listitem>
|
||||
<para>
|
||||
CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes.
|
||||
Specifically, a C compiler (GCC or Clang), Binutils (or the CCTools + binutils mashup when targetting Darwin), and a C standard library (glibc or Darwin's libSystem) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by CC Wrapper.
|
||||
Packages typically depend on only CC Wrapper, instead of those 3 inputs directly.
|
||||
</para>
|
||||
<para>
|
||||
Dependency finding is undoubtedly the main task of CC wrapper.
|
||||
It is currently accomplished by collecting directories of host-platform dependencies (i.e. <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname>) in environment variables.
|
||||
CC wrapper's setup hook causes any <filename>include</filename> subdirectory of such a dependency to be added to <envar>NIX_CFLAGS_COMPILE</envar>, and any <filename>lib</filename> and <filename>lib64</filename> subdirectories to <envar>NIX_LDFLAGS</envar>.
|
||||
The setup hook itself contains some lengthy comments describing the exact convoluted mechanism by which this is accomplished.
|
||||
</para>
|
||||
<para>
|
||||
A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables full-fill which purpose.
|
||||
They are defined to just be the base name of the tools, under the assumption that CC Wrapper's binaries will be on the path.
|
||||
Firstly, this helps poorly-written packages, e.g. ones that look for just <command>gcc</command> when <envar>CC</envar> isn't defined yet <command>clang</command> is to be used.
|
||||
Secondly, this helps packages not get confused when cross-compiling, in which case multiple CC wrappers may be simultaneous in use (targeting different platforms).
|
||||
<envar>BUILD_</envar>- and <envar>TARGET_</envar>-prefixed versions of the normal environment variable are defined for the additional CC Wrappers, properly disambiguating them.
|
||||
</para>
|
||||
<para>
|
||||
A problem with this final task is that CC Wrapper is honest and defines <envar>LD</envar> as <command>ld</command>.
|
||||
Most packages, however, firstly use the C compiler for linking, secondly use <envar>LD</envar> anyways, defining it as the C compiler, and thirdly, only so define <envar>LD</envar> when it is undefined as a fallback.
|
||||
This triple-threat means CC Wrapper will break those packages, as LD is already defined as the actually linker which the package won't override yet doesn't want to use.
|
||||
The workaround is to define, just for the problematic package, <envar>LD</envar> as the C compiler.
|
||||
A good way to do this would be <command>preConfigure = "LD=$CC"</command>.
|
||||
</para>
|
||||
</listitem>
|
||||
<term>GCC wrapper</term>
|
||||
<listitem><para>Adds the <filename>include</filename> subdirectory
|
||||
of each build input to the <envar>NIX_CFLAGS_COMPILE</envar>
|
||||
environment variable, and the <filename>lib</filename> and
|
||||
<filename>lib64</filename> subdirectories to
|
||||
<envar>NIX_LDFLAGS</envar>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -1503,15 +1367,8 @@ These can be toggled using the <varname>stdenv.mkDerivation</varname> parameters
|
||||
<varname>hardeningDisable</varname> and <varname>hardeningEnable</varname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Both parameters take a list of flags as strings. The special
|
||||
<varname>"all"</varname> flag can be passed to <varname>hardeningDisable</varname>
|
||||
to turn off all hardening. These flags can also be used as environment variables
|
||||
for testing or development purposes.
|
||||
</para>
|
||||
|
||||
<para>The following flags are enabled by default and might require disabling with
|
||||
<varname>hardeningDisable</varname> if the program to package is incompatible.
|
||||
<para>The following flags are enabled by default and might require disabling
|
||||
if the program to package is incompatible.
|
||||
</para>
|
||||
|
||||
<variablelist>
|
||||
@@ -1567,7 +1424,7 @@ bin/blib.a(bios_console.o): In function `bios_handle_cup':
|
||||
depends on such a format string, it will need to be worked around.
|
||||
</para>
|
||||
|
||||
<para>Additionally, some warnings are enabled which might trigger build
|
||||
<para>Addtionally, some warnings are enabled which might trigger build
|
||||
failures if compiler warnings are treated as errors in the package build.
|
||||
In this case, set <option>NIX_CFLAGS_COMPILE</option> to
|
||||
<option>-Wno-error=warning-type</option>.</para>
|
||||
@@ -1597,7 +1454,7 @@ fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute erro
|
||||
<term><varname>pic</varname></term>
|
||||
<listitem>
|
||||
<para>Adds the <option>-fPIC</option> compiler options. This options adds
|
||||
support for position independent code in shared libraries and thus making
|
||||
support for position independant code in shared libraries and thus making
|
||||
ASLR possible.</para>
|
||||
<para>Most notably, the Linux kernel, kernel modules and other code
|
||||
not running in an operating system environment like boot loaders won't
|
||||
@@ -1672,8 +1529,7 @@ intel_drv.so: undefined symbol: vgaHWFreeHWRec
|
||||
</variablelist>
|
||||
|
||||
<para>The following flags are disabled by default and should be enabled
|
||||
with <varname>hardeningEnable</varname> for packages that take untrusted
|
||||
input like network services.
|
||||
for packages that take untrusted input, like network services.
|
||||
</para>
|
||||
|
||||
<variablelist>
|
||||
@@ -1709,3 +1565,4 @@ Arch Wiki</link>.
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
|
||||
@@ -223,133 +223,6 @@ Additional information.
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Pull Request Template</title>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
<para>When a PR is created, it will be pre-populated with some checkboxes detailed below:
|
||||
</para>
|
||||
<section>
|
||||
<title>Tested using sandboxing</title>
|
||||
<para>
|
||||
When sandbox builds are enabled, Nix will setup an isolated environment
|
||||
for each build process. It is used to remove further hidden dependencies
|
||||
set by the build environment to improve reproducibility. This includes
|
||||
access to the network during the build outside of
|
||||
<function>fetch*</function> functions and files outside the Nix store.
|
||||
Depending on the operating system access to other resources are blocked
|
||||
as well (ex. inter process communication is isolated on Linux); see <link
|
||||
xlink:href="https://nixos.org/nix/manual/#description-45">build-use-sandbox</link>
|
||||
in Nix manual for details.
|
||||
</para>
|
||||
<para>
|
||||
Sandboxing is not enabled by default in Nix due to a small performance
|
||||
hit on each build. In pull requests for <link
|
||||
xlink:href="https://github.com/NixOS/nixpkgs/">nixpkgs</link> people
|
||||
are asked to test builds with sandboxing enabled (see <literal>Tested
|
||||
using sandboxing</literal> in the pull request template) because
|
||||
in<link
|
||||
xlink:href="https://nixos.org/hydra/">https://nixos.org/hydra/</link>
|
||||
sandboxing is also used.
|
||||
</para>
|
||||
<para>
|
||||
Depending if you use NixOS or other platforms you can use one of the
|
||||
following methods to enable sandboxing <emphasis role="bold">before</emphasis> building the package:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis role="bold">Globally enable sandboxing on NixOS</emphasis>:
|
||||
add the following to
|
||||
<filename>configuration.nix</filename>
|
||||
<screen>nix.useSandbox = true;</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis role="bold">Globally enable sandboxing on non-NixOS platforms</emphasis>:
|
||||
add the following to: <filename>/etc/nix/nix.conf</filename>
|
||||
<screen>build-use-sandbox = true</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
<section>
|
||||
<title>Built on platform(s)</title>
|
||||
<para>
|
||||
Many Nix packages are designed to run on multiple
|
||||
platforms. As such, it's important to let the maintainer know which
|
||||
platforms your changes have been tested on. It's not always practical to
|
||||
test a change on all platforms, and is not required for a pull request to
|
||||
be merged. Only check the systems you tested the build on in this
|
||||
section.
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)</title>
|
||||
<para>
|
||||
Packages with automated tests are much more likely to be merged in a
|
||||
timely fashion because it doesn't require as much manual testing by the
|
||||
maintainer to verify the functionality of the package. If there are
|
||||
existing tests for the package, they should be run to verify your changes
|
||||
do not break the tests. Tests only apply to packages with NixOS modules
|
||||
defined and can only be run on Linux. For more details on writing and
|
||||
running tests, see the <link
|
||||
xlink:href="https://nixos.org/nixos/manual/index.html#sec-nixos-tests">section
|
||||
in the NixOS manual</link>.
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Tested compilation of all pkgs that depend on this change using <command>nox-review</command></title>
|
||||
<para>
|
||||
If you are updating a package's version, you can use nox to make sure all
|
||||
packages that depend on the updated package still compile correctly. This
|
||||
can be done using the nox utility. The <command>nox-review</command>
|
||||
utility can look for and build all dependencies either based on
|
||||
uncommited changes with the <literal>wip</literal> option or specifying a
|
||||
github pull request number.
|
||||
</para>
|
||||
<para>
|
||||
review uncommitted changes:
|
||||
<screen>nix-shell -p nox --run nox-review wip</screen>
|
||||
</para>
|
||||
<para>
|
||||
review changes from pull request number 12345:
|
||||
<screen>nix-shell -p nox --run nox-review pr 12345</screen>
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Tested execution of all binary files (usually in <filename>./result/bin/</filename>)</title>
|
||||
<para>
|
||||
It's important to test any executables generated by a build when you
|
||||
change or create a package in nixpkgs. This can be done by looking in
|
||||
<filename>./result/bin</filename> and running any files in there, or at a
|
||||
minimum, the main executable for the package. For example, if you make a change
|
||||
to <package>texlive</package>, you probably would only check the binaries
|
||||
associated with the change you made rather than testing all of them.
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Meets nixpkgs contribution standards</title>
|
||||
<para>
|
||||
The last checkbox is fits <link
|
||||
xlink:href="https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md">CONTRIBUTING.md</link>.
|
||||
The contributing document has detailed information on standards the Nix
|
||||
community has for commit messages, reviews, licensing of contributions
|
||||
you make to the project, etc... Everyone should read and understand the
|
||||
standards the community has for contributing before submitting a pull
|
||||
request.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Hotfixing pull requests</title>
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Operations on attribute sets.
|
||||
|
||||
let
|
||||
with {
|
||||
inherit (builtins) head tail length;
|
||||
inherit (import ./trivial.nix) and or;
|
||||
inherit (import ./trivial.nix) or;
|
||||
inherit (import ./default.nix) fold;
|
||||
inherit (import ./strings.nix) concatStringsSep;
|
||||
inherit (import ./lists.nix) concatMap concatLists all deepSeqList;
|
||||
in
|
||||
};
|
||||
|
||||
rec {
|
||||
inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr;
|
||||
@@ -116,7 +116,7 @@ rec {
|
||||
listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
|
||||
|
||||
|
||||
/* Filter an attribute set recursively by removing all attributes for
|
||||
/* Filter an attribute set recursivelly by removing all attributes for
|
||||
which the given predicate return false.
|
||||
|
||||
Example:
|
||||
@@ -296,17 +296,12 @@ rec {
|
||||
|
||||
/* Converts a store path to a fake derivation. */
|
||||
toDerivation = path:
|
||||
let
|
||||
path' = builtins.storePath path;
|
||||
res =
|
||||
{ type = "derivation";
|
||||
name = builtins.unsafeDiscardStringContext (builtins.substring 33 (-1) (baseNameOf path'));
|
||||
outPath = path';
|
||||
outputs = [ "out" ];
|
||||
out = res;
|
||||
outputName = "out";
|
||||
};
|
||||
in res;
|
||||
let path' = builtins.storePath path; in
|
||||
{ type = "derivation";
|
||||
name = builtins.unsafeDiscardStringContext (builtins.substring 33 (-1) (baseNameOf path'));
|
||||
outPath = path';
|
||||
outputs = [ "out" ];
|
||||
};
|
||||
|
||||
|
||||
/* If `cond' is true, return the attribute set `as',
|
||||
@@ -334,7 +329,7 @@ rec {
|
||||
value = f name (catAttrs name sets);
|
||||
}) names);
|
||||
|
||||
/* Implementation note: Common names appear multiple times in the list of
|
||||
/* Implentation note: Common names appear multiple times in the list of
|
||||
names, hopefully this does not affect the system because the maximal
|
||||
laziness avoid computing twice the same expression and listToAttrs does
|
||||
not care about duplicated attribute names.
|
||||
@@ -353,7 +348,7 @@ rec {
|
||||
zipAttrs = zipAttrsWith (name: values: values);
|
||||
|
||||
/* Does the same as the update operator '//' except that attributes are
|
||||
merged until the given predicate is verified. The predicate should
|
||||
merged until the given pedicate is verified. The predicate should
|
||||
accept 3 arguments which are the path to reach the attribute, a part of
|
||||
the first attribute set and a part of the second attribute set. When
|
||||
the predicate is verified, the value of the first attribute set is
|
||||
@@ -391,7 +386,7 @@ rec {
|
||||
);
|
||||
in f [] [rhs lhs];
|
||||
|
||||
/* A recursive variant of the update operator ‘//’. The recursion
|
||||
/* A recursive variant of the update operator ‘//’. The recusion
|
||||
stops when one of the attribute values is not an attribute set,
|
||||
in which case the right hand side value takes precedence over the
|
||||
left hand side value.
|
||||
@@ -417,15 +412,18 @@ rec {
|
||||
|
||||
/* Returns true if the pattern is contained in the set. False otherwise.
|
||||
|
||||
FIXME(zimbatm): this example doesn't work !!!
|
||||
|
||||
Example:
|
||||
matchAttrs { cpu = {}; } { cpu = { bits = 64; }; }
|
||||
sys = mkSystem { }
|
||||
matchAttrs { cpu = { bits = 64; }; } sys
|
||||
=> true
|
||||
*/
|
||||
matchAttrs = pattern: attrs: assert isAttrs pattern;
|
||||
fold and true (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
|
||||
matchAttrs = pattern: attrs:
|
||||
fold or false (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
|
||||
let pat = head values; val = head (tail values); in
|
||||
if length values == 1 then false
|
||||
else if isAttrs pat then isAttrs val && matchAttrs pat val
|
||||
else if isAttrs pat then isAttrs val && matchAttrs head values
|
||||
else pat == val
|
||||
) [pattern attrs]));
|
||||
|
||||
@@ -456,8 +454,6 @@ rec {
|
||||
getLib = getOutput "lib";
|
||||
getDev = getOutput "dev";
|
||||
|
||||
/* Pick the outputs of packages to place in buildInputs */
|
||||
chooseDevOutputs = drvs: builtins.map getDev drvs;
|
||||
|
||||
/*** deprecated stuff ***/
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{lib, pkgs}:
|
||||
{lib, pkgs} :
|
||||
let inherit (lib) nv nvs; in
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ let inherit (lib) nv nvs; in
|
||||
# * vim_configurable
|
||||
#
|
||||
# A minimal example illustrating most features would look like this:
|
||||
# let base = composableDerivation { (fixed: let inherit (fixed.fixed) name in {
|
||||
# let base = composableDerivation { (fixed : let inherit (fixed.fixed) name in {
|
||||
# src = fetchurl {
|
||||
# }
|
||||
# buildInputs = [A];
|
||||
@@ -39,7 +39,7 @@ let inherit (lib) nv nvs; in
|
||||
#
|
||||
# issues:
|
||||
# * its complicated to understand
|
||||
# * some "features" such as exact merge behaviour are buried in mergeAttrBy
|
||||
# * some "features" such as exact merge behaviour are burried in mergeAttrBy
|
||||
# and defaultOverridableDelayableArgs assuming the default behaviour does
|
||||
# the right thing in the common case
|
||||
# * Eelco once said using such fix style functions are slow to evaluate
|
||||
@@ -48,7 +48,7 @@ let inherit (lib) nv nvs; in
|
||||
# / add patches the way you want without having to declare function arguments
|
||||
#
|
||||
# nice features:
|
||||
# declaring "optional features" is modular. For instance:
|
||||
# declaring "optional featuers" is modular. For instance:
|
||||
# flags.curl = {
|
||||
# configureFlags = ["--with-curl=${curl.dev}" "--with-curlwrappers"];
|
||||
# buildInputs = [curl openssl];
|
||||
@@ -79,7 +79,7 @@ let inherit (lib) nv nvs; in
|
||||
# consider adding addtional elements by derivation.merge { removeAttrs = ["elem"]; };
|
||||
removeAttrs ? ["cfg" "flags"]
|
||||
|
||||
}: (lib.defaultOverridableDelayableArgs ( a: mkDerivation a)
|
||||
}: (lib.defaultOverridableDelayableArgs ( a: mkDerivation a)
|
||||
{
|
||||
inherit applyPreTidy removeAttrs;
|
||||
}).merge;
|
||||
|
||||
@@ -10,15 +10,15 @@ rec {
|
||||
|
||||
/* `overrideDerivation drv f' takes a derivation (i.e., the result
|
||||
of a call to the builtin function `derivation') and returns a new
|
||||
derivation in which the attributes of the original are overridden
|
||||
derivation in which the attributes of the original are overriden
|
||||
according to the function `f'. The function `f' is called with
|
||||
the original derivation attributes.
|
||||
|
||||
`overrideDerivation' allows certain "ad-hoc" customisation
|
||||
scenarios (e.g. in ~/.config/nixpkgs/config.nix). For instance,
|
||||
if you want to "patch" the derivation returned by a package
|
||||
function in Nixpkgs to build another version than what the
|
||||
function itself provides, you can do something like this:
|
||||
scenarios (e.g. in ~/.nixpkgs/config.nix). For instance, if you
|
||||
want to "patch" the derivation returned by a package function in
|
||||
Nixpkgs to build another version than what the function itself
|
||||
provides, you can do something like this:
|
||||
|
||||
mySed = overrideDerivation pkgs.gnused (oldAttrs: {
|
||||
name = "sed-4.2.2-pre";
|
||||
@@ -51,41 +51,21 @@ rec {
|
||||
else { }));
|
||||
|
||||
|
||||
/* `makeOverridable` takes a function from attribute set to attribute set and
|
||||
injects `override` attibute which can be used to override arguments of
|
||||
the function.
|
||||
|
||||
nix-repl> x = {a, b}: { result = a + b; }
|
||||
|
||||
nix-repl> y = lib.makeOverridable x { a = 1; b = 2; }
|
||||
|
||||
nix-repl> y
|
||||
{ override = «lambda»; overrideDerivation = «lambda»; result = 3; }
|
||||
|
||||
nix-repl> y.override { a = 10; }
|
||||
{ override = «lambda»; overrideDerivation = «lambda»; result = 12; }
|
||||
|
||||
Please refer to "Nixpkgs Contributors Guide" section
|
||||
"<pkg>.overrideDerivation" to learn about `overrideDerivation` and caveats
|
||||
related to its use.
|
||||
*/
|
||||
makeOverridable = f: origArgs:
|
||||
let
|
||||
ff = f origArgs;
|
||||
overrideWith = newArgs: origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs);
|
||||
in
|
||||
if builtins.isAttrs ff then (ff // {
|
||||
override = newArgs: makeOverridable f (overrideWith newArgs);
|
||||
overrideDerivation = fdrv:
|
||||
makeOverridable (args: overrideDerivation (f args) fdrv) origArgs;
|
||||
${if ff ? overrideAttrs then "overrideAttrs" else null} = fdrv:
|
||||
makeOverridable (args: (f args).overrideAttrs fdrv) origArgs;
|
||||
})
|
||||
else if builtins.isFunction ff then {
|
||||
override = newArgs: makeOverridable f (overrideWith newArgs);
|
||||
__functor = self: ff;
|
||||
overrideDerivation = throw "overrideDerivation not yet supported for functors";
|
||||
}
|
||||
if builtins.isAttrs ff then (ff //
|
||||
{ override = newArgs: makeOverridable f (overrideWith newArgs);
|
||||
overrideDerivation = fdrv:
|
||||
makeOverridable (args: overrideDerivation (f args) fdrv) origArgs;
|
||||
})
|
||||
else if builtins.isFunction ff then
|
||||
{ override = newArgs: makeOverridable f (overrideWith newArgs);
|
||||
__functor = self: ff;
|
||||
overrideDerivation = throw "overrideDerivation not yet supported for functors";
|
||||
}
|
||||
else ff;
|
||||
|
||||
|
||||
@@ -124,9 +104,11 @@ rec {
|
||||
let
|
||||
f = if builtins.isFunction fn then fn else import fn;
|
||||
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
|
||||
origArgs = auto // args;
|
||||
pkgs = f origArgs;
|
||||
mkAttrOverridable = name: pkg: makeOverridable (newArgs: (f newArgs).${name}) origArgs;
|
||||
finalArgs = auto // args;
|
||||
pkgs = f finalArgs;
|
||||
mkAttrOverridable = name: pkg: pkg // {
|
||||
override = newArgs: mkAttrOverridable name (f (finalArgs // newArgs)).${name};
|
||||
};
|
||||
in lib.mapAttrs mkAttrOverridable pkgs;
|
||||
|
||||
|
||||
@@ -185,7 +167,7 @@ rec {
|
||||
/* Make a set of packages with a common scope. All packages called
|
||||
with the provided `callPackage' will be evaluated with the same
|
||||
arguments. Any package in the set may depend on any other. The
|
||||
`overrideScope' function allows subsequent modification of the package
|
||||
`override' function allows subsequent modification of the package
|
||||
set in a consistent way, i.e. all packages in the set will be
|
||||
called with the overridden packages. The package sets may be
|
||||
hierarchical: the packages in the set are called with the scope
|
||||
@@ -195,10 +177,9 @@ rec {
|
||||
let self = f self // {
|
||||
newScope = scope: newScope (self // scope);
|
||||
callPackage = self.newScope {};
|
||||
overrideScope = g:
|
||||
makeScope newScope
|
||||
(self_: let super = f self_; in super // g super self_);
|
||||
packages = f;
|
||||
override = g: makeScope newScope (self_:
|
||||
let super = f self_;
|
||||
in super // g super self_);
|
||||
};
|
||||
in self;
|
||||
|
||||
|
||||
@@ -20,38 +20,14 @@ rec {
|
||||
traceXMLValMarked = str: x: trace (str + builtins.toXML x) x;
|
||||
|
||||
# strict trace functions (traced structure is fully evaluated and printed)
|
||||
|
||||
/* `builtins.trace`, but the value is `builtins.deepSeq`ed first. */
|
||||
traceSeq = x: y: trace (builtins.deepSeq x x) y;
|
||||
|
||||
/* Like `traceSeq`, but only down to depth n.
|
||||
* This is very useful because lots of `traceSeq` usages
|
||||
* lead to an infinite recursion.
|
||||
*/
|
||||
traceSeqN = depth: x: y: with lib;
|
||||
let snip = v: if isList v then noQuotes "[…]" v
|
||||
else if isAttrs v then noQuotes "{…}" v
|
||||
else v;
|
||||
noQuotes = str: v: { __pretty = const str; val = v; };
|
||||
modify = n: fn: v: if (n == 0) then fn v
|
||||
else if isList v then map (modify (n - 1) fn) v
|
||||
else if isAttrs v then mapAttrs
|
||||
(const (modify (n - 1) fn)) v
|
||||
else v;
|
||||
in trace (generators.toPretty { allowPrettyValues = true; }
|
||||
(modify depth snip x)) y;
|
||||
|
||||
/* `traceSeq`, but the same value is traced and returned */
|
||||
traceValSeq = v: traceVal (builtins.deepSeq v v);
|
||||
/* `traceValSeq` but with fixed depth */
|
||||
traceValSeqN = depth: v: traceSeqN depth v v;
|
||||
|
||||
|
||||
# this can help debug your code as well - designed to not produce thousands of lines
|
||||
traceShowVal = x: trace (showVal x) x;
|
||||
traceShowVal = x : trace (showVal x) x;
|
||||
traceShowValMarked = str: x: trace (str + showVal x) x;
|
||||
attrNamesToStr = a: lib.concatStringsSep "; " (map (x: "${x}=") (attrNames a));
|
||||
showVal = x:
|
||||
attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (attrNames a));
|
||||
showVal = x :
|
||||
if isAttrs x then
|
||||
if x ? outPath then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
|
||||
else "x is attr set { ${attrNamesToStr x} }"
|
||||
@@ -67,9 +43,9 @@ rec {
|
||||
|
||||
# trace the arguments passed to function and its result
|
||||
# maybe rewrite these functions in a traceCallXml like style. Then one function is enough
|
||||
traceCall = n: f: a: let t = n2: x: traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
||||
traceCall2 = n: f: a: b: let t = n2: x: traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
||||
traceCall3 = n: f: a: b: c: let t = n2: x: traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
|
||||
traceCall = n : f : a : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
||||
traceCall2 = n : f : a : b : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
||||
traceCall3 = n : f : a : b : c : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
|
||||
|
||||
# FIXME: rename this?
|
||||
traceValIfNot = c: x:
|
||||
@@ -95,7 +71,7 @@ rec {
|
||||
|
||||
# create a test assuming that list elements are true
|
||||
# usage: { testX = allTrue [ true ]; }
|
||||
testAllTrue = expr: { inherit expr; expected = map (x: true) expr; };
|
||||
testAllTrue = expr : { inherit expr; expected = map (x: true) expr; };
|
||||
|
||||
strict = v:
|
||||
trace "Warning: strict is deprecated and will be removed in the next release"
|
||||
|
||||
@@ -1,62 +1,31 @@
|
||||
/* Library of low-level helper functions for nix expressions.
|
||||
*
|
||||
* Please implement (mostly) exhaustive unit tests
|
||||
* for new functions in `./tests.nix'.
|
||||
*/
|
||||
let
|
||||
let
|
||||
|
||||
# often used, or depending on very little
|
||||
trivial = import ./trivial.nix;
|
||||
fixedPoints = import ./fixed-points.nix;
|
||||
|
||||
# datatypes
|
||||
attrsets = import ./attrsets.nix;
|
||||
lists = import ./lists.nix;
|
||||
strings = import ./strings.nix;
|
||||
stringsWithDeps = import ./strings-with-deps.nix;
|
||||
|
||||
# packaging
|
||||
customisation = import ./customisation.nix;
|
||||
maintainers = import ./maintainers.nix;
|
||||
meta = import ./meta.nix;
|
||||
attrsets = import ./attrsets.nix;
|
||||
sources = import ./sources.nix;
|
||||
|
||||
# module system
|
||||
modules = import ./modules.nix;
|
||||
options = import ./options.nix;
|
||||
types = import ./types.nix;
|
||||
|
||||
# constants
|
||||
licenses = import ./licenses.nix;
|
||||
systems = import ./systems;
|
||||
|
||||
# misc
|
||||
meta = import ./meta.nix;
|
||||
debug = import ./debug.nix;
|
||||
generators = import ./generators.nix;
|
||||
misc = import ./deprecated.nix;
|
||||
|
||||
# domain-specific
|
||||
maintainers = import ./maintainers.nix;
|
||||
platforms = import ./platforms.nix;
|
||||
systems = import ./systems.nix;
|
||||
customisation = import ./customisation.nix;
|
||||
licenses = import ./licenses.nix;
|
||||
sandbox = import ./sandbox.nix;
|
||||
fetchers = import ./fetchers.nix;
|
||||
|
||||
# Eval-time filesystem handling
|
||||
filesystem = import ./filesystem.nix;
|
||||
|
||||
in
|
||||
{ inherit trivial fixedPoints
|
||||
attrsets lists strings stringsWithDeps
|
||||
customisation maintainers meta sources
|
||||
modules options types
|
||||
licenses systems
|
||||
debug generators misc
|
||||
sandbox fetchers filesystem;
|
||||
|
||||
# back-compat aliases
|
||||
platforms = systems.doubles;
|
||||
{ inherit trivial lists strings stringsWithDeps attrsets sources options
|
||||
modules types meta debug maintainers licenses platforms systems sandbox;
|
||||
}
|
||||
# !!! don't include everything at top-level; perhaps only the most
|
||||
# commonly used functions.
|
||||
// trivial // fixedPoints
|
||||
// lists // strings // stringsWithDeps // attrsets // sources
|
||||
// trivial // lists // strings // stringsWithDeps // attrsets // sources
|
||||
// options // types // meta // debug // misc // modules
|
||||
// systems
|
||||
// customisation
|
||||
|
||||
@@ -16,23 +16,23 @@ rec {
|
||||
|
||||
defaultMergeArg = x : y: if builtins.isAttrs y then
|
||||
y
|
||||
else
|
||||
else
|
||||
(y x);
|
||||
defaultMerge = x: y: x // (defaultMergeArg x y);
|
||||
foldArgs = merger: f: init: x:
|
||||
let arg = (merger init (defaultMergeArg init x));
|
||||
# now add the function with composed args already applied to the final attrs
|
||||
base = (setAttrMerge "passthru" {} (f arg)
|
||||
( z: z // rec {
|
||||
function = foldArgs merger f arg;
|
||||
args = (lib.attrByPath ["passthru" "args"] {} z) // x;
|
||||
foldArgs = merger: f: init: x:
|
||||
let arg=(merger init (defaultMergeArg init x));
|
||||
# now add the function with composed args already applied to the final attrs
|
||||
base = (setAttrMerge "passthru" {} (f arg)
|
||||
( z : z // rec {
|
||||
function = foldArgs merger f arg;
|
||||
args = (lib.attrByPath ["passthru" "args"] {} z) // x;
|
||||
} ));
|
||||
withStdOverrides = base // {
|
||||
override = base.passthru.function;
|
||||
};
|
||||
withStdOverrides = base // {
|
||||
override = base.passthru.function;
|
||||
} ;
|
||||
in
|
||||
withStdOverrides;
|
||||
|
||||
withStdOverrides;
|
||||
|
||||
|
||||
# predecessors: proposed replacement for applyAndFun (which has a bug cause it merges twice)
|
||||
# the naming "overridableDelayableArgs" tries to express that you can
|
||||
@@ -49,35 +49,35 @@ rec {
|
||||
#
|
||||
# examples: see test cases "res" below;
|
||||
overridableDelayableArgs =
|
||||
f: # the function applied to the arguments
|
||||
initial: # you pass attrs, the functions below are passing a function taking the fix argument
|
||||
f : # the function applied to the arguments
|
||||
initial : # you pass attrs, the functions below are passing a function taking the fix argument
|
||||
let
|
||||
takeFixed = if isFunction initial then initial else (fixed : initial); # transform initial to an expression always taking the fixed argument
|
||||
tidy = args:
|
||||
tidy = args :
|
||||
let # apply all functions given in "applyPreTidy" in sequence
|
||||
applyPreTidyFun = fold ( n: a: x: n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args);
|
||||
applyPreTidyFun = fold ( n : a : x : n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args);
|
||||
in removeAttrs (applyPreTidyFun args) ( ["applyPreTidy"] ++ (maybeAttr "removeAttrs" [] args) ); # tidy up args before applying them
|
||||
fun = n: x:
|
||||
let newArgs = fixed:
|
||||
let args = takeFixed fixed;
|
||||
mergeFun = args.${n};
|
||||
in if isAttrs x then (mergeFun args x)
|
||||
else assert isFunction x;
|
||||
mergeFun args (x ( args // { inherit fixed; }));
|
||||
in overridableDelayableArgs f newArgs;
|
||||
fun = n : x :
|
||||
let newArgs = fixed :
|
||||
let args = takeFixed fixed;
|
||||
mergeFun = args.${n};
|
||||
in if isAttrs x then (mergeFun args x)
|
||||
else assert isFunction x;
|
||||
mergeFun args (x ( args // { inherit fixed; }));
|
||||
in overridableDelayableArgs f newArgs;
|
||||
in
|
||||
(f (tidy (lib.fix takeFixed))) // {
|
||||
merge = fun "mergeFun";
|
||||
replace = fun "keepFun";
|
||||
};
|
||||
defaultOverridableDelayableArgs = f:
|
||||
defaultOverridableDelayableArgs = f :
|
||||
let defaults = {
|
||||
mergeFun = mergeAttrByFunc; # default merge function. merge strategie (concatenate lists, strings) is given by mergeAttrBy
|
||||
keepFun = a: b: { inherit (a) removeAttrs mergeFun keepFun mergeAttrBy; } // b; # even when using replace preserve these values
|
||||
keepFun = a : b : { inherit (a) removeAttrs mergeFun keepFun mergeAttrBy; } // b; # even when using replace preserve these values
|
||||
applyPreTidy = []; # list of functions applied to args before args are tidied up (usage case : prepareDerivationArgs)
|
||||
mergeAttrBy = mergeAttrBy // {
|
||||
applyPreTidy = a: b: a ++ b;
|
||||
removeAttrs = a: b: a ++ b;
|
||||
applyPreTidy = a : b : a ++ b;
|
||||
removeAttrs = a : b: a ++ b;
|
||||
};
|
||||
removeAttrs = ["mergeFun" "keepFun" "mergeAttrBy" "removeAttrs" "fixed" ]; # before applying the arguments to the function make sure these names are gone
|
||||
};
|
||||
@@ -86,7 +86,7 @@ rec {
|
||||
|
||||
|
||||
# rec { # an example of how composedArgsAndFun can be used
|
||||
# a = composedArgsAndFun (x: x) { a = ["2"]; meta = { d = "bar";}; };
|
||||
# a = composedArgsAndFun (x : x) { a = ["2"]; meta = { d = "bar";}; };
|
||||
# # meta.d will be lost ! It's your task to preserve it (eg using a merge function)
|
||||
# b = a.passthru.function { a = [ "3" ]; meta = { d2 = "bar2";}; };
|
||||
# # instead of passing/ overriding values you can use a merge function:
|
||||
@@ -119,7 +119,7 @@ rec {
|
||||
else if val == true || val == false then false
|
||||
else null;
|
||||
|
||||
|
||||
|
||||
# Return true only if there is an attribute and it is true.
|
||||
checkFlag = attrSet: name:
|
||||
if name == "true" then true else
|
||||
@@ -134,29 +134,29 @@ rec {
|
||||
( attrByPath [name] (if checkFlag attrSet name then true else
|
||||
if argList == [] then null else
|
||||
let x = builtins.head argList; in
|
||||
if (head x) == name then
|
||||
if (head x) == name then
|
||||
(head (tail x))
|
||||
else (getValue attrSet
|
||||
else (getValue attrSet
|
||||
(tail argList) name)) attrSet );
|
||||
|
||||
|
||||
|
||||
# Input : attrSet, [[name default] ...], [ [flagname reqs..] ... ]
|
||||
# Output : are reqs satisfied? It's asserted.
|
||||
checkReqs = attrSet: argList: condList:
|
||||
checkReqs = attrSet : argList : condList :
|
||||
(
|
||||
fold lib.and true
|
||||
(map (x: let name = (head x); in
|
||||
|
||||
((checkFlag attrSet name) ->
|
||||
fold lib.and true
|
||||
(map (x: let name = (head x) ; in
|
||||
|
||||
((checkFlag attrSet name) ->
|
||||
(fold lib.and true
|
||||
(map (y: let val=(getValue attrSet argList y); in
|
||||
(val!=null) && (val!=false))
|
||||
(tail x))))) condList));
|
||||
|
||||
(val!=null) && (val!=false))
|
||||
(tail x))))) condList)) ;
|
||||
|
||||
|
||||
# This function has O(n^2) performance.
|
||||
uniqList = { inputList, acc ? [] }:
|
||||
let go = xs: acc:
|
||||
uniqList = {inputList, acc ? []} :
|
||||
let go = xs : acc :
|
||||
if xs == []
|
||||
then []
|
||||
else let x = head xs;
|
||||
@@ -164,26 +164,26 @@ rec {
|
||||
in y ++ go (tail xs) (y ++ acc);
|
||||
in go inputList acc;
|
||||
|
||||
uniqListExt = { inputList,
|
||||
outputList ? [],
|
||||
getter ? (x: x),
|
||||
compare ? (x: y: x==y) }:
|
||||
uniqListExt = {inputList, outputList ? [],
|
||||
getter ? (x : x), compare ? (x: y: x==y)}:
|
||||
if inputList == [] then outputList else
|
||||
let x = head inputList;
|
||||
isX = y: (compare (getter y) (getter x));
|
||||
newOutputList = outputList ++
|
||||
(if any isX outputList then [] else [x]);
|
||||
in uniqListExt { outputList = newOutputList;
|
||||
inputList = (tail inputList);
|
||||
inherit getter compare;
|
||||
};
|
||||
let x=head inputList;
|
||||
isX = y: (compare (getter y) (getter x));
|
||||
newOutputList = outputList ++
|
||||
(if any isX outputList then [] else [x]);
|
||||
in uniqListExt {outputList=newOutputList;
|
||||
inputList = (tail inputList);
|
||||
inherit getter compare;
|
||||
};
|
||||
|
||||
|
||||
|
||||
condConcat = name: list: checker:
|
||||
if list == [] then name else
|
||||
if checker (head list) then
|
||||
condConcat
|
||||
(name + (head (tail list)))
|
||||
(tail (tail list))
|
||||
if checker (head list) then
|
||||
condConcat
|
||||
(name + (head (tail list)))
|
||||
(tail (tail list))
|
||||
checker
|
||||
else condConcat
|
||||
name (tail (tail list)) checker;
|
||||
@@ -202,12 +202,12 @@ rec {
|
||||
in
|
||||
work startSet [] [];
|
||||
|
||||
innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
|
||||
innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
|
||||
innerModifySumArgs f x (a // b);
|
||||
modifySumArgs = f: x: innerModifySumArgs f x {};
|
||||
|
||||
|
||||
innerClosePropagation = acc: xs:
|
||||
innerClosePropagation = acc : xs :
|
||||
if xs == []
|
||||
then acc
|
||||
else let y = head xs;
|
||||
@@ -227,45 +227,45 @@ rec {
|
||||
closePropagation = list: (uniqList {inputList = (innerClosePropagation [] list);});
|
||||
|
||||
# calls a function (f attr value ) for each record item. returns a list
|
||||
mapAttrsFlatten = f: r: map (attr: f attr r.${attr}) (attrNames r);
|
||||
mapAttrsFlatten = f : r : map (attr: f attr r.${attr}) (attrNames r);
|
||||
|
||||
# attribute set containing one attribute
|
||||
nvs = name: value: listToAttrs [ (nameValuePair name value) ];
|
||||
nvs = name : value : listToAttrs [ (nameValuePair name value) ];
|
||||
# adds / replaces an attribute of an attribute set
|
||||
setAttr = set: name: v: set // (nvs name v);
|
||||
setAttr = set : name : v : set // (nvs name v);
|
||||
|
||||
# setAttrMerge (similar to mergeAttrsWithFunc but only merges the values of a particular name)
|
||||
# setAttrMerge "a" [] { a = [2];} (x: x ++ [3]) -> { a = [2 3]; }
|
||||
# setAttrMerge "a" [] { } (x: x ++ [3]) -> { a = [ 3]; }
|
||||
setAttrMerge = name: default: attrs: f:
|
||||
# setAttrMerge "a" [] { a = [2];} (x : x ++ [3]) -> { a = [2 3]; }
|
||||
# setAttrMerge "a" [] { } (x : x ++ [3]) -> { a = [ 3]; }
|
||||
setAttrMerge = name : default : attrs : f :
|
||||
setAttr attrs name (f (maybeAttr name default attrs));
|
||||
|
||||
# Using f = a: b = b the result is similar to //
|
||||
# Using f = a : b = b the result is similar to //
|
||||
# merge attributes with custom function handling the case that the attribute
|
||||
# exists in both sets
|
||||
mergeAttrsWithFunc = f: set1: set2:
|
||||
fold (n: set: if set ? ${n}
|
||||
mergeAttrsWithFunc = f : set1 : set2 :
|
||||
fold (n: set : if set ? ${n}
|
||||
then setAttr set n (f set.${n} set2.${n})
|
||||
else set )
|
||||
(set2 // set1) (attrNames set2);
|
||||
|
||||
# merging two attribute set concatenating the values of same attribute names
|
||||
# eg { a = 7; } { a = [ 2 3 ]; } becomes { a = [ 7 2 3 ]; }
|
||||
mergeAttrsConcatenateValues = mergeAttrsWithFunc ( a: b: (toList a) ++ (toList b) );
|
||||
mergeAttrsConcatenateValues = mergeAttrsWithFunc ( a : b : (toList a) ++ (toList b) );
|
||||
|
||||
# merges attributes using //, if a name exists in both attributes
|
||||
# merges attributes using //, if a name exisits in both attributes
|
||||
# an error will be triggered unless its listed in mergeLists
|
||||
# so you can mergeAttrsNoOverride { buildInputs = [a]; } { buildInputs = [a]; } {} to get
|
||||
# { buildInputs = [a b]; }
|
||||
# merging buildPhase doesn't really make sense. The cases will be rare where appending /prefixing will fit your needs?
|
||||
# merging buildPhase does'nt really make sense. The cases will be rare where appending /prefixing will fit your needs?
|
||||
# in these cases the first buildPhase will override the second one
|
||||
# ! deprecated, use mergeAttrByFunc instead
|
||||
mergeAttrsNoOverride = { mergeLists ? ["buildInputs" "propagatedBuildInputs"],
|
||||
overrideSnd ? [ "buildPhase" ]
|
||||
}: attrs1: attrs2:
|
||||
fold (n: set:
|
||||
} : attrs1 : attrs2 :
|
||||
fold (n: set :
|
||||
setAttr set n ( if set ? ${n}
|
||||
then # merge
|
||||
then # merge
|
||||
if elem n mergeLists # attribute contains list, merge them by concatenating
|
||||
then attrs2.${n} ++ attrs1.${n}
|
||||
else if elem n overrideSnd
|
||||
@@ -286,14 +286,14 @@ rec {
|
||||
# { mergeAttrsBy = [...]; buildInputs = [ a b c d ]; }
|
||||
# is used by prepareDerivationArgs, defaultOverridableDelayableArgs and can be used when composing using
|
||||
# foldArgs, composedArgsAndFun or applyAndFun. Example: composableDerivation in all-packages.nix
|
||||
mergeAttrByFunc = x: y:
|
||||
mergeAttrByFunc = x : y :
|
||||
let
|
||||
mergeAttrBy2 = { mergeAttrBy = lib.mergeAttrs; }
|
||||
mergeAttrBy2 = { mergeAttrBy=lib.mergeAttrs; }
|
||||
// (maybeAttr "mergeAttrBy" {} x)
|
||||
// (maybeAttr "mergeAttrBy" {} y); in
|
||||
fold lib.mergeAttrs {} [
|
||||
x y
|
||||
(mapAttrs ( a: v: # merge special names using given functions
|
||||
(mapAttrs ( a : v : # merge special names using given functions
|
||||
if x ? ${a}
|
||||
then if y ? ${a}
|
||||
then v x.${a} y.${a} # both have attr, use merge func
|
||||
@@ -309,19 +309,58 @@ rec {
|
||||
mergeAttrsByFuncDefaults = foldl mergeAttrByFunc { inherit mergeAttrBy; };
|
||||
mergeAttrsByFuncDefaultsClean = list: removeAttrs (mergeAttrsByFuncDefaults list) ["mergeAttrBy"];
|
||||
|
||||
# merge attrs based on version key into mkDerivation args, see mergeAttrBy to learn about smart merge defaults
|
||||
#
|
||||
# This function is best explained by an example:
|
||||
#
|
||||
# {version ? "2.x"} :
|
||||
#
|
||||
# mkDerivation (mergeAttrsByVersion "package-name" version
|
||||
# { # version specific settings
|
||||
# "git" = { src = ..; preConfigre = "autogen.sh"; buildInputs = [automake autoconf libtool]; };
|
||||
# "2.x" = { src = ..; };
|
||||
# }
|
||||
# { // shared settings
|
||||
# buildInputs = [ common build inputs ];
|
||||
# meta = { .. }
|
||||
# }
|
||||
# )
|
||||
#
|
||||
# Please note that e.g. Eelco Dolstra usually prefers having one file for
|
||||
# each version. On the other hand there are valuable additional design goals
|
||||
# - readability
|
||||
# - do it once only
|
||||
# - try to avoid duplication
|
||||
#
|
||||
# Marc Weber and Michael Raskin sometimes prefer keeping older
|
||||
# versions around for testing and regression tests - as long as its cheap to
|
||||
# do so.
|
||||
#
|
||||
# Very often it just happens that the "shared" code is the bigger part.
|
||||
# Then using this function might be appropriate.
|
||||
#
|
||||
# Be aware that its easy to cause recompilations in all versions when using
|
||||
# this function - also if derivations get too complex splitting into multiple
|
||||
# files is the way to go.
|
||||
#
|
||||
# See misc.nix -> versionedDerivation
|
||||
# discussion: nixpkgs: pull/310
|
||||
mergeAttrsByVersion = name: version: attrsByVersion: base:
|
||||
mergeAttrsByFuncDefaultsClean [ { name = "${name}-${version}"; } base (maybeAttr version (throw "bad version ${version} for ${name}") attrsByVersion)];
|
||||
|
||||
# sane defaults (same name as attr name so that inherit can be used)
|
||||
mergeAttrBy = # { buildInputs = concatList; [...]; passthru = mergeAttr; [..]; }
|
||||
listToAttrs (map (n: nameValuePair n lib.concat)
|
||||
listToAttrs (map (n : nameValuePair n lib.concat)
|
||||
[ "nativeBuildInputs" "buildInputs" "propagatedBuildInputs" "configureFlags" "prePhases" "postAll" "patches" ])
|
||||
// listToAttrs (map (n: nameValuePair n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ])
|
||||
// listToAttrs (map (n: nameValuePair n (a: b: "${a}\n${b}") ) [ "preConfigure" "postInstall" ])
|
||||
// listToAttrs (map (n : nameValuePair n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ])
|
||||
// listToAttrs (map (n : nameValuePair n (a: b: "${a}\n${b}") ) [ "preConfigure" "postInstall" ])
|
||||
;
|
||||
|
||||
# prepareDerivationArgs tries to make writing configurable derivations easier
|
||||
# example:
|
||||
# prepareDerivationArgs {
|
||||
# mergeAttrBy = {
|
||||
# myScript = x: y: x ++ "\n" ++ y;
|
||||
# myScript = x : y : x ++ "\n" ++ y;
|
||||
# };
|
||||
# cfg = {
|
||||
# readlineSupport = true;
|
||||
@@ -353,10 +392,10 @@ rec {
|
||||
# TODO use args.mergeFun here as well?
|
||||
prepareDerivationArgs = args:
|
||||
let args2 = { cfg = {}; flags = {}; } // args;
|
||||
flagName = name: "${name}Support";
|
||||
cfgWithDefaults = (listToAttrs (map (n: nameValuePair (flagName n) false) (attrNames args2.flags)))
|
||||
flagName = name : "${name}Support";
|
||||
cfgWithDefaults = (listToAttrs (map (n : nameValuePair (flagName n) false) (attrNames args2.flags)))
|
||||
// args2.cfg;
|
||||
opts = attrValues (mapAttrs (a: v:
|
||||
opts = attrValues (mapAttrs (a : v :
|
||||
let v2 = if v ? set || v ? unset then v else { set = v; };
|
||||
n = if cfgWithDefaults.${flagName a} then "set" else "unset";
|
||||
attr = maybeAttr n {} v2; in
|
||||
@@ -381,12 +420,4 @@ rec {
|
||||
else if isInt x then "int"
|
||||
else "string";
|
||||
|
||||
/* deprecated:
|
||||
|
||||
For historical reasons, imap has an index starting at 1.
|
||||
|
||||
But for consistency with the rest of the library we want an index
|
||||
starting at zero.
|
||||
*/
|
||||
imap = imap1;
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# snippets that can be shared by multiple fetchers (pkgs/build-support)
|
||||
{
|
||||
|
||||
proxyImpureEnvVars = [
|
||||
# We borrow these environment variables from the caller to allow
|
||||
# easy proxy configuration. This is impure, but a fixed-output
|
||||
# derivation like fetchurl is allowed to do so since its result is
|
||||
# by definition pure.
|
||||
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
||||
];
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
{ # haskellPathsInDir : Path -> Map String Path
|
||||
# A map of all haskell packages defined in the given path,
|
||||
# identified by having a cabal file with the same name as the
|
||||
# directory itself.
|
||||
haskellPathsInDir = root:
|
||||
let # Files in the root
|
||||
root-files = builtins.attrNames (builtins.readDir root);
|
||||
# Files with their full paths
|
||||
root-files-with-paths =
|
||||
map (file:
|
||||
{ name = file; value = root + "/${file}"; }
|
||||
) root-files;
|
||||
# Subdirectories of the root with a cabal file.
|
||||
cabal-subdirs =
|
||||
builtins.filter ({ name, value }:
|
||||
builtins.pathExists (value + "/${name}.cabal")
|
||||
) root-files-with-paths;
|
||||
in builtins.listToAttrs cabal-subdirs;
|
||||
# locateDominatingFile : RegExp
|
||||
# -> Path
|
||||
# -> Nullable { path : Path;
|
||||
# matches : [ MatchResults ];
|
||||
# }
|
||||
# Find the first directory containing a file matching 'pattern'
|
||||
# upward from a given 'file'.
|
||||
# Returns 'null' if no directories contain a file matching 'pattern'.
|
||||
locateDominatingFile = pattern: file:
|
||||
let go = path:
|
||||
let files = builtins.attrNames (builtins.readDir path);
|
||||
matches = builtins.filter (match: match != null)
|
||||
(map (builtins.match pattern) files);
|
||||
in
|
||||
if builtins.length matches != 0
|
||||
then { inherit path matches; }
|
||||
else if path == /.
|
||||
then null
|
||||
else go (dirOf path);
|
||||
parent = dirOf file;
|
||||
isDir =
|
||||
let base = baseNameOf file;
|
||||
type = (builtins.readDir parent).${base} or null;
|
||||
in file == /. || type == "directory";
|
||||
in go (if isDir then file else parent);
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
rec {
|
||||
# Compute the fixed point of the given function `f`, which is usually an
|
||||
# attribute set that expects its final, non-recursive representation as an
|
||||
# argument:
|
||||
#
|
||||
# f = self: { foo = "foo"; bar = "bar"; foobar = self.foo + self.bar; }
|
||||
#
|
||||
# Nix evaluates this recursion until all references to `self` have been
|
||||
# resolved. At that point, the final result is returned and `f x = x` holds:
|
||||
#
|
||||
# nix-repl> fix f
|
||||
# { bar = "bar"; foo = "foo"; foobar = "foobar"; }
|
||||
#
|
||||
# Type: fix :: (a -> a) -> a
|
||||
#
|
||||
# See https://en.wikipedia.org/wiki/Fixed-point_combinator for further
|
||||
# details.
|
||||
fix = f: let x = f x; in x;
|
||||
|
||||
# A variant of `fix` that records the original recursive attribute set in the
|
||||
# result. This is useful in combination with the `extends` function to
|
||||
# implement deep overriding. See pkgs/development/haskell-modules/default.nix
|
||||
# for a concrete example.
|
||||
fix' = f: let x = f x // { __unfix__ = f; }; in x;
|
||||
|
||||
# Modify the contents of an explicitly recursive attribute set in a way that
|
||||
# honors `self`-references. This is accomplished with a function
|
||||
#
|
||||
# g = self: super: { foo = super.foo + " + "; }
|
||||
#
|
||||
# that has access to the unmodified input (`super`) as well as the final
|
||||
# non-recursive representation of the attribute set (`self`). `extends`
|
||||
# differs from the native `//` operator insofar as that it's applied *before*
|
||||
# references to `self` are resolved:
|
||||
#
|
||||
# nix-repl> fix (extends g f)
|
||||
# { bar = "bar"; foo = "foo + "; foobar = "foo + bar"; }
|
||||
#
|
||||
# The name of the function is inspired by object-oriented inheritance, i.e.
|
||||
# think of it as an infix operator `g extends f` that mimics the syntax from
|
||||
# Java. It may seem counter-intuitive to have the "base class" as the second
|
||||
# argument, but it's nice this way if several uses of `extends` are cascaded.
|
||||
extends = f: rattrs: self: let super = rattrs self; in super // f self super;
|
||||
|
||||
# Compose two extending functions of the type expected by 'extends'
|
||||
# into one where changes made in the first are available in the
|
||||
# 'super' of the second
|
||||
composeExtensions =
|
||||
f: g: self: super:
|
||||
let fApplied = f self super;
|
||||
super' = super // fApplied;
|
||||
in fApplied // g self super';
|
||||
|
||||
# Create an overridable, recursive attribute set. For example:
|
||||
#
|
||||
# nix-repl> obj = makeExtensible (self: { })
|
||||
#
|
||||
# nix-repl> obj
|
||||
# { __unfix__ = «lambda»; extend = «lambda»; }
|
||||
#
|
||||
# nix-repl> obj = obj.extend (self: super: { foo = "foo"; })
|
||||
#
|
||||
# nix-repl> obj
|
||||
# { __unfix__ = «lambda»; extend = «lambda»; foo = "foo"; }
|
||||
#
|
||||
# nix-repl> obj = obj.extend (self: super: { foo = super.foo + " + "; bar = "bar"; foobar = self.foo + self.bar; })
|
||||
#
|
||||
# nix-repl> obj
|
||||
# { __unfix__ = «lambda»; bar = "bar"; extend = «lambda»; foo = "foo + "; foobar = "foo + bar"; }
|
||||
makeExtensible = makeExtensibleWithCustomName "extend";
|
||||
|
||||
# Same as `makeExtensible` but the name of the extending attribute is
|
||||
# customized.
|
||||
makeExtensibleWithCustomName = extenderName: rattrs:
|
||||
fix' rattrs // {
|
||||
${extenderName} = f: makeExtensibleWithCustomName extenderName (extends f rattrs);
|
||||
};
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/* Functions that generate widespread file
|
||||
* formats from nix data structures.
|
||||
*
|
||||
* They all follow a similar interface:
|
||||
* generator { config-attrs } data
|
||||
*
|
||||
* Tests can be found in ./tests.nix
|
||||
* Documentation in the manual, #sec-generators
|
||||
*/
|
||||
with import ./trivial.nix;
|
||||
let
|
||||
libStr = import ./strings.nix;
|
||||
libAttr = import ./attrsets.nix;
|
||||
|
||||
flipMapAttrs = flip libAttr.mapAttrs;
|
||||
in
|
||||
|
||||
rec {
|
||||
|
||||
/* Generate a line of key k and value v, separated by
|
||||
* character sep. If sep appears in k, it is escaped.
|
||||
* Helper for synaxes with different separators.
|
||||
*
|
||||
* mkKeyValueDefault ":" "f:oo" "bar"
|
||||
* > "f\:oo:bar"
|
||||
*/
|
||||
mkKeyValueDefault = sep: k: v:
|
||||
"${libStr.escape [sep] k}${sep}${toString v}";
|
||||
|
||||
|
||||
/* Generate a key-value-style config file from an attrset.
|
||||
*
|
||||
* mkKeyValue is the same as in toINI.
|
||||
*/
|
||||
toKeyValue = {
|
||||
mkKeyValue ? mkKeyValueDefault "="
|
||||
}: attrs:
|
||||
let mkLine = k: v: mkKeyValue k v + "\n";
|
||||
in libStr.concatStrings (libAttr.mapAttrsToList mkLine attrs);
|
||||
|
||||
|
||||
/* Generate an INI-style config file from an
|
||||
* attrset of sections to an attrset of key-value pairs.
|
||||
*
|
||||
* generators.toINI {} {
|
||||
* foo = { hi = "${pkgs.hello}"; ciao = "bar"; };
|
||||
* baz = { "also, integers" = 42; };
|
||||
* }
|
||||
*
|
||||
*> [baz]
|
||||
*> also, integers=42
|
||||
*>
|
||||
*> [foo]
|
||||
*> ciao=bar
|
||||
*> hi=/nix/store/y93qql1p5ggfnaqjjqhxcw0vqw95rlz0-hello-2.10
|
||||
*
|
||||
* The mk* configuration attributes can generically change
|
||||
* the way sections and key-value strings are generated.
|
||||
*
|
||||
* For more examples see the test cases in ./tests.nix.
|
||||
*/
|
||||
toINI = {
|
||||
# apply transformations (e.g. escapes) to section names
|
||||
mkSectionName ? (name: libStr.escape [ "[" "]" ] name),
|
||||
# format a setting line from key and value
|
||||
mkKeyValue ? mkKeyValueDefault "="
|
||||
}: attrsOfAttrs:
|
||||
let
|
||||
# map function to string for each key val
|
||||
mapAttrsToStringsSep = sep: mapFn: attrs:
|
||||
libStr.concatStringsSep sep
|
||||
(libAttr.mapAttrsToList mapFn attrs);
|
||||
mkSection = sectName: sectValues: ''
|
||||
[${mkSectionName sectName}]
|
||||
'' + toKeyValue { inherit mkKeyValue; } sectValues;
|
||||
in
|
||||
# map input to ini sections
|
||||
mapAttrsToStringsSep "\n" mkSection attrsOfAttrs;
|
||||
|
||||
|
||||
/* Generates JSON from an arbitrary (non-function) value.
|
||||
* For more information see the documentation of the builtin.
|
||||
*/
|
||||
toJSON = {}: builtins.toJSON;
|
||||
|
||||
|
||||
/* YAML has been a strict superset of JSON since 1.2, so we
|
||||
* use toJSON. Before it only had a few differences referring
|
||||
* to implicit typing rules, so it should work with older
|
||||
* parsers as well.
|
||||
*/
|
||||
toYAML = {}@args: toJSON args;
|
||||
|
||||
/* Pretty print a value, akin to `builtins.trace`.
|
||||
* Should probably be a builtin as well.
|
||||
*/
|
||||
toPretty = {
|
||||
/* If this option is true, attrsets like { __pretty = fn; val = …; }
|
||||
will use fn to convert val to a pretty printed representation.
|
||||
(This means fn is type Val -> String.) */
|
||||
allowPrettyValues ? false
|
||||
}@args: v: with builtins;
|
||||
if isInt v then toString v
|
||||
else if isBool v then (if v == true then "true" else "false")
|
||||
else if isString v then "\"" + v + "\""
|
||||
else if null == v then "null"
|
||||
else if isFunction v then
|
||||
let fna = functionArgs v;
|
||||
showFnas = concatStringsSep "," (libAttr.mapAttrsToList
|
||||
(name: hasDefVal: if hasDefVal then "(${name})" else name)
|
||||
fna);
|
||||
in if fna == {} then "<λ>"
|
||||
else "<λ:{${showFnas}}>"
|
||||
else if isList v then "[ "
|
||||
+ libStr.concatMapStringsSep " " (toPretty args) v
|
||||
+ " ]"
|
||||
else if isAttrs v then
|
||||
# apply pretty values if allowed
|
||||
if attrNames v == [ "__pretty" "val" ] && allowPrettyValues
|
||||
then v.__pretty v.val
|
||||
# TODO: there is probably a better representation?
|
||||
else if v ? type && v.type == "derivation" then "<δ>"
|
||||
else "{ "
|
||||
+ libStr.concatStringsSep " " (libAttr.mapAttrsToList
|
||||
(name: value:
|
||||
"${toPretty args name} = ${toPretty args value};") v)
|
||||
+ " }"
|
||||
else "toPretty: should never happen (v = ${v})";
|
||||
|
||||
}
|
||||
@@ -45,11 +45,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Apple Public Source License 2.0";
|
||||
};
|
||||
|
||||
arphicpl = {
|
||||
fullName = "Arphic Public License";
|
||||
url = https://www.freedesktop.org/wiki/Arphic_Public_License/;
|
||||
};
|
||||
|
||||
artistic1 = spdx {
|
||||
spdxId = "Artistic-1.0";
|
||||
fullName = "Artistic License 1.0";
|
||||
@@ -70,11 +65,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Boost Software License 1.0";
|
||||
};
|
||||
|
||||
beerware = spdx {
|
||||
spdxId = "Beerware";
|
||||
fullName = ''Beerware License'';
|
||||
};
|
||||
|
||||
bsd2 = spdx {
|
||||
spdxId = "BSD-2-Clause";
|
||||
fullName = ''BSD 2-clause "Simplified" License'';
|
||||
@@ -115,11 +105,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Creative Commons Attribution Non Commercial Share Alike 4.0";
|
||||
};
|
||||
|
||||
cc-by-nd-30 = spdx {
|
||||
spdxId = "CC-BY-ND-3.0";
|
||||
fullName = "Creative Commons Attribution-No Derivative Works v3.00";
|
||||
};
|
||||
|
||||
cc-by-sa-25 = spdx {
|
||||
spdxId = "CC-BY-SA-2.5";
|
||||
fullName = "Creative Commons Attribution Share Alike 2.5";
|
||||
@@ -196,11 +181,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
free = false;
|
||||
};
|
||||
|
||||
eupl11 = spdx {
|
||||
spdxId = "EUPL-1.1";
|
||||
fullname = "European Union Public License 1.1";
|
||||
};
|
||||
|
||||
fdl12 = spdx {
|
||||
spdxId = "GFDL-1.2";
|
||||
fullName = "GNU Free Documentation License v1.2";
|
||||
@@ -362,11 +342,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Lucent Public License v1.02";
|
||||
};
|
||||
|
||||
miros = {
|
||||
fullname = "MirOS License";
|
||||
url = https://opensource.org/licenses/MirOS;
|
||||
};
|
||||
|
||||
# spdx.org does not (yet) differentiate between the X11 and Expat versions
|
||||
# for details see http://en.wikipedia.org/wiki/MIT_License#Various_versions
|
||||
mit = spdx {
|
||||
@@ -389,11 +364,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Mozilla Public License 2.0";
|
||||
};
|
||||
|
||||
mspl = spdx {
|
||||
spdxId = "MS-PL";
|
||||
fullName = "Microsoft Public License";
|
||||
};
|
||||
|
||||
msrla = {
|
||||
fullName = "Microsoft Research License Agreement";
|
||||
url = "http://research.microsoft.com/en-us/projects/pex/msr-la.txt";
|
||||
@@ -469,12 +439,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Sleepycat License";
|
||||
};
|
||||
|
||||
smail = {
|
||||
shortName = "smail";
|
||||
fullName = "SMAIL General Public License";
|
||||
url = http://metadata.ftp-master.debian.org/changelogs/main/d/debianutils/debianutils_4.8.1_copyright;
|
||||
};
|
||||
|
||||
tcltk = spdx {
|
||||
spdxId = "TCL";
|
||||
fullName = "TCL/TK License";
|
||||
@@ -506,11 +470,6 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "The Unlicense";
|
||||
};
|
||||
|
||||
upl = {
|
||||
fullName = "Universal Permissive License";
|
||||
url = "https://oss.oracle.com/licenses/upl/";
|
||||
};
|
||||
|
||||
vim = spdx {
|
||||
spdxId = "Vim";
|
||||
fullName = "Vim License";
|
||||
@@ -536,22 +495,17 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
||||
fullName = "Do What The F*ck You Want To Public License";
|
||||
};
|
||||
|
||||
wxWindows = spdx {
|
||||
spdxId = "WXwindows";
|
||||
fullName = "wxWindows Library Licence, Version 3.1";
|
||||
};
|
||||
|
||||
zlib = spdx {
|
||||
spdxId = "Zlib";
|
||||
fullName = "zlib License";
|
||||
};
|
||||
|
||||
zpl20 = spdx {
|
||||
zpt20 = spdx { # FIXME: why zpt* instead of zpl*
|
||||
spdxId = "ZPL-2.0";
|
||||
fullName = "Zope Public License 2.0";
|
||||
};
|
||||
|
||||
zpl21 = spdx {
|
||||
zpt21 = spdx {
|
||||
spdxId = "ZPL-2.1";
|
||||
fullName = "Zope Public License 2.1";
|
||||
};
|
||||
|
||||
@@ -16,22 +16,17 @@ rec {
|
||||
*/
|
||||
singleton = x: [x];
|
||||
|
||||
/* “right fold” a binary function `op' between successive elements of
|
||||
`list' with `nul' as the starting value, i.e.,
|
||||
`foldr op nul [x_1 x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'.
|
||||
Type:
|
||||
foldr :: (a -> b -> b) -> b -> [a] -> b
|
||||
/* "Fold" a binary function `op' between successive elements of
|
||||
`list' with `nul' as the starting value, i.e., `fold op nul [x_1
|
||||
x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'. (This is
|
||||
Haskell's foldr).
|
||||
|
||||
Example:
|
||||
concat = foldr (a: b: a + b) "z"
|
||||
concat = fold (a: b: a + b) "z"
|
||||
concat [ "a" "b" "c" ]
|
||||
=> "abcz"
|
||||
# different types
|
||||
strange = foldr (int: str: toString (int + 1) + str) "a"
|
||||
strange [ 1 2 3 4 ]
|
||||
=> "2345a"
|
||||
*/
|
||||
foldr = op: nul: list:
|
||||
fold = op: nul: list:
|
||||
let
|
||||
len = length list;
|
||||
fold' = n:
|
||||
@@ -40,25 +35,13 @@ rec {
|
||||
else op (elemAt list n) (fold' (n + 1));
|
||||
in fold' 0;
|
||||
|
||||
/* `fold' is an alias of `foldr' for historic reasons */
|
||||
# FIXME(Profpatsch): deprecate?
|
||||
fold = foldr;
|
||||
|
||||
|
||||
/* “left fold”, like `foldr', but from the left:
|
||||
`foldl op nul [x_1 x_2 ... x_n] == op (... (op (op nul x_1) x_2) ... x_n)`.
|
||||
|
||||
Type:
|
||||
foldl :: (b -> a -> b) -> b -> [a] -> b
|
||||
/* Left fold: `fold op nul [x_1 x_2 ... x_n] == op (... (op (op nul
|
||||
x_1) x_2) ... x_n)'.
|
||||
|
||||
Example:
|
||||
lconcat = foldl (a: b: a + b) "z"
|
||||
lconcat [ "a" "b" "c" ]
|
||||
=> "zabc"
|
||||
# different types
|
||||
lstrange = foldl (str: int: str + toString (int + 1)) ""
|
||||
strange [ 1 2 3 4 ]
|
||||
=> "a2345"
|
||||
*/
|
||||
foldl = op: nul: list:
|
||||
let
|
||||
@@ -69,7 +52,7 @@ rec {
|
||||
else op (foldl' (n - 1)) (elemAt list n);
|
||||
in foldl' (length list - 1);
|
||||
|
||||
/* Strict version of `foldl'.
|
||||
/* Strict version of foldl.
|
||||
|
||||
The difference is that evaluation is forced upon access. Usually used
|
||||
with small whole results (in contract with lazily-generated list or large
|
||||
@@ -77,21 +60,15 @@ rec {
|
||||
*/
|
||||
foldl' = builtins.foldl' or foldl;
|
||||
|
||||
/* Map with index starting from 0
|
||||
/* Map with index
|
||||
|
||||
FIXME(zimbatm): why does this start to count at 1?
|
||||
|
||||
Example:
|
||||
imap0 (i: v: "${v}-${toString i}") ["a" "b"]
|
||||
=> [ "a-0" "b-1" ]
|
||||
*/
|
||||
imap0 = f: list: genList (n: f n (elemAt list n)) (length list);
|
||||
|
||||
/* Map with index starting from 1
|
||||
|
||||
Example:
|
||||
imap1 (i: v: "${v}-${toString i}") ["a" "b"]
|
||||
imap (i: v: "${v}-${toString i}") ["a" "b"]
|
||||
=> [ "a-1" "b-2" ]
|
||||
*/
|
||||
imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
|
||||
imap = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
|
||||
|
||||
/* Map and concatenate the result.
|
||||
|
||||
@@ -163,7 +140,7 @@ rec {
|
||||
any isString [ 1 { } ]
|
||||
=> false
|
||||
*/
|
||||
any = builtins.any or (pred: foldr (x: y: if pred x then true else y) false);
|
||||
any = builtins.any or (pred: fold (x: y: if pred x then true else y) false);
|
||||
|
||||
/* Return true iff function `pred' returns true for all elements of
|
||||
`list'.
|
||||
@@ -174,7 +151,7 @@ rec {
|
||||
all (x: x < 3) [ 1 2 3 ]
|
||||
=> false
|
||||
*/
|
||||
all = builtins.all or (pred: foldr (x: y: if pred x then y else false) true);
|
||||
all = builtins.all or (pred: fold (x: y: if pred x then y else false) true);
|
||||
|
||||
/* Count how many times function `pred' returns true for the elements
|
||||
of `list'.
|
||||
@@ -197,7 +174,7 @@ rec {
|
||||
*/
|
||||
optional = cond: elem: if cond then [elem] else [];
|
||||
|
||||
/* Return a list or an empty list, depending on a boolean value.
|
||||
/* Return a list or an empty list, dependening on a boolean value.
|
||||
|
||||
Example:
|
||||
optionals true [ 2 3 ]
|
||||
@@ -242,7 +219,7 @@ rec {
|
||||
=> { right = [ 5 3 4 ]; wrong = [ 1 2 ]; }
|
||||
*/
|
||||
partition = builtins.partition or (pred:
|
||||
foldr (h: t:
|
||||
fold (h: t:
|
||||
if pred h
|
||||
then { right = [h] ++ t.right; wrong = t.wrong; }
|
||||
else { right = t.right; wrong = [h] ++ t.wrong; }
|
||||
@@ -477,12 +454,4 @@ rec {
|
||||
*/
|
||||
subtractLists = e: filter (x: !(elem x e));
|
||||
|
||||
/* Test if two lists have no common element.
|
||||
It should be slightly more efficient than (intersectLists a b == [])
|
||||
*/
|
||||
mutuallyExclusive = a: b:
|
||||
(builtins.length a) == 0 ||
|
||||
(!(builtins.elem (builtins.head a) b) &&
|
||||
mutuallyExclusive (builtins.tail a) b);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,63 +10,46 @@
|
||||
aaronschif = "Aaron Schif <aaronschif@gmail.com>";
|
||||
abaldeau = "Andreas Baldeau <andreas@baldeau.net>";
|
||||
abbradar = "Nikolay Amiantov <ab@fmap.me>";
|
||||
abigailbuccaneer = "Abigail Bunyan <abigailbuccaneer@gmail.com>";
|
||||
aboseley = "Adam Boseley <adam.boseley@gmail.com>";
|
||||
abuibrahim = "Ruslan Babayev <ruslan@babayev.com>";
|
||||
acowley = "Anthony Cowley <acowley@gmail.com>";
|
||||
adelbertc = "Adelbert Chang <adelbertc@gmail.com>";
|
||||
adev = "Adrien Devresse <adev@adev.name>";
|
||||
adisbladis = "Adam Hose <adis@blad.is>";
|
||||
Adjective-Object = "Maxwell Huang-Hobbs <mhuan13@gmail.com>";
|
||||
adnelson = "Allen Nelson <ithinkican@gmail.com>";
|
||||
adolfogc = "Adolfo E. García Castro <adolfo.garcia.cr@gmail.com>";
|
||||
aespinosa = "Allan Espinosa <allan.espinosa@outlook.com>";
|
||||
aflatter = "Alexander Flatter <flatter@fastmail.fm>";
|
||||
afldcr = "James Alexander Feldman-Crough <alex@fldcr.com>";
|
||||
aforemny = "Alexander Foremny <alexanderforemny@googlemail.com>";
|
||||
afranchuk = "Alex Franchuk <alex.franchuk@gmail.com>";
|
||||
aherrmann = "Andreas Herrmann <andreash87@gmx.ch>";
|
||||
ahmedtd = "Taahir Ahmed <ahmed.taahir@gmail.com>";
|
||||
ak = "Alexander Kjeldaas <ak@formalprivacy.com>";
|
||||
akaWolf = "Artjom Vejsel <akawolf0@gmail.com>";
|
||||
akc = "Anders Claesson <akc@akc.is>";
|
||||
algorith = "Dries Van Daele <dries_van_daele@telenet.be>";
|
||||
alibabzo = "Alistair Bill <alistair.bill@gmail.com>";
|
||||
all = "Nix Committers <nix-commits@lists.science.uu.nl>";
|
||||
alunduil = "Alex Brandt <alunduil@alunduil.com>";
|
||||
ambrop72 = "Ambroz Bizjak <ambrop7@gmail.com>";
|
||||
amiddelk = "Arie Middelkoop <amiddelk@gmail.com>";
|
||||
amiloradovsky = "Andrew Miloradovsky <miloradovsky@gmail.com>";
|
||||
amorsillo = "Andrew Morsillo <andrew.morsillo@gmail.com>";
|
||||
AndersonTorres = "Anderson Torres <torres.anderson.85@gmail.com>";
|
||||
anderspapitto = "Anders Papitto <anderspapitto@gmail.com>";
|
||||
andres = "Andres Loeh <ksnixos@andres-loeh.de>";
|
||||
andrewrk = "Andrew Kelley <superjoe30@gmail.com>";
|
||||
andsild = "Anders Sildnes <andsild@gmail.com>";
|
||||
aneeshusa = "Aneesh Agrawal <aneeshusa@gmail.com>";
|
||||
ankhers = "Justin Wood <justin.k.wood@gmail.com>";
|
||||
antono = "Antono Vasiljev <self@antono.info>";
|
||||
apeschar = "Albert Peschar <albert@peschar.net>";
|
||||
apeyroux = "Alexandre Peyroux <alex@px.io>";
|
||||
ardumont = "Antoine R. Dumont <eniotna.t@gmail.com>";
|
||||
aristid = "Aristid Breitkreuz <aristidb@gmail.com>";
|
||||
arobyn = "Alexei Robyn <shados@shados.net>";
|
||||
artuuge = "Artur E. Ruuge <artuuge@gmail.com>";
|
||||
ashalkhakov = "Artyom Shalkhakov <artyom.shalkhakov@gmail.com>";
|
||||
aske = "Kirill Boltaev <aske@fmap.me>";
|
||||
asppsa = "Alastair Pharo <asppsa@gmail.com>";
|
||||
astsmtl = "Alexander Tsamutali <astsmtl@yandex.ru>";
|
||||
asymmetric = "Lorenzo Manacorda <lorenzo@mailbox.org>";
|
||||
aszlig = "aszlig <aszlig@redmoonstudios.org>";
|
||||
auntie = "Jonathan Glines <auntieNeo@gmail.com>";
|
||||
avnik = "Alexander V. Nikolaev <avn@avnik.info>";
|
||||
aycanirican = "Aycan iRiCAN <iricanaycan@gmail.com>";
|
||||
bachp = "Pascal Bach <pascal.bach@nextrem.ch>";
|
||||
badi = "Badi' Abdul-Wahid <abdulwahidc@gmail.com>";
|
||||
balajisivaraman = "Balaji Sivaraman<sivaraman.balaji@gmail.com>";
|
||||
barrucadu = "Michael Walker <mike@barrucadu.co.uk>";
|
||||
basvandijk = "Bas van Dijk <v.dijk.bas@gmail.com>";
|
||||
Baughn = "Svein Ove Aas <sveina@gmail.com>";
|
||||
bbenoist = "Baptist BENOIST <return_0@live.com>";
|
||||
bcarrell = "Brandon Carrell <brandoncarrell@gmail.com>";
|
||||
bcdarwin = "Ben Darwin <bcdarwin@gmail.com>";
|
||||
bdimcheff = "Brandon Dimcheff <brandon@dimcheff.com>";
|
||||
@@ -75,12 +58,9 @@
|
||||
benwbooth = "Ben Booth <benwbooth@gmail.com>";
|
||||
berdario = "Dario Bertini <berdario@gmail.com>";
|
||||
bergey = "Daniel Bergey <bergey@teallabs.org>";
|
||||
bhipple = "Benjamin Hipple <bhipple@protonmail.com>";
|
||||
binarin = "Alexey Lebedeff <binarin@binarin.ru>";
|
||||
bjg = "Brian Gough <bjg@gnu.org>";
|
||||
bjornfor = "Bjørn Forsman <bjorn.forsman@gmail.com>";
|
||||
bluescreen303 = "Mathijs Kwik <mathijs@bluescreen303.nl>";
|
||||
bobakker = "Bo Bakker <bobakk3r@gmail.com>";
|
||||
bobvanderlinden = "Bob van der Linden <bobvanderlinden@gmail.com>";
|
||||
bodil = "Bodil Stokke <nix@bodil.org>";
|
||||
boothead = "Ben Ford <ben@perurbis.com>";
|
||||
@@ -90,85 +70,51 @@
|
||||
bstrik = "Berno Strik <dutchman55@gmx.com>";
|
||||
bzizou = "Bruno Bzeznik <Bruno@bzizou.net>";
|
||||
c0dehero = "CodeHero <codehero@nerdpol.ch>";
|
||||
calbrecht = "Christian Albrecht <christian.albrecht@mayflower.de>";
|
||||
calrama = "Moritz Maxeiner <moritz@ucworks.org>";
|
||||
calvertvl = "Victor Calvert <calvertvl@gmail.com>";
|
||||
campadrenalin = "Philip Horger <campadrenalin@gmail.com>";
|
||||
canndrew = "Andrew Cann <shum@canndrew.org>";
|
||||
carlsverre = "Carl Sverre <accounts@carlsverre.com>";
|
||||
casey = "Casey Rodarmor <casey@rodarmor.net>";
|
||||
caugner = "Claas Augner <nixos@caugner.de>";
|
||||
cdepillabout = "Dennis Gosnell <cdep.illabout@gmail.com>";
|
||||
cfouche = "Chaddaï Fouché <chaddai.fouche@gmail.com>";
|
||||
changlinli = "Changlin Li <mail@changlinli.com>";
|
||||
chaoflow = "Florian Friesdorf <flo@chaoflow.net>";
|
||||
chattered = "Phil Scott <me@philscotted.com>";
|
||||
choochootrain = "Hurshal Patel <hurshal@imap.cc>";
|
||||
chris-martin = "Chris Martin <ch.martin@gmail.com>";
|
||||
chrisjefferson = "Christopher Jefferson <chris@bubblescope.net>";
|
||||
christopherpoole = "Christopher Mark Poole <mail@christopherpoole.net>";
|
||||
ciil = "Simon Lackerbauer <simon@lackerbauer.com>";
|
||||
ckampka = "Christian Kampka <christian@kampka.net>";
|
||||
cko = "Christine Koppelt <christine.koppelt@gmail.com>";
|
||||
cleverca22 = "Michael Bishop <cleverca22@gmail.com>";
|
||||
cmcdragonkai = "Roger Qiu <roger.qiu@matrix.ai>";
|
||||
cmfwyp = "cmfwyp <cmfwyp@riseup.net>";
|
||||
coconnor = "Corey O'Connor <coreyoconnor@gmail.com>";
|
||||
codsl = "codsl <codsl@riseup.net>";
|
||||
codyopel = "Cody Opel <codyopel@gmail.com>";
|
||||
colemickens = "Cole Mickens <cole.mickens@gmail.com>";
|
||||
colescott = "Cole Scott <colescottsf@gmail.com>";
|
||||
copumpkin = "Dan Peebles <pumpkingod@gmail.com>";
|
||||
corngood = "David McFarland <corngood@gmail.com>";
|
||||
coroa = "Jonas Hörsch <jonas@chaoflow.net>";
|
||||
couchemar = "Andrey Pavlov <couchemar@yandex.ru>";
|
||||
cpages = "Carles Pagès <page@ruiec.cat>";
|
||||
cransom = "Casey Ransom <cransom@hubns.net>";
|
||||
cryptix = "Henry Bubert <cryptix@riseup.net>";
|
||||
CrystalGamma = "Jona Stubbe <nixos@crystalgamma.de>";
|
||||
cstrahan = "Charles Strahan <charles@cstrahan.com>";
|
||||
cwoac = "Oliver Matthews <oliver@codersoffortune.net>";
|
||||
DamienCassou = "Damien Cassou <damien@cassou.me>";
|
||||
danbst = "Danylo Hlynskyi <abcz2.uprola@gmail.com>";
|
||||
dancek = "Hannu Hartikainen <hannu.hartikainen@gmail.com>";
|
||||
danielfullmer = "Daniel Fullmer <danielrf12@gmail.com>";
|
||||
dasuxullebt = "Christoph-Simon Senjak <christoph.senjak@googlemail.com>";
|
||||
davidak = "David Kleuker <post@davidak.de>";
|
||||
davidrusu = "David Rusu <davidrusu.me@gmail.com>";
|
||||
davorb = "Davor Babic <davor@davor.se>";
|
||||
dbohdan = "Danyil Bohdan <danyil.bohdan@gmail.com>";
|
||||
dbrock = "Daniel Brockman <daniel@brockman.se>";
|
||||
deepfire = "Kosyrev Serge <_deepfire@feelingofgreen.ru>";
|
||||
demin-dmitriy = "Dmitriy Demin <demindf@gmail.com>";
|
||||
derchris = "Christian Gerbrandt <derchris@me.com>";
|
||||
DerGuteMoritz = "Moritz Heidkamp <moritz@twoticketsplease.de>";
|
||||
dermetfan = "Robin Stumm <serverkorken@gmail.com>";
|
||||
DerTim1 = "Tim Digel <tim.digel@active-group.de>";
|
||||
desiderius = "Didier J. Devroye <didier@devroye.name>";
|
||||
devhell = "devhell <\"^\"@regexmail.net>";
|
||||
dezgeg = "Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>";
|
||||
dfordivam = "Divam <dfordivam+nixpkgs@gmail.com>";
|
||||
dfoxfranke = "Daniel Fox Franke <dfoxfranke@gmail.com>";
|
||||
dgonyeo = "Derek Gonyeo <derek@gonyeo.com>";
|
||||
dipinhora = "Dipin Hora <dipinhora+github@gmail.com>";
|
||||
disassembler = "Samuel Leathers <disasm@gmail.com>";
|
||||
dmalikov = "Dmitry Malikov <malikov.d.y@gmail.com>";
|
||||
DmitryTsygankov = "Dmitry Tsygankov <dmitry.tsygankov@gmail.com>";
|
||||
dmjio = "David Johnson <djohnson.m@gmail.com>";
|
||||
dochang = "Desmond O. Chang <dochang@gmail.com>";
|
||||
domenkozar = "Domen Kozar <domen@dev.si>";
|
||||
dotlambda = "Robert Schütz <rschuetz17@gmail.com>";
|
||||
doublec = "Chris Double <chris.double@double.co.nz>";
|
||||
dpaetzel = "David Pätzel <david.a.paetzel@gmail.com>";
|
||||
drets = "Dmytro Rets <dmitryrets@gmail.com>";
|
||||
drewkett = "Andrew Burkett <burkett.andrew@gmail.com>";
|
||||
dsferruzza = "David Sferruzza <david.sferruzza@gmail.com>";
|
||||
dtzWill = "Will Dietz <nix@wdtz.org>";
|
||||
dywedir = "Vladyslav M. <dywedir@protonmail.ch>";
|
||||
e-user = "Alexander Kahl <nixos@sodosopa.io>";
|
||||
ebzzry = "Rommel Martinez <ebzzry@gmail.com>";
|
||||
edanaher = "Evan Danaher <nixos@edanaher.net>";
|
||||
edef = "edef <edef@edef.eu>";
|
||||
ederoyd46 = "Matthew Brown <matt@ederoyd.co.uk>";
|
||||
eduarrrd = "Eduard Bachmakov <e.bachmakov@gmail.com>";
|
||||
edwtjo = "Edward Tjörnhammar <ed@cflags.cc>";
|
||||
@@ -176,26 +122,19 @@
|
||||
ehegnes = "Eric Hegnes <eric.hegnes@gmail.com>";
|
||||
ehmry = "Emery Hemingway <emery@vfemail.net>";
|
||||
eikek = "Eike Kettner <eike.kettner@posteo.de>";
|
||||
ekleog = "Leo Gaspard <leo@gaspard.io>";
|
||||
elasticdog = "Aaron Bull Schaefer <aaron@elasticdog.com>";
|
||||
eleanor = "Dejan Lukan <dejan@proteansec.com>";
|
||||
elijahcaine = "Elijah Caine <elijahcainemv@gmail.com>";
|
||||
elitak = "Eric Litak <elitak@gmail.com>";
|
||||
ellis = "Ellis Whitehead <nixos@ellisw.net>";
|
||||
eperuffo = "Emanuele Peruffo <info@emanueleperuffo.com>";
|
||||
epitrochoid = "Mabry Cervin <mpcervin@uncg.edu>";
|
||||
ericbmerritt = "Eric Merritt <eric@afiniate.com>";
|
||||
ericsagnes = "Eric Sagnes <eric.sagnes@gmail.com>";
|
||||
erikryb = "Erik Rybakken <erik.rybakken@math.ntnu.no>";
|
||||
ertes = "Ertugrul Söylemez <esz@posteo.de>";
|
||||
ethercrow = "Dmitry Ivanov <ethercrow@gmail.com>";
|
||||
exi = "Reno Reckling <nixos@reckling.org>";
|
||||
exlevan = "Alexey Levan <exlevan@gmail.com>";
|
||||
expipiplus1 = "Joe Hermaszewski <nix@monoid.al>";
|
||||
fadenb = "Tristan Helmich <tristan.helmich+nixos@gmail.com>";
|
||||
fare = "Francois-Rene Rideau <fahree@gmail.com>";
|
||||
falsifian = "James Cook <james.cook@utoronto.ca>";
|
||||
florianjacob = "Florian Jacob <projects+nixos@florianjacob.de>";
|
||||
flosse = "Markus Kohlhase <mail@markus-kohlhase.de>";
|
||||
fluffynukeit = "Daniel Austin <dan@fluffynukeit.com>";
|
||||
fmthoma = "Franz Thoma <f.m.thoma@googlemail.com>";
|
||||
@@ -209,134 +148,85 @@
|
||||
ftrvxmtrx = "Siarhei Zirukin <ftrvxmtrx@gmail.com>";
|
||||
funfunctor = "Edward O'Callaghan <eocallaghan@alterapraxis.com>";
|
||||
fuuzetsu = "Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>";
|
||||
fuzzy-id = "Thomas Bach <hacking+nixos@babibo.de>";
|
||||
fxfactorial = "Edgar Aroutiounian <edgar.factorial@gmail.com>";
|
||||
gal_bolle = "Florent Becker <florent.becker@ens-lyon.org>";
|
||||
garbas = "Rok Garbas <rok@garbas.si>";
|
||||
garrison = "Jim Garrison <jim@garrison.cc>";
|
||||
gavin = "Gavin Rogers <gavin@praxeology.co.uk>";
|
||||
gebner = "Gabriel Ebner <gebner@gebner.org>";
|
||||
geistesk = "Alvar Penning <post@0x21.biz>";
|
||||
georgewhewell = "George Whewell <georgerw@gmail.com>";
|
||||
gilligan = "Tobias Pflug <tobias.pflug@gmail.com>";
|
||||
giogadi = "Luis G. Torres <lgtorres42@gmail.com>";
|
||||
gleber = "Gleb Peregud <gleber.p@gmail.com>";
|
||||
glenns = "Glenn Searby <glenn.searby@gmail.com>";
|
||||
globin = "Robin Gloster <mail@glob.in>";
|
||||
gnidorah = "Alex Ivanov <yourbestfriend@opmbx.org>";
|
||||
goibhniu = "Cillian de Róiste <cillian.deroiste@gmail.com>";
|
||||
Gonzih = "Max Gonzih <gonzih@gmail.com>";
|
||||
goodrone = "Andrew Trachenko <goodrone@gmail.com>";
|
||||
gpyh = "Yacine Hmito <yacine.hmito@gmail.com>";
|
||||
grahamc = "Graham Christensen <graham@grahamc.com>";
|
||||
grburst = "Julius Elias <grburst@openmailbox.org>";
|
||||
gridaphobe = "Eric Seidel <eric@seidel.io>";
|
||||
guibert = "David Guibert <david.guibert@gmail.com>";
|
||||
guillaumekoenig = "Guillaume Koenig <guillaume.edward.koenig@gmail.com>";
|
||||
guyonvarch = "Joris Guyonvarch <joris@guyonvarch.me>";
|
||||
hakuch = "Jesse Haber-Kucharsky <hakuch@gmail.com>";
|
||||
havvy = "Ryan Scheel <ryan.havvy@gmail.com>";
|
||||
hbunke = "Hendrik Bunke <bunke.hendrik@gmail.com>";
|
||||
hce = "Hans-Christian Esperer <hc@hcesperer.org>";
|
||||
hectorj = "Hector Jusforgues <hector.jusforgues+nixos@gmail.com>";
|
||||
heel = "Sergii Paryzhskyi <parizhskiy@gmail.com>";
|
||||
henrytill = "Henry Till <henrytill@gmail.com>";
|
||||
hhm = "hhm <heehooman+nixpkgs@gmail.com>";
|
||||
hiberno = "Christian Lask <hiberno@hiberno.net>";
|
||||
hinton = "Tom Hinton <t@larkery.com>";
|
||||
hodapp = "Chris Hodapp <hodapp87@gmail.com>";
|
||||
hrdinka = "Christoph Hrdinka <c.nix@hrdinka.at>";
|
||||
htr = "Hugo Tavares Reis <hugo@linux.com>";
|
||||
iand675 = "Ian Duncan <ian@iankduncan.com>";
|
||||
ianwookim = "Ian-Woo Kim <ianwookim@gmail.com>";
|
||||
domenkozar = "Domen Kozar <domen@dev.si>";
|
||||
igsha = "Igor Sharonov <igor.sharonov@gmail.com>";
|
||||
ikervagyok = "Balázs Lengyel <ikervagyok@gmail.com>";
|
||||
infinisil = "Silvan Mosberger <infinisil@icloud.com>";
|
||||
ivan-tkatchev = "Ivan Tkatchev <tkatchev@gmail.com>";
|
||||
j-keck = "Jürgen Keck <jhyphenkeck@gmail.com>";
|
||||
jagajaga = "Arseniy Seroka <ars.seroka@gmail.com>";
|
||||
jammerful = "jammerful <jammerful@gmail.com>";
|
||||
jansol = "Jan Solanti <jan.solanti@paivola.fi>";
|
||||
javaguirre = "Javier Aguirre <contacto@javaguirre.net>";
|
||||
jb55 = "William Casarin <jb55@jb55.com>";
|
||||
jbedo = "Justin Bedő <cu@cua0.org>";
|
||||
jb55 = "William Casarin <bill@casarin.me>";
|
||||
jcumming = "Jack Cummings <jack@mudshark.org>";
|
||||
jdagilliland = "Jason Gilliland <jdagilliland@gmail.com>";
|
||||
jefdaj = "Jeffrey David Johnson <jefdaj@gmail.com>";
|
||||
jensbin = "Jens Binkert <jensbin@protonmail.com>";
|
||||
jerith666 = "Matt McHenry <github@matt.mchenryfamily.org>";
|
||||
jfb = "James Felix Black <james@yamtime.com>";
|
||||
jfrankenau = "Johannes Frankenau <johannes@frankenau.net>";
|
||||
jgeerds = "Jascha Geerds <jascha@jgeerds.name>";
|
||||
jgertm = "Tim Jaeger <jger.tm@gmail.com>";
|
||||
jgillich = "Jakob Gillich <jakob@gillich.me>";
|
||||
jhhuh = "Ji-Haeng Huh <jhhuh.note@gmail.com>";
|
||||
jirkamarsik = "Jirka Marsik <jiri.marsik89@gmail.com>";
|
||||
jlesquembre = "José Luis Lafuente <jl@lafuente.me>";
|
||||
jluttine = "Jaakko Luttinen <jaakko.luttinen@iki.fi>";
|
||||
joachifm = "Joachim Fasting <joachifm@fastmail.fm>";
|
||||
joamaki = "Jussi Maki <joamaki@gmail.com>";
|
||||
joelmo = "Joel Moberg <joel.moberg@gmail.com>";
|
||||
joelteon = "Joel Taylor <me@joelt.io>";
|
||||
johbo = "Johannes Bornhold <johannes@bornhold.name>";
|
||||
johnramsden = "John Ramsden <johnramsden@riseup.net>";
|
||||
joko = "Ioannis Koutras <ioannis.koutras@gmail.com>";
|
||||
jonafato = "Jon Banafato <jon@jonafato.com>";
|
||||
jpbernardy = "Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>";
|
||||
jpierre03 = "Jean-Pierre PRUNARET <nix@prunetwork.fr>";
|
||||
jpotier = "Martin Potier <jpo.contributes.to.nixos@marvid.fr>";
|
||||
jraygauthier = "Raymond Gauthier <jraygauthier@gmail.com>";
|
||||
jtojnar = "Jan Tojnar <jtojnar@gmail.com>";
|
||||
juliendehos = "Julien Dehos <dehos@lisic.univ-littoral.fr>";
|
||||
jwiegley = "John Wiegley <johnw@newartisans.com>";
|
||||
jwilberding = "Jordan Wilberding <jwilberding@afiniate.com>";
|
||||
jzellner = "Jeff Zellner <jeffz@eml.cc>";
|
||||
kaiha = "Kai Harries <kai.harries@gmail.com>";
|
||||
kamilchm = "Kamil Chmielewski <kamil.chm@gmail.com>";
|
||||
kampfschlaefer = "Arnold Krille <arnold@arnoldarts.de>";
|
||||
kentjames = "James Kent <jameschristopherkent@gmail.com";
|
||||
kevincox = "Kevin Cox <kevincox@kevincox.ca>";
|
||||
khumba = "Bryan Gardiner <bog@khumba.net>";
|
||||
KibaFox = "Kiba Fox <kiba.fox@foxypossibilities.com>";
|
||||
kierdavis = "Kier Davis <kierdavis@gmail.com>";
|
||||
kiloreux = "Kiloreux Emperex <kiloreux@gmail.com>";
|
||||
kkallio = "Karn Kallio <tierpluspluslists@gmail.com>";
|
||||
knedlsepp = "Josef Kemetmüller <josef.kemetmueller@gmail.com>";
|
||||
konimex = "Muhammad Herdiansyah <herdiansyah@openmailbox.org>";
|
||||
koral = "Koral <koral@mailoo.org>";
|
||||
kovirobi = "Kovacsics Robert <kovirobi@gmail.com>";
|
||||
kragniz = "Louis Taylor <louis@kragniz.eu>";
|
||||
kristoff3r = "Kristoffer Søholm <k.soeholm@gmail.com>";
|
||||
ktosiek = "Tomasz Kontusz <tomasz.kontusz@gmail.com>";
|
||||
lassulus = "Lassulus <lassulus@gmail.com>";
|
||||
layus = "Guillaume Maudoux <layus.on@gmail.com>";
|
||||
ldesgoui = "Lucas Desgouilles <ldesgoui@gmail.com>";
|
||||
league = "Christopher League <league@contrapunctus.net>";
|
||||
lebastr = "Alexander Lebedev <lebastr@gmail.com>";
|
||||
leemachin = "Lee Machin <me@mrl.ee>";
|
||||
leenaars = "Michiel Leenaars <ml.software@leenaa.rs>";
|
||||
leonardoce = "Leonardo Cecchi <leonardo.cecchi@gmail.com>";
|
||||
lethalman = "Luca Bruno <lucabru@src.gnome.org>";
|
||||
lewo = "Antoine Eiche <lewo@abesis.fr>";
|
||||
lheckemann = "Linus Heckemann <git@sphalerite.org>";
|
||||
lhvwb = "Nathaniel Baxter <nathaniel.baxter@gmail.com>";
|
||||
lihop = "Leroy Hopson <nixos@leroy.geek.nz>";
|
||||
linquize = "Linquize <linquize@yahoo.com.hk>";
|
||||
linus = "Linus Arver <linusarver@gmail.com>";
|
||||
lluchs = "Lukas Werling <lukas.werling@gmail.com>";
|
||||
lnl7 = "Daiderd Jordan <daiderd@gmail.com>";
|
||||
loskutov = "Ignat Loskutov <ignat.loskutov@gmail.com>";
|
||||
lovek323 = "Jason O'Conal <jason@oconal.id.au>";
|
||||
lowfatcomputing = "Andreas Wagner <andreas.wagner@lowfatcomputing.org>";
|
||||
lsix = "Lancelot SIX <lsix@lancelotsix.com>";
|
||||
lucas8 = "Luc Chabassier <luc.linux@mailoo.org>";
|
||||
ludo = "Ludovic Courtès <ludo@gnu.org>";
|
||||
lufia = "Kyohei Kadota <lufia@lufia.org>";
|
||||
luispedro = "Luis Pedro Coelho <luis@luispedro.org>";
|
||||
lukasepple = "Lukas Epple <post@lukasepple.de>";
|
||||
lukego = "Luke Gorrie <luke@snabb.co>";
|
||||
lw = "Sergey Sofeychuk <lw@fmap.me>";
|
||||
lyt = "Tim Liou <wheatdoge@gmail.com>";
|
||||
m3tti = "Mathaeus Sander <mathaeus.peter.sander@gmail.com>";
|
||||
ma27 = "Maximilian Bosch <maximilian@mbosch.me>";
|
||||
madjar = "Georges Dubus <georges.dubus@compiletoi.net>";
|
||||
magnetophon = "Bart Brouns <bart@magnetophon.nl>";
|
||||
mahe = "Matthias Herrmann <matthias.mh.herrmann@gmail.com>";
|
||||
@@ -350,100 +240,66 @@
|
||||
martingms = "Martin Gammelsæter <martin@mg.am>";
|
||||
matejc = "Matej Cotman <cotman.matej@gmail.com>";
|
||||
mathnerd314 = "Mathnerd314 <mathnerd314.gph+hs@gmail.com>";
|
||||
matthewbauer = "Matthew Bauer <mjbauer95@gmail.com>";
|
||||
matthiasbeyer = "Matthias Beyer <mail@beyermatthias.de>";
|
||||
maurer = "Matthew Maurer <matthew.r.maurer+nix@gmail.com>";
|
||||
mbakke = "Marius Bakke <mbakke@fastmail.com>";
|
||||
mbbx6spp = "Susan Potter <me@susanpotter.net>";
|
||||
matthewbauer = "Matthew Bauer <mjbauer95@gmail.com>";
|
||||
mbe = "Brandon Edens <brandonedens@gmail.com>";
|
||||
mboes = "Mathieu Boespflug <mboes@tweag.net>";
|
||||
mbrgm = "Marius Bergmann <marius@yeai.de>";
|
||||
mcmtroffaes = "Matthias C. M. Troffaes <matthias.troffaes@gmail.com>";
|
||||
mdaiter = "Matthew S. Daiter <mdaiter8121@gmail.com>";
|
||||
meditans = "Carlo Nucera <meditans@gmail.com>";
|
||||
meisternu = "Matt Miemiec <meister@krutt.org>";
|
||||
metabar = "Celine Mercier <softs@metabarcoding.org>";
|
||||
mguentner = "Maximilian Güntner <code@klandest.in>";
|
||||
mic92 = "Jörg Thalheim <joerg@thalheim.io>";
|
||||
mic92 = "Jörg Thalheim <joerg@higgsboson.tk>";
|
||||
michaelpj = "Michael Peyton Jones <michaelpj@gmail.com>";
|
||||
michalrus = "Michal Rus <m@michalrus.com>";
|
||||
michelk = "Michel Kuhlmann <michel@kuhlmanns.info>";
|
||||
midchildan = "midchildan <midchildan+nix@gmail.com>";
|
||||
mikefaille = "Michaël Faille <michael@faille.io>";
|
||||
miltador = "Vasiliy Solovey <miltador@yandex.ua>";
|
||||
mimadrid = "Miguel Madrid <mimadrid@ucm.es>";
|
||||
mingchuan = "Ming Chuan <ming@culpring.com>";
|
||||
mirdhyn = "Merlin Gaillard <mirdhyn@gmail.com>";
|
||||
mirrexagon = "Andrew Abbott <mirrexagon@mirrexagon.com>";
|
||||
mjanczyk = "Marcin Janczyk <m@dragonvr.pl>";
|
||||
mlieberman85 = "Michael Lieberman <mlieberman85@gmail.com>";
|
||||
modulistic = "Pablo Costa <modulistic@gmail.com>";
|
||||
mog = "Matthew O'Gorman <mog-lists@rldn.net>";
|
||||
montag451 = "montag451 <montag451@laposte.net>";
|
||||
moosingin3space = "Nathan Moos <moosingin3space@gmail.com>";
|
||||
moretea = "Maarten Hoogendoorn <maarten@moretea.nl>";
|
||||
mornfall = "Petr Ročkai <me@mornfall.net>";
|
||||
MostAwesomeDude = "Corbin Simpson <cds@corbinsimpson.com>";
|
||||
mounium = "Katona László <muoniurn@gmail.com>";
|
||||
MP2E = "Cray Elliott <MP2E@archlinux.us>";
|
||||
mpcsh = "Mark Cohen <m@mpc.sh>";
|
||||
mpscholten = "Marc Scholten <marc@mpscholten.de>";
|
||||
mpsyco = "Francis St-Amour <fr.st-amour@gmail.com>";
|
||||
msackman = "Matthew Sackman <matthew@wellquite.org>";
|
||||
mschristiansen = "Mikkel Christiansen <mikkel@rheosystems.com>";
|
||||
msteen = "Matthijs Steen <emailmatthijs@gmail.com>";
|
||||
mt-caret = "Masayuki Takeda <mtakeda.enigsol@gmail.com>";
|
||||
mtreskin = "Max Treskin <zerthurd@gmail.com>";
|
||||
mudri = "James Wood <lamudri@gmail.com>";
|
||||
muflax = "Stefan Dorn <mail@muflax.com>";
|
||||
myrl = "Myrl Hex <myrl.0xf@gmail.com>";
|
||||
namore = "Roman Naumann <namor@hemio.de>";
|
||||
nand0p = "Fernando Jose Pando <nando@hex7.com>";
|
||||
Nate-Devv = "Nathan Moore <natedevv@gmail.com>";
|
||||
nathan-gs = "Nathan Bijnens <nathan@nathan.gs>";
|
||||
nckx = "Tobias Geerinckx-Rice <github@tobias.gr>";
|
||||
ndowens = "Nathan Owens <ndowens04@gmail.com>";
|
||||
neeasade = "Nathan Isom <nathanisom27@gmail.com>";
|
||||
Nate-Devv = "Nathan Moore <natedevv@gmail.com>";
|
||||
nckx = "Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>";
|
||||
nequissimus = "Tim Steinbach <tim@nequissimus.com>";
|
||||
nfjinjing = "Jinjing Wang <nfjinjing@gmail.com>";
|
||||
nh2 = "Niklas Hambüchen <mail@nh2.me>";
|
||||
nhooyr = "Anmol Sethi <anmol@aubble.com>";
|
||||
nickhu = "Nick Hu <me@nickhu.co.uk>";
|
||||
nicknovitski = "Nick Novitski <nixpkgs@nicknovitski.com>";
|
||||
nico202 = "Nicolò Balzarotti <anothersms@gmail.com>";
|
||||
NikolaMandic = "Ratko Mladic <nikola@mandic.email>";
|
||||
nixy = "Andrew R. M. <andrewmiller237@gmail.com>";
|
||||
nocoolnametom = "Tom Doggett <nocoolnametom@gmail.com>";
|
||||
notthemessiah = "Brian Cohen <brian.cohen.88@gmail.com>";
|
||||
NikolaMandic = "Ratko Mladic <nikola@mandic.email>";
|
||||
np = "Nicolas Pouillard <np.nix@nicolaspouillard.fr>";
|
||||
nslqqq = "Nikita Mikhailov <nslqqq@gmail.com>";
|
||||
nthorne = "Niklas Thörne <notrupertthorne@gmail.com>";
|
||||
nyarly = "Judson Lester <nyarly@gmail.com>";
|
||||
obadz = "obadz <obadz-nixos@obadz.com>";
|
||||
ocharles = "Oliver Charles <ollie@ocharles.org.uk>";
|
||||
odi = "Oliver Dunkl <oliver.dunkl@gmail.com>";
|
||||
offline = "Jaka Hudoklin <jakahudoklin@gmail.com>";
|
||||
oida = "oida <oida@posteo.de>";
|
||||
okasu = "Okasu <oka.sux@gmail.com>";
|
||||
olcai = "Erik Timan <dev@timan.info>";
|
||||
olejorgenb = "Ole Jørgen Brønner <olejorgenb@yahoo.no>";
|
||||
olynch = "Owen Lynch <owen@olynch.me>";
|
||||
orbekk = "KJ Ørbekk <kjetil.orbekk@gmail.com>";
|
||||
orbitz = "Malcolm Matalka <mmatalka@gmail.com>";
|
||||
orivej = "Orivej Desh <orivej@gmx.fr>";
|
||||
osener = "Ozan Sener <ozan@ozansener.com>";
|
||||
otwieracz = "Slawomir Gonet <slawek@otwiera.cz>";
|
||||
oxij = "Jan Malakhovski <oxij@oxij.org>";
|
||||
page = "Carles Pagès <page@cubata.homelinux.net>";
|
||||
paholg = "Paho Lurie-Gregg <paho@paholg.com>";
|
||||
pakhfn = "Fedor Pakhomov <pakhfn@gmail.com>";
|
||||
palo = "Ingolf Wanger <palipalo9@googlemail.com>";
|
||||
panaeon = "Vitalii Voloshyn <vitalii.voloshyn@gmail.com";
|
||||
paperdigits = "Mica Semrick <mica@silentumbrella.com>";
|
||||
pashev = "Igor Pashev <pashev.igor@gmail.com>";
|
||||
patternspandemic = "Brad Christensen <patternspandemic@live.com>";
|
||||
pawelpacana = "Paweł Pacana <pawel.pacana@gmail.com>";
|
||||
pbogdan = "Piotr Bogdan <ppbogdan@gmail.com>";
|
||||
periklis = "theopompos@gmail.com";
|
||||
pesterhazy = "Paulus Esterhazy <pesterhazy@gmail.com>";
|
||||
peterhoeg = "Peter Hoeg <peter@hoeg.com>";
|
||||
peti = "Peter Simons <simons@cryp.to>";
|
||||
@@ -452,25 +308,19 @@
|
||||
Phlogistique = "Noé Rubinstein <noe.rubinstein@gmail.com>";
|
||||
phreedom = "Evgeny Egorochkin <phreedom@yandex.ru>";
|
||||
phunehehe = "Hoang Xuan Phu <phunehehe@gmail.com>";
|
||||
pierrer = "Pierre Radermecker <pierrer@pi3r.be>";
|
||||
pierron = "Nicolas B. Pierron <nixos@nbp.name>";
|
||||
piotr = "Piotr Pietraszkiewicz <ppietrasa@gmail.com>";
|
||||
pjbarnoy = "Perry Barnoy <pjbarnoy@gmail.com>";
|
||||
pjones = "Peter Jones <pjones@devalot.com>";
|
||||
pkmx = "Chih-Mao Chen <pkmx.tw@gmail.com>";
|
||||
plcplc = "Philip Lykke Carlsen <plcplc@gmail.com>";
|
||||
plumps = "Maksim Bronsky <maks.bronsky@web.de";
|
||||
pmahoney = "Patrick Mahoney <pat@polycrystal.org>";
|
||||
pmiddend = "Philipp Middendorf <pmidden@secure.mailbox.org>";
|
||||
polyrod = "Maurizio Di Pietro <dc1mdp@gmail.com>";
|
||||
pradeepchhetri = "Pradeep Chhetri <pradeep.chhetri89@gmail.com>";
|
||||
prikhi = "Pavan Rikhi <pavan.rikhi@gmail.com>";
|
||||
primeos = "Michael Weiss <dev.primeos@gmail.com>";
|
||||
profpatsch = "Profpatsch <mail@profpatsch.de>";
|
||||
proglodyte = "Proglodyte <proglodyte23@gmail.com>";
|
||||
pshendry = "Paul Hendry <paul@pshendry.com>";
|
||||
psibi = "Sibi <sibi@psibi.in>";
|
||||
pstn = "Philipp Steinpaß <philipp@xndr.de>";
|
||||
pSub = "Pascal Wittmann <mail@pascal-wittmann.de>";
|
||||
puffnfresh = "Brian McKenna <brian@brianmckenna.org>";
|
||||
pxc = "Patrick Callahan <patrick.callahan@latitudeengineering.com>";
|
||||
@@ -481,62 +331,44 @@
|
||||
rardiol = "Ricardo Ardissone <ricardo.ardissone@gmail.com>";
|
||||
rasendubi = "Alexey Shmalko <rasen.dubi@gmail.com>";
|
||||
raskin = "Michael Raskin <7c6f434c@mail.ru>";
|
||||
rbasso = "Rafael Basso <rbasso@sharpgeeks.net>";
|
||||
redbaron = "Maxim Ivanov <ivanov.maxim@gmail.com>";
|
||||
redvers = "Redvers Davies <red@infect.me>";
|
||||
refnil = "Martin Lavoie <broemartino@gmail.com>";
|
||||
regnat = "Théophane Hufschmitt <regnat@regnat.ovh>";
|
||||
relrod = "Ricky Elrod <ricky@elrod.me>";
|
||||
renzo = "Renzo Carbonara <renzocarbonara@gmail.com>";
|
||||
retrry = "Tadas Barzdžius <retrry@gmail.com>";
|
||||
rht = "rht <rhtbot@protonmail.com>";
|
||||
rick68 = "Wei-Ming Yang <rick68@gmail.com>";
|
||||
rickynils = "Rickard Nilsson <rickynils@gmail.com>";
|
||||
ris = "Robert Scott <code@humanleg.org.uk>";
|
||||
rlupton20 = "Richard Lupton <richard.lupton@gmail.com>";
|
||||
rnhmjoj = "Michele Guerini Rocco <micheleguerinirocco@me.com>";
|
||||
rob = "Rob Vermaas <rob.vermaas@gmail.com>";
|
||||
robberer = "Longrin Wischnewski <robberer@freakmail.de>";
|
||||
robbinch = "Robbin C. <robbinch33@gmail.com>";
|
||||
roberth = "Robert Hensing <nixpkgs@roberthensing.nl>";
|
||||
robgssp = "Rob Glossop <robgssp@gmail.com>";
|
||||
roblabla = "Robin Lambertz <robinlambertz+dev@gmail.com>";
|
||||
roconnor = "Russell O'Connor <roconnor@theorem.ca>";
|
||||
romildo = "José Romildo Malaquias <malaquias@gmail.com>";
|
||||
rongcuid = "Rongcui Dong <rongcuid@outlook.com>";
|
||||
rszibele = "Richard Szibele <richard@szibele.com>";
|
||||
rtreffer = "Rene Treffer <treffer+nixos@measite.de>";
|
||||
rszibele = "Richard Szibele <richard_szibele@hotmail.com>";
|
||||
rushmorem = "Rushmore Mushambi <rushmore@webenchanter.com>";
|
||||
rvl = "Rodney Lorrimar <dev+nix@rodney.id.au>";
|
||||
rvlander = "Gaëtan André <rvlander@gaetanandre.eu>";
|
||||
rvolosatovs = "Roman Volosatovs <rvolosatovs@riseup.net";
|
||||
ryanartecona = "Ryan Artecona <ryanartecona@gmail.com>";
|
||||
ryansydnor = "Ryan Sydnor <ryan.t.sydnor@gmail.com>";
|
||||
ryantm = "Ryan Mulligan <ryan@ryantm.com>";
|
||||
rybern = "Ryan Bernstein <ryan.bernstein@columbia.edu>";
|
||||
ryansydnor = "Ryan Sydnor <ryan.t.sydnor@gmail.com>";
|
||||
rycee = "Robert Helgesson <robert@rycee.net>";
|
||||
ryneeverett = "Ryne Everett <ryneeverett@gmail.com>";
|
||||
rzetterberg = "Richard Zetterberg <richard.zetterberg@gmail.com>";
|
||||
s1lvester = "Markus Silvester <s1lvester@bockhacker.me>";
|
||||
samuelrivas = "Samuel Rivas <samuelrivas@gmail.com>";
|
||||
sander = "Sander van der Burg <s.vanderburg@tudelft.nl>";
|
||||
sargon = "Daniel Ehlers <danielehlers@mindeye.net>";
|
||||
sauyon = "Sauyon Lee <s@uyon.co>";
|
||||
schmitthenner = "Fabian Schmitthenner <development@schmitthenner.eu>";
|
||||
schneefux = "schneefux <schneefux+nixos_pkg@schneefux.xyz>";
|
||||
schristo = "Scott Christopher <schristopher@konputa.com>";
|
||||
scolobb = "Sergiu Ivanov <sivanov@colimite.fr>";
|
||||
sdll = "Sasha Illarionov <sasha.delly@gmail.com>";
|
||||
sepi = "Raffael Mancini <raffael@mancini.lu>";
|
||||
seppeljordan = "Sebastian Jordan <sebastian.jordan.mail@googlemail.com>";
|
||||
shanemikel = "Shane Pearlman <shanemikel1@gmail.com>";
|
||||
shawndellysse = "Shawn Dellysse <sdellysse@gmail.com>";
|
||||
sheenobu = "Sheena Artrip <sheena.artrip@gmail.com>";
|
||||
sheganinans = "Aistis Raulinaitis <sheganinans@gmail.com>";
|
||||
shell = "Shell Turner <cam.turn@gmail.com>";
|
||||
shlevy = "Shea Levy <shea@shealevy.com>";
|
||||
siddharthist = "Langston Barrett <langston.barrett@gmail.com>";
|
||||
sigma = "Yann Hodique <yann.hodique@gmail.com>";
|
||||
simonvandel = "Simon Vandel Sillesen <simon.vandel@gmail.com>";
|
||||
sjagoe = "Simon Jagoe <simon@simonjagoe.com>";
|
||||
sjmackenzie = "Stewart Mackenzie <setori88@gmail.com>";
|
||||
@@ -544,33 +376,23 @@
|
||||
skeidel = "Sven Keidel <svenkeidel@gmail.com>";
|
||||
skrzyp = "Jakub Skrzypnik <jot.skrzyp@gmail.com>";
|
||||
sleexyz = "Sean Lee <freshdried@gmail.com>";
|
||||
smironov = "Sergey Mironov <grrwlf@gmail.com>";
|
||||
snyh = "Xia Bin <snyh@snyh.org>";
|
||||
smironov = "Sergey Mironov <ierton@gmail.com>";
|
||||
solson = "Scott Olson <scott@solson.me>";
|
||||
sorpaas = "Wei Tang <hi@that.world>";
|
||||
spacefrogg = "Michael Raitza <spacefrogg-nixos@meterriblecrew.net>";
|
||||
spencerjanssen = "Spencer Janssen <spencerjanssen@gmail.com>";
|
||||
spinus = "Tomasz Czyż <tomasz.czyz@gmail.com>";
|
||||
sprock = "Roger Mason <rmason@mun.ca>";
|
||||
spwhitt = "Spencer Whitt <sw@swhitt.me>";
|
||||
srhb = "Sarah Brofeldt <sbrofeldt@gmail.com>";
|
||||
SShrike = "Severen Redwood <severen@shrike.me>";
|
||||
stephenmw = "Stephen Weinberg <stephen@q5comm.com>";
|
||||
sternenseemann = "Lukas Epple <post@lukasepple.de>";
|
||||
stesie = "Stefan Siegl <stesie@brokenpipe.de>";
|
||||
steveej = "Stefan Junker <mail@stefanjunker.de>";
|
||||
SuprDewd = "Bjarki Ágúst Guðmundsson <suprdewd@gmail.com>";
|
||||
swarren83 = "Shawn Warren <shawn.w.warren@gmail.com>";
|
||||
swflint = "Samuel W. Flint <swflint@flintfam.org>";
|
||||
swistak35 = "Rafał Łasocha <me@swistak35.com>";
|
||||
szczyp = "Szczyp <qb@szczyp.com>";
|
||||
sztupi = "Attila Sztupak <attila.sztupak@gmail.com>";
|
||||
taeer = "Taeer Bar-Yam <taeer@necsi.edu>";
|
||||
tailhook = "Paul Colomiets <paul@colomiets.name>";
|
||||
takikawa = "Asumu Takikawa <asumu@igalia.com>";
|
||||
taktoa = "Remy Goldschmidt <taktoa@gmail.com>";
|
||||
taku0 = "Takuo Yonezawa <mxxouy6x3m_github@tatapa.org>";
|
||||
tari = "Peter Marheine <peter@taricorp.net>";
|
||||
tavyc = "Octavian Cerna <octavian.cerna@gmail.com>";
|
||||
teh = "Tom Hunger <tehunger@gmail.com>";
|
||||
telotortium = "Robert Irelan <rirelan@gmail.com>";
|
||||
@@ -581,50 +403,30 @@
|
||||
thoughtpolice = "Austin Seipp <aseipp@pobox.com>";
|
||||
timbertson = "Tim Cuthbertson <tim@gfxmonk.net>";
|
||||
titanous = "Jonathan Rudenberg <jonathan@titanous.com>";
|
||||
tnias = "Philipp Bartsch <phil@grmr.de>";
|
||||
tohl = "Tomas Hlavaty <tom@logand.com>";
|
||||
tokudan = "Daniel Frank <git@danielfrank.net>";
|
||||
tomberek = "Thomas Bereknyei <tomberek@gmail.com>";
|
||||
tomsmeets = "Tom Smeets <tom@tsmeets.nl>";
|
||||
travisbhartwell = "Travis B. Hartwell <nafai@travishartwell.net>";
|
||||
trevorj = "Trevor Joynson <nix@trevor.joynson.io>";
|
||||
trino = "Hubert Mühlhans <muehlhans.hubert@ekodia.de>";
|
||||
tstrobel = "Thomas Strobel <4ZKTUB6TEP74PYJOPWIR013S2AV29YUBW5F9ZH2F4D5UMJUJ6S@hash.domains>";
|
||||
ttuegel = "Thomas Tuegel <ttuegel@mailbox.org>";
|
||||
ttuegel = "Thomas Tuegel <ttuegel@gmail.com>";
|
||||
tv = "Tomislav Viljetić <tv@shackspace.de>";
|
||||
tvestelind = "Tomas Vestelind <tomas.vestelind@fripost.org>";
|
||||
tvorog = "Marsel Zaripov <marszaripov@gmail.com>";
|
||||
tweber = "Thorsten Weber <tw+nixpkgs@360vier.de>";
|
||||
twey = "James ‘Twey’ Kay <twey@twey.co.uk>";
|
||||
uralbash = "Svintsov Dmitry <root@uralbash.ru>";
|
||||
utdemir = "Utku Demir <me@utdemir.com>";
|
||||
#urkud = "Yury G. Kudryashov <urkud+nix@ya.ru>"; inactive since 2012
|
||||
uwap = "uwap <me@uwap.name>";
|
||||
vaibhavsagar = "Vaibhav Sagar <vaibhavsagar@gmail.com>";
|
||||
urkud = "Yury G. Kudryashov <urkud+nix@ya.ru>";
|
||||
vandenoever = "Jos van den Oever <jos@vandenoever.info>";
|
||||
vanschelven = "Klaas van Schelven <klaas@vanschelven.com>";
|
||||
vanzef = "Ivan Solyankin <vanzef@gmail.com>";
|
||||
vbgl = "Vincent Laporte <Vincent.Laporte@gmail.com>";
|
||||
vbmithr = "Vincent Bernardoff <vb@luminar.eu.org>";
|
||||
vcunat = "Vladimír Čunát <vcunat@gmail.com>";
|
||||
vdemeester = "Vincent Demeester <vincent@sbr.pm>";
|
||||
veprbl = "Dmitry Kalinkin <veprbl@gmail.com>";
|
||||
vifino = "Adrian Pistol <vifino@tty.sh>";
|
||||
vinymeuh = "VinyMeuh <vinymeuh@gmail.com>";
|
||||
viric = "Lluís Batlle i Rossell <viric@viric.name>";
|
||||
vizanto = "Danny Wilson <danny@prime.vc>";
|
||||
vklquevs = "vklquevs <vklquevs@gmail.com>";
|
||||
vlstill = "Vladimír Štill <xstill@fi.muni.cz>";
|
||||
vmandela = "Venkateswara Rao Mandela <venkat.mandela@gmail.com>";
|
||||
vmchale = "Vanessa McHale <tmchale@wisc.edu>";
|
||||
valeriangalliat = "Valérian Galliat <val@codejam.info>";
|
||||
volhovm = "Mikhail Volkhov <volhovm.cs@gmail.com>";
|
||||
volth = "Jaroslavas Pocepko <jaroslavas@volth.com>";
|
||||
vozz = "Oliver Hunt <oliver.huntuk@gmail.com>";
|
||||
vrthra = "Rahul Gopinath <rahul@gopinath.org>";
|
||||
vyp = "vyp <elisp.vim@gmail.com>";
|
||||
wedens = "wedens <kirill.wedens@gmail.com>";
|
||||
willibutz = "Willi Butz <willibutz@posteo.de>";
|
||||
willtim = "Tim Philip Williams <tim.williams.public@gmail.com>";
|
||||
winden = "Antonio Vargas Gonzalez <windenntw@gmail.com>";
|
||||
wizeman = "Ricardo M. Correia <rcorreia@wizy.org>";
|
||||
@@ -634,24 +436,13 @@
|
||||
womfoo = "Kranium Gikos Mendoza <kranium@gikos.net>";
|
||||
wscott = "Wayne Scott <wsc9tt@gmail.com>";
|
||||
wyvie = "Elijah Rum <elijahrum@gmail.com>";
|
||||
xnwdd = "Guillermo NWDD <nwdd+nixos@no.team>";
|
||||
xvapx = "Marti Serra <marti.serra.coscollano@gmail.com>";
|
||||
xwvvvvwx = "David Terry <davidterry@posteo.de>";
|
||||
yarr = "Dmitry V. <savraz@gmail.com>";
|
||||
yochai = "Yochai <yochai@titat.info>";
|
||||
yorickvp = "Yorick van Pelt <yorickvanpelt@gmail.com>";
|
||||
yuriaisaka = "Yuri Aisaka <yuri.aisaka+nix@gmail.com>";
|
||||
yurrriq = "Eric Bailey <eric@ericb.me>";
|
||||
z77z = "Marco Maggesi <maggesi@math.unifi.it>";
|
||||
zagy = "Christian Zagrodnick <cz@flyingcircus.io>";
|
||||
zalakain = "Unai Zalakain <contact@unaizalakain.info>";
|
||||
zarelit = "David Costa <david@zarel.net>";
|
||||
zauberpony = "Elmar Athmer <elmar@athmer.org>";
|
||||
zef = "Zef Hemel <zef@zef.me>";
|
||||
zimbatm = "zimbatm <zimbatm@zimbatm.com>";
|
||||
Zimmi48 = "Théo Zimmermann <theo.zimmermann@univ-paris-diderot.fr>";
|
||||
zohl = "Al Zohali <zohl@fmap.me>";
|
||||
zoomulator = "Kim Simmons <zoomulator@gmail.com>";
|
||||
zraexy = "David Mell <zraexy@gmail.com>";
|
||||
zx2c4 = "Jason A. Donenfeld <Jason@zx2c4.com>";
|
||||
amiloradovsky = "Andrew Miloradovsky <miloradovsky@gmail.com>";
|
||||
}
|
||||
|
||||
@@ -17,11 +17,6 @@ rec {
|
||||
drv // { meta = (drv.meta or {}) // newAttrs; };
|
||||
|
||||
|
||||
/* Disable Hydra builds of given derivation.
|
||||
*/
|
||||
dontDistribute = drv: addMetaAttrs { hydraPlatforms = []; } drv;
|
||||
|
||||
|
||||
/* Change the symbolic name of a package for presentation purposes
|
||||
(i.e., so that nix-env users can tell them apart).
|
||||
*/
|
||||
@@ -50,7 +45,7 @@ rec {
|
||||
/* Decrease the nix-env priority of the package, i.e., other
|
||||
versions/variants of the package will be preferred.
|
||||
*/
|
||||
lowPrio = drv: addMetaAttrs { priority = 10; } drv;
|
||||
lowPrio = drv: addMetaAttrs { priority = "10"; } drv;
|
||||
|
||||
|
||||
/* Apply lowPrio to an attrset with derivations
|
||||
@@ -61,7 +56,7 @@ rec {
|
||||
/* Increase the nix-env priority of the package, i.e., this
|
||||
version/variant of the package will be preferred.
|
||||
*/
|
||||
hiPrio = drv: addMetaAttrs { priority = -10; } drv;
|
||||
hiPrio = drv: addMetaAttrs { priority = "-10"; } drv;
|
||||
|
||||
|
||||
/* Apply hiPrio to an attrset with derivations
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# Expose the minimum required version for evaluating Nixpkgs
|
||||
"1.11"
|
||||
"1.10"
|
||||
|
||||
152
lib/modules.nix
152
lib/modules.nix
@@ -1,5 +1,4 @@
|
||||
with import ./lists.nix;
|
||||
with import ./strings.nix;
|
||||
with import ./trivial.nix;
|
||||
with import ./attrsets.nix;
|
||||
with import ./options.nix;
|
||||
@@ -20,8 +19,7 @@ rec {
|
||||
, prefix ? []
|
||||
, # This should only be used for special arguments that need to be evaluated
|
||||
# when resolving module structure (like in imports). For everything else,
|
||||
# there's _module.args. If specialArgs.modulesPath is defined it will be
|
||||
# used as the base path for disabledModules.
|
||||
# there's _module.args.
|
||||
specialArgs ? {}
|
||||
, # This would be remove in the future, Prefer _module.args option instead.
|
||||
args ? {}
|
||||
@@ -59,7 +57,10 @@ rec {
|
||||
|
||||
closed = closeModules (modules ++ [ internalModule ]) ({ inherit config options; lib = import ./.; } // specialArgs);
|
||||
|
||||
options = mergeModules prefix (reverseList (filterModules (specialArgs.modulesPath or "") closed));
|
||||
# Note: the list of modules is reversed to maintain backward
|
||||
# compatibility with the old module system. Not sure if this is
|
||||
# the most sensible policy.
|
||||
options = mergeModules prefix (reverseList closed);
|
||||
|
||||
# Traverse options and extract the option values into the final
|
||||
# config set. At the same time, check whether all option
|
||||
@@ -85,20 +86,10 @@ rec {
|
||||
result = { inherit options config; };
|
||||
in result;
|
||||
|
||||
|
||||
# Filter disabled modules. Modules can be disabled allowing
|
||||
# their implementation to be replaced.
|
||||
filterModules = modulesPath: modules:
|
||||
let
|
||||
moduleKey = m: if isString m then toString modulesPath + "/" + m else toString m;
|
||||
disabledKeys = map moduleKey (concatMap (m: m.disabledModules) modules);
|
||||
in
|
||||
filter (m: !(elem m.key disabledKeys)) modules;
|
||||
|
||||
/* Close a set of modules under the ‘imports’ relation. */
|
||||
closeModules = modules: args:
|
||||
let
|
||||
toClosureList = file: parentKey: imap1 (n: x:
|
||||
toClosureList = file: parentKey: imap (n: x:
|
||||
if isAttrs x || isFunction x then
|
||||
let key = "${parentKey}:anon-${toString n}"; in
|
||||
unifyModuleSyntax file key (unpackSubmodule (applyIfFunction key) x args)
|
||||
@@ -114,18 +105,17 @@ rec {
|
||||
/* Massage a module into canonical form, that is, a set consisting
|
||||
of ‘options’, ‘config’ and ‘imports’ attributes. */
|
||||
unifyModuleSyntax = file: key: m:
|
||||
let metaSet = if m ? meta
|
||||
let metaSet = if m ? meta
|
||||
then { meta = m.meta; }
|
||||
else {};
|
||||
in
|
||||
if m ? config || m ? options then
|
||||
let badAttrs = removeAttrs m ["_file" "key" "disabledModules" "imports" "options" "config" "meta"]; in
|
||||
let badAttrs = removeAttrs m ["imports" "options" "config" "key" "_file" "meta"]; in
|
||||
if badAttrs != {} then
|
||||
throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. This is caused by assignments to the top-level attributes `config' or `options'."
|
||||
else
|
||||
{ file = m._file or file;
|
||||
key = toString m.key or key;
|
||||
disabledModules = m.disabledModules or [];
|
||||
imports = m.imports or [];
|
||||
options = m.options or {};
|
||||
config = mkMerge [ (m.config or {}) metaSet ];
|
||||
@@ -133,10 +123,9 @@ rec {
|
||||
else
|
||||
{ file = m._file or file;
|
||||
key = toString m.key or key;
|
||||
disabledModules = m.disabledModules or [];
|
||||
imports = m.require or [] ++ m.imports or [];
|
||||
options = {};
|
||||
config = mkMerge [ (removeAttrs m ["_file" "key" "disabledModules" "require" "imports"]) metaSet ];
|
||||
config = mkMerge [ (removeAttrs m ["key" "_file" "require" "imports"]) metaSet ];
|
||||
};
|
||||
|
||||
applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then
|
||||
@@ -241,20 +230,12 @@ rec {
|
||||
correspond to the definition of 'loc' in 'opt.file'. */
|
||||
mergeOptionDecls = loc: opts:
|
||||
foldl' (res: opt:
|
||||
let t = res.type;
|
||||
t' = opt.options.type;
|
||||
mergedType = t.typeMerge t'.functor;
|
||||
typesMergeable = mergedType != null;
|
||||
typeSet = if (bothHave "type") && typesMergeable
|
||||
then { type = mergedType; }
|
||||
else {};
|
||||
bothHave = k: opt.options ? ${k} && res ? ${k};
|
||||
in
|
||||
if bothHave "default" ||
|
||||
bothHave "example" ||
|
||||
bothHave "description" ||
|
||||
bothHave "apply" ||
|
||||
(bothHave "type" && (! typesMergeable))
|
||||
if opt.options ? default && res ? default ||
|
||||
opt.options ? example && res ? example ||
|
||||
opt.options ? description && res ? description ||
|
||||
opt.options ? apply && res ? apply ||
|
||||
# Accept to merge options which have identical types.
|
||||
opt.options ? type && res ? type && opt.options.type.name != res.type.name
|
||||
then
|
||||
throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${showFiles res.declarations}."
|
||||
else
|
||||
@@ -276,7 +257,7 @@ rec {
|
||||
in opt.options // res //
|
||||
{ declarations = res.declarations ++ [opt.file];
|
||||
options = submodules;
|
||||
} // typeSet
|
||||
}
|
||||
) { inherit loc; declarations = []; options = []; } opts;
|
||||
|
||||
/* Merge all the definitions of an option to produce the final
|
||||
@@ -336,7 +317,7 @@ rec {
|
||||
# Type-check the remaining definitions, and merge them.
|
||||
mergedValue = foldl' (res: def:
|
||||
if type.check def.value then res
|
||||
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.description}.")
|
||||
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.")
|
||||
(type.merge loc defsFinal) defsFinal;
|
||||
|
||||
isDefined = defsFinal != [];
|
||||
@@ -385,13 +366,10 @@ rec {
|
||||
if def._type or "" == "merge" then
|
||||
concatMap dischargeProperties def.contents
|
||||
else if def._type or "" == "if" then
|
||||
if isBool def.condition then
|
||||
if def.condition then
|
||||
dischargeProperties def.content
|
||||
else
|
||||
[ ]
|
||||
if def.condition then
|
||||
dischargeProperties def.content
|
||||
else
|
||||
throw "‘mkIf’ called with a non-Boolean condition"
|
||||
[ ]
|
||||
else
|
||||
[ def ];
|
||||
|
||||
@@ -423,7 +401,7 @@ rec {
|
||||
in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
|
||||
|
||||
/* Sort a list of properties. The sort priority of a property is
|
||||
1000 by default, but can be overridden by wrapping the property
|
||||
1000 by default, but can be overriden by wrapping the property
|
||||
using mkOrder. */
|
||||
sortProperties = defs:
|
||||
let
|
||||
@@ -443,14 +421,12 @@ rec {
|
||||
options = opt.options or
|
||||
(throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
|
||||
f = tp:
|
||||
let optionSetIn = type: (tp.name == type) && (tp.functor.wrapped.name == "optionSet");
|
||||
in
|
||||
if tp.name == "option set" || tp.name == "submodule" then
|
||||
throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}."
|
||||
else if optionSetIn "attrsOf" then types.attrsOf (types.submodule options)
|
||||
else if optionSetIn "loaOf" then types.loaOf (types.submodule options)
|
||||
else if optionSetIn "listOf" then types.listOf (types.submodule options)
|
||||
else if optionSetIn "nullOr" then types.nullOr (types.submodule options)
|
||||
else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options)
|
||||
else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options)
|
||||
else if tp.name == "list of option sets" then types.listOf (types.submodule options)
|
||||
else if tp.name == "null or option set" then types.nullOr (types.submodule options)
|
||||
else tp;
|
||||
in
|
||||
if opt.type.getSubModules or null == null
|
||||
@@ -569,84 +545,6 @@ rec {
|
||||
use = builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
|
||||
};
|
||||
|
||||
/* Return a module that causes a warning to be shown if any of the "from"
|
||||
option is defined; the defined values can be used in the "mergeFn" to set
|
||||
the "to" value.
|
||||
This function can be used to merge multiple options into one that has a
|
||||
different type.
|
||||
|
||||
"mergeFn" takes the module "config" as a parameter and must return a value
|
||||
of "to" option type.
|
||||
|
||||
mkMergedOptionModule
|
||||
[ [ "a" "b" "c" ]
|
||||
[ "d" "e" "f" ] ]
|
||||
[ "x" "y" "z" ]
|
||||
(config:
|
||||
let value = p: getAttrFromPath p config;
|
||||
in
|
||||
if (value [ "a" "b" "c" ]) == true then "foo"
|
||||
else if (value [ "d" "e" "f" ]) == true then "bar"
|
||||
else "baz")
|
||||
|
||||
- options.a.b.c is a removed boolean option
|
||||
- options.d.e.f is a removed boolean option
|
||||
- options.x.y.z is a new str option that combines a.b.c and d.e.f
|
||||
functionality
|
||||
|
||||
This show a warning if any a.b.c or d.e.f is set, and set the value of
|
||||
x.y.z to the result of the merge function
|
||||
*/
|
||||
mkMergedOptionModule = from: to: mergeFn:
|
||||
{ config, options, ... }:
|
||||
{
|
||||
options = foldl recursiveUpdate {} (map (path: setAttrByPath path (mkOption {
|
||||
visible = false;
|
||||
# To use the value in mergeFn without triggering errors
|
||||
default = "_mkMergedOptionModule";
|
||||
})) from);
|
||||
|
||||
config = {
|
||||
warnings = filter (x: x != "") (map (f:
|
||||
let val = getAttrFromPath f config;
|
||||
opt = getAttrFromPath f options;
|
||||
in
|
||||
optionalString
|
||||
(val != "_mkMergedOptionModule")
|
||||
"The option `${showOption f}' defined in ${showFiles opt.files} has been changed to `${showOption to}' that has a different type. Please read `${showOption to}' documentation and update your configuration accordingly."
|
||||
) from);
|
||||
} // setAttrByPath to (mkMerge
|
||||
(optional
|
||||
(any (f: (getAttrFromPath f config) != "_mkMergedOptionModule") from)
|
||||
(mergeFn config)));
|
||||
};
|
||||
|
||||
/* Single "from" version of mkMergedOptionModule.
|
||||
Return a module that causes a warning to be shown if the "from" option is
|
||||
defined; the defined value can be used in the "mergeFn" to set the "to"
|
||||
value.
|
||||
This function can be used to change an option into another that has a
|
||||
different type.
|
||||
|
||||
"mergeFn" takes the module "config" as a parameter and must return a value of
|
||||
"to" option type.
|
||||
|
||||
mkChangedOptionModule [ "a" "b" "c" ] [ "x" "y" "z" ]
|
||||
(config:
|
||||
let value = getAttrFromPath [ "a" "b" "c" ] config;
|
||||
in
|
||||
if value > 100 then "high"
|
||||
else "normal")
|
||||
|
||||
- options.a.b.c is a removed int option
|
||||
- options.x.y.z is a new str option that supersedes a.b.c
|
||||
|
||||
This show a warning if a.b.c is set, and set the value of x.y.z to the
|
||||
result of the change function
|
||||
*/
|
||||
mkChangedOptionModule = from: to: changeFn:
|
||||
mkMergedOptionModule [ from ] to changeFn;
|
||||
|
||||
/* Like ‘mkRenamedOptionModule’, but doesn't show a warning. */
|
||||
mkAliasOptionModule = from: to: doRename {
|
||||
inherit from to;
|
||||
|
||||
@@ -92,7 +92,7 @@ rec {
|
||||
internal = opt.internal or false;
|
||||
visible = opt.visible or true;
|
||||
readOnly = opt.readOnly or false;
|
||||
type = opt.type.description or null;
|
||||
type = opt.type.name or null;
|
||||
}
|
||||
// (if opt ? example then { example = scrubOptionValue opt.example; } else {})
|
||||
// (if opt ? default then { default = scrubOptionValue opt.default; } else {})
|
||||
|
||||
24
lib/platforms.nix
Normal file
24
lib/platforms.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
let lists = import ./lists.nix; in
|
||||
|
||||
rec {
|
||||
all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
|
||||
allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all;
|
||||
none = [];
|
||||
|
||||
arm = ["armv5tel-linux" "armv6l-linux" "armv7l-linux" ];
|
||||
i686 = ["i686-linux" "i686-freebsd" "i686-netbsd" "i686-cygwin"];
|
||||
mips = [ "mips64el-linux" ];
|
||||
x86_64 = ["x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin"];
|
||||
|
||||
cygwin = ["i686-cygwin" "x86_64-cygwin"];
|
||||
darwin = ["x86_64-darwin"];
|
||||
freebsd = ["i686-freebsd" "x86_64-freebsd"];
|
||||
gnu = linux; /* ++ hurd ++ kfreebsd ++ ... */
|
||||
illumos = ["x86_64-solaris"];
|
||||
linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "mips64el-linux"];
|
||||
netbsd = ["i686-netbsd" "x86_64-netbsd"];
|
||||
openbsd = ["i686-openbsd" "x86_64-openbsd"];
|
||||
unix = linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
|
||||
|
||||
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux"];
|
||||
}
|
||||
@@ -12,28 +12,20 @@ rec {
|
||||
|
||||
# Bring in a path as a source, filtering out all Subversion and CVS
|
||||
# directories, as well as backup files (*~).
|
||||
cleanSourceFilter = name: type: let baseName = baseNameOf (toString name); in ! (
|
||||
# Filter out Subversion and CVS directories.
|
||||
(type == "directory" && (baseName == ".git" || baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
|
||||
# Filter out backup files.
|
||||
lib.hasSuffix "~" baseName ||
|
||||
builtins.match "^.*\.sw[a-z]$" baseName != null ||
|
||||
cleanSource =
|
||||
let filter = name: type: let baseName = baseNameOf (toString name); in ! (
|
||||
# Filter out Subversion and CVS directories.
|
||||
(type == "directory" && (baseName == ".git" || baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
|
||||
# Filter out backup files.
|
||||
lib.hasSuffix "~" baseName ||
|
||||
# Filter out generates files.
|
||||
lib.hasSuffix ".o" baseName ||
|
||||
lib.hasSuffix ".so" baseName ||
|
||||
# Filter out nix-build result symlinks
|
||||
(type == "symlink" && lib.hasPrefix "result" baseName)
|
||||
);
|
||||
in src: builtins.filterSource filter src;
|
||||
|
||||
# Filter out generates files.
|
||||
lib.hasSuffix ".o" baseName ||
|
||||
lib.hasSuffix ".so" baseName ||
|
||||
# Filter out nix-build result symlinks
|
||||
(type == "symlink" && lib.hasPrefix "result" baseName)
|
||||
);
|
||||
|
||||
cleanSource = builtins.filterSource cleanSourceFilter;
|
||||
|
||||
# Filter sources by a list of regular expressions.
|
||||
#
|
||||
# E.g. `src = sourceByRegex ./my-subproject [".*\.py$" "^database.sql$"]`
|
||||
sourceByRegex = src: regexes: builtins.filterSource (path: type:
|
||||
let relPath = lib.removePrefix (toString src + "/") (toString path);
|
||||
in lib.any (re: builtins.match re relPath != null) regexes) src;
|
||||
|
||||
# Get all files ending with the specified suffices from the given
|
||||
# directory or its descendants. E.g. `sourceFilesBySuffices ./dir
|
||||
|
||||
@@ -33,7 +33,7 @@ rec {
|
||||
concatImapStrings (pos: x: "${toString pos}-${x}") ["foo" "bar"]
|
||||
=> "1-foo2-bar"
|
||||
*/
|
||||
concatImapStrings = f: list: concatStrings (lib.imap1 f list);
|
||||
concatImapStrings = f: list: concatStrings (lib.imap f list);
|
||||
|
||||
/* Place an element between each element of a list
|
||||
|
||||
@@ -70,7 +70,7 @@ rec {
|
||||
concatImapStringsSep "-" (pos: x: toString (x / pos)) [ 6 6 6 ]
|
||||
=> "6-3-2"
|
||||
*/
|
||||
concatImapStringsSep = sep: f: list: concatStringsSep sep (lib.imap1 f list);
|
||||
concatImapStringsSep = sep: f: list: concatStringsSep sep (lib.imap f list);
|
||||
|
||||
/* Construct a Unix-style search path consisting of each `subDir"
|
||||
directory of the given list of packages.
|
||||
@@ -126,8 +126,8 @@ rec {
|
||||
*/
|
||||
makePerlPath = makeSearchPathOutput "lib" "lib/perl5/site_perl";
|
||||
|
||||
/* Depending on the boolean `cond', return either the given string
|
||||
or the empty string. Useful to concatenate against a bigger string.
|
||||
/* Dependening on the boolean `cond', return either the given string
|
||||
or the empty string. Useful to contatenate against a bigger string.
|
||||
|
||||
Example:
|
||||
optionalString true "some-string"
|
||||
@@ -291,7 +291,7 @@ rec {
|
||||
|
||||
recurse = index: startAt:
|
||||
let cutUntil = i: [(substring startAt (i - startAt) s)]; in
|
||||
if index <= lastSearch then
|
||||
if index < lastSearch then
|
||||
if startWithSep index then
|
||||
let restartAt = index + sepLen; in
|
||||
cutUntil index ++ recurse restartAt restartAt
|
||||
@@ -438,13 +438,8 @@ rec {
|
||||
=> true
|
||||
isStorePath pkgs.python
|
||||
=> true
|
||||
isStorePath [] || isStorePath 42 || isStorePath {} || …
|
||||
=> false
|
||||
*/
|
||||
isStorePath = x:
|
||||
builtins.isString x
|
||||
&& builtins.substring 0 1 (toString x) == "/"
|
||||
&& dirOf (builtins.toPath x) == builtins.storeDir;
|
||||
isStorePath = x: builtins.substring 0 1 (toString x) == "/" && dirOf (builtins.toPath x) == builtins.storeDir;
|
||||
|
||||
/* Convert string to int
|
||||
Obviously, it is a bit hacky to use fromJSON that way.
|
||||
@@ -481,8 +476,10 @@ rec {
|
||||
readPathsFromFile = rootPath: file:
|
||||
let
|
||||
root = toString rootPath;
|
||||
lines = lib.splitString "\n" (builtins.readFile file);
|
||||
removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line));
|
||||
lines =
|
||||
builtins.map (lib.removeSuffix "\n")
|
||||
(lib.splitString "\n" (builtins.readFile file));
|
||||
removeComments = lib.filter (line: !(lib.hasPrefix "#" line));
|
||||
relativePaths = removeComments lines;
|
||||
absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths;
|
||||
in
|
||||
|
||||
126
lib/systems.nix
Normal file
126
lib/systems.nix
Normal file
@@ -0,0 +1,126 @@
|
||||
# Define the list of system with their properties. Only systems tested for
|
||||
# Nixpkgs are listed below
|
||||
|
||||
with import ./lists.nix;
|
||||
with import ./types.nix;
|
||||
with import ./attrsets.nix;
|
||||
|
||||
let
|
||||
lib = import ./default.nix;
|
||||
setTypes = type:
|
||||
mapAttrs (name: value:
|
||||
setType type ({inherit name;} // value)
|
||||
);
|
||||
in
|
||||
|
||||
rec {
|
||||
|
||||
isSignificantByte = isType "significant-byte";
|
||||
significantBytes = setTypes "significant-byte" {
|
||||
bigEndian = {};
|
||||
littleEndian = {};
|
||||
};
|
||||
|
||||
|
||||
isCpuType = x: isType "cpu-type" x
|
||||
&& elem x.bits [8 16 32 64 128]
|
||||
&& (8 < x.bits -> isSignificantByte x.significantByte);
|
||||
|
||||
cpuTypes = with significantBytes;
|
||||
setTypes "cpu-type" {
|
||||
arm = { bits = 32; significantByte = littleEndian; };
|
||||
armv5tel = { bits = 32; significantByte = littleEndian; };
|
||||
armv7l = { bits = 32; significantByte = littleEndian; };
|
||||
i686 = { bits = 32; significantByte = littleEndian; };
|
||||
powerpc = { bits = 32; significantByte = bigEndian; };
|
||||
x86_64 = { bits = 64; significantByte = littleEndian; };
|
||||
};
|
||||
|
||||
|
||||
isExecFormat = isType "exec-format";
|
||||
execFormats = setTypes "exec-format" {
|
||||
aout = {}; # a.out
|
||||
elf = {};
|
||||
macho = {};
|
||||
pe = {};
|
||||
unknow = {};
|
||||
};
|
||||
|
||||
|
||||
isKernel = isType "kernel";
|
||||
kernels = with execFormats;
|
||||
setTypes "kernel" {
|
||||
cygwin = { execFormat = pe; };
|
||||
darwin = { execFormat = macho; };
|
||||
freebsd = { execFormat = elf; };
|
||||
linux = { execFormat = elf; };
|
||||
netbsd = { execFormat = elf; };
|
||||
none = { execFormat = unknow; };
|
||||
openbsd = { execFormat = elf; };
|
||||
win32 = { execFormat = pe; };
|
||||
};
|
||||
|
||||
|
||||
isArchitecture = isType "architecture";
|
||||
architectures = setTypes "architecture" {
|
||||
apple = {};
|
||||
pc = {};
|
||||
unknow = {};
|
||||
};
|
||||
|
||||
|
||||
isSystem = x: isType "system" x
|
||||
&& isCpuType x.cpu
|
||||
&& isArchitecture x.arch
|
||||
&& isKernel x.kernel;
|
||||
|
||||
mkSystem = {
|
||||
cpu ? cpuTypes.i686,
|
||||
arch ? architectures.pc,
|
||||
kernel ? kernels.linux,
|
||||
name ? "${cpu.name}-${arch.name}-${kernel.name}"
|
||||
}: setType "system" {
|
||||
inherit name cpu arch kernel;
|
||||
};
|
||||
|
||||
|
||||
is64Bit = matchAttrs { cpu = { bits = 64; }; };
|
||||
isDarwin = matchAttrs { kernel = kernels.darwin; };
|
||||
isi686 = matchAttrs { cpu = cpuTypes.i686; };
|
||||
isLinux = matchAttrs { kernel = kernels.linux; };
|
||||
|
||||
|
||||
# This should revert the job done by config.guess from the gcc compiler.
|
||||
mkSystemFromString = s: let
|
||||
l = lib.splitString "-" s;
|
||||
|
||||
getCpu = name:
|
||||
attrByPath [name] (throw "Unknow cpuType `${name}'.")
|
||||
cpuTypes;
|
||||
getArch = name:
|
||||
attrByPath [name] (throw "Unknow architecture `${name}'.")
|
||||
architectures;
|
||||
getKernel = name:
|
||||
attrByPath [name] (throw "Unknow kernel `${name}'.")
|
||||
kernels;
|
||||
|
||||
system =
|
||||
if builtins.length l == 2 then
|
||||
mkSystem rec {
|
||||
name = s;
|
||||
cpu = getCpu (head l);
|
||||
arch =
|
||||
if isDarwin system
|
||||
then architectures.apple
|
||||
else architectures.pc;
|
||||
kernel = getKernel (head (tail l));
|
||||
}
|
||||
else
|
||||
mkSystem {
|
||||
name = s;
|
||||
cpu = getCpu (head l);
|
||||
arch = getArch (head (tail l));
|
||||
kernel = getKernel (head (tail (tail l)));
|
||||
};
|
||||
in assert isSystem system; system;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
let inherit (import ../attrsets.nix) mapAttrs; in
|
||||
|
||||
rec {
|
||||
doubles = import ./doubles.nix;
|
||||
parse = import ./parse.nix;
|
||||
inspect = import ./inspect.nix;
|
||||
platforms = import ./platforms.nix;
|
||||
examples = import ./examples.nix;
|
||||
|
||||
# Elaborate a `localSystem` or `crossSystem` so that it contains everything
|
||||
# necessary.
|
||||
#
|
||||
# `parsed` is inferred from args, both because there are two options with one
|
||||
# clearly prefered, and to prevent cycles. A simpler fixed point where the RHS
|
||||
# always just used `final.*` would fail on both counts.
|
||||
elaborate = args: let
|
||||
final = {
|
||||
# Prefer to parse `config` as it is strictly more informative.
|
||||
parsed = parse.mkSystemFromString (if args ? config then args.config else args.system);
|
||||
# Either of these can be losslessly-extracted from `parsed` iff parsing succeeds.
|
||||
system = parse.doubleFromSystem final.parsed;
|
||||
config = parse.tripleFromSystem final.parsed;
|
||||
# Just a guess, based on `system`
|
||||
platform = platforms.selectBySystem final.system;
|
||||
libc =
|
||||
/**/ if final.isDarwin then "libSystem"
|
||||
else if final.isMinGW then "msvcrt"
|
||||
else if final.isLinux then "glibc"
|
||||
# TODO(@Ericson2314) think more about other operating systems
|
||||
else "native/impure";
|
||||
} // mapAttrs (n: v: v final.parsed) inspect.predicates
|
||||
// args;
|
||||
in final;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
let
|
||||
lists = import ../lists.nix;
|
||||
parse = import ./parse.nix;
|
||||
inherit (import ./inspect.nix) predicates;
|
||||
inherit (import ../attrsets.nix) matchAttrs;
|
||||
|
||||
all = [
|
||||
"aarch64-linux"
|
||||
"armv5tel-linux" "armv6l-linux" "armv7l-linux"
|
||||
|
||||
"mips64el-linux"
|
||||
|
||||
"i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd"
|
||||
|
||||
"x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-linux"
|
||||
"x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris"
|
||||
];
|
||||
|
||||
allParsed = map parse.mkSystemFromString all;
|
||||
|
||||
filterDoubles = f: map parse.doubleFromSystem (lists.filter f allParsed);
|
||||
|
||||
in rec {
|
||||
inherit all;
|
||||
|
||||
allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all;
|
||||
none = [];
|
||||
|
||||
arm = filterDoubles predicates.isArm;
|
||||
i686 = filterDoubles predicates.isi686;
|
||||
mips = filterDoubles predicates.isMips;
|
||||
x86_64 = filterDoubles predicates.isx86_64;
|
||||
|
||||
cygwin = filterDoubles predicates.isCygwin;
|
||||
darwin = filterDoubles predicates.isDarwin;
|
||||
freebsd = filterDoubles predicates.isFreeBSD;
|
||||
# Should be better, but MinGW is unclear, and HURD is bit-rotted.
|
||||
gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; });
|
||||
illumos = filterDoubles predicates.isSunOS;
|
||||
linux = filterDoubles predicates.isLinux;
|
||||
netbsd = filterDoubles predicates.isNetBSD;
|
||||
openbsd = filterDoubles predicates.isOpenBSD;
|
||||
unix = filterDoubles predicates.isUnix;
|
||||
|
||||
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux"];
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
# These can be passed to nixpkgs as either the `localSystem` or
|
||||
# `crossSystem`. They are put here for user convenience, but also used by cross
|
||||
# tests and linux cross stdenv building, so handle with care!
|
||||
|
||||
let platforms = import ./platforms.nix; in
|
||||
|
||||
rec {
|
||||
#
|
||||
# Linux
|
||||
#
|
||||
|
||||
sheevaplug = rec {
|
||||
config = "armv5tel-unknown-linux-gnueabi";
|
||||
bigEndian = false;
|
||||
arch = "armv5tel";
|
||||
float = "soft";
|
||||
withTLS = true;
|
||||
libc = "glibc";
|
||||
platform = platforms.sheevaplug;
|
||||
openssl.system = "linux-generic32";
|
||||
inherit (platform) gcc;
|
||||
};
|
||||
|
||||
raspberryPi = rec {
|
||||
config = "armv6l-unknown-linux-gnueabihf";
|
||||
bigEndian = false;
|
||||
arch = "armv6l";
|
||||
float = "hard";
|
||||
fpu = "vfp";
|
||||
withTLS = true;
|
||||
libc = "glibc";
|
||||
platform = platforms.raspberrypi;
|
||||
openssl.system = "linux-generic32";
|
||||
inherit (platform) gcc;
|
||||
};
|
||||
|
||||
armv7l-hf-multiplatform = rec {
|
||||
config = "arm-unknown-linux-gnueabihf";
|
||||
bigEndian = false;
|
||||
arch = "armv7-a";
|
||||
float = "hard";
|
||||
fpu = "vfpv3-d16";
|
||||
withTLS = true;
|
||||
libc = "glibc";
|
||||
platform = platforms.armv7l-hf-multiplatform;
|
||||
openssl.system = "linux-generic32";
|
||||
inherit (platform) gcc;
|
||||
};
|
||||
|
||||
aarch64-multiplatform = rec {
|
||||
config = "aarch64-unknown-linux-gnu";
|
||||
bigEndian = false;
|
||||
arch = "aarch64";
|
||||
withTLS = true;
|
||||
libc = "glibc";
|
||||
platform = platforms.aarch64-multiplatform;
|
||||
inherit (platform) gcc;
|
||||
};
|
||||
|
||||
scaleway-c1 = armv7l-hf-multiplatform // rec {
|
||||
platform = platforms.scaleway-c1;
|
||||
inherit (platform) gcc;
|
||||
inherit (gcc) fpu;
|
||||
};
|
||||
|
||||
pogoplug4 = rec {
|
||||
arch = "armv5tel";
|
||||
config = "armv5tel-softfloat-linux-gnueabi";
|
||||
float = "soft";
|
||||
|
||||
platform = platforms.pogoplug4;
|
||||
|
||||
inherit (platform) gcc;
|
||||
libc = "glibc";
|
||||
|
||||
withTLS = true;
|
||||
openssl.system = "linux-generic32";
|
||||
};
|
||||
|
||||
fuloongminipc = rec {
|
||||
config = "mips64el-unknown-linux-gnu";
|
||||
bigEndian = false;
|
||||
arch = "mips";
|
||||
float = "hard";
|
||||
withTLS = true;
|
||||
libc = "glibc";
|
||||
platform = platforms.fuloong2f_n32;
|
||||
openssl.system = "linux-generic32";
|
||||
inherit (platform) gcc;
|
||||
};
|
||||
|
||||
#
|
||||
# Darwin
|
||||
#
|
||||
|
||||
iphone64 = {
|
||||
config = "aarch64-apple-darwin14";
|
||||
arch = "arm64";
|
||||
libc = "libSystem";
|
||||
platform = {};
|
||||
};
|
||||
|
||||
iphone32 = {
|
||||
config = "arm-apple-darwin10";
|
||||
arch = "armv7-a";
|
||||
libc = "libSystem";
|
||||
platform = {};
|
||||
};
|
||||
|
||||
#
|
||||
# Windows
|
||||
#
|
||||
|
||||
# 32 bit mingw-w64
|
||||
mingw32 = {
|
||||
config = "i686-pc-mingw32";
|
||||
arch = "x86"; # Irrelevant
|
||||
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
|
||||
platform = {};
|
||||
};
|
||||
|
||||
# 64 bit mingw-w64
|
||||
mingwW64 = {
|
||||
# That's the triplet they use in the mingw-w64 docs.
|
||||
config = "x86_64-pc-mingw32";
|
||||
arch = "x86_64"; # Irrelevant
|
||||
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
|
||||
platform = {};
|
||||
};
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
with import ./parse.nix;
|
||||
with import ../attrsets.nix;
|
||||
with import ../lists.nix;
|
||||
|
||||
rec {
|
||||
patterns = rec {
|
||||
"32bit" = { cpu = { bits = 32; }; };
|
||||
"64bit" = { cpu = { bits = 64; }; };
|
||||
i686 = { cpu = cpuTypes.i686; };
|
||||
x86_64 = { cpu = cpuTypes.x86_64; };
|
||||
PowerPC = { cpu = cpuTypes.powerpc; };
|
||||
x86 = { cpu = { family = "x86"; }; };
|
||||
Arm = { cpu = { family = "arm"; }; };
|
||||
Aarch64 = { cpu = { family = "aarch64"; }; };
|
||||
Mips = { cpu = { family = "mips"; }; };
|
||||
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
|
||||
LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };
|
||||
|
||||
BSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
|
||||
Unix = [ BSD Darwin Linux SunOS Hurd Cygwin ];
|
||||
|
||||
Darwin = { kernel = kernels.darwin; };
|
||||
Linux = { kernel = kernels.linux; };
|
||||
SunOS = { kernel = kernels.solaris; };
|
||||
FreeBSD = { kernel = kernels.freebsd; };
|
||||
Hurd = { kernel = kernels.hurd; };
|
||||
NetBSD = { kernel = kernels.netbsd; };
|
||||
OpenBSD = { kernel = kernels.openbsd; };
|
||||
Windows = { kernel = kernels.windows; };
|
||||
Cygwin = { kernel = kernels.windows; abi = abis.cygnus; };
|
||||
MinGW = { kernel = kernels.windows; abi = abis.gnu; };
|
||||
};
|
||||
|
||||
matchAnyAttrs = patterns:
|
||||
if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns
|
||||
else matchAttrs patterns;
|
||||
|
||||
predicates = mapAttrs'
|
||||
(name: value: nameValuePair ("is" + name) (matchAnyAttrs value))
|
||||
patterns;
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
# Define the list of system with their properties.
|
||||
#
|
||||
# See https://clang.llvm.org/docs/CrossCompilation.html and
|
||||
# http://llvm.org/docs/doxygen/html/Triple_8cpp_source.html especially
|
||||
# Triple::normalize. Parsing should essentially act as a more conservative
|
||||
# version of that last function.
|
||||
|
||||
with import ../lists.nix;
|
||||
with import ../types.nix;
|
||||
with import ../attrsets.nix;
|
||||
with (import ./inspect.nix).predicates;
|
||||
|
||||
let
|
||||
lib = import ../default.nix;
|
||||
setTypesAssert = type: pred:
|
||||
mapAttrs (name: value:
|
||||
assert pred value;
|
||||
setType type ({ inherit name; } // value));
|
||||
setTypes = type: setTypesAssert type (_: true);
|
||||
|
||||
in
|
||||
|
||||
rec {
|
||||
|
||||
isSignificantByte = isType "significant-byte";
|
||||
significantBytes = setTypes "significant-byte" {
|
||||
bigEndian = {};
|
||||
littleEndian = {};
|
||||
};
|
||||
|
||||
isCpuType = isType "cpu-type";
|
||||
cpuTypes = with significantBytes; setTypesAssert "cpu-type"
|
||||
(x: elem x.bits [8 16 32 64 128]
|
||||
&& (if 8 < x.bits
|
||||
then isSignificantByte x.significantByte
|
||||
else !(x ? significantByte)))
|
||||
{
|
||||
arm = { bits = 32; significantByte = littleEndian; family = "arm"; };
|
||||
armv5tel = { bits = 32; significantByte = littleEndian; family = "arm"; };
|
||||
armv6l = { bits = 32; significantByte = littleEndian; family = "arm"; };
|
||||
armv7a = { bits = 32; significantByte = littleEndian; family = "arm"; };
|
||||
armv7l = { bits = 32; significantByte = littleEndian; family = "arm"; };
|
||||
aarch64 = { bits = 64; significantByte = littleEndian; family = "aarch64"; };
|
||||
i686 = { bits = 32; significantByte = littleEndian; family = "x86"; };
|
||||
x86_64 = { bits = 64; significantByte = littleEndian; family = "x86"; };
|
||||
mips64el = { bits = 32; significantByte = littleEndian; family = "mips"; };
|
||||
powerpc = { bits = 32; significantByte = bigEndian; family = "power"; };
|
||||
};
|
||||
|
||||
isVendor = isType "vendor";
|
||||
vendors = setTypes "vendor" {
|
||||
apple = {};
|
||||
pc = {};
|
||||
|
||||
unknown = {};
|
||||
};
|
||||
|
||||
isExecFormat = isType "exec-format";
|
||||
execFormats = setTypes "exec-format" {
|
||||
aout = {}; # a.out
|
||||
elf = {};
|
||||
macho = {};
|
||||
pe = {};
|
||||
|
||||
unknown = {};
|
||||
};
|
||||
|
||||
isKernelFamily = isType "kernel-family";
|
||||
kernelFamilies = setTypes "kernel-family" {
|
||||
bsd = {};
|
||||
};
|
||||
|
||||
isKernel = x: isType "kernel" x;
|
||||
kernels = with execFormats; with kernelFamilies; setTypesAssert "kernel"
|
||||
(x: isExecFormat x.execFormat && all isKernelFamily (attrValues x.families))
|
||||
{
|
||||
darwin = { execFormat = macho; families = { }; };
|
||||
freebsd = { execFormat = elf; families = { inherit bsd; }; };
|
||||
hurd = { execFormat = elf; families = { }; };
|
||||
linux = { execFormat = elf; families = { }; };
|
||||
netbsd = { execFormat = elf; families = { inherit bsd; }; };
|
||||
none = { execFormat = unknown; families = { }; };
|
||||
openbsd = { execFormat = elf; families = { inherit bsd; }; };
|
||||
solaris = { execFormat = elf; families = { }; };
|
||||
windows = { execFormat = pe; families = { }; };
|
||||
} // { # aliases
|
||||
# TODO(@Ericson2314): Handle these Darwin version suffixes more generally.
|
||||
darwin10 = kernels.darwin;
|
||||
darwin14 = kernels.darwin;
|
||||
win32 = kernels.windows;
|
||||
};
|
||||
|
||||
isAbi = isType "abi";
|
||||
abis = setTypes "abi" {
|
||||
cygnus = {};
|
||||
gnu = {};
|
||||
msvc = {};
|
||||
eabi = {};
|
||||
androideabi = {};
|
||||
gnueabi = {};
|
||||
gnueabihf = {};
|
||||
|
||||
unknown = {};
|
||||
};
|
||||
|
||||
isSystem = isType "system";
|
||||
mkSystem = { cpu, vendor, kernel, abi }:
|
||||
assert isCpuType cpu && isVendor vendor && isKernel kernel && isAbi abi;
|
||||
setType "system" {
|
||||
inherit cpu vendor kernel abi;
|
||||
};
|
||||
|
||||
mkSkeletonFromList = l: {
|
||||
"2" = # We only do 2-part hacks for things Nix already supports
|
||||
if elemAt l 1 == "cygwin"
|
||||
then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; }
|
||||
else if elemAt l 1 == "gnu"
|
||||
then { cpu = elemAt l 0; kernel = "hurd"; abi = "gnu"; }
|
||||
else { cpu = elemAt l 0; kernel = elemAt l 1; };
|
||||
"3" = # Awkwards hacks, beware!
|
||||
if elemAt l 1 == "apple"
|
||||
then { cpu = elemAt l 0; vendor = "apple"; kernel = elemAt l 2; }
|
||||
else if (elemAt l 1 == "linux") || (elemAt l 2 == "gnu")
|
||||
then { cpu = elemAt l 0; kernel = elemAt l 1; abi = elemAt l 2; }
|
||||
else if (elemAt l 2 == "mingw32") # autotools breaks on -gnu for window
|
||||
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "windows"; abi = "gnu"; }
|
||||
else throw "Target specification with 3 components is ambiguous";
|
||||
"4" = { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; };
|
||||
}.${toString (length l)}
|
||||
or (throw "system string has invalid number of hyphen-separated components");
|
||||
|
||||
# This should revert the job done by config.guess from the gcc compiler.
|
||||
mkSystemFromSkeleton = { cpu
|
||||
, # Optional, but fallback too complex for here.
|
||||
# Inferred below instead.
|
||||
vendor ? assert false; null
|
||||
, kernel
|
||||
, # Also inferred below
|
||||
abi ? assert false; null
|
||||
} @ args: let
|
||||
getCpu = name: cpuTypes.${name} or (throw "Unknown CPU type: ${name}");
|
||||
getVendor = name: vendors.${name} or (throw "Unknown vendor: ${name}");
|
||||
getKernel = name: kernels.${name} or (throw "Unknown kernel: ${name}");
|
||||
getAbi = name: abis.${name} or (throw "Unknown ABI: ${name}");
|
||||
|
||||
parsed = rec {
|
||||
cpu = getCpu args.cpu;
|
||||
vendor =
|
||||
/**/ if args ? vendor then getVendor args.vendor
|
||||
else if isDarwin parsed then vendors.apple
|
||||
else if isWindows parsed then vendors.pc
|
||||
else vendors.unknown;
|
||||
kernel = getKernel args.kernel;
|
||||
abi =
|
||||
/**/ if args ? abi then getAbi args.abi
|
||||
else if isLinux parsed then abis.gnu
|
||||
else if isWindows parsed then abis.gnu
|
||||
else abis.unknown;
|
||||
};
|
||||
|
||||
in mkSystem parsed;
|
||||
|
||||
mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s));
|
||||
|
||||
doubleFromSystem = { cpu, vendor, kernel, abi, ... }:
|
||||
if abi == abis.cygnus
|
||||
then "${cpu.name}-cygwin"
|
||||
else "${cpu.name}-${kernel.name}";
|
||||
|
||||
tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let
|
||||
optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}";
|
||||
in "${cpu.name}-${vendor.name}-${kernel.name}${optAbi}";
|
||||
|
||||
}
|
||||
@@ -1,567 +0,0 @@
|
||||
rec {
|
||||
pcBase = {
|
||||
name = "pc";
|
||||
uboot = null;
|
||||
kernelHeadersBaseConfig = "defconfig";
|
||||
kernelBaseConfig = "defconfig";
|
||||
# Build whatever possible as a module, if not stated in the extra config.
|
||||
kernelAutoModules = true;
|
||||
kernelTarget = "bzImage";
|
||||
};
|
||||
|
||||
pc64 = pcBase // { kernelArch = "x86_64"; };
|
||||
|
||||
pc32 = pcBase // { kernelArch = "i386"; };
|
||||
|
||||
pc32_simplekernel = pc32 // {
|
||||
kernelAutoModules = false;
|
||||
};
|
||||
|
||||
pc64_simplekernel = pc64 // {
|
||||
kernelAutoModules = false;
|
||||
};
|
||||
|
||||
pogoplug4 = {
|
||||
name = "pogoplug4";
|
||||
|
||||
gcc = {
|
||||
arch = "armv5te";
|
||||
float = "soft";
|
||||
};
|
||||
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "multi_v5_defconfig";
|
||||
kernelBaseConfig = "multi_v5_defconfig";
|
||||
kernelArch = "arm";
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig =
|
||||
''
|
||||
# Ubi for the mtd
|
||||
MTD_UBI y
|
||||
UBIFS_FS y
|
||||
UBIFS_FS_XATTR y
|
||||
UBIFS_FS_ADVANCED_COMPR y
|
||||
UBIFS_FS_LZO y
|
||||
UBIFS_FS_ZLIB y
|
||||
UBIFS_FS_DEBUG n
|
||||
'';
|
||||
kernelMakeFlags = [ "LOADADDR=0x8000" ];
|
||||
kernelTarget = "uImage";
|
||||
# TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working
|
||||
#kernelDTB = true;
|
||||
|
||||
# XXX can be anything non-null, pkgs actually only cares if it is set or not
|
||||
uboot = "pogoplug4";
|
||||
};
|
||||
|
||||
sheevaplug = {
|
||||
name = "sheevaplug";
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "multi_v5_defconfig";
|
||||
kernelBaseConfig = "multi_v5_defconfig";
|
||||
kernelArch = "arm";
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig = ''
|
||||
BLK_DEV_RAM y
|
||||
BLK_DEV_INITRD y
|
||||
BLK_DEV_CRYPTOLOOP m
|
||||
BLK_DEV_DM m
|
||||
DM_CRYPT m
|
||||
MD y
|
||||
REISERFS_FS m
|
||||
BTRFS_FS m
|
||||
XFS_FS m
|
||||
JFS_FS m
|
||||
EXT4_FS m
|
||||
USB_STORAGE_CYPRESS_ATACB m
|
||||
|
||||
# mv cesa requires this sw fallback, for mv-sha1
|
||||
CRYPTO_SHA1 y
|
||||
# Fast crypto
|
||||
CRYPTO_TWOFISH y
|
||||
CRYPTO_TWOFISH_COMMON y
|
||||
CRYPTO_BLOWFISH y
|
||||
CRYPTO_BLOWFISH_COMMON y
|
||||
|
||||
IP_PNP y
|
||||
IP_PNP_DHCP y
|
||||
NFS_FS y
|
||||
ROOT_NFS y
|
||||
TUN m
|
||||
NFS_V4 y
|
||||
NFS_V4_1 y
|
||||
NFS_FSCACHE y
|
||||
NFSD m
|
||||
NFSD_V2_ACL y
|
||||
NFSD_V3 y
|
||||
NFSD_V3_ACL y
|
||||
NFSD_V4 y
|
||||
NETFILTER y
|
||||
IP_NF_IPTABLES y
|
||||
IP_NF_FILTER y
|
||||
IP_NF_MATCH_ADDRTYPE y
|
||||
IP_NF_TARGET_LOG y
|
||||
IP_NF_MANGLE y
|
||||
IPV6 m
|
||||
VLAN_8021Q m
|
||||
|
||||
CIFS y
|
||||
CIFS_XATTR y
|
||||
CIFS_POSIX y
|
||||
CIFS_FSCACHE y
|
||||
CIFS_ACL y
|
||||
|
||||
WATCHDOG y
|
||||
WATCHDOG_CORE y
|
||||
ORION_WATCHDOG m
|
||||
|
||||
ZRAM m
|
||||
NETCONSOLE m
|
||||
|
||||
# Disable OABI to have seccomp_filter (required for systemd)
|
||||
# https://github.com/raspberrypi/firmware/issues/651
|
||||
OABI_COMPAT n
|
||||
|
||||
# Fail to build
|
||||
DRM n
|
||||
SCSI_ADVANSYS n
|
||||
USB_ISP1362_HCD n
|
||||
SND_SOC n
|
||||
SND_ALI5451 n
|
||||
FB_SAVAGE n
|
||||
SCSI_NSP32 n
|
||||
ATA_SFF n
|
||||
SUNGEM n
|
||||
IRDA n
|
||||
ATM_HE n
|
||||
SCSI_ACARD n
|
||||
BLK_DEV_CMD640_ENHANCED n
|
||||
|
||||
FUSE_FS m
|
||||
|
||||
# systemd uses cgroups
|
||||
CGROUPS y
|
||||
|
||||
# Latencytop
|
||||
LATENCYTOP y
|
||||
|
||||
# Ubi for the mtd
|
||||
MTD_UBI y
|
||||
UBIFS_FS y
|
||||
UBIFS_FS_XATTR y
|
||||
UBIFS_FS_ADVANCED_COMPR y
|
||||
UBIFS_FS_LZO y
|
||||
UBIFS_FS_ZLIB y
|
||||
UBIFS_FS_DEBUG n
|
||||
|
||||
# Kdb, for kernel troubles
|
||||
KGDB y
|
||||
KGDB_SERIAL_CONSOLE y
|
||||
KGDB_KDB y
|
||||
'';
|
||||
kernelMakeFlags = [ "LOADADDR=0x0200000" ];
|
||||
kernelTarget = "uImage";
|
||||
uboot = "sheevaplug";
|
||||
# Only for uboot = uboot :
|
||||
ubootConfig = "sheevaplug_config";
|
||||
kernelDTB = true; # Beyond 3.10
|
||||
gcc = {
|
||||
arch = "armv5te";
|
||||
float = "soft";
|
||||
};
|
||||
};
|
||||
|
||||
raspberrypi = {
|
||||
name = "raspberrypi";
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "bcm2835_defconfig";
|
||||
kernelBaseConfig = "bcmrpi_defconfig";
|
||||
kernelDTB = true;
|
||||
kernelArch = "arm";
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig = ''
|
||||
BLK_DEV_RAM y
|
||||
BLK_DEV_INITRD y
|
||||
BLK_DEV_CRYPTOLOOP m
|
||||
BLK_DEV_DM m
|
||||
DM_CRYPT m
|
||||
MD y
|
||||
REISERFS_FS m
|
||||
BTRFS_FS y
|
||||
XFS_FS m
|
||||
JFS_FS y
|
||||
EXT4_FS y
|
||||
|
||||
IP_PNP y
|
||||
IP_PNP_DHCP y
|
||||
NFS_FS y
|
||||
ROOT_NFS y
|
||||
TUN m
|
||||
NFS_V4 y
|
||||
NFS_V4_1 y
|
||||
NFS_FSCACHE y
|
||||
NFSD m
|
||||
NFSD_V2_ACL y
|
||||
NFSD_V3 y
|
||||
NFSD_V3_ACL y
|
||||
NFSD_V4 y
|
||||
NETFILTER y
|
||||
IP_NF_IPTABLES y
|
||||
IP_NF_FILTER y
|
||||
IP_NF_MATCH_ADDRTYPE y
|
||||
IP_NF_TARGET_LOG y
|
||||
IP_NF_MANGLE y
|
||||
IPV6 m
|
||||
VLAN_8021Q m
|
||||
|
||||
CIFS y
|
||||
CIFS_XATTR y
|
||||
CIFS_POSIX y
|
||||
CIFS_FSCACHE y
|
||||
CIFS_ACL y
|
||||
|
||||
ZRAM m
|
||||
|
||||
# Disable OABI to have seccomp_filter (required for systemd)
|
||||
# https://github.com/raspberrypi/firmware/issues/651
|
||||
OABI_COMPAT n
|
||||
|
||||
# Fail to build
|
||||
DRM n
|
||||
SCSI_ADVANSYS n
|
||||
USB_ISP1362_HCD n
|
||||
SND_SOC n
|
||||
SND_ALI5451 n
|
||||
FB_SAVAGE n
|
||||
SCSI_NSP32 n
|
||||
ATA_SFF n
|
||||
SUNGEM n
|
||||
IRDA n
|
||||
ATM_HE n
|
||||
SCSI_ACARD n
|
||||
BLK_DEV_CMD640_ENHANCED n
|
||||
|
||||
FUSE_FS m
|
||||
|
||||
# nixos mounts some cgroup
|
||||
CGROUPS y
|
||||
|
||||
# Latencytop
|
||||
LATENCYTOP y
|
||||
'';
|
||||
kernelTarget = "zImage";
|
||||
uboot = null;
|
||||
gcc = {
|
||||
arch = "armv6";
|
||||
fpu = "vfp";
|
||||
float = "hard";
|
||||
# TODO(@Ericson2314) what is this and is it a good idea? It was
|
||||
# used in some cross compilation examples but not others.
|
||||
#
|
||||
# abi = "aapcs-linux";
|
||||
};
|
||||
};
|
||||
|
||||
raspberrypi2 = armv7l-hf-multiplatform // {
|
||||
name = "raspberrypi2";
|
||||
kernelBaseConfig = "bcm2709_defconfig";
|
||||
kernelDTB = true;
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig = ''
|
||||
BLK_DEV_RAM y
|
||||
BLK_DEV_INITRD y
|
||||
BLK_DEV_CRYPTOLOOP m
|
||||
BLK_DEV_DM m
|
||||
DM_CRYPT m
|
||||
MD y
|
||||
REISERFS_FS m
|
||||
BTRFS_FS y
|
||||
XFS_FS m
|
||||
JFS_FS y
|
||||
EXT4_FS y
|
||||
|
||||
IP_PNP y
|
||||
IP_PNP_DHCP y
|
||||
NFS_FS y
|
||||
ROOT_NFS y
|
||||
TUN m
|
||||
NFS_V4 y
|
||||
NFS_V4_1 y
|
||||
NFS_FSCACHE y
|
||||
NFSD m
|
||||
NFSD_V2_ACL y
|
||||
NFSD_V3 y
|
||||
NFSD_V3_ACL y
|
||||
NFSD_V4 y
|
||||
NETFILTER y
|
||||
IP_NF_IPTABLES y
|
||||
IP_NF_FILTER y
|
||||
IP_NF_MATCH_ADDRTYPE y
|
||||
IP_NF_TARGET_LOG y
|
||||
IP_NF_MANGLE y
|
||||
IPV6 m
|
||||
VLAN_8021Q m
|
||||
|
||||
CIFS y
|
||||
CIFS_XATTR y
|
||||
CIFS_POSIX y
|
||||
CIFS_FSCACHE y
|
||||
CIFS_ACL y
|
||||
|
||||
ZRAM m
|
||||
|
||||
# Disable OABI to have seccomp_filter (required for systemd)
|
||||
# https://github.com/raspberrypi/firmware/issues/651
|
||||
OABI_COMPAT n
|
||||
|
||||
# Fail to build
|
||||
DRM n
|
||||
SCSI_ADVANSYS n
|
||||
USB_ISP1362_HCD n
|
||||
SND_SOC n
|
||||
SND_ALI5451 n
|
||||
FB_SAVAGE n
|
||||
SCSI_NSP32 n
|
||||
ATA_SFF n
|
||||
SUNGEM n
|
||||
IRDA n
|
||||
ATM_HE n
|
||||
SCSI_ACARD n
|
||||
BLK_DEV_CMD640_ENHANCED n
|
||||
|
||||
FUSE_FS m
|
||||
|
||||
# nixos mounts some cgroup
|
||||
CGROUPS y
|
||||
|
||||
# Latencytop
|
||||
LATENCYTOP y
|
||||
|
||||
# Disable the common config Xen, it doesn't build on ARM
|
||||
XEN? n
|
||||
'';
|
||||
kernelTarget = "zImage";
|
||||
uboot = null;
|
||||
};
|
||||
|
||||
scaleway-c1 = armv7l-hf-multiplatform // {
|
||||
gcc = {
|
||||
cpu = "cortex-a9";
|
||||
fpu = "vfpv3";
|
||||
float = "hard";
|
||||
};
|
||||
};
|
||||
|
||||
utilite = {
|
||||
name = "utilite";
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "multi_v7_defconfig";
|
||||
kernelBaseConfig = "multi_v7_defconfig";
|
||||
kernelArch = "arm";
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig =
|
||||
''
|
||||
# Ubi for the mtd
|
||||
MTD_UBI y
|
||||
UBIFS_FS y
|
||||
UBIFS_FS_XATTR y
|
||||
UBIFS_FS_ADVANCED_COMPR y
|
||||
UBIFS_FS_LZO y
|
||||
UBIFS_FS_ZLIB y
|
||||
UBIFS_FS_DEBUG n
|
||||
'';
|
||||
kernelMakeFlags = [ "LOADADDR=0x10800000" ];
|
||||
kernelTarget = "uImage";
|
||||
kernelDTB = true;
|
||||
uboot = true; #XXX: any non-null value here is needed so that mkimage is present to build kernelTarget uImage
|
||||
gcc = {
|
||||
cpu = "cortex-a9";
|
||||
fpu = "neon";
|
||||
float = "hard";
|
||||
};
|
||||
};
|
||||
|
||||
guruplug = sheevaplug // {
|
||||
# Define `CONFIG_MACH_GURUPLUG' (see
|
||||
# <http://kerneltrap.org/mailarchive/git-commits-head/2010/5/19/33618>)
|
||||
# and other GuruPlug-specific things. Requires the `guruplug-defconfig'
|
||||
# patch.
|
||||
|
||||
kernelBaseConfig = "guruplug_defconfig";
|
||||
#kernelHeadersBaseConfig = "guruplug_defconfig";
|
||||
};
|
||||
|
||||
fuloong2f_n32 = {
|
||||
name = "fuloong2f_n32";
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "fuloong2e_defconfig";
|
||||
kernelBaseConfig = "lemote2f_defconfig";
|
||||
kernelArch = "mips";
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig = ''
|
||||
MIGRATION n
|
||||
COMPACTION n
|
||||
|
||||
# nixos mounts some cgroup
|
||||
CGROUPS y
|
||||
|
||||
BLK_DEV_RAM y
|
||||
BLK_DEV_INITRD y
|
||||
BLK_DEV_CRYPTOLOOP m
|
||||
BLK_DEV_DM m
|
||||
DM_CRYPT m
|
||||
MD y
|
||||
REISERFS_FS m
|
||||
EXT4_FS m
|
||||
USB_STORAGE_CYPRESS_ATACB m
|
||||
|
||||
IP_PNP y
|
||||
IP_PNP_DHCP y
|
||||
IP_PNP_BOOTP y
|
||||
NFS_FS y
|
||||
ROOT_NFS y
|
||||
TUN m
|
||||
NFS_V4 y
|
||||
NFS_V4_1 y
|
||||
NFS_FSCACHE y
|
||||
NFSD m
|
||||
NFSD_V2_ACL y
|
||||
NFSD_V3 y
|
||||
NFSD_V3_ACL y
|
||||
NFSD_V4 y
|
||||
|
||||
# Fail to build
|
||||
DRM n
|
||||
SCSI_ADVANSYS n
|
||||
USB_ISP1362_HCD n
|
||||
SND_SOC n
|
||||
SND_ALI5451 n
|
||||
FB_SAVAGE n
|
||||
SCSI_NSP32 n
|
||||
ATA_SFF n
|
||||
SUNGEM n
|
||||
IRDA n
|
||||
ATM_HE n
|
||||
SCSI_ACARD n
|
||||
BLK_DEV_CMD640_ENHANCED n
|
||||
|
||||
FUSE_FS m
|
||||
|
||||
# Needed for udev >= 150
|
||||
SYSFS_DEPRECATED_V2 n
|
||||
|
||||
VGA_CONSOLE n
|
||||
VT_HW_CONSOLE_BINDING y
|
||||
SERIAL_8250_CONSOLE y
|
||||
FRAMEBUFFER_CONSOLE y
|
||||
EXT2_FS y
|
||||
EXT3_FS y
|
||||
REISERFS_FS y
|
||||
MAGIC_SYSRQ y
|
||||
|
||||
# The kernel doesn't boot at all, with FTRACE
|
||||
FTRACE n
|
||||
'';
|
||||
kernelTarget = "vmlinux";
|
||||
uboot = null;
|
||||
gcc = {
|
||||
arch = "loongson2f";
|
||||
abi = "n32";
|
||||
};
|
||||
};
|
||||
|
||||
beaglebone = armv7l-hf-multiplatform // {
|
||||
name = "beaglebone";
|
||||
kernelBaseConfig = "omap2plus_defconfig";
|
||||
kernelAutoModules = false;
|
||||
kernelExtraConfig = ""; # TBD kernel config
|
||||
kernelTarget = "zImage";
|
||||
uboot = null;
|
||||
};
|
||||
|
||||
armv7l-hf-multiplatform = {
|
||||
name = "armv7l-hf-multiplatform";
|
||||
kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
|
||||
kernelHeadersBaseConfig = "multi_v7_defconfig";
|
||||
kernelBaseConfig = "multi_v7_defconfig";
|
||||
kernelArch = "arm";
|
||||
kernelDTB = true;
|
||||
kernelAutoModules = true;
|
||||
kernelPreferBuiltin = true;
|
||||
uboot = null;
|
||||
kernelTarget = "zImage";
|
||||
kernelExtraConfig = ''
|
||||
# Fix broken sunxi-sid nvmem driver.
|
||||
TI_CPTS y
|
||||
|
||||
# Hangs ODROID-XU4
|
||||
ARM_BIG_LITTLE_CPUIDLE n
|
||||
'';
|
||||
gcc = {
|
||||
# Some table about fpu flags:
|
||||
# http://community.arm.com/servlet/JiveServlet/showImage/38-1981-3827/blogentry-103749-004812900+1365712953_thumb.png
|
||||
# Cortex-A5: -mfpu=neon-fp16
|
||||
# Cortex-A7 (rpi2): -mfpu=neon-vfpv4
|
||||
# Cortex-A8 (beaglebone): -mfpu=neon
|
||||
# Cortex-A9: -mfpu=neon-fp16
|
||||
# Cortex-A15: -mfpu=neon-vfpv4
|
||||
|
||||
# More about FPU:
|
||||
# https://wiki.debian.org/ArmHardFloatPort/VfpComparison
|
||||
|
||||
# vfpv3-d16 is what Debian uses and seems to be the best compromise: NEON is not supported in e.g. Scaleway or Tegra 2,
|
||||
# and the above page suggests NEON is only an improvement with hand-written assembly.
|
||||
arch = "armv7-a";
|
||||
fpu = "vfpv3-d16";
|
||||
float = "hard";
|
||||
|
||||
# For Raspberry Pi the 2 the best would be:
|
||||
# cpu = "cortex-a7";
|
||||
# fpu = "neon-vfpv4";
|
||||
};
|
||||
};
|
||||
|
||||
aarch64-multiplatform = {
|
||||
name = "aarch64-multiplatform";
|
||||
kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
|
||||
kernelHeadersBaseConfig = "defconfig";
|
||||
kernelBaseConfig = "defconfig";
|
||||
kernelArch = "arm64";
|
||||
kernelDTB = true;
|
||||
kernelAutoModules = true;
|
||||
kernelPreferBuiltin = true;
|
||||
kernelExtraConfig = ''
|
||||
# Raspberry Pi 3 stuff. Not needed for kernels >= 4.10.
|
||||
ARCH_BCM2835 y
|
||||
BCM2835_MBOX y
|
||||
BCM2835_WDT y
|
||||
RASPBERRYPI_FIRMWARE y
|
||||
RASPBERRYPI_POWER y
|
||||
SERIAL_8250_BCM2835AUX y
|
||||
SERIAL_8250_EXTENDED y
|
||||
SERIAL_8250_SHARE_IRQ y
|
||||
|
||||
# Cavium ThunderX stuff.
|
||||
PCI_HOST_THUNDER_ECAM y
|
||||
|
||||
# The default (=y) forces us to have the XHCI firmware available in initrd,
|
||||
# which our initrd builder can't currently do easily.
|
||||
USB_XHCI_TEGRA m
|
||||
'';
|
||||
uboot = null;
|
||||
kernelTarget = "Image";
|
||||
gcc = {
|
||||
arch = "armv8-a";
|
||||
};
|
||||
};
|
||||
|
||||
selectBySystem = system: {
|
||||
"i686-linux" = pc32;
|
||||
"x86_64-linux" = pc64;
|
||||
"armv5tel-linux" = sheevaplug;
|
||||
"armv6l-linux" = raspberrypi;
|
||||
"armv7l-linux" = armv7l-hf-multiplatform;
|
||||
"aarch64-linux" = aarch64-multiplatform;
|
||||
"mips64el-linux" = fuloong2f_n32;
|
||||
}.${system} or pcBase;
|
||||
}
|
||||
133
lib/tests.nix
Normal file
133
lib/tests.nix
Normal file
@@ -0,0 +1,133 @@
|
||||
let inherit (builtins) add; in
|
||||
with import ./default.nix;
|
||||
|
||||
runTests {
|
||||
|
||||
testId = {
|
||||
expr = id 1;
|
||||
expected = 1;
|
||||
};
|
||||
|
||||
testConst = {
|
||||
expr = const 2 3;
|
||||
expected = 2;
|
||||
};
|
||||
|
||||
/*
|
||||
testOr = {
|
||||
expr = or true false;
|
||||
expected = true;
|
||||
};
|
||||
*/
|
||||
|
||||
testAnd = {
|
||||
expr = and true false;
|
||||
expected = false;
|
||||
};
|
||||
|
||||
testFix = {
|
||||
expr = fix (x: {a = if x ? a then "a" else "b";});
|
||||
expected = {a = "a";};
|
||||
};
|
||||
|
||||
testConcatMapStrings = {
|
||||
expr = concatMapStrings (x: x + ";") ["a" "b" "c"];
|
||||
expected = "a;b;c;";
|
||||
};
|
||||
|
||||
testConcatStringsSep = {
|
||||
expr = concatStringsSep "," ["a" "b" "c"];
|
||||
expected = "a,b,c";
|
||||
};
|
||||
|
||||
testFilter = {
|
||||
expr = filter (x: x != "a") ["a" "b" "c" "a"];
|
||||
expected = ["b" "c"];
|
||||
};
|
||||
|
||||
testFold = {
|
||||
expr = fold (builtins.add) 0 (range 0 100);
|
||||
expected = 5050;
|
||||
};
|
||||
|
||||
testTake = testAllTrue [
|
||||
([] == (take 0 [ 1 2 3 ]))
|
||||
([1] == (take 1 [ 1 2 3 ]))
|
||||
([ 1 2 ] == (take 2 [ 1 2 3 ]))
|
||||
([ 1 2 3 ] == (take 3 [ 1 2 3 ]))
|
||||
([ 1 2 3 ] == (take 4 [ 1 2 3 ]))
|
||||
];
|
||||
|
||||
testFoldAttrs = {
|
||||
expr = foldAttrs (n: a: [n] ++ a) [] [
|
||||
{ a = 2; b = 7; }
|
||||
{ a = 3; c = 8; }
|
||||
];
|
||||
expected = { a = [ 2 3 ]; b = [7]; c = [8];};
|
||||
};
|
||||
|
||||
testOverridableDelayableArgsTest = {
|
||||
expr =
|
||||
let res1 = defaultOverridableDelayableArgs id {};
|
||||
res2 = defaultOverridableDelayableArgs id { a = 7; };
|
||||
res3 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||
in (x.merge) { b = 10; };
|
||||
res4 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||
in (x.merge) ( x: { b = 10; });
|
||||
res5 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||
in (x.merge) ( x: { a = add x.a 3; });
|
||||
res6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = add; }; };
|
||||
y = x.merge {};
|
||||
in (y.merge) { a = 10; };
|
||||
|
||||
resRem7 = res6.replace (a : removeAttrs a ["a"]);
|
||||
|
||||
resReplace6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = add; }; };
|
||||
x2 = x.merge { a = 20; }; # now we have 27
|
||||
in (x2.replace) { a = 10; }; # and override the value by 10
|
||||
|
||||
# fixed tests (delayed args): (when using them add some comments, please)
|
||||
resFixed1 =
|
||||
let x = defaultOverridableDelayableArgs id ( x : { a = 7; c = x.fixed.b; });
|
||||
y = x.merge (x : { name = "name-${builtins.toString x.fixed.c}"; });
|
||||
in (y.merge) { b = 10; };
|
||||
strip = attrs : removeAttrs attrs ["merge" "replace"];
|
||||
in all id
|
||||
[ ((strip res1) == { })
|
||||
((strip res2) == { a = 7; })
|
||||
((strip res3) == { a = 7; b = 10; })
|
||||
((strip res4) == { a = 7; b = 10; })
|
||||
((strip res5) == { a = 10; })
|
||||
((strip res6) == { a = 17; })
|
||||
((strip resRem7) == {})
|
||||
((strip resFixed1) == { a = 7; b = 10; c =10; name = "name-10"; })
|
||||
];
|
||||
expected = true;
|
||||
};
|
||||
|
||||
testSort = {
|
||||
expr = sort builtins.lessThan [ 40 2 30 42 ];
|
||||
expected = [2 30 40 42];
|
||||
};
|
||||
|
||||
testToIntShouldConvertStringToInt = {
|
||||
expr = toInt "27";
|
||||
expected = 27;
|
||||
};
|
||||
|
||||
testToIntShouldThrowErrorIfItCouldNotConvertToInt = {
|
||||
expr = builtins.tryEval (toInt "\"foo\"");
|
||||
expected = { success = false; value = false; };
|
||||
};
|
||||
|
||||
testHasAttrByPathTrue = {
|
||||
expr = hasAttrByPath ["a" "b"] { a = { b = "yey"; }; };
|
||||
expected = true;
|
||||
};
|
||||
|
||||
testHasAttrByPathFalse = {
|
||||
expr = hasAttrByPath ["a" "b"] { a = { c = "yey"; }; };
|
||||
expected = false;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
# to run these tests:
|
||||
# nix-instantiate --eval --strict nixpkgs/lib/tests/misc.nix
|
||||
# if the resulting list is empty, all tests passed
|
||||
with import ../default.nix;
|
||||
|
||||
runTests {
|
||||
|
||||
|
||||
# TRIVIAL
|
||||
|
||||
testId = {
|
||||
expr = id 1;
|
||||
expected = 1;
|
||||
};
|
||||
|
||||
testConst = {
|
||||
expr = const 2 3;
|
||||
expected = 2;
|
||||
};
|
||||
|
||||
/*
|
||||
testOr = {
|
||||
expr = or true false;
|
||||
expected = true;
|
||||
};
|
||||
*/
|
||||
|
||||
testAnd = {
|
||||
expr = and true false;
|
||||
expected = false;
|
||||
};
|
||||
|
||||
testFix = {
|
||||
expr = fix (x: {a = if x ? a then "a" else "b";});
|
||||
expected = {a = "a";};
|
||||
};
|
||||
|
||||
testComposeExtensions = {
|
||||
expr = let obj = makeExtensible (self: { foo = self.bar; });
|
||||
f = self: super: { bar = false; baz = true; };
|
||||
g = self: super: { bar = super.baz or false; };
|
||||
f_o_g = composeExtensions f g;
|
||||
composed = obj.extend f_o_g;
|
||||
in composed.foo;
|
||||
expected = true;
|
||||
};
|
||||
|
||||
# STRINGS
|
||||
|
||||
testConcatMapStrings = {
|
||||
expr = concatMapStrings (x: x + ";") ["a" "b" "c"];
|
||||
expected = "a;b;c;";
|
||||
};
|
||||
|
||||
testConcatStringsSep = {
|
||||
expr = concatStringsSep "," ["a" "b" "c"];
|
||||
expected = "a,b,c";
|
||||
};
|
||||
|
||||
testSplitStringsSimple = {
|
||||
expr = strings.splitString "." "a.b.c.d";
|
||||
expected = [ "a" "b" "c" "d" ];
|
||||
};
|
||||
|
||||
testSplitStringsEmpty = {
|
||||
expr = strings.splitString "." "a..b";
|
||||
expected = [ "a" "" "b" ];
|
||||
};
|
||||
|
||||
testSplitStringsOne = {
|
||||
expr = strings.splitString ":" "a.b";
|
||||
expected = [ "a.b" ];
|
||||
};
|
||||
|
||||
testSplitStringsNone = {
|
||||
expr = strings.splitString "." "";
|
||||
expected = [ "" ];
|
||||
};
|
||||
|
||||
testSplitStringsFirstEmpty = {
|
||||
expr = strings.splitString "/" "/a/b/c";
|
||||
expected = [ "" "a" "b" "c" ];
|
||||
};
|
||||
|
||||
testSplitStringsLastEmpty = {
|
||||
expr = strings.splitString ":" "2001:db8:0:0042::8a2e:370:";
|
||||
expected = [ "2001" "db8" "0" "0042" "" "8a2e" "370" "" ];
|
||||
};
|
||||
|
||||
testIsStorePath = {
|
||||
expr =
|
||||
let goodPath =
|
||||
"${builtins.storeDir}/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11";
|
||||
in {
|
||||
storePath = isStorePath goodPath;
|
||||
storePathAppendix = isStorePath
|
||||
"${goodPath}/bin/python";
|
||||
nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath)));
|
||||
asPath = isStorePath (builtins.toPath goodPath);
|
||||
otherPath = isStorePath "/something/else";
|
||||
otherVals = {
|
||||
attrset = isStorePath {};
|
||||
list = isStorePath [];
|
||||
int = isStorePath 42;
|
||||
};
|
||||
};
|
||||
expected = {
|
||||
storePath = true;
|
||||
storePathAppendix = false;
|
||||
nonAbsolute = false;
|
||||
asPath = true;
|
||||
otherPath = false;
|
||||
otherVals = {
|
||||
attrset = false;
|
||||
list = false;
|
||||
int = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# LISTS
|
||||
|
||||
testFilter = {
|
||||
expr = filter (x: x != "a") ["a" "b" "c" "a"];
|
||||
expected = ["b" "c"];
|
||||
};
|
||||
|
||||
testFold =
|
||||
let
|
||||
f = op: fold: fold op 0 (range 0 100);
|
||||
# fold with associative operator
|
||||
assoc = f builtins.add;
|
||||
# fold with non-associative operator
|
||||
nonAssoc = f builtins.sub;
|
||||
in {
|
||||
expr = {
|
||||
assocRight = assoc foldr;
|
||||
# right fold with assoc operator is same as left fold
|
||||
assocRightIsLeft = assoc foldr == assoc foldl;
|
||||
nonAssocRight = nonAssoc foldr;
|
||||
nonAssocLeft = nonAssoc foldl;
|
||||
# with non-assoc operator the fold results are not the same
|
||||
nonAssocRightIsNotLeft = nonAssoc foldl != nonAssoc foldr;
|
||||
# fold is an alias for foldr
|
||||
foldIsRight = nonAssoc fold == nonAssoc foldr;
|
||||
};
|
||||
expected = {
|
||||
assocRight = 5050;
|
||||
assocRightIsLeft = true;
|
||||
nonAssocRight = 50;
|
||||
nonAssocLeft = (-5050);
|
||||
nonAssocRightIsNotLeft = true;
|
||||
foldIsRight = true;
|
||||
};
|
||||
};
|
||||
|
||||
testTake = testAllTrue [
|
||||
([] == (take 0 [ 1 2 3 ]))
|
||||
([1] == (take 1 [ 1 2 3 ]))
|
||||
([ 1 2 ] == (take 2 [ 1 2 3 ]))
|
||||
([ 1 2 3 ] == (take 3 [ 1 2 3 ]))
|
||||
([ 1 2 3 ] == (take 4 [ 1 2 3 ]))
|
||||
];
|
||||
|
||||
testFoldAttrs = {
|
||||
expr = foldAttrs (n: a: [n] ++ a) [] [
|
||||
{ a = 2; b = 7; }
|
||||
{ a = 3; c = 8; }
|
||||
];
|
||||
expected = { a = [ 2 3 ]; b = [7]; c = [8];};
|
||||
};
|
||||
|
||||
testSort = {
|
||||
expr = sort builtins.lessThan [ 40 2 30 42 ];
|
||||
expected = [2 30 40 42];
|
||||
};
|
||||
|
||||
testToIntShouldConvertStringToInt = {
|
||||
expr = toInt "27";
|
||||
expected = 27;
|
||||
};
|
||||
|
||||
testToIntShouldThrowErrorIfItCouldNotConvertToInt = {
|
||||
expr = builtins.tryEval (toInt "\"foo\"");
|
||||
expected = { success = false; value = false; };
|
||||
};
|
||||
|
||||
testHasAttrByPathTrue = {
|
||||
expr = hasAttrByPath ["a" "b"] { a = { b = "yey"; }; };
|
||||
expected = true;
|
||||
};
|
||||
|
||||
testHasAttrByPathFalse = {
|
||||
expr = hasAttrByPath ["a" "b"] { a = { c = "yey"; }; };
|
||||
expected = false;
|
||||
};
|
||||
|
||||
|
||||
# GENERATORS
|
||||
# these tests assume attributes are converted to lists
|
||||
# in alphabetical order
|
||||
|
||||
testMkKeyValueDefault = {
|
||||
expr = generators.mkKeyValueDefault ":" "f:oo" "bar";
|
||||
expected = ''f\:oo:bar'';
|
||||
};
|
||||
|
||||
testToKeyValue = {
|
||||
expr = generators.toKeyValue {} {
|
||||
key = "value";
|
||||
"other=key" = "baz";
|
||||
};
|
||||
expected = ''
|
||||
key=value
|
||||
other\=key=baz
|
||||
'';
|
||||
};
|
||||
|
||||
testToINIEmpty = {
|
||||
expr = generators.toINI {} {};
|
||||
expected = "";
|
||||
};
|
||||
|
||||
testToINIEmptySection = {
|
||||
expr = generators.toINI {} { foo = {}; bar = {}; };
|
||||
expected = ''
|
||||
[bar]
|
||||
|
||||
[foo]
|
||||
'';
|
||||
};
|
||||
|
||||
testToINIDefaultEscapes = {
|
||||
expr = generators.toINI {} {
|
||||
"no [ and ] allowed unescaped" = {
|
||||
"and also no = in keys" = 42;
|
||||
};
|
||||
};
|
||||
expected = ''
|
||||
[no \[ and \] allowed unescaped]
|
||||
and also no \= in keys=42
|
||||
'';
|
||||
};
|
||||
|
||||
testToINIDefaultFull = {
|
||||
expr = generators.toINI {} {
|
||||
"section 1" = {
|
||||
attribute1 = 5;
|
||||
x = "Me-se JarJar Binx";
|
||||
};
|
||||
"foo[]" = {
|
||||
"he\\h=he" = "this is okay";
|
||||
};
|
||||
};
|
||||
expected = ''
|
||||
[foo\[\]]
|
||||
he\h\=he=this is okay
|
||||
|
||||
[section 1]
|
||||
attribute1=5
|
||||
x=Me-se JarJar Binx
|
||||
'';
|
||||
};
|
||||
|
||||
/* right now only invocation check */
|
||||
testToJSONSimple =
|
||||
let val = {
|
||||
foobar = [ "baz" 1 2 3 ];
|
||||
};
|
||||
in {
|
||||
expr = generators.toJSON {} val;
|
||||
# trivial implementation
|
||||
expected = builtins.toJSON val;
|
||||
};
|
||||
|
||||
/* right now only invocation check */
|
||||
testToYAMLSimple =
|
||||
let val = {
|
||||
list = [ { one = 1; } { two = 2; } ];
|
||||
all = 42;
|
||||
};
|
||||
in {
|
||||
expr = generators.toYAML {} val;
|
||||
# trivial implementation
|
||||
expected = builtins.toJSON val;
|
||||
};
|
||||
|
||||
testToPretty = {
|
||||
expr = mapAttrs (const (generators.toPretty {})) rec {
|
||||
int = 42;
|
||||
bool = true;
|
||||
string = "fnord";
|
||||
null_ = null;
|
||||
function = x: x;
|
||||
functionArgs = { arg ? 4, foo }: arg;
|
||||
list = [ 3 4 function [ false ] ];
|
||||
attrs = { foo = null; "foo bar" = "baz"; };
|
||||
drv = derivation { name = "test"; system = builtins.currentSystem; };
|
||||
};
|
||||
expected = rec {
|
||||
int = "42";
|
||||
bool = "true";
|
||||
string = "\"fnord\"";
|
||||
null_ = "null";
|
||||
function = "<λ>";
|
||||
functionArgs = "<λ:{(arg),foo}>";
|
||||
list = "[ 3 4 ${function} [ false ] ]";
|
||||
attrs = "{ \"foo\" = null; \"foo bar\" = \"baz\"; }";
|
||||
drv = "<δ>";
|
||||
};
|
||||
};
|
||||
|
||||
testToPrettyAllowPrettyValues = {
|
||||
expr = generators.toPretty { allowPrettyValues = true; }
|
||||
{ __pretty = v: "«" + v + "»"; val = "foo"; };
|
||||
expected = "«foo»";
|
||||
};
|
||||
|
||||
|
||||
# MISC
|
||||
|
||||
testOverridableDelayableArgsTest = {
|
||||
expr =
|
||||
let res1 = defaultOverridableDelayableArgs id {};
|
||||
res2 = defaultOverridableDelayableArgs id { a = 7; };
|
||||
res3 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||
in (x.merge) { b = 10; };
|
||||
res4 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||
in (x.merge) ( x: { b = 10; });
|
||||
res5 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||
in (x.merge) ( x: { a = builtins.add x.a 3; });
|
||||
res6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = builtins.add; }; };
|
||||
y = x.merge {};
|
||||
in (y.merge) { a = 10; };
|
||||
|
||||
resRem7 = res6.replace (a: removeAttrs a ["a"]);
|
||||
|
||||
resReplace6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = builtins.add; }; };
|
||||
x2 = x.merge { a = 20; }; # now we have 27
|
||||
in (x2.replace) { a = 10; }; # and override the value by 10
|
||||
|
||||
# fixed tests (delayed args): (when using them add some comments, please)
|
||||
resFixed1 =
|
||||
let x = defaultOverridableDelayableArgs id ( x: { a = 7; c = x.fixed.b; });
|
||||
y = x.merge (x: { name = "name-${builtins.toString x.fixed.c}"; });
|
||||
in (y.merge) { b = 10; };
|
||||
strip = attrs: removeAttrs attrs ["merge" "replace"];
|
||||
in all id
|
||||
[ ((strip res1) == { })
|
||||
((strip res2) == { a = 7; })
|
||||
((strip res3) == { a = 7; b = 10; })
|
||||
((strip res4) == { a = 7; b = 10; })
|
||||
((strip res5) == { a = 10; })
|
||||
((strip res6) == { a = 17; })
|
||||
((strip resRem7) == {})
|
||||
((strip resFixed1) == { a = 7; b = 10; c =10; name = "name-10"; })
|
||||
];
|
||||
expected = true;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -99,14 +99,6 @@ checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-if-foo-enabl
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-if-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-enable-if.nix
|
||||
|
||||
# Check disabledModules with config definitions and option declarations.
|
||||
set -- config.enable ./define-enable.nix ./declare-enable.nix
|
||||
checkConfigOutput "true" "$@"
|
||||
checkConfigOutput "false" "$@" ./disable-define-enable.nix
|
||||
checkConfigError "The option .*enable.* defined in .* does not exist" "$@" ./disable-declare-enable.nix
|
||||
checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-define-enable.nix ./disable-declare-enable.nix
|
||||
checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-enable-modules.nix
|
||||
|
||||
# Check _module.args.
|
||||
set -- config.enable ./declare-enable.nix ./define-enable-with-custom-arg.nix
|
||||
checkConfigError 'while evaluating the module argument .*custom.* in .*define-enable-with-custom-arg.nix.*:' "$@"
|
||||
@@ -123,11 +115,6 @@ set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-loaOfSub-
|
||||
checkConfigError 'The option .* defined in .* does not exist.' "$@"
|
||||
checkConfigOutput "true" "$@" ./define-module-check.nix
|
||||
|
||||
# Check coerced value.
|
||||
checkConfigOutput "\"42\"" config.value ./declare-coerced-value.nix
|
||||
checkConfigOutput "\"24\"" config.value ./declare-coerced-value.nix ./define-value-string.nix
|
||||
checkConfigError 'The option value .* in .* is not a string or integer.' config.value ./declare-coerced-value.nix ./define-value-list.nix
|
||||
|
||||
cat <<EOF
|
||||
====== module tests ======
|
||||
$pass Pass
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options = {
|
||||
value = lib.mkOption {
|
||||
default = 42;
|
||||
type = lib.types.coercedTo lib.types.int builtins.toString lib.types.str;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
{ lib ? import ../.., modules ? [] }:
|
||||
{ lib ? import <nixpkgs/lib>, modules ? [] }:
|
||||
|
||||
{
|
||||
inherit (lib.evalModules {
|
||||
inherit modules;
|
||||
specialArgs.modulesPath = ./.;
|
||||
}) config options;
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
value = [];
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
value = "24";
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ ./declare-enable.nix ];
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ ./define-enable.nix ];
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ "define-enable.nix" "declare-enable.nix" ];
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
{ pkgs ? import ((import ../.).cleanSource ../..) {} }:
|
||||
{ nixpkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
with import ../.. { };
|
||||
with lib;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "nixpkgs-lib-tests";
|
||||
buildInputs = [ pkgs.nix ];
|
||||
NIX_PATH="nixpkgs=${pkgs.path}";
|
||||
buildInputs = [ nix ];
|
||||
NIX_PATH="nixpkgs=${nixpkgs}";
|
||||
|
||||
buildCommand = ''
|
||||
datadir="${pkgs.nix}/share"
|
||||
datadir="${nix}/share"
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
@@ -20,13 +23,9 @@ pkgs.stdenv.mkDerivation {
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
nix-store --init
|
||||
|
||||
cd ${pkgs.path}/lib/tests
|
||||
cd ${nixpkgs}/lib/tests
|
||||
./modules.sh
|
||||
|
||||
[[ "$(nix-instantiate --eval --strict misc.nix)" == "[ ]" ]]
|
||||
|
||||
[[ "$(nix-instantiate --eval --strict systems.nix)" == "[ ]" ]]
|
||||
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# We assert that the new algorithmic way of generating these lists matches the
|
||||
# way they were hard-coded before.
|
||||
#
|
||||
# One might think "if we exhaustively test, what's the point of procedurally
|
||||
# calculating the lists anyway?". The answer is one can mindlessly update these
|
||||
# tests as new platforms become supported, and then just give the diff a quick
|
||||
# sanity check before committing :).
|
||||
let
|
||||
lib = import ../default.nix;
|
||||
mseteq = x: y: {
|
||||
expr = lib.sort lib.lessThan x;
|
||||
expected = lib.sort lib.lessThan y;
|
||||
};
|
||||
in with lib.systems.doubles; lib.runTests {
|
||||
all = assertTrue (mseteq all (linux ++ darwin ++ cygwin ++ freebsd ++ openbsd ++ netbsd ++ illumos));
|
||||
|
||||
arm = assertTrue (mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv7l-linux" ]);
|
||||
i686 = assertTrue (mseteq i686 [ "i686-linux" "i686-freebsd" "i686-netbsd" "i686-openbsd" "i686-cygwin" ]);
|
||||
mips = assertTrue (mseteq mips [ "mips64el-linux" ]);
|
||||
x86_64 = assertTrue (mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" ]);
|
||||
|
||||
cygwin = assertTrue (mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]);
|
||||
darwin = assertTrue (mseteq darwin [ "x86_64-darwin" ]);
|
||||
freebsd = assertTrue (mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]);
|
||||
gnu = assertTrue (mseteq gnu (linux /* ++ hurd ++ kfreebsd ++ ... */));
|
||||
illumos = assertTrue (mseteq illumos [ "x86_64-solaris" ]);
|
||||
linux = assertTrue (mseteq linux [ "i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mips64el-linux" ]);
|
||||
netbsd = assertTrue (mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]);
|
||||
openbsd = assertTrue (mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]);
|
||||
unix = assertTrue (mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos));
|
||||
}
|
||||
105
lib/trivial.nix
105
lib/trivial.nix
@@ -1,54 +1,61 @@
|
||||
rec {
|
||||
|
||||
/* The identity function
|
||||
For when you need a function that does “nothing”.
|
||||
|
||||
Type: id :: a -> a
|
||||
*/
|
||||
# Identity function.
|
||||
id = x: x;
|
||||
|
||||
/* The constant function
|
||||
Ignores the second argument.
|
||||
Or: Construct a function that always returns a static value.
|
||||
|
||||
Type: const :: a -> b -> a
|
||||
Example:
|
||||
let f = const 5; in f 10
|
||||
=> 5
|
||||
*/
|
||||
# Constant function.
|
||||
const = x: y: x;
|
||||
|
||||
|
||||
## Named versions corresponding to some builtin operators.
|
||||
|
||||
/* Concat two strings */
|
||||
# Named versions corresponding to some builtin operators.
|
||||
concat = x: y: x ++ y;
|
||||
|
||||
/* boolean “or” */
|
||||
or = x: y: x || y;
|
||||
|
||||
/* boolean “and” */
|
||||
and = x: y: x && y;
|
||||
|
||||
/* Convert a boolean to a string.
|
||||
Note that toString on a bool returns "1" and "".
|
||||
*/
|
||||
boolToString = b: if b then "true" else "false";
|
||||
|
||||
/* Merge two attribute sets shallowly, right side trumps left
|
||||
|
||||
Example:
|
||||
mergeAttrs { a = 1; b = 2; } { b = 3; c = 4; }
|
||||
=> { a = 1; b = 3; c = 4; }
|
||||
*/
|
||||
mergeAttrs = x: y: x // y;
|
||||
|
||||
# Compute the fixed point of the given function `f`, which is usually an
|
||||
# attribute set that expects its final, non-recursive representation as an
|
||||
# argument:
|
||||
#
|
||||
# f = self: { foo = "foo"; bar = "bar"; foobar = self.foo + self.bar; }
|
||||
#
|
||||
# Nix evaluates this recursion until all references to `self` have been
|
||||
# resolved. At that point, the final result is returned and `f x = x` holds:
|
||||
#
|
||||
# nix-repl> fix f
|
||||
# { bar = "bar"; foo = "foo"; foobar = "foobar"; }
|
||||
#
|
||||
# See https://en.wikipedia.org/wiki/Fixed-point_combinator for further
|
||||
# details.
|
||||
fix = f: let x = f x; in x;
|
||||
|
||||
# A variant of `fix` that records the original recursive attribute set in the
|
||||
# result. This is useful in combination with the `extends` function to
|
||||
# implement deep overriding. See pkgs/development/haskell-modules/default.nix
|
||||
# for a concrete example.
|
||||
fix' = f: let x = f x // { __unfix__ = f; }; in x;
|
||||
|
||||
# Modify the contents of an explicitly recursive attribute set in a way that
|
||||
# honors `self`-references. This is accomplished with a function
|
||||
#
|
||||
# g = self: super: { foo = super.foo + " + "; }
|
||||
#
|
||||
# that has access to the unmodified input (`super`) as well as the final
|
||||
# non-recursive representation of the attribute set (`self`). `extends`
|
||||
# differs from the native `//` operator insofar as that it's applied *before*
|
||||
# references to `self` are resolved:
|
||||
#
|
||||
# nix-repl> fix (extends g f)
|
||||
# { bar = "bar"; foo = "foo + "; foobar = "foo + bar"; }
|
||||
#
|
||||
# The name of the function is inspired by object-oriented inheritance, i.e.
|
||||
# think of it as an infix operator `g extends f` that mimics the syntax from
|
||||
# Java. It may seem counter-intuitive to have the "base class" as the second
|
||||
# argument, but it's nice this way if several uses of `extends` are cascaded.
|
||||
extends = f: rattrs: self: let super = rattrs self; in super // f self super;
|
||||
|
||||
# Flip the order of the arguments of a binary function.
|
||||
flip = f: a: b: f b a;
|
||||
|
||||
# Apply function if argument is non-null
|
||||
mapNullable = f: a: if isNull a then a else f a;
|
||||
|
||||
# Pull in some builtins not included elsewhere.
|
||||
inherit (builtins)
|
||||
pathExists readFile isBool isFunction
|
||||
@@ -70,17 +77,25 @@ rec {
|
||||
min = x: y: if x < y then x else y;
|
||||
max = x: y: if x > y then x else y;
|
||||
|
||||
/* Integer modulus
|
||||
/* Reads a JSON file. It is useful to import pure data into other nix
|
||||
expressions.
|
||||
|
||||
Example:
|
||||
mod 11 10
|
||||
=> 1
|
||||
mod 1 10
|
||||
=> 1
|
||||
*/
|
||||
mod = base: int: base - (int * (builtins.div base int));
|
||||
|
||||
/* Reads a JSON file. */
|
||||
mkDerivation {
|
||||
src = fetchgit (importJSON ./repo.json)
|
||||
#...
|
||||
}
|
||||
|
||||
where repo.json contains:
|
||||
|
||||
{
|
||||
"url": "git://some-domain/some/repo",
|
||||
"rev": "265de7283488964f44f0257a8b4a055ad8af984d",
|
||||
"sha256": "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h"
|
||||
}
|
||||
|
||||
*/
|
||||
importJSON = path:
|
||||
builtins.fromJSON (builtins.readFile path);
|
||||
|
||||
|
||||
193
lib/types.nix
193
lib/types.nix
@@ -6,7 +6,7 @@ with import ./attrsets.nix;
|
||||
with import ./options.nix;
|
||||
with import ./trivial.nix;
|
||||
with import ./strings.nix;
|
||||
let inherit (import ./modules.nix) mergeDefinitions filterOverrides; in
|
||||
with {inherit (import ./modules.nix) mergeDefinitions filterOverrides; };
|
||||
|
||||
rec {
|
||||
|
||||
@@ -17,43 +17,10 @@ rec {
|
||||
};
|
||||
|
||||
|
||||
# Default type merging function
|
||||
# takes two type functors and return the merged type
|
||||
defaultTypeMerge = f: f':
|
||||
let wrapped = f.wrapped.typeMerge f'.wrapped.functor;
|
||||
payload = f.binOp f.payload f'.payload;
|
||||
in
|
||||
# cannot merge different types
|
||||
if f.name != f'.name
|
||||
then null
|
||||
# simple types
|
||||
else if (f.wrapped == null && f'.wrapped == null)
|
||||
&& (f.payload == null && f'.payload == null)
|
||||
then f.type
|
||||
# composed types
|
||||
else if (f.wrapped != null && f'.wrapped != null) && (wrapped != null)
|
||||
then f.type wrapped
|
||||
# value types
|
||||
else if (f.payload != null && f'.payload != null) && (payload != null)
|
||||
then f.type payload
|
||||
else null;
|
||||
|
||||
# Default type functor
|
||||
defaultFunctor = name: {
|
||||
inherit name;
|
||||
type = types."${name}" or null;
|
||||
wrapped = null;
|
||||
payload = null;
|
||||
binOp = a: b: null;
|
||||
};
|
||||
|
||||
isOptionType = isType "option-type";
|
||||
mkOptionType =
|
||||
{ # Human-readable representation of the type, should be equivalent to
|
||||
# the type function name.
|
||||
{ # Human-readable representation of the type.
|
||||
name
|
||||
, # Description of the type, defined recursively by embedding the wrapped type if any.
|
||||
description ? null
|
||||
, # Function applied to each definition that should return true if
|
||||
# its type-correct, false otherwise.
|
||||
check ? (x: true)
|
||||
@@ -69,31 +36,15 @@ rec {
|
||||
getSubOptions ? prefix: {}
|
||||
, # List of modules if any, or null if none.
|
||||
getSubModules ? null
|
||||
, # Function for building the same option type with a different list of
|
||||
, # Function for building the same option type with a different list of
|
||||
# modules.
|
||||
substSubModules ? m: null
|
||||
, # Function that merge type declarations.
|
||||
# internal, takes a functor as argument and returns the merged type.
|
||||
# returning null means the type is not mergeable
|
||||
typeMerge ? defaultTypeMerge functor
|
||||
, # The type functor.
|
||||
# internal, representation of the type as an attribute set.
|
||||
# name: name of the type
|
||||
# type: type function.
|
||||
# wrapped: the type wrapped in case of compound types.
|
||||
# payload: values of the type, two payloads of the same type must be
|
||||
# combinable with the binOp binary operation.
|
||||
# binOp: binary operation that merge two payloads of the same type.
|
||||
functor ? defaultFunctor name
|
||||
}:
|
||||
{ _type = "option-type";
|
||||
inherit name check merge getSubOptions getSubModules substSubModules typeMerge functor;
|
||||
description = if description == null then name else description;
|
||||
inherit name check merge getSubOptions getSubModules substSubModules;
|
||||
};
|
||||
|
||||
|
||||
# When adding new types don't forget to document them in
|
||||
# nixos/doc/manual/development/option-types.xml!
|
||||
types = rec {
|
||||
|
||||
unspecified = mkOptionType {
|
||||
@@ -101,39 +52,29 @@ rec {
|
||||
};
|
||||
|
||||
bool = mkOptionType {
|
||||
name = "bool";
|
||||
description = "boolean";
|
||||
name = "boolean";
|
||||
check = isBool;
|
||||
merge = mergeEqualOption;
|
||||
};
|
||||
|
||||
int = mkOptionType rec {
|
||||
name = "int";
|
||||
description = "integer";
|
||||
int = mkOptionType {
|
||||
name = "integer";
|
||||
check = isInt;
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
str = mkOptionType {
|
||||
name = "str";
|
||||
description = "string";
|
||||
name = "string";
|
||||
check = isString;
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
# Merge multiple definitions by concatenating them (with the given
|
||||
# separator between the values).
|
||||
separatedString = sep: mkOptionType rec {
|
||||
name = "separatedString";
|
||||
description = "string";
|
||||
separatedString = sep: mkOptionType {
|
||||
name = "string";
|
||||
check = isString;
|
||||
merge = loc: defs: concatStringsSep sep (getValues defs);
|
||||
functor = (defaultFunctor name) // {
|
||||
payload = sep;
|
||||
binOp = sepLhs: sepRhs:
|
||||
if sepLhs == sepRhs then sepLhs
|
||||
else null;
|
||||
};
|
||||
};
|
||||
|
||||
lines = separatedString "\n";
|
||||
@@ -145,8 +86,7 @@ rec {
|
||||
string = separatedString "";
|
||||
|
||||
attrs = mkOptionType {
|
||||
name = "attrs";
|
||||
description = "attribute set";
|
||||
name = "attribute set";
|
||||
check = isAttrs;
|
||||
merge = loc: foldl' (res: def: mergeAttrs res def.value) {};
|
||||
};
|
||||
@@ -174,14 +114,13 @@ rec {
|
||||
# drop this in the future:
|
||||
list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf;
|
||||
|
||||
listOf = elemType: mkOptionType rec {
|
||||
name = "listOf";
|
||||
description = "list of ${elemType.description}s";
|
||||
listOf = elemType: mkOptionType {
|
||||
name = "list of ${elemType.name}s";
|
||||
check = isList;
|
||||
merge = loc: defs:
|
||||
map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
|
||||
map (x: x.value) (filter (x: x ? value) (concatLists (imap (n: def:
|
||||
if isList def.value then
|
||||
imap1 (m: def':
|
||||
imap (m: def':
|
||||
(mergeDefinitions
|
||||
(loc ++ ["[definition ${toString n}-entry ${toString m}]"])
|
||||
elemType
|
||||
@@ -193,12 +132,10 @@ rec {
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: listOf (elemType.substSubModules m);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
attrsOf = elemType: mkOptionType rec {
|
||||
name = "attrsOf";
|
||||
description = "attribute set of ${elemType.description}s";
|
||||
attrsOf = elemType: mkOptionType {
|
||||
name = "attribute set of ${elemType.name}s";
|
||||
check = isAttrs;
|
||||
merge = loc: defs:
|
||||
mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
|
||||
@@ -210,7 +147,6 @@ rec {
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: attrsOf (elemType.substSubModules m);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# List or attribute set of ...
|
||||
@@ -220,7 +156,7 @@ rec {
|
||||
if isList def.value then
|
||||
{ inherit (def) file;
|
||||
value = listToAttrs (
|
||||
imap1 (elemIdx: elem:
|
||||
imap (elemIdx: elem:
|
||||
{ name = elem.name or "unnamed-${toString defIdx}.${toString elemIdx}";
|
||||
value = elem;
|
||||
}) def.value);
|
||||
@@ -229,21 +165,18 @@ rec {
|
||||
def;
|
||||
listOnly = listOf elemType;
|
||||
attrOnly = attrsOf elemType;
|
||||
in mkOptionType rec {
|
||||
name = "loaOf";
|
||||
description = "list or attribute set of ${elemType.description}s";
|
||||
in mkOptionType {
|
||||
name = "list or attribute set of ${elemType.name}s";
|
||||
check = x: isList x || isAttrs x;
|
||||
merge = loc: defs: attrOnly.merge loc (imap1 convertIfList defs);
|
||||
merge = loc: defs: attrOnly.merge loc (imap convertIfList defs);
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name?>"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: loaOf (elemType.substSubModules m);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# List or element of ...
|
||||
loeOf = elemType: mkOptionType rec {
|
||||
name = "loeOf";
|
||||
description = "element or list of ${elemType.description}s";
|
||||
loeOf = elemType: mkOptionType {
|
||||
name = "element or list of ${elemType.name}s";
|
||||
check = x: isList x || elemType.check x;
|
||||
merge = loc: defs:
|
||||
let
|
||||
@@ -256,24 +189,18 @@ rec {
|
||||
else if !isString res then
|
||||
throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}."
|
||||
else res;
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# Value of given type but with no merging (i.e. `uniq list`s are not concatenated).
|
||||
uniq = elemType: mkOptionType rec {
|
||||
name = "uniq";
|
||||
inherit (elemType) description check;
|
||||
uniq = elemType: mkOptionType {
|
||||
inherit (elemType) name check;
|
||||
merge = mergeOneOption;
|
||||
getSubOptions = elemType.getSubOptions;
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: uniq (elemType.substSubModules m);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# Null or value of ...
|
||||
nullOr = elemType: mkOptionType rec {
|
||||
name = "nullOr";
|
||||
description = "null or ${elemType.description}";
|
||||
nullOr = elemType: mkOptionType {
|
||||
name = "null or ${elemType.name}";
|
||||
check = x: x == null || elemType.check x;
|
||||
merge = loc: defs:
|
||||
let nrNulls = count (def: def.value == null) defs; in
|
||||
@@ -284,10 +211,8 @@ rec {
|
||||
getSubOptions = elemType.getSubOptions;
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: nullOr (elemType.substSubModules m);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# A submodule (like typed attribute set). See NixOS manual.
|
||||
submodule = opts:
|
||||
let
|
||||
opts' = toList opts;
|
||||
@@ -311,15 +236,8 @@ rec {
|
||||
args = { name = ""; }; }).options;
|
||||
getSubModules = opts';
|
||||
substSubModules = m: submodule m;
|
||||
functor = (defaultFunctor name) // {
|
||||
# Merging of submodules is done as part of mergeOptionDecls, as we have to annotate
|
||||
# each submodule with its location.
|
||||
payload = [];
|
||||
binOp = lhs: rhs: [];
|
||||
};
|
||||
};
|
||||
|
||||
# A value from a set of allowed ones.
|
||||
enum = values:
|
||||
let
|
||||
show = v:
|
||||
@@ -327,68 +245,23 @@ rec {
|
||||
else if builtins.isInt v then builtins.toString v
|
||||
else ''<${builtins.typeOf v}>'';
|
||||
in
|
||||
mkOptionType rec {
|
||||
name = "enum";
|
||||
description = "one of ${concatMapStringsSep ", " show values}";
|
||||
mkOptionType {
|
||||
name = "one of ${concatMapStringsSep ", " show values}";
|
||||
check = flip elem values;
|
||||
merge = mergeOneOption;
|
||||
functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
|
||||
};
|
||||
|
||||
# Either value of type `t1` or `t2`.
|
||||
either = t1: t2: mkOptionType rec {
|
||||
name = "either";
|
||||
description = "${t1.description} or ${t2.description}";
|
||||
either = t1: t2: mkOptionType {
|
||||
name = "${t1.name} or ${t2.name}";
|
||||
check = x: t1.check x || t2.check x;
|
||||
merge = loc: defs:
|
||||
let
|
||||
defList = map (d: d.value) defs;
|
||||
in
|
||||
if all (x: t1.check x) defList
|
||||
then t1.merge loc defs
|
||||
else if all (x: t2.check x) defList
|
||||
then t2.merge loc defs
|
||||
else mergeOneOption loc defs;
|
||||
typeMerge = f':
|
||||
let mt1 = t1.typeMerge (elemAt f'.wrapped 0).functor;
|
||||
mt2 = t2.typeMerge (elemAt f'.wrapped 1).functor;
|
||||
in
|
||||
if (name == f'.name) && (mt1 != null) && (mt2 != null)
|
||||
then functor.type mt1 mt2
|
||||
else null;
|
||||
functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
# Either value of type `finalType` or `coercedType`, the latter is
|
||||
# converted to `finalType` using `coerceFunc`.
|
||||
coercedTo = coercedType: coerceFunc: finalType:
|
||||
assert coercedType.getSubModules == null;
|
||||
mkOptionType rec {
|
||||
name = "coercedTo";
|
||||
description = "${finalType.description} or ${coercedType.description}";
|
||||
check = x: finalType.check x || coercedType.check x;
|
||||
merge = loc: defs:
|
||||
let
|
||||
coerceVal = val:
|
||||
if finalType.check val then val
|
||||
else let
|
||||
coerced = coerceFunc val;
|
||||
in assert finalType.check coerced; coerced;
|
||||
|
||||
in finalType.merge loc (map (def: def // { value = coerceVal def.value; }) defs);
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = t1: t2: null;
|
||||
functor = (defaultFunctor name) // { wrapped = finalType; };
|
||||
};
|
||||
|
||||
# Obsolete alternative to configOf. It takes its option
|
||||
# declarations from the ‘options’ attribute of containing option
|
||||
# declaration.
|
||||
optionSet = mkOptionType {
|
||||
name = builtins.trace "types.optionSet is deprecated; use types.submodule instead" "optionSet";
|
||||
description = "option set";
|
||||
name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set";
|
||||
};
|
||||
|
||||
# Augment the given type with an additional type check function.
|
||||
|
||||
14
maintainers/docker/.dockerignore
Normal file
14
maintainers/docker/.dockerignore
Normal file
@@ -0,0 +1,14 @@
|
||||
*~
|
||||
,*
|
||||
.*.swp
|
||||
.*.swo
|
||||
result
|
||||
result-*
|
||||
/doc/NEWS.html
|
||||
/doc/NEWS.txt
|
||||
/doc/manual.html
|
||||
/doc/manual.pdf
|
||||
.version-suffix
|
||||
|
||||
.DS_Store
|
||||
.git
|
||||
12
maintainers/docker/Dockerfile
Normal file
12
maintainers/docker/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM busybox
|
||||
|
||||
RUN dir=`mktemp -d` && trap 'rm -rf "$dir"' EXIT && \
|
||||
wget -O- https://nixos.org/releases/nix/nix-1.7/nix-1.7-x86_64-linux.tar.bz2 | bzcat | tar x -C $dir && \
|
||||
mkdir -m 0755 /nix && USER=root sh $dir/*/install && \
|
||||
echo ". /root/.nix-profile/etc/profile.d/nix.sh" >> /etc/profile
|
||||
|
||||
ADD . /root/nix/nixpkgs
|
||||
ONBUILD ENV NIX_PATH nixpkgs=/root/nix/nixpkgs:nixos=/root/nix/nixpkgs/nixos
|
||||
ONBUILD ENV PATH /root/.nix-profile/bin:/root/.nix-profile/sbin:/bin:/sbin:/usr/bin:/usr/sbin
|
||||
ONBUILD ENV ENV /etc/profile
|
||||
ENV ENV /etc/profile
|
||||
@@ -14,5 +14,5 @@ removeAttrs (import ../../pkgs/top-level/release.nix
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
})
|
||||
[ # Remove jobs whose evaluation depends on a writable Nix store.
|
||||
"tarball" "unstable" "darwin-tested"
|
||||
"tarball" "unstable"
|
||||
]
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p coreutils findutils gnused nix wget
|
||||
|
||||
set -efuo pipefail
|
||||
|
||||
SRCS=
|
||||
if [ -d "$1" ]; then
|
||||
SRCS="$(pwd)/$1/srcs.nix"
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
set -o pipefail
|
||||
|
||||
GNOME_FTP=ftp.gnome.org/pub/GNOME/sources
|
||||
GNOME_FTP="ftp.gnome.org/pub/GNOME/sources"
|
||||
|
||||
# projects that don't follow the GNOME major versioning, or that we don't want to
|
||||
# programmatically update
|
||||
NO_GNOME_MAJOR="ghex gtkhtml gdm"
|
||||
NO_GNOME_MAJOR="gtkhtml gdm"
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 gnome_dir <show project>|<update project>|<update-all> [major.minor]" >&2
|
||||
@@ -18,10 +18,10 @@ if [ "$#" -lt 2 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
GNOME_TOP=$1
|
||||
GNOME_TOP="$1"
|
||||
shift
|
||||
|
||||
action=$1
|
||||
action="$1"
|
||||
|
||||
# curl -l ftp://... doesn't work from my office in HSE, and I don't want to have
|
||||
# any conversations with sysadmin. Somehow lftp works.
|
||||
@@ -36,18 +36,18 @@ else
|
||||
fi
|
||||
|
||||
find_project() {
|
||||
exec find "$GNOME_TOP" -mindepth 2 -maxdepth 2 -type d "$@"
|
||||
exec find "$GNOME_TOP" -mindepth 2 -maxdepth 2 -type d $@
|
||||
}
|
||||
|
||||
show_project() {
|
||||
local project=$1
|
||||
local majorVersion=$2
|
||||
local version=
|
||||
local project="$1"
|
||||
local majorVersion="$2"
|
||||
local version=""
|
||||
|
||||
if [ -z "$majorVersion" ]; then
|
||||
echo "Looking for available versions..." >&2
|
||||
local available_baseversions=$(ls_ftp ftp://${GNOME_FTP}/${project} | grep '[0-9]\.[0-9]' | sort -t. -k1,1n -k 2,2n)
|
||||
if [ "$?" -ne 0 ]; then
|
||||
local available_baseversions=( `ls_ftp ftp://${GNOME_FTP}/${project} | grep '[0-9]\.[0-9]' | sort -t. -k1,1n -k 2,2n` )
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "Project $project not found" >&2
|
||||
return 1
|
||||
fi
|
||||
@@ -59,11 +59,11 @@ show_project() {
|
||||
|
||||
if echo "$majorVersion" | grep -q "[0-9]\+\.[0-9]\+\.[0-9]\+"; then
|
||||
# not a major version
|
||||
version=$majorVersion
|
||||
version="$majorVersion"
|
||||
majorVersion=$(echo "$majorVersion" | cut -d '.' -f 1,2)
|
||||
fi
|
||||
|
||||
local FTPDIR=${GNOME_FTP}/${project}/${majorVersion}
|
||||
local FTPDIR="${GNOME_FTP}/${project}/${majorVersion}"
|
||||
|
||||
#version=`curl -l ${FTPDIR}/ 2>/dev/null | grep LATEST-IS | sed -e s/LATEST-IS-//`
|
||||
# gnome's LATEST-IS is broken. Do not trust it.
|
||||
@@ -92,7 +92,7 @@ show_project() {
|
||||
esac
|
||||
done
|
||||
echo "Found versions ${!versions[@]}" >&2
|
||||
version=$(echo ${!versions[@]} | sed -e 's/ /\n/g' | sort -t. -k1,1n -k 2,2n -k 3,3n | tail -n1)
|
||||
version=`echo ${!versions[@]} | sed -e 's/ /\n/g' | sort -t. -k1,1n -k 2,2n -k 3,3n | tail -n1`
|
||||
if [ -z "$version" ]; then
|
||||
echo "No version available for major $majorVersion" >&2
|
||||
return 1
|
||||
@@ -103,7 +103,7 @@ show_project() {
|
||||
|
||||
local name=${project}-${version}
|
||||
echo "Fetching .sha256 file" >&2
|
||||
local sha256out=$(curl -s -f http://"${FTPDIR}"/"${name}".sha256sum)
|
||||
local sha256out=$(curl -s -f http://${FTPDIR}/${name}.sha256sum)
|
||||
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "Version not found" >&2
|
||||
@@ -136,8 +136,8 @@ fetchurl: {
|
||||
}
|
||||
|
||||
update_project() {
|
||||
local project=$1
|
||||
local majorVersion=$2
|
||||
local project="$1"
|
||||
local majorVersion="$2"
|
||||
|
||||
# find project in nixpkgs tree
|
||||
projectPath=$(find_project -name "$project" -print)
|
||||
@@ -150,14 +150,14 @@ update_project() {
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "Updating $projectPath/src.nix" >&2
|
||||
echo -e "$src" > "$projectPath"/src.nix
|
||||
echo -e "$src" > "$projectPath/src.nix"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "$action" = "update-all" ]; then
|
||||
majorVersion=$2
|
||||
if [ "$action" == "update-all" ]; then
|
||||
majorVersion="$2"
|
||||
if [ -z "$majorVersion" ]; then
|
||||
echo "No major version specified" >&2
|
||||
usage
|
||||
@@ -170,23 +170,23 @@ if [ "$action" = "update-all" ]; then
|
||||
echo "Skipping $project"
|
||||
else
|
||||
echo "= Updating $project to $majorVersion" >&2
|
||||
update_project "$project" "$majorVersion"
|
||||
update_project $project $majorVersion
|
||||
echo >&2
|
||||
fi
|
||||
done
|
||||
else
|
||||
project=$2
|
||||
majorVersion=$3
|
||||
project="$2"
|
||||
majorVersion="$3"
|
||||
|
||||
if [ -z "$project" ]; then
|
||||
echo "No project specified, exiting" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "$action" = show ]; then
|
||||
show_project "$project" "$majorVersion"
|
||||
elif [ "$action" = update ]; then
|
||||
update_project "$project" "$majorVersion"
|
||||
if [ "$action" == "show" ]; then
|
||||
show_project $project $majorVersion
|
||||
elif [ "$action" == "update" ]; then
|
||||
update_project $project $majorVersion
|
||||
else
|
||||
echo "Unknown action $action" >&2
|
||||
usage
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python -p pythonFull pythonPackages.requests pythonPackages.pyquery pythonPackages.click
|
||||
|
||||
# To use, just execute this script with --help to display help.
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
import sys
|
||||
|
||||
import click
|
||||
import requests
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
|
||||
maintainers_json = subprocess.check_output([
|
||||
'nix-instantiate',
|
||||
'lib/maintainers.nix',
|
||||
'--eval',
|
||||
'--json'])
|
||||
maintainers = json.loads(maintainers_json)
|
||||
MAINTAINERS = {v: k for k, v in maintainers.iteritems()}
|
||||
|
||||
|
||||
def get_response_text(url):
|
||||
return pq(requests.get(url).text) # IO
|
||||
|
||||
EVAL_FILE = {
|
||||
'nixos': 'nixos/release.nix',
|
||||
'nixpkgs': 'pkgs/top-level/release.nix',
|
||||
}
|
||||
|
||||
|
||||
def get_maintainers(attr_name):
|
||||
try:
|
||||
nixname = attr_name.split('.')
|
||||
meta_json = subprocess.check_output([
|
||||
'nix-instantiate',
|
||||
'--eval',
|
||||
'--strict',
|
||||
'-A',
|
||||
'.'.join(nixname[1:]) + '.meta',
|
||||
EVAL_FILE[nixname[0]],
|
||||
'--json'])
|
||||
meta = json.loads(meta_json)
|
||||
if meta.get('maintainers'):
|
||||
return [MAINTAINERS[name] for name in meta['maintainers'] if MAINTAINERS.get(name)]
|
||||
except:
|
||||
return []
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option(
|
||||
'--jobset',
|
||||
default="nixos/release-17.03",
|
||||
help='Hydra project like nixos/release-17.03')
|
||||
def cli(jobset):
|
||||
"""
|
||||
Given a Hydra project, inspect latest evaluation
|
||||
and print a summary of failed builds
|
||||
"""
|
||||
|
||||
url = "http://hydra.nixos.org/jobset/{}".format(jobset)
|
||||
|
||||
# get the last evaluation
|
||||
click.echo(click.style(
|
||||
'Getting latest evaluation for {}'.format(url), fg='green'))
|
||||
d = get_response_text(url)
|
||||
evaluations = d('#tabs-evaluations').find('a[class="row-link"]')
|
||||
latest_eval_url = evaluations[0].get('href')
|
||||
|
||||
# parse last evaluation page
|
||||
click.echo(click.style(
|
||||
'Parsing evaluation {}'.format(latest_eval_url), fg='green'))
|
||||
d = get_response_text(latest_eval_url + '?full=1')
|
||||
|
||||
# TODO: aborted evaluations
|
||||
# TODO: dependency failed without propagated builds
|
||||
for tr in d('img[alt="Failed"]').parents('tr'):
|
||||
a = pq(tr)('a')[1]
|
||||
print("- [ ] [{}]({})".format(a.text, a.get('href')))
|
||||
|
||||
sys.stdout.flush()
|
||||
|
||||
maintainers = get_maintainers(a.text)
|
||||
if maintainers:
|
||||
print(" - maintainers: {}".format(", ".join(map(lambda u: '@' + u, maintainers))))
|
||||
# TODO: print last three persons that touched this file
|
||||
# TODO: pinpoint the diff that broke this build, or maybe it's transient or maybe it never worked?
|
||||
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
cli()
|
||||
except:
|
||||
import pdb;pdb.post_mortem()
|
||||
@@ -1,277 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p coreutils gnugrep gnused
|
||||
|
||||
################################################################################
|
||||
# nix-diff.sh #
|
||||
################################################################################
|
||||
# This script "diffs" Nix profile generations. #
|
||||
# #
|
||||
# Example: #
|
||||
################################################################################
|
||||
# > nix-diff.sh 90 92 #
|
||||
# + gnumake-4.2.1 #
|
||||
# + gnumake-4.2.1-doc #
|
||||
# - htmldoc-1.8.29 #
|
||||
################################################################################
|
||||
# The example shows that as of generation 92 and since generation 90, #
|
||||
# gnumake-4.2.1 and gnumake-4.2.1-doc have been installed, while #
|
||||
# htmldoc-1.8.29 has been removed. #
|
||||
# #
|
||||
# The example above shows the default, minimal output mode of this script. #
|
||||
# For more features, run `nix-diff.sh -h` for usage instructions. #
|
||||
################################################################################
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
usage: nix-diff.sh [-h | [-p profile | -s] [-q] [-l] [range]]
|
||||
-h: print this message before exiting
|
||||
-q: list the derivations installed in the parent generation
|
||||
-l: diff every available intermediate generation between parent and
|
||||
child
|
||||
-p profile: specify the Nix profile to use
|
||||
* defaults to ~/.nix-profile
|
||||
-s: use the system profile
|
||||
* equivalent to: -p /nix/var/nix/profiles/system
|
||||
profile: * should be something like /nix/var/nix/profiles/default, not a
|
||||
generation link like /nix/var/nix/profiles/default-2-link
|
||||
range: the range of generations to diff
|
||||
* the following patterns are allowed, where A, B, and N are positive
|
||||
integers, and G is the currently active generation:
|
||||
A..B => diffs from generation A to generation B
|
||||
~N => diffs from the Nth newest generation (older than G) to G
|
||||
A => diffs from generation A to G
|
||||
* defaults to ~1
|
||||
EOF
|
||||
}
|
||||
|
||||
usage_tip() {
|
||||
echo 'run `nix-diff.sh -h` for usage instructions' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts :hqlp:s opt; do
|
||||
case $opt in
|
||||
h)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
q)
|
||||
opt_query=1
|
||||
;;
|
||||
l)
|
||||
opt_log=1
|
||||
;;
|
||||
p)
|
||||
opt_profile=$OPTARG
|
||||
;;
|
||||
s)
|
||||
opt_profile=/nix/var/nix/profiles/system
|
||||
;;
|
||||
\?)
|
||||
echo "error: invalid option -$OPTARG" >&2
|
||||
usage_tip
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ -n "$opt_profile" ]; then
|
||||
if ! [ -L "$opt_profile" ]; then
|
||||
echo "error: expecting \`$opt_profile\` to be a symbolic link" >&2
|
||||
usage_tip
|
||||
fi
|
||||
else
|
||||
opt_profile=$(readlink ~/.nix-profile)
|
||||
if (( $? != 0 )); then
|
||||
echo 'error: unable to dereference `~/.nix-profile`' >&2
|
||||
echo 'specify the profile manually with the `-p` flag' >&2
|
||||
usage_tip
|
||||
fi
|
||||
fi
|
||||
|
||||
list_gens() {
|
||||
nix-env -p "$opt_profile" --list-generations \
|
||||
| sed -r 's:^\s*::' \
|
||||
| cut -d' ' -f1
|
||||
}
|
||||
|
||||
current_gen() {
|
||||
nix-env -p "$opt_profile" --list-generations \
|
||||
| grep -E '\(current\)\s*$' \
|
||||
| sed -r 's:^\s*::' \
|
||||
| cut -d' ' -f1
|
||||
}
|
||||
|
||||
neg_gen() {
|
||||
local i=0 from=$1 n=$2 tmp
|
||||
for gen in $(list_gens | sort -rn); do
|
||||
if ((gen < from)); then
|
||||
tmp=$gen
|
||||
((i++))
|
||||
((i == n)) && break
|
||||
fi
|
||||
done
|
||||
if ((i < n)); then
|
||||
echo -n "error: there aren't $n generation(s) older than" >&2
|
||||
echo " generation $from" >&2
|
||||
return 1
|
||||
fi
|
||||
echo $tmp
|
||||
}
|
||||
|
||||
match() {
|
||||
argv=("$@")
|
||||
for i in $(seq $(($#-1))); do
|
||||
if grep -E "^${argv[$i]}\$" <(echo "$1") >/dev/null; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo 0
|
||||
}
|
||||
|
||||
case $(match "$1" '' '[0-9]+' '[0-9]+\.\.[0-9]+' '~[0-9]+') in
|
||||
1)
|
||||
diffTo=$(current_gen)
|
||||
diffFrom=$(neg_gen $diffTo 1)
|
||||
(($? == 1)) && usage_tip
|
||||
;;
|
||||
2)
|
||||
diffFrom=$1
|
||||
diffTo=$(current_gen)
|
||||
;;
|
||||
3)
|
||||
diffFrom=${1%%.*}
|
||||
diffTo=${1##*.}
|
||||
;;
|
||||
4)
|
||||
diffTo=$(current_gen)
|
||||
diffFrom=$(neg_gen $diffTo ${1#*~})
|
||||
(($? == 1)) && usage_tip
|
||||
;;
|
||||
0)
|
||||
echo 'error: invalid invocation' >&2
|
||||
usage_tip
|
||||
;;
|
||||
esac
|
||||
|
||||
dirA="${opt_profile}-${diffFrom}-link"
|
||||
dirB="${opt_profile}-${diffTo}-link"
|
||||
|
||||
declare -a temp_files
|
||||
temp_length() {
|
||||
echo -n ${#temp_files[@]}
|
||||
}
|
||||
temp_make() {
|
||||
temp_files[$(temp_length)]=$(mktemp)
|
||||
}
|
||||
temp_clean() {
|
||||
rm -f ${temp_files[@]}
|
||||
}
|
||||
temp_name() {
|
||||
echo -n "${temp_files[$(($(temp_length)-1))]}"
|
||||
}
|
||||
trap 'temp_clean' EXIT
|
||||
|
||||
temp_make
|
||||
versA=$(temp_name)
|
||||
refs=$(nix-store -q --references "$dirA")
|
||||
(( $? != 0 )) && exit 1
|
||||
echo "$refs" \
|
||||
| grep -v env-manifest.nix \
|
||||
| sort \
|
||||
> "$versA"
|
||||
|
||||
print_tag() {
|
||||
local gen=$1
|
||||
nix-env -p "$opt_profile" --list-generations \
|
||||
| grep -E "^\s*${gen}" \
|
||||
| sed -r 's:^\s*::' \
|
||||
| sed -r 's:\s*$::'
|
||||
}
|
||||
|
||||
if [ -n "$opt_query" ]; then
|
||||
print_tag $diffFrom
|
||||
cat "$versA" \
|
||||
| sed -r 's:^[^-]+-(.*)$: \1:'
|
||||
|
||||
print_line=1
|
||||
fi
|
||||
|
||||
if [ -n "$opt_log" ]; then
|
||||
gens=$(for gen in $(list_gens); do
|
||||
((diffFrom < gen && gen < diffTo)) && echo $gen
|
||||
done)
|
||||
# Force the $diffTo generation to be included in this list, instead of using
|
||||
# `gen <= diffTo` in the preceding loop, so we encounter an error upon the
|
||||
# event of its nonexistence.
|
||||
gens=$(echo "$gens"
|
||||
echo $diffTo)
|
||||
else
|
||||
gens=$diffTo
|
||||
fi
|
||||
|
||||
temp_make
|
||||
add=$(temp_name)
|
||||
temp_make
|
||||
rem=$(temp_name)
|
||||
temp_make
|
||||
out=$(temp_name)
|
||||
|
||||
for gen in $gens; do
|
||||
|
||||
[ -n "$print_line" ] && echo
|
||||
|
||||
temp_make
|
||||
versB=$(temp_name)
|
||||
|
||||
dirB="${opt_profile}-${gen}-link"
|
||||
refs=$(nix-store -q --references "$dirB")
|
||||
(( $? != 0 )) && exit 1
|
||||
echo "$refs" \
|
||||
| grep -v env-manifest.nix \
|
||||
| sort \
|
||||
> "$versB"
|
||||
|
||||
in=$(comm -3 -1 "$versA" "$versB")
|
||||
sed -r 's:^[^-]*-(.*)$:\1+:' <(echo "$in") \
|
||||
| sort -f \
|
||||
> "$add"
|
||||
|
||||
un=$(comm -3 -2 "$versA" "$versB")
|
||||
sed -r 's:^[^-]*-(.*)$:\1-:' <(echo "$un") \
|
||||
| sort -f \
|
||||
> "$rem"
|
||||
|
||||
cat "$rem" "$add" \
|
||||
| sort -f \
|
||||
| sed -r 's:(.*)-$:- \1:' \
|
||||
| sed -r 's:(.*)\+$:\+ \1:' \
|
||||
| grep -v '^$' \
|
||||
> "$out"
|
||||
|
||||
if [ -n "$opt_query" -o -n "$opt_log" ]; then
|
||||
|
||||
lines=$(wc -l "$out" | cut -d' ' -f1)
|
||||
tag=$(print_tag "$gen")
|
||||
(( $? != 0 )) && exit 1
|
||||
if [ $lines -eq 0 ]; then
|
||||
echo "$tag (no change)"
|
||||
else
|
||||
echo "$tag"
|
||||
fi
|
||||
cat "$out" \
|
||||
| sed 's:^: :'
|
||||
|
||||
print_line=1
|
||||
|
||||
else
|
||||
echo "diffing from generation $diffFrom to $diffTo"
|
||||
cat "$out"
|
||||
fi
|
||||
|
||||
versA=$versB
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -1,115 +1,260 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$#" != 1 ] && [ "$#" != 2 ]; then
|
||||
cat <<-EOF
|
||||
Usage: $0 commit-spec [commit-spec]
|
||||
You need to be in a git-controlled nixpkgs tree.
|
||||
The current state of the tree will be used if the second commit is missing.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
usage () {
|
||||
echo 1>&2 "
|
||||
usage:
|
||||
$0
|
||||
[--git commit..commit | --git commit]
|
||||
[--svn rev:rev | --svn rev]
|
||||
[--path path[:path]*]
|
||||
[--help]
|
||||
|
||||
# A slightly hacky way to get the config.
|
||||
parallel="$(echo 'config.rebuild-amount.parallel or false' | nix-repl . 2>/dev/null \
|
||||
| grep -v '^\(nix-repl.*\)\?$' | tail -n 1 || true)"
|
||||
This program is used to investigate how any changes inside your nixpkgs
|
||||
repository may hurt. With these kind of information you may choose wisely
|
||||
where you should commit your changes.
|
||||
|
||||
echo "Estimating rebuild amount by counting changed Hydra jobs."
|
||||
This program adapts it-self to your versionning system to avoid too much
|
||||
effort on your Internet bandwidth. If you need to check more than one
|
||||
commits / revisions, you may use the following commands:
|
||||
|
||||
toRemove=()
|
||||
--git remotes/trunk..master
|
||||
--svn 17670:17677
|
||||
|
||||
cleanup() {
|
||||
rm -rf "${toRemove[@]}"
|
||||
}
|
||||
trap cleanup EXIT SIGINT SIGQUIT ERR
|
||||
Check the differences between each commit separating the first and the
|
||||
last commit.
|
||||
|
||||
MKTEMP='mktemp --tmpdir nix-rebuild-amount-XXXXXXXX'
|
||||
--path /etc/nixos/nixpkgs:/tmp/nixpkgs_1:/tmp/nixpkgs_2
|
||||
|
||||
nixexpr() {
|
||||
cat <<-EONIX
|
||||
let
|
||||
lib = import $1/lib;
|
||||
hydraJobs = import $1/pkgs/top-level/release.nix
|
||||
# Compromise: accuracy vs. resources needed for evaluation.
|
||||
{ supportedSystems = cfg.systems or [ "x86_64-linux" "x86_64-darwin" ]; };
|
||||
cfg = (import $1 {}).config.rebuild-amount or {};
|
||||
Check the differences between multiple directories containing different
|
||||
versions of nixpkgs.
|
||||
|
||||
recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
|
||||
All these options exist with one commit / revision argument. Such options
|
||||
are used to compare your \$NIXPKGS path with the specified version.
|
||||
|
||||
# hydraJobs leaves recurseForDerivations as empty attrmaps;
|
||||
# that would break nix-env and we also need to recurse everywhere.
|
||||
tweak = lib.mapAttrs
|
||||
(name: val:
|
||||
if name == "recurseForDerivations" then true
|
||||
else if lib.isAttrs val && val.type or null != "derivation"
|
||||
then recurseIntoAttrs (tweak val)
|
||||
else val
|
||||
);
|
||||
If you omit to mention any other commit / revision, then your \$NIXPKGS path
|
||||
is compared with its last update. This command is useful to test code from
|
||||
a dirty repository.
|
||||
|
||||
# Some of these contain explicit references to platform(s) we want to avoid;
|
||||
# some even (transitively) depend on ~/.nixpkgs/config.nix (!)
|
||||
blacklist = [
|
||||
"tarball" "metrics" "manual"
|
||||
"darwin-tested" "unstable" "stdenvBootstrapTools"
|
||||
"moduleSystem" "lib-tests" # these just confuse the output
|
||||
];
|
||||
|
||||
in
|
||||
tweak (builtins.removeAttrs hydraJobs blacklist)
|
||||
EONIX
|
||||
"
|
||||
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Output packages in tree $2 that weren't in $1.
|
||||
# Changing the output hash or name is taken as a change.
|
||||
# Extra nix-env parameters can be in $3
|
||||
newPkgs() {
|
||||
# We use files instead of pipes, as running multiple nix-env processes
|
||||
# could eat too much memory for a standard 4GiB machine.
|
||||
local -a list
|
||||
for i in 1 2; do
|
||||
local l="$($MKTEMP)"
|
||||
list[$i]="$l"
|
||||
toRemove+=("$l")
|
||||
#####################
|
||||
# Process Arguments #
|
||||
#####################
|
||||
|
||||
local expr="$($MKTEMP)"
|
||||
toRemove+=("$expr")
|
||||
nixexpr "${!i}" > "$expr"
|
||||
: ${NIXPKGS=/etc/nixos/nixpkgs/}
|
||||
|
||||
nix-env -f "$expr" -qaP --no-name --out-path --show-trace $3 \
|
||||
| sort > "${list[$i]}" &
|
||||
vcs=""
|
||||
gitCommits=""
|
||||
svnRevisions=""
|
||||
pathLocations=""
|
||||
verbose=false
|
||||
|
||||
if [ "$parallel" != "true" ]; then
|
||||
wait
|
||||
fi
|
||||
done
|
||||
|
||||
wait
|
||||
comm -13 "${list[@]}"
|
||||
}
|
||||
|
||||
# Prepare nixpkgs trees.
|
||||
declare -a tree
|
||||
for i in 1 2; do
|
||||
if [ -n "${!i}" ]; then # use the given commit
|
||||
dir="$($MKTEMP -d)"
|
||||
tree[$i]="$dir"
|
||||
toRemove+=("$dir")
|
||||
|
||||
git clone --shared --no-checkout --quiet . "${tree[$i]}"
|
||||
(cd "${tree[$i]}" && git checkout --quiet "${!i}")
|
||||
else #use the current tree
|
||||
tree[$i]="$(pwd)"
|
||||
fi
|
||||
argfun=""
|
||||
for arg; do
|
||||
if test -z "$argfun"; then
|
||||
case $arg in
|
||||
--git) vcs="git"; argfun="set_gitCommits";;
|
||||
--svn) vcs="svn"; argfun="set_svnRevisions";;
|
||||
--path) vcs="path"; argfun="set_pathLocations";;
|
||||
--verbose) verbose=true;;
|
||||
--help) usage;;
|
||||
*) usage;;
|
||||
esac
|
||||
else
|
||||
case $argfun in
|
||||
set_*)
|
||||
var=$(echo $argfun | sed 's,^set_,,')
|
||||
eval $var=$arg
|
||||
;;
|
||||
esac
|
||||
argfun=""
|
||||
fi
|
||||
done
|
||||
|
||||
newlist="$($MKTEMP)"
|
||||
toRemove+=("$newlist")
|
||||
# Notes:
|
||||
# - the evaluation is done on x86_64-linux, like on Hydra.
|
||||
# - using $newlist file so that newPkgs() isn't in a sub-shell (because of toRemove)
|
||||
newPkgs "${tree[1]}" "${tree[2]}" '--argstr system "x86_64-linux"' > "$newlist"
|
||||
if $verbose; then
|
||||
set -x
|
||||
else
|
||||
set +x
|
||||
fi
|
||||
|
||||
# Hacky: keep only the last word of each attribute path and sort.
|
||||
sed -n 's/\([^. ]*\.\)*\([^. ]*\) .*$/\2/p' < "$newlist" \
|
||||
| sort | uniq -c
|
||||
############################
|
||||
# Find the repository type #
|
||||
############################
|
||||
|
||||
if test -z "$vcs"; then
|
||||
if test -x "$NIXPKGS/.git"; then
|
||||
if git --git-dir="$NIXPKGS/.git" branch > /dev/null 2>&1; then
|
||||
vcs="git"
|
||||
gitCommits=$(git --git-dir="$NIXPKGS/.git" log -n 1 --pretty=format:%H 2> /dev/null)
|
||||
fi
|
||||
elif test -x "$NIXPKGS/.svn"; then
|
||||
cd "$NIXPKGS"
|
||||
if svn info > /dev/null 2>&1; then
|
||||
vcs="svn";
|
||||
svnRevisions=$(svn info | sed -n 's,Revision: ,,p')
|
||||
fi
|
||||
cd -
|
||||
else
|
||||
usage
|
||||
fi
|
||||
fi
|
||||
|
||||
###############################
|
||||
# Define a storage directory. #
|
||||
###############################
|
||||
|
||||
pkgListDir=""
|
||||
exitCode=1
|
||||
cleanup(){
|
||||
test -e "$pkgListDir" && rm -rf "$pkgListDir"
|
||||
exit $exitCode;
|
||||
}
|
||||
|
||||
trap cleanup EXIT SIGINT SIGQUIT ERR
|
||||
|
||||
pkgListDir=$(mktemp --tmpdir -d rebuild-amount-XXXXXXXX)
|
||||
vcsDir="$pkgListDir/.vcs"
|
||||
|
||||
###########################
|
||||
# Versionning for Dummies #
|
||||
###########################
|
||||
|
||||
path_init() {
|
||||
if test "${pathLocations#*:}" = "$pathLocations"; then
|
||||
pathLocations="$NIXPKGS:$pathLocations"
|
||||
fi
|
||||
pathLocations="${pathLocations}:"
|
||||
}
|
||||
|
||||
path_getNext() {
|
||||
pathLoc="${pathLocations%%:*}"
|
||||
pathLocations="${pathLocations#*:}"
|
||||
}
|
||||
|
||||
path_setPath() {
|
||||
path="$pathLoc"
|
||||
}
|
||||
|
||||
path_setName() {
|
||||
name=$(echo "$pathLoc" | tr '/' '_')
|
||||
}
|
||||
|
||||
################
|
||||
# Git Commands #
|
||||
################
|
||||
|
||||
git_init() {
|
||||
git clone "$NIXPKGS/.git" "$vcsDir" > /dev/null 2>&1
|
||||
if echo "gitCommits" | grep -c "\.\." > /dev/null 2>&1; then
|
||||
gitCommits=$(git --git-dir="$vcsDir/.git" log --reverse --pretty=format:%H $gitCommits 2> /dev/null)
|
||||
else
|
||||
pathLocations="$vcsDir:$NIXPKGS"
|
||||
vcs="path"
|
||||
path_init
|
||||
fi
|
||||
}
|
||||
|
||||
git_getNext() {
|
||||
git --git-dir="$vcsDir/.git" checkout $(echo "$gitCommits" | head -n 1) > /dev/null 2>&1
|
||||
gitCommits=$(echo "$gitCommits" | sed '1 d')
|
||||
}
|
||||
|
||||
git_setPath() {
|
||||
path="$vcsDir"
|
||||
}
|
||||
|
||||
git_setName() {
|
||||
name=$(git --git-dir="$vcsDir/.git" log -n 1 --pretty=format:%H 2> /dev/null)
|
||||
}
|
||||
|
||||
#######################
|
||||
# Subversion Commands #
|
||||
#######################
|
||||
|
||||
svn_init() {
|
||||
cp -r "$NIXPKGS" "$vcsDir" > /dev/null 2>&1
|
||||
if echo "svnRevisions" | grep -c ":" > /dev/null 2>&1; then
|
||||
svnRevisions=$(seq ${svnRevisions%:*} ${svnRevisions#*:})
|
||||
else
|
||||
pathLocations="$vcsDir:$NIXPKGS"
|
||||
vcs="path"
|
||||
path_init
|
||||
fi
|
||||
}
|
||||
|
||||
svn_getNext() {
|
||||
cd "$vcsDir"
|
||||
svn checkout $(echo "$svnRevisions" | head -n 1) > /dev/null 2>&1
|
||||
cd -
|
||||
svnRevisions=$(echo "$svnRevisions" | sed '1 d')
|
||||
}
|
||||
|
||||
svn_setPath() {
|
||||
path="$vcsDir"
|
||||
}
|
||||
|
||||
svn_setName() {
|
||||
name=$(svn info 2> /dev/null | sed -n 's,Revision: ,,p')
|
||||
}
|
||||
|
||||
####################
|
||||
# Logical Commands #
|
||||
####################
|
||||
|
||||
init () { ${vcs}_init; }
|
||||
getNext () { ${vcs}_getNext; }
|
||||
setPath () { ${vcs}_setPath; }
|
||||
setName () { ${vcs}_setName; }
|
||||
|
||||
|
||||
#####################
|
||||
# Check for Rebuild #
|
||||
#####################
|
||||
|
||||
# Generate the list of all derivations that could be build from a nixpkgs
|
||||
# respository. This list of derivation hashes is compared with previous
|
||||
# lists and a brief summary is produced on the output.
|
||||
|
||||
compareNames () {
|
||||
nb=$(diff -y --suppress-common-lines --speed-large-files "$pkgListDir/$1.drvs" "$pkgListDir/$2.drvs" 2> /dev/null | wc -l)
|
||||
echo "$1 -> $2: $nb"
|
||||
}
|
||||
|
||||
echo "Please wait, this may take some minutes ..."
|
||||
|
||||
init
|
||||
first=""
|
||||
oldPrev=""
|
||||
|
||||
prev=""
|
||||
curr=""
|
||||
|
||||
while true; do
|
||||
getNext
|
||||
setPath # set path=...
|
||||
setName # set name=...
|
||||
curr="$name"
|
||||
|
||||
test -z "$curr" && break || true
|
||||
|
||||
nix-instantiate "$path" > "$pkgListDir/$curr.drvs" > /dev/null 2>&1 || true
|
||||
|
||||
if test -n "$prev"; then
|
||||
compareNames "$prev" "$curr"
|
||||
else
|
||||
echo "Number of package to rebuild:"
|
||||
first="$curr"
|
||||
fi
|
||||
oldPrev="$prev"
|
||||
prev="$curr"
|
||||
done
|
||||
|
||||
if test "$first" != "$oldPrev"; then
|
||||
echo "Number of package to rebuild (first -> last):"
|
||||
compareNames "$first" "$curr"
|
||||
fi
|
||||
|
||||
exitCode=0
|
||||
|
||||
@@ -38,12 +38,6 @@ while test -n "$1"; do
|
||||
nix-build $TRAVIS_BUILD_DIR/pkgs/top-level/release.nix --attr tarball --show-trace
|
||||
;;
|
||||
|
||||
nixpkgs-unstable)
|
||||
echo "=== Checking nixpkgs unstable job"
|
||||
|
||||
nix-instantiate $TRAVIS_BUILD_DIR/pkgs/top-level/release.nix --attr unstable --show-trace
|
||||
;;
|
||||
|
||||
nixpkgs-lint)
|
||||
echo "=== Checking nixpkgs lint"
|
||||
|
||||
@@ -53,8 +47,8 @@ while test -n "$1"; do
|
||||
nox)
|
||||
echo "=== Fetching Nox from binary cache"
|
||||
|
||||
# build nox (+ a basic nix-shell env) silently so it's not in the log
|
||||
nix-shell -p nox stdenv --command true
|
||||
# build nox silently so it's not in the log
|
||||
nix-build "<nixpkgs>" -A nox -A stdenv
|
||||
;;
|
||||
|
||||
pr)
|
||||
|
||||
@@ -1,243 +0,0 @@
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i python3 -p 'python3.withPackages(ps: with ps; [ requests toolz ])'
|
||||
|
||||
"""
|
||||
Update a Python package expression by passing in the `.nix` file, or the directory containing it.
|
||||
You can pass in multiple files or paths.
|
||||
|
||||
You'll likely want to use
|
||||
``
|
||||
$ ./update-python-libraries ../../pkgs/development/python-modules/*
|
||||
``
|
||||
to update all libraries in that folder.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
import toolz
|
||||
|
||||
INDEX = "https://pypi.io/pypi"
|
||||
"""url of PyPI"""
|
||||
|
||||
EXTENSIONS = ['tar.gz', 'tar.bz2', 'tar', 'zip', '.whl']
|
||||
"""Permitted file extensions. These are evaluated from left to right and the first occurance is returned."""
|
||||
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
def _get_values(attribute, text):
|
||||
"""Match attribute in text and return all matches.
|
||||
|
||||
:returns: List of matches.
|
||||
"""
|
||||
regex = '{}\s+=\s+"(.*)";'.format(attribute)
|
||||
regex = re.compile(regex)
|
||||
values = regex.findall(text)
|
||||
return values
|
||||
|
||||
def _get_unique_value(attribute, text):
|
||||
"""Match attribute in text and return unique match.
|
||||
|
||||
:returns: Single match.
|
||||
"""
|
||||
values = _get_values(attribute, text)
|
||||
n = len(values)
|
||||
if n > 1:
|
||||
raise ValueError("found too many values for {}".format(attribute))
|
||||
elif n == 1:
|
||||
return values[0]
|
||||
else:
|
||||
raise ValueError("no value found for {}".format(attribute))
|
||||
|
||||
def _get_line_and_value(attribute, text):
|
||||
"""Match attribute in text. Return the line and the value of the attribute."""
|
||||
regex = '({}\s+=\s+"(.*)";)'.format(attribute)
|
||||
regex = re.compile(regex)
|
||||
value = regex.findall(text)
|
||||
n = len(value)
|
||||
if n > 1:
|
||||
raise ValueError("found too many values for {}".format(attribute))
|
||||
elif n == 1:
|
||||
return value[0]
|
||||
else:
|
||||
raise ValueError("no value found for {}".format(attribute))
|
||||
|
||||
|
||||
def _replace_value(attribute, value, text):
|
||||
"""Search and replace value of attribute in text."""
|
||||
old_line, old_value = _get_line_and_value(attribute, text)
|
||||
new_line = old_line.replace(old_value, value)
|
||||
new_text = text.replace(old_line, new_line)
|
||||
return new_text
|
||||
|
||||
def _fetch_page(url):
|
||||
r = requests.get(url)
|
||||
if r.status_code == requests.codes.ok:
|
||||
return r.json()
|
||||
else:
|
||||
raise ValueError("request for {} failed".format(url))
|
||||
|
||||
def _get_latest_version_pypi(package, extension):
|
||||
"""Get latest version and hash from PyPI."""
|
||||
url = "{}/{}/json".format(INDEX, package)
|
||||
json = _fetch_page(url)
|
||||
|
||||
version = json['info']['version']
|
||||
for release in json['releases'][version]:
|
||||
if release['filename'].endswith(extension):
|
||||
# TODO: In case of wheel we need to do further checks!
|
||||
sha256 = release['digests']['sha256']
|
||||
break
|
||||
else:
|
||||
sha256 = None
|
||||
return version, sha256
|
||||
|
||||
|
||||
def _get_latest_version_github(package, extension):
|
||||
raise ValueError("updating from GitHub is not yet supported.")
|
||||
|
||||
|
||||
FETCHERS = {
|
||||
'fetchFromGitHub' : _get_latest_version_github,
|
||||
'fetchPypi' : _get_latest_version_pypi,
|
||||
'fetchurl' : _get_latest_version_pypi,
|
||||
}
|
||||
|
||||
|
||||
DEFAULT_SETUPTOOLS_EXTENSION = 'tar.gz'
|
||||
|
||||
|
||||
FORMATS = {
|
||||
'setuptools' : DEFAULT_SETUPTOOLS_EXTENSION,
|
||||
'wheel' : 'whl'
|
||||
}
|
||||
|
||||
def _determine_fetcher(text):
|
||||
# Count occurences of fetchers.
|
||||
nfetchers = sum(text.count('src = {}'.format(fetcher)) for fetcher in FETCHERS.keys())
|
||||
if nfetchers == 0:
|
||||
raise ValueError("no fetcher.")
|
||||
elif nfetchers > 1:
|
||||
raise ValueError("multiple fetchers.")
|
||||
else:
|
||||
# Then we check which fetcher to use.
|
||||
for fetcher in FETCHERS.keys():
|
||||
if 'src = {}'.format(fetcher) in text:
|
||||
return fetcher
|
||||
|
||||
|
||||
def _determine_extension(text, fetcher):
|
||||
"""Determine what extension is used in the expression.
|
||||
|
||||
If we use:
|
||||
- fetchPypi, we check if format is specified.
|
||||
- fetchurl, we determine the extension from the url.
|
||||
- fetchFromGitHub we simply use `.tar.gz`.
|
||||
"""
|
||||
if fetcher == 'fetchPypi':
|
||||
try:
|
||||
format = _get_unique_value('format', text)
|
||||
except ValueError as e:
|
||||
format = None # format was not given
|
||||
|
||||
try:
|
||||
extension = _get_unique_value('extension', text)
|
||||
except ValueError as e:
|
||||
extension = None # extension was not given
|
||||
|
||||
if extension is None:
|
||||
if format is None:
|
||||
format = 'setuptools'
|
||||
extension = FORMATS[format]
|
||||
|
||||
elif fetcher == 'fetchurl':
|
||||
url = _get_unique_value('url', text)
|
||||
extension = os.path.splitext(url)[1]
|
||||
if 'pypi' not in url:
|
||||
raise ValueError('url does not point to PyPI.')
|
||||
|
||||
elif fetcher == 'fetchFromGitHub':
|
||||
raise ValueError('updating from GitHub is not yet implemented.')
|
||||
|
||||
return extension
|
||||
|
||||
|
||||
def _update_package(path):
|
||||
|
||||
|
||||
|
||||
# Read the expression
|
||||
with open(path, 'r') as f:
|
||||
text = f.read()
|
||||
|
||||
# Determine pname.
|
||||
pname = _get_unique_value('pname', text)
|
||||
|
||||
# Determine version.
|
||||
version = _get_unique_value('version', text)
|
||||
|
||||
# First we check how many fetchers are mentioned.
|
||||
fetcher = _determine_fetcher(text)
|
||||
|
||||
extension = _determine_extension(text, fetcher)
|
||||
|
||||
new_version, new_sha256 = _get_latest_version_pypi(pname, extension)
|
||||
|
||||
if new_version == version:
|
||||
logging.info("Path {}: no update available for {}.".format(path, pname))
|
||||
return False
|
||||
if not new_sha256:
|
||||
raise ValueError("no file available for {}.".format(pname))
|
||||
|
||||
text = _replace_value('version', new_version, text)
|
||||
text = _replace_value('sha256', new_sha256, text)
|
||||
|
||||
with open(path, 'w') as f:
|
||||
f.write(text)
|
||||
|
||||
logging.info("Path {}: updated {} from {} to {}".format(path, pname, version, new_version))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def _update(path):
|
||||
|
||||
# We need to read and modify a Nix expression.
|
||||
if os.path.isdir(path):
|
||||
path = os.path.join(path, 'default.nix')
|
||||
|
||||
# If a default.nix does not exist, we quit.
|
||||
if not os.path.isfile(path):
|
||||
logging.info("Path {}: does not exist.".format(path))
|
||||
return False
|
||||
|
||||
# If file is not a Nix expression, we quit.
|
||||
if not path.endswith(".nix"):
|
||||
logging.info("Path {}: does not end with `.nix`.".format(path))
|
||||
return False
|
||||
|
||||
try:
|
||||
return _update_package(path)
|
||||
except ValueError as e:
|
||||
logging.warning("Path {}: {}".format(path, e))
|
||||
return False
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('package', type=str, nargs='+')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
packages = map(os.path.abspath, args.package)
|
||||
|
||||
count = list(map(_update, packages))
|
||||
|
||||
logging.info("{} package(s) updated".format(sum(count)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,131 +0,0 @@
|
||||
{ package ? null
|
||||
, maintainer ? null
|
||||
}:
|
||||
|
||||
# TODO: add assert statements
|
||||
|
||||
let
|
||||
|
||||
pkgs = import ./../../default.nix { };
|
||||
|
||||
packagesWith = cond: return: set:
|
||||
pkgs.lib.flatten
|
||||
(pkgs.lib.mapAttrsToList
|
||||
(name: pkg:
|
||||
let
|
||||
result = builtins.tryEval (
|
||||
if pkgs.lib.isDerivation pkg && cond name pkg
|
||||
then [(return name pkg)]
|
||||
else if pkg.recurseForDerivations or false || pkg.recurseForRelease or false
|
||||
then packagesWith cond return pkg
|
||||
else []
|
||||
);
|
||||
in
|
||||
if result.success then result.value
|
||||
else []
|
||||
)
|
||||
set
|
||||
);
|
||||
|
||||
packagesWithUpdateScriptAndMaintainer = maintainer':
|
||||
let
|
||||
maintainer =
|
||||
if ! builtins.hasAttr maintainer' pkgs.lib.maintainers then
|
||||
builtins.throw "Maintainer with name `${maintainer'} does not exist in `lib/maintainers.nix`."
|
||||
else
|
||||
builtins.getAttr maintainer' pkgs.lib.maintainers;
|
||||
in
|
||||
packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg &&
|
||||
(if builtins.hasAttr "maintainers" pkg.meta
|
||||
then (if builtins.isList pkg.meta.maintainers
|
||||
then builtins.elem maintainer pkg.meta.maintainers
|
||||
else maintainer == pkg.meta.maintainers
|
||||
)
|
||||
else false
|
||||
)
|
||||
)
|
||||
(name: pkg: pkg)
|
||||
pkgs;
|
||||
|
||||
packageByName = name:
|
||||
let
|
||||
package = pkgs.lib.attrByPath (pkgs.lib.splitString "." name) null pkgs;
|
||||
in
|
||||
if package == null then
|
||||
builtins.throw "Package with an attribute name `${name}` does not exists."
|
||||
else if ! builtins.hasAttr "updateScript" package then
|
||||
builtins.throw "Package with an attribute name `${name}` does have an `passthru.updateScript` defined."
|
||||
else
|
||||
package;
|
||||
|
||||
packages =
|
||||
if package != null then
|
||||
[ (packageByName package) ]
|
||||
else if maintainer != null then
|
||||
packagesWithUpdateScriptAndMaintainer maintainer
|
||||
else
|
||||
builtins.throw "No arguments provided.\n\n${helpText}";
|
||||
|
||||
helpText = ''
|
||||
Please run:
|
||||
|
||||
% nix-shell maintainers/scripts/update.nix --argstr maintainer garbas
|
||||
|
||||
to run all update scripts for all packages that lists \`garbas\` as a maintainer
|
||||
and have \`updateScript\` defined, or:
|
||||
|
||||
% nix-shell maintainers/scripts/update.nix --argstr package garbas
|
||||
|
||||
to run update script for specific package.
|
||||
'';
|
||||
|
||||
runUpdateScript = package: ''
|
||||
echo -ne " - ${package.name}: UPDATING ..."\\r
|
||||
${package.updateScript} &> ${(builtins.parseDrvName package.name).name}.log
|
||||
CODE=$?
|
||||
if [ "$CODE" != "0" ]; then
|
||||
echo " - ${package.name}: ERROR "
|
||||
echo ""
|
||||
echo "--- SHOWING ERROR LOG FOR ${package.name} ----------------------"
|
||||
echo ""
|
||||
cat ${(builtins.parseDrvName package.name).name}.log
|
||||
echo ""
|
||||
echo "--- SHOWING ERROR LOG FOR ${package.name} ----------------------"
|
||||
exit $CODE
|
||||
else
|
||||
rm ${(builtins.parseDrvName package.name).name}.log
|
||||
fi
|
||||
echo " - ${package.name}: DONE. "
|
||||
'';
|
||||
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "nixpkgs-update-script";
|
||||
buildCommand = ''
|
||||
echo ""
|
||||
echo "----------------------------------------------------------------"
|
||||
echo ""
|
||||
echo "Not possible to update packages using \`nix-build\`"
|
||||
echo ""
|
||||
echo "${helpText}"
|
||||
echo "----------------------------------------------------------------"
|
||||
exit 1
|
||||
'';
|
||||
shellHook = ''
|
||||
echo ""
|
||||
echo "Going to be running update for following packages:"
|
||||
echo "${builtins.concatStringsSep "\n" (map (x: " - ${x.name}") packages)}"
|
||||
echo ""
|
||||
read -n1 -r -p "Press space to continue..." confirm
|
||||
if [ "$confirm" = "" ]; then
|
||||
echo ""
|
||||
echo "Running update for:"
|
||||
${builtins.concatStringsSep "\n" (map runUpdateScript packages)}
|
||||
echo ""
|
||||
echo "Packages updated!"
|
||||
exit 0
|
||||
else
|
||||
echo "Aborting!"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
}
|
||||
@@ -101,15 +101,15 @@ cleaner_script="$(echo "$name_list_canonical" | denormalize_name |
|
||||
|
||||
# Add github usernames
|
||||
if [ -n "$NIXPKGS_GITHUB_NAME_CACHE" ]; then
|
||||
github_adder_script="$(mktemp)"
|
||||
echo "$github_name_list" |
|
||||
github_adder_script="$(echo "$github_name_list" |
|
||||
grep -E "$(echo "$name_list_canonical" | cut -f 2 |
|
||||
tr '\n' '|' )" |
|
||||
sort | uniq |
|
||||
sed -re 's/(.*)\t(.*)/s| \1$| \1\t\2|g;/' |
|
||||
denormalize_name > "$github_adder_script"
|
||||
denormalize_name
|
||||
)"
|
||||
else
|
||||
github_adder_script='/dev/null'
|
||||
github_adder_script=''
|
||||
fi
|
||||
|
||||
echo "$name_list" | denormalize_name
|
||||
@@ -118,5 +118,5 @@ echo
|
||||
|
||||
echo "$git_data" | cut -f 1 |
|
||||
sed -e "$cleaner_script" |
|
||||
sort | uniq -c | sort -k1n | sed -rf "$github_adder_script" |
|
||||
sort | uniq -c | sort -k1n | sed -re "$github_adder_script" |
|
||||
sed -re 's/^ *([0-9]+) /\1\t/'
|
||||
|
||||
@@ -37,4 +37,7 @@ in
|
||||
vm = vmConfig.system.build.vm;
|
||||
|
||||
vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
|
||||
|
||||
# The following are used by nixos-rebuild.
|
||||
nixFallback = pkgs.nixUnstable.out;
|
||||
}
|
||||
|
||||
@@ -47,12 +47,4 @@ where <literal>eth0</literal> should be replaced with the desired
|
||||
external interface. Note that <literal>ve-+</literal> is a wildcard
|
||||
that matches all container interfaces.</para>
|
||||
|
||||
<para>If you are using Network Manager, you need to explicitly prevent
|
||||
it from managing container interfaces:
|
||||
|
||||
<programlisting>
|
||||
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -29,10 +29,8 @@ line. For instance, to create a container that has
|
||||
<literal>root</literal>:
|
||||
|
||||
<screen>
|
||||
# nixos-container create foo --config '
|
||||
services.openssh.enable = true;
|
||||
users.extraUsers.root.openssh.authorizedKeys.keys = ["ssh-dss AAAAB3N…"];
|
||||
'
|
||||
# nixos-container create foo --config 'services.openssh.enable = true; \
|
||||
users.extraUsers.root.openssh.authorizedKeys.keys = ["ssh-dss AAAAB3N…"];'
|
||||
</screen>
|
||||
|
||||
</para>
|
||||
@@ -57,7 +55,7 @@ Thus, if something went wrong, you can get status info using
|
||||
|
||||
</para>
|
||||
|
||||
<para>If the container has started successfully, you can log in as
|
||||
<para>If the container has started succesfully, you can log in as
|
||||
root using the <command>root-login</command> operation:
|
||||
|
||||
<screen>
|
||||
@@ -99,11 +97,8 @@ This will build and activate the new configuration. You can also
|
||||
specify a new configuration on the command line:
|
||||
|
||||
<screen>
|
||||
# nixos-container update foo --config '
|
||||
services.httpd.enable = true;
|
||||
services.httpd.adminAddr = "foo@example.org";
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
'
|
||||
# nixos-container update foo --config 'services.httpd.enable = true; \
|
||||
services.httpd.adminAddr = "foo@example.org";'
|
||||
|
||||
# curl http://$(nixos-container show-ip foo)/
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">…
|
||||
|
||||
@@ -21,7 +21,6 @@ effect after you run <command>nixos-rebuild</command>.</para>
|
||||
<xi:include href="user-mgmt.xml" />
|
||||
<xi:include href="file-systems.xml" />
|
||||
<xi:include href="x-windows.xml" />
|
||||
<xi:include href="xfce.xml" />
|
||||
<xi:include href="networking.xml" />
|
||||
<xi:include href="linux-kernel.xml" />
|
||||
|
||||
|
||||
@@ -42,30 +42,29 @@ construction, so without them,
|
||||
elements.)</para>
|
||||
|
||||
<para>Even greater customisation is possible using the function
|
||||
<varname>overrideAttrs</varname>. While the
|
||||
<varname>overrideDerivation</varname>. While the
|
||||
<varname>override</varname> mechanism above overrides the arguments of
|
||||
a package function, <varname>overrideAttrs</varname> allows
|
||||
changing the <emphasis>attributes</emphasis> passed to <literal>mkDerivation</literal>.
|
||||
This permits changing any aspect of the package, such as the source code.
|
||||
a package function, <varname>overrideDerivation</varname> allows
|
||||
changing the <emphasis>result</emphasis> of the function. This
|
||||
permits changing any aspect of the package, such as the source code.
|
||||
For instance, if you want to override the source code of Emacs, you
|
||||
can say:
|
||||
|
||||
<programlisting>
|
||||
environment.systemPackages = [
|
||||
(pkgs.emacs.overrideAttrs (oldAttrs: {
|
||||
name = "emacs-25.0-pre";
|
||||
src = /path/to/my/emacs/tree;
|
||||
}))
|
||||
];
|
||||
environment.systemPackages =
|
||||
[ (pkgs.lib.overrideDerivation pkgs.emacs (attrs: {
|
||||
name = "emacs-25.0-pre";
|
||||
src = /path/to/my/emacs/tree;
|
||||
}))
|
||||
];
|
||||
</programlisting>
|
||||
|
||||
Here, <varname>overrideAttrs</varname> takes the Nix derivation
|
||||
Here, <varname>overrideDerivation</varname> takes the Nix derivation
|
||||
specified by <varname>pkgs.emacs</varname> and produces a new
|
||||
derivation in which the original’s <literal>name</literal> and
|
||||
<literal>src</literal> attribute have been replaced by the given
|
||||
values by re-calling <literal>stdenv.mkDerivation</literal>.
|
||||
The original attributes are accessible via the function argument,
|
||||
which is conventionally named <varname>oldAttrs</varname>.</para>
|
||||
values. The original attributes are accessible via
|
||||
<varname>attrs</varname>.</para>
|
||||
|
||||
<para>The overrides shown above are not global. They do not affect
|
||||
the original package; other packages in Nixpkgs continue to depend on
|
||||
|
||||
@@ -35,12 +35,6 @@ or <literal>ext4</literal>, then it’s best to specify
|
||||
<option>fsType</option> to ensure that the kernel module is
|
||||
available.</para>
|
||||
|
||||
<note><para>System startup will fail if any of the filesystems fails to mount,
|
||||
dropping you to the emergency shell.
|
||||
You can make a mount asynchronous and non-critical by adding
|
||||
<literal>options = [ "nofail" ];</literal>.
|
||||
</para></note>
|
||||
|
||||
<xi:include href="luks-file-systems.xml" />
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -12,35 +12,8 @@ can disable IPv6 support globally by setting:
|
||||
|
||||
<programlisting>
|
||||
networking.enableIPv6 = false;
|
||||
</programlisting></para>
|
||||
|
||||
<para>You can disable IPv6 on a single interface using a normal sysctl (in this
|
||||
example, we use interface <varname>eth0</varname>):
|
||||
|
||||
<programlisting>
|
||||
boot.kernel.sysctl."net.ipv6.conf.eth0.disable_ipv6" = true;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>As with IPv4 networking interfaces are automatically configured via
|
||||
DHCPv6. You can configure an interface manually:
|
||||
|
||||
<programlisting>
|
||||
networking.interfaces.eth0.ip6 = [ { address = "fe00:aa:bb:cc::2"; prefixLength = 64; } ];
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>For configuring a gateway, optionally with explicitly specified interface:
|
||||
|
||||
<programlisting>
|
||||
networking.defaultGateway6 = {
|
||||
address = "fe00::1";
|
||||
interface = "enp0s3";
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>See <xref linkend='sec-ipv4' /> for similar examples and additional information.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -37,10 +37,6 @@ boot.initrd.luks.devices.crypted.device = "/dev/disk/by-uuid/3f6b0024-3a44-4fde-
|
||||
fileSystems."/".device = "/dev/mapper/crypted";
|
||||
</programlisting>
|
||||
|
||||
Should grub be used as bootloader, and <filename>/boot</filename> is located
|
||||
on an encrypted partition, it is necessary to add the following grub option:
|
||||
<programlisting>boot.loader.grub.enableCryptodisk = true;</programlisting>
|
||||
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -36,8 +36,9 @@ latter might look like this:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{ services.xserver.enable = true;
|
||||
services.xserver.displayManager.sddm.enable = true;
|
||||
services.xserver.desktopManager.plasma5.enable = true;
|
||||
services.xserver.displayManager.kdm.enable = true;
|
||||
services.xserver.desktopManager.kde4.enable = true;
|
||||
environment.systemPackages = [ pkgs.kde4.kscreensaver ];
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
@@ -128,7 +129,7 @@ default; run <literal>nix-env -i nix-repl</literal> to get it. A
|
||||
typical use:
|
||||
|
||||
<screen>
|
||||
$ nix-repl '<nixpkgs/nixos>'
|
||||
$ nix-repl '<nixos>'
|
||||
|
||||
nix-repl> config.networking.hostName
|
||||
"mandark"
|
||||
|
||||
@@ -16,26 +16,12 @@ networking.networkmanager.enable = true;
|
||||
some desktop managers (e.g., GNOME) enable NetworkManager
|
||||
automatically for you.</para>
|
||||
|
||||
<para>All users that should have permission to change network settings must
|
||||
belong to the <code>networkmanager</code> group:
|
||||
|
||||
<programlisting>
|
||||
users.extraUsers.youruser.extraGroups = [ "networkmanager" ];
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>NetworkManager is controlled using either <command>nmcli</command> or
|
||||
<command>nmtui</command> (curses-based terminal user interface). See their
|
||||
manual pages for details on their usage. Some desktop environments (GNOME, KDE)
|
||||
have their own configuration tools for NetworkManager. On XFCE, there is no
|
||||
configuration tool for NetworkManager by default: by adding
|
||||
<code>networkmanagerapplet</code> to the list of system packages, the graphical
|
||||
applet will be installed and will launch automatically when XFCE is starting
|
||||
(and will show in the status tray).</para>
|
||||
<para>All users that should have permission to change network settings
|
||||
must belong to the <code>networkmanager</code> group.</para>
|
||||
|
||||
<note><para><code>networking.networkmanager</code> and
|
||||
<code>networking.wireless</code> (WPA Supplicant) cannot be enabled at the same
|
||||
time: you can still connect to the wireless networks using
|
||||
<code>networking.wireless</code> can not be enabled at the same time:
|
||||
you can still connect to the wireless networks using
|
||||
NetworkManager.</para></note>
|
||||
|
||||
</section>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user