Merge remote-tracking branch 'upstream/master' into gcc-6
This commit is contained in:
commit
da9adb8fab
16
.github/CONTRIBUTING.md
vendored
16
.github/CONTRIBUTING.md
vendored
@ -14,14 +14,22 @@ under the terms of [COPYING](../COPYING), which is an MIT-like license.
|
||||
|
||||
* Format the commits in the following way:
|
||||
|
||||
`(pkg-name | service-name): (from -> to | init at version | refactor | etc)`
|
||||
```
|
||||
(pkg-name | service-name): (from -> to | init at version | refactor | etc)
|
||||
|
||||
(Motivation for change. Additional information.)
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
* nginx: init at 2.0.1
|
||||
* firefox: 3.0 -> 3.1.1
|
||||
* hydra service: add bazBaz option
|
||||
|
||||
Dual baz behavior is needed to do foo.
|
||||
* nginx service: refactor config generation
|
||||
|
||||
The old config generation system used impure shell scripts and could break in specific circumstances (see #1234).
|
||||
|
||||
* `meta.description` should:
|
||||
* Be capitalized
|
||||
@ -30,6 +38,12 @@ under the terms of [COPYING](../COPYING), which is an MIT-like license.
|
||||
|
||||
See the nixpkgs manual for more details on how to [Submit changes to nixpkgs](https://nixos.org/nixpkgs/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,3 +11,4 @@
|
||||
* 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`)
|
||||
|
@ -2,7 +2,8 @@
|
||||
"userBlacklist": [
|
||||
"civodul",
|
||||
"jhasse",
|
||||
"shlevy"
|
||||
"shlevy",
|
||||
"bbenoist"
|
||||
],
|
||||
"alwaysNotifyForPaths": [
|
||||
{ "name": "FRidh", "files": ["pkgs/top-level/python-packages.nix", "pkgs/development/interpreters/python/*", "pkgs/development/python-modules/*" ] },
|
||||
|
13
.travis.yml
13
.travis.yml
@ -1,8 +1,14 @@
|
||||
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: false
|
||||
sudo: required
|
||||
script:
|
||||
- ./maintainers/scripts/travis-nox-review-pr.sh nixpkgs-verify nixpkgs-manual nixpkgs-tarball nixpkgs-unstable
|
||||
- ./maintainers/scripts/travis-nox-review-pr.sh nixos-options nixos-manual
|
||||
@ -18,3 +24,8 @@ matrix:
|
||||
env:
|
||||
global:
|
||||
- GITHUB_TOKEN=5edaaf1017f691ed34e7f80878f8f5fbd071603f
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: change
|
||||
|
@ -13,12 +13,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-16.09` for the latest
|
||||
custom changes on top of one of the channels, e.g. `nixos-17.03` for the latest
|
||||
release and `nixos-unstable` for the latest successful build of master:
|
||||
|
||||
```
|
||||
% git remote update channels
|
||||
% git rebase channels/nixos-16.09
|
||||
% git rebase channels/nixos-17.03
|
||||
```
|
||||
|
||||
For pull-requests, please rebase onto nixpkgs `master`.
|
||||
@ -32,9 +32,9 @@ 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 16.09 release](https://hydra.nixos.org/jobset/nixos/release-16.09)
|
||||
* [Continuous package builds for 17.03 release](https://hydra.nixos.org/jobset/nixos/release-17.03)
|
||||
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
|
||||
* [Tests for 16.09 release](https://hydra.nixos.org/job/nixos/release-16.09/tested#tabs-constituents)
|
||||
* [Tests for 17.03 release](https://hydra.nixos.org/job/nixos/release-17.03/tested#tabs-constituents)
|
||||
|
||||
Communication:
|
||||
|
||||
|
12
default.nix
12
default.nix
@ -2,7 +2,17 @@ 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! See https://nixos.org/wiki/How_to_update_when_Nix_is_too_old_to_evaluate_Nixpkgs"
|
||||
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
|
||||
''
|
||||
|
||||
else
|
||||
|
||||
|
@ -623,7 +623,7 @@ evaluate correctly.</para>
|
||||
from bad to good:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Uses <literal>git://</literal> which won't be proxied.
|
||||
<para>Bad: 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>This is ok, but an archive fetch will still be faster.
|
||||
<para>Better: 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>Fetches a snapshot archive and you get the rev you want.
|
||||
<para>Best: Fetches a snapshot archive and you get the rev you want.
|
||||
<programlisting>
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
|
@ -2,85 +2,223 @@
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-packageconfig">
|
||||
|
||||
<title><filename>~/.nixpkgs/config.nix</filename>: global configuration</title>
|
||||
<title>Global configuration</title>
|
||||
|
||||
<para>Nix packages can be configured to allow or deny certain options.</para>
|
||||
<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>To apply the configuration edit
|
||||
<filename>~/.nixpkgs/config.nix</filename> and set it like
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
and will allow the Nix package manager to install unfree licensed packages.</para>
|
||||
<section xml:id="sec-allow-broken">
|
||||
<title>Installing broken packages</title>
|
||||
|
||||
<para>The configuration as listed also applies to NixOS under
|
||||
<option>nixpkgs.config</option> set.</para>
|
||||
|
||||
<itemizedlist>
|
||||
<para>There are two ways to try compiling a package which has been
|
||||
marked as broken.</para>
|
||||
|
||||
<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>
|
||||
<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:
|
||||
|
||||
<para>Same can be achieved by setting the environment variable:
|
||||
<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:
|
||||
|
||||
<programlisting>
|
||||
$ export NIXPKGS_ALLOW_UNFREE=1
|
||||
{
|
||||
allowBroken = true;
|
||||
}
|
||||
</programlisting>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
</para>
|
||||
</listitem>
|
||||
<section xml:id="sec-allow-unfree">
|
||||
<title>Installing unfree packages</title>
|
||||
|
||||
<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:
|
||||
<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:
|
||||
|
||||
<programlisting>
|
||||
allowUnfreePredicate = (pkg: ...);
|
||||
{
|
||||
allowUnfreePredicate = (pkg: elem (builtins.parseDrvName pkg.name).name [ "flashplayer" "vscode" ]);
|
||||
}
|
||||
</programlisting>
|
||||
</para></listitem>
|
||||
|
||||
Example to allow flash player and visual studio code only:
|
||||
<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>:
|
||||
|
||||
<programlisting>
|
||||
allowUnfreePredicate = with builtins; (pkg: elem (parseDrvName pkg.name).name [ "flashplayer" "vscode" ]);
|
||||
{
|
||||
whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Whenever unfree packages are not allowed, packages can still
|
||||
be whitelisted by their license:
|
||||
<para>The following example configuration blacklists the
|
||||
<literal>gpl3</literal> and <literal>agpl3</literal> licenses:
|
||||
|
||||
<programlisting>
|
||||
whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
|
||||
{
|
||||
blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<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:
|
||||
<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:
|
||||
|
||||
<programlisting>
|
||||
blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
|
||||
{
|
||||
allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) <= 5);
|
||||
}
|
||||
</programlisting>
|
||||
</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>
|
||||
|
||||
<para>Note that <literal>permittedInsecurePackages</literal> is
|
||||
only checked if <literal>allowInsecurePredicate</literal> is not
|
||||
specified.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<!--============================================================-->
|
||||
|
||||
@ -89,7 +227,7 @@ packages via <literal>packageOverrides</literal></title>
|
||||
|
||||
<para>You can define a function called
|
||||
<varname>packageOverrides</varname> in your local
|
||||
<filename>~/.nixpkgs/config.nix</filename> to overide nix packages. It
|
||||
<filename>~/.config/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.
|
||||
|
||||
|
216
doc/cross-compilation.xml
Normal file
216
doc/cross-compilation.xml
Normal file
@ -0,0 +1,216 @@
|
||||
<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>cross</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 at the top level, so 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, .. }: ...</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 compiler code for a single platform.
|
||||
Thus, when building them, one must think ahead about what 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>
|
||||
<note><para>
|
||||
If you dig around nixpkgs, you may notice there is also <varname>stdenv.cross</varname>.
|
||||
This field defined as <varname>hostPlatform</varname> when the host and build platforms differ, but otherwise not defined at all.
|
||||
This field is obsolete and will soon disappear—please do not use it.
|
||||
</para></note>
|
||||
<para>
|
||||
The exact scheme these fields is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up.
|
||||
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, along with some <literal>is*</literal>predicates.
|
||||
These predicates are superior to the ones in <varname>stdenv</varname> as they aren't tied to the build platform (host, as previously discussed, would be a saner default).
|
||||
</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 one 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 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 <link 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>
|
||||
Many sources (manual, wiki, etc) probably mention passing <varname>system</varname>, <varname>platform</varname>, and, optionally, <varname>crossSystem</varname> to nixpkgs:
|
||||
<literal>import <nixpkgs> { system = ..; platform = ..; crossSystem = ..; }</literal>.
|
||||
<varname>system</varname> and <varname>platform</varname> together determine the system on which packages are built, and <varname>crossSystem</varname> specifies the platform on which packages are ultimately intended to run, if it is different.
|
||||
This still works, but with more recent changes, one can alternatively pass <varname>localSystem</varname>, containing <varname>system</varname> and <varname>platform</varname>, for symmetry.
|
||||
</para>
|
||||
<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>
|
@ -68,6 +68,14 @@ pkgs.stdenv.mkDerivation {
|
||||
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
|
||||
|
||||
|
@ -119,7 +119,7 @@
|
||||
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>.
|
||||
<filename>~/.config/nixpkgs/config.nix</filename>.
|
||||
</para>
|
||||
</warning>
|
||||
|
||||
@ -133,7 +133,7 @@
|
||||
<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>
|
||||
|
||||
<para>
|
||||
Example usage:
|
||||
@ -228,7 +228,7 @@
|
||||
] 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.
|
||||
<literal>]</literal> with a backslash.
|
||||
</para>
|
||||
|
||||
<note><para>Nix store paths can be converted to strings by enclosing a
|
||||
@ -524,6 +524,22 @@
|
||||
using its <varname>buildArgs</varname> attribute.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<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">
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,9 @@ such as Perl or Haskell. These are described in this chapter.</para>
|
||||
<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>
|
||||
|
@ -3,7 +3,7 @@
|
||||
## User Guide
|
||||
|
||||
Several versions of Python are available on Nix as well as a high amount of
|
||||
packages. The default interpreter is CPython 3.5.
|
||||
packages. The default interpreter is CPython 2.7.
|
||||
|
||||
### Using Python
|
||||
|
||||
@ -74,7 +74,6 @@ can do is write a simple Nix expression which sets up an environment for you,
|
||||
requiring you only to type `nix-shell`. Say we want to have Python 3.5, `numpy`
|
||||
and `toolz`, like before, in an environment. With a `shell.nix` file
|
||||
containing
|
||||
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
@ -101,22 +100,25 @@ On Nix all packages are built by functions. The main function in Nix for buildin
|
||||
Let's see how we would build the `toolz` package. According to [`python-packages.nix`](https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/python-packages.nix) `toolz` is build using
|
||||
|
||||
```nix
|
||||
toolz = buildPythonPackage rec{
|
||||
name = "toolz-${version}";
|
||||
version = "0.7.4";
|
||||
{ # ...
|
||||
|
||||
src = pkgs.fetchurl{
|
||||
url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
|
||||
sha256 = "43c2c9e5e7a16b6c88ba3088a9bfc82f7db8e13378be7c78d6c14a5f8ed05afd";
|
||||
};
|
||||
toolz = buildPythonPackage rec {
|
||||
name = "toolz-${version}";
|
||||
version = "0.7.4";
|
||||
|
||||
meta = {
|
||||
homepage = "http://github.com/pytoolz/toolz/";
|
||||
description = "List processing tools and functional utilities";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ fridh ];
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
|
||||
sha256 = "43c2c9e5e7a16b6c88ba3088a9bfc82f7db8e13378be7c78d6c14a5f8ed05afd";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://github.com/pytoolz/toolz/";
|
||||
description = "List processing tools and functional utilities";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ fridh ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
What happens here? The function `buildPythonPackage` is called and as argument
|
||||
@ -129,7 +131,7 @@ specify some (optional) [meta information](http://nixos.org/nixpkgs/manual/#chap
|
||||
|
||||
The output of the function is a derivation, which is an attribute with the name
|
||||
`toolz` of the set `pythonPackages`. Actually, sets are created for all interpreter versions,
|
||||
so `python27Packages`, `python34Packages`, `python35Packages` and `pypyPackages`.
|
||||
so e.g. `python27Packages`, `python35Packages` and `pypyPackages`.
|
||||
|
||||
The above example works when you're directly working on
|
||||
`pkgs/top-level/python-packages.nix` in the Nixpkgs repository. Often though,
|
||||
@ -143,7 +145,7 @@ pkgs.python35Packages.buildPythonPackage rec {
|
||||
name = "toolz-${version}";
|
||||
version = "0.8.0";
|
||||
|
||||
src = pkgs.fetchurl{
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
|
||||
sha256 = "e8451af61face57b7c5d09e71c0d27b8005f001ead56e9fdf470417e5cc6d479";
|
||||
};
|
||||
@ -174,7 +176,7 @@ with import <nixpkgs> {};
|
||||
name = "toolz-${version}";
|
||||
version = "0.8.0";
|
||||
|
||||
src = pkgs.fetchurl{
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
|
||||
sha256 = "e8451af61face57b7c5d09e71c0d27b8005f001ead56e9fdf470417e5cc6d479";
|
||||
};
|
||||
@ -215,25 +217,28 @@ The following example shows which arguments are given to `buildPythonPackage` in
|
||||
order to build [`datashape`](https://github.com/blaze/datashape).
|
||||
|
||||
```nix
|
||||
datashape = buildPythonPackage rec {
|
||||
name = "datashape-${version}";
|
||||
version = "0.4.7";
|
||||
{ # ...
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/D/DataShape/${name}.tar.gz";
|
||||
sha256 = "14b2ef766d4c9652ab813182e866f493475e65e558bed0822e38bf07bba1a278";
|
||||
datashape = buildPythonPackage rec {
|
||||
name = "datashape-${version}";
|
||||
version = "0.4.7";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/D/DataShape/${name}.tar.gz";
|
||||
sha256 = "14b2ef766d4c9652ab813182e866f493475e65e558bed0822e38bf07bba1a278";
|
||||
};
|
||||
|
||||
buildInputs = with self; [ pytest ];
|
||||
propagatedBuildInputs = with self; [ numpy multipledispatch dateutil ];
|
||||
|
||||
meta = {
|
||||
homepage = https://github.com/ContinuumIO/datashape;
|
||||
description = "A data description language";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ fridh ];
|
||||
};
|
||||
};
|
||||
|
||||
buildInputs = with self; [ pytest ];
|
||||
propagatedBuildInputs = with self; [ numpy multipledispatch dateutil ];
|
||||
|
||||
meta = {
|
||||
homepage = https://github.com/ContinuumIO/datashape;
|
||||
description = "A data description language";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ fridh ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
We can see several runtime dependencies, `numpy`, `multipledispatch`, and
|
||||
@ -247,23 +252,26 @@ Python bindings to `libxml2` and `libxslt`. These libraries are only required
|
||||
when building the bindings and are therefore added as `buildInputs`.
|
||||
|
||||
```nix
|
||||
lxml = buildPythonPackage rec {
|
||||
name = "lxml-3.4.4";
|
||||
{ # ...
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/l/lxml/${name}.tar.gz";
|
||||
sha256 = "16a0fa97hym9ysdk3rmqz32xdjqmy4w34ld3rm3jf5viqjx65lxk";
|
||||
lxml = buildPythonPackage rec {
|
||||
name = "lxml-3.4.4";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/l/lxml/${name}.tar.gz";
|
||||
sha256 = "16a0fa97hym9ysdk3rmqz32xdjqmy4w34ld3rm3jf5viqjx65lxk";
|
||||
};
|
||||
|
||||
buildInputs = with self; [ pkgs.libxml2 pkgs.libxslt ];
|
||||
|
||||
meta = {
|
||||
description = "Pythonic binding for the libxml2 and libxslt libraries";
|
||||
homepage = http://lxml.de;
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ sjourdois ];
|
||||
};
|
||||
};
|
||||
|
||||
buildInputs = with self; [ pkgs.libxml2 pkgs.libxslt ];
|
||||
|
||||
meta = {
|
||||
description = "Pythonic binding for the libxml2 and libxslt libraries";
|
||||
homepage = http://lxml.de;
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ sjourdois ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
In this example `lxml` and Nix are able to work out exactly where the relevant
|
||||
@ -277,33 +285,37 @@ find each of them in a different folder, and therefore we have to set `LDFLAGS`
|
||||
and `CFLAGS`.
|
||||
|
||||
```nix
|
||||
pyfftw = buildPythonPackage rec {
|
||||
name = "pyfftw-${version}";
|
||||
version = "0.9.2";
|
||||
{ # ...
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/p/pyFFTW/pyFFTW-${version}.tar.gz";
|
||||
sha256 = "f6bbb6afa93085409ab24885a1a3cdb8909f095a142f4d49e346f2bd1b789074";
|
||||
pyfftw = buildPythonPackage rec {
|
||||
name = "pyfftw-${version}";
|
||||
version = "0.9.2";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/p/pyFFTW/pyFFTW-${version}.tar.gz";
|
||||
sha256 = "f6bbb6afa93085409ab24885a1a3cdb8909f095a142f4d49e346f2bd1b789074";
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.fftw pkgs.fftwFloat pkgs.fftwLongDouble];
|
||||
|
||||
propagatedBuildInputs = with self; [ numpy scipy ];
|
||||
|
||||
# Tests cannot import pyfftw. pyfftw works fine though.
|
||||
doCheck = false;
|
||||
|
||||
preConfigure = ''
|
||||
export LDFLAGS="-L${pkgs.fftw.dev}/lib -L${pkgs.fftwFloat.out}/lib -L${pkgs.fftwLongDouble.out}/lib"
|
||||
export CFLAGS="-I${pkgs.fftw.dev}/include -I${pkgs.fftwFloat.dev}/include -I${pkgs.fftwLongDouble.dev}/include"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A pythonic wrapper around FFTW, the FFT library, presenting a unified interface for all the supported transforms";
|
||||
homepage = http://hgomersall.github.com/pyFFTW/;
|
||||
license = with licenses; [ bsd2 bsd3 ];
|
||||
maintainer = with maintainers; [ fridh ];
|
||||
};
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.fftw pkgs.fftwFloat pkgs.fftwLongDouble];
|
||||
|
||||
propagatedBuildInputs = with self; [ numpy scipy ];
|
||||
|
||||
# Tests cannot import pyfftw. pyfftw works fine though.
|
||||
doCheck = false;
|
||||
|
||||
LDFLAGS="-L${pkgs.fftw.dev}/lib -L${pkgs.fftwFloat.out}/lib -L${pkgs.fftwLongDouble.out}/lib"
|
||||
CFLAGS="-I${pkgs.fftw.dev}/include -I${pkgs.fftwFloat.dev}/include -I${pkgs.fftwLongDouble.dev}/include"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A pythonic wrapper around FFTW, the FFT library, presenting a unified interface for all the supported transforms";
|
||||
homepage = http://hgomersall.github.com/pyFFTW/;
|
||||
license = with licenses; [ bsd2 bsd3 ];
|
||||
maintainer = with maintainers; [ fridh ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
Note also the line `doCheck = false;`, we explicitly disabled running the test-suite.
|
||||
|
||||
@ -316,10 +328,7 @@ That way, you can run updated code without having to reinstall after each and ev
|
||||
Development mode is also available. Let's see how you can use it.
|
||||
|
||||
In the previous Nix expression the source was fetched from an url. We can also refer to a local source instead using
|
||||
|
||||
```nix
|
||||
src = ./path/to/source/tree;
|
||||
```
|
||||
`src = ./path/to/source/tree;`
|
||||
|
||||
If we create a `shell.nix` file which calls `buildPythonPackage`, and if `src`
|
||||
is a local source, and if the local source has a `setup.py`, then development
|
||||
@ -338,7 +347,7 @@ buildPythonPackage rec {
|
||||
name = "mypackage";
|
||||
src = ./path/to/package/source;
|
||||
propagatedBuildInputs = [ pytest numpy pkgs.libsndfile ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
It is important to note that due to how development mode is implemented on Nix it is not possible to have multiple packages simultaneously in development mode.
|
||||
@ -371,7 +380,7 @@ buildPythonPackage rec {
|
||||
name = "toolz-${version}";
|
||||
version = "0.7.4";
|
||||
|
||||
src = pkgs.fetchurl{
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
|
||||
sha256 = "43c2c9e5e7a16b6c88ba3088a9bfc82f7db8e13378be7c78d6c14a5f8ed05afd";
|
||||
};
|
||||
@ -382,7 +391,7 @@ buildPythonPackage rec {
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ fridh ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
It takes two arguments, `pkgs` and `buildPythonPackage`.
|
||||
@ -392,7 +401,10 @@ We now call this function using `callPackage` in the definition of our environme
|
||||
with import <nixpkgs> {};
|
||||
|
||||
( let
|
||||
toolz = pkgs.callPackage ~/path/to/toolz/release.nix { pkgs=pkgs; buildPythonPackage=pkgs.python35Packages.buildPythonPackage; };
|
||||
toolz = pkgs.callPackage /path/to/toolz/release.nix {
|
||||
pkgs = pkgs;
|
||||
buildPythonPackage = pkgs.python35Packages.buildPythonPackage;
|
||||
};
|
||||
in pkgs.python35.withPackages (ps: [ ps.numpy toolz ])
|
||||
).env
|
||||
```
|
||||
@ -410,8 +422,8 @@ and in this case the `python35` interpreter is automatically used.
|
||||
|
||||
### Interpreters
|
||||
|
||||
Versions 2.6, 2.7, 3.3, 3.4 and 3.5 of the CPython interpreter are available as respectively
|
||||
`python26`, `python27`, `python33`, `python34` and `python35`. The PyPy interpreter
|
||||
Versions 2.7, 3.3, 3.4, 3.5 and 3.6 of the CPython interpreter are available as
|
||||
respectively `python27`, `python33`, `python34`, `python35` and `python36`. The PyPy interpreter
|
||||
is available as `pypy`. The aliases `python2` and `python3` correspond to respectively `python27` and
|
||||
`python35`. The default interpreter, `python`, maps to `python2`.
|
||||
The Nix expressions for the interpreters can be found in
|
||||
@ -460,6 +472,7 @@ sets are
|
||||
* `pkgs.python33Packages`
|
||||
* `pkgs.python34Packages`
|
||||
* `pkgs.python35Packages`
|
||||
* `pkgs.python36Packages`
|
||||
* `pkgs.pypyPackages`
|
||||
|
||||
and the aliases
|
||||
@ -474,22 +487,27 @@ The `buildPythonPackage` function is implemented in
|
||||
`pkgs/development/interpreters/python/build-python-package.nix`
|
||||
|
||||
The following is an example:
|
||||
```nix
|
||||
{ # ...
|
||||
|
||||
twisted = buildPythonPackage {
|
||||
name = "twisted-8.1.0";
|
||||
twisted = buildPythonPackage {
|
||||
name = "twisted-8.1.0";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
|
||||
sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
|
||||
};
|
||||
src = pkgs.fetchurl {
|
||||
url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
|
||||
sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ self.ZopeInterface ];
|
||||
propagatedBuildInputs = [ self.ZopeInterface ];
|
||||
|
||||
meta = {
|
||||
homepage = http://twistedmatrix.com/;
|
||||
description = "Twisted, an event-driven networking engine written in Python";
|
||||
license = stdenv.lib.licenses.mit; };
|
||||
};
|
||||
meta = {
|
||||
homepage = http://twistedmatrix.com/;
|
||||
description = "Twisted, an event-driven networking engine written in Python";
|
||||
license = stdenv.lib.licenses.mit;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
The `buildPythonPackage` mainly does four things:
|
||||
|
||||
@ -539,29 +557,32 @@ Because with an application we're not interested in multiple version the prefix
|
||||
Python environments can be created using the low-level `pkgs.buildEnv` function.
|
||||
This example shows how to create an environment that has the Pyramid Web Framework.
|
||||
Saving the following as `default.nix`
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
with import <nixpkgs> {};
|
||||
|
||||
python.buildEnv.override {
|
||||
extraLibs = [ pkgs.pythonPackages.pyramid ];
|
||||
ignoreCollisions = true;
|
||||
}
|
||||
python.buildEnv.override {
|
||||
extraLibs = [ pkgs.pythonPackages.pyramid ];
|
||||
ignoreCollisions = true;
|
||||
}
|
||||
```
|
||||
|
||||
and running `nix-build` will create
|
||||
|
||||
/nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env
|
||||
```
|
||||
/nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env
|
||||
```
|
||||
|
||||
with wrapped binaries in `bin/`.
|
||||
|
||||
You can also use the `env` attribute to create local environments with needed
|
||||
packages installed. This is somewhat comparable to `virtualenv`. For example,
|
||||
running `nix-shell` with the following `shell.nix`
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
with import <nixpkgs> {};
|
||||
|
||||
(python3.buildEnv.override {
|
||||
extraLibs = with python3Packages; [ numpy requests2 ];
|
||||
}).env
|
||||
(python3.buildEnv.override {
|
||||
extraLibs = with python3Packages; [ numpy requests ];
|
||||
}).env
|
||||
```
|
||||
|
||||
will drop you into a shell where Python will have the
|
||||
specified packages in its path.
|
||||
@ -576,34 +597,40 @@ specified packages in its path.
|
||||
#### python.withPackages function
|
||||
|
||||
The `python.withPackages` function provides a simpler interface to the `python.buildEnv` functionality.
|
||||
It takes a function as an argument that is passed the set of python packages and returns the list
|
||||
It takes a function as an argument that is passed the set of python packages and returns the list
|
||||
of the packages to be included in the environment. Using the `withPackages` function, the previous
|
||||
example for the Pyramid Web Framework environment can be written like this:
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
with import <nixpkgs> {};
|
||||
python.withPackages (ps: [ps.pyramid])
|
||||
```
|
||||
|
||||
python.withPackages (ps: [ps.pyramid])
|
||||
|
||||
`withPackages` passes the correct package set for the specific interpreter version as an
|
||||
`withPackages` passes the correct package set for the specific interpreter version as an
|
||||
argument to the function. In the above example, `ps` equals `pythonPackages`.
|
||||
But you can also easily switch to using python3:
|
||||
|
||||
with import <nixpkgs> {};
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
python3.withPackages (ps: [ps.pyramid])
|
||||
python3.withPackages (ps: [ps.pyramid])
|
||||
```
|
||||
|
||||
Now, `ps` is set to `python3Packages`, matching the version of the interpreter.
|
||||
|
||||
As `python.withPackages` simply uses `python.buildEnv` under the hood, it also supports the `env`
|
||||
attribute. The `shell.nix` file from the previous section can thus be also written like this:
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
with import <nixpkgs> {};
|
||||
|
||||
(python33.withPackages (ps: [ps.numpy ps.requests2])).env
|
||||
(python33.withPackages (ps: [ps.numpy ps.requests])).env
|
||||
```
|
||||
|
||||
In contrast to `python.buildEnv`, `python.withPackages` does not support the more advanced options
|
||||
such as `ignoreCollisions = true` or `postBuild`. If you need them, you have to use `python.buildEnv`.
|
||||
|
||||
Python 2 namespace packages may provide `__init__.py` that collide. In that case `python.buildEnv`
|
||||
should be used with `ignoreCollisions = true`.
|
||||
|
||||
### Development mode
|
||||
|
||||
Development or editable mode is supported. To develop Python packages
|
||||
@ -613,22 +640,24 @@ install -e . --prefix $TMPDIR/`for the package.
|
||||
Warning: `shellPhase` is executed only if `setup.py` exists.
|
||||
|
||||
Given a `default.nix`:
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
with import <nixpkgs> {};
|
||||
buildPythonPackage { name = "myproject";
|
||||
|
||||
buildPythonPackage { name = "myproject";
|
||||
buildInputs = with pkgs.pythonPackages; [ pyramid ];
|
||||
|
||||
buildInputs = with pkgs.pythonPackages; [ pyramid ];
|
||||
|
||||
src = ./.; }
|
||||
src = ./.; }
|
||||
```
|
||||
|
||||
Running `nix-shell` with no arguments should give you
|
||||
the environment in which the package would be built with
|
||||
`nix-build`.
|
||||
|
||||
Shortcut to setup environments with C headers/libraries and python packages:
|
||||
|
||||
$ nix-shell -p pythonPackages.pyramid zlib libjpeg git
|
||||
```shell
|
||||
nix-shell -p pythonPackages.pyramid zlib libjpeg git
|
||||
```
|
||||
|
||||
Note: There is a boolean value `lib.inNixShell` set to `true` if nix-shell is invoked.
|
||||
|
||||
@ -641,6 +670,19 @@ community to help save time. No tool is preferred at the moment.
|
||||
- [pypi2nix](https://github.com/garbas/pypi2nix) by Rok Garbas
|
||||
- [pypi2nix](https://github.com/offlinehacker/pypi2nix) by Jaka Hudoklin
|
||||
|
||||
### Deterministic builds
|
||||
|
||||
Python 2.7, 3.5 and 3.6 are now built deterministically and 3.4 mostly.
|
||||
Minor modifications had to be made to the interpreters in order to generate
|
||||
deterministic bytecode. This has security implications and is relevant for
|
||||
those using Python in a `nix-shell`.
|
||||
|
||||
When the environment variable `DETERMINISTIC_BUILD` is set, all bytecode will have timestamp 1.
|
||||
The `buildPythonPackage` function sets `DETERMINISTIC_BUILD=1` and
|
||||
[PYTHONHASHSEED=0](https://docs.python.org/3.5/using/cmdline.html#envvar-PYTHONHASHSEED).
|
||||
Both are also exported in `nix-shell`.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### How can I install a working Python environment?
|
||||
@ -663,7 +705,7 @@ with import <nixpkgs> {};
|
||||
pkgs.python35.withPackages (ps: with ps; [ numpy ipython ])
|
||||
```
|
||||
and install it in your profile with
|
||||
```
|
||||
```shell
|
||||
nix-env -if build.nix
|
||||
```
|
||||
Now you can use the Python interpreter, as well as the extra packages that you added to the environment.
|
||||
@ -671,15 +713,19 @@ Now you can use the Python interpreter, as well as the extra packages that you a
|
||||
#### Environment defined in `~/.nixpkgs/config.nix`
|
||||
|
||||
If you prefer to, you could also add the environment as a package override to the Nixpkgs set.
|
||||
```
|
||||
```nix
|
||||
{ # ...
|
||||
|
||||
packageOverrides = pkgs: with pkgs; {
|
||||
myEnv = python35.withPackages (ps: with ps; [ numpy ipython ]);
|
||||
};
|
||||
}
|
||||
```
|
||||
and install it in your profile with
|
||||
```
|
||||
```shell
|
||||
nix-env -iA nixpkgs.myEnv
|
||||
```
|
||||
|
||||
We're installing using the attribute path and assume the channels is named `nixpkgs`.
|
||||
Note that I'm using the attribute path here.
|
||||
|
||||
@ -688,9 +734,12 @@ Note that I'm using the attribute path here.
|
||||
For the sake of completeness, here's another example how to install the environment system-wide.
|
||||
|
||||
```nix
|
||||
environment.systemPackages = with pkgs; [
|
||||
(python35.withPackages(ps: with ps; [ numpy ipython ]))
|
||||
];
|
||||
{ # ...
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(python35.withPackages(ps: with ps; [ numpy ipython ]))
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### How to solve circular dependencies?
|
||||
@ -727,19 +776,18 @@ All packages in the Python package set will now use the updated `scipy` version.
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
|
||||
(
|
||||
let
|
||||
packageOverrides = self: super: {
|
||||
scipy = super.scipy_0_17;
|
||||
};
|
||||
in (pkgs.python35.override {inherit packageOverrides;}).withPackages (ps: [ps.blaze])
|
||||
( let
|
||||
packageOverrides = self: super: {
|
||||
scipy = super.scipy_0_17;
|
||||
};
|
||||
in (pkgs.python35.override {inherit packageOverrides;}).withPackages (ps: [ps.blaze])
|
||||
).env
|
||||
```
|
||||
The requested package `blaze` depends on `pandas` which itself depends on `scipy`.
|
||||
|
||||
If you want the whole of Nixpkgs to use your modifications, then you can use `overlays`
|
||||
as explained in this manual. In the following example we build a `inkscape` using a different version of `numpy`.
|
||||
```
|
||||
```nix
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
newpkgs = import pkgs.path { overlays = [ (pkgsself: pkgssuper: {
|
||||
@ -762,32 +810,32 @@ This is because files are included that depend on items in the Nix store which h
|
||||
The command `bdist_wheel` takes into account `SOURCE_DATE_EPOCH`, and `nix-shell` sets this to 1. By setting it to a value corresponding to 1980 or later, or by unsetting it, it is possible to build wheels.
|
||||
|
||||
Use 1980 as timestamp:
|
||||
```
|
||||
```shell
|
||||
nix-shell --run "SOURCE_DATE_EPOCH=315532800 python3 setup.py bdist_wheel"
|
||||
```
|
||||
or the current time:
|
||||
```
|
||||
```shell
|
||||
nix-shell --run "SOURCE_DATE_EPOCH=$(date +%s) python3 setup.py bdist_wheel"
|
||||
```
|
||||
or unset:
|
||||
```
|
||||
```shell
|
||||
nix-shell --run "unset SOURCE_DATE_EPOCH; python3 setup.py bdist_wheel"
|
||||
```
|
||||
|
||||
### `install_data` / `data_files` problems
|
||||
|
||||
If you get the following error:
|
||||
|
||||
could not create '/nix/store/6l1bvljpy8gazlsw2aw9skwwp4pmvyxw-python-2.7.8/etc':
|
||||
Permission denied
|
||||
|
||||
This is a [known bug](https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix) in setuptools.
|
||||
```
|
||||
could not create '/nix/store/6l1bvljpy8gazlsw2aw9skwwp4pmvyxw-python-2.7.8/etc':
|
||||
Permission denied
|
||||
```
|
||||
This is a [known bug](https://github.com/pypa/setuptools/issues/130) in `setuptools`.
|
||||
Setuptools `install_data` does not respect `--prefix`. An example of such package using the feature is `pkgs/tools/X11/xpra/default.nix`.
|
||||
As workaround install it as an extra `preInstall` step:
|
||||
|
||||
${python.interpreter} setup.py install_data --install-dir=$out --root=$out
|
||||
sed -i '/ = data\_files/d' setup.py
|
||||
|
||||
```shell
|
||||
${python.interpreter} setup.py install_data --install-dir=$out --root=$out
|
||||
sed -i '/ = data\_files/d' setup.py
|
||||
```
|
||||
|
||||
### Rationale of non-existent global site-packages
|
||||
|
||||
@ -811,11 +859,11 @@ and install python modules through `pip` the traditional way.
|
||||
|
||||
Create this `default.nix` file, together with a `requirements.txt` and simply execute `nix-shell`.
|
||||
|
||||
```
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
with pkgs.python27Packages;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation {
|
||||
name = "impurePythonEnv";
|
||||
buildInputs = [
|
||||
# these packages are required for virtualenv and pip to work:
|
||||
@ -823,10 +871,10 @@ stdenv.mkDerivation {
|
||||
python27Full
|
||||
python27Packages.virtualenv
|
||||
python27Packages.pip
|
||||
# the following packages are related to the dependencies of your python
|
||||
# project.
|
||||
# In this particular example the python modules listed in the
|
||||
# requirements.tx require the following packages to be installed locally
|
||||
# the following packages are related to the dependencies of your python
|
||||
# project.
|
||||
# In this particular example the python modules listed in the
|
||||
# requirements.tx require the following packages to be installed locally
|
||||
# in order to compile any binary extensions they may require.
|
||||
#
|
||||
taglib
|
||||
@ -841,7 +889,7 @@ stdenv.mkDerivation {
|
||||
shellHook = ''
|
||||
# set SOURCE_DATE_EPOCH so that we can use python wheels
|
||||
SOURCE_DATE_EPOCH=$(date +%s)
|
||||
virtualenv --no-setuptools venv
|
||||
virtualenv --no-setuptools venv
|
||||
export PATH=$PWD/venv/bin:$PATH
|
||||
pip install -r requirements.txt
|
||||
'';
|
||||
@ -849,10 +897,31 @@ stdenv.mkDerivation {
|
||||
```
|
||||
|
||||
Note that the `pip install` is an imperative action. So every time `nix-shell`
|
||||
is executed it will attempt to download the python modules listed in
|
||||
is executed it will attempt to download the python modules listed in
|
||||
requirements.txt. However these will be cached locally within the `virtualenv`
|
||||
folder and not downloaded again.
|
||||
|
||||
### How to override a Python package from `configuration.nix`?
|
||||
|
||||
If you need to change a package's attribute(s) from `configuration.nix` you could do:
|
||||
|
||||
```nix
|
||||
nixpkgs.config.packageOverrides = superP: {
|
||||
pythonPackages = superP.pythonPackages.override {
|
||||
overrides = self: super: {
|
||||
bepasty-server = super.bepasty-server.overrideAttrs ( oldAttrs: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/bepasty/bepasty-server";
|
||||
sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
|
||||
rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
If you are using the `bepasty-server` package somewhere, for example in `systemPackages` or indirectly from `services.bepasty`, then a `nixos-rebuild switch` will rebuild the system but with the `bepasty-server` package using a different `src` attribute. This way one can modify `python` based software/libraries easily. Using `self` and `super` one can also alter dependencies (`buildInputs`) between the old state (`self`) and new state (`super`).
|
||||
|
||||
## Contributing
|
||||
|
||||
@ -860,7 +929,8 @@ folder and not downloaded again.
|
||||
|
||||
Following rules are desired to be respected:
|
||||
|
||||
* Make sure package builds for all python interpreters. Use `disabled` argument to `buildPythonPackage` to set unsupported interpreters.
|
||||
* If tests need to be disabled for a package, make sure you leave a comment about reasoning.
|
||||
* Packages in `pkgs/top-level/python-packages.nix` are sorted quasi-alphabetically to avoid merge conflicts.
|
||||
* Python libraries are supposed to be in `python-packages.nix` and packaged with `buildPythonPackage`. Python applications live outside of `python-packages.nix` and are packaged with `buildPythonApplication`.
|
||||
* Python libraries are supposed to be called from `python-packages.nix` and packaged with `buildPythonPackage`. The expression of a library should be in `pkgs/development/python-modules/<name>/default.nix`. Libraries in `pkgs/top-level/python-packages.nix` are sorted quasi-alphabetically to avoid merge conflicts.
|
||||
* Python applications live outside of `python-packages.nix` and are packaged with `buildPythonApplication`.
|
||||
* Make sure libraries build for all Python interpreters.
|
||||
* By default we enable tests. Make sure the tests are found and, in the case of libraries, are passing for all interpreters. If certain tests fail they can be disabled individually. Try to avoid disabling the tests altogether. In any case, when you disable tests, leave a comment explaining why.
|
||||
* Commit names of Python libraries should include `pythonPackages`, for example `pythonPackages.numpy: 1.11 -> 1.12`.
|
||||
|
@ -2,67 +2,31 @@
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="sec-language-qt">
|
||||
|
||||
<title>Qt</title>
|
||||
<title>Qt and KDE</title>
|
||||
|
||||
<para>The information in this section applies to Qt 5.5 and later.</para>
|
||||
|
||||
<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>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 to support packages that may not be compatible with the latest version. When packaging applications and libraries for Nixpkgs, it is important to ensure that compatible versions of Qt 5 are used throughout; this consideration motivates the tools described below.</para>
|
||||
|
||||
<section xml:id="ssec-qt-libraries"><title>Libraries</title>
|
||||
|
||||
<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>
|
||||
<para>Libraries that depend on Qt 5 should be built with each available version to avoid linking a dependent package against incompatible versions of Qt 5. (Although Qt 5 maintains backward ABI compatibility, linking against multiple versions at once is generally not possible; at best it will lead to runtime faults.) Packages that provide 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. The <varname>callPackage</varname> provided in this scope will ensure that only one Qt version will be used throughout the dependency tree. Dependencies should be imported unqualified, i.e. <literal>qtbase</literal> not <literal>qt5.qtbase</literal>, so that <varname>callPackage</varname> can do its work. <emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal> into your package; although it may work fine in the moment, it could well break at the next Qt update.</para>
|
||||
|
||||
<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>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-qt-programs"><title>Programs</title>
|
||||
<section xml:id="ssec-qt-applications"><title>Applications</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>Applications generally do not need to be built with every Qt version because they do not provide any libraries for dependent packages to link against. The primary consideration is merely ensuring that the application itself and its dependencies are linked against only one version of Qt. To call your application expression, use <literal>libsForQt5.callPackage</literal> instead of <literal>callPackage</literal>. Dependencies should be imported 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> into your package; although it may work fine in the moment, it could well break at the next Qt update.</para>
|
||||
|
||||
<para>Several environment variables must be set at runtime for Qt
|
||||
applications to function correctly, including:</para>
|
||||
<para>It is generally best to build an application package against 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.</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>
|
||||
<para>Qt-based applications require that several paths be set at runtime. This is accomplished by wrapping the provided executables in a package with <literal>wrapQtProgram</literal> or <literal>makeQtWrapper</literal> during the <literal>postFixup</literal> phase. To use the wrapper generators, add <literal>makeQtWrapper</literal> to <literal>nativeBuildInputs</literal>. The wrapper generators support the same options as <literal>wrapProgram</literal> and <literal>makeWrapper</literal> respectively. It is usually only necessary to generate wrappers for programs intended to be invoked by the user.</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="ssec-qt-kde"><title>KDE</title>
|
||||
|
||||
<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>
|
||||
<para>The KDE Frameworks are a set of libraries for Qt 5 which form the basis of the Plasma desktop environment and the KDE Applications suite. Packaging a Frameworks-based library does not require any steps beyond those described above for general Qt-based libraries. Frameworks-based applications should not use <literal>makeQtWrapper</literal>; instead, use <literal>kdeWrapper</literal> to create the necessary wrappers: <literal>kdeWrapper { unwrapped = <replaceable>expr</replaceable>; targets = <replaceable>exes</replaceable>; }</literal>, where <replaceable>expr</replaceable> is the un-wrapped package expression and <replaceable>exes</replaceable> is a list of strings giving the relative paths to programs in the package which should be wrapped.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
@ -16,8 +16,7 @@ $ cd sensu
|
||||
$ cat > Gemfile
|
||||
source 'https://rubygems.org'
|
||||
gem 'sensu'
|
||||
$ nix-shell -p bundler --command "bundler package --path /tmp/vendor/bundle"
|
||||
$ $(nix-build '<nixpkgs>' -A bundix)/bin/bundix
|
||||
$ $(nix-build '<nixpkgs>' -A bundix)/bin/bundix --magic
|
||||
$ cat > default.nix
|
||||
{ lib, bundlerEnv, ruby }:
|
||||
|
||||
@ -47,7 +46,7 @@ bundlerEnv rec {
|
||||
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>
|
||||
run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> like this:</para>
|
||||
|
||||
<programlisting>
|
||||
<.
|
||||
|
||||
## 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/).
|
102
doc/languages-frameworks/vim.md
Normal file
102
doc/languages-frameworks/vim.md
Normal file
@ -0,0 +1,102 @@
|
||||
---
|
||||
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.
|
||||
|
||||
VAM (=vim-addon-manager) and Pathogen plugin managers are supported.
|
||||
Vundle, NeoBundle could be your turn.
|
||||
|
||||
## dependencies by Vim plugins
|
||||
|
||||
VAM introduced .json files supporting dependencies without versioning
|
||||
assuming that "using latest version" is ok most of the time.
|
||||
|
||||
## HOWTO
|
||||
|
||||
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,6 +13,7 @@
|
||||
<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" />
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
<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>
|
||||
|
@ -61,7 +61,7 @@ stdenv.mkDerivation {
|
||||
builder = ./builder.sh;
|
||||
src = fetchurl {
|
||||
url = http://ftp.nluug.nl/gnu/binutils/binutils-2.16.1.tar.bz2;
|
||||
md5 = "6a9d529efb285071dad10e1f3d2b2967";
|
||||
sha256 = "1ian3kwh2vg6hr3ymrv48s04gijs539vzrq62xr76bxbhbwnz2np";
|
||||
};
|
||||
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.4-arm";
|
||||
name = "linux-headers-2.6.13.1-arm";
|
||||
builder = ./builder.sh;
|
||||
src = fetchurl {
|
||||
url = http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.4.tar.bz2;
|
||||
md5 = "94768d7eef90a9d8174639b2a7d3f58d";
|
||||
url = http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.1.tar.bz2;
|
||||
sha256 = "12qxmc827fjhaz53kjy7vyrzsaqcg78amiqsb3qm20z26w705lma";
|
||||
};
|
||||
}
|
||||
---
|
||||
@ -152,9 +152,7 @@ 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;
|
||||
md5 = "f7781398ada62ba255486673e6274b26";
|
||||
#url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.0.2/gcc-4.0.2.tar.bz2;
|
||||
#md5 = "a659b8388cac9db2b13e056e574ceeb0";
|
||||
sha256 = "02fxh0asflm8825w23l2jq1wvs7hbnam0jayrivg7zdv2ifnc0rc";
|
||||
};
|
||||
# !!! apply only if noSysDirs is set
|
||||
patches = [./no-sys-dirs.patch ./gcc-inhibit.patch];
|
||||
|
@ -28,13 +28,13 @@ first one present is considered, and all the rest are ignored:
|
||||
|
||||
<listitem>
|
||||
|
||||
<para>In the directory pointed by the environment variable
|
||||
<varname>NIXPKGS_OVERLAYS</varname>.</para>
|
||||
<para>In the directory pointed to by the Nix search path entry
|
||||
<literal><nixpkgs-overlays></literal>.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
<para>In the directory <filename>~/.nixpkgs/overlays/</filename>.</para>
|
||||
<para>In the directory <filename>~/.config/nixpkgs/overlays/</filename>.</para>
|
||||
</listitem>
|
||||
|
||||
</orderedlist>
|
||||
@ -50,7 +50,7 @@ the same recipe. In the case where overlays are loaded from a directory, they ar
|
||||
alphabetical order.</para>
|
||||
|
||||
<para>To install an overlay using the last option, you can clone the overlay's repository and add
|
||||
a symbolic link to it in <filename>~/.nixpkgs/overlays/</filename> directory.</para>
|
||||
a symbolic link to it in <filename>~/.config/nixpkgs/overlays/</filename> directory.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
@ -278,7 +278,7 @@ packageOverrides = pkgs: {
|
||||
</screen>
|
||||
|
||||
to your Nixpkgs configuration
|
||||
(<filename>~/.nixpkgs/config.nix</filename>) and install it by
|
||||
(<filename>~/.config/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
|
||||
|
132
doc/stdenv.xml
132
doc/stdenv.xml
@ -194,33 +194,52 @@ 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
|
||||
<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>
|
||||
<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>
|
||||
</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 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>
|
||||
<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>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
@ -322,7 +341,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
|
||||
@ -706,7 +725,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>
|
||||
|
||||
@ -773,7 +792,7 @@ doCheck = true;</programlisting>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@ -840,12 +859,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>
|
||||
|
||||
@ -1091,13 +1110,41 @@ 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
|
||||
@ -1125,7 +1172,7 @@ functions.</para>
|
||||
<literal>@<replaceable>...</replaceable>@</literal> in the
|
||||
template as placeholders.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--subst-var-by</option>
|
||||
<replaceable>varName</replaceable>
|
||||
@ -1134,7 +1181,7 @@ functions.</para>
|
||||
<literal>@<replaceable>varName</replaceable>@</literal> by
|
||||
the string <replaceable>s</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
@ -1162,7 +1209,7 @@ substitute ./foo.in ./foo.out \
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-substituteInPlace'>
|
||||
<term><function>substituteInPlace</function>
|
||||
@ -1173,7 +1220,7 @@ substitute ./foo.in ./foo.out \
|
||||
<replaceable>file</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
|
||||
<varlistentry xml:id='fun-substituteAll'>
|
||||
<term><function>substituteAll</function>
|
||||
<replaceable>infile</replaceable>
|
||||
@ -1233,7 +1280,7 @@ echo @foo@
|
||||
<listitem><para>Strips the directory and hash part of a store
|
||||
path, outputting the name part to <literal>stdout</literal>.
|
||||
For example:
|
||||
|
||||
|
||||
<programlisting>
|
||||
# prints coreutils-8.24
|
||||
stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
||||
@ -1241,7 +1288,7 @@ stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
||||
|
||||
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)
|
||||
@ -1249,8 +1296,24 @@ someVar=$(stripHash $name)
|
||||
|
||||
</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>
|
||||
@ -1607,4 +1670,3 @@ Arch Wiki</link>.
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
# Operations on attribute sets.
|
||||
|
||||
with {
|
||||
let
|
||||
inherit (builtins) head tail length;
|
||||
inherit (import ./trivial.nix) or;
|
||||
inherit (import ./trivial.nix) and 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 recursivelly by removing all attributes for
|
||||
/* Filter an attribute set recursively by removing all attributes for
|
||||
which the given predicate return false.
|
||||
|
||||
Example:
|
||||
@ -334,7 +334,7 @@ rec {
|
||||
value = f name (catAttrs name sets);
|
||||
}) names);
|
||||
|
||||
/* Implentation note: Common names appear multiple times in the list of
|
||||
/* Implementation 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 +353,7 @@ rec {
|
||||
zipAttrs = zipAttrsWith (name: values: values);
|
||||
|
||||
/* Does the same as the update operator '//' except that attributes are
|
||||
merged until the given pedicate is verified. The predicate should
|
||||
merged until the given predicate 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
|
||||
@ -417,18 +417,15 @@ rec {
|
||||
|
||||
/* Returns true if the pattern is contained in the set. False otherwise.
|
||||
|
||||
FIXME(zimbatm): this example doesn't work !!!
|
||||
|
||||
Example:
|
||||
sys = mkSystem { }
|
||||
matchAttrs { cpu = { bits = 64; }; } sys
|
||||
matchAttrs { cpu = {}; } { cpu = { bits = 64; }; }
|
||||
=> true
|
||||
*/
|
||||
matchAttrs = pattern: attrs:
|
||||
fold or false (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
|
||||
matchAttrs = pattern: attrs: assert isAttrs pattern;
|
||||
fold and true (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 head values
|
||||
else if isAttrs pat then isAttrs val && matchAttrs pat val
|
||||
else pat == val
|
||||
) [pattern attrs]));
|
||||
|
||||
|
@ -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 burried in mergeAttrBy
|
||||
# * some "features" such as exact merge behaviour are buried 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 featuers" is modular. For instance:
|
||||
# declaring "optional features" 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 overriden
|
||||
derivation in which the attributes of the original are overridden
|
||||
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 ~/.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 ~/.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:
|
||||
|
||||
mySed = overrideDerivation pkgs.gnused (oldAttrs: {
|
||||
name = "sed-4.2.2-pre";
|
||||
@ -106,11 +106,9 @@ rec {
|
||||
let
|
||||
f = if builtins.isFunction fn then fn else import fn;
|
||||
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
|
||||
finalArgs = auto // args;
|
||||
pkgs = f finalArgs;
|
||||
mkAttrOverridable = name: pkg: pkg // {
|
||||
override = newArgs: mkAttrOverridable name (f (finalArgs // newArgs)).${name};
|
||||
};
|
||||
origArgs = auto // args;
|
||||
pkgs = f origArgs;
|
||||
mkAttrOverridable = name: pkg: makeOverridable (newArgs: (f newArgs).${name}) origArgs;
|
||||
in lib.mapAttrs mkAttrOverridable pkgs;
|
||||
|
||||
|
||||
@ -169,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
|
||||
`override' function allows subsequent modification of the package
|
||||
`overrideScope' 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
|
||||
@ -179,9 +177,10 @@ rec {
|
||||
let self = f self // {
|
||||
newScope = scope: newScope (self // scope);
|
||||
callPackage = self.newScope {};
|
||||
override = g: makeScope newScope (self_:
|
||||
let super = f self_;
|
||||
in super // g super self_);
|
||||
overrideScope = g:
|
||||
makeScope newScope
|
||||
(self_: let super = f self_; in super // g super self_);
|
||||
packages = f;
|
||||
};
|
||||
in self;
|
||||
|
||||
|
@ -24,10 +24,10 @@ rec {
|
||||
traceValSeq = v: traceVal (builtins.deepSeq 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} }"
|
||||
@ -43,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:
|
||||
@ -71,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,3 +1,8 @@
|
||||
/* Library of low-level helper functions for nix expressions.
|
||||
*
|
||||
* Please implement (mostly) exhaustive unit tests
|
||||
* for new functions in `./tests.nix'.
|
||||
*/
|
||||
let
|
||||
|
||||
# trivial, often used functions
|
||||
@ -22,8 +27,7 @@ let
|
||||
|
||||
# constants
|
||||
licenses = import ./licenses.nix;
|
||||
platforms = import ./platforms.nix;
|
||||
systems = import ./systems.nix;
|
||||
systems = import ./systems;
|
||||
|
||||
# misc
|
||||
debug = import ./debug.nix;
|
||||
@ -34,18 +38,23 @@ let
|
||||
sandbox = import ./sandbox.nix;
|
||||
fetchers = import ./fetchers.nix;
|
||||
|
||||
# Eval-time filesystem handling
|
||||
filesystem = import ./filesystem.nix;
|
||||
|
||||
in
|
||||
{ inherit trivial
|
||||
attrsets lists strings stringsWithDeps
|
||||
customisation maintainers meta sources
|
||||
modules options types
|
||||
licenses platforms systems
|
||||
licenses systems
|
||||
debug generators misc
|
||||
sandbox fetchers;
|
||||
sandbox fetchers filesystem;
|
||||
|
||||
# back-compat aliases
|
||||
platforms = systems.doubles;
|
||||
}
|
||||
# !!! don't include everything at top-level; perhaps only the most
|
||||
# commonly used functions.
|
||||
// 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 exisits in both attributes
|
||||
# merges attributes using //, if a name exists 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 does'nt really make sense. The cases will be rare where appending /prefixing will fit your needs?
|
||||
# merging buildPhase doesn't 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
|
||||
@ -313,9 +313,9 @@ rec {
|
||||
#
|
||||
# This function is best explained by an example:
|
||||
#
|
||||
# {version ? "2.x"} :
|
||||
# {version ? "2.x"}:
|
||||
#
|
||||
# mkDerivation (mergeAttrsByVersion "package-name" version
|
||||
# mkDerivation (mergeAttrsByVersion "package-name" version
|
||||
# { # version specific settings
|
||||
# "git" = { src = ..; preConfigre = "autogen.sh"; buildInputs = [automake autoconf libtool]; };
|
||||
# "2.x" = { src = ..; };
|
||||
@ -346,21 +346,24 @@ rec {
|
||||
# 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)];
|
||||
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;
|
||||
@ -392,10 +395,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
# snippets that can be shared by mutliple fetchers (pkgs/build-support)
|
||||
# snippets that can be shared by multiple fetchers (pkgs/build-support)
|
||||
{
|
||||
|
||||
proxyImpureEnvVars = [
|
||||
|
44
lib/filesystem.nix
Normal file
44
lib/filesystem.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{ # 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);
|
||||
}
|
@ -191,6 +191,11 @@ 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";
|
||||
@ -352,6 +357,11 @@ 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 {
|
||||
@ -374,6 +384,11 @@ 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";
|
||||
@ -516,6 +531,11 @@ 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";
|
||||
|
@ -16,17 +16,22 @@ rec {
|
||||
*/
|
||||
singleton = x: [x];
|
||||
|
||||
/* "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).
|
||||
/* “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
|
||||
|
||||
Example:
|
||||
concat = fold (a: b: a + b) "z"
|
||||
concat = foldr (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"
|
||||
*/
|
||||
fold = op: nul: list:
|
||||
foldr = op: nul: list:
|
||||
let
|
||||
len = length list;
|
||||
fold' = n:
|
||||
@ -35,13 +40,25 @@ rec {
|
||||
else op (elemAt list n) (fold' (n + 1));
|
||||
in fold' 0;
|
||||
|
||||
/* Left fold: `fold op nul [x_1 x_2 ... x_n] == op (... (op (op nul
|
||||
x_1) x_2) ... x_n)'.
|
||||
/* `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
|
||||
|
||||
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
|
||||
@ -52,7 +69,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
|
||||
@ -140,7 +157,7 @@ rec {
|
||||
any isString [ 1 { } ]
|
||||
=> false
|
||||
*/
|
||||
any = builtins.any or (pred: fold (x: y: if pred x then true else y) false);
|
||||
any = builtins.any or (pred: foldr (x: y: if pred x then true else y) false);
|
||||
|
||||
/* Return true iff function `pred' returns true for all elements of
|
||||
`list'.
|
||||
@ -151,7 +168,7 @@ rec {
|
||||
all (x: x < 3) [ 1 2 3 ]
|
||||
=> false
|
||||
*/
|
||||
all = builtins.all or (pred: fold (x: y: if pred x then y else false) true);
|
||||
all = builtins.all or (pred: foldr (x: y: if pred x then y else false) true);
|
||||
|
||||
/* Count how many times function `pred' returns true for the elements
|
||||
of `list'.
|
||||
@ -174,7 +191,7 @@ rec {
|
||||
*/
|
||||
optional = cond: elem: if cond then [elem] else [];
|
||||
|
||||
/* Return a list or an empty list, dependening on a boolean value.
|
||||
/* Return a list or an empty list, depending on a boolean value.
|
||||
|
||||
Example:
|
||||
optionals true [ 2 3 ]
|
||||
@ -219,7 +236,7 @@ rec {
|
||||
=> { right = [ 5 3 4 ]; wrong = [ 1 2 ]; }
|
||||
*/
|
||||
partition = builtins.partition or (pred:
|
||||
fold (h: t:
|
||||
foldr (h: t:
|
||||
if pred h
|
||||
then { right = [h] ++ t.right; wrong = t.wrong; }
|
||||
else { right = t.right; wrong = [h] ++ t.wrong; }
|
||||
|
@ -14,15 +14,18 @@
|
||||
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>";
|
||||
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>";
|
||||
@ -40,6 +43,7 @@
|
||||
andsild = "Anders Sildnes <andsild@gmail.com>";
|
||||
aneeshusa = "Aneesh Agrawal <aneeshusa@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>";
|
||||
@ -57,8 +61,8 @@
|
||||
bachp = "Pascal Bach <pascal.bach@nextrem.ch>";
|
||||
badi = "Badi' Abdul-Wahid <abdulwahidc@gmail.com>";
|
||||
balajisivaraman = "Balaji Sivaraman<sivaraman.balaji@gmail.com>";
|
||||
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>";
|
||||
@ -70,6 +74,7 @@
|
||||
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>";
|
||||
@ -80,10 +85,13 @@
|
||||
bzizou = "Bruno Bzeznik <Bruno@bzizou.net>";
|
||||
c0dehero = "CodeHero <codehero@nerdpol.ch>";
|
||||
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>";
|
||||
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>";
|
||||
@ -99,6 +107,7 @@
|
||||
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>";
|
||||
@ -111,6 +120,7 @@
|
||||
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>";
|
||||
@ -129,15 +139,20 @@
|
||||
dgonyeo = "Derek Gonyeo <derek@gonyeo.com>";
|
||||
dipinhora = "Dipin Hora <dipinhora+github@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>";
|
||||
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>";
|
||||
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>";
|
||||
@ -149,6 +164,7 @@
|
||||
eleanor = "Dejan Lukan <dejan@proteansec.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>";
|
||||
@ -173,12 +189,14 @@
|
||||
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>";
|
||||
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>";
|
||||
@ -197,28 +215,37 @@
|
||||
havvy = "Ryan Scheel <ryan.havvy@gmail.com>";
|
||||
hbunke = "Hendrik Bunke <bunke.hendrik@gmail.com>";
|
||||
hce = "Hans-Christian Esperer <hc@hcesperer.org>";
|
||||
heel = "Sergii Paryzhskyi <parizhskiy@gmail.com>";
|
||||
henrytill = "Henry Till <henrytill@gmail.com>";
|
||||
hinton = "Tom Hinton <t@larkery.com>";
|
||||
hodapp = "Chris Hodapp <hodapp87@gmail.com>";
|
||||
hrdinka = "Christoph Hrdinka <c.nix@hrdinka.at>";
|
||||
iand675 = "Ian Duncan <ian@iankduncan.com>";
|
||||
ianwookim = "Ian-Woo Kim <ianwookim@gmail.com>";
|
||||
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 <bill@casarin.me>";
|
||||
jbedo = "Justin Bedő <cu@cua0.org>";
|
||||
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>";
|
||||
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>";
|
||||
@ -227,6 +254,8 @@
|
||||
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>";
|
||||
juliendehos = "Julien Dehos <dehos@lisic.univ-littoral.fr>";
|
||||
jwiegley = "John Wiegley <johnw@newartisans.com>";
|
||||
@ -244,6 +273,7 @@
|
||||
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>";
|
||||
@ -270,6 +300,8 @@
|
||||
luispedro = "Luis Pedro Coelho <luis@luispedro.org>";
|
||||
lukego = "Luke Gorrie <luke@snabb.co>";
|
||||
lw = "Sergey Sofeychuk <lw@fmap.me>";
|
||||
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>";
|
||||
@ -290,16 +322,19 @@
|
||||
mbbx6spp = "Susan Potter <me@susanpotter.net>";
|
||||
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@higgsboson.tk>";
|
||||
mic92 = "Jörg Thalheim <joerg@thalheim.io>";
|
||||
michaelpj = "Michael Peyton Jones <michaelpj@gmail.com>";
|
||||
michalrus = "Michal Rus <m@michalrus.com>";
|
||||
michelk = "Michel Kuhlmann <michel@kuhlmanns.info>";
|
||||
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>";
|
||||
@ -320,6 +355,7 @@
|
||||
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>";
|
||||
@ -329,16 +365,21 @@
|
||||
Nate-Devv = "Nathan Moore <natedevv@gmail.com>";
|
||||
nathan-gs = "Nathan Bijnens <nathan@nathan.gs>";
|
||||
nckx = "Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>";
|
||||
ndowens = "Nathan Owens <ndowens04@gmail.com>";
|
||||
neeasade = "Nathan Isom <nathanisom27@gmail.com>";
|
||||
nequissimus = "Tim Steinbach <tim@nequissimus.com>";
|
||||
nfjinjing = "Jinjing Wang <nfjinjing@gmail.com>";
|
||||
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>";
|
||||
np = "Nicolas Pouillard <np.nix@nicolaspouillard.fr>";
|
||||
nslqqq = "Nikita Mikhailov <nslqqq@gmail.com>";
|
||||
nthorne = "Niklas Thörne <notrupertthorne@gmail.com>";
|
||||
obadz = "obadz <obadz-nixos@obadz.com>";
|
||||
ocharles = "Oliver Charles <ollie@ocharles.org.uk>";
|
||||
odi = "Oliver Dunkl <oliver.dunkl@gmail.com>";
|
||||
@ -349,14 +390,19 @@
|
||||
olejorgenb = "Ole Jørgen Brønner <olejorgenb@yahoo.no>";
|
||||
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>";
|
||||
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>";
|
||||
@ -366,15 +412,18 @@
|
||||
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>";
|
||||
@ -400,8 +449,10 @@
|
||||
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>";
|
||||
@ -411,8 +462,9 @@
|
||||
roblabla = "Robin Lambertz <robinlambertz+dev@gmail.com>";
|
||||
roconnor = "Russell O'Connor <roconnor@theorem.ca>";
|
||||
romildo = "José Romildo Malaquias <malaquias@gmail.com>";
|
||||
ronny = "Ronny Pfannschmidt <nixos@ronnypfannschmidt.de>";
|
||||
rszibele = "Richard Szibele <richard_szibele@hotmail.com>";
|
||||
rongcuid = "Rongcui Dong <rongcuid@outlook.com>";
|
||||
rszibele = "Richard Szibele <richard@szibele.com>";
|
||||
rtreffer = "Rene Treffer <treffer+nixos@measite.de>";
|
||||
rushmorem = "Rushmore Mushambi <rushmore@webenchanter.com>";
|
||||
rvl = "Rodney Lorrimar <dev+nix@rodney.id.au>";
|
||||
rvlander = "Gaëtan André <rvlander@gaetanandre.eu>";
|
||||
@ -421,20 +473,25 @@
|
||||
ryantm = "Ryan Mulligan <ryan@ryantm.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>";
|
||||
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>";
|
||||
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>";
|
||||
@ -443,6 +500,7 @@
|
||||
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>";
|
||||
solson = "Scott Olson <scott@solson.me>";
|
||||
spacefrogg = "Michael Raitza <spacefrogg-nixos@meterriblecrew.net>";
|
||||
spencerjanssen = "Spencer Janssen <spencerjanssen@gmail.com>";
|
||||
@ -453,14 +511,19 @@
|
||||
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>";
|
||||
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>";
|
||||
@ -477,13 +540,14 @@
|
||||
travisbhartwell = "Travis B. Hartwell <nafai@travishartwell.net>";
|
||||
trino = "Hubert Mühlhans <muehlhans.hubert@ekodia.de>";
|
||||
tstrobel = "Thomas Strobel <4ZKTUB6TEP74PYJOPWIR013S2AV29YUBW5F9ZH2F4D5UMJUJ6S@hash.domains>";
|
||||
ttuegel = "Thomas Tuegel <ttuegel@gmail.com>";
|
||||
ttuegel = "Thomas Tuegel <ttuegel@mailbox.org>";
|
||||
tv = "Tomislav Viljetić <tv@shackspace.de>";
|
||||
tvestelind = "Tomas Vestelind <tomas.vestelind@fripost.org>";
|
||||
tvorog = "Marsel Zaripov <marszaripov@gmail.com>";
|
||||
twey = "James ‘Twey’ Kay <twey@twey.co.uk>";
|
||||
uralbash = "Svintsov Dmitry <root@uralbash.ru>";
|
||||
urkud = "Yury G. Kudryashov <urkud+nix@ya.ru>";
|
||||
utdemir = "Utku Demir <me@utdemir.com>";
|
||||
#urkud = "Yury G. Kudryashov <urkud+nix@ya.ru>"; inactive since 2012
|
||||
uwap = "uwap <me@uwap.name>";
|
||||
vandenoever = "Jos van den Oever <jos@vandenoever.info>";
|
||||
vanzef = "Ivan Solyankin <vanzef@gmail.com>";
|
||||
@ -492,11 +556,13 @@
|
||||
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>";
|
||||
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>";
|
||||
volhovm = "Mikhail Volkhov <volhovm.cs@gmail.com>";
|
||||
volth = "Jaroslavas Pocepko <jaroslavas@volth.com>";
|
||||
vozz = "Oliver Hunt <oliver.huntuk@gmail.com>";
|
||||
@ -511,11 +577,17 @@
|
||||
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>";
|
||||
zauberpony = "Elmar Athmer <elmar@athmer.org>";
|
||||
zef = "Zef Hemel <zef@zef.me>";
|
||||
zimbatm = "zimbatm <zimbatm@zimbatm.com>";
|
||||
|
@ -45,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
|
||||
@ -56,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
|
||||
|
@ -20,7 +20,8 @@ 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.
|
||||
# there's _module.args. If specialArgs.modulesPath is defined it will be
|
||||
# used as the base path for disabledModules.
|
||||
specialArgs ? {}
|
||||
, # This would be remove in the future, Prefer _module.args option instead.
|
||||
args ? {}
|
||||
@ -58,10 +59,7 @@ rec {
|
||||
|
||||
closed = closeModules (modules ++ [ internalModule ]) ({ inherit config options; lib = import ./.; } // specialArgs);
|
||||
|
||||
# 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);
|
||||
options = mergeModules prefix (reverseList (filterModules (specialArgs.modulesPath or "") closed));
|
||||
|
||||
# Traverse options and extract the option values into the final
|
||||
# config set. At the same time, check whether all option
|
||||
@ -87,6 +85,16 @@ 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
|
||||
@ -106,17 +114,18 @@ 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 ["imports" "options" "config" "key" "_file" "meta"]; in
|
||||
let badAttrs = removeAttrs m ["_file" "key" "disabledModules" "imports" "options" "config" "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 ];
|
||||
@ -124,9 +133,10 @@ 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 ["key" "_file" "require" "imports"]) metaSet ];
|
||||
config = mkMerge [ (removeAttrs m ["_file" "key" "disabledModules" "require" "imports"]) metaSet ];
|
||||
};
|
||||
|
||||
applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then
|
||||
@ -326,7 +336,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.name}.")
|
||||
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.description}.")
|
||||
(type.merge loc defsFinal) defsFinal;
|
||||
|
||||
isDefined = defsFinal != [];
|
||||
@ -413,7 +423,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 overriden by wrapping the property
|
||||
1000 by default, but can be overridden by wrapping the property
|
||||
using mkOrder. */
|
||||
sortProperties = defs:
|
||||
let
|
||||
@ -585,7 +595,7 @@ rec {
|
||||
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
|
||||
x.y.z to the result of the merge function
|
||||
*/
|
||||
mkMergedOptionModule = from: to: mergeFn:
|
||||
{ config, options, ... }:
|
||||
@ -601,12 +611,12 @@ rec {
|
||||
let val = getAttrFromPath f config;
|
||||
opt = getAttrFromPath f options;
|
||||
in
|
||||
optionalString
|
||||
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
|
||||
(optional
|
||||
(any (f: (getAttrFromPath f config) != "_mkMergedOptionModule") from)
|
||||
(mergeFn config)));
|
||||
};
|
||||
|
@ -1,24 +0,0 @@
|
||||
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"];
|
||||
}
|
@ -26,6 +26,12 @@ rec {
|
||||
|
||||
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
|
||||
|
@ -126,8 +126,8 @@ rec {
|
||||
*/
|
||||
makePerlPath = makeSearchPathOutput "lib" "lib/perl5/site_perl";
|
||||
|
||||
/* Dependening on the boolean `cond', return either the given string
|
||||
or the empty string. Useful to contatenate against a bigger string.
|
||||
/* Depending on the boolean `cond', return either the given string
|
||||
or the empty string. Useful to concatenate 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
|
||||
@ -476,10 +476,8 @@ rec {
|
||||
readPathsFromFile = rootPath: file:
|
||||
let
|
||||
root = toString rootPath;
|
||||
lines =
|
||||
builtins.map (lib.removeSuffix "\n")
|
||||
(lib.splitString "\n" (builtins.readFile file));
|
||||
removeComments = lib.filter (line: !(lib.hasPrefix "#" line));
|
||||
lines = lib.splitString "\n" (builtins.readFile file);
|
||||
removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line));
|
||||
relativePaths = removeComments lines;
|
||||
absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths;
|
||||
in
|
||||
|
126
lib/systems.nix
126
lib/systems.nix
@ -1,126 +0,0 @@
|
||||
# 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;
|
||||
}
|
23
lib/systems/default.nix
Normal file
23
lib/systems/default.nix
Normal file
@ -0,0 +1,23 @@
|
||||
rec {
|
||||
doubles = import ./doubles.nix;
|
||||
parse = import ./parse.nix;
|
||||
platforms = import ./platforms.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;
|
||||
} // args;
|
||||
in final;
|
||||
}
|
44
lib/systems/doubles.nix
Normal file
44
lib/systems/doubles.nix
Normal file
@ -0,0 +1,44 @@
|
||||
let lists = import ../lists.nix; in
|
||||
let parse = import ./parse.nix; in
|
||||
let inherit (import ../attrsets.nix) matchAttrs; in
|
||||
|
||||
let
|
||||
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 (matchAttrs { cpu = { family = "arm"; bits = 32; }; });
|
||||
i686 = filterDoubles parse.isi686;
|
||||
mips = filterDoubles (matchAttrs { cpu = { family = "mips"; }; });
|
||||
x86_64 = filterDoubles parse.isx86_64;
|
||||
|
||||
cygwin = filterDoubles parse.isCygwin;
|
||||
darwin = filterDoubles parse.isDarwin;
|
||||
freebsd = filterDoubles (matchAttrs { kernel = parse.kernels.freebsd; });
|
||||
gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); # Should be better
|
||||
illumos = filterDoubles (matchAttrs { kernel = parse.kernels.solaris; });
|
||||
linux = filterDoubles parse.isLinux;
|
||||
netbsd = filterDoubles (matchAttrs { kernel = parse.kernels.netbsd; });
|
||||
openbsd = filterDoubles (matchAttrs { kernel = parse.kernels.openbsd; });
|
||||
unix = filterDoubles parse.isUnix;
|
||||
|
||||
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux"];
|
||||
}
|
184
lib/systems/parse.nix
Normal file
184
lib/systems/parse.nix
Normal file
@ -0,0 +1,184 @@
|
||||
# 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;
|
||||
|
||||
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 = "arm"; };
|
||||
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 = "powerpc"; };
|
||||
};
|
||||
|
||||
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 = {};
|
||||
unix = {};
|
||||
};
|
||||
|
||||
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 = { inherit unix; }; };
|
||||
freebsd = { execFormat = elf; families = { inherit unix bsd; }; };
|
||||
linux = { execFormat = elf; families = { inherit unix; }; };
|
||||
netbsd = { execFormat = elf; families = { inherit unix bsd; }; };
|
||||
none = { execFormat = unknown; families = { inherit unix; }; };
|
||||
openbsd = { execFormat = elf; families = { inherit unix bsd; }; };
|
||||
solaris = { execFormat = elf; families = { inherit unix; }; };
|
||||
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;
|
||||
};
|
||||
|
||||
is64Bit = matchAttrs { cpu = { bits = 64; }; };
|
||||
is32Bit = matchAttrs { cpu = { bits = 32; }; };
|
||||
isi686 = matchAttrs { cpu = cpuTypes.i686; };
|
||||
isx86_64 = matchAttrs { cpu = cpuTypes.x86_64; };
|
||||
|
||||
isDarwin = matchAttrs { kernel = kernels.darwin; };
|
||||
isLinux = matchAttrs { kernel = kernels.linux; };
|
||||
isUnix = matchAttrs { kernel = { families = { inherit (kernelFamilies) unix; }; }; };
|
||||
isWindows = matchAttrs { kernel = kernels.windows; };
|
||||
isCygwin = matchAttrs { kernel = kernels.windows; abi = abis.cygnus; };
|
||||
isMinGW = matchAttrs { kernel = kernels.windows; abi = abis.gnu; };
|
||||
|
||||
|
||||
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 { 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}");
|
||||
|
||||
system = rec {
|
||||
cpu = getCpu args.cpu;
|
||||
vendor =
|
||||
/**/ if args ? vendor then getVendor args.vendor
|
||||
else if isDarwin system then vendors.apple
|
||||
else if isWindows system then vendors.pc
|
||||
else vendors.unknown;
|
||||
kernel = getKernel args.kernel;
|
||||
abi =
|
||||
/**/ if args ? abi then getAbi args.abi
|
||||
else if isLinux system then abis.gnu
|
||||
else if isWindows system then abis.gnu
|
||||
else abis.unknown;
|
||||
};
|
||||
|
||||
in mkSystem system;
|
||||
|
||||
mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s));
|
||||
|
||||
doubleFromSystem = { cpu, vendor, kernel, abi, ... }:
|
||||
if vendor == kernels.windows && 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}";
|
||||
|
||||
}
|
556
lib/systems/platforms.nix
Normal file
556
lib/systems/platforms.nix
Normal file
@ -0,0 +1,556 @@
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
|
||||
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
|
||||
'';
|
||||
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;
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
# to run these tests:
|
||||
# nix-instantiate --eval --strict nixpkgs/lib/tests/misc.nix
|
||||
# if the resulting list is empty, all tests passed
|
||||
let inherit (builtins) add; in
|
||||
with import ./default.nix;
|
||||
with import ../default.nix;
|
||||
|
||||
runTests {
|
||||
|
||||
|
||||
# TRIVIAL
|
||||
|
||||
testId = {
|
||||
expr = id 1;
|
||||
expected = 1;
|
||||
@ -30,6 +36,18 @@ runTests {
|
||||
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;";
|
||||
@ -40,15 +58,71 @@ runTests {
|
||||
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" "" ];
|
||||
};
|
||||
|
||||
# LISTS
|
||||
|
||||
testFilter = {
|
||||
expr = filter (x: x != "a") ["a" "b" "c" "a"];
|
||||
expected = ["b" "c"];
|
||||
};
|
||||
|
||||
testFold = {
|
||||
expr = fold (builtins.add) 0 (range 0 100);
|
||||
expected = 5050;
|
||||
};
|
||||
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 ]))
|
||||
@ -66,45 +140,6 @@ runTests {
|
||||
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];
|
||||
@ -131,9 +166,9 @@ runTests {
|
||||
};
|
||||
|
||||
|
||||
/* Generator tests */
|
||||
# these tests assume attributes are converted to lists
|
||||
# in alphabetical order
|
||||
# GENERATORS
|
||||
# these tests assume attributes are converted to lists
|
||||
# in alphabetical order
|
||||
|
||||
testMkKeyValueDefault = {
|
||||
expr = generators.mkKeyValueDefault ":" "f:oo" "bar";
|
||||
@ -204,7 +239,7 @@ runTests {
|
||||
};
|
||||
in {
|
||||
expr = generators.toJSON {} val;
|
||||
# trival implementation
|
||||
# trivial implementation
|
||||
expected = builtins.toJSON val;
|
||||
};
|
||||
|
||||
@ -216,8 +251,49 @@ runTests {
|
||||
};
|
||||
in {
|
||||
expr = generators.toYAML {} val;
|
||||
# trival implementation
|
||||
# trivial implementation
|
||||
expected = builtins.toJSON val;
|
||||
};
|
||||
|
||||
# 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 = 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;
|
||||
};
|
||||
|
||||
}
|
@ -99,6 +99,14 @@ 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.*:' "$@"
|
||||
@ -115,6 +123,11 @@ 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
|
||||
|
10
lib/tests/modules/declare-coerced-value.nix
Normal file
10
lib/tests/modules/declare-coerced-value.nix
Normal file
@ -0,0 +1,10 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options = {
|
||||
value = lib.mkOption {
|
||||
default = 42;
|
||||
type = lib.types.coercedTo lib.types.int builtins.toString lib.types.str;
|
||||
};
|
||||
};
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
{ lib ? import <nixpkgs/lib>, modules ? [] }:
|
||||
{ lib ? import ../.., modules ? [] }:
|
||||
|
||||
{
|
||||
inherit (lib.evalModules {
|
||||
inherit modules;
|
||||
specialArgs.modulesPath = ./.;
|
||||
}) config options;
|
||||
}
|
||||
|
3
lib/tests/modules/define-value-list.nix
Normal file
3
lib/tests/modules/define-value-list.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
value = [];
|
||||
}
|
3
lib/tests/modules/define-value-string.nix
Normal file
3
lib/tests/modules/define-value-string.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
value = "24";
|
||||
}
|
5
lib/tests/modules/disable-declare-enable.nix
Normal file
5
lib/tests/modules/disable-declare-enable.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ ./declare-enable.nix ];
|
||||
}
|
5
lib/tests/modules/disable-define-enable.nix
Normal file
5
lib/tests/modules/disable-define-enable.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ ./define-enable.nix ];
|
||||
}
|
5
lib/tests/modules/disable-enable-modules.nix
Normal file
5
lib/tests/modules/disable-enable-modules.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ "define-enable.nix" "declare-enable.nix" ];
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
{ nixpkgs }:
|
||||
{ pkgs ? import ((import ../../lib).cleanSource ../..) {} }:
|
||||
|
||||
with import ../.. { };
|
||||
with lib;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "nixpkgs-lib-tests";
|
||||
buildInputs = [ nix ];
|
||||
NIX_PATH="nixpkgs=${nixpkgs}";
|
||||
buildInputs = [ pkgs.nix ];
|
||||
NIX_PATH="nixpkgs=${pkgs.path}";
|
||||
|
||||
buildCommand = ''
|
||||
datadir="${nix}/share"
|
||||
datadir="${pkgs.nix}/share"
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
@ -23,9 +20,13 @@ stdenv.mkDerivation {
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
nix-store --init
|
||||
|
||||
cd ${nixpkgs}/lib/tests
|
||||
cd ${pkgs.path}/lib/tests
|
||||
./modules.sh
|
||||
|
||||
[[ "$(nix-instantiate --eval --strict misc.nix)" == "[ ]" ]]
|
||||
|
||||
[[ "$(nix-instantiate --eval --strict systems.nix)" == "[ ]" ]]
|
||||
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
|
31
lib/tests/systems.nix
Normal file
31
lib/tests/systems.nix
Normal file
@ -0,0 +1,31 @@
|
||||
# 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));
|
||||
}
|
@ -1,17 +1,49 @@
|
||||
rec {
|
||||
|
||||
# Identity function.
|
||||
/* The identity function
|
||||
For when you need a function that does “nothing”.
|
||||
|
||||
Type: id :: a -> a
|
||||
*/
|
||||
id = x: x;
|
||||
|
||||
# Constant function.
|
||||
/* 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
|
||||
*/
|
||||
const = x: y: x;
|
||||
|
||||
# Named versions corresponding to some builtin operators.
|
||||
|
||||
## Named versions corresponding to some builtin operators.
|
||||
|
||||
/* Concat two strings */
|
||||
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:
|
||||
@ -24,6 +56,8 @@ rec {
|
||||
# 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;
|
||||
@ -53,6 +87,15 @@ rec {
|
||||
# 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: { })
|
||||
@ -81,6 +124,9 @@ rec {
|
||||
# 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
|
||||
@ -102,25 +148,7 @@ rec {
|
||||
min = x: y: if x < y then x else y;
|
||||
max = x: y: if x > y then x else y;
|
||||
|
||||
/* Reads a JSON file. It is useful to import pure data into other nix
|
||||
expressions.
|
||||
|
||||
Example:
|
||||
|
||||
mkDerivation {
|
||||
src = fetchgit (importJSON ./repo.json)
|
||||
#...
|
||||
}
|
||||
|
||||
where repo.json contains:
|
||||
|
||||
{
|
||||
"url": "git://some-domain/some/repo",
|
||||
"rev": "265de7283488964f44f0257a8b4a055ad8af984d",
|
||||
"sha256": "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h"
|
||||
}
|
||||
|
||||
*/
|
||||
/* Reads a JSON file. */
|
||||
importJSON = path:
|
||||
builtins.fromJSON (builtins.readFile path);
|
||||
|
||||
|
@ -6,7 +6,7 @@ with import ./attrsets.nix;
|
||||
with import ./options.nix;
|
||||
with import ./trivial.nix;
|
||||
with import ./strings.nix;
|
||||
with {inherit (import ./modules.nix) mergeDefinitions filterOverrides; };
|
||||
let inherit (import ./modules.nix) mergeDefinitions filterOverrides; in
|
||||
|
||||
rec {
|
||||
|
||||
@ -52,7 +52,7 @@ rec {
|
||||
{ # Human-readable representation of the type, should be equivalent to
|
||||
# the type function name.
|
||||
name
|
||||
, # Description of the type, defined recursively by embedding the the wrapped type if any.
|
||||
, # 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.
|
||||
@ -81,7 +81,7 @@ rec {
|
||||
# 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
|
||||
# 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
|
||||
@ -352,6 +352,28 @@ rec {
|
||||
functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
|
||||
};
|
||||
|
||||
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.
|
||||
|
@ -1,14 +0,0 @@
|
||||
*~
|
||||
,*
|
||||
.*.swp
|
||||
.*.swo
|
||||
result
|
||||
result-*
|
||||
/doc/NEWS.html
|
||||
/doc/NEWS.txt
|
||||
/doc/manual.html
|
||||
/doc/manual.pdf
|
||||
.version-suffix
|
||||
|
||||
.DS_Store
|
||||
.git
|
@ -1,12 +0,0 @@
|
||||
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"
|
||||
"tarball" "unstable" "darwin-tested"
|
||||
]
|
||||
|
94
maintainers/scripts/hydra-eval-failures.py
Executable file
94
maintainers/scripts/hydra-eval-failures.py
Executable file
@ -0,0 +1,94 @@
|
||||
#!/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):
|
||||
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)]
|
||||
|
||||
|
||||
@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()
|
277
maintainers/scripts/nix-diff.sh
Executable file
277
maintainers/scripts/nix-diff.sh
Executable file
@ -0,0 +1,277 @@
|
||||
#!/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
|
@ -37,7 +37,4 @@ in
|
||||
vm = vmConfig.system.build.vm;
|
||||
|
||||
vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
|
||||
|
||||
# The following are used by nixos-rebuild.
|
||||
nixFallback = pkgs.nixUnstable.out;
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ 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>
|
||||
@ -97,8 +99,11 @@ 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";'
|
||||
# nixos-container update foo --config '
|
||||
services.httpd.enable = true;
|
||||
services.httpd.adminAddr = "foo@example.org";
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
'
|
||||
|
||||
# curl http://$(nixos-container show-ip foo)/
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">…
|
||||
|
@ -21,6 +21,7 @@ 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" />
|
||||
|
||||
|
@ -35,6 +35,12 @@ 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>
|
||||
|
@ -22,5 +22,25 @@ 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,6 +37,10 @@ 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,9 +36,8 @@ latter might look like this:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{ services.xserver.enable = true;
|
||||
services.xserver.displayManager.kdm.enable = true;
|
||||
services.xserver.desktopManager.kde4.enable = true;
|
||||
environment.systemPackages = [ pkgs.kde4.kscreensaver ];
|
||||
services.xserver.displayManager.sddm.enable = true;
|
||||
services.xserver.desktopManager.plasma5.enable = true;
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
|
@ -27,7 +27,11 @@ users.extraUsers.youruser.extraGroups = [ "networkmanager" ];
|
||||
<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.</para>
|
||||
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>
|
||||
|
||||
<note><para><code>networking.networkmanager</code> and
|
||||
<code>networking.wireless</code> (WPA Supplicant) cannot be enabled at the same
|
||||
|
@ -36,7 +36,10 @@ to set a password, which is retained across invocations of
|
||||
and /etc/group will be congruent to your NixOS configuration. For instance,
|
||||
if you remove a user from users.extraUsers and run nixos-rebuild, the user
|
||||
account will cease to exist. Also, imperative commands for managing users
|
||||
and groups, such as useradd, are no longer available.</para>
|
||||
and groups, such as useradd, are no longer available. Passwords may still be
|
||||
assigned by setting the user's <literal>hashedPassword</literal> option. A
|
||||
hashed password can be generated using <command>mkpasswd -m sha-512</command>
|
||||
after installing the <literal>mkpasswd</literal> package.</para>
|
||||
|
||||
<para>A user ID (uid) is assigned automatically. You can also specify
|
||||
a uid manually by adding
|
||||
|
@ -25,19 +25,23 @@ Otherwise, you can only log into a plain undecorated
|
||||
<command>xterm</command> window. Thus you should pick one or more of
|
||||
the following lines:
|
||||
<programlisting>
|
||||
services.xserver.desktopManager.kde4.enable = true;
|
||||
services.xserver.desktopManager.plasma5.enable = true;
|
||||
services.xserver.desktopManager.xfce.enable = true;
|
||||
services.xserver.desktopManager.gnome3.enable = true;
|
||||
services.xserver.windowManager.xmonad.enable = true;
|
||||
services.xserver.windowManager.twm.enable = true;
|
||||
services.xserver.windowManager.icewm.enable = true;
|
||||
services.xserver.windowManager.i3.enable = true;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>NixOS’s default <emphasis>display manager</emphasis> (the
|
||||
program that provides a graphical login prompt and manages the X
|
||||
server) is SLiM. You can select KDE’s <command>kdm</command> instead:
|
||||
server) is SLiM. You can select an alternative one by picking one
|
||||
of the following lines:
|
||||
<programlisting>
|
||||
services.xserver.displayManager.kdm.enable = true;
|
||||
services.xserver.displayManager.sddm.enable = true;
|
||||
services.xserver.displayManager.lightdm.enable = true;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
|
105
nixos/doc/manual/configuration/xfce.xml
Normal file
105
nixos/doc/manual/configuration/xfce.xml
Normal file
@ -0,0 +1,105 @@
|
||||
<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-xfce">
|
||||
|
||||
<title>Xfce Desktop Environment</title>
|
||||
|
||||
<para>
|
||||
To enable the Xfce Desktop Environment, set
|
||||
<programlisting>
|
||||
services.xserver.desktopManager = {
|
||||
xfce.enable = true;
|
||||
default = "xfce";
|
||||
};
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Optionally, <emphasis>compton</emphasis>
|
||||
can be enabled for nice graphical effects, some example settings:
|
||||
<programlisting>
|
||||
services.compton = {
|
||||
enable = true;
|
||||
fade = true;
|
||||
inactiveOpacity = "0.9";
|
||||
shadow = true;
|
||||
fadeDelta = 4;
|
||||
};
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Some Xfce programs are not installed automatically.
|
||||
To install them manually (system wide), put them into your
|
||||
<literal>environment.systemPackages</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
NixOS’s default <emphasis>display manager</emphasis> is SLiM.
|
||||
(DM is the program that provides a graphical login prompt
|
||||
and manages the X server.)
|
||||
You can, for example, select KDE’s
|
||||
<command>sddm</command> instead:
|
||||
<programlisting>
|
||||
services.xserver.displayManager.sddm.enable = true;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<simplesect>
|
||||
<title>Thunar Volume Support</title>
|
||||
|
||||
<para>
|
||||
To enable
|
||||
<emphasis>Thunar</emphasis>
|
||||
volume support, put
|
||||
<programlisting>
|
||||
services.xserver.desktopManager.xfce.enable = true;
|
||||
</programlisting>
|
||||
into your <emphasis>configuration.nix</emphasis>.
|
||||
</para>
|
||||
|
||||
</simplesect>
|
||||
|
||||
<simplesect>
|
||||
<title>Polkit Authentication Agent</title>
|
||||
|
||||
<para>
|
||||
There is no authentication agent automatically installed alongside
|
||||
Xfce. To allow mounting of local (non-removable) filesystems, you
|
||||
will need to install one.
|
||||
|
||||
Installing <emphasis>polkit_gnome</emphasis>, a rebuild, logout and
|
||||
login did the trick.
|
||||
</para>
|
||||
|
||||
</simplesect>
|
||||
|
||||
<simplesect>
|
||||
<title>Troubleshooting</title>
|
||||
|
||||
<para>
|
||||
Even after enabling udisks2, volume management might not work.
|
||||
Thunar and/or the desktop takes time to show up.
|
||||
|
||||
Thunar will spit out this kind of message on start
|
||||
(look at <command>journalctl --user -b</command>).
|
||||
|
||||
<programlisting>
|
||||
Thunar:2410): GVFS-RemoteVolumeMonitor-WARNING **: remote volume monitor with dbus name org.gtk.Private.UDisks2VolumeMonitor is not supported
|
||||
</programlisting>
|
||||
|
||||
This is caused by some needed GNOME services not running.
|
||||
This is all fixed by enabling "Launch GNOME services on startup" in
|
||||
the Advanced tab of the Session and Startup settings panel.
|
||||
Alternatively, you can run this command to do the same thing.
|
||||
<programlisting>
|
||||
$ xfconf-query -c xfce4-session -p /compat/LaunchGNOME -s true
|
||||
</programlisting>
|
||||
A log-out and re-log will be needed for this to take effect.
|
||||
</para>
|
||||
|
||||
</simplesect>
|
||||
|
||||
</chapter>
|
@ -65,22 +65,22 @@ options = {
|
||||
|
||||
</para>
|
||||
|
||||
<section xml:id="sec-option-declarations-eot"><title>Extensible Option
|
||||
<section xml:id="sec-option-declarations-eot"><title>Extensible Option
|
||||
Types</title>
|
||||
|
||||
<para>Extensible option types is a feature that allow to extend certain types
|
||||
<para>Extensible option types is a feature that allow to extend certain types
|
||||
declaration through multiple module files.
|
||||
This feature only work with a restricted set of types, namely
|
||||
This feature only work with a restricted set of types, namely
|
||||
<literal>enum</literal> and <literal>submodules</literal> and any composed
|
||||
forms of them.</para>
|
||||
|
||||
<para>Extensible option types can be used for <literal>enum</literal> options
|
||||
that affects multiple modules, or as an alternative to related
|
||||
<para>Extensible option types can be used for <literal>enum</literal> options
|
||||
that affects multiple modules, or as an alternative to related
|
||||
<literal>enable</literal> options.</para>
|
||||
|
||||
<para>As an example, we will take the case of display managers. There is a
|
||||
central display manager module for generic display manager options and a
|
||||
module file per display manager backend (slim, kdm, gdm ...).
|
||||
module file per display manager backend (slim, sddm, gdm ...).
|
||||
</para>
|
||||
|
||||
<para>There are two approach to this module structure:
|
||||
@ -96,7 +96,7 @@ options = {
|
||||
</para>
|
||||
|
||||
<para>Both approachs have problems.</para>
|
||||
|
||||
|
||||
<para>Making backends independent can quickly become hard to manage. For
|
||||
display managers, there can be only one enabled at a time, but the type
|
||||
system can not enforce this restriction as there is no relation between
|
||||
@ -108,18 +108,18 @@ options = {
|
||||
central module will require to change the central module option every time
|
||||
a new backend is added or removed.</para>
|
||||
|
||||
<para>By using extensible option types, it is possible to create a placeholder
|
||||
option in the central module (<xref linkend='ex-option-declaration-eot-service'
|
||||
/>), and to extend it in each backend module (<xref
|
||||
linkend='ex-option-declaration-eot-backend-slim' />, <xref
|
||||
linkend='ex-option-declaration-eot-backend-kdm' />).</para>
|
||||
|
||||
<para>By using extensible option types, it is possible to create a placeholder
|
||||
option in the central module (<xref linkend='ex-option-declaration-eot-service'
|
||||
/>), and to extend it in each backend module (<xref
|
||||
linkend='ex-option-declaration-eot-backend-slim' />, <xref
|
||||
linkend='ex-option-declaration-eot-backend-sddm' />).</para>
|
||||
|
||||
<para>As a result, <literal>displayManager.enable</literal> option values can
|
||||
be added without changing the main service module file and the type system
|
||||
automatically enforce that there can only be a single display manager
|
||||
enabled.</para>
|
||||
|
||||
<example xml:id='ex-option-declaration-eot-service'><title>Extensible type
|
||||
<example xml:id='ex-option-declaration-eot-service'><title>Extensible type
|
||||
placeholder in the service module</title>
|
||||
<screen>
|
||||
services.xserver.displayManager.enable = mkOption {
|
||||
@ -127,29 +127,29 @@ services.xserver.displayManager.enable = mkOption {
|
||||
type = with types; nullOr (enum [ ]);
|
||||
};</screen></example>
|
||||
|
||||
<example xml:id='ex-option-declaration-eot-backend-slim'><title>Extending
|
||||
<literal>services.xserver.displayManager.enable</literal> in the
|
||||
<example xml:id='ex-option-declaration-eot-backend-slim'><title>Extending
|
||||
<literal>services.xserver.displayManager.enable</literal> in the
|
||||
<literal>slim</literal> module</title>
|
||||
<screen>
|
||||
services.xserver.displayManager.enable = mkOption {
|
||||
type = with types; nullOr (enum [ "slim" ]);
|
||||
};</screen></example>
|
||||
|
||||
<example xml:id='ex-option-declaration-eot-backend-kdm'><title>Extending
|
||||
<literal>services.foo.backend</literal> in the <literal>kdm</literal>
|
||||
<example xml:id='ex-option-declaration-eot-backend-sddm'><title>Extending
|
||||
<literal>services.foo.backend</literal> in the <literal>sddm</literal>
|
||||
module</title>
|
||||
<screen>
|
||||
services.xserver.displayManager.enable = mkOption {
|
||||
type = with types; nullOr (enum [ "kdm" ]);
|
||||
type = with types; nullOr (enum [ "sddm" ]);
|
||||
};</screen></example>
|
||||
|
||||
<para>The placeholder declaration is a standard <literal>mkOption</literal>
|
||||
declaration, but it is important that extensible option declarations only use
|
||||
<para>The placeholder declaration is a standard <literal>mkOption</literal>
|
||||
declaration, but it is important that extensible option declarations only use
|
||||
the <literal>type</literal> argument.</para>
|
||||
|
||||
<para>Extensible option types work with any of the composed variants of
|
||||
<literal>enum</literal> such as
|
||||
<literal>with types; nullOr (enum [ "foo" "bar" ])</literal>
|
||||
<para>Extensible option types work with any of the composed variants of
|
||||
<literal>enum</literal> such as
|
||||
<literal>with types; nullOr (enum [ "foo" "bar" ])</literal>
|
||||
or <literal>with types; listOf (enum [ "foo" "bar" ])</literal>.</para>
|
||||
|
||||
</section>
|
||||
|
75
nixos/doc/manual/development/replace-modules.xml
Normal file
75
nixos/doc/manual/development/replace-modules.xml
Normal file
@ -0,0 +1,75 @@
|
||||
<section 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-replace-modules">
|
||||
|
||||
<title>Replace Modules</title>
|
||||
|
||||
<para>Modules that are imported can also be disabled. The option
|
||||
declarations and config implementation of a disabled module will be
|
||||
ignored, allowing another to take it's place. This can be used to
|
||||
import a set of modules from another channel while keeping the rest
|
||||
of the system on a stable release.</para>
|
||||
<para><literal>disabledModules</literal> is a top level attribute like
|
||||
<literal>imports</literal>, <literal>options</literal> and
|
||||
<literal>config</literal>. It contains a list of modules that will
|
||||
be disabled. This can either be the full path to the module or a
|
||||
string with the filename relative to the modules path
|
||||
(eg. <nixpkgs/nixos/modules> for nixos).
|
||||
</para>
|
||||
|
||||
<para>This example will replace the existing postgresql module with
|
||||
the version defined in the nixos-unstable channel while keeping the
|
||||
rest of the modules and packages from the original nixos channel.
|
||||
This only overrides the module definition, this won't use postgresql
|
||||
from nixos-unstable unless explicitly configured to do so.</para>
|
||||
|
||||
<programlisting>
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ "services/databases/postgresql.nix" ];
|
||||
|
||||
imports =
|
||||
[ # Use postgresql service from nixos-unstable channel.
|
||||
# sudo nix-channel --add http://nixos.org/channels/nixos-unstable nixos-unstable
|
||||
<nixos-unstable/nixos/modules/services/databases/postgresql.nix>
|
||||
];
|
||||
|
||||
services.postgresql.enable = true;
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
<para>This example shows how to define a custom module as a
|
||||
replacement for an existing module. Importing this module will
|
||||
disable the original module without having to know it's
|
||||
implementation details.</para>
|
||||
|
||||
<programlisting>
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.man;
|
||||
in
|
||||
|
||||
{
|
||||
disabledModules = [ "services/programs/man.nix" ];
|
||||
|
||||
options = {
|
||||
programs.man.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable manual pages.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enabled {
|
||||
warnings = [ "disabled manpages for production deployments." ];
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
</section>
|
@ -8,7 +8,7 @@
|
||||
|
||||
<para>By default, NixOS’s <command>nixos-rebuild</command> command
|
||||
uses the NixOS and Nixpkgs sources provided by the
|
||||
<literal>nixos-unstable</literal> channel (kept in
|
||||
<literal>nixos</literal> channel (kept in
|
||||
<filename>/nix/var/nix/profiles/per-user/root/channels/nixos</filename>).
|
||||
To modify NixOS, however, you should check out the latest sources from
|
||||
Git. This is as follows:
|
||||
@ -27,8 +27,8 @@ a subdirectory of the Nixpkgs repository.) The remote
|
||||
<literal>channels</literal> refers to a read-only repository that
|
||||
tracks the Nixpkgs/NixOS channels (see <xref linkend="sec-upgrading"/>
|
||||
for more information about channels). Thus, the Git branch
|
||||
<literal>channels/nixos-14.12</literal> will contain the latest built
|
||||
and tested version available in the <literal>nixos-14.12</literal>
|
||||
<literal>channels/nixos-17.03</literal> will contain the latest built
|
||||
and tested version available in the <literal>nixos-17.03</literal>
|
||||
channel.</para>
|
||||
|
||||
<para>It’s often inconvenient to develop directly on the master
|
||||
@ -39,9 +39,9 @@ branch based on your current NixOS version:
|
||||
|
||||
<screen>
|
||||
$ nixos-version
|
||||
14.04.273.ea1952b (Baboon)
|
||||
17.09pre104379.6e0b727 (Hummingbird)
|
||||
|
||||
$ git checkout -b local ea1952b
|
||||
$ git checkout -b local 6e0b727
|
||||
</screen>
|
||||
|
||||
Or, to base your local branch on the latest version available in a
|
||||
@ -49,17 +49,17 @@ NixOS channel:
|
||||
|
||||
<screen>
|
||||
$ git remote update channels
|
||||
$ git checkout -b local channels/nixos-14.12
|
||||
$ git checkout -b local channels/nixos-17.03
|
||||
</screen>
|
||||
|
||||
(Replace <literal>nixos-14.12</literal> with the name of the channel
|
||||
(Replace <literal>nixos-17.03</literal> with the name of the channel
|
||||
you want to use.) You can use <command>git merge</command> or
|
||||
<command>git rebase</command> to keep your local branch in sync with
|
||||
the channel, e.g.
|
||||
|
||||
<screen>
|
||||
$ git remote update channels
|
||||
$ git merge channels/nixos-14.12
|
||||
$ git merge channels/nixos-17.03
|
||||
</screen>
|
||||
|
||||
You can use <command>git cherry-pick</command> to copy commits from
|
||||
@ -87,7 +87,11 @@ $ ln -s <replaceable>/my/sources</replaceable>/nixpkgs ~/.nix-defexpr/nixpkgs
|
||||
|
||||
You may want to delete the symlink
|
||||
<filename>~/.nix-defexpr/channels_root</filename> to prevent root’s
|
||||
NixOS channel from clashing with your own tree.</para>
|
||||
NixOS channel from clashing with your own tree (this may break the
|
||||
command-not-found utility though). If you want to go back to the default
|
||||
state, you may just remove the <filename>~/.nix-defexpr</filename>
|
||||
directory completely, log out and log in again and it should have been
|
||||
recreated with a link to the root channels.</para>
|
||||
|
||||
<!-- FIXME: not sure what this means.
|
||||
<para>You should not pass the base directory
|
||||
|
@ -179,5 +179,6 @@ in {
|
||||
<xi:include href="option-types.xml" />
|
||||
<xi:include href="option-def.xml" />
|
||||
<xi:include href="meta-attributes.xml" />
|
||||
<xi:include href="replace-modules.xml" />
|
||||
|
||||
</chapter>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<para>The file <filename>/etc/nixos/configuration.nix</filename>
|
||||
contains the current configuration of your machine. Whenever you’ve
|
||||
changed something to that file, you should do
|
||||
<link linkend="ch-configuration">changed something</link> in that file, you should do
|
||||
|
||||
<screen>
|
||||
# nixos-rebuild switch</screen>
|
||||
|
@ -26,7 +26,8 @@ changes:
|
||||
<literal>vfat</literal> filesystem.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>You must set <option>boot.loader.systemd-boot.enable</option> to
|
||||
<para>Instead of <option>boot.loader.grub.device</option>,
|
||||
you must set <option>boot.loader.systemd-boot.enable</option> to
|
||||
<literal>true</literal>. <command>nixos-generate-config</command>
|
||||
should do this automatically for new configurations when booted in
|
||||
UEFI mode.</para>
|
||||
|
@ -11,7 +11,9 @@ a USB stick. You can use the <command>dd</command> utility to write the image:
|
||||
<command>dd if=<replaceable>path-to-image</replaceable>
|
||||
of=<replaceable>/dev/sdb</replaceable></command>. Be careful about specifying the
|
||||
correct drive; you can use the <command>lsblk</command> command to get a list of
|
||||
block devices.</para>
|
||||
block devices. If you're on OS X you can run <command>diskutil list</command>
|
||||
to see the list of devices; the device you'll use for the USB must be ejected
|
||||
before writing the image.</para>
|
||||
|
||||
<para>The <command>dd</command> utility will write the image verbatim to the drive,
|
||||
making it the recommended option for both UEFI and non-UEFI installations. For
|
||||
@ -32,6 +34,11 @@ ISO, copy its contents verbatim to your drive, then either:
|
||||
in <link xlink:href="https://www.kernel.org/doc/Documentation/kernel-parameters.txt">
|
||||
the kernel documentation</link> for more details).</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If you want to load the contents of the ISO to ram after bootin
|
||||
(So you can remove the stick after bootup) you can append the parameter
|
||||
<literal>copytoram</literal>to the <literal>options</literal> field.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
|
@ -37,6 +37,11 @@
|
||||
first disable network-manager with
|
||||
<command>systemctl stop network-manager</command>.</para></listitem>
|
||||
|
||||
<listitem><para>If you would like to continue the installation from a different
|
||||
machine you need to activate the SSH daemon via <literal>systemctl start sshd</literal>.
|
||||
In order to be able to login you also need to set a password for
|
||||
<literal>root</literal> using <literal>passwd</literal>.</para></listitem>
|
||||
|
||||
<listitem><para>The NixOS installer doesn’t do any partitioning or
|
||||
formatting yet, so you need to do that yourself. Use the following
|
||||
commands:
|
||||
|
@ -15,12 +15,12 @@ been built. These channels are:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis>Stable channels</emphasis>, such as <literal
|
||||
xlink:href="https://nixos.org/channels/nixos-14.12">nixos-14.12</literal>.
|
||||
xlink:href="https://nixos.org/channels/nixos-17.03">nixos-17.03</literal>.
|
||||
These only get conservative bug fixes and package upgrades. For
|
||||
instance, a channel update may cause the Linux kernel on your
|
||||
system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but
|
||||
not from 3.4.<replaceable>x</replaceable> to
|
||||
3.11.<replaceable>x</replaceable> (a major change that has the
|
||||
system to be upgraded from 4.9.16 to 4.9.17 (a minor bug fix), but
|
||||
not from 4.9.<replaceable>x</replaceable> to
|
||||
4.11.<replaceable>x</replaceable> (a major change that has the
|
||||
potential to break things). Stable channels are generally
|
||||
maintained until the next stable branch is created.</para>
|
||||
<para></para>
|
||||
@ -34,7 +34,7 @@ been built. These channels are:
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis>Small channels</emphasis>, such as <literal
|
||||
xlink:href="https://nixos.org/channels/nixos-14.12-small">nixos-14.12-small</literal>
|
||||
xlink:href="https://nixos.org/channels/nixos-17.03-small">nixos-17.03-small</literal>
|
||||
or <literal
|
||||
xlink:href="https://nixos.org/channels/nixos-unstable-small">nixos-unstable-small</literal>. These
|
||||
are identical to the stable and unstable channels described above,
|
||||
@ -55,8 +55,8 @@ appliances.)</para>
|
||||
|
||||
<para>When you first install NixOS, you’re automatically subscribed to
|
||||
the NixOS channel that corresponds to your installation source. For
|
||||
instance, if you installed from a 14.12 ISO, you will be subscribed to
|
||||
the <literal>nixos-14.12</literal> channel. To see which NixOS
|
||||
instance, if you installed from a 17.03 ISO, you will be subscribed to
|
||||
the <literal>nixos-17.03</literal> channel. To see which NixOS
|
||||
channel you’re subscribed to, run the following as root:
|
||||
|
||||
<screen>
|
||||
@ -71,16 +71,16 @@ To switch to a different NixOS channel, do
|
||||
</screen>
|
||||
|
||||
(Be sure to include the <literal>nixos</literal> parameter at the
|
||||
end.) For instance, to use the NixOS 14.12 stable channel:
|
||||
end.) For instance, to use the NixOS 17.03 stable channel:
|
||||
|
||||
<screen>
|
||||
# nix-channel --add https://nixos.org/channels/nixos-14.12 nixos
|
||||
# nix-channel --add https://nixos.org/channels/nixos-17.03 nixos
|
||||
</screen>
|
||||
|
||||
If you have a server, you may want to use the “small” channel instead:
|
||||
|
||||
<screen>
|
||||
# nix-channel --add https://nixos.org/channels/nixos-14.12-small nixos
|
||||
# nix-channel --add https://nixos.org/channels/nixos-17.03-small nixos
|
||||
</screen>
|
||||
|
||||
And if you want to live on the bleeding edge:
|
||||
@ -130,7 +130,7 @@ runs, see <command>systemctl list-timers</command>.) You can also
|
||||
specify a channel explicitly, e.g.
|
||||
|
||||
<programlisting>
|
||||
system.autoUpgrade.channel = https://nixos.org/channels/nixos-15.09;
|
||||
system.autoUpgrade.channel = https://nixos.org/channels/nixos-17.03;
|
||||
</programlisting>
|
||||
|
||||
</para>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<para>This section lists the release notes for each stable version of NixOS
|
||||
and current unstable revision.</para>
|
||||
|
||||
<xi:include href="rl-1709.xml" />
|
||||
<xi:include href="rl-1703.xml" />
|
||||
<xi:include href="rl-1609.xml" />
|
||||
<xi:include href="rl-1603.xml" />
|
||||
|
@ -4,7 +4,15 @@
|
||||
version="5.0"
|
||||
xml:id="sec-release-17.03">
|
||||
|
||||
<title>Release 17.03 (“XXX”, 2017/03/??)</title>
|
||||
<title>Release 17.03 (“Gorilla”, 2017/03/31)</title>
|
||||
|
||||
<section 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-release-17.03-highlights">
|
||||
|
||||
<title>Highlights</title>
|
||||
|
||||
<para>In addition to numerous new and upgraded packages, this release
|
||||
has the following highlights: </para>
|
||||
@ -15,21 +23,171 @@ has the following highlights: </para>
|
||||
xlink:href="https://nixos.org/nixpkgs/manual/#sec-overlays-install">Nixpkgs
|
||||
manual</link> for more information.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>This release is based on Glibc 2.25, GCC 5.4.0 and systemd
|
||||
232. The default Linux kernel is 4.9 and Nix is at 1.11.8.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The default desktop environment now is KDE's Plasma 5. KDE 4 has been removed</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The setuid wrapper functionality now supports setting
|
||||
capabilities.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>X.org server uses branch 1.19. Due to ABI incompatibilities,
|
||||
<literal>ati_unfree</literal> keeps forcing 1.17
|
||||
and <literal>amdgpu-pro</literal> starts forcing 1.18.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Cross compilation has been rewritten. See the nixpkgs manual for
|
||||
details. The most obvious breaking change is that in derivations there is no
|
||||
<literal>.nativeDrv</literal> nor <literal>.crossDrv</literal> are now
|
||||
cross by default, not native.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The <literal>overridePackages</literal> function has been rewritten
|
||||
to be replaced by <link
|
||||
xlink:href="https://nixos.org/nixpkgs/manual/#sec-overlays-install">
|
||||
overlays</link></para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Packages in nixpkgs can be marked as insecure through listed
|
||||
vulnerabilities. See the <link
|
||||
xlink:href="https://nixos.org/nixpkgs/manual/#sec-allow-insecure">Nixpkgs
|
||||
manual</link> for more information.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>PHP now defaults to PHP 7.1</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
<section 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-release-17.03-new-services">
|
||||
|
||||
<title>New Services</title>
|
||||
|
||||
<para>The following new services were added since the last release:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para></para>
|
||||
</listitem>
|
||||
<listitem><para><literal>hardware/ckb.nix</literal></para></listitem>
|
||||
<listitem><para><literal>hardware/mcelog.nix</literal></para></listitem>
|
||||
<listitem><para><literal>hardware/usb-wwan.nix</literal></para></listitem>
|
||||
<listitem><para><literal>hardware/video/capture/mwprocapture.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/adb.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/chromium.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/gphoto2.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/java.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/mtr.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/oblogout.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/vim.nix</literal></para></listitem>
|
||||
<listitem><para><literal>programs/wireshark.nix</literal></para></listitem>
|
||||
<listitem><para><literal>security/dhparams.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/audio/ympd.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/computing/boinc/client.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/continuous-integration/buildbot/master.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/continuous-integration/buildbot/worker.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/continuous-integration/gitlab-runner.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/databases/riak-cs.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/databases/stanchion.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/desktops/gnome3/gnome-terminal-server.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/editors/infinoted.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/hardware/illum.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/hardware/trezord.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/logging/journalbeat.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/mail/offlineimap.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/mail/postgrey.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/couchpotato.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/docker-registry.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/errbot.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/geoip-updater.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/gogs.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/leaps.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/nix-optimise.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/ssm-agent.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/misc/sssd.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/arbtt.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/netdata.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/default.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/alertmanager.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/blackbox-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/json-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/nginx-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/node-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/snmp-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/unifi-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/prometheus/varnish-exporter.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/sysstat.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/telegraf.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/monitoring/vnstat.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/network-filesystems/cachefilesd.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/network-filesystems/glusterfs.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/network-filesystems/ipfs.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/dante.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/dnscrypt-wrapper.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/fakeroute.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/flannel.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/htpdate.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/miredo.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/nftables.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/powerdns.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/pdns-recursor.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/quagga.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/redsocks.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/networking/wireguard.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/system/cgmanager.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/torrent/opentracker.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/atlassian/confluence.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/atlassian/crowd.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/atlassian/jira.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/frab.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/nixbot.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/selfoss.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/web-apps/quassel-webserver.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/x11/unclutter-xfixes.nix</literal></para></listitem>
|
||||
<listitem><para><literal>services/x11/urxvtd.nix</literal></para></listitem>
|
||||
<listitem><para><literal>system/boot/systemd-nspawn.nix</literal></para></listitem>
|
||||
<listitem><para><literal>virtualisation/ecs-agent.nix</literal></para></listitem>
|
||||
<listitem><para><literal>virtualisation/lxcfs.nix</literal></para></listitem>
|
||||
<listitem><para><literal>virtualisation/openstack/keystone.nix</literal></para></listitem>
|
||||
<listitem><para><literal>virtualisation/openstack/glance.nix</literal></para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
<section 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-release-17.03-incompatibilities">
|
||||
|
||||
<title>Backward Incompatibilities</title>
|
||||
|
||||
<para>When upgrading from a previous release, please be aware of the
|
||||
following incompatible changes:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Derivations have no <literal>.nativeDrv</literal> nor <literal>.crossDrv</literal>
|
||||
and are now cross by default, not native.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>stdenv.overrides</literal> is now expected to take <literal>self</literal>
|
||||
@ -38,6 +196,15 @@ following incompatible changes:</para>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>ansible</literal> now defaults to ansible version 2 as version 1
|
||||
has been removed due to a serious <link
|
||||
xlink:href="https://www.computest.nl/advisories/CT-2017-0109_Ansible.txt">
|
||||
vulnerability</link> unpatched by upstream.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>gnome</literal> alias has been removed along with
|
||||
@ -54,15 +221,6 @@ following incompatible changes:</para>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The Yama LSM is now enabled by default in the kernel,
|
||||
which prevents ptracing non-child processes.
|
||||
This means you will not be able to attach gdb to an existing process,
|
||||
but will need to start that process from gdb (so it is a child).
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>stripHash</literal> bash function in <literal>stdenv</literal>
|
||||
@ -79,6 +237,15 @@ following incompatible changes:</para>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Two lone top-level dict dbs moved into <literal>dictdDBs</literal>. This
|
||||
affects: <literal>dictdWordnet</literal> which is now at
|
||||
<literal>dictdDBs.wordnet</literal> and <literal>dictdWiktionary</literal>
|
||||
which is now at <literal>dictdDBs.wiktionary</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Parsoid service now uses YAML configuration format.
|
||||
@ -100,11 +267,40 @@ following incompatible changes:</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>service.nylon</literal> is now declared using named instances.
|
||||
As an example:
|
||||
|
||||
<programlisting>
|
||||
services.nylon = {
|
||||
enable = true;
|
||||
acceptInterface = "br0";
|
||||
bindInterface = "tun1";
|
||||
port = 5912;
|
||||
};
|
||||
</programlisting>
|
||||
|
||||
should be replaced with:
|
||||
|
||||
<programlisting>
|
||||
services.nylon.myvpn = {
|
||||
enable = true;
|
||||
acceptInterface = "br0";
|
||||
bindInterface = "tun1";
|
||||
port = 5912;
|
||||
};
|
||||
</programlisting>
|
||||
|
||||
this enables you to declare a SOCKS proxy for each uplink.
|
||||
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><literal>overridePackages</literal> function no longer exists.
|
||||
It is replaced by <link
|
||||
xlink:href="https://nixos.org/nixpkgs/manual/#sec-overlays-install">
|
||||
overlays</link>. For example, the following code:
|
||||
overlays</link>. For example, the following code:
|
||||
|
||||
<programlisting>
|
||||
let
|
||||
@ -124,19 +320,195 @@ following incompatible changes:</para>
|
||||
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Autoloading connection tracking helpers is now disabled by default.
|
||||
This default was also changed in the Linux kernel and is considered
|
||||
insecure if not configured properly in your firewall. If you need
|
||||
connection tracking helpers (i.e. for active FTP) please enable
|
||||
<literal>networking.firewall.autoLoadConntrackHelpers</literal> and
|
||||
tune <literal>networking.firewall.connectionTrackingModules</literal>
|
||||
to suit your needs.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>local_recipient_maps</literal> is not set to empty value by
|
||||
Postfix service. It's an insecure default as stated by Postfix
|
||||
documentation. Those who want to retain this setting need to set it via
|
||||
<literal>services.postfix.extraConfig</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Iputils no longer provide ping6 and traceroute6. The functionality of
|
||||
these tools has been integrated into ping and traceroute respectively. To
|
||||
enforce an address family the new flags <literal>-4</literal> and
|
||||
<literal>-6</literal> have been added. One notable incompatibility is that
|
||||
specifying an interface (for link-local IPv6 for instance) is no longer done
|
||||
with the <literal>-I</literal> flag, but by encoding the interface into the
|
||||
address (<literal>ping fe80::1%eth0</literal>).
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The socket handling of the <literal>services.rmilter</literal> module
|
||||
has been fixed and refactored. As rmilter doesn't support binding to
|
||||
more than one socket, the options <literal>bindUnixSockets</literal>
|
||||
and <literal>bindInetSockets</literal> have been replaced by
|
||||
<literal>services.rmilter.bindSocket.*</literal>. The default is still
|
||||
a unix socket in <literal>/run/rmilter/rmilter.sock</literal>. Refer to
|
||||
the options documentation for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>fetch*</literal> functions no longer support md5,
|
||||
please use sha256 instead.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The dnscrypt-proxy module interface has been streamlined around the
|
||||
<option>extraArgs</option> option. Where possible, legacy option
|
||||
declarations are mapped to <option>extraArgs</option> but will emit
|
||||
warnings. The <option>resolverList</option> has been outright
|
||||
removed: to use an unlisted resolver, use the
|
||||
<option>customResolver</option> option.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
torbrowser now stores local state under
|
||||
<filename>~/.local/share/tor-browser</filename> by default. Any
|
||||
browser profile data from the old location,
|
||||
<filename>~/.torbrowser4</filename>, must be migrated manually.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The ihaskell, monetdb, offlineimap and sitecopy services have been removed.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
<section 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-release-17.03-notable-changes">
|
||||
|
||||
<para>Other notable improvements:</para>
|
||||
<title>Other Notable Changes</title>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<para>Module type system have a new extensible option types feature that
|
||||
allow to extend certain types, such as enum, through multiple option
|
||||
declarations of the same option across multiple modules.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>jre</literal> now defaults to GTK+ UI by default. This
|
||||
improves visual consistency and makes Java follow system font style,
|
||||
improving the situation on HighDPI displays. This has a cost of increased
|
||||
closure size; for server and other headless workloads it's recommended to
|
||||
use <literal>jre_headless</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Python 2.6 interpreter and package set have been removed.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The Python 2.7 interpreter does not use modules anymore. Instead, all
|
||||
CPython interpreters now include the whole standard library except for `tkinter`,
|
||||
which is available in the Python package set.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Python 2.7, 3.5 and 3.6 are now built deterministically and 3.4 mostly.
|
||||
Minor modifications had to be made to the interpreters in order to generate
|
||||
deterministic bytecode. This has security implications and is relevant for
|
||||
those using Python in a <literal>nix-shell</literal>. See the Nixpkgs manual
|
||||
for details.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The Python package sets now use a fixed-point combinator and the sets are
|
||||
available as attributes of the interpreters.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The Python function <literal>buildPythonPackage</literal> has been improved and can be
|
||||
used to build from Setuptools source, Flit source, and precompiled Wheels.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
When adding new or updating current Python libraries, the expressions should be put
|
||||
in separate files in <literal>pkgs/development/python-modules</literal> and
|
||||
called from <literal>python-packages.nix</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The dnscrypt-proxy service supports synchronizing the list of public
|
||||
resolvers without working DNS resolution. This fixes issues caused by the
|
||||
resolver list becoming outdated. It also improves the viability of
|
||||
DNSCrypt only configurations.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Containers using bridged networking no longer lose their connection after
|
||||
changes to the host networking.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
ZFS supports pool auto scrubbing.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The bind DNS utilities (e.g. dig) have been split into their own output and
|
||||
are now also available in <literal>pkgs.dnsutils</literal> and it is no longer
|
||||
necessary to pull in all of <literal>bind</literal> to use them.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Per-user configuration was moved from <filename>~/.nixpkgs</filename> to
|
||||
<filename>~/.config/nixpkgs</filename>. The former is still valid for
|
||||
<filename>config.nix</filename> for backwards compatibility.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
</section>
|
||||
</section>
|
||||
|
102
nixos/doc/manual/release-notes/rl-1709.xml
Normal file
102
nixos/doc/manual/release-notes/rl-1709.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<section 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-release-17.09">
|
||||
|
||||
<title>Release 17.09 (“Hummingbird”, 2017/09/??)</title>
|
||||
|
||||
<para>In addition to numerous new and upgraded packages, this release
|
||||
has the following highlights: </para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
The user handling now keeps track of deallocated UIDs/GIDs. When a user
|
||||
or group is revived, this allows it to be allocated the UID/GID it had before.
|
||||
A consequence is that UIDs and GIDs are no longer reused.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The module option <option>services.xserver.xrandrHeads</option> now
|
||||
causes the first head specified in this list to be set as the primary
|
||||
head. Apart from that, it's now possible to also set additional options
|
||||
by using an attribute set, for example:
|
||||
<programlisting>
|
||||
{ services.xserver.xrandrHeads = [
|
||||
"HDMI-0"
|
||||
{
|
||||
output = "DVI-0";
|
||||
primary = true;
|
||||
monitorConfig = ''
|
||||
Option "Rotate" "right"
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
</programlisting>
|
||||
This will set the <literal>DVI-0</literal> output to be the primary head,
|
||||
even though <literal>HDMI-0</literal> is the first head in the list.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>The following new services were added since the last release:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
<para>When upgrading from a previous release, please be aware of the
|
||||
following incompatible changes:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Top-level <literal>idea</literal> package collection was renamed.
|
||||
All JetBrains IDEs are now at <literal>jetbrains</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>flexget</literal>'s state database cannot be upgraded to its
|
||||
new internal format, requiring removal of any existing
|
||||
<literal>db-config.sqlite</literal> which will be automatically recreated.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
<para>Other notable improvements:</para>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Modules can now be disabled by using <link
|
||||
xlink:href="https://nixos.org/nixpkgs/manual/#sec-replace-modules">
|
||||
disabledModules</link>, allowing another to take it's place. This can be
|
||||
used to import a set of modules from another channel while keeping the
|
||||
rest of the system on a stable release.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Updated to FreeType 2.7.1, including a new TrueType engine.
|
||||
The new engine replaces the Infinality engine which was the default in
|
||||
NixOS. The default font rendering settings are now provided by
|
||||
fontconfig-penultimate, replacing fontconfig-ultimate; the new defaults
|
||||
are less invasive and provide rendering that is more consistent with
|
||||
other systems and hopefully with each font designer's intent. Some
|
||||
system-wide configuration has been removed from the Fontconfig NixOS
|
||||
module where user Fontconfig settings are available.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
@ -7,6 +7,12 @@
|
||||
, # The size of the disk, in megabytes.
|
||||
diskSize
|
||||
|
||||
# The files and directories to be placed in the target file system.
|
||||
# This is a list of attribute sets {source, target} where `source'
|
||||
# is the file system object (regular file or directory) to be
|
||||
# grafted in the file system at path `target'.
|
||||
, contents ? []
|
||||
|
||||
, # Whether the disk should be partitioned (with a single partition
|
||||
# containing the root filesystem) or contain the root filesystem
|
||||
# directly.
|
||||
@ -27,35 +33,124 @@
|
||||
|
||||
, name ? "nixos-disk-image"
|
||||
|
||||
# This prevents errors while checking nix-store validity, see
|
||||
# https://github.com/NixOS/nix/issues/1134
|
||||
, fixValidity ? true
|
||||
|
||||
, format ? "raw"
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
pkgs.vmTools.runInLinuxVM (
|
||||
let
|
||||
# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/channel.nix
|
||||
# TODO: factor out more cleanly
|
||||
|
||||
# Do not include these things:
|
||||
# - The '.git' directory
|
||||
# - Result symlinks from nix-build ('result', 'result-2', 'result-bin', ...)
|
||||
# - VIM/Emacs swap/backup files ('.swp', '.swo', '.foo.swp', 'foo~', ...)
|
||||
filterFn = path: type: let basename = baseNameOf (toString path); in
|
||||
if type == "directory" then basename != ".git"
|
||||
else if type == "symlink" then builtins.match "^result(|-.*)$" basename == null
|
||||
else builtins.match "^((|\..*)\.sw[a-z]|.*~)$" basename == null;
|
||||
|
||||
nixpkgs = builtins.filterSource filterFn pkgs.path;
|
||||
|
||||
channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}" {} ''
|
||||
mkdir -p $out
|
||||
cp -prd ${nixpkgs} $out/nixos
|
||||
chmod -R u+w $out/nixos
|
||||
if [ ! -e $out/nixos/nixpkgs ]; then
|
||||
ln -s . $out/nixos/nixpkgs
|
||||
fi
|
||||
rm -rf $out/nixos/.git
|
||||
echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix
|
||||
'';
|
||||
|
||||
metaClosure = pkgs.writeText "meta" ''
|
||||
${config.system.build.toplevel}
|
||||
${config.nix.package.out}
|
||||
${channelSources}
|
||||
'';
|
||||
|
||||
prepareImageInputs = with pkgs; [ rsync utillinux parted e2fsprogs lkl fakeroot config.system.build.nixos-prepare-root ] ++ stdenv.initialPath;
|
||||
|
||||
# I'm preserving the line below because I'm going to search for it across nixpkgs to consolidate
|
||||
# image building logic. The comment right below this now appears in 4 different places in nixpkgs :)
|
||||
# !!! should use XML.
|
||||
sources = map (x: x.source) contents;
|
||||
targets = map (x: x.target) contents;
|
||||
|
||||
prepareImage = ''
|
||||
export PATH=${pkgs.lib.makeSearchPathOutput "bin" "bin" prepareImageInputs}
|
||||
|
||||
mkdir $out
|
||||
diskImage=nixos.raw
|
||||
truncate -s ${toString diskSize}M $diskImage
|
||||
|
||||
${if partitioned then ''
|
||||
parted $diskImage -- mklabel msdos mkpart primary ext4 1M -1s
|
||||
offset=$((2048*512))
|
||||
'' else ''
|
||||
offset=0
|
||||
''}
|
||||
|
||||
mkfs.${fsType} -F -L nixos -E offset=$offset $diskImage
|
||||
|
||||
root="$PWD/root"
|
||||
mkdir -p $root
|
||||
|
||||
# Copy arbitrary other files into the image
|
||||
# Semi-shamelessly copied from make-etc.sh. I (@copumpkin) shall factor this stuff out as part of
|
||||
# https://github.com/NixOS/nixpkgs/issues/23052.
|
||||
set -f
|
||||
sources_=(${concatStringsSep " " sources})
|
||||
targets_=(${concatStringsSep " " targets})
|
||||
set +f
|
||||
|
||||
for ((i = 0; i < ''${#targets_[@]}; i++)); do
|
||||
source="''${sources_[$i]}"
|
||||
target="''${targets_[$i]}"
|
||||
|
||||
if [[ "$source" =~ '*' ]]; then
|
||||
# If the source name contains '*', perform globbing.
|
||||
mkdir -p $root/$target
|
||||
for fn in $source; do
|
||||
rsync -a --no-o --no-g "$fn" $root/$target/
|
||||
done
|
||||
else
|
||||
mkdir -p $root/$(dirname $target)
|
||||
if ! [ -e $root/$target ]; then
|
||||
rsync -a --no-o --no-g $source $root/$target
|
||||
else
|
||||
echo "duplicate entry $target -> $source"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# TODO: Nix really likes to chown things it creates to its current user...
|
||||
fakeroot nixos-prepare-root $root ${channelSources} ${config.system.build.toplevel} closure
|
||||
|
||||
echo "copying staging root to image..."
|
||||
cptofs ${pkgs.lib.optionalString partitioned "-P 1"} -t ${fsType} -i $diskImage $root/* /
|
||||
'';
|
||||
in pkgs.vmTools.runInLinuxVM (
|
||||
pkgs.runCommand name
|
||||
{ preVM =
|
||||
''
|
||||
mkdir $out
|
||||
diskImage=$out/nixos.${if format == "qcow2" then "qcow2" else "img"}
|
||||
${pkgs.vmTools.qemu}/bin/qemu-img create -f ${format} $diskImage "${toString diskSize}M"
|
||||
mv closure xchg/
|
||||
'';
|
||||
buildInputs = [ pkgs.utillinux pkgs.perl pkgs.e2fsprogs pkgs.parted ];
|
||||
exportReferencesGraph =
|
||||
[ "closure" config.system.build.toplevel ];
|
||||
inherit postVM;
|
||||
{ preVM = prepareImage;
|
||||
buildInputs = with pkgs; [ utillinux e2fsprogs ];
|
||||
exportReferencesGraph = [ "closure" metaClosure ];
|
||||
postVM = ''
|
||||
${if format == "raw" then ''
|
||||
mv $diskImage $out/nixos.img
|
||||
diskImage=$out/nixos.img
|
||||
'' else ''
|
||||
${pkgs.qemu}/bin/qemu-img convert -f raw -O qcow2 $diskImage $out/nixos.qcow2
|
||||
diskImage=$out/nixos.qcow2
|
||||
''}
|
||||
${postVM}
|
||||
'';
|
||||
memSize = 1024;
|
||||
}
|
||||
''
|
||||
${if partitioned then ''
|
||||
# Create a single / partition.
|
||||
parted /dev/vda mklabel msdos
|
||||
parted /dev/vda -- mkpart primary ext2 1M -1s
|
||||
. /sys/class/block/vda1/uevent
|
||||
mknod /dev/vda1 b $MAJOR $MINOR
|
||||
rootDisk=/dev/vda1
|
||||
@ -63,46 +158,40 @@ pkgs.vmTools.runInLinuxVM (
|
||||
rootDisk=/dev/vda
|
||||
''}
|
||||
|
||||
# Create an empty filesystem and mount it.
|
||||
mkfs.${fsType} -L nixos $rootDisk
|
||||
mkdir /mnt
|
||||
mount $rootDisk /mnt
|
||||
|
||||
# Register the paths in the Nix database.
|
||||
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
||||
${config.nix.package.out}/bin/nix-store --load-db --option build-users-group ""
|
||||
|
||||
${if fixValidity then ''
|
||||
# Add missing size/hash fields to the database. FIXME:
|
||||
# exportReferencesGraph should provide these directly.
|
||||
${config.nix.package.out}/bin/nix-store --verify --check-contents --option build-users-group ""
|
||||
'' else ""}
|
||||
|
||||
# In case the bootloader tries to write to /dev/sda…
|
||||
# Some tools assume these exist
|
||||
ln -s vda /dev/xvda
|
||||
ln -s vda /dev/sda
|
||||
|
||||
# Install the closure onto the image
|
||||
USER=root ${config.system.build.nixos-install}/bin/nixos-install \
|
||||
--closure ${config.system.build.toplevel} \
|
||||
--no-channel-copy \
|
||||
--no-root-passwd \
|
||||
${optionalString (!installBootLoader) "--no-bootloader"}
|
||||
mountPoint=/mnt
|
||||
mkdir $mountPoint
|
||||
mount $rootDisk $mountPoint
|
||||
|
||||
# Install a configuration.nix.
|
||||
# Install a configuration.nix
|
||||
mkdir -p /mnt/etc/nixos
|
||||
${optionalString (configFile != null) ''
|
||||
cp ${configFile} /mnt/etc/nixos/configuration.nix
|
||||
''}
|
||||
|
||||
# Remove /etc/machine-id so that each machine cloning this image will get its own id
|
||||
rm -f /mnt/etc/machine-id
|
||||
mount --rbind /dev $mountPoint/dev
|
||||
mount --rbind /proc $mountPoint/proc
|
||||
mount --rbind /sys $mountPoint/sys
|
||||
|
||||
umount /mnt
|
||||
# Set up core system link, GRUB, etc.
|
||||
NIXOS_INSTALL_BOOTLOADER=1 chroot $mountPoint /nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||
|
||||
# Make sure resize2fs works
|
||||
# TODO: figure out if I should activate, but for now I won't
|
||||
# chroot $mountPoint /nix/var/nix/profiles/system/activate
|
||||
|
||||
# The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images
|
||||
rm -f $mountPoint/etc/machine-id
|
||||
|
||||
umount -R /mnt
|
||||
|
||||
# Make sure resize2fs works. Note that resize2fs has stricter criteria for resizing than a normal
|
||||
# mount, so the `-c 0` and `-i 0` don't affect it. Setting it to `now` doesn't produce deterministic
|
||||
# output, of course, but we can fix that when/if we start making images deterministic.
|
||||
${optionalString (fsType == "ext4") ''
|
||||
tune2fs -c 0 -i 0 $rootDisk
|
||||
tune2fs -T now -c 0 -i 0 $rootDisk
|
||||
''}
|
||||
''
|
||||
)
|
||||
|
@ -508,7 +508,7 @@ sub screenshot {
|
||||
sub getTTYText {
|
||||
my ($self, $tty) = @_;
|
||||
|
||||
my ($status, $out) = $self->execute("fold -w 80 /dev/vcs${tty}");
|
||||
my ($status, $out) = $self->execute("fold -w\$(stty -F /dev/tty${tty} size | awk '{print \$2}') /dev/vcs${tty}");
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -542,16 +542,20 @@ sub getScreenText {
|
||||
$self->nest("performing optical character recognition", sub {
|
||||
my $tmpbase = Cwd::abs_path(".")."/ocr";
|
||||
my $tmpin = $tmpbase."in.ppm";
|
||||
my $tmpout = "$tmpbase.ppm";
|
||||
|
||||
$self->sendMonitorCommand("screendump $tmpin");
|
||||
system("ppmtopgm $tmpin | pamscale 4 -filter=lanczos > $tmpout") == 0
|
||||
or die "cannot scale screenshot";
|
||||
|
||||
my $magickArgs = "-filter Catrom -density 72 -resample 300 "
|
||||
. "-contrast -normalize -despeckle -type grayscale "
|
||||
. "-sharpen 1 -posterize 3 -negate -gamma 100 "
|
||||
. "-blur 1x65535";
|
||||
my $tessArgs = "-c debug_file=/dev/null --psm 11 --oem 2";
|
||||
|
||||
$text = `convert $magickArgs $tmpin tiff:- | tesseract - - $tessArgs`;
|
||||
my $status = $? >> 8;
|
||||
unlink $tmpin;
|
||||
system("tesseract $tmpout $tmpbase") == 0 or die "OCR failed";
|
||||
unlink $tmpout;
|
||||
$text = read_file("$tmpbase.txt");
|
||||
unlink "$tmpbase.txt";
|
||||
|
||||
die "OCR failed with exit code $status" if $status != 0;
|
||||
});
|
||||
return $text;
|
||||
}
|
||||
@ -607,34 +611,25 @@ sub waitForWindow {
|
||||
sub copyFileFromHost {
|
||||
my ($self, $from, $to) = @_;
|
||||
my $s = `cat $from` or die;
|
||||
$self->mustSucceed("echo '$s' > $to"); # !!! escaping
|
||||
$s =~ s/'/'\\''/g;
|
||||
$self->mustSucceed("echo '$s' > $to");
|
||||
}
|
||||
|
||||
|
||||
my %charToKey = (
|
||||
'!' => "shift-0x02",
|
||||
'@' => "shift-0x03",
|
||||
'#' => "shift-0x04",
|
||||
'$' => "shift-0x05",
|
||||
'%' => "shift-0x06",
|
||||
'^' => "shift-0x07",
|
||||
'&' => "shift-0x08",
|
||||
'*' => "shift-0x09",
|
||||
'(' => "shift-0x0A",
|
||||
')' => "shift-0x0B",
|
||||
'-' => "0x0C", '_' => "shift-0x0C",
|
||||
'=' => "0x0D", '+' => "shift-0x0D",
|
||||
'[' => "0x1A", '{' => "shift-0x1A",
|
||||
']' => "0x1B", '}' => "shift-0x1B",
|
||||
';' => "0x27", ':' => "shift-0x27",
|
||||
'\'' => "0x28", '"' => "shift-0x28",
|
||||
'`' => "0x29", '~' => "shift-0x29",
|
||||
'\\' => "0x2B", '|' => "shift-0x2B",
|
||||
',' => "0x33", '<' => "shift-0x33",
|
||||
'.' => "0x34", '>' => "shift-0x34",
|
||||
'/' => "0x35", '?' => "shift-0x35",
|
||||
' ' => "spc",
|
||||
"\n" => "ret",
|
||||
'A' => "shift-a", 'N' => "shift-n", '-' => "0x0C", '_' => "shift-0x0C", '!' => "shift-0x02",
|
||||
'B' => "shift-b", 'O' => "shift-o", '=' => "0x0D", '+' => "shift-0x0D", '@' => "shift-0x03",
|
||||
'C' => "shift-c", 'P' => "shift-p", '[' => "0x1A", '{' => "shift-0x1A", '#' => "shift-0x04",
|
||||
'D' => "shift-d", 'Q' => "shift-q", ']' => "0x1B", '}' => "shift-0x1B", '$' => "shift-0x05",
|
||||
'E' => "shift-e", 'R' => "shift-r", ';' => "0x27", ':' => "shift-0x27", '%' => "shift-0x06",
|
||||
'F' => "shift-f", 'S' => "shift-s", '\'' => "0x28", '"' => "shift-0x28", '^' => "shift-0x07",
|
||||
'G' => "shift-g", 'T' => "shift-t", '`' => "0x29", '~' => "shift-0x29", '&' => "shift-0x08",
|
||||
'H' => "shift-h", 'U' => "shift-u", '\\' => "0x2B", '|' => "shift-0x2B", '*' => "shift-0x09",
|
||||
'I' => "shift-i", 'V' => "shift-v", ',' => "0x33", '<' => "shift-0x33", '(' => "shift-0x0A",
|
||||
'J' => "shift-j", 'W' => "shift-w", '.' => "0x34", '>' => "shift-0x34", ')' => "shift-0x0B",
|
||||
'K' => "shift-k", 'X' => "shift-x", '/' => "0x35", '?' => "shift-0x35",
|
||||
'L' => "shift-l", 'Y' => "shift-y", ' ' => "spc",
|
||||
'M' => "shift-m", 'Z' => "shift-z", "\n" => "ret",
|
||||
);
|
||||
|
||||
|
||||
|
@ -93,7 +93,7 @@ rec {
|
||||
|
||||
vms = map (m: m.config.system.build.vm) (lib.attrValues nodes);
|
||||
|
||||
ocrProg = tesseract;
|
||||
ocrProg = tesseract_4.override { enableLanguages = [ "eng" ]; };
|
||||
|
||||
# Generate onvenience wrappers for running the test driver
|
||||
# interactively with the specified network, and for starting the
|
||||
@ -108,16 +108,17 @@ rec {
|
||||
mkdir -p $out/bin
|
||||
echo "$testScript" > $out/test-script
|
||||
ln -s ${testDriver}/bin/nixos-test-driver $out/bin/
|
||||
vms="$(for i in ${toString vms}; do echo $i/bin/run-*-vm; done)"
|
||||
vms=($(for i in ${toString vms}; do echo $i/bin/run-*-vm; done))
|
||||
wrapProgram $out/bin/nixos-test-driver \
|
||||
--add-flags "$vms" \
|
||||
${lib.optionalString enableOCR "--prefix PATH : '${ocrProg}/bin'"} \
|
||||
--add-flags "''${vms[*]}" \
|
||||
${lib.optionalString enableOCR
|
||||
"--prefix PATH : '${ocrProg}/bin:${imagemagick}/bin'"} \
|
||||
--run "testScript=\"\$(cat $out/test-script)\"" \
|
||||
--set testScript '$testScript' \
|
||||
--set VLANS '${toString vlans}'
|
||||
ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
|
||||
wrapProgram $out/bin/nixos-run-vms \
|
||||
--add-flags "$vms" \
|
||||
--add-flags "''${vms[*]}" \
|
||||
${lib.optionalString enableOCR "--prefix PATH : '${ocrProg}/bin'"} \
|
||||
--set tests 'startAll; joinAll;' \
|
||||
--set VLANS '${toString vlans}' \
|
||||
|
@ -2,15 +2,31 @@
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
let
|
||||
cfg = config.amazonImage;
|
||||
in {
|
||||
|
||||
imports =
|
||||
[ ../../../modules/installer/cd-dvd/channel.nix
|
||||
../../../modules/virtualisation/amazon-image.nix
|
||||
];
|
||||
imports = [ ../../../modules/virtualisation/amazon-image.nix ];
|
||||
|
||||
system.build.amazonImage = import ../../../lib/make-disk-image.nix {
|
||||
options.amazonImage = {
|
||||
contents = mkOption {
|
||||
example = literalExample ''
|
||||
[ { source = pkgs.memtest86 + "/memtest.bin";
|
||||
target = "boot/memtest.bin";
|
||||
}
|
||||
]
|
||||
'';
|
||||
default = [];
|
||||
description = ''
|
||||
This option lists files to be copied to fixed locations in the
|
||||
generated image. Glob patterns work.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config.system.build.amazonImage = import ../../../lib/make-disk-image.nix {
|
||||
inherit lib config;
|
||||
inherit (cfg) contents;
|
||||
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
|
||||
partitioned = config.ec2.hvm;
|
||||
diskSize = if config.ec2.hvm then 2048 else 8192;
|
||||
|
@ -3,23 +3,22 @@
|
||||
|
||||
# To start with do: nix-shell -p awscli --run "aws configure"
|
||||
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
#set -x
|
||||
|
||||
stateDir=${TMPDIR:-/tmp}/ec2-image
|
||||
echo "keeping state in $stateDir"
|
||||
mkdir -p $stateDir
|
||||
|
||||
version=$(nix-instantiate --eval --strict '<nixpkgs>' -A lib.nixpkgsVersion | sed s/'"'//g)
|
||||
major=${version:0:5}
|
||||
echo "NixOS version is $version ($major)"
|
||||
|
||||
stateDir=/var/tmp/ec2-image-$version
|
||||
echo "keeping state in $stateDir"
|
||||
mkdir -p $stateDir
|
||||
|
||||
rm -f ec2-amis.nix
|
||||
|
||||
types="hvm pv"
|
||||
types="hvm"
|
||||
stores="ebs s3"
|
||||
regions="eu-west-1 eu-west-2 eu-central-1 us-east-1 us-east-2 us-west-1 us-west-2 ap-southeast-1 ap-southeast-2 ap-northeast-1 ap-northeast-2 sa-east-1 ap-south-1"
|
||||
regions="eu-west-1 eu-west-2 eu-central-1 us-east-1 us-east-2 us-west-1 us-west-2 ca-central-1 ap-southeast-1 ap-southeast-2 ap-northeast-1 ap-northeast-2 sa-east-1 ap-south-1"
|
||||
|
||||
for type in $types; do
|
||||
link=$stateDir/$type
|
||||
@ -206,7 +205,7 @@ for type in $types; do
|
||||
|
||||
# Register the AMI.
|
||||
if [ $type = pv ]; then
|
||||
kernel=$(aws ec2 describe-images --owner amazon --filters "Name=name,Values=pv-grub-hd0_1.04-$arch.gz" | jq -r .Images[0].ImageId)
|
||||
kernel=$(aws ec2 describe-images --owner amazon --filters "Name=name,Values=pv-grub-hd0_1.05-$arch.gz" | jq -r .Images[0].ImageId)
|
||||
if [ "$kernel" = null ]; then break; fi
|
||||
echo "using PV-GRUB kernel $kernel"
|
||||
extraFlags+=" --virtualization-type paravirtual --kernel $kernel"
|
||||
|
@ -1,15 +1,23 @@
|
||||
#! /bin/sh -e
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p google-cloud-sdk
|
||||
|
||||
BUCKET_NAME=${BUCKET_NAME:-nixos-images}
|
||||
export NIX_PATH=nixpkgs=../../../..
|
||||
export NIXOS_CONFIG=$(dirname $(readlink -f $0))/../../../modules/virtualisation/google-compute-image.nix
|
||||
export TIMESTAMP=$(date +%Y%m%d%H%M)
|
||||
set -euo pipefail
|
||||
|
||||
BUCKET_NAME="${BUCKET_NAME:-nixos-images}"
|
||||
TIMESTAMP="$(date +%Y%m%d%H%M)"
|
||||
export TIMESTAMP
|
||||
|
||||
nix-build '<nixpkgs/nixos>' \
|
||||
-A config.system.build.googleComputeImage --argstr system x86_64-linux -o gce --option extra-binary-caches http://hydra.nixos.org -j 10
|
||||
-A config.system.build.googleComputeImage \
|
||||
--arg configuration "{ imports = [ <nixpkgs/nixos/modules/virtualisation/google-compute-image.nix> ]; }" \
|
||||
--argstr system x86_64-linux \
|
||||
-o gce \
|
||||
-j 10
|
||||
|
||||
img=$(echo gce/*.tar.gz)
|
||||
if ! gsutil ls gs://${BUCKET_NAME}/$(basename $img); then
|
||||
gsutil cp $img gs://${BUCKET_NAME}/$(basename $img)
|
||||
img_path=$(echo gce/*.tar.gz)
|
||||
img_name=$(basename "$img_path")
|
||||
img_id=$(echo "$img_name" | sed 's|.raw.tar.gz$||;s|\.|-|g;s|_|-|g')
|
||||
if ! gsutil ls "gs://${BUCKET_NAME}/$img_name"; then
|
||||
gsutil cp "$img_path" "gs://${BUCKET_NAME}/$img_name"
|
||||
fi
|
||||
gcloud compute images create $(basename $img .raw.tar.gz | sed 's|\.|-|' | sed 's|_|-|') --source-uri gs://${BUCKET_NAME}/$(basename $img)
|
||||
gcloud compute images create "$img_id" --source-uri "gs://${BUCKET_NAME}/$img_name"
|
||||
|
24
nixos/maintainers/scripts/openstack/nova-image.nix
Normal file
24
nixos/maintainers/scripts/openstack/nova-image.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports =
|
||||
[ ../../../modules/installer/cd-dvd/channel.nix
|
||||
../../../modules/virtualisation/nova-config.nix
|
||||
];
|
||||
|
||||
system.build.novaImage = import ../../../lib/make-disk-image.nix {
|
||||
inherit lib config;
|
||||
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
|
||||
diskSize = 8192;
|
||||
format = "qcow2";
|
||||
configFile = pkgs.writeText "configuration.nix"
|
||||
''
|
||||
{
|
||||
imports = [ <nixpkgs/nixos/modules/virtualisation/nova-config.nix> ];
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
270
nixos/modules/config/fonts/fontconfig-penultimate.nix
Normal file
270
nixos/modules/config/fonts/fontconfig-penultimate.nix
Normal file
@ -0,0 +1,270 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.fonts.fontconfig;
|
||||
|
||||
fcBool = x: "<bool>" + (boolToString x) + "</bool>";
|
||||
|
||||
# back-supported fontconfig version and package
|
||||
# version is used for font cache generation
|
||||
supportVersion = "210";
|
||||
supportPkg = pkgs."fontconfig_${supportVersion}";
|
||||
|
||||
# latest fontconfig version and package
|
||||
# version is used for configuration folder name, /etc/fonts/VERSION/
|
||||
# note: format differs from supportVersion and can not be used with makeCacheConf
|
||||
latestVersion = pkgs.fontconfig.configVersion;
|
||||
latestPkg = pkgs.fontconfig;
|
||||
|
||||
# supported version fonts.conf
|
||||
supportFontsConf = pkgs.makeFontsConf { fontconfig = supportPkg; fontDirectories = config.fonts.fonts; };
|
||||
|
||||
# configuration file to read fontconfig cache
|
||||
# version dependent
|
||||
# priority 0
|
||||
cacheConfSupport = makeCacheConf { version = supportVersion; };
|
||||
cacheConfLatest = makeCacheConf {};
|
||||
|
||||
# generate the font cache setting file for a fontconfig version
|
||||
# use latest when no version is passed
|
||||
makeCacheConf = { version ? null }:
|
||||
let
|
||||
fcPackage = if builtins.isNull version
|
||||
then "fontconfig"
|
||||
else "fontconfig_${version}";
|
||||
makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };
|
||||
cache = makeCache pkgs."${fcPackage}";
|
||||
cache32 = makeCache pkgs.pkgsi686Linux."${fcPackage}";
|
||||
in
|
||||
pkgs.writeText "fc-00-nixos-cache.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<!-- Font directories -->
|
||||
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
|
||||
<!-- Pre-generated font caches -->
|
||||
<cachedir>${cache}</cachedir>
|
||||
${optionalString (pkgs.stdenv.isx86_64 && cfg.cache32Bit) ''
|
||||
<cachedir>${cache32}</cachedir>
|
||||
''}
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# The configuration to be included in /etc/font/
|
||||
penultimateConf = pkgs.runCommand "font-penultimate-conf" {} ''
|
||||
support_folder=$out/etc/fonts/conf.d
|
||||
latest_folder=$out/etc/fonts/${latestVersion}/conf.d
|
||||
|
||||
mkdir -p $support_folder
|
||||
mkdir -p $latest_folder
|
||||
|
||||
ln -s ${supportFontsConf} $support_folder/../fonts.conf
|
||||
ln -s ${latestPkg.out}/etc/fonts/fonts.conf \
|
||||
$latest_folder/../fonts.conf
|
||||
|
||||
# fontconfig-penultimate various configuration files
|
||||
ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \
|
||||
$support_folder
|
||||
ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \
|
||||
$latest_folder
|
||||
|
||||
ln -s ${cacheConfSupport} $support_folder/00-nixos-cache.conf
|
||||
ln -s ${cacheConfLatest} $latest_folder/00-nixos-cache.conf
|
||||
|
||||
rm $support_folder/10-antialias.conf $latest_folder/10-antialias.conf
|
||||
ln -s ${antialiasConf} $support_folder/10-antialias.conf
|
||||
ln -s ${antialiasConf} $latest_folder/10-antialias.conf
|
||||
|
||||
rm $support_folder/10-hinting.conf $latest_folder/10-hinting.conf
|
||||
ln -s ${hintingConf} $support_folder/10-hinting.conf
|
||||
ln -s ${hintingConf} $latest_folder/10-hinting.conf
|
||||
|
||||
${optionalString cfg.useEmbeddedBitmaps ''
|
||||
rm $support_folder/10-no-embedded-bitmaps.conf
|
||||
rm $latest_folder/10-no-embedded-bitmaps.conf
|
||||
''}
|
||||
|
||||
rm $support_folder/10-subpixel.conf $latest_folder/10-subpixel.conf
|
||||
ln -s ${subpixelConf} $support_folder/10-subpixel.conf
|
||||
ln -s ${subpixelConf} $latest_folder/10-subpixel.conf
|
||||
|
||||
${optionalString (cfg.dpi != 0) ''
|
||||
ln -s ${dpiConf} $support_folder/11-dpi.conf
|
||||
ln -s ${dpiConf} $latest_folder/11-dpi.conf
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.includeUserConf) ''
|
||||
rm $support_folder/50-user.conf
|
||||
rm $latest_folder/50-user.conf
|
||||
''}
|
||||
|
||||
# 51-local.conf
|
||||
rm $latest_folder/51-local.conf
|
||||
substitute \
|
||||
${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/51-local.conf \
|
||||
$latest_folder/51-local.conf \
|
||||
--replace local.conf /etc/fonts/${latestVersion}/local.conf
|
||||
|
||||
ln -s ${defaultFontsConf} $support_folder/52-default-fonts.conf
|
||||
ln -s ${defaultFontsConf} $latest_folder/52-default-fonts.conf
|
||||
|
||||
${optionalString cfg.allowBitmaps ''
|
||||
rm $support_folder/53-no-bitmaps.conf
|
||||
rm $latest_folder/53-no-bitmaps.conf
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.allowType1) ''
|
||||
ln -s ${rejectType1} $support_folder/53-no-type1.conf
|
||||
ln -s ${rejectType1} $latest_folder/53-no-type1.conf
|
||||
''}
|
||||
'';
|
||||
|
||||
hintingConf = pkgs.writeText "fc-10-hinting.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default rendering settings -->
|
||||
<match target="pattern">
|
||||
<edit mode="append" name="hinting">
|
||||
${fcBool cfg.hinting.enable}
|
||||
</edit>
|
||||
<edit mode="append" name="autohint">
|
||||
${fcBool cfg.hinting.autohint}
|
||||
</edit>
|
||||
<edit mode="append" name="hintstyle">
|
||||
<const>hintslight</const>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
antialiasConf = pkgs.writeText "fc-10-antialias.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default rendering settings -->
|
||||
<match target="pattern">
|
||||
<edit mode="append" name="antialias">
|
||||
${fcBool cfg.antialias}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
subpixelConf = pkgs.writeText "fc-10-subpixel.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default rendering settings -->
|
||||
<match target="pattern">
|
||||
<edit mode="append" name="rgba">
|
||||
<const>${cfg.subpixel.rgba}</const>
|
||||
</edit>
|
||||
<edit mode="append" name="lcdfilter">
|
||||
<const>lcd${cfg.subpixel.lcdfilter}</const>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
dpiConf = pkgs.writeText "fc-11-dpi.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<match target="pattern">
|
||||
<edit name="dpi" mode="assign">
|
||||
<double>${toString cfg.dpi}</double>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
defaultFontsConf =
|
||||
let genDefault = fonts: name:
|
||||
optionalString (fonts != []) ''
|
||||
<alias>
|
||||
<family>${name}</family>
|
||||
<prefer>
|
||||
${concatStringsSep ""
|
||||
(map (font: ''
|
||||
<family>${font}</family>
|
||||
'') fonts)}
|
||||
</prefer>
|
||||
</alias>
|
||||
'';
|
||||
in
|
||||
pkgs.writeText "fc-52-nixos-default-fonts.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default fonts -->
|
||||
${genDefault cfg.defaultFonts.sansSerif "sans-serif"}
|
||||
|
||||
${genDefault cfg.defaultFonts.serif "serif"}
|
||||
|
||||
${genDefault cfg.defaultFonts.monospace "monospace"}
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
rejectType1 = pkgs.writeText "fc-53-no-type1.conf" ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
<!-- Reject Type 1 fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="fontformat"><string>Type 1</string></patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
fonts = {
|
||||
|
||||
fontconfig = {
|
||||
|
||||
penultimate = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable fontconfig-penultimate settings to supplement the
|
||||
NixOS defaults by providing per-font rendering defaults and
|
||||
metric aliases.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf (config.fonts.fontconfig.enable && cfg.enable) {
|
||||
|
||||
fonts.fontconfig.confPackages = [ penultimateConf ];
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -8,61 +8,6 @@ let fcBool = x: if x then "<bool>true</bool>" else "<bool>false</bool>";
|
||||
|
||||
latestVersion = pkgs.fontconfig.configVersion;
|
||||
|
||||
# fontconfig ultimate main configuration file
|
||||
# priority 52
|
||||
fontconfigUltimateConf = pkgs.writeText "fc-52-fontconfig-ultimate.conf" ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
${optionalString (!cfg.allowBitmaps) ''
|
||||
<!-- Reject bitmap fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="scalable"><bool>false</bool></patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
${optionalString cfg.allowType1 ''
|
||||
<!-- Reject Type 1 fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="fontformat">
|
||||
<string>Type 1</string>
|
||||
</patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
<!-- Use embedded bitmaps in fonts like Calibri? -->
|
||||
<match target="font">
|
||||
<edit name="embeddedbitmap" mode="assign">
|
||||
${fcBool cfg.useEmbeddedBitmaps}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!-- Force autohint always -->
|
||||
<match target="font">
|
||||
<edit name="force_autohint" mode="assign">
|
||||
${fcBool cfg.forceAutohint}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!-- Render some monospace TTF fonts as bitmaps -->
|
||||
<match target="pattern">
|
||||
<edit name="bitmap_monospace" mode="assign">
|
||||
${fcBool cfg.renderMonoTTFAsBitmap}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# The configuration to be included in /etc/font/
|
||||
confPkg = pkgs.runCommand "font-ultimate-conf" {} ''
|
||||
support_folder=$out/etc/fonts/conf.d
|
||||
@ -71,12 +16,6 @@ let fcBool = x: if x then "<bool>true</bool>" else "<bool>false</bool>";
|
||||
mkdir -p $support_folder
|
||||
mkdir -p $latest_folder
|
||||
|
||||
# 52-fontconfig-ultimate.conf
|
||||
ln -s ${fontconfigUltimateConf} \
|
||||
$support_folder/52-fontconfig-ultimate.conf
|
||||
ln -s ${fontconfigUltimateConf} \
|
||||
$latest_folder/52-fontconfig-ultimate.conf
|
||||
|
||||
# fontconfig ultimate substitutions
|
||||
${optionalString (cfg.substitutions != "none") ''
|
||||
ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \
|
||||
@ -104,7 +43,7 @@ in
|
||||
ultimate = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
default = false;
|
||||
description = ''
|
||||
Enable fontconfig-ultimate settings (formerly known as
|
||||
Infinality). Besides the customizable settings in this NixOS
|
||||
@ -113,45 +52,6 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
allowBitmaps = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Allow bitmap fonts. Set to <literal>false</literal> to ban all
|
||||
bitmap fonts.
|
||||
'';
|
||||
};
|
||||
|
||||
allowType1 = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Allow Type-1 fonts. Default is <literal>false</literal> because of
|
||||
poor rendering.
|
||||
'';
|
||||
};
|
||||
|
||||
useEmbeddedBitmaps = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''Use embedded bitmaps in fonts like Calibri.'';
|
||||
};
|
||||
|
||||
forceAutohint = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Force use of the TrueType Autohinter. Useful for debugging or
|
||||
free-software purists.
|
||||
'';
|
||||
};
|
||||
|
||||
renderMonoTTFAsBitmap = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''Render some monospace TTF fonts as bitmaps.'';
|
||||
};
|
||||
|
||||
substitutions = mkOption {
|
||||
type = types.nullOr (types.enum ["free" "combi" "ms"]);
|
||||
default = "free";
|
||||
|
@ -20,7 +20,7 @@ with lib;
|
||||
|
||||
let cfg = config.fonts.fontconfig;
|
||||
|
||||
fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
|
||||
fcBool = x: "<bool>" + (boolToString x) + "</bool>";
|
||||
|
||||
# back-supported fontconfig version and package
|
||||
# version is used for font cache generation
|
||||
@ -41,11 +41,11 @@ let cfg = config.fonts.fontconfig;
|
||||
# priority 0
|
||||
cacheConfSupport = makeCacheConf { version = supportVersion; };
|
||||
cacheConfLatest = makeCacheConf {};
|
||||
|
||||
|
||||
# generate the font cache setting file for a fontconfig version
|
||||
# use latest when no version is passed
|
||||
makeCacheConf = { version ? null }:
|
||||
let
|
||||
let
|
||||
fcPackage = if builtins.isNull version
|
||||
then "fontconfig"
|
||||
else "fontconfig_${version}";
|
||||
@ -75,23 +75,23 @@ let cfg = config.fonts.fontconfig;
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default rendering settings -->
|
||||
<match target="font">
|
||||
<edit mode="assign" name="hinting">
|
||||
<match target="pattern">
|
||||
<edit mode="append" name="hinting">
|
||||
${fcBool cfg.hinting.enable}
|
||||
</edit>
|
||||
<edit mode="assign" name="autohint">
|
||||
<edit mode="append" name="autohint">
|
||||
${fcBool cfg.hinting.autohint}
|
||||
</edit>
|
||||
<edit mode="assign" name="hintstyle">
|
||||
<const>hint${cfg.hinting.style}</const>
|
||||
<edit mode="append" name="hintstyle">
|
||||
<const>hintslight</const>
|
||||
</edit>
|
||||
<edit mode="assign" name="antialias">
|
||||
<edit mode="append" name="antialias">
|
||||
${fcBool cfg.antialias}
|
||||
</edit>
|
||||
<edit mode="assign" name="rgba">
|
||||
<edit mode="append" name="rgba">
|
||||
<const>${cfg.subpixel.rgba}</const>
|
||||
</edit>
|
||||
<edit mode="assign" name="lcdfilter">
|
||||
<edit mode="append" name="lcdfilter">
|
||||
<const>lcd${cfg.subpixel.lcdfilter}</const>
|
||||
</edit>
|
||||
</match>
|
||||
@ -113,7 +113,7 @@ let cfg = config.fonts.fontconfig;
|
||||
|
||||
# default fonts configuration file
|
||||
# priority 52
|
||||
defaultFontsConf =
|
||||
defaultFontsConf =
|
||||
let genDefault = fonts: name:
|
||||
optionalString (fonts != []) ''
|
||||
<alias>
|
||||
@ -142,7 +142,54 @@ let cfg = config.fonts.fontconfig;
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# fontconfig configuration package
|
||||
# bitmap font options
|
||||
# priority 53
|
||||
rejectBitmaps = pkgs.writeText "fc-53-nixos-bitmaps.conf" ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
${optionalString (!cfg.allowBitmaps) ''
|
||||
<!-- Reject bitmap fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="scalable"><bool>false</bool></patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
<!-- Use embedded bitmaps in fonts like Calibri? -->
|
||||
<match target="font">
|
||||
<edit name="embeddedbitmap" mode="assign">
|
||||
${fcBool cfg.useEmbeddedBitmaps}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# reject Type 1 fonts
|
||||
# priority 53
|
||||
rejectType1 = pkgs.writeText "fc-53-nixos-reject-type1.conf" ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
<!-- Reject Type 1 fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="fontformat"><string>Type 1</string></patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# fontconfig configuration package
|
||||
confPkg = pkgs.runCommand "fontconfig-conf" {} ''
|
||||
support_folder=$out/etc/fonts
|
||||
latest_folder=$out/etc/fonts/${latestVersion}
|
||||
@ -166,7 +213,7 @@ let cfg = config.fonts.fontconfig;
|
||||
|
||||
substitute ${latestPkg.out}/etc/fonts/conf.d/51-local.conf \
|
||||
$latest_folder/conf.d/51-local.conf \
|
||||
--replace local.conf /etc/fonts/${latestVersion}/local.conf
|
||||
--replace local.conf /etc/fonts/${latestVersion}/local.conf
|
||||
|
||||
# 00-nixos-cache.conf
|
||||
ln -s ${cacheConfSupport} \
|
||||
@ -192,6 +239,16 @@ let cfg = config.fonts.fontconfig;
|
||||
# 52-nixos-default-fonts.conf
|
||||
ln -s ${defaultFontsConf} $support_folder/conf.d/52-nixos-default-fonts.conf
|
||||
ln -s ${defaultFontsConf} $latest_folder/conf.d/52-nixos-default-fonts.conf
|
||||
|
||||
# 53-nixos-bitmaps.conf
|
||||
ln -s ${rejectBitmaps} $support_folder/conf.d/53-nixos-bitmaps.conf
|
||||
ln -s ${rejectBitmaps} $latest_folder/conf.d/53-nixos-bitmaps.conf
|
||||
|
||||
${optionalString (! cfg.allowType1) ''
|
||||
# 53-nixos-reject-type1.conf
|
||||
ln -s ${rejectType1} $support_folder/conf.d/53-nixos-reject-type1.conf
|
||||
ln -s ${rejectType1} $latest_folder/conf.d/53-nixos-reject-type1.conf
|
||||
''}
|
||||
'';
|
||||
|
||||
# Package with configuration files
|
||||
@ -233,7 +290,11 @@ in
|
||||
antialias = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable font antialiasing.";
|
||||
description = ''
|
||||
Enable font antialiasing. At high resolution (> 200 DPI),
|
||||
antialiasing has no visible effect; users of such displays may want
|
||||
to disable this option.
|
||||
'';
|
||||
};
|
||||
|
||||
dpi = mkOption {
|
||||
@ -249,7 +310,7 @@ in
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
System-wide customization file contents, has higher priority than
|
||||
System-wide customization file contents, has higher priority than
|
||||
<literal>defaultFonts</literal> settings.
|
||||
'';
|
||||
};
|
||||
@ -287,26 +348,21 @@ in
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable TrueType hinting.";
|
||||
description = ''
|
||||
Enable font hinting. Hinting aligns glyphs to pixel boundaries to
|
||||
improve rendering sharpness at low resolution. At high resolution
|
||||
(> 200 dpi) hinting will do nothing (at best); users of such
|
||||
displays may want to disable this option.
|
||||
'';
|
||||
};
|
||||
|
||||
autohint = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
default = false;
|
||||
description = ''
|
||||
Enable the autohinter, which provides hinting for otherwise
|
||||
un-hinted fonts. The results are usually lower quality than
|
||||
correctly-hinted fonts.
|
||||
'';
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = types.enum ["none" "slight" "medium" "full"];
|
||||
default = "full";
|
||||
description = ''
|
||||
TrueType hinting style, one of <literal>none</literal>,
|
||||
<literal>slight</literal>, <literal>medium</literal>, or
|
||||
<literal>full</literal>.
|
||||
Enable the autohinter in place of the default interpreter.
|
||||
The results are usually lower quality than correctly-hinted
|
||||
fonts, but better than unhinted fonts.
|
||||
'';
|
||||
};
|
||||
};
|
||||
@ -327,7 +383,15 @@ in
|
||||
default = "rgb";
|
||||
type = types.enum ["rgb" "bgr" "vrgb" "vbgr" "none"];
|
||||
description = ''
|
||||
Subpixel order.
|
||||
Subpixel order. The overwhelming majority of displays are
|
||||
<literal>rgb</literal> in their normal orientation. Select
|
||||
<literal>vrgb</literal> for mounting such a display 90 degrees
|
||||
clockwise from its normal orientation or <literal>vbgr</literal>
|
||||
for mounting 90 degrees counter-clockwise. Select
|
||||
<literal>bgr</literal> in the unlikely event of mounting 180
|
||||
degrees from the normal orientation. Reverse these directions in
|
||||
the improbable event that the display's native subpixel order is
|
||||
<literal>bgr</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
@ -335,7 +399,9 @@ in
|
||||
default = "default";
|
||||
type = types.enum ["none" "default" "light" "legacy"];
|
||||
description = ''
|
||||
FreeType LCD filter.
|
||||
FreeType LCD filter. At high resolution (> 200 DPI), LCD filtering
|
||||
has no visible effect; users of such displays may want to select
|
||||
<literal>none</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
@ -349,16 +415,43 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
allowBitmaps = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Allow bitmap fonts. Set to <literal>false</literal> to ban all
|
||||
bitmap fonts.
|
||||
'';
|
||||
};
|
||||
|
||||
allowType1 = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Allow Type-1 fonts. Default is <literal>false</literal> because of
|
||||
poor rendering.
|
||||
'';
|
||||
};
|
||||
|
||||
useEmbeddedBitmaps = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''Use embedded bitmaps in fonts like Calibri.'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
fonts.fontconfig.confPackages = [ confPkg ];
|
||||
|
||||
environment.systemPackages = [ pkgs.fontconfig ];
|
||||
environment.etc.fonts.source = "${fontconfigEtc}/etc/fonts/";
|
||||
};
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.fontconfig ];
|
||||
environment.etc.fonts.source = "${fontconfigEtc}/etc/fonts/";
|
||||
})
|
||||
(mkIf (cfg.enable && !cfg.penultimate.enable) {
|
||||
fonts.fontconfig.confPackages = [ confPkg ];
|
||||
})
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ with lib;
|
||||
pkgs.xorg.fontbhlucidatypewriter75dpi
|
||||
pkgs.dejavu_fonts
|
||||
pkgs.freefont_ttf
|
||||
pkgs.gyre-fonts # TrueType substitutes for standard PostScript fonts
|
||||
pkgs.liberation_ttf
|
||||
pkgs.xorg.fontbh100dpi
|
||||
pkgs.xorg.fontmiscmisc
|
||||
|
@ -2,21 +2,27 @@
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
glibcLocales = pkgs.glibcLocales.override {
|
||||
allLocales = any (x: x == "all") config.i18n.supportedLocales;
|
||||
locales = config.i18n.supportedLocales;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
i18n = {
|
||||
glibcLocales = mkOption {
|
||||
type = types.path;
|
||||
default = pkgs.glibcLocales.override {
|
||||
allLocales = any (x: x == "all") config.i18n.supportedLocales;
|
||||
locales = config.i18n.supportedLocales;
|
||||
};
|
||||
example = literalExample "pkgs.glibcLocales";
|
||||
description = ''
|
||||
Customized pkg.glibcLocales package.
|
||||
|
||||
Changing this option can disable handling of i18n.defaultLocale
|
||||
and supportedLocale.
|
||||
'';
|
||||
};
|
||||
|
||||
defaultLocale = mkOption {
|
||||
type = types.str;
|
||||
default = "en_US.UTF-8";
|
||||
@ -118,7 +124,7 @@ in
|
||||
'');
|
||||
|
||||
environment.systemPackages =
|
||||
optional (config.i18n.supportedLocales != []) glibcLocales;
|
||||
optional (config.i18n.supportedLocales != []) config.i18n.glibcLocales;
|
||||
|
||||
environment.sessionVariables =
|
||||
{ LANG = config.i18n.defaultLocale;
|
||||
@ -126,7 +132,7 @@ in
|
||||
};
|
||||
|
||||
systemd.globalEnvironment = mkIf (config.i18n.supportedLocales != []) {
|
||||
LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
|
||||
LOCALE_ARCHIVE = "${config.i18n.glibcLocales}/lib/locale/locale-archive";
|
||||
};
|
||||
|
||||
# ‘/etc/locale.conf’ is used by systemd.
|
||||
|
@ -178,10 +178,10 @@ in
|
||||
|
||||
environment.etc =
|
||||
{ # /etc/services: TCP/UDP port assignments.
|
||||
"services".source = pkgs.iana_etc + "/etc/services";
|
||||
"services".source = pkgs.iana-etc + "/etc/services";
|
||||
|
||||
# /etc/protocols: IP protocol numbers.
|
||||
"protocols".source = pkgs.iana_etc + "/etc/protocols";
|
||||
"protocols".source = pkgs.iana-etc + "/etc/protocols";
|
||||
|
||||
# /etc/rpc: RPC program numbers.
|
||||
"rpc".source = pkgs.glibc.out + "/etc/rpc";
|
||||
@ -251,11 +251,6 @@ in
|
||||
# Install the proxy environment variables
|
||||
environment.sessionVariables = cfg.proxy.envVars;
|
||||
|
||||
# The ‘ip-up’ target is kept for backwards compatibility.
|
||||
# New services should use systemd upstream targets:
|
||||
# See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
|
||||
systemd.targets.ip-up.description = "Services Requiring IP Connectivity (deprecated)";
|
||||
|
||||
# This is needed when /etc/resolv.conf is being overriden by networkd
|
||||
# and other configurations. If the file is destroyed by an environment
|
||||
# activation then it must be rebuilt so that applications which interface
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user