mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-10 22:30:59 +00:00
Compare commits
5 Commits
staging-ne
...
23.11-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c28f1de7c | ||
|
|
bf0e44973f | ||
|
|
7fecfc443f | ||
|
|
ec7d794042 | ||
|
|
180f05bf8c |
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
@@ -47,12 +47,6 @@
|
||||
/pkgs/build-support/setup-hooks/auto-patchelf.py @layus
|
||||
/pkgs/pkgs-lib @infinisil
|
||||
|
||||
# pkgs/by-name
|
||||
/pkgs/test/nixpkgs-check-by-name @infinisil
|
||||
/pkgs/by-name/README.md @infinisil
|
||||
/pkgs/top-level/by-name-overlay.nix @infinisil
|
||||
/.github/workflows/check-by-name.nix @infinisil
|
||||
|
||||
# Nixpkgs build-support
|
||||
/pkgs/build-support/writers @lassulus @Profpatsch
|
||||
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -22,7 +22,7 @@ For new packages please briefly describe the package or provide a link to its ho
|
||||
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
|
||||
- [ ] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
|
||||
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
|
||||
- [23.11 Release Notes (or backporting 23.05 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2305-release-notes)
|
||||
- [23.05 Release Notes (or backporting 22.11 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2305-release-notes)
|
||||
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
|
||||
- [ ] (Module updates) Added a release notes entry if the change is significant
|
||||
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
|
||||
|
||||
54
.github/workflows/check-by-name.yml
vendored
54
.github/workflows/check-by-name.yml
vendored
@@ -1,54 +0,0 @@
|
||||
# Checks pkgs/by-name (see pkgs/by-name/README.md)
|
||||
# using the nixpkgs-check-by-name tool (see pkgs/test/nixpkgs-check-by-name)
|
||||
name: Check pkgs/by-name
|
||||
|
||||
# The pre-built tool is fetched from a channel,
|
||||
# making it work predictable on all PRs.
|
||||
on:
|
||||
# Using pull_request_target instead of pull_request avoids having to approve first time contributors
|
||||
pull_request_target
|
||||
|
||||
# The tool doesn't need any permissions, it only outputs success or not based on the checkout
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
# This is x86_64-linux, for which the tool is always prebuilt on the nixos-* channels,
|
||||
# as specified in nixos/release-combined.nix
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- uses: cachix/install-nix-action@v23
|
||||
- name: Determining channel to use for dependencies
|
||||
run: |
|
||||
echo "Determining which channel to use for PR base branch $GITHUB_BASE_REF"
|
||||
if [[ "$GITHUB_BASE_REF" =~ ^(release|staging|staging-next)-([0-9][0-9]\.[0-9][0-9])$ ]]; then
|
||||
# Use the release channel for all PRs to release-XX.YY, staging-XX.YY and staging-next-XX.YY
|
||||
channel=nixos-${BASH_REMATCH[2]}
|
||||
echo "PR is for a release branch, using release channel $channel"
|
||||
else
|
||||
# Use the nixos-unstable channel for all other PRs
|
||||
channel=nixos-unstable
|
||||
echo "PR is for a non-release branch, using unstable channel $channel"
|
||||
fi
|
||||
echo "channel=$channel" >> "$GITHUB_ENV"
|
||||
- name: Fetching latest version of channel
|
||||
run: |
|
||||
echo "Fetching latest version of channel $channel"
|
||||
# This is probably the easiest way to get Nix to output the path to a downloaded channel!
|
||||
nixpkgs=$(nix-instantiate --find-file nixpkgs -I nixpkgs=channel:"$channel")
|
||||
# This file only exists in channels
|
||||
rev=$(<"$nixpkgs"/.git-revision)
|
||||
echo "Channel $channel is at revision $rev"
|
||||
echo "nixpkgs=$nixpkgs" >> "$GITHUB_ENV"
|
||||
echo "rev=$rev" >> "$GITHUB_ENV"
|
||||
- name: Fetching pre-built nixpkgs-check-by-name from the channel
|
||||
run: |
|
||||
echo "Fetching pre-built nixpkgs-check-by-name from channel $channel at revision $rev"
|
||||
# Passing --max-jobs 0 makes sure that we won't build anything
|
||||
nix-build "$nixpkgs" -A tests.nixpkgs-check-by-name --max-jobs 0
|
||||
- name: Running nixpkgs-check-by-name
|
||||
run: result/bin/nixpkgs-check-by-name .
|
||||
4
.github/workflows/periodic-merge-24h.yml
vendored
4
.github/workflows/periodic-merge-24h.yml
vendored
@@ -38,6 +38,10 @@ jobs:
|
||||
into: staging-next-22.11
|
||||
- from: staging-next-22.11
|
||||
into: staging-22.11
|
||||
- from: release-23.05
|
||||
into: staging-next-23.05
|
||||
- from: staging-next-23.05
|
||||
into: staging-23.05
|
||||
name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@@ -106,17 +106,17 @@ git push origin feature --force-with-lease
|
||||
|
||||
Follow these steps to backport a change into a release branch in compliance with the [commit policy](https://nixos.org/nixpkgs/manual/#submitting-changes-stable-release-branches).
|
||||
|
||||
You can add a label such as `backport release-23.05` to a PR, so that merging it will
|
||||
You can add a label such as `backport release-22.11` to a PR, so that merging it will
|
||||
automatically create a backport (via [a GitHub Action](.github/workflows/backport.yml)).
|
||||
This also works for pull requests that have already been merged, and might take a couple of minutes to trigger.
|
||||
This also works for PR's that have already been merged, and might take a couple of minutes to trigger.
|
||||
|
||||
You can also create the backport manually:
|
||||
|
||||
1. Take note of the commits in which the change was introduced into `master` branch.
|
||||
2. Check out the target _release branch_, e.g. `release-23.05`. Do not use a _channel branch_ like `nixos-23.05` or `nixpkgs-23.05-darwin`.
|
||||
2. Check out the target _release branch_, e.g. `release-22.11`. Do not use a _channel branch_ like `nixos-22.11` or `nixpkgs-22.11-darwin`.
|
||||
3. Create a branch for your change, e.g. `git checkout -b backport`.
|
||||
4. When the reason to backport is not obvious from the original commit message, use `git cherry-pick -xe <original commit>` and add a reason. Otherwise use `git cherry-pick -x <original commit>`. That's fine for minor version updates that only include security and bug fixes, commits that fixes an otherwise broken package or similar. Please also ensure the commits exists on the master branch; in the case of squashed or rebased merges, the commit hash will change and the new commits can be found in the merge message at the bottom of the master pull request.
|
||||
5. Push to GitHub and open a backport pull request. Make sure to select the release branch (e.g. `release-23.05`) as the target branch of the pull request, and link to the pull request in which the original change was committed to `master`. The pull request title should be the commit title with the release version as prefix, e.g. `[23.05]`.
|
||||
5. Push to GitHub and open a backport pull request. Make sure to select the release branch (e.g. `release-22.11`) as the target branch of the pull request, and link to the pull request in which the original change was committed to `master`. The pull request title should be the commit title with the release version as prefix, e.g. `[22.11]`.
|
||||
6. When the backport pull request is merged and you have the necessary privileges you can also replace the label `9.needs: port to stable` with `8.has: port to stable` on the original pull request. This way maintainers can keep track of missing backports easier.
|
||||
|
||||
## Criteria for Backporting changes
|
||||
@@ -128,7 +128,7 @@ Anything that does not cause user or downstream dependency regressions can be ba
|
||||
- Services which require a client to be up-to-date regardless. (E.g. `spotify`, `steam`, or `discord`)
|
||||
- Security critical applications (E.g. `firefox`)
|
||||
|
||||
## Generating 23.11 Release Notes
|
||||
## Generating 23.05 Release Notes
|
||||
<!--
|
||||
note: title unchanged even though we don't need regeneration because extant
|
||||
PRs will link here. definitely change the title for 23.11 though.
|
||||
@@ -136,10 +136,10 @@ PRs will link here. definitely change the title for 23.11 though.
|
||||
|
||||
Documentation in nixpkgs is transitioning to a markdown-centric workflow. In the past release notes required a translation step to convert from markdown to a compatible docbook document, but this is no longer necessary.
|
||||
|
||||
Steps for updating 23.11 Release notes:
|
||||
Steps for updating 23.05 Release notes:
|
||||
|
||||
1. Edit `nixos/doc/manual/release-notes/rl-2311.section.md` with the desired changes
|
||||
2. Commit changes to `rl-2311.section.md`.
|
||||
1. Edit `nixos/doc/manual/release-notes/rl-2305.section.md` with the desired changes
|
||||
2. Commit changes to `rl-2305.section.md`.
|
||||
|
||||
## Reviewing contributions
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ Nixpkgs and NixOS are built and tested by our continuous integration
|
||||
system, [Hydra](https://hydra.nixos.org/).
|
||||
|
||||
* [Continuous package builds for unstable/master](https://hydra.nixos.org/jobset/nixos/trunk-combined)
|
||||
* [Continuous package builds for the NixOS 23.05 release](https://hydra.nixos.org/jobset/nixos/release-23.05)
|
||||
* [Continuous package builds for the NixOS 22.11 release](https://hydra.nixos.org/jobset/nixos/release-22.11)
|
||||
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
|
||||
* [Tests for the NixOS 23.05 release](https://hydra.nixos.org/job/nixos/release-23.05/tested#tabs-constituents)
|
||||
* [Tests for the NixOS 22.11 release](https://hydra.nixos.org/job/nixos/release-22.11/tested#tabs-constituents)
|
||||
|
||||
Artifacts successfully built with Hydra are published to cache at
|
||||
https://cache.nixos.org/. When successful build and test criteria are
|
||||
|
||||
@@ -11,8 +11,6 @@ Accepted arguments are:
|
||||
Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed.
|
||||
- `multiPkgs`
|
||||
Packages to be installed for all architectures supported by a host (i.e. i686 and x86_64 on x86_64 installations). Only libraries are installed by default.
|
||||
- `multiArch`
|
||||
Whether to install 32bit multiPkgs into the FHSEnv in 64bit environments
|
||||
- `extraBuildCommands`
|
||||
Additional commands to be executed for finalizing the directory structure.
|
||||
- `extraBuildCommandsMulti`
|
||||
|
||||
@@ -998,18 +998,6 @@ benchmark component.
|
||||
`dontCoverage drv`
|
||||
: Sets the `doCoverage` argument to `false` for `drv`.
|
||||
|
||||
`enableExecutableProfiling drv`
|
||||
: Sets the `enableExecutableProfiling` argument to `true` for `drv`.
|
||||
|
||||
`disableExecutableProfiling drv`
|
||||
: Sets the `enableExecutableProfiling` argument to `false` for `drv`.
|
||||
|
||||
`enableLibraryProfiling drv`
|
||||
: Sets the `enableLibraryProfiling` argument to `true` for `drv`.
|
||||
|
||||
`disableLibraryProfiling drv`
|
||||
: Sets the `enableLibraryProfiling` argument to `false` for `drv`.
|
||||
|
||||
#### Library functions in the Haskell package sets {#haskell-package-set-lib-functions}
|
||||
|
||||
Some library functions depend on packages from the Haskell package sets. Thus they are
|
||||
@@ -1084,124 +1072,6 @@ covered in the old [haskell4nix docs](https://haskell4nix.readthedocs.io/).
|
||||
If you feel any important topic is not documented at all, feel free to comment
|
||||
on the issue linked above.
|
||||
|
||||
### How to enable or disable profiling builds globally? {#haskell-faq-override-profiling}
|
||||
|
||||
By default, Nixpkgs builds a profiling version of each Haskell library. The
|
||||
exception to this rule are some platforms where it is disabled due to concerns
|
||||
over output size. You may want to…
|
||||
|
||||
* …enable profiling globally so that you can build a project you are working on
|
||||
with profiling ability giving you insight in the time spent across your code
|
||||
and code you depend on using [GHC's profiling feature][profiling].
|
||||
|
||||
* …disable profiling (globally) to reduce the time spent building the profiling
|
||||
versions of libraries which a significant amount of build time is spent on
|
||||
(although they are not as expensive as the “normal” build of a Haskell library).
|
||||
|
||||
::: {.note}
|
||||
The method described below affects the build of all libraries in the
|
||||
respective Haskell package set as well as GHC. If your choices differ from
|
||||
Nixpkgs' default for your (host) platform, you will lose the ability to
|
||||
substitute from the official binary cache.
|
||||
|
||||
If you are concerned about build times and thus want to disable profiling, it
|
||||
probably makes sense to use `haskell.lib.compose.disableLibraryProfiling` (see
|
||||
[](#haskell-trivial-helpers)) on the packages you are building locally while
|
||||
continuing to substitute their dependencies and GHC.
|
||||
:::
|
||||
|
||||
Since we need to change the profiling settings for the desired Haskell package
|
||||
set _and_ GHC (as the core libraries like `base`, `filepath` etc. are bundled
|
||||
with GHC), it is recommended to use overlays for Nixpkgs to change them.
|
||||
Since the interrelated parts, i.e. the package set and GHC, are connected
|
||||
via the Nixpkgs fixpoint, we need to modify them both in a way that preserves
|
||||
their connection (or else we'd have to wire it up again manually). This is
|
||||
achieved by changing GHC and the package set in seperate overlays to prevent
|
||||
the package set from pulling in GHC from `prev`.
|
||||
|
||||
The result is two overlays like the ones shown below. Adjustable parts are
|
||||
annotated with comments, as are any optional or alternative ways to achieve
|
||||
the desired profiling settings without causing too many rebuilds.
|
||||
|
||||
<!-- TODO(@sternenseemann): buildHaskellPackages != haskellPackages with this overlay,
|
||||
affected by https://github.com/NixOS/nixpkgs/issues/235960 which needs to be fixed
|
||||
properly still.
|
||||
-->
|
||||
|
||||
```nix
|
||||
let
|
||||
# Name of the compiler and package set you want to change. If you are using
|
||||
# the default package set `haskellPackages`, you need to look up what version
|
||||
# of GHC it currently uses (note that this is subject to change).
|
||||
ghcName = "ghc92";
|
||||
# Desired new setting
|
||||
enableProfiling = true;
|
||||
in
|
||||
|
||||
[
|
||||
# The first overlay modifies the GHC derivation so that it does or does not
|
||||
# build profiling versions of the core libraries bundled with it. It is
|
||||
# recommended to only use such an overlay if you are enabling profiling on a
|
||||
# platform that doesn't by default, because compiling GHC from scratch is
|
||||
# quite expensive.
|
||||
(final: prev:
|
||||
let
|
||||
inherit (final) lib;
|
||||
in
|
||||
|
||||
{
|
||||
haskell = lib.recursiveUpdate prev.haskell {
|
||||
compiler.${ghcName} = prev.haskell.compiler.${ghcName}.override {
|
||||
# Unfortunately, the GHC setting is named differently for historical reasons
|
||||
enableProfiledLibs = enableProfiling;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(final: prev:
|
||||
let
|
||||
inherit (final) lib;
|
||||
haskellLib = final.haskell.lib.compose;
|
||||
in
|
||||
|
||||
{
|
||||
haskell = lib.recursiveUpdate prev.haskell {
|
||||
packages.${ghcName} = prev.haskell.packages.${ghcName}.override {
|
||||
overrides = hfinal: hprev: {
|
||||
mkDerivation = args: hprev.mkDerivation (args // {
|
||||
# Since we are forcing our ideas upon mkDerivation, this change will
|
||||
# affect every package in the package set.
|
||||
enableLibraryProfiling = enableProfiling;
|
||||
|
||||
# To actually use profiling on an executable, executable profiling
|
||||
# needs to be enabled for the executable you want to profile. You
|
||||
# can either do this globally or…
|
||||
enableExecutableProfiling = enableProfiling;
|
||||
});
|
||||
|
||||
# …only for the package that contains an executable you want to profile.
|
||||
# That saves on unnecessary rebuilds for packages that you only depend
|
||||
# on for their library, but also contain executables (e.g. pandoc).
|
||||
my-executable = haskellLib.enableExecutableProfiling hprev.my-executable;
|
||||
|
||||
# If you are disabling profiling to save on build time, but want to
|
||||
# retain the ability to substitute from the binary cache. Drop the
|
||||
# override for mkDerivation above and instead have an override like
|
||||
# this for the specific packages you are building locally and want
|
||||
# to make cheaper to build.
|
||||
my-library = haskellLib.disableLibraryProfiling hprev.my-library;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
<!-- TODO(@sternenseemann): write overriding mkDerivation, overriding GHC, and
|
||||
overriding the entire package set sections and link to them from here where
|
||||
relevant.
|
||||
-->
|
||||
|
||||
[Stackage]: https://www.stackage.org
|
||||
[cabal-project-files]: https://cabal.readthedocs.io/en/latest/cabal-project.html
|
||||
[cabal2nix]: https://github.com/nixos/cabal2nix
|
||||
|
||||
@@ -196,14 +196,10 @@ buildNpmPackage rec {
|
||||
* `npmDepsHash`: The output hash of the dependencies for this project. Can be calculated in advance with [`prefetch-npm-deps`](#javascript-buildNpmPackage-prefetch-npm-deps).
|
||||
* `makeCacheWritable`: Whether to make the cache writable prior to installing dependencies. Don't set this unless npm tries to write to the cache directory, as it can slow down the build.
|
||||
* `npmBuildScript`: The script to run to build the project. Defaults to `"build"`.
|
||||
* `npmWorkspace`: The workspace directory within the project to build and install.
|
||||
* `dontNpmBuild`: Option to disable running the build script. Set to `true` if the package does not have a build script. Defaults to `false`. Alternatively, setting `buildPhase` explicitly also disables this.
|
||||
* `dontNpmInstall`: Option to disable running `npm install`. Defaults to `false`. Alternatively, setting `installPhase` explicitly also disables this.
|
||||
* `npmFlags`: Flags to pass to all npm commands.
|
||||
* `npmInstallFlags`: Flags to pass to `npm ci`.
|
||||
* `npmInstallFlags`: Flags to pass to `npm ci` and `npm prune`.
|
||||
* `npmBuildFlags`: Flags to pass to `npm run ${npmBuildScript}`.
|
||||
* `npmPackFlags`: Flags to pass to `npm pack`.
|
||||
* `npmPruneFlags`: Flags to pass to `npm prune`. Defaults to the value of `npmInstallFlags`.
|
||||
|
||||
#### prefetch-npm-deps {#javascript-buildNpmPackage-prefetch-npm-deps}
|
||||
|
||||
|
||||
@@ -15,23 +15,32 @@ case of packages not containing exported library code the attribute
|
||||
The following example shows a Nim program that depends only on Nim libraries:
|
||||
|
||||
```nix
|
||||
{ lib, nimPackages, fetchFromGitHub }:
|
||||
{ lib, nimPackages, fetchurl }:
|
||||
|
||||
nimPackages.buildNimPackage rec {
|
||||
pname = "hottext";
|
||||
version = "1.4";
|
||||
|
||||
nimPackages.buildNimPackage (finalAttrs: {
|
||||
pname = "ttop";
|
||||
version = "1.0.1";
|
||||
nimBinOnly = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "inv2004";
|
||||
repo = "ttop";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-x4Uczksh6p3XX/IMrOFtBxIleVHdAPX9e8n32VAUTC4=";
|
||||
src = fetchurl {
|
||||
url = "https://git.sr.ht/~ehmry/hottext/archive/v${version}.tar.gz";
|
||||
hash = "sha256-hIUofi81zowSMbt1lUsxCnVzfJGN3FEiTtN8CEFpwzY=";
|
||||
};
|
||||
|
||||
buildInputs = with nimPackages; [ asciigraph illwill parsetoml zippy ];
|
||||
buildInputs = with nimPackages; [
|
||||
bumpy
|
||||
chroma
|
||||
flatty
|
||||
nimsimd
|
||||
pixie
|
||||
sdl2
|
||||
typography
|
||||
vmath
|
||||
zippy
|
||||
];
|
||||
}
|
||||
|
||||
})
|
||||
```
|
||||
|
||||
## Nim library packages in Nixpkgs {#nim-library-packages-in-nixpkgs}
|
||||
@@ -51,16 +60,15 @@ non-Nim package:
|
||||
```nix
|
||||
{ lib, buildNimPackage, fetchNimble, SDL2 }:
|
||||
|
||||
buildNimPackage (finalAttrs: {
|
||||
buildNimPackage rec {
|
||||
pname = "sdl2";
|
||||
version = "2.0.4";
|
||||
src = fetchNimble {
|
||||
inherit (finalAttrs) pname version;
|
||||
hash = "sha256-Vtcj8goI4zZPQs2TbFoBFlcR5UqDtOldaXSH/+/xULk=";
|
||||
inherit pname version;
|
||||
hash = "sha256-qDtVSnf+7rTq36WAxgsUZ8XoUk4sKwHyt8EJcY5WP+o=";
|
||||
};
|
||||
propagatedBuildInputs = [ SDL2 ];
|
||||
doCheck = true;
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## `buildNimPackage` parameters {#buildnimpackage-parameters}
|
||||
|
||||
@@ -182,7 +182,7 @@ runCommand "my-package-test" {
|
||||
|
||||
### `timeout` {#var-meta-timeout}
|
||||
|
||||
A timeout (in seconds) for building the derivation. If the derivation takes longer than this time to build, Hydra will fail it due to breaking the timeout. However, all computers do not have the same computing power, hence some builders may decide to apply a multiplicative factor to this value. When filling this value in, try to keep it approximately consistent with other values already present in `nixpkgs`.
|
||||
A timeout (in seconds) for building the derivation. If the derivation takes longer than this time to build, it can fail due to breaking the timeout. However, all computers do not have the same computing power, hence some builders may decide to apply a multiplicative factor to this value. When filling this value in, try to keep it approximately consistent with other values already present in `nixpkgs`.
|
||||
|
||||
`meta` attributes are not stored in the instantiated derivation.
|
||||
Therefore, this setting may be lost when the package is used as a dependency.
|
||||
|
||||
@@ -1445,7 +1445,7 @@ This flag can break dynamic shared object loading. For instance, the module syst
|
||||
|
||||
#### `bindnow` {#bindnow}
|
||||
|
||||
Adds the `-z now` linker option. During program load, all dynamic symbols are resolved, allowing for the complete GOT to be marked read-only (due to `relro`). This prevents GOT overwrite attacks. For very large applications, this can incur some performance loss during initial load while symbols are resolved, but this shouldn’t be an issue for daemons.
|
||||
Adds the `-z bindnow` linker option. During program load, all dynamic symbols are resolved, allowing for the complete GOT to be marked read-only (due to `relro`). This prevents GOT overwrite attacks. For very large applications, this can incur some performance loss during initial load while symbols are resolved, but this shouldn’t be an issue for daemons.
|
||||
|
||||
This flag can break dynamic shared object loading. For instance, the module systems of Xorg and PHP are incompatible with this flag. Programs incompatible with this flag often fail at runtime due to missing symbols, like:
|
||||
|
||||
|
||||
@@ -16,12 +16,6 @@ Example usages:
|
||||
pkgs.foo.override { arg1 = val1; arg2 = val2; ... }
|
||||
```
|
||||
|
||||
It's also possible to access the previous arguments.
|
||||
|
||||
```nix
|
||||
pkgs.foo.override (previous: { arg1 = previous.arg1; ... })
|
||||
```
|
||||
|
||||
<!-- TODO: move below programlisting to a new section about extending and overlays and reference it -->
|
||||
|
||||
```nix
|
||||
@@ -42,15 +36,15 @@ In the first example, `pkgs.foo` is the result of a function call with some defa
|
||||
|
||||
The function `overrideAttrs` allows overriding the attribute set passed to a `stdenv.mkDerivation` call, producing a new derivation based on the original one. This function is available on all derivations produced by the `stdenv.mkDerivation` function, which is most packages in the nixpkgs expression `pkgs`.
|
||||
|
||||
Example usages:
|
||||
Example usage:
|
||||
|
||||
```nix
|
||||
helloBar = pkgs.hello.overrideAttrs (finalAttrs: previousAttrs: {
|
||||
pname = previousAttrs.pname + "-bar";
|
||||
helloWithDebug = pkgs.hello.overrideAttrs (finalAttrs: previousAttrs: {
|
||||
separateDebugInfo = true;
|
||||
});
|
||||
```
|
||||
|
||||
In the above example, "-bar" is appended to the pname attribute, while all other attributes will be retained from the original `hello` package.
|
||||
In the above example, the `separateDebugInfo` attribute is overridden to be true, thus building debug info for `helloWithDebug`, while all other attributes will be retained from the original `hello` package.
|
||||
|
||||
The argument `previousAttrs` is conventionally used to refer to the attr set originally passed to `stdenv.mkDerivation`.
|
||||
|
||||
@@ -58,16 +52,6 @@ The argument `finalAttrs` refers to the final attributes passed to `mkDerivation
|
||||
|
||||
If only a one-argument function is written, the argument has the meaning of `previousAttrs`.
|
||||
|
||||
Function arguments can be omitted entirely if there is no need to access `previousAttrs` or `finalAttrs`.
|
||||
|
||||
```nix
|
||||
helloWithDebug = pkgs.hello.overrideAttrs {
|
||||
separateDebugInfo = true;
|
||||
};
|
||||
```
|
||||
|
||||
In the above example, the `separateDebugInfo` attribute is overridden to be true, thus building debug info for `helloWithDebug`.
|
||||
|
||||
::: {.note}
|
||||
Note that `separateDebugInfo` is processed only by the `stdenv.mkDerivation` function, not the generated, raw Nix derivation. Thus, using `overrideDerivation` will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that `overrideAttrs` should be preferred in (almost) all cases to `overrideDerivation`, i.e. to allow using `stdenv.mkDerivation` to process input arguments, as well as the fact that it is easier to use (you can use the same attribute names you see in your Nix code, instead of the ones generated (e.g. `buildInputs` vs `nativeBuildInputs`), and it involves less typing).
|
||||
:::
|
||||
|
||||
@@ -734,42 +734,6 @@ rec {
|
||||
sets:
|
||||
zipAttrsWith (name: values: values) sets;
|
||||
|
||||
/*
|
||||
Merge a list of attribute sets together using the `//` operator.
|
||||
In case of duplicate attributes, values from later list elements take precedence over earlier ones.
|
||||
The result is the same as `foldl mergeAttrs { }`, but the performance is better for large inputs.
|
||||
For n list elements, each with an attribute set containing m unique attributes, the complexity of this operation is O(nm log n).
|
||||
|
||||
Type:
|
||||
mergeAttrsList :: [ Attrs ] -> Attrs
|
||||
|
||||
Example:
|
||||
mergeAttrsList [ { a = 0; b = 1; } { c = 2; d = 3; } ]
|
||||
=> { a = 0; b = 1; c = 2; d = 3; }
|
||||
mergeAttrsList [ { a = 0; } { a = 1; } ]
|
||||
=> { a = 1; }
|
||||
*/
|
||||
mergeAttrsList = list:
|
||||
let
|
||||
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
|
||||
# Type: Int -> Int -> Attrs
|
||||
binaryMerge = start: end:
|
||||
# assert start < end; # Invariant
|
||||
if end - start >= 2 then
|
||||
# If there's at least 2 elements, split the range in two, recurse on each part and merge the result
|
||||
# The invariant is satisfied because each half will have at least 1 element
|
||||
binaryMerge start (start + (end - start) / 2)
|
||||
// binaryMerge (start + (end - start) / 2) end
|
||||
else
|
||||
# Otherwise there will be exactly 1 element due to the invariant, in which case we just return it directly
|
||||
elemAt list start;
|
||||
in
|
||||
if list == [ ] then
|
||||
# Calling binaryMerge as below would not satisfy its invariant
|
||||
{ }
|
||||
else
|
||||
binaryMerge 0 (length list);
|
||||
|
||||
|
||||
/* Does the same as the update operator '//' except that attributes are
|
||||
merged until the given predicate is verified. The predicate should
|
||||
|
||||
@@ -117,11 +117,10 @@ let
|
||||
inherit (self.meta) addMetaAttrs dontDistribute setName updateName
|
||||
appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio
|
||||
hiPrioSet getLicenseFromSpdxId getExe;
|
||||
inherit (self.filesystem) pathType pathIsDirectory pathIsRegularFile;
|
||||
inherit (self.sources) cleanSourceFilter
|
||||
inherit (self.sources) pathType pathIsDirectory cleanSourceFilter
|
||||
cleanSource sourceByRegex sourceFilesBySuffices
|
||||
commitIdFromGitRepo cleanSourceWith pathHasContext
|
||||
canCleanSource pathIsGitRepo;
|
||||
canCleanSource pathIsRegularFile pathIsGitRepo;
|
||||
inherit (self.modules) evalModules setDefaultModuleLocation
|
||||
unifyModuleSyntax applyModuleArgsIfFunction mergeModules
|
||||
mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
|
||||
|
||||
@@ -1,93 +1,13 @@
|
||||
# Functions for querying information about the filesystem
|
||||
# without copying any files to the Nix store.
|
||||
# Functions for copying sources to the Nix store.
|
||||
{ lib }:
|
||||
|
||||
# Tested in lib/tests/filesystem.sh
|
||||
let
|
||||
inherit (builtins)
|
||||
readDir
|
||||
pathExists
|
||||
;
|
||||
|
||||
inherit (lib.strings)
|
||||
hasPrefix
|
||||
;
|
||||
|
||||
inherit (lib.filesystem)
|
||||
pathType
|
||||
;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
/*
|
||||
The type of a path. The path needs to exist and be accessible.
|
||||
The result is either "directory" for a directory, "regular" for a regular file, "symlink" for a symlink, or "unknown" for anything else.
|
||||
|
||||
Type:
|
||||
pathType :: Path -> String
|
||||
|
||||
Example:
|
||||
pathType /.
|
||||
=> "directory"
|
||||
|
||||
pathType /some/file.nix
|
||||
=> "regular"
|
||||
*/
|
||||
pathType =
|
||||
builtins.readFileType or
|
||||
# Nix <2.14 compatibility shim
|
||||
(path:
|
||||
if ! pathExists path
|
||||
# Fail irrecoverably to mimic the historic behavior of this function and
|
||||
# the new builtins.readFileType
|
||||
then abort "lib.filesystem.pathType: Path ${toString path} does not exist."
|
||||
# The filesystem root is the only path where `dirOf / == /` and
|
||||
# `baseNameOf /` is not valid. We can detect this and directly return
|
||||
# "directory", since we know the filesystem root can't be anything else.
|
||||
else if dirOf path == path
|
||||
then "directory"
|
||||
else (readDir (dirOf path)).${baseNameOf path}
|
||||
);
|
||||
|
||||
/*
|
||||
Whether a path exists and is a directory.
|
||||
|
||||
Type:
|
||||
pathIsDirectory :: Path -> Bool
|
||||
|
||||
Example:
|
||||
pathIsDirectory /.
|
||||
=> true
|
||||
|
||||
pathIsDirectory /this/does/not/exist
|
||||
=> false
|
||||
|
||||
pathIsDirectory /some/file.nix
|
||||
=> false
|
||||
*/
|
||||
pathIsDirectory = path:
|
||||
pathExists path && pathType path == "directory";
|
||||
|
||||
/*
|
||||
Whether a path exists and is a regular file, meaning not a symlink or any other special file type.
|
||||
|
||||
Type:
|
||||
pathIsRegularFile :: Path -> Bool
|
||||
|
||||
Example:
|
||||
pathIsRegularFile /.
|
||||
=> false
|
||||
|
||||
pathIsRegularFile /this/does/not/exist
|
||||
=> false
|
||||
|
||||
pathIsRegularFile /some/file.nix
|
||||
=> true
|
||||
*/
|
||||
pathIsRegularFile = path:
|
||||
pathExists path && pathType path == "regular";
|
||||
|
||||
/*
|
||||
A map of all haskell packages defined in the given path,
|
||||
identified by having a cabal file with the same name as the
|
||||
|
||||
@@ -178,11 +178,6 @@ in mkLicense lset) ({
|
||||
fullName = ''BSD 3-clause "New" or "Revised" License'';
|
||||
};
|
||||
|
||||
bsd3Clear = {
|
||||
spdxId = "BSD-3-Clause-Clear";
|
||||
fullName = "BSD 3-Clause Clear License";
|
||||
};
|
||||
|
||||
bsdOriginal = {
|
||||
spdxId = "BSD-4-Clause";
|
||||
fullName = ''BSD 4-clause "Original" or "Old" License'';
|
||||
@@ -455,11 +450,6 @@ in mkLicense lset) ({
|
||||
free = false;
|
||||
};
|
||||
|
||||
fraunhofer-fdk = {
|
||||
fullName = "Fraunhofer FDK AAC Codec Library";
|
||||
spdxId = "FDK-AAC";
|
||||
};
|
||||
|
||||
free = {
|
||||
fullName = "Unspecified free software license";
|
||||
};
|
||||
@@ -573,7 +563,7 @@ in mkLicense lset) ({
|
||||
};
|
||||
|
||||
inria-icesl = {
|
||||
fullName = "End User License Agreement for IceSL Software";
|
||||
fullName = "INRIA Non-Commercial License Agreement for IceSL";
|
||||
url = "https://icesl.loria.fr/assets/pdf/EULA_IceSL_binary.pdf";
|
||||
free = false;
|
||||
};
|
||||
@@ -757,12 +747,6 @@ in mkLicense lset) ({
|
||||
fullName = "Microsoft Public License";
|
||||
};
|
||||
|
||||
mulan-psl2 = {
|
||||
spdxId = "MulanPSL-2.0";
|
||||
fullName = "Mulan Permissive Software License, Version 2";
|
||||
url = "https://license.coscl.org.cn/MulanPSL2";
|
||||
};
|
||||
|
||||
nasa13 = {
|
||||
spdxId = "NASA-1.3";
|
||||
fullName = "NASA Open Source Agreement 1.3";
|
||||
|
||||
@@ -910,40 +910,6 @@ let
|
||||
else opt // { type = opt.type.substSubModules opt.options; options = []; };
|
||||
|
||||
|
||||
/*
|
||||
Merge an option's definitions in a way that preserves the priority of the
|
||||
individual attributes in the option value.
|
||||
|
||||
This does not account for all option semantics, such as readOnly.
|
||||
|
||||
Type:
|
||||
option -> attrsOf { highestPrio, value }
|
||||
*/
|
||||
mergeAttrDefinitionsWithPrio = opt:
|
||||
let
|
||||
defsByAttr =
|
||||
lib.zipAttrs (
|
||||
lib.concatLists (
|
||||
lib.concatMap
|
||||
({ value, ... }@def:
|
||||
map
|
||||
(lib.mapAttrsToList (k: value: { ${k} = def // { inherit value; }; }))
|
||||
(pushDownProperties value)
|
||||
)
|
||||
opt.definitionsWithLocations
|
||||
)
|
||||
);
|
||||
in
|
||||
assert opt.type.name == "attrsOf" || opt.type.name == "lazyAttrsOf";
|
||||
lib.mapAttrs
|
||||
(k: v:
|
||||
let merging = lib.mergeDefinitions (opt.loc ++ [k]) opt.type.nestedTypes.elemType v;
|
||||
in {
|
||||
value = merging.mergedValue;
|
||||
inherit (merging.defsFinal') highestPrio;
|
||||
})
|
||||
defsByAttr;
|
||||
|
||||
/* Properties. */
|
||||
|
||||
mkIf = condition: content:
|
||||
@@ -1290,7 +1256,6 @@ private //
|
||||
importJSON
|
||||
importTOML
|
||||
mergeDefinitions
|
||||
mergeAttrDefinitionsWithPrio
|
||||
mergeOptionDecls # should be private?
|
||||
mkAfter
|
||||
mkAliasAndWrapDefinitions
|
||||
|
||||
@@ -18,22 +18,14 @@ pkgs.runCommand "lib-path-tests" {
|
||||
];
|
||||
} ''
|
||||
# Needed to make Nix evaluation work
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||
export PAGER=cat
|
||||
export NIX_STATE_DIR=$(mktemp -d)
|
||||
|
||||
cp -r ${libpath} lib
|
||||
export TEST_LIB=$PWD/lib
|
||||
|
||||
echo "Running unit tests lib/path/tests/unit.nix"
|
||||
nix-instantiate --eval --show-trace \
|
||||
--argstr libpath "$TEST_LIB" \
|
||||
lib/path/tests/unit.nix
|
||||
nix-instantiate --eval lib/path/tests/unit.nix \
|
||||
--argstr libpath "$TEST_LIB"
|
||||
|
||||
echo "Running property tests lib/path/tests/prop.sh"
|
||||
bash lib/path/tests/prop.sh ${toString seed}
|
||||
|
||||
@@ -71,7 +71,7 @@ fi
|
||||
|
||||
# Precalculate all normalisations with a single Nix call. Calling Nix for each
|
||||
# string individually would take way too long
|
||||
nix-instantiate --eval --strict --json --show-trace \
|
||||
nix-instantiate --eval --strict --json \
|
||||
--argstr libpath "$TEST_LIB" \
|
||||
--argstr dir "$tmp/strings" \
|
||||
"$SCRIPT_DIR"/prop.nix \
|
||||
|
||||
@@ -18,11 +18,21 @@ let
|
||||
pathExists
|
||||
readFile
|
||||
;
|
||||
inherit (lib.filesystem)
|
||||
pathType
|
||||
pathIsDirectory
|
||||
pathIsRegularFile
|
||||
;
|
||||
|
||||
/*
|
||||
Returns the type of a path: regular (for file), symlink, or directory.
|
||||
*/
|
||||
pathType = path: getAttr (baseNameOf path) (readDir (dirOf path));
|
||||
|
||||
/*
|
||||
Returns true if the path exists and is a directory, false otherwise.
|
||||
*/
|
||||
pathIsDirectory = path: if pathExists path then (pathType path) == "directory" else false;
|
||||
|
||||
/*
|
||||
Returns true if the path exists and is a regular file, false otherwise.
|
||||
*/
|
||||
pathIsRegularFile = path: if pathExists path then (pathType path) == "regular" else false;
|
||||
|
||||
/*
|
||||
A basic filter for `cleanSourceWith` that removes
|
||||
@@ -261,20 +271,11 @@ let
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
pathType = lib.warnIf (lib.isInOldestRelease 2305)
|
||||
"lib.sources.pathType has been moved to lib.filesystem.pathType."
|
||||
lib.filesystem.pathType;
|
||||
|
||||
pathIsDirectory = lib.warnIf (lib.isInOldestRelease 2305)
|
||||
"lib.sources.pathIsDirectory has been moved to lib.filesystem.pathIsDirectory."
|
||||
lib.filesystem.pathIsDirectory;
|
||||
|
||||
pathIsRegularFile = lib.warnIf (lib.isInOldestRelease 2305)
|
||||
"lib.sources.pathIsRegularFile has been moved to lib.filesystem.pathIsRegularFile."
|
||||
lib.filesystem.pathIsRegularFile;
|
||||
|
||||
inherit
|
||||
pathType
|
||||
pathIsDirectory
|
||||
pathIsRegularFile
|
||||
|
||||
pathIsGitRepo
|
||||
commitIdFromGitRepo
|
||||
|
||||
|
||||
@@ -305,11 +305,6 @@ rec {
|
||||
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
|
||||
};
|
||||
|
||||
ucrt64 = {
|
||||
config = "x86_64-w64-mingw32";
|
||||
libc = "ucrt"; # This distinguishes the mingw (non posix) toolchain
|
||||
};
|
||||
|
||||
# BSDs
|
||||
|
||||
x86_64-freebsd = {
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Tests lib/filesystem.nix
|
||||
# Run:
|
||||
# [nixpkgs]$ lib/tests/filesystem.sh
|
||||
# or:
|
||||
# [nixpkgs]$ nix-build lib/tests/release.nix
|
||||
|
||||
set -euo pipefail
|
||||
shopt -s inherit_errexit
|
||||
|
||||
# Use
|
||||
# || die
|
||||
die() {
|
||||
echo >&2 "test case failed: " "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if test -n "${TEST_LIB:-}"; then
|
||||
NIX_PATH=nixpkgs="$(dirname "$TEST_LIB")"
|
||||
else
|
||||
NIX_PATH=nixpkgs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.."; pwd)"
|
||||
fi
|
||||
export NIX_PATH
|
||||
|
||||
work="$(mktemp -d)"
|
||||
clean_up() {
|
||||
rm -rf "$work"
|
||||
}
|
||||
trap clean_up EXIT
|
||||
cd "$work"
|
||||
|
||||
mkdir directory
|
||||
touch regular
|
||||
ln -s target symlink
|
||||
mkfifo fifo
|
||||
|
||||
expectSuccess() {
|
||||
local expr=$1
|
||||
local expectedResultRegex=$2
|
||||
if ! result=$(nix-instantiate --eval --strict --json \
|
||||
--expr "with (import <nixpkgs/lib>).filesystem; $expr"); then
|
||||
die "$expr failed to evaluate, but it was expected to succeed"
|
||||
fi
|
||||
if [[ ! "$result" =~ $expectedResultRegex ]]; then
|
||||
die "$expr == $result, but $expectedResultRegex was expected"
|
||||
fi
|
||||
}
|
||||
|
||||
expectFailure() {
|
||||
local expr=$1
|
||||
local expectedErrorRegex=$2
|
||||
if result=$(nix-instantiate --eval --strict --json 2>"$work/stderr" \
|
||||
--expr "with (import <nixpkgs/lib>).filesystem; $expr"); then
|
||||
die "$expr evaluated successfully to $result, but it was expected to fail"
|
||||
fi
|
||||
if [[ ! "$(<"$work/stderr")" =~ $expectedErrorRegex ]]; then
|
||||
die "Error was $(<"$work/stderr"), but $expectedErrorRegex was expected"
|
||||
fi
|
||||
}
|
||||
|
||||
expectSuccess "pathType /." '"directory"'
|
||||
expectSuccess "pathType $PWD/directory" '"directory"'
|
||||
expectSuccess "pathType $PWD/regular" '"regular"'
|
||||
expectSuccess "pathType $PWD/symlink" '"symlink"'
|
||||
expectSuccess "pathType $PWD/fifo" '"unknown"'
|
||||
|
||||
# Only check error message when a Nixpkgs-specified error is thrown,
|
||||
# which is only the case when `readFileType` is not available
|
||||
# and the fallback implementation needs to be used.
|
||||
if [[ "$(nix-instantiate --eval --expr 'builtins ? readFileType')" == false ]]; then
|
||||
expectFailure "pathType $PWD/non-existent" \
|
||||
"error: evaluation aborted with the following error message: 'lib.filesystem.pathType: Path $PWD/non-existent does not exist.'"
|
||||
fi
|
||||
|
||||
expectSuccess "pathIsDirectory /." "true"
|
||||
expectSuccess "pathIsDirectory $PWD/directory" "true"
|
||||
expectSuccess "pathIsDirectory $PWD/regular" "false"
|
||||
expectSuccess "pathIsDirectory $PWD/symlink" "false"
|
||||
expectSuccess "pathIsDirectory $PWD/fifo" "false"
|
||||
expectSuccess "pathIsDirectory $PWD/non-existent" "false"
|
||||
|
||||
expectSuccess "pathIsRegularFile /." "false"
|
||||
expectSuccess "pathIsRegularFile $PWD/directory" "false"
|
||||
expectSuccess "pathIsRegularFile $PWD/regular" "true"
|
||||
expectSuccess "pathIsRegularFile $PWD/symlink" "false"
|
||||
expectSuccess "pathIsRegularFile $PWD/fifo" "false"
|
||||
expectSuccess "pathIsRegularFile $PWD/non-existent" "false"
|
||||
|
||||
echo >&2 tests ok
|
||||
@@ -569,31 +569,6 @@ runTests {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
testMergeAttrsListExample1 = {
|
||||
expr = attrsets.mergeAttrsList [ { a = 0; b = 1; } { c = 2; d = 3; } ];
|
||||
expected = { a = 0; b = 1; c = 2; d = 3; };
|
||||
};
|
||||
testMergeAttrsListExample2 = {
|
||||
expr = attrsets.mergeAttrsList [ { a = 0; } { a = 1; } ];
|
||||
expected = { a = 1; };
|
||||
};
|
||||
testMergeAttrsListExampleMany =
|
||||
let
|
||||
list = genList (n:
|
||||
listToAttrs (genList (m:
|
||||
let
|
||||
# Integer divide n by two to create duplicate attributes
|
||||
str = "halfn${toString (n / 2)}m${toString m}";
|
||||
in
|
||||
nameValuePair str str
|
||||
) 100)
|
||||
) 100;
|
||||
in {
|
||||
expr = attrsets.mergeAttrsList list;
|
||||
expected = foldl' mergeAttrs { } list;
|
||||
};
|
||||
|
||||
# code from the example
|
||||
testRecursiveUpdateUntil = {
|
||||
expr = recursiveUpdateUntil (path: l: r: path == ["foo"]) {
|
||||
|
||||
@@ -18,14 +18,14 @@ evalConfig() {
|
||||
local attr=$1
|
||||
shift
|
||||
local script="import ./default.nix { modules = [ $* ];}"
|
||||
nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace --read-write-mode --json
|
||||
nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace --read-write-mode
|
||||
}
|
||||
|
||||
reportFailure() {
|
||||
local attr=$1
|
||||
shift
|
||||
local script="import ./default.nix { modules = [ $* ];}"
|
||||
echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only --json"
|
||||
echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only"
|
||||
evalConfig "$attr" "$@" || true
|
||||
((++fail))
|
||||
}
|
||||
@@ -61,18 +61,6 @@ checkConfigError() {
|
||||
# Shorthand meta attribute does not duplicate the config
|
||||
checkConfigOutput '^"one two"$' config.result ./shorthand-meta.nix
|
||||
|
||||
checkConfigOutput '^true$' config.result ./test-mergeAttrDefinitionsWithPrio.nix
|
||||
|
||||
# types.pathInStore
|
||||
checkConfigOutput '".*/store/5lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv"' config.pathInStore.ok1 ./types.nix
|
||||
checkConfigOutput '".*/store/xfb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15"' config.pathInStore.ok2 ./types.nix
|
||||
checkConfigOutput '".*/store/xfb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15/bin/bash"' config.pathInStore.ok3 ./types.nix
|
||||
checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ""' config.pathInStore.bad1 ./types.nix
|
||||
checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ".*/store"' config.pathInStore.bad2 ./types.nix
|
||||
checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ".*/store/"' config.pathInStore.bad3 ./types.nix
|
||||
checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ".*/store/.links"' config.pathInStore.bad4 ./types.nix
|
||||
checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: "/foo/bar"' config.pathInStore.bad5 ./types.nix
|
||||
|
||||
# Check boolean option.
|
||||
checkConfigOutput '^false$' config.enable ./declare-enable.nix
|
||||
checkConfigError 'The option .* does not exist. Definition values:\n\s*- In .*: true' config.enable ./define-enable.nix
|
||||
@@ -103,7 +91,7 @@ checkConfigOutput '^42$' config.value ./declare-either.nix ./define-value-int-po
|
||||
checkConfigOutput '^"24"$' config.value ./declare-either.nix ./define-value-string.nix
|
||||
# types.oneOf
|
||||
checkConfigOutput '^42$' config.value ./declare-oneOf.nix ./define-value-int-positive.nix
|
||||
checkConfigOutput '^\[\]$' config.value ./declare-oneOf.nix ./define-value-list.nix
|
||||
checkConfigOutput '^\[ \]$' config.value ./declare-oneOf.nix ./define-value-list.nix
|
||||
checkConfigOutput '^"24"$' config.value ./declare-oneOf.nix ./define-value-string.nix
|
||||
|
||||
# Check mkForce without submodules.
|
||||
@@ -275,7 +263,7 @@ checkConfigOutput '^"24"$' config.value ./freeform-attrsOf.nix ./define-value-st
|
||||
# Shorthand modules interpret `meta` and `class` as config items
|
||||
checkConfigOutput '^true$' options._module.args.value.result ./freeform-attrsOf.nix ./define-freeform-keywords-shorthand.nix
|
||||
# No freeform assignments shouldn't make it error
|
||||
checkConfigOutput '^{}$' config ./freeform-attrsOf.nix
|
||||
checkConfigOutput '^{ }$' config ./freeform-attrsOf.nix
|
||||
# but only if the type matches
|
||||
checkConfigError 'A definition for option .* is not of type .*' config.value ./freeform-attrsOf.nix ./define-value-list.nix
|
||||
# and properties should be applied
|
||||
@@ -313,19 +301,19 @@ checkConfigError 'The option .* has conflicting definitions' config.value ./type
|
||||
checkConfigOutput '^0$' config.value.int ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^false$' config.value.bool ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^""$' config.value.string ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^"/[^"]\+"$' config.value.path ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^/$' config.value.path ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^null$' config.value.null ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^0.1$' config.value.float ./types-anything/equal-atoms.nix
|
||||
# Functions can't be merged together
|
||||
checkConfigError "The option .value.multiple-lambdas.<function body>. has conflicting option types" config.applied.multiple-lambdas ./types-anything/functions.nix
|
||||
checkConfigOutput '^true$' config.valueIsFunction.single-lambda ./types-anything/functions.nix
|
||||
checkConfigOutput '^<LAMBDA>$' config.value.single-lambda ./types-anything/functions.nix
|
||||
checkConfigOutput '^null$' config.applied.merging-lambdas.x ./types-anything/functions.nix
|
||||
checkConfigOutput '^null$' config.applied.merging-lambdas.y ./types-anything/functions.nix
|
||||
# Check that all mk* modifiers are applied
|
||||
checkConfigError 'attribute .* not found' config.value.mkiffalse ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^{}$' config.value.mkiftrue ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^{ }$' config.value.mkiftrue ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^1$' config.value.mkdefault ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^{}$' config.value.mkmerge ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^{ }$' config.value.mkmerge ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^true$' config.value.mkbefore ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^1$' config.value.nested.foo ./types-anything/mk-mods.nix
|
||||
checkConfigOutput '^"baz"$' config.value.nested.bar.baz ./types-anything/mk-mods.nix
|
||||
@@ -345,16 +333,16 @@ checkConfigOutput '^"a b y z"$' config.resultFooBar ./declare-variants.nix ./def
|
||||
checkConfigOutput '^"a b c"$' config.resultFooFoo ./declare-variants.nix ./define-variant.nix
|
||||
|
||||
## emptyValue's
|
||||
checkConfigOutput "\[\]" config.list.a ./emptyValues.nix
|
||||
checkConfigOutput "{}" config.attrs.a ./emptyValues.nix
|
||||
checkConfigOutput "[ ]" config.list.a ./emptyValues.nix
|
||||
checkConfigOutput "{ }" config.attrs.a ./emptyValues.nix
|
||||
checkConfigOutput "null" config.null.a ./emptyValues.nix
|
||||
checkConfigOutput "{}" config.submodule.a ./emptyValues.nix
|
||||
checkConfigOutput "{ }" config.submodule.a ./emptyValues.nix
|
||||
# These types don't have empty values
|
||||
checkConfigError 'The option .int.a. is used but not defined' config.int.a ./emptyValues.nix
|
||||
checkConfigError 'The option .nonEmptyList.a. is used but not defined' config.nonEmptyList.a ./emptyValues.nix
|
||||
|
||||
## types.raw
|
||||
checkConfigOutput '^true$' config.unprocessedNestingEvaluates.success ./raw.nix
|
||||
checkConfigOutput "{ foo = <CODE>; }" config.unprocessedNesting ./raw.nix
|
||||
checkConfigOutput "10" config.processedToplevel ./raw.nix
|
||||
checkConfigError "The option .multiple. is defined multiple times" config.multiple ./raw.nix
|
||||
checkConfigOutput "bar" config.priorities ./raw.nix
|
||||
@@ -380,17 +368,17 @@ checkConfigOutput 'ok' config.freeformItems.foo.bar ./adhoc-freeformType-survive
|
||||
checkConfigOutput '^1$' config.sub.specialisation.value ./extendModules-168767-imports.nix
|
||||
|
||||
# Class checks, evalModules
|
||||
checkConfigOutput '^{}$' config.ok.config ./class-check.nix
|
||||
checkConfigOutput '^{ }$' config.ok.config ./class-check.nix
|
||||
checkConfigOutput '"nixos"' config.ok.class ./class-check.nix
|
||||
checkConfigError 'The module .*/module-class-is-darwin.nix was imported into nixos instead of darwin.' config.fail.config ./class-check.nix
|
||||
checkConfigError 'The module foo.nix#darwinModules.default was imported into nixos instead of darwin.' config.fail-anon.config ./class-check.nix
|
||||
|
||||
# Class checks, submoduleWith
|
||||
checkConfigOutput '^{}$' config.sub.nixosOk ./class-check.nix
|
||||
checkConfigOutput '^{ }$' config.sub.nixosOk ./class-check.nix
|
||||
checkConfigError 'The module .*/module-class-is-darwin.nix was imported into nixos instead of darwin.' config.sub.nixosFail.config ./class-check.nix
|
||||
|
||||
# submoduleWith type merge with different class
|
||||
checkConfigError 'A submoduleWith option is declared multiple times with conflicting class values "darwin" and "nixos".' config.sub.mergeFail.config ./class-check.nix
|
||||
checkConfigError 'error: A submoduleWith option is declared multiple times with conflicting class values "darwin" and "nixos".' config.sub.mergeFail.config ./class-check.nix
|
||||
|
||||
# _type check
|
||||
checkConfigError 'Could not load a value as a module, because it is of type "flake", in file .*/module-imports-_type-check.nix' config.ok.config ./module-imports-_type-check.nix
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lib, config, ... }: {
|
||||
{ lib, ... }: {
|
||||
|
||||
options = {
|
||||
processedToplevel = lib.mkOption {
|
||||
@@ -13,9 +13,6 @@
|
||||
priorities = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
};
|
||||
unprocessedNestingEvaluates = lib.mkOption {
|
||||
default = builtins.tryEval config.unprocessedNesting;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
{ lib, options, ... }:
|
||||
|
||||
let
|
||||
defs = lib.modules.mergeAttrDefinitionsWithPrio options._module.args;
|
||||
assertLazy = pos: throw "${pos.file}:${toString pos.line}:${toString pos.column}: The test must not evaluate this the assertLazy thunk, but it did. Unexpected strictness leads to unexpected errors and performance problems.";
|
||||
in
|
||||
|
||||
{
|
||||
options.result = lib.mkOption { };
|
||||
config._module.args = {
|
||||
default = lib.mkDefault (assertLazy __curPos);
|
||||
regular = null;
|
||||
force = lib.mkForce (assertLazy __curPos);
|
||||
unused = assertLazy __curPos;
|
||||
};
|
||||
config.result =
|
||||
assert defs.default.highestPrio == (lib.mkDefault (assertLazy __curPos)).priority;
|
||||
assert defs.regular.highestPrio == lib.modules.defaultOverridePriority;
|
||||
assert defs.force.highestPrio == (lib.mkForce (assertLazy __curPos)).priority;
|
||||
true;
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
value.int = 0;
|
||||
value.bool = false;
|
||||
value.string = "";
|
||||
value.path = ./.;
|
||||
value.path = /.;
|
||||
value.null = null;
|
||||
value.float = 0.1;
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
value.int = 0;
|
||||
value.bool = false;
|
||||
value.string = "";
|
||||
value.path = ./.;
|
||||
value.path = /.;
|
||||
value.null = null;
|
||||
value.float = 0.1;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{ lib, config, ... }: {
|
||||
|
||||
options.valueIsFunction = lib.mkOption {
|
||||
default = lib.mapAttrs (name: lib.isFunction) config.value;
|
||||
};
|
||||
|
||||
options.value = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
};
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (builtins)
|
||||
storeDir;
|
||||
inherit (lib)
|
||||
types
|
||||
mkOption
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
pathInStore = mkOption { type = types.lazyAttrsOf types.pathInStore; };
|
||||
};
|
||||
config = {
|
||||
pathInStore.ok1 = "${storeDir}/5lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv";
|
||||
pathInStore.ok2 = "${storeDir}/xfb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15";
|
||||
pathInStore.ok3 = "${storeDir}/xfb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15/bin/bash";
|
||||
pathInStore.bad1 = "";
|
||||
pathInStore.bad2 = "${storeDir}";
|
||||
pathInStore.bad3 = "${storeDir}/";
|
||||
pathInStore.bad4 = "${storeDir}/.links"; # technically true, but not reasonable
|
||||
pathInStore.bad5 = "/foo/bar";
|
||||
};
|
||||
}
|
||||
@@ -2,60 +2,50 @@
|
||||
# Don't test properties of pkgs.lib, but rather the lib in the parent directory
|
||||
pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; },
|
||||
nix ? pkgs.nix,
|
||||
nixVersions ? [ pkgs.nixVersions.minimum nix pkgs.nixVersions.unstable ],
|
||||
}:
|
||||
|
||||
let
|
||||
testWithNix = nix:
|
||||
pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" {
|
||||
buildInputs = [
|
||||
(import ./check-eval.nix)
|
||||
(import ./maintainers.nix {
|
||||
inherit pkgs;
|
||||
lib = import ../.;
|
||||
})
|
||||
(import ./teams.nix {
|
||||
inherit pkgs;
|
||||
lib = import ../.;
|
||||
})
|
||||
(import ../path/tests {
|
||||
inherit pkgs;
|
||||
})
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
nix
|
||||
];
|
||||
strictDeps = true;
|
||||
} ''
|
||||
datadir="${nix}/share"
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||
export PAGER=cat
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
pkgs.runCommand "nixpkgs-lib-tests" {
|
||||
buildInputs = [
|
||||
(import ./check-eval.nix)
|
||||
(import ./maintainers.nix {
|
||||
inherit pkgs;
|
||||
lib = import ../.;
|
||||
})
|
||||
(import ./teams.nix {
|
||||
inherit pkgs;
|
||||
lib = import ../.;
|
||||
})
|
||||
(import ../path/tests {
|
||||
inherit pkgs;
|
||||
})
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
nix
|
||||
];
|
||||
strictDeps = true;
|
||||
} ''
|
||||
datadir="${nix}/share"
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||
export PAGER=cat
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
|
||||
nix-store --init
|
||||
mkdir -p $NIX_CONF_DIR
|
||||
echo "experimental-features = nix-command" >> $NIX_CONF_DIR/nix.conf
|
||||
|
||||
cp -r ${../.} lib
|
||||
echo "Running lib/tests/modules.sh"
|
||||
bash lib/tests/modules.sh
|
||||
nix-store --init
|
||||
|
||||
echo "Running lib/tests/filesystem.sh"
|
||||
TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh
|
||||
cp -r ${../.} lib
|
||||
echo "Running lib/tests/modules.sh"
|
||||
bash lib/tests/modules.sh
|
||||
|
||||
echo "Running lib/tests/sources.sh"
|
||||
TEST_LIB=$PWD/lib bash lib/tests/sources.sh
|
||||
echo "Running lib/tests/sources.sh"
|
||||
TEST_LIB=$PWD/lib bash lib/tests/sources.sh
|
||||
|
||||
mkdir $out
|
||||
echo success > $out/${nix.version}
|
||||
'';
|
||||
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = "nixpkgs-lib-tests";
|
||||
paths = map testWithNix nixVersions;
|
||||
}
|
||||
touch $out
|
||||
''
|
||||
|
||||
@@ -23,19 +23,14 @@ clean_up() {
|
||||
trap clean_up EXIT
|
||||
cd "$work"
|
||||
|
||||
# Crudely unquotes a JSON string by just taking everything between the first and the second quote.
|
||||
# We're only using this for resulting /nix/store paths, which can't contain " anyways,
|
||||
# nor can they contain any other characters that would need to be escaped specially in JSON
|
||||
# This way we don't need to add a dependency on e.g. jq
|
||||
crudeUnquoteJSON() {
|
||||
cut -d \" -f2
|
||||
}
|
||||
|
||||
touch {README.md,module.o,foo.bar}
|
||||
|
||||
dir="$(nix-instantiate --eval --strict --read-write-mode --json --expr '(with import <nixpkgs/lib>; "${
|
||||
# nix-instantiate doesn't write out the source, only computing the hash, so
|
||||
# this uses the experimental nix command instead.
|
||||
|
||||
dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
|
||||
cleanSource ./.
|
||||
}")' | crudeUnquoteJSON)"
|
||||
}")')"
|
||||
(cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
|
||||
.
|
||||
./foo.bar
|
||||
@@ -44,9 +39,9 @@ EOF
|
||||
) || die "cleanSource 1"
|
||||
|
||||
|
||||
dir="$(nix-instantiate --eval --strict --read-write-mode --json --expr '(with import <nixpkgs/lib>; "${
|
||||
dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
|
||||
cleanSourceWith { src = '"$work"'; filter = path: type: ! hasSuffix ".bar" path; }
|
||||
}")' | crudeUnquoteJSON)"
|
||||
}")')"
|
||||
(cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
|
||||
.
|
||||
./module.o
|
||||
@@ -54,9 +49,9 @@ dir="$(nix-instantiate --eval --strict --read-write-mode --json --expr '(with im
|
||||
EOF
|
||||
) || die "cleanSourceWith 1"
|
||||
|
||||
dir="$(nix-instantiate --eval --strict --read-write-mode --json --expr '(with import <nixpkgs/lib>; "${
|
||||
dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
|
||||
cleanSourceWith { src = cleanSource '"$work"'; filter = path: type: ! hasSuffix ".bar" path; }
|
||||
}")' | crudeUnquoteJSON)"
|
||||
}")')"
|
||||
(cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
|
||||
.
|
||||
./README.md
|
||||
|
||||
@@ -195,7 +195,7 @@ rec {
|
||||
On each release the first letter is bumped and a new animal is chosen
|
||||
starting with that new letter.
|
||||
*/
|
||||
codeName = "Stoat";
|
||||
codeName = "Tapir";
|
||||
|
||||
/* Returns the current nixpkgs version suffix as string. */
|
||||
versionSuffix =
|
||||
|
||||
@@ -461,7 +461,6 @@ rec {
|
||||
# - strings with context, e.g. "${pkgs.foo}" or (toString pkgs.foo)
|
||||
# - hardcoded store path literals (/nix/store/hash-foo) or strings without context
|
||||
# ("/nix/store/hash-foo"). These get a context added to them using builtins.storePath.
|
||||
# If you don't need a *top-level* store path, consider using pathInStore instead.
|
||||
package = mkOptionType {
|
||||
name = "package";
|
||||
descriptionClass = "noun";
|
||||
@@ -492,14 +491,6 @@ rec {
|
||||
merge = mergeEqualOption;
|
||||
};
|
||||
|
||||
pathInStore = mkOptionType {
|
||||
name = "pathInStore";
|
||||
description = "path in the Nix store";
|
||||
descriptionClass = "noun";
|
||||
check = x: isStringLike x && builtins.match "${builtins.storeDir}/[^.].*" (toString x) != null;
|
||||
merge = mergeEqualOption;
|
||||
};
|
||||
|
||||
listOf = elemType: mkOptionType rec {
|
||||
name = "listOf";
|
||||
description = "list of ${optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType}";
|
||||
|
||||
@@ -788,12 +788,6 @@
|
||||
githubId = 160476;
|
||||
name = "Amanjeev Sethi";
|
||||
};
|
||||
amanse = {
|
||||
email = "amansetiarjp@gmail.com";
|
||||
github = "amanse";
|
||||
githubId = 13214574;
|
||||
name = "Aman Setia";
|
||||
};
|
||||
amar1729 = {
|
||||
email = "amar.paul16@gmail.com";
|
||||
github = "Amar1729";
|
||||
@@ -937,12 +931,6 @@
|
||||
githubId = 123550;
|
||||
name = "André Silva";
|
||||
};
|
||||
andresnav = {
|
||||
email = "nix@andresnav.com";
|
||||
github = "andres-nav";
|
||||
githubId = 118762770;
|
||||
name = "Andres Navarro";
|
||||
};
|
||||
andrestylianos = {
|
||||
email = "andre.stylianos@gmail.com";
|
||||
github = "andrestylianos";
|
||||
@@ -1672,12 +1660,6 @@
|
||||
fingerprint = "6FBC A462 4EAF C69C A7C4 98C1 F044 3098 48A0 7CAC";
|
||||
}];
|
||||
};
|
||||
babeuh = {
|
||||
name = "Raphael Le Goaller";
|
||||
email = "babeuh@rlglr.fr";
|
||||
github = "babeuh";
|
||||
githubId = 60193302;
|
||||
};
|
||||
bachp = {
|
||||
email = "pascal.bach@nextrem.ch";
|
||||
matrix = "@bachp:matrix.org";
|
||||
@@ -2120,15 +2102,6 @@
|
||||
github = "blaggacao";
|
||||
githubId = 7548295;
|
||||
};
|
||||
blankparticle = {
|
||||
name = "BlankParticle";
|
||||
email = "blankparticle@gmail.com";
|
||||
github = "BlankParticle";
|
||||
githubId = 130567419;
|
||||
keys = [{
|
||||
fingerprint = "1757 64C3 7065 AA8D 614D 41C9 0ACE 126D 7B35 9261";
|
||||
}];
|
||||
};
|
||||
blanky0230 = {
|
||||
email = "blanky0230@gmail.com";
|
||||
github = "blanky0230";
|
||||
@@ -2318,12 +2291,6 @@
|
||||
github = "brianmcgee";
|
||||
githubId = 1173648;
|
||||
};
|
||||
brianmcgillion = {
|
||||
name = "Brian McGillion";
|
||||
email = "bmg.avoin@gmail.com";
|
||||
github = "brianmcgillion";
|
||||
githubId = 1044263;
|
||||
};
|
||||
brodes = {
|
||||
email = "me@brod.es";
|
||||
github = "brhoades";
|
||||
@@ -3197,12 +3164,6 @@
|
||||
name = "Changsheng Wu";
|
||||
githubId = 2083950;
|
||||
};
|
||||
conni2461 = {
|
||||
email = "simon.hauser@outlook.com";
|
||||
github = "Conni2461";
|
||||
name = "Simon Hauser";
|
||||
githubId = 15233006;
|
||||
};
|
||||
connorbaker = {
|
||||
email = "connor.baker@tweag.io";
|
||||
matrix = "@connorbaker:matrix.org";
|
||||
@@ -3916,13 +3877,6 @@
|
||||
githubId = 17111639;
|
||||
name = "Devin Singh";
|
||||
};
|
||||
devpikachu = {
|
||||
email = "andrei.hava@proton.me";
|
||||
matrix = "@andrei:matrix.detpikachu.dev";
|
||||
github = "devpikachu";
|
||||
githubId = 30475873;
|
||||
name = "Andrei Hava";
|
||||
};
|
||||
devusb = {
|
||||
email = "mhelton@devusb.us";
|
||||
github = "devusb";
|
||||
@@ -4414,11 +4368,6 @@
|
||||
githubId = 7875;
|
||||
name = "Rommel Martinez";
|
||||
};
|
||||
eclairevoyant = {
|
||||
github = "eclairevoyant";
|
||||
githubId = 848000;
|
||||
name = "éclairevoyant";
|
||||
};
|
||||
edanaher = {
|
||||
email = "nixos@edanaher.net";
|
||||
github = "edanaher";
|
||||
@@ -5550,15 +5499,6 @@
|
||||
githubId = 17859309;
|
||||
name = "Fuzen";
|
||||
};
|
||||
fwam = {
|
||||
name = "Legion Orsetti";
|
||||
email = "fwam@queereen.dev";
|
||||
github = "fwam";
|
||||
githubId = 113541944;
|
||||
keys = [{
|
||||
fingerprint = "3822 20B8 57ED 0602 3786 8A7A 18E1 AE22 D704 B4FC";
|
||||
}];
|
||||
};
|
||||
fxfactorial = {
|
||||
email = "edgar.factorial@gmail.com";
|
||||
github = "fxfactorial";
|
||||
@@ -5755,12 +5695,6 @@
|
||||
githubId = 10353047;
|
||||
name = "Tobias Happ";
|
||||
};
|
||||
getchoo = {
|
||||
email = "getchoo@tuta.io";
|
||||
github = "getchoo";
|
||||
githubId = 48872998;
|
||||
name = "Seth";
|
||||
};
|
||||
gfrascadorio = {
|
||||
email = "gfrascadorio@tutanota.com";
|
||||
github = "gfrascadorio";
|
||||
@@ -5876,12 +5810,6 @@
|
||||
githubId = 1447245;
|
||||
name = "Robin Gloster";
|
||||
};
|
||||
gmemstr = {
|
||||
email = "git@gmem.ca";
|
||||
github = "gmemstr";
|
||||
githubId = 1878840;
|
||||
name = "Gabriel Simmer";
|
||||
};
|
||||
gnxlxnxx = {
|
||||
email = "gnxlxnxx@web.de";
|
||||
github = "gnxlxnxx";
|
||||
@@ -7711,12 +7639,6 @@
|
||||
githubId = 297653;
|
||||
name = "Joe Salisbury";
|
||||
};
|
||||
johannwagner = {
|
||||
email = "nix@wagner.digital";
|
||||
github = "johannwagner";
|
||||
githubId = 12380026;
|
||||
name = "Johann Wagner";
|
||||
};
|
||||
johanot = {
|
||||
email = "write@ownrisk.dk";
|
||||
github = "johanot";
|
||||
@@ -8344,12 +8266,6 @@
|
||||
githubId = 546087;
|
||||
name = "Kristoffer K. Føllesdal";
|
||||
};
|
||||
khaneliman = {
|
||||
email = "khaneliman12@gmail.com";
|
||||
github = "khaneliman";
|
||||
githubId = 1778670;
|
||||
name = "Austin Horstman";
|
||||
};
|
||||
kho-dialga = {
|
||||
email = "ivandashenyou@gmail.com";
|
||||
github = "Kho-Dialga";
|
||||
@@ -8804,12 +8720,6 @@
|
||||
fingerprint = "5A9A 1C9B 2369 8049 3B48 CF5B 81A1 5409 4816 2372";
|
||||
}];
|
||||
};
|
||||
l0b0 = {
|
||||
email = "victor@engmark.name";
|
||||
github = "l0b0";
|
||||
githubId = 168301;
|
||||
name = "Victor Engmark";
|
||||
};
|
||||
l3af = {
|
||||
email = "L3afMeAlon3@gmail.com";
|
||||
matrix = "@L3afMe:matrix.org";
|
||||
@@ -9432,15 +9342,6 @@
|
||||
githubId = 1168435;
|
||||
name = "Ludovic Courtès";
|
||||
};
|
||||
ludovicopiero = {
|
||||
email = "ludovicopiero@pm.me";
|
||||
github = "ludovicopiero";
|
||||
githubId = 44255157;
|
||||
name = "Ludovico Piero";
|
||||
keys = [{
|
||||
fingerprint = "72CA 4F61 46C6 0DAB 6193 4D35 3911 DD27 6CFE 779C";
|
||||
}];
|
||||
};
|
||||
lufia = {
|
||||
email = "lufia@lufia.org";
|
||||
github = "lufia";
|
||||
@@ -9751,12 +9652,6 @@
|
||||
githubId = 346094;
|
||||
name = "Michael Alyn Miller";
|
||||
};
|
||||
mangoiv = {
|
||||
email = "contact@mangoiv.com";
|
||||
github = "mangoiv";
|
||||
githubId = 40720523;
|
||||
name = "MangoIV";
|
||||
};
|
||||
manojkarthick = {
|
||||
email = "smanojkarthick@gmail.com";
|
||||
github = "manojkarthick";
|
||||
@@ -10308,12 +10203,6 @@
|
||||
githubId = 3300322;
|
||||
name = "Mitchell Fossen";
|
||||
};
|
||||
mfrw = {
|
||||
email = "falakreyaz@gmail.com";
|
||||
github = "mfrw";
|
||||
githubId = 4929861;
|
||||
name = "Muhammad Falak R Wani";
|
||||
};
|
||||
mgdelacroix = {
|
||||
email = "mgdelacroix@gmail.com";
|
||||
github = "mgdelacroix";
|
||||
@@ -10472,12 +10361,6 @@
|
||||
githubId = 43088426;
|
||||
name = "Mihnea Stoian";
|
||||
};
|
||||
mikaelfangel = {
|
||||
email = "nixpkgs.bottle597@passfwd.com";
|
||||
github = "MikaelFangel";
|
||||
githubId = 34864484;
|
||||
name = "Mikael Fangel";
|
||||
};
|
||||
mikefaille = {
|
||||
email = "michael@faille.io";
|
||||
github = "mikefaille";
|
||||
@@ -10796,12 +10679,6 @@
|
||||
fingerprint = "6460 4147 C434 F65E C306 A21F 135E EDD0 F719 34F3";
|
||||
}];
|
||||
};
|
||||
moody = {
|
||||
email = "moody@posixcafe.org";
|
||||
github = "majiru";
|
||||
githubId = 3579600;
|
||||
name = "Jacob Moody";
|
||||
};
|
||||
moosingin3space = {
|
||||
email = "moosingin3space@gmail.com";
|
||||
github = "moosingin3space";
|
||||
@@ -14102,12 +13979,6 @@
|
||||
githubId = 107703;
|
||||
name = "Samuel Rivas";
|
||||
};
|
||||
samueltardieu = {
|
||||
email = "nixpkgs@sam.rfc1149.net";
|
||||
github = "samueltardieu";
|
||||
githubId = 44656;
|
||||
name = "Samuel Tardieu";
|
||||
};
|
||||
samw = {
|
||||
email = "sam@wlcx.cc";
|
||||
github = "wlcx";
|
||||
@@ -14891,12 +14762,6 @@
|
||||
githubId = 1437166;
|
||||
name = "Xia Bin";
|
||||
};
|
||||
sochotnicky = {
|
||||
email = "stanislav+github@ochotnicky.com";
|
||||
github = "sochotnicky";
|
||||
githubId = 55726;
|
||||
name = "Stanislav Ochotnický";
|
||||
};
|
||||
softinio = {
|
||||
email = "code@softinio.com";
|
||||
github = "softinio";
|
||||
@@ -15152,6 +15017,12 @@
|
||||
fingerprint = "5D8B FA8B 286A C2EF 6EE4 8598 F742 B72C 8926 1A51";
|
||||
}];
|
||||
};
|
||||
stepech = {
|
||||
name = "stepech";
|
||||
github = "stepech";
|
||||
githubId = 29132060;
|
||||
matrix = "@stepech:matrix.org";
|
||||
};
|
||||
stephank = {
|
||||
email = "nix@stephank.nl";
|
||||
matrix = "@skochen:matrix.org";
|
||||
|
||||
@@ -272,19 +272,8 @@ with lib.maintainers; {
|
||||
enableFeatureFreezePing = true;
|
||||
};
|
||||
|
||||
flyingcircus = {
|
||||
# Verify additions by approval of an already existing member of the team.
|
||||
members = [
|
||||
theuni
|
||||
dpausp
|
||||
leona
|
||||
];
|
||||
scope = "Team for Flying Circus employees who collectively maintain packages.";
|
||||
shortName = "Flying Circus employees";
|
||||
};
|
||||
|
||||
freedesktop = {
|
||||
members = [ ];
|
||||
members = [ jtojnar ];
|
||||
scope = "Maintain Freedesktop.org packages for graphical desktop.";
|
||||
shortName = "freedesktop.org packaging";
|
||||
};
|
||||
@@ -327,6 +316,7 @@ with lib.maintainers; {
|
||||
members = [
|
||||
bobby285271
|
||||
hedning
|
||||
jtojnar
|
||||
dasj19
|
||||
maxeaubrey
|
||||
];
|
||||
@@ -849,18 +839,6 @@ with lib.maintainers; {
|
||||
shortName = "Vim/Neovim";
|
||||
};
|
||||
|
||||
wdz = {
|
||||
members = [
|
||||
n0emis
|
||||
netali
|
||||
vidister
|
||||
johannwagner
|
||||
yuka
|
||||
];
|
||||
scope = "Group registration for WDZ GmbH team members who collectively maintain packages.";
|
||||
shortName = "WDZ GmbH";
|
||||
};
|
||||
|
||||
xfce = {
|
||||
members = [
|
||||
bobby285271
|
||||
|
||||
@@ -20,11 +20,6 @@ merging is handled.
|
||||
coerced to a string. Even if derivations can be considered as
|
||||
paths, the more specific `types.package` should be preferred.
|
||||
|
||||
`types.pathInStore`
|
||||
|
||||
: A path that is contained in the Nix store. This can be a top-level store
|
||||
path like `pkgs.hello` or a descendant like `"${pkgs.hello}/bin/hello"`.
|
||||
|
||||
`types.package`
|
||||
|
||||
: A top-level store path. This can be an attribute set pointing
|
||||
|
||||
@@ -6,7 +6,7 @@ expressions and associated binaries. The NixOS channels are updated
|
||||
automatically from NixOS's Git repository after certain tests have
|
||||
passed and all packages have been built. These channels are:
|
||||
|
||||
- *Stable channels*, such as [`nixos-23.05`](https://channels.nixos.org/nixos-23.05).
|
||||
- *Stable channels*, such as [`nixos-22.11`](https://nixos.org/channels/nixos-22.11).
|
||||
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 4.19.34 to 4.19.38 (a minor bug fix), but not
|
||||
@@ -14,13 +14,13 @@ passed and all packages have been built. These channels are:
|
||||
Stable channels are generally maintained until the next stable
|
||||
branch is created.
|
||||
|
||||
- The *unstable channel*, [`nixos-unstable`](https://channels.nixos.org/nixos-unstable).
|
||||
- The *unstable channel*, [`nixos-unstable`](https://nixos.org/channels/nixos-unstable).
|
||||
This corresponds to NixOS's main development branch, and may thus see
|
||||
radical changes between channel updates. It's not recommended for
|
||||
production systems.
|
||||
|
||||
- *Small channels*, such as [`nixos-23.05-small`](https://channels.nixos.org/nixos-23.05-small)
|
||||
or [`nixos-unstable-small`](https://channels.nixos.org/nixos-unstable-small).
|
||||
- *Small channels*, such as [`nixos-22.11-small`](https://nixos.org/channels/nixos-22.11-small)
|
||||
or [`nixos-unstable-small`](https://nixos.org/channels/nixos-unstable-small).
|
||||
These are identical to the stable and unstable channels described above,
|
||||
except that they contain fewer binary packages. This means they get updated
|
||||
faster than the regular channels (for instance, when a critical security patch
|
||||
@@ -28,7 +28,7 @@ passed and all packages have been built. These channels are:
|
||||
built from source than usual. They're mostly intended for server environments
|
||||
and as such contain few GUI applications.
|
||||
|
||||
To see what channels are available, go to <https://channels.nixos.org>.
|
||||
To see what channels are available, go to <https://nixos.org/channels>.
|
||||
(Note that the URIs of the various channels redirect to a directory that
|
||||
contains the channel's latest version and includes ISO images and
|
||||
VirtualBox appliances.) Please note that during the release process,
|
||||
@@ -38,38 +38,38 @@ newest supported stable release.
|
||||
|
||||
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 23.05 ISO, you will be subscribed to
|
||||
the `nixos-23.05` channel. To see which NixOS channel you're subscribed
|
||||
instance, if you installed from a 22.11 ISO, you will be subscribed to
|
||||
the `nixos-22.11` channel. To see which NixOS channel you're subscribed
|
||||
to, run the following as root:
|
||||
|
||||
```ShellSession
|
||||
# nix-channel --list | grep nixos
|
||||
nixos https://channels.nixos.org/nixos-unstable
|
||||
nixos https://nixos.org/channels/nixos-unstable
|
||||
```
|
||||
|
||||
To switch to a different NixOS channel, do
|
||||
|
||||
```ShellSession
|
||||
# nix-channel --add https://channels.nixos.org/channel-name nixos
|
||||
# nix-channel --add https://nixos.org/channels/channel-name nixos
|
||||
```
|
||||
|
||||
(Be sure to include the `nixos` parameter at the end.) For instance, to
|
||||
use the NixOS 23.05 stable channel:
|
||||
use the NixOS 22.11 stable channel:
|
||||
|
||||
```ShellSession
|
||||
# nix-channel --add https://channels.nixos.org/nixos-23.05 nixos
|
||||
# nix-channel --add https://nixos.org/channels/nixos-22.11 nixos
|
||||
```
|
||||
|
||||
If you have a server, you may want to use the "small" channel instead:
|
||||
|
||||
```ShellSession
|
||||
# nix-channel --add https://channels.nixos.org/nixos-23.05-small nixos
|
||||
# nix-channel --add https://nixos.org/channels/nixos-22.11-small nixos
|
||||
```
|
||||
|
||||
And if you want to live on the bleeding edge:
|
||||
|
||||
```ShellSession
|
||||
# nix-channel --add https://channels.nixos.org/nixos-unstable nixos
|
||||
# nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
||||
```
|
||||
|
||||
You can then upgrade NixOS to the latest version in your chosen channel
|
||||
@@ -114,5 +114,5 @@ the new generation contains a different kernel, initrd or kernel
|
||||
modules. You can also specify a channel explicitly, e.g.
|
||||
|
||||
```nix
|
||||
system.autoUpgrade.channel = "https://channels.nixos.org/nixos-23.05";
|
||||
system.autoUpgrade.channel = https://nixos.org/channels/nixos-22.11;
|
||||
```
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
This section lists the release notes for each stable version of NixOS and current unstable revision.
|
||||
|
||||
```{=include=} sections
|
||||
rl-2311.section.md
|
||||
rl-2305.section.md
|
||||
rl-2211.section.md
|
||||
rl-2205.section.md
|
||||
|
||||
@@ -1,81 +1,65 @@
|
||||
# Release 23.05 (“Stoat”, 2023.05/31) {#sec-release-23.05}
|
||||
# Release 23.05 (“Stoat”, 2023.05/??) {#sec-release-23.05}
|
||||
|
||||
The NixOS release team is happy to announce a new version of NixOS. The release is called NixOS 23.05 ("Stoat").
|
||||
|
||||
NixOS is a Linux distribution, whose set of packages can also be used on other Linux systems and macOS.
|
||||
|
||||
Support is planned until the end of December 2023, handing over to NixOS 23.11.
|
||||
|
||||
To upgrade to the latest release, follow the [upgrade chapter](https://nixos.org/manual/nixos/stable/index.html#sec-upgrading).
|
||||
Support is planned until the end of December 2023, handing over to 23.11.
|
||||
|
||||
## Highlights {#sec-release-23.05-highlights}
|
||||
|
||||
In addition to numerous new and updated packages, this release has the following highlights:
|
||||
In addition to numerous new and upgraded packages, this release has the following highlights:
|
||||
|
||||
- The default [Nix](https://github.com/NixOS/nix) version was updated from 2.11 to 2.13. In particular, this includes a [small language alteration](https://github.com/NixOS/nix/issues/8259) in the way floats are represented in `builtins.toJSON`. See the release notes for [2.12](https://nixos.org/manual/nix/stable/release-notes/rl-2.12.html) and [2.13](https://nixos.org/manual/nix/unstable/release-notes/rl-2.13.html) for more information.
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- The default [Linux Kernel](https://kernel.org/) was updated from version 5.15 to 6.1, see [Kernelnewbies](https://kernelnewbies.org/Linux_6.1) for what has changed. All Kernels currently shown on [kernel.org](https://kernel.org/) are available.
|
||||
- Core version changes:
|
||||
|
||||
- [systemd](https://systemd.io) has been updated from v252 to v253, see [the release notes](https://github.com/systemd/systemd/blob/v253/NEWS#L3-L659) for more information on the changes.
|
||||
- Updating with `nixos-rebuild boot` and rebooting is recommended, since in some rare cases the `nixos-rebuild switch` into the new generation on a live system might fail due to missing mount units.
|
||||
- default linux: 5.15 -\> 6.1, all supported kernels available
|
||||
|
||||
- [glibc](https://www.gnu.org/software/libc/) has been updated from version 2.35 to 2.37, see [the release notes](https://sourceware.org/glibc/wiki/Release/2.37) for what was changed.
|
||||
- systemd has been updated to v253.1, see [the pull request](https://github.com/NixOS/nixpkgs/pull/216826) for more info.
|
||||
It's recommended to use `nixos-rebuild boot` and `reboot`, rather than `nixos-rebuild switch` - since in some rare cases
|
||||
the switch of a live system might fail.
|
||||
|
||||
- [libxcrypt](https://github.com/besser82/libxcrypt), the library providing the `crypt(3)` password hashing function, is now built without support for algorithms not flagged [`strong`](https://github.com/besser82/libxcrypt/blob/v4.4.33/lib/hashes.conf#L48). This affects the availability of password hashing algorithms used for system login (`login(1)`, `passwd(1)`), but also Apache2 Basic-Auth, Samba, OpenLDAP, Dovecot, and [many other packages](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/NixOS/nixpkgs%24+libxcrypt&patternType=standard&sm=1&groupBy=path).
|
||||
- glibc: 2.35 -\> 2.37
|
||||
|
||||
- NixOS now defaults to using [nsncd](https://github.com/twosigma/nsncd), a non-caching reimplementation of nscd in Rust, as its NSS lookup dispatcher. This replaces the buggy and deprecated nscd implementation provided through glibc. When you find problems, you can switch back by disabling it:
|
||||
```nix
|
||||
services.nscd.enableNsncd = false;
|
||||
```
|
||||
- Cinnamon has been updated to 5.6, see [the pull request](https://github.com/NixOS/nixpkgs/pull/201328#issue-1449910204) for what is changed.
|
||||
|
||||
- The internal option `boot.bootspec.enable` is now enabled by default because [RFC 0125](https://github.com/NixOS/rfcs/pull/125) was merged. This means you will have a bootspec document called `boot.json` generated for each system and specialisation in the top-level. This is useful to enable advanced boot use cases in NixOS, such as Secure Boot.
|
||||
- GNOME has been upgraded to version 44. Please see the [release notes](https://release.gnome.org/44/) for details.
|
||||
|
||||
- Two changes to `nixos-rebuild` are important to highlight as well.
|
||||
- Support for an extra `--specialisation` option was added that can be used to change specialisation for `switch` and `test` commands.
|
||||
- The `--target-host` and `--build-host` options no longer treat the `localhost` value specially – to build on resp. deploy to a local machine, omit the relevant flag.
|
||||
- KDE Plasma has been updated to v5.27, see [the release notes](https://kde.org/announcements/plasma/5/5.27.0/) for what is changed.
|
||||
|
||||
- [Python](https://www.python.org) implements [PEP 668](https://peps.python.org/pep-0668/), providing better feedback to users that try to run `pip install` for system-wide or user home installations.
|
||||
- Python implements [PEP 668](https://peps.python.org/pep-0668/), providing better feedback to users that try to run `pip install` system-wide.
|
||||
|
||||
- [Cinnamon](https://github.com/linuxmint/Cinnamon) has been updated to version 5.6, see [the pull request](https://github.com/NixOS/nixpkgs/pull/201328#issue-1449910204) for what was changed.
|
||||
- `nixos-rebuild` now supports an extra `--specialisation` option that can be used to change specialisation for `switch` and `test` commands.
|
||||
|
||||
- [GNOME](https://www.gnome.org) has been updated to version 44, see the [the release notes](https://release.gnome.org/44/) for details.
|
||||
- `libxcrypt`, the library providing the `crypt(3)` password hashing function, is now built without support for algorithms not flagged [`strong`](https://github.com/besser82/libxcrypt/blob/v4.4.33/lib/hashes.conf#L48). This affects the availability of password hashing algorithms used for system login (`login(1)`, `passwd(1)`), but also Apache2 Basic-Auth, Samba, OpenLDAP, Dovecot, and [many other packages](https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20libxcrypt&type=code).
|
||||
|
||||
- [KDE Plasma](https://kde.org/de/plasma-desktop/) has been updated to version 5.27, see [the release notes](https://kde.org/announcements/plasma/5/5.27.0/) for what was changed.
|
||||
- `boot.bootspec.enable` (internal option) is now enabled by default because [RFC-0125](https://github.com/NixOS/rfcs/pull/125) was merged. This means you will have a bootspec document called `boot.json` generated for each system and specialisation in the top-level. This is useful to enable advanced boot usecases in NixOS such as SecureBoot.
|
||||
|
||||
## New Services {#sec-release-23.05-new-services}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- [Akkoma](https://akkoma.social), an ActivityPub microblogging server. Available as [services.akkoma](options.html#opt-services.akkoma.enable).
|
||||
|
||||
- [alertmanager-irc-relay](https://github.com/google/alertmanager-irc-relay), a Prometheus Alertmanager IRC Relay. Available as [services.prometheus.alertmanagerIrcRelay](options.html#opt-services.prometheus.alertmanagerIrcRelay.enable).
|
||||
|
||||
- [alice-lg](github.com/alice-lg/alice-lg), a looking-glass for BGP sessions. Available as [services.alice-lg](#opt-services.alice-lg.enable).
|
||||
|
||||
- [atuin](https://github.com/ellie/atuin), a sync server for shell history. Available as [services.atuin](#opt-services.atuin.enable).
|
||||
|
||||
- [authelia](https://www.authelia.com/), an open-source authentication and authorization server. Available as [services.authelia](options.html#opt-services.authelia.enable).
|
||||
|
||||
- [birdwatcher](github.com/alice-lg/birdwatcher), a small HTTP server meant to provide an API defined by Barry O'Donovan's birds-eye to the BIRD internet routing daemon. Available as [services.birdwatcher](#opt-services.birdwatcher.enable).
|
||||
- [Pixelfed](https://pixelfed.org/), an Instagram-like ActivityPub server. Available as [services.pixelfed](options.html#opt-services.pixelfed.enable).
|
||||
|
||||
- [blesh](https://github.com/akinomyoga/ble.sh), a line editor written in pure bash. Available as [programs.bash.blesh](#opt-programs.bash.blesh.enable).
|
||||
|
||||
- [Budgie Desktop](https://github.com/BuddiesOfBudgie/budgie-desktop), a familiar, modern desktop environment. Available as [services.xserver.desktopManager.budgie](options.html#opt-services.xserver.desktopManager.budgie).
|
||||
- [webhook](https://github.com/adnanh/webhook), a lightweight webhook server. Available as [services.webhook](#opt-services.webhook.enable).
|
||||
|
||||
- [clash-verge](https://github.com/zzzgydi/clash-verge), a Clash GUI based on tauri. Available as [programs.clash-verge](#opt-programs.clash-verge.enable).
|
||||
- [cups-pdf-to-pdf](https://github.com/alexivkin/CUPS-PDF-to-PDF), a pdf-generating cups backend based on [cups-pdf](https://www.cups-pdf.de/). Available as [services.printing.cups-pdf](#opt-services.printing.cups-pdf.enable).
|
||||
|
||||
- [clash-verge](https://github.com/zzzgydi/clash-verge), A Clash GUI based on tauri. Available as [programs.clash-verge](#opt-programs.clash-verge.enable).
|
||||
|
||||
- [Cloudlog](https://www.magicbug.co.uk/cloudlog/), a web-based Amateur Radio logging application. Available as [services.cloudlog](#opt-services.cloudlog.enable).
|
||||
|
||||
- [consul-template](https://github.com/hashicorp/consul-template/), a template renderer, notifier, and supervisor for HashiCorp Consul and Vault data. Available as [services.consul-template](#opt-services.consul-template.instances).
|
||||
|
||||
- [cups-pdf-to-pdf](https://github.com/alexivkin/CUPS-PDF-to-PDF), a PDF-generating CUPS backend based on [cups-pdf](https://www.cups-pdf.de/). Available as [services.printing.cups-pdf](#opt-services.printing.cups-pdf.enable).
|
||||
|
||||
- [Deepin Desktop Environment](https://github.com/linuxdeepin/dde), an elegant, easy to use and reliable desktop environment. Available as [services.xserver.desktopManager.deepin](options.html#opt-services.xserver.desktopManager.deepin).
|
||||
|
||||
- [esphome](https://esphome.io), a dashboard to configure ESP8266/ESP32 devices for use with Home Automation systems. Available as [services.esphome](#opt-services.esphome.enable).
|
||||
- [system-repart](https://www.freedesktop.org/software/systemd/man/systemd-repart.service.html), grow and add partitions to a partition table. Available as [systemd.repart](options.html#opt-systemd.repart) and [boot.initrd.systemd.repart](options.html#opt-boot.initrd.systemd.repart)
|
||||
|
||||
- [frigate](https://frigate.video), an open source NVR built around real-time AI object detection. Available as [services.frigate](#opt-services.frigate.enable).
|
||||
|
||||
- [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.fuzzyCompletion).
|
||||
|
||||
- [readarr](https://github.com/Readarr/Readarr), Book Manager and Automation (Sonarr for Ebooks). Available as [services.readarr](options.html#opt-services.readarr.enable).
|
||||
|
||||
- [gemstash](https://github.com/rubygems/gemstash), a RubyGems.org cache and private gem server. Available as [services.gemstash](#opt-services.gemstash.enable).
|
||||
|
||||
- [gitea-actions-runner](https://gitea.com/gitea/act_runner), a CI runner for Gitea/Forgejo Actions. Available as [services.gitea-actions-runner](#opt-services.gitea-actions-runner.instances).
|
||||
@@ -84,121 +68,129 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- [go2rtc](https://github.com/AlexxIT/go2rtc), a camera streaming appliation with support for RTSP, WebRTC, HomeKit, FFMPEG, RTMP and other protocols. Available as [services.go2rtc](options.html#opt-services.go2rtc.enable).
|
||||
|
||||
- [goeland](https://github.com/slurdge/goeland), an alternative to rss2email written in Golang with many filters. Available as [services.goeland](#opt-services.goeland.enable).
|
||||
|
||||
- [gonic](https://github.com/sentriz/gonic), a Subsonic music streaming server. Available as [services.gonic](#opt-services.gonic.enable).
|
||||
|
||||
- [hardware.ipu6](#opt-hardware.ipu6.enable), drivers for IPU6 based webcams on Intel Tiger Lake and Alder Lake.
|
||||
|
||||
- [harmonia](https://github.com/nix-community/harmonia/), a Nix binary cache implemented in Rust using [libnixstore](https://docs.rs/libnixstore/latest/libnixstore/). Available as [services.harmonia](options.html#opt-services.harmonia.enable).
|
||||
- [harmonia](https://github.com/nix-community/harmonia/), Nix binary cache implemented in rust using libnix-store. Available as [services.harmonia](options.html#opt-services.harmonia.enable).
|
||||
|
||||
- [hyprland](https://github.com/hyprwm/hyprland), a dynamic tiling Wayland compositor that doesn't sacrifice on its looks. Available as [programs.hyprland](#opt-programs.hyprland.enable).
|
||||
|
||||
- [imaginary](https://github.com/h2non/imaginary), a microservice for high-level image processing that Nextcloud can use to generate previews. Available as [services.imaginary](#opt-services.imaginary.enable).
|
||||
|
||||
- [ivpn](https://www.ivpn.net/), a secure, private VPN with fast WireGuard connections. Available as [services.ivpn](#opt-services.ivpn.enable).
|
||||
|
||||
- [vmalert](https://victoriametrics.com/), an alerting engine for VictoriaMetrics. Available as [services.vmalert](#opt-services.vmalert.enable).
|
||||
|
||||
- [jellyseerr](https://github.com/Fallenbagel/jellyseerr), a web-based requests manager for Jellyfin, forked from Overseerr. Available as [services.jellyseerr](#opt-services.jellyseerr.enable).
|
||||
|
||||
- [kavita](https://kavitareader.com), a self-hosted digital library. Available as [services.kavita](options.html#opt-services.kavita.enable).
|
||||
|
||||
- [keyd](https://github.com/rvaiya/keyd), a key remapping daemon for Linux. Available as [services.keyd](#opt-services.keyd.enable).
|
||||
|
||||
- [lldap](https://github.com/lldap/lldap), a lightweight authentication server that provides an opinionated, simplified LDAP interface for authentication. Available as [services.lldap](#opt-services.lldap.enable).
|
||||
|
||||
- [minipro](https://gitlab.com/DavidGriffith/minipro/), an open source program for controlling the MiniPRO TL866xx series of chip programmers. Available as [programs.minipro](options.html#opt-programs.minipro.enable).
|
||||
|
||||
- [mmsd](https://gitlab.com/kop316/mmsd), a lower level daemon that transmits and receives MMSes. Available as [services.mmsd](#opt-services.mmsd.enable).
|
||||
- [stevenblack-blocklist](https://github.com/StevenBlack/hosts), A unified hosts file with base extensions for blocking unwanted websites. Available as [networking.stevenblack](options.html#opt-networking.stevenblack.enable).
|
||||
|
||||
- [monica](https://www.monicahq.com), an open source personal CRM. Available as [services.monica](options.html#opt-services.monica.enable).
|
||||
- [Budgie Desktop](https://github.com/BuddiesOfBudgie/budgie-desktop), a familiar, modern desktop environment. Available as [services.xserver.desktopManager.budgie](options.html#opt-services.xserver.desktopManager.budgie).
|
||||
|
||||
- [networkd-dispatcher](https://gitlab.com/craftyguy/networkd-dispatcher), a dispatcher service for systemd-networkd connection status changes. Available as [services.networkd-dispatcher](#opt-services.networkd-dispatcher.enable).
|
||||
|
||||
- [nimdow](https://github.com/avahe-kellenberger/nimdow), a window manager written in Nim, inspired by dwm. Available as [services.xserver.windowManager.nimdow.enable](options.html#opt-services.xserver.windowManager.nimdow.enable).
|
||||
- [imaginary](https://github.com/h2non/imaginary), a microservice for high-level image processing that Nextcloud can use to generate previews. Available as [services.imaginary](#opt-services.imaginary.enable).
|
||||
|
||||
- [opensearch](https://opensearch.org), a search server alternative to Elasticsearch. Available as [services.opensearch](options.html#opt-services.opensearch.enable).
|
||||
|
||||
- [openvscode-server](https://github.com/gitpod-io/openvscode-server), run VS Code on a remote machine with access through a modern web browser from any device, anywhere. Available as [services.openvscode-server](#opt-services.openvscode-server.enable).
|
||||
- [kavita](https://kavitareader.com), a self-hosted digital library. Available as [services.kavita](options.html#opt-services.kavita.enable).
|
||||
|
||||
- [peroxide](https://github.com/ljanyst/peroxide), a fork of the official [ProtonMail bridge](https://github.com/ProtonMail/proton-bridge) that aims to be similar to [Hydroxide](https://github.com/emersion/hydroxide). Available as [services.peroxide](#opt-services.peroxide.enable).
|
||||
- [monica](https://www.monicahq.com), an open source personal CRM. Available as [services.monica](options.html#opt-services.monica.enable).
|
||||
|
||||
- [photoprism](https://photoprism.app/), a AI-powered photos app for the decentralized web. Available as [services.photoprism](options.html#opt-services.photoprism.enable).
|
||||
- [authelia](https://www.authelia.com/), is an open-source authentication and authorization server. Available under [services.authelia](options.html#opt-services.authelia.enable).
|
||||
|
||||
- [Pixelfed](https://pixelfed.org/), an Instagram-like ActivityPub server. Available as [services.pixelfed](options.html#opt-services.pixelfed.enable).
|
||||
- [goeland](https://github.com/slurdge/goeland), an alternative to rss2email written in golang with many filters. Available as [services.goeland](#opt-services.goeland.enable).
|
||||
|
||||
- [PufferPanel](https://pufferpanel.com), a game server management panel designed to be easy to use. Available as [services.pufferpanel](#opt-services.pufferpanel.enable).
|
||||
|
||||
- [QDMR](https://dm3mat.darc.de/qdmr/), a GUI application and command line tool for programming DMR radios [programs.qdmr](#opt-programs.qdmr.enable).
|
||||
|
||||
- [readarr](https://github.com/Readarr/Readarr), book manager and automation (Sonarr for ebooks). Available as [services.readarr](options.html#opt-services.readarr.enable).
|
||||
|
||||
- [ReGreet](https://github.com/rharish101/ReGreet), a clean and customizable greeter for greetd. Available as [programs.regreet](#opt-programs.regreet.enable).
|
||||
|
||||
- [rshim](https://github.com/Mellanox/rshim-user-space), the user-space rshim driver for the BlueField SoC. Available as [services.rshim](options.html#opt-services.rshim.enable).
|
||||
|
||||
- [SFTPGo](https://github.com/drakkan/sftpgo), a fully featured and highly configurable SFTP server with optional HTTP/S, FTP/S and WebDAV support. Available as [services.sftpgo](options.html#opt-services.sftpgo.enable).
|
||||
|
||||
- [sharing](https://github.com/parvardegr/sharing), a command-line tool to share directories and files from the CLI to iOS and Android devices without the need of an extra client app. Available as [programs.sharing](#opt-programs.sharing.enable).
|
||||
|
||||
- [sniffnet](https://github.com/GyulyVGC/sniffnet), an application to monitor your network traffic. Available as [programs.sniffnet](#opt-programs.sniffnet.enable).
|
||||
|
||||
- [stargazer](https://sr.ht/~zethra/stargazer/), a fast and easy to use Gemini server. Available as [services.stargazer](#opt-services.stargazer.enable).
|
||||
|
||||
- [stevenblack-blocklist](https://github.com/StevenBlack/hosts), a unified hosts file with base extensions for blocking unwanted websites. Available as [networking.stevenblack](options.html#opt-networking.stevenblack.enable).
|
||||
|
||||
- [systemd-repart](https://www.freedesktop.org/software/systemd/man/systemd-repart.service.html), grow and add partitions to a partition table. Available as [systemd.repart](options.html#opt-systemd.repart) and [boot.initrd.systemd.repart](options.html#opt-boot.initrd.systemd.repart)
|
||||
|
||||
- [trippy](https://github.com/fujiapple852/trippy), a network diagnostic tool. Available as [programs.trippy](#opt-programs.trippy.enable).
|
||||
- [alertmanager-irc-relay](https://github.com/google/alertmanager-irc-relay), a Prometheus Alertmanager IRC Relay. Available as [services.prometheus.alertmanagerIrcRelay](options.html#opt-services.prometheus.alertmanagerIrcRelay.enable).
|
||||
|
||||
- [tts](https://github.com/coqui-ai/TTS), a battle-tested deep learning toolkit for Text-to-Speech. Multiple servers may be configured below [services.tts.servers](#opt-services.tts.servers).
|
||||
|
||||
- [ulogd](https://www.netfilter.org/projects/ulogd/index.html), a userspace logging daemon for netfilter/iptables related logging. Available as [services.ulogd](options.html#opt-services.ulogd.enable).
|
||||
- [atuin](https://github.com/ellie/atuin), a sync server for shell history. Available as [services.atuin](#opt-services.atuin.enable).
|
||||
|
||||
- [esphome](https://esphome.io), a dashboard to configure ESP8266/ESP32 devices for use with Home Automation systems. Available as [services.esphome](#opt-services.esphome.enable).
|
||||
|
||||
- [networkd-dispatcher](https://gitlab.com/craftyguy/networkd-dispatcher), a dispatcher service for systemd-networkd connection status changes. Available as [services.networkd-dispatcher](#opt-services.networkd-dispatcher.enable).
|
||||
|
||||
- [gonic](https://github.com/sentriz/gonic), a Subsonic music streaming server. Available as [services.gonic](#opt-services.gonic.enable).
|
||||
|
||||
- [mmsd](https://gitlab.com/kop316/mmsd), a lower level daemon that transmits and receives MMSes. Available as [services.mmsd](#opt-services.mmsd.enable).
|
||||
|
||||
- [QDMR](https://dm3mat.darc.de/qdmr/), a GUI application and command line tool for programming DMR radios [programs.qdmr](#opt-programs.qdmr.enable)
|
||||
|
||||
- [keyd](https://github.com/rvaiya/keyd), a key remapping daemon for linux. Available as [services.keyd](#opt-services.keyd.enable).
|
||||
|
||||
- [consul-template](https://github.com/hashicorp/consul-template/), a template rendering, notifier, and supervisor for HashiCorp Consul and Vault data. Available as [services.consul-template](#opt-services.consul-template.instances).
|
||||
|
||||
- [vault-agent](https://developer.hashicorp.com/vault/docs/agent), a template rendering and API auth proxy for HashiCorp Vault, similar to `consul-template`. Available as [services.vault-agent](#opt-services.vault-agent.instances).
|
||||
|
||||
- [trippy](https://github.com/fujiapple852/trippy), a network diagnostic tool. Available as [programs.trippy](#opt-programs.trippy.enable).
|
||||
|
||||
- [v2rayA](https://v2raya.org), a Linux web GUI client of Project V which supports V2Ray, Xray, SS, SSR, Trojan and Pingtunnel. Available as [services.v2raya](options.html#opt-services.v2raya.enable).
|
||||
|
||||
- [v4l2-relayd](https://git.launchpad.net/v4l2-relayd), a streaming relay for v4l2loopback using gstreamer. Available as [services.v4l2-relayd](#opt-services.v4l2-relayd.instances._name_.enable).
|
||||
- [rshim](https://github.com/Mellanox/rshim-user-space), the user-space rshim driver for the BlueField SoC. Available as [services.rshim](options.html#opt-services.rshim.enable).
|
||||
|
||||
- [vault-agent](https://developer.hashicorp.com/vault/docs/agent), a template renderer and API auth proxy for HashiCorp Vault, similar to `consul-template`. Available as [services.vault-agent](#opt-services.vault-agent.instances).
|
||||
- [wstunnel](https://github.com/erebe/wstunnel), a proxy tunnelling arbitrary TCP or UDP traffic through a WebSocket connection. Instances may be configured via [services.wstunnel](options.html#opt-services.wstunnel.enable).
|
||||
|
||||
- [webhook](https://github.com/adnanh/webhook), a lightweight webhook server. Available as [services.webhook](#opt-services.webhook.enable).
|
||||
- [ulogd](https://www.netfilter.org/projects/ulogd/index.html), a userspace logging daemon for netfilter/iptables related logging. Available as [services.ulogd](options.html#opt-services.ulogd.enable).
|
||||
|
||||
- [PufferPanel](https://pufferpanel.com), game server management panel designed to be easy to use. Available as [services.pufferpanel](#opt-services.pufferpanel.enable).
|
||||
|
||||
- [jellyseerr](https://github.com/Fallenbagel/jellyseerr), a web-based requests manager for Jellyfin, forked from Overseerr. Available as [services.jellyseerr](#opt-services.jellyseerr.enable).
|
||||
|
||||
- [stargazer](https://sr.ht/~zethra/stargazer/), a fast and easy to use Gemini server. Available as [services.stargazer](#opt-services.stargazer.enable).
|
||||
|
||||
- [sniffnet](https://github.com/GyulyVGC/sniffnet), an application to monitor your network traffic. Available as [programs.sniffnet](#opt-programs.sniffnet.enable).
|
||||
|
||||
- [photoprism](https://photoprism.app/), a AI-Powered Photos App for the Decentralized Web. Available as [services.photoprism](options.html#opt-services.photoprism.enable).
|
||||
|
||||
- [alice-lg](github.com/alice-lg/alice-lg), a looking-glass for BGP sessions. Available as [services.alice-lg](#opt-services.alice-lg.enable).
|
||||
|
||||
- [birdwatcher](github.com/alice-lg/birdwatcher), a small HTTP server meant to provide an API defined by Barry O'Donovan's birds-eye to the BIRD internet routing daemon. Available as [services.birdwatcher](#opt-services.birdwatcher.enable).
|
||||
|
||||
- [peroxide](https://github.com/ljanyst/peroxide), a fork of the official [ProtonMail bridge](https://github.com/ProtonMail/proton-bridge) that aims to be similar to [Hydroxide](https://github.com/emersion/hydroxide). Available as [services.peroxide](#opt-services.peroxide.enable).
|
||||
|
||||
- [autosuspend](https://github.com/languitar/autosuspend), a python daemon that suspends a system if certain conditions are met, or not met.
|
||||
|
||||
- [sharing](https://github.com/parvardegr/sharing), a command-line tool to share directories and files from the CLI to iOS and Android devices without the need of an extra client app. Available as [programs.sharing](#opt-programs.sharing.enable).
|
||||
|
||||
- [nimdow](https://github.com/avahe-kellenberger/nimdow), a window manager written in Nim, inspired by dwm.
|
||||
|
||||
- [trurl](https://github.com/curl/trurl), a command line tool for URL parsing and manipulation.
|
||||
|
||||
- [wgautomesh](https://git.deuxfleurs.fr/Deuxfleurs/wgautomesh), a simple utility to help connect wireguard nodes together in a full mesh topology. Available as [services.wgautomesh](options.html#opt-services.wgautomesh.enable).
|
||||
|
||||
- [woodpecker](https://woodpecker-ci.org/), a simple CI engine with great extensibility. Available as [services.woodpecker-server](#opt-services.woodpecker-server.enable) and [services.woodpecker-agents](#opt-services.woodpecker-agents.agents._name_.enable).
|
||||
- [woodpecker-agents](https://woodpecker-ci.org/), a simple CI engine with great extensibility. Available as [services.woodpecker-agents](#opt-services.woodpecker-agents.agents._name_.enable).
|
||||
|
||||
- [wstunnel](https://github.com/erebe/wstunnel), a proxy tunnelling arbitrary TCP or UDP traffic through a WebSocket connection. Available as [services.wstunnel](options.html#opt-services.wstunnel.enable).
|
||||
- [woodpecker-server](https://woodpecker-ci.org/), a simple CI engine with great extensibility. Available as [services.woodpecker-server](#opt-services.woodpecker-server.enable).
|
||||
|
||||
- [lldap](https://github.com/lldap/lldap), a lightweight authentication server that provides an opinionated, simplified LDAP interface for authentication. Available as [services.lldap](#opt-services.lldap.enable).
|
||||
|
||||
- [ReGreet](https://github.com/rharish101/ReGreet), a clean and customizable greeter for greetd. Available as [programs.regreet](#opt-programs.regreet.enable).
|
||||
|
||||
- [v4l2-relayd](https://git.launchpad.net/v4l2-relayd), a streaming relay for v4l2loopback using gstreamer. Available as [services.v4l2-relayd](#opt-services.v4l2-relayd.instances._name_.enable).
|
||||
|
||||
- [hardware.ipu6](#opt-hardware.ipu6.enable) adds support for ipu6 based webcams on intel tiger lake and alder lake.
|
||||
|
||||
- [ivpn](https://www.ivpn.net/), a secure, private VPN with fast WireGuard connections. Available as [services.ivpn](#opt-services.ivpn.enable).
|
||||
|
||||
- [openvscode-server](https://github.com/gitpod-io/openvscode-server), run VS Code on a remote machine with access through a modern web browser from any device, anywhere. Available as [services.openvscode-server](#opt-services.openvscode-server.enable).
|
||||
|
||||
## Backward Incompatibilities {#sec-release-23.05-incompatibilities}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- `carnix` and `cratesIO` has been removed due to being unmaintained, use alternatives such as [naersk](https://github.com/nix-community/naersk) and [crate2nix](https://github.com/kolloch/crate2nix) instead.
|
||||
|
||||
- `services.asusd` configuration now uses strings instead of structured configuration, as upstream switched to the [RON](https://github.com/ron-rs/ron) configuration format. Support for structured configuration may return when [RON](https://github.com/ron-rs/ron) generation is implemented in nixpkgs.
|
||||
|
||||
- `checkInputs` have been renamed to `nativeCheckInputs`, because they behave the same as `nativeBuildInputs` when `doCheck` is set. `checkInputs` now denote a new type of dependencies, added to `buildInputs` when `doCheck` is set. As a rule of thumb, `nativeCheckInputs` are tools on `$PATH` used during the tests, and `checkInputs` are libraries which are linked to executables built as part of the tests. Similarly, `installCheckInputs` are renamed to `nativeInstallCheckInputs`, corresponding to `nativeBuildInputs`, and `installCheckInputs` are a new type of dependencies added to `buildInputs` when `doInstallCheck` is set. (Note that this change will not cause breakage to derivations with `strictDeps` unset, which are most packages except python, rust, ocaml and go packages).
|
||||
|
||||
- `buildDunePackage` now defaults to `strictDeps = true` which means that any library should go into `buildInputs` or `checkInputs`. Any executable that is run on the building machine should go into `nativeBuildInputs` or `nativeCheckInputs` respectively. Example of executables are `ocaml`, `findlib` and `menhir`. PPXs are libraries which are built by dune and should therefore not go into `nativeBuildInputs`.
|
||||
|
||||
- `borgbackup` module now has an option for inhibiting system sleep while backups are running, defaulting to off (not inhibiting sleep), available as [`services.borgbackup.jobs.<name>.inhibitsSleep`](#opt-services.borgbackup.jobs._name_.inhibitsSleep).
|
||||
|
||||
- The `openssh` client now comes with the `~C` escape sequence disabled by default. It can be re-enabled by setting `EnableEscapeCommandline yes`
|
||||
- The `ssh` client tool now disables the `~C` escape sequence by default. This can be re-enabled by setting `EnableEscapeCommandline yes`
|
||||
|
||||
- The `programs.ssh` client module does not read `/etc/ssh/ssh_known_hosts2` anymore, since this location is [deprecated since 2001](https://marc.info/?l=openssh-unix-dev&m=100508718416162&w=2).
|
||||
- Many `services.syncthing` options have been moved to `services.syncthing.settings`, as part of [RFC 42](https://github.com/NixOS/rfcs/pull/42)'s implementation, see [#226088](https://github.com/NixOS/nixpkgs/pull/226088).
|
||||
|
||||
- The `services.openssh` server module does not read `~/.ssh/authorized_keys2` anymore, since this location is [deprecated since 2001](https://marc.info/?l=openssh-unix-dev&m=100508718416162&w=2).
|
||||
- The `ssh` module does not read `/etc/ssh/ssh_known_hosts2` anymore since this location is [deprecated since 2001](https://marc.info/?l=openssh-unix-dev&m=100508718416162&w=2).
|
||||
|
||||
- MAC-then-encrypt algorithms were removed from the default selection of `services.openssh.settings.Macs`. If you still require these [MACs](https://en.wikipedia.org/wiki/Message_authentication_code), for example when you are relying on libssh2 (e.g. VLC) or the SSH library shipped on the iPhone, you can re-add them like this:
|
||||
|
||||
```nix
|
||||
services.openssh.settings.Macs = [
|
||||
"hmac-sha2-512"
|
||||
"hmac-sha2-256"
|
||||
"umac-128@openssh.com"
|
||||
];
|
||||
```
|
||||
- The openssh module does not read `~/.ssh/authorized_keys2` anymore since this location is [deprecated since 2001](https://marc.info/?l=openssh-unix-dev&m=100508718416162&w=2).
|
||||
|
||||
- `podman` now uses the `netavark` network stack. Users will need to delete all of their local containers, images, volumes, etc, by running `podman system reset --force` once before upgrading their systems.
|
||||
|
||||
- `git-bug` has been updated to at least version 0.8.0, which includes backwards incompatible changes. The `git-bug-migration` package can be used to upgrade existing repositories.
|
||||
|
||||
- `graylog` has been updated to version 5, which can not be updated directly from the previously packaged version 3.3. If you had installed the previously packaged version 3.3, please follow the [upgrade path](https://go2docs.graylog.org/5-0/upgrading_graylog/upgrade_path.htm) from 3.3 to 4.0 to 4.3 to 5.0.
|
||||
|
||||
- `buildFHSUserEnv` is now called `buildFHSEnv` and uses FlatPak's Bubblewrap sandboxing tool rather than Nixpkgs' own chrootenv. The old chrootenv-based implemenation is still available via `buildFHSEnvChrootenv` but is considered deprecated and will be removed when the remaining uses inside Nixpkgs have been migrated. If your FHSEnv-wrapped application misbehaves when using the new bubblewrap implementation, please create an issue in Nixpkgs.
|
||||
- `graylog` has been updated to version 5, which can not be upgraded directly from the previously packaged version 3.3. If you had installed the previously packaged version 3.3, please follow the [upgrade path](https://go2docs.graylog.org/5-0/upgrading_graylog/upgrade_path.htm) from 3.3 to 4.0 to 4.3 to 5.0.
|
||||
|
||||
- `nushell` has been updated to at least version 0.77.0, which includes potential breaking changes in aliases. The old aliases are now available as `old-alias` but it is recommended you migrate to the new format. See [Reworked aliases](https://www.nushell.sh/blog/2023-03-14-nushell_0_77.html#reworked-aliases-breaking-changes-kubouch).
|
||||
|
||||
@@ -206,16 +198,16 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- `keepassx` and `keepassx2` have been removed, due to upstream [stopping development](https://www.keepassx.org/index.html%3Fp=636.html). Consider [KeePassXC](https://keepassxc.org) as a maintained alternative.
|
||||
|
||||
- The [services.kubo.settings](#opt-services.kubo.settings) option is now no longer stateful. If you changed any of the options in [services.kubo.settings](#opt-services.kubo.settings) in the past and then removed them from your NixOS configuration again, those changes are still in your Kubo configuration file but will now be reset to the default. If you're unsure, you may want to make a backup of your configuration file (probably `/var/lib/ipfs/config`) and compare after the update.
|
||||
- The [services.kubo.settings](#opt-services.kubo.settings) option is now no longer stateful. If you changed any of the options in [services.kubo.settings](#opt-services.kubo.settings) in the past and then removed them from your NixOS configuration again, those changes are still in your Kubo configuration file but will now be reset to the default. If you're unsure, you may want to make a backup of your configuration file (probably /var/lib/ipfs/config) and compare after the update.
|
||||
|
||||
- The Kubo HTTP API will no longer listen on localhost and will instead only listen on a Unix domain socket by default. Read the [services.kubo.settings.Addresses.API](#opt-services.kubo.settings.Addresses.API) option description for more information.
|
||||
|
||||
- The EC2 image module no longer fetches instance metadata in stage-1. This results in a significantly smaller initramfs, since network drivers no longer need to be included, and faster boots, since metadata fetching can happen in parallel with startup of other services.
|
||||
This breaks services which rely on metadata being present by the time stage-2 is entered. Anything which reads EC2 metadata from `/etc/ec2-metadata` should now have an `after` dependency on `fetch-ec2-metadata.service`
|
||||
|
||||
- The mailman service now defaults to using a randomly generated REST API password instead of a hard-coded one.
|
||||
- The mailman service now defaults to using a randomly generated REST API password instead of a hardcoded one.
|
||||
|
||||
- `minio` removed support for its legacy filesystem backend in [RELEASE.2022-10-29T06-21-33Z](https://github.com/minio/minio/releases/tag/RELEASE.2022-10-29T06-21-33Z). This means if your storage was created with the old format, minio will no longer start. Unfortunately, minio doesn't provide an automatic migration, they only provide [instructions how to manually convert the node](https://min.io/docs/minio/windows/operations/install-deploy-manage/migrate-fs-gateway.html). To facilitate this migration, we keep around the last version that still supports the old filesystem backend as `minio_legacy_fs`. Use it via `services.minio.package = minio_legacy_fs;` to export your data before switching to the new version. See the corresponding [issue](https://github.com/NixOS/nixpkgs/issues/199318) for more details.
|
||||
- `minio` removed support for its legacy filesystem backend in [RELEASE.2022-10-29T06-21-33Z](https://github.com/minio/minio/releases/tag/RELEASE.2022-10-29T06-21-33Z). This means if your storage was created with the old format, minio will no longer start. Unfortunately minio doesn't provide a an automatic migration, they only provide [instructions how to manually convert the node](https://min.io/docs/minio/windows/operations/install-deploy-manage/migrate-fs-gateway.html). To facilitate this migration we keep around the last version that still supports the old filesystem backend as `minio_legacy_fs`. Use it via `services.minio.package = minio_legacy_fs;` to export your data before switching to the new version. See the corresponding [issue](https://github.com/NixOS/nixpkgs/issues/199318) for more details.
|
||||
|
||||
- `services.sourcehut.dispatch` and the corresponding package (`sourcehut.dispatchsrht`) have been removed due to [upstream deprecation](https://sourcehut.org/blog/2022-08-01-dispatch-deprecation-plans/).
|
||||
|
||||
@@ -239,20 +231,15 @@ In addition to numerous new and updated packages, this release has the following
|
||||
};
|
||||
```
|
||||
|
||||
- The default module options for [services.snapserver.openFirewall](#opt-services.snapserver.openFirewall), [services.tmate-ssh-server.openFirewall](#opt-services.tmate-ssh-server.openFirewall) and [services.unifi-video.openFirewall](#opt-services.unifi-video.openFirewall) have been changed from `true` to `false`. You will need to explicitly set this option to `true`, or configure your firewall.
|
||||
- The [services.snapserver.openFirewall](#opt-services.snapserver.openFirewall) module option default value has been changed from `true` to `false`. You will need to explicitly set this option to `true`, or configure your firewall.
|
||||
|
||||
- The option `i18n.inputMethod.fcitx5.enableRimeData` has been removed. Default RIME data is now included in `fcitx5-rime` by default, and can be customized using
|
||||
- The [services.tmate-ssh-server.openFirewall](#opt-services.tmate-ssh-server.openFirewall) module option default value has been changed from `true` to `false`. You will need to explicitly set this option to `true`, or configure your firewall.
|
||||
|
||||
```nix
|
||||
fcitx5-rime.override {
|
||||
rimeDataPkgs = [
|
||||
pkgs.rime-data
|
||||
# ...
|
||||
];
|
||||
}
|
||||
```
|
||||
- The [services.unifi-video.openFirewall](#opt-services.unifi-video.openFirewall) module option default value has been changed from `true` to `false`. You will need to explicitly set this option to `true`, or configure your firewall.
|
||||
|
||||
- The `udev` hwdb.bin file is now built with systemd-hwdb rather than the [deprecated "udevadm hwdb"](https://github.com/systemd/systemd/pull/25714). This may impact mappings where the same key is defined in multiple matching entries. The updated behavior will select the latest definition in case of conflict. In general, this should be a positive change, as the hwdb source files are designed with this ordering in mind. As an example, the mapping of the HP Dev One keyboard scan code for "mute mic" is corrected by this update. This change may impact users who have worked-around previously incorrect mappings.
|
||||
- The option `i18n.inputMethod.fcitx5.enableRimeData` has been removed. Default RIME data is now included in `fcitx5-rime` by default, and can be customized using `fcitx5-rime.override { rimeDataPkgs = [ pkgs.rime-data, package2, ... ]; }`
|
||||
|
||||
- The udev hwdb.bin file is now built with systemd-hwdb rather than the [deprecated "udevadm hwdb"](https://github.com/systemd/systemd/pull/25714). This may impact mappings where the same key is defined in multiple matching entries. The updated behavior will select the latest definition in case of conflict. In general, this should be a positive change, as the hwdb source files are designed with this ordering in mind. As an example, the mapping of the HP Dev One keyboard scan code for "mute mic" is corrected by this update. This change may impact users who have worked-around previously incorrect mappings.
|
||||
|
||||
- Kime has been updated from 2.5.6 to 3.0.2 and the `i18n.inputMethod.kime.config` option has been removed. Users should use `daemonModules`, `iconColor`, and `extraConfig` options under `i18n.inputMethod.kime` instead.
|
||||
|
||||
@@ -260,26 +247,28 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- `i3status-rust` has been updated from 0.22.0 to 0.30.5, and this brings many changes to its configuration format. Additional information can be found [here](https://github.com/greshake/i3status-rust/blob/v0.30.0/NEWS.md).
|
||||
|
||||
- The `wordpress` derivation no longer contains any built-in plugins or themes. If you need them, you have to add them back to prevent your site from breaking. You can find them in `wordpressPackages.{plugins,themes}`.
|
||||
- The `wordpress` derivation no longer contains any builtin plugins or themes. If you need them you have to add them back to prevent your site from breaking. You can find them in `wordpressPackages.{plugins,themes}`.
|
||||
|
||||
- `llvmPackages_rocm.llvm` will not contain `clang` or `compiler-rt`. `llvmPackages_rocm.clang` will not contain `llvm`. `llvmPackages_rocm.clangNoCompilerRt` has been removed in favor of using `llvmPackages_rocm.clang-unwrapped`.
|
||||
|
||||
- `services.xserver.desktopManager.plasma5.excludePackages` has been moved to `environment.plasma5.excludePackages`, for consistency with other Desktop Environments.
|
||||
|
||||
- `teleport` has been updated from major version 10 to major version 12. Please see upstream [upgrade instructions](https://goteleport.com/docs/setup/operations/upgrading/) and release notes for versions [11](https://goteleport.com/docs/changelog/#1100) and [12](https://goteleport.com/docs/changelog/#1201). Note that Teleport does not officially support upgrades across more than one major version at a time. If you're running Teleport server components, it is recommended to first upgrade to an intermediate 11.x version by setting `services.teleport.package = pkgs.teleport_11`. Afterwards, this option can be removed to upgrade to the default version (12).
|
||||
- `services.xserver.desktopManager.plasma5.excludePackages` has been moved to `environment.plasma5.excludePackages`, for consistency with other Desktop Environments
|
||||
|
||||
- The EC2 image module previously detected and automatically mounted ext3-formatted instance store devices and partitions in stage-1 (initramfs), storing `/tmp` on the first discovered device. This behaviour, which only catered to very specific use cases and could not be disabled, has been removed. Users relying on this should provide their own implementation, and probably use ext4 and perform the mount in stage-2.
|
||||
|
||||
- `teleport` has been upgraded from major version 10 to major version 12. Please see upstream [upgrade instructions](https://goteleport.com/docs/setup/operations/upgrading/) and release notes for versions [11](https://goteleport.com/docs/changelog/#1100) and [12](https://goteleport.com/docs/changelog/#1201). Note that Teleport does not officially support upgrades across more than one major version at a time. If you're running Teleport server components, it is recommended to first upgrade to an intermediate 11.x version by setting `services.teleport.package = pkgs.teleport_11`. Afterwards, this option can be removed to upgrade to the default version (12).
|
||||
|
||||
- The EC2 image module previously detected and activated swap-formatted instance store devices and partitions in stage-1 (initramfs). This behaviour has been removed. Users relying on this should provide their own implementation.
|
||||
|
||||
- `gitlab` has been upgraded from major version 15 to major version 16 and requires at least PostgreSQL 13.6. Check the [upgrade guide](#module-services-postgres-upgrading) in the NixOS manual on how to upgrade your PostgreSQL installation.
|
||||
|
||||
- `gitlab` 16 deprecates the use of external container registries, in our case `pkgs.docker-distribution`. Module users who have [`services.gitlab.registry.enable`](#opt-services.gitlab.registry.enable) set to `true` are advised to back up their state and switch to gitlab's fork by setting [`services.gitlab.registry.package`](#opt-services.gitlab.registry.package) to `pkgs.gitlab-container-registry`.
|
||||
|
||||
- `fail2ban` has been updated to 1.0.2, which has a few breaking changes compared to 0.11.2 ([changelog for 1.0.1](https://github.com/fail2ban/fail2ban/blob/1.0.1/ChangeLog), [changelog for 1.0.2](https://github.com/fail2ban/fail2ban/blob/1.0.2/ChangeLog))
|
||||
|
||||
- `albert` has been updated from 0.17.6 to 0.20.13, and 0.18.0 changed the config format and many plugins ([changelog for 0.18.0](https://github.com/albertlauncher/albert/blob/v0.18.0/CHANGELOG.md))
|
||||
|
||||
- Calling `makeSetupHook` without passing a `name` argument is deprecated.
|
||||
|
||||
- Top-level buildPlatform,hostPlatform,targetPlatform have been deprecated, use stdenv.X instead.
|
||||
|
||||
- `lib.systems.examples.ghcjs` and consequently `pkgsCross.ghcjs` now use the target triplet `javascript-unknown-ghcjs` instead of `js-unknown-ghcjs`. This has been done to match an [upstream decision](https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c) to follow Cabal's platform naming more closely. Nixpkgs will also reject `js` as an architecture name.
|
||||
|
||||
- `dokuwiki` has been updated from 2023-07-31a (Igor) to 2023-04-04 (Jack Jackrum), which has [completely removed](https://www.dokuwiki.org/changes#release_2023-04-04_jack_jackrum) the options to embed HTML and PHP for security reasons. The [htmlok plugin](https://www.dokuwiki.org/plugin:htmlok) can be used to regain this functionality.
|
||||
|
||||
- The old unsupported version 6.x of the ELK-stack and Elastic beats have been removed. Use OpenSearch instead.
|
||||
@@ -290,6 +279,10 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- The [services.wordpress.sites.<name>.plugins](#opt-services.wordpress.sites._name_.plugins) and [services.wordpress.sites.<name>.themes](#opt-services.wordpress.sites._name_.themes) options have been converted from sets to attribute sets to allow for consumers to specify explicit install paths via attribute name.
|
||||
|
||||
- [`services.nextcloud.database.createLocally`](#opt-services.nextcloud.database.createLocally) now uses socket authentication and is no longer compatible with password authentication.
|
||||
- If you want the module to manage the database for you, unset [`services.nextcloud.config.dbpassFile`](#opt-services.nextcloud.config.dbpassFile) (and [`services.nextcloud.config.dbhost`](#opt-services.nextcloud.config.dbhost), if it's set).
|
||||
- If you want to use password authentication **and** create the database locally, you will have to use [`services.mysql`](#opt-services.mysql.enable) to set it up.
|
||||
|
||||
- `protonmail-bridge` package has been updated to major version 3.
|
||||
|
||||
- Nebula now runs as a system user and group created for each nebula network, using the `CAP_NET_ADMIN` ambient capability on launch rather than starting as root. Ensure that any files each Nebula instance needs to access are owned by the correct user and group, by default `nebula-${networkName}`.
|
||||
@@ -298,20 +291,26 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- In `mastodon` it is now necessary to specify location of file with `PostgreSQL` database password. In `services.mastodon.database.passwordFile` parameter default value `/var/lib/mastodon/secrets/db-password` has been changed to `null`.
|
||||
|
||||
- The `--target-host` and `--build-host` options of `nixos-rebuild` no longer treat the `localhost` value specially – to build on/deploy to local machine, omit the relevant flag.
|
||||
|
||||
- The `nix.readOnlyStore` option has been renamed to `boot.readOnlyNixStore` to clarify that it configures the NixOS boot process, not the Nix daemon.
|
||||
|
||||
- Deprecated `xlibsWrapper` transitional package has been removed in favour of direct use of its constituents: `xorg.libX11`, `freetype` and others.
|
||||
|
||||
- The latest available version of Nextcloud is v26 (available as `pkgs.nextcloud26`) which uses PHP 8.2 as interpreter by default. The installation logic is as follows:
|
||||
- If `system.stateVersion` is >=23.05, `pkgs.nextcloud26` will be installed by default.
|
||||
- If `system.stateVersion` is >=22.11, `pkgs.nextcloud25` will be installed by default.
|
||||
- Please note that an upgrade from v24 (or older) to v26 directly is not possible. Please upgrade to `nextcloud25` (or earlier) first. Nextcloud prohibits skipping major versions while upgrading. You can upgrade by declaring [`services.nextcloud.package = pkgs.nextcloud25;`](options.html#opt-services.nextcloud.package).
|
||||
- It's recommended to use the latest version available (i.e. v26) and to specify that using `services.nextcloud.package`.
|
||||
|
||||
- .NET 5.0 and .NET 3.1 were removed due to being end-of-life, use a newer, supported .NET version. Visit the [Support Policy](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) for more information.
|
||||
- .NET 5.0 and .NET 3.1 were removed due to being end-of-life, use a newer, supported .NET version - https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core
|
||||
|
||||
- The iputils package, which is installed by default, no longer provides the
|
||||
`ninfod`, `rarpd` and `rdisc` tools. See [upstream's release notes](https://github.com/iputils/iputils/releases/tag/20221126) for more details and available replacements.
|
||||
`ninfod`, `rarpd` and `rdisc` tools. See
|
||||
[upstream's release notes](https://github.com/iputils/iputils/releases/tag/20221126)
|
||||
for more details and available replacements.
|
||||
|
||||
- The ppp plugin `rp-pppoe.so` has been renamed to `pppoe.so` in ppp 2.4.9. Starting from ppp 2.5.0, there is no longer an alias for backwards compatibility. Configurations that use this plugin must be updated accordingly from `plugin rp-pppoe.so` to `plugin pppoe.so`. See [upstream change](https://github.com/ppp-project/ppp/commit/610a7bd76eb1f99f22317541b35001b1e24877ed).
|
||||
- The ppp plugin `rp-pppoe.so` has been renamed to `pppoe.so` in ppp 2.4.9. Starting from ppp 2.5.0, there is no longer a alias for backwards compatibility. Configurations that use this plugin must be updated accordingly from `plugin rp-pppoe.so` to `plugin pppoe.so`. See [upstream change](https://github.com/ppp-project/ppp/commit/610a7bd76eb1f99f22317541b35001b1e24877ed).
|
||||
|
||||
- [services.xserver.videoDrivers](options.html#opt-services.xserver.videoDrivers) now defaults to the `modesetting` driver over device-specific ones. The `radeon`, `amdgpu` and `nouveau` drivers are still available, but effectively unmaintained and not recommended for use.
|
||||
|
||||
@@ -321,7 +320,7 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- In `services.fail2ban`, `bantime-increment.<name>` options now default to `null` (except `bantime-increment.enable`) and are used to set the corresponding option in `jail.local` only if not `null`. Also, enforce that `bantime-increment.formula` and `bantime-increment.multipliers` are not both specified.
|
||||
|
||||
- The default `asterisk` package was changed to v20 from v19. Asterisk versions 16 and 19 have been dropped due to being EOL. You may need to update /var/lib/asterisk to match the template files in `${asterisk-20}/var/lib/asterisk`.
|
||||
- The default Asterisk package was changed to v20 from v19. Asterisk versions 16 and 19 have been dropped due to being EOL. You may need to update /var/lib/asterisk to match the template files in `${asterisk-20}/var/lib/asterisk`.
|
||||
|
||||
- conntrack helper autodetection has been removed from kernels 6.0 and up upstream, and an assertion was added to ensure things don't silently stop working. Migrate your configuration to assign helpers explicitly or use an older LTS kernel branch as a temporary workaround.
|
||||
|
||||
@@ -339,7 +338,7 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- The `qlandkartegt` and `garmindev` packages were removed due to being unmaintained and insecure.
|
||||
|
||||
- The `go-ethereum` package has been updated to v1.11.5 and the `puppeth` command is no longer available as of v1.11.0.
|
||||
- `go-ethereum` package has been updated to v1.11.5 and the `puppeth` command is no longer available as of v1.11.0.
|
||||
|
||||
- The `pnpm` package has be updated to from version 7.29.1 to version 8.1.1 and Node.js 14 support has been discontinued (though, there are workarounds if Node.js 14 is still required)
|
||||
- Migration instructions: ["Before updating pnpm to v8 in your CI, regenerate your pnpm-lock.yaml. To upgrade your lockfile, run pnpm install and commit the changes. Existing dependencies will not be updated; however, due to configuration changes in pnpm v8, some missing peer dependencies may be added to the lockfile and some packages may get deduplicated. You can commit the new lockfile even before upgrading Node.js in the CI, as pnpm v7 already supports the new lockfile format."](https://github.com/pnpm/pnpm/releases/tag/v8.0.0)
|
||||
@@ -348,21 +347,21 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- The `pict-rs` package was updated from an 0.3 alpha release to 0.3 stable, and related environment variables now require two underscores instead of one.
|
||||
|
||||
- The `shattered-pixel-dungeon` game was updated from 1.1.2 to 2.0.2.
|
||||
- The location of game data has changed. To migrate it, run `mv ~/.shatteredpixel ~/.local/share/.shatteredpixel`
|
||||
- The update will delete all your in-progress games.
|
||||
|
||||
- `espanso` has been updated to major version 2. Therefore, migration steps may need to be performed. See [the official migration instructions](https://espanso.org/docs/migration/overview/) for how to perform these migrations. Further, `espanso-wayland` can now be used for Wayland support.
|
||||
|
||||
- Only `k3s` version 1.26 is included. Users of the `k3s_1_24` or `k3s_1_25` packages should upgrade to use the `1.26` version of the package.
|
||||
|
||||
- The `nerdfonts` package has been updated to major version 3, which includes potential [breaking changes](https://github.com/ryanoasis/nerd-fonts/releases/tag/v3.0.0).
|
||||
|
||||
## Other Notable Changes {#sec-release-23.05-notable-changes}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- To follow [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md) a few options of `openssh` have been moved from `extraConfig` to the new freeform option `settings` and renamed, e.g.:
|
||||
- `vim_configurable` has been renamed to `vim-full` to avoid confusion: `vim-full`'s build-time features are configurable, but both `vim` and `vim-full` are _customizable_ (in the sense of user configuration, like vimrc).
|
||||
|
||||
- Pantheon now defaults to Mutter 43 and GNOME settings daemon 43, all Pantheon packages are now tracking elementary OS 7 updates.
|
||||
|
||||
- The module for the application firewall `opensnitch` got the ability to configure rules. Available as [services.opensnitch.rules](#opt-services.opensnitch.rules)
|
||||
|
||||
- The module `usbmuxd` now has the ability to change the package used by the daemon. In case you're experiencing issues with `usbmuxd` you can try an alternative program like `usbmuxd2`. Available as [services.usbmuxd.package](#opt-services.usbmuxd.package)
|
||||
|
||||
- A few openssh options have been moved from extraConfig to the new freeform option `settings` and renamed as follows:
|
||||
- `services.openssh.forwardX11` to `services.openssh.settings.X11Forwarding`
|
||||
- `services.openssh.kbdInteractiveAuthentication` -> `services.openssh.settings.KbdInteractiveAuthentication`
|
||||
- `services.openssh.passwordAuthentication` to `services.openssh.settings.PasswordAuthentication`
|
||||
@@ -374,21 +373,18 @@ In addition to numerous new and updated packages, this release has the following
|
||||
- `services.openssh.ciphers` to `services.openssh.settings.Ciphers`
|
||||
- `services.openssh.gatewayPorts` to `services.openssh.settings.GatewayPorts`
|
||||
|
||||
|
||||
- `vim_configurable` has been renamed to `vim-full` to avoid confusion: `vim-full`'s build-time features are configurable, but both `vim` and `vim-full` are _customizable_ (in the sense of user configuration, like vimrc).
|
||||
|
||||
- Pantheon now defaults to Mutter 43 and GNOME settings daemon 43, all Pantheon packages are now tracking elementary OS 7 updates.
|
||||
|
||||
- The module for the application firewall `opensnitch` got the ability to configure rules. Available as [services.opensnitch.rules](#opt-services.opensnitch.rules)
|
||||
|
||||
- The module `usbmuxd` now has the ability to change the package used by the daemon. In case you're experiencing issues with `usbmuxd` you can try an alternative program like `usbmuxd2`. Available as [services.usbmuxd.package](#opt-services.usbmuxd.package)
|
||||
|
||||
- `netbox` was updated to 3.5. NixOS' `services.netbox.package` still defaults to 3.3 if `stateVersion` is earlier than 23.05. Please review upstream's breaking changes [for 3.4.0](https://github.com/netbox-community/netbox/releases/tag/v3.4.0) and [for 3.5.0](https://github.com/netbox-community/netbox/releases/tag/v3.5.0), and upgrade NetBox by changing `services.netbox.package`. Database migrations will be run automatically.
|
||||
|
||||
- `services.netbox` now support RFC42-style options, through `services.netbox.settings`.
|
||||
|
||||
- `services.mastodon` gained a tootctl wrapped named `mastodon-tootctl` similar to `nextcloud-occ` which can be executed from any user and switches to the configured mastodon user with sudo and sources the environment variables.
|
||||
|
||||
- DocBook option documentation, which has been deprecated since 22.11, will now cause a warning when documentation is built. Out-of-tree modules should migrate to using CommonMark documentation as outlined in [](#sec-option-declarations) to silence this warning.
|
||||
|
||||
DocBook option documentation support will be removed in the next release and CommonMark will become the default. DocBook option documentation that has not been migrated until then will no longer render properly or cause errors.
|
||||
|
||||
- NixOS now defaults to using nsncd (a non-caching reimplementation in Rust) as NSS lookup dispatcher, instead of the buggy and deprecated glibc-provided nscd. If you need to switch back, set `services.nscd.enableNsncd = false`, but please open an issue in nixpkgs so your issue can be fixed.
|
||||
|
||||
- `services.borgmatic` now allows for multiple configurations, placed in `/etc/borgmatic.d/`, you can define them with `services.borgmatic.configurations`.
|
||||
|
||||
- `service.openafsServer` features a new backup server `pkgs.fabs` as a
|
||||
@@ -406,6 +402,8 @@ In addition to numerous new and updated packages, this release has the following
|
||||
`services.dnsmasq.extraConfig` will be deprecated when NixOS 22.11 reaches
|
||||
end of life.
|
||||
|
||||
- `kube3d` has now been renamed to `k3d` since the 3d editor that originally took that name has been dropped from nixpkgs. `kube3d` will continue to work as an alias for now.
|
||||
|
||||
- The `dokuwiki` service is now configured via `services.dokuwiki.sites.<name>.settings` attribute set; `extraConfig` has been removed.
|
||||
The `{aclUse,superUser,disableActions}` attributes have been renamed accordingly. `pluginsConfig` now only accepts an attribute set of booleans.
|
||||
Passing plain PHP is no longer possible.
|
||||
@@ -421,88 +419,106 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- The minimal ISO image now uses the `nixos/modules/profiles/minimal.nix` profile.
|
||||
|
||||
- NixOS installer ISOs can now be built for `powerpc64le-linux`; see `nixos/modules/installer/sd-card/sd-image-powerpc64le.nix` and [PR 192672](https://github.com/NixOS/nixpkgs/pull/192672). Hydra does not support this platform, so you must build the binaries yourself.
|
||||
|
||||
- The `ghcWithPackages` and `ghcWithHoogle` wrappers will now also symlink GHC's
|
||||
and all included libraries' documentation to `$out/share/doc` for convenience.
|
||||
If undesired, the old behavior can be restored by overriding the builders with
|
||||
`{ installDocumentation = false; }`.
|
||||
|
||||
- The nftables module now validates its ruleset at build time. The new `networking.nftables.checkRuleset` option allows disabling this check, which may fail when rules have very specific requirements, that the sandbox environment, by default, will not cover. The `networking.nftables.preCheckRuleset` option can be used to prepare the environment before the checks are run.
|
||||
- The new option `networking.nftables.checkRuleset` controls whether the ruleset is checked for syntax or not during build. It is `true` by default. The check might fail because it is in a sandbox environment. To circumvent this, the ruleset file can be edited using the `networking.nftables.preCheckRuleset` option.
|
||||
|
||||
- The `services.mastodon` module now supports connection to a remote `PostgreSQL` database.
|
||||
- `mastodon` now supports connection to a remote `PostgreSQL` database.
|
||||
|
||||
- [`services.nextcloud.database.createLocally`](#opt-services.nextcloud.database.createLocally) now uses socket authentication and is no longer compatible with password authentication.
|
||||
- If you want the module to manage the database for you, unset [`services.nextcloud.config.dbpassFile`](#opt-services.nextcloud.config.dbpassFile) (and [`services.nextcloud.config.dbhost`](#opt-services.nextcloud.config.dbhost), if it's set).
|
||||
- If you want to use password authentication **and** create the database locally, you will have to use [`services.mysql`](#opt-services.mysql.enable) to set it up.
|
||||
- `nextcloud` has an option to enable SSE-C in S3.
|
||||
|
||||
- [`services.nextcloud.config.objectstore.s3.sseCKeyFile`](#opt-services.nextcloud.config.objectstore.s3.sseCKeyFile) is a new option to enable server-side encryption with customer provided keys (SSE-C) for your S3 in Nextcloud.
|
||||
|
||||
- NixOS swap partitions with random encryption can now control the sector size, cipher, and key size used to set up the plain encryption device over the underlying block device rather than allowing them to be determined by `cryptsetup(8)`. One can use these features like so:
|
||||
- NixOS swap partitions with random encryption can now control the sector size, cipher, and key size used to setup the plain encryption device over the
|
||||
underlying block device rather than allowing them to be determined by `cryptsetup(8)`. One can use these features like so:
|
||||
|
||||
```nix
|
||||
swapDevices = [ {
|
||||
device = "/dev/disk/by-partlabel/swapspace";
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
cipher = "aes-xts-plain64";
|
||||
keySize = 512;
|
||||
sectorSize = 4096;
|
||||
};
|
||||
} ];
|
||||
{
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-partlabel/swapspace";
|
||||
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
cipher = "aes-xts-plain64";
|
||||
keySize = 512;
|
||||
sectorSize = 4096;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
- New option `security.pam.zfs` to enable unlocking and mounting of encrypted ZFS home dataset at login.
|
||||
|
||||
- `services.peertube` now requires you to specify the secret file `secrets.secretsFile`. It can be generated by running `openssl rand -hex 32`. Before upgrading, check the release notes for [PeerTube v5.0.0](https://github.com/Chocobozzz/PeerTube/releases/tag/v5.0.0).And backup your data.
|
||||
- `services.peertube` now requires you to specify the secret file `secrets.secretsFile`. It can be generated by running `openssl rand -hex 32`.
|
||||
Before upgrading, read the release notes for PeerTube:
|
||||
- [Release v5.0.0](https://github.com/Chocobozzz/PeerTube/releases/tag/v5.0.0)
|
||||
|
||||
And backup your data.
|
||||
|
||||
- `services.chronyd` is now started with additional systemd sandbox/hardening options for better security.
|
||||
|
||||
- PostgreSQL has added opt-in support for [JIT compilation](https://www.postgresql.org/docs/current/jit-reason.html). It can be enabled like this:
|
||||
- PostgreSQL has opt-in support for [JIT compilation](https://www.postgresql.org/docs/current/jit-reason.html). It can be enabled like this:
|
||||
```nix
|
||||
services.postgresql.enableJIT = true;
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
enableJIT = true;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
- `services.netdata` offers a [`services.netdata.deadlineBeforeStopSec`](#opt-services.netdata.deadlineBeforeStopSec) option which will control the deadline (in seconds) after which systemd will consider your netdata instance as dead if it didn't start in the elapsed time. It is helpful when your netdata instance takes longer to start because of a large amount of state or upgrades.
|
||||
- `services.netdata` offers a `deadlineBeforeStopSec` option which enable users who have netdata instance that takes time to initialize to not have systemd kill them for no reason.
|
||||
|
||||
- `services.dhcpcd` service stopped soliciting or accepting IPv6 Router Advertisements on interfaces that use static IPv6 addresses.
|
||||
If your network provides both IPv6 unique local addresses (ULA) and globally unique addresses (GUA) through autoconfiguration with SLAAC, you must add the parameter `networking.dhcpcd.IPv6rs = true;`.
|
||||
- `services.dhcpcd` service now don't solicit or accept IPv6 Router Advertisements on interfaces that use static IPv6 addresses.
|
||||
If network uses both IPv6 Unique local addresses (ULA) and global IPv6 address auto-configuration with SLAAC, must add the parameter `networking.dhcpcd.IPv6rs = true;`.
|
||||
|
||||
- The module `services.headscale` was refactored to be compliant with [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md). To be precise, this means that the following things have changed:
|
||||
|
||||
- Most settings have been migrated below [services.headscale.settings](#opt-services.headscale.settings) which is a freeform attribute-set that will be converted into headscale's YAML config format. This means that the configuration from [headscale's example configuration](https://github.com/juanfont/headscale/blob/main/config-example.yaml) can be directly written as attribute-set in Nix within this option.
|
||||
- Most settings has been migrated under [services.headscale.settings](#opt-services.headscale.settings) which is an attribute-set that
|
||||
will be converted into headscale's YAML config format. This means that the configuration from
|
||||
[headscale's example configuration](https://github.com/juanfont/headscale/blob/main/config-example.yaml)
|
||||
can be directly written as attribute-set in Nix within this option.
|
||||
|
||||
- `services.kubo` now unmounts `ipfsMountDir` and `ipnsMountDir` even if it is killed unexpectedly when `autoMount` is enabled.
|
||||
|
||||
- `services.grafana` listens only on localhost by default again. This was changed to the upstream default of `0.0.0.0` by accident in the freeform setting conversion.
|
||||
- `nixos/lib/make-disk-image.nix` can now mutate EFI variables, run user-provided EFI firmware or variable templates. This is now extensively documented in the NixOS manual.
|
||||
|
||||
- `services.grafana` listens only on localhost by default again. This was changed to upstreams default of `0.0.0.0` by accident in the freeform setting conversion.
|
||||
|
||||
- Grafana Tempo has been updated to version 2.0. See the [upstream upgrade guide](https://grafana.com/docs/tempo/latest/release-notes/v2-0/#upgrade-considerations) for migration instructions.
|
||||
|
||||
- A new `virtualisation.rosetta` module was added to allow running `x86_64` binaries through [Rosetta](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment) inside virtualised NixOS guests on Apple Silicon. This feature works by default with the [UTM](https://docs.getutm.app/) virtualisation [package](https://search.nixos.org/packages?channel=23.05&show=utm&from=0&size=1&sort=relevance&type=packages&query=utm).
|
||||
- A new `virtualisation.rosetta` module was added to allow running `x86_64` binaries through [Rosetta](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment) inside virtualised NixOS guests on Apple silicon. This feature works by default with the [UTM](https://docs.getutm.app/) virtualisation [package](https://search.nixos.org/packages?channel=unstable&show=utm&from=0&size=1&sort=relevance&type=packages&query=utm).
|
||||
|
||||
- The new option `users.motdFile` allows configuring a Message Of The Day that can be updated dynamically.
|
||||
|
||||
- The `root` package is now built with the `"-Dgnuinstall=ON"` CMake flag, making the output conform the `bin` `lib` `share` layout. In this layout, `tutorials` is under `share/doc/ROOT/`; `cmake`, `font`, `icons`, `js` and `macro` under `share/root`; `Makefile.comp` and `Makefile.config` under `etc/root`.
|
||||
|
||||
- There are various new options in the `services.nginx` module:
|
||||
- Enabling global redirect in `services.nginx.virtualHosts` now allows one to add exceptions with the `locations` option.
|
||||
- The `proxyCachePath` option has been added to `services.nginx`. It allows configuring the [`proxy_cache_path`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path), that configures the storage path and various other settings for the cache.
|
||||
- A new option `recommendedBrotliSettings` has been added to `services.nginx`. Learn more about compression in Brotli format [here](https://github.com/google/ngx_brotli/blob/master/README.md).
|
||||
- `services.nginx.recommendedProxySettings` now removes the `Connection` header preventing clients from closing backend connections.
|
||||
- Enabling global redirect in `services.nginx.virtualHosts` now allows one to add exceptions with the `locations` option.
|
||||
|
||||
- The nginx module also received an update to `services.nginx.recommendedGzipSettings`:
|
||||
- A new option `proxyCachePath` has been added to `services.nginx`. Learn more about proxy_cache_path: <https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path>.
|
||||
|
||||
- A new option `recommendedBrotliSettings` has been added to `services.nginx`. Learn more about compression in Brotli format [here](https://github.com/google/ngx_brotli/blob/master/README.md).
|
||||
|
||||
- Updated recommended settings in `services.nginx.recommendedGzipSettings`:
|
||||
- Enables gzip compression for only certain proxied requests.
|
||||
- Allow checking and loading of precompressed files.
|
||||
- Updated gzip mime-types.
|
||||
- Increased the minimum length of a response that will be gzipped.
|
||||
|
||||
- [Garage](https://garagehq.deuxfleurs.fr/) version is based on [system.stateVersion](options.html#opt-system.stateVersion), existing installations will keep using version 0.7. New installations will use version 0.8. In order to upgrade a Garage cluster, please follow [upstream instructions](https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/) and configure [services.garage.package](options.html#opt-services.garage.package).
|
||||
- [Garage](https://garagehq.deuxfleurs.fr/) version is based on [system.stateVersion](options.html#opt-system.stateVersion), existing installations will keep using version 0.7. New installations will use version 0.8. In order to upgrade a Garage cluster, please follow [upstream instructions](https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/) and force [services.garage.package](options.html#opt-services.garage.package) or upgrade accordingly [system.stateVersion](options.html#opt-system.stateVersion).
|
||||
|
||||
- Nebula now supports the `services.nebula.networks.<name>.isRelay` and `services.nebula.networks.<name>.relays` configuration options for setting up or allowing traffic relaying. See the [announcement](https://www.defined.net/blog/announcing-relay-support-in-nebula/) for more details about relays.
|
||||
|
||||
- `hip` has been separated into `hip`, `hip-common` and `hipcc`.
|
||||
|
||||
- `services.nginx.recommendedProxySettings` now removes the `Connection` header preventing clients from closing backend connections.
|
||||
|
||||
- Resilio sync secret keys can now be provided using a secrets file at runtime, preventing these secrets from ending up in the Nix store.
|
||||
|
||||
- The `firewall` and `nat` modules can now optionally rely on an nftables based implementation. Enable `networking.nftables` to use it.
|
||||
- The `firewall` and `nat` module now has a nftables based implementation. Enable `networking.nftables` to use it.
|
||||
|
||||
- The `services.fwupd` module now allows arbitrary daemon settings to be configured in a structured manner ([`services.fwupd.daemonSettings`](#opt-services.fwupd.daemonSettings)).
|
||||
|
||||
@@ -516,13 +532,19 @@ In addition to numerous new and updated packages, this release has the following
|
||||
* `apptainer`: From `github.com/apptainer/apptainer`, which is the new repo after renaming.
|
||||
* `singularity`: From `github.com/sylabs/singularity`, which is the fork by Sylabs Inc..
|
||||
|
||||
`programs.singularity` got a new `package` option to specify which package to use.
|
||||
|
||||
`singularity-tools.buildImage` got a new input argument `singularity` to specify which package to use.
|
||||
|
||||
- The new option `programs.singularity.enableFakeroot`, if set to `true`, provides `--fakeroot` support for `apptainer` and `singularity`.
|
||||
|
||||
- The `unifi-poller` package and corresponding NixOS module have been renamed to `unpoller` to match upstream.
|
||||
|
||||
- The `rtsp-simple-server` package and corresponding NixOS module have been renamed to `mediamtx` to match upstream.
|
||||
|
||||
- The new option `services.tailscale.useRoutingFeatures` controls various settings for using Tailscale features like exit nodes and subnet routers. If you wish to use your machine as an exit node, you can set this setting to `server`, otherwise if you wish to use an exit node you can set this setting to `client`. The strict RPF warning has been removed as the RPF will be loosened automatically based on the value of this setting.
|
||||
|
||||
- `openjdk` from versioggn 11 and above is not build with `openjfx` (i.e.: JavaFX) support by default anymore. You can re-enable it by overriding, e.g.: `openjdk11.override { enableJavaFX = true; };`.
|
||||
- `openjdk` from version 11 and above is not build with `openjfx` (i.e.: JavaFX) support by default anymore. You can re-enable it by overriding, e.g.: `openjdk11.override { enableJavaFX = true; };`.
|
||||
|
||||
- [Xastir](https://xastir.org/index.php/Main_Page) can now access AX.25 interfaces via the `libax25` package.
|
||||
|
||||
@@ -532,49 +554,22 @@ In addition to numerous new and updated packages, this release has the following
|
||||
|
||||
- The option `services.prometheus.exporters.pihole.interval` does not exist anymore and has been removed.
|
||||
|
||||
- The option `services.gpsd.device` has been replaced with `services.gpsd.devices`, which supports multiple devices.
|
||||
- The option `services.gpsd.device` has been replaced with
|
||||
`services.gpsd.devices`, which supports multiple devices.
|
||||
|
||||
- `k3s` can now be configured with an `EnvironmentFile` for its systemd service, allowing secrets to be provided without ending up in the Nix Store.
|
||||
- `k3s` can now be configured with an EnvironmentFile for its systemd service, allowing secrets to be provided without ending up in the Nix Store.
|
||||
|
||||
- The `gitea` module options have been moved into a freeform attribute set below `services.gitea.settings`.
|
||||
- `gitea` module options have been changed to be RFC042 conforming (i.e. some options were moved to be located under `services.gitea.settings`)
|
||||
|
||||
- `boot.initrd.luks.device.<name>` has a new `tryEmptyPassphrase` option, this is useful for OEMs who need to install an encrypted disk with a future settable passphrase
|
||||
|
||||
- The `bind` module now allows the per-zone `allow-query` setting to be configured (previously it was hard-coded to `any`; it still defaults to `any` to retain compatibility).
|
||||
|
||||
- The option `services.jitsi-videobridge.apis` has been renamed to `colibriRestApi` and turned into a boolean. Setting it to `true` will enable the private rest API, useful for monitoring using `services.prometheus.exporters.jitsi.enable`. Learn more about the API: "[The COLIBRI control interface (/colibri/)](https://github.com/jitsi/jitsi-videobridge/blob/v2.3/doc/rest.md)".
|
||||
|
||||
- Booting from a volume managed by the Stratis storage management daemon is now supported. Use `fileSystems.<name>.stratis.poolUuid` to configure the pool containing the fs.
|
||||
|
||||
## Nixpkgs internals {#sec-release-23.05-nixpkgs-internals}
|
||||
|
||||
- `buildDunePackage` now defaults to `strictDeps = true` which means that any library should go into `buildInputs` or `checkInputs`. Any executable that is run on the building machine should go into `nativeBuildInputs` or `nativeCheckInputs` respectively. Example of executables are `ocaml`, `findlib` and `menhir`. PPXs are libraries which are built by dune and should therefore not go into `nativeBuildInputs`.
|
||||
|
||||
- `buildFHSUserEnv` is now called `buildFHSEnv` and uses FlatPak's Bubblewrap sandboxing tool rather than Nixpkgs' own chrootenv. The old chrootenv-based implemenation is still available via `buildFHSEnvChrootenv` but is considered deprecated and will be removed when the remaining uses inside Nixpkgs have been migrated. If your FHSEnv-wrapped application misbehaves when using the new bubblewrap implementation, please create an issue in Nixpkgs.
|
||||
|
||||
- Top-level `buildPlatform`, `hostPlatform`, `targetPlatform` have been deprecated, use `stdenv.X` instead.
|
||||
|
||||
- `carnix` and `cratesIO` has been removed due to being unmaintained, use alternatives such as [naersk](https://github.com/nix-community/naersk) and [crate2nix](https://github.com/kolloch/crate2nix) instead.
|
||||
|
||||
- `checkInputs` have been renamed to `nativeCheckInputs`, because they behave the same as `nativeBuildInputs` when `doCheck` is set. `checkInputs` now denote a new type of dependencies, added to `buildInputs` when `doCheck` is set. As a rule of thumb, `nativeCheckInputs` are tools on `$PATH` used during the tests, and `checkInputs` are libraries which are linked to executables built as part of the tests. Similarly, `installCheckInputs` are renamed to `nativeInstallCheckInputs`, corresponding to `nativeBuildInputs`, and `installCheckInputs` are a new type of dependencies added to `buildInputs` when `doInstallCheck` is set. (Note that this change will not cause breakage to derivations with `strictDeps` unset, which are most packages except python, rust, ocaml and go packages).
|
||||
|
||||
- DocBook option documentation, which has been deprecated since 22.11, will now cause a warning when documentation is built. Out-of-tree modules should migrate to using CommonMark documentation as outlined in [](#sec-option-declarations) to silence this warning.
|
||||
|
||||
DocBook option documentation support will be removed in the next release and CommonMark will become the default. DocBook option documentation that has not been migrated until then will no longer render properly or cause errors.
|
||||
|
||||
- `lib.systems.examples.ghcjs` and consequently `pkgsCross.ghcjs` now use the target triplet `javascript-unknown-ghcjs` instead of `js-unknown-ghcjs`. This has been done to match an [upstream decision](https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c) to follow Cabal's platform naming more closely. Nixpkgs will also reject `js` as an architecture name.
|
||||
- `boot.initrd.luks.device.<name>` has a new `tryEmptyPassphrase` option, this is useful for OEM's who need to install an encrypted disk with a future settable passphrase
|
||||
|
||||
- Lisp gained a [manual section](https://nixos.org/manual/nixpkgs/stable/#lisp), documenting a new and backwards incompatible interface. The previous interface will be removed in a future release.
|
||||
|
||||
- Calling `makeSetupHook` without passing a `name` argument is deprecated.
|
||||
- The `bind` module now allows the per-zone `allow-query` setting to be configured (previously it was hard-coded to `any`; it still defaults to `any` to retain compatibility).
|
||||
|
||||
- `nixos/lib/make-disk-image.nix` handles `contents` arguments that are directories better, fixing a bug where it used to put them in a subdirectory of the intended `target`.
|
||||
- `make-disk-image` handles `contents` arguments that are directories better, fixing a bug where it used to put them in a subdirectory of the intended `target`.
|
||||
|
||||
- `nixos/lib/make-disk-image.nix` can now mutate EFI variables, run user-provided EFI firmware or variable templates. This is now extensively documented in the NixOS manual.
|
||||
|
||||
- Nixpkgs now uses [IEEE-standard floating point arithmetic](https://github.com/NixOS/nixpkgs/pull/170215) on `powerpc64le-linux`.
|
||||
|
||||
- Deprecated `xlibsWrapper` transitional package has been removed in favour of direct use of its constituents: `xorg.libX11`, `freetype` and others.
|
||||
- The option `services.jitsi-videobridge.apis` has been renamed to `colibriRestApi` and turned into a boolean. Setting it to `true` will enable the private rest API, useful for monitoring using `services.prometheus.exporters.jitsi.enable`. Learn more about the API: "[The COLIBRI control interface (/colibri/)](https://github.com/jitsi/jitsi-videobridge/blob/v2.3/doc/rest.md)".
|
||||
|
||||
## Detailed migration information {#sec-release-23.05-migration}
|
||||
|
||||
|
||||
12
nixos/doc/manual/release-notes/rl-2311.section.md
Normal file
12
nixos/doc/manual/release-notes/rl-2311.section.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Release 23.11 (“Tapir”, 2023.11/??) {#sec-release-23.11}
|
||||
|
||||
## Highlights {#sec-release-23.11-highlights}
|
||||
|
||||
## New Services {#sec-release-23.11-new-services}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
## Backward Incompatibilities {#sec-release-23.11-incompatibilities}
|
||||
|
||||
## Other Notable Changes {#sec-release-23.11-notable-changes}
|
||||
|
||||
@@ -163,6 +163,11 @@ class Driver:
|
||||
machine.wait_for_shutdown()
|
||||
|
||||
def create_machine(self, args: Dict[str, Any]) -> Machine:
|
||||
rootlog.warning(
|
||||
"Using legacy create_machine(), please instantiate the"
|
||||
"Machine class directly, instead"
|
||||
)
|
||||
|
||||
tmp_dir = get_tmp_dir()
|
||||
|
||||
if args.get("startCommand"):
|
||||
|
||||
@@ -369,8 +369,8 @@ class Machine:
|
||||
@staticmethod
|
||||
def create_startcommand(args: Dict[str, str]) -> StartCommand:
|
||||
rootlog.warning(
|
||||
"Using legacy create_startcommand(), "
|
||||
"please use proper nix test vm instrumentation, instead "
|
||||
"Using legacy create_startcommand(),"
|
||||
"please use proper nix test vm instrumentation, instead"
|
||||
"to generate the appropriate nixos test vm qemu startup script"
|
||||
)
|
||||
hda = None
|
||||
@@ -514,11 +514,7 @@ class Machine:
|
||||
return "".join(output_buffer)
|
||||
|
||||
def execute(
|
||||
self,
|
||||
command: str,
|
||||
check_return: bool = True,
|
||||
check_output: bool = True,
|
||||
timeout: Optional[int] = 900,
|
||||
self, command: str, check_return: bool = True, timeout: Optional[int] = 900
|
||||
) -> Tuple[int, str]:
|
||||
self.run_callbacks()
|
||||
self.connect()
|
||||
@@ -539,9 +535,6 @@ class Machine:
|
||||
assert self.shell
|
||||
self.shell.send(out_command.encode())
|
||||
|
||||
if not check_output:
|
||||
return (-2, "")
|
||||
|
||||
# Get the output
|
||||
output = base64.b64decode(self._next_newline_closed_block_from_shell())
|
||||
|
||||
@@ -862,37 +855,21 @@ class Machine:
|
||||
with self.nested(f"waiting for {regex} to appear on screen"):
|
||||
retry(screen_matches)
|
||||
|
||||
def wait_for_console_text(self, regex: str, timeout: int | None = None) -> None:
|
||||
"""
|
||||
Wait for the provided regex to appear on console.
|
||||
For each reads,
|
||||
|
||||
If timeout is None, timeout is infinite.
|
||||
|
||||
`timeout` is in seconds.
|
||||
"""
|
||||
# Buffer the console output, this is needed
|
||||
# to match multiline regexes.
|
||||
console = io.StringIO()
|
||||
|
||||
def console_matches(_: Any) -> bool:
|
||||
nonlocal console
|
||||
try:
|
||||
# This will return as soon as possible and
|
||||
# sleep 1 second.
|
||||
console.write(self.last_lines.get(block=False))
|
||||
except queue.Empty:
|
||||
pass
|
||||
console.seek(0)
|
||||
matches = re.search(regex, console.read())
|
||||
return matches is not None
|
||||
|
||||
def wait_for_console_text(self, regex: str) -> None:
|
||||
with self.nested(f"waiting for {regex} to appear on console"):
|
||||
if timeout is not None:
|
||||
retry(console_matches, timeout)
|
||||
else:
|
||||
while not console_matches(False):
|
||||
pass
|
||||
# Buffer the console output, this is needed
|
||||
# to match multiline regexes.
|
||||
console = io.StringIO()
|
||||
while True:
|
||||
try:
|
||||
console.write(self.last_lines.get())
|
||||
except queue.Empty:
|
||||
self.sleep(1)
|
||||
continue
|
||||
console.seek(0)
|
||||
matches = re.search(regex, console.read())
|
||||
if matches is not None:
|
||||
return
|
||||
|
||||
def send_key(
|
||||
self, key: str, delay: Optional[float] = 0.01, log: Optional[bool] = True
|
||||
|
||||
@@ -66,7 +66,6 @@ with lib;
|
||||
(builtins.map (l: (replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] l) + "/UTF-8") (
|
||||
[
|
||||
"C.UTF-8"
|
||||
"en_US.UTF-8"
|
||||
config.i18n.defaultLocale
|
||||
] ++ (attrValues (filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings))
|
||||
))
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
Manages the things that are needed for a traditional nix-channel based
|
||||
configuration to work.
|
||||
|
||||
See also
|
||||
- ./nix.nix
|
||||
- ./nix-flakes.nix
|
||||
*/
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkDefault
|
||||
mkIf
|
||||
mkOption
|
||||
stringAfter
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.nix;
|
||||
|
||||
in
|
||||
{
|
||||
options = {
|
||||
nix = {
|
||||
channel = {
|
||||
enable = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Whether the `nix-channel` command and state files are made available on the machine.
|
||||
|
||||
The following files are initialized when enabled:
|
||||
- `/nix/var/nix/profiles/per-user/root/channels`
|
||||
- `/root/.nix-channels`
|
||||
- `$HOME/.nix-defexpr/channels` (on login)
|
||||
|
||||
Disabling this option will not remove the state files from the system.
|
||||
'';
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
nixPath = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default =
|
||||
if cfg.channel.enable
|
||||
then [
|
||||
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
|
||||
"nixos-config=/etc/nixos/configuration.nix"
|
||||
"/nix/var/nix/profiles/per-user/root/channels"
|
||||
]
|
||||
else [ ];
|
||||
defaultText = ''
|
||||
if nix.channel.enable
|
||||
then [
|
||||
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
|
||||
"nixos-config=/etc/nixos/configuration.nix"
|
||||
"/nix/var/nix/profiles/per-user/root/channels"
|
||||
]
|
||||
else [];
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
The default Nix expression search path, used by the Nix
|
||||
evaluator to look up paths enclosed in angle brackets
|
||||
(e.g. `<nixpkgs>`).
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
system = {
|
||||
defaultChannel = mkOption {
|
||||
internal = true;
|
||||
type = types.str;
|
||||
default = "https://nixos.org/channels/nixos-23.05";
|
||||
description = lib.mdDoc "Default NixOS channel to which the root user is subscribed.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.extraInit =
|
||||
mkIf cfg.channel.enable ''
|
||||
if [ -e "$HOME/.nix-defexpr/channels" ]; then
|
||||
export NIX_PATH="$HOME/.nix-defexpr/channels''${NIX_PATH:+:$NIX_PATH}"
|
||||
fi
|
||||
'';
|
||||
|
||||
environment.extraSetup = mkIf (!cfg.channel.enable) ''
|
||||
rm --force $out/bin/nix-channel
|
||||
'';
|
||||
|
||||
# NIX_PATH has a non-empty default according to Nix docs, so we don't unset
|
||||
# it when empty.
|
||||
environment.sessionVariables = {
|
||||
NIX_PATH = cfg.nixPath;
|
||||
};
|
||||
|
||||
nix.settings.nix-path = mkIf (! cfg.channel.enable) (mkDefault "");
|
||||
|
||||
system.activationScripts.nix-channel = mkIf cfg.channel.enable
|
||||
(stringAfter [ "etc" "users" ] ''
|
||||
# Subscribe the root user to the NixOS channel by default.
|
||||
if [ ! -e "/root/.nix-channels" ]; then
|
||||
echo "${config.system.defaultChannel} nixos" > "/root/.nix-channels"
|
||||
fi
|
||||
'');
|
||||
};
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
Manages the flake registry.
|
||||
|
||||
See also
|
||||
- ./nix.nix
|
||||
- ./nix-channel.nix
|
||||
*/
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
literalExpression
|
||||
mapAttrsToList
|
||||
mkDefault
|
||||
mkIf
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.nix;
|
||||
|
||||
in
|
||||
{
|
||||
options = {
|
||||
nix = {
|
||||
registry = mkOption {
|
||||
type = types.attrsOf (types.submodule (
|
||||
let
|
||||
referenceAttrs = with types; attrsOf (oneOf [
|
||||
str
|
||||
int
|
||||
bool
|
||||
path
|
||||
package
|
||||
]);
|
||||
in
|
||||
{ config, name, ... }:
|
||||
{
|
||||
options = {
|
||||
from = mkOption {
|
||||
type = referenceAttrs;
|
||||
example = { type = "indirect"; id = "nixpkgs"; };
|
||||
description = lib.mdDoc "The flake reference to be rewritten.";
|
||||
};
|
||||
to = mkOption {
|
||||
type = referenceAttrs;
|
||||
example = { type = "github"; owner = "my-org"; repo = "my-nixpkgs"; };
|
||||
description = lib.mdDoc "The flake reference {option}`from` is rewritten to.";
|
||||
};
|
||||
flake = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
example = literalExpression "nixpkgs";
|
||||
description = lib.mdDoc ''
|
||||
The flake input {option}`from` is rewritten to.
|
||||
'';
|
||||
};
|
||||
exact = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
Whether the {option}`from` reference needs to match exactly. If set,
|
||||
a {option}`from` reference like `nixpkgs` does not
|
||||
match with a reference like `nixpkgs/nixos-20.03`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
from = mkDefault { type = "indirect"; id = name; };
|
||||
to = mkIf (config.flake != null) (mkDefault (
|
||||
{
|
||||
type = "path";
|
||||
path = config.flake.outPath;
|
||||
} // filterAttrs
|
||||
(n: _: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash")
|
||||
config.flake
|
||||
));
|
||||
};
|
||||
}
|
||||
));
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
A system-wide flake registry.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.etc."nix/registry.json".text = builtins.toJSON {
|
||||
version = 2;
|
||||
flakes = mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
/*
|
||||
Manages the remote build configuration, /etc/nix/machines
|
||||
|
||||
See also
|
||||
- ./nix.nix
|
||||
- nixos/modules/services/system/nix-daemon.nix
|
||||
*/
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
any
|
||||
concatMapStrings
|
||||
concatStringsSep
|
||||
filter
|
||||
getVersion
|
||||
mkIf
|
||||
mkMerge
|
||||
mkOption
|
||||
optional
|
||||
optionalString
|
||||
types
|
||||
versionAtLeast
|
||||
;
|
||||
|
||||
cfg = config.nix;
|
||||
|
||||
nixPackage = cfg.package.out;
|
||||
|
||||
isNixAtLeast = versionAtLeast (getVersion nixPackage);
|
||||
|
||||
buildMachinesText =
|
||||
concatMapStrings
|
||||
(machine:
|
||||
(concatStringsSep " " ([
|
||||
"${optionalString (machine.protocol != null) "${machine.protocol}://"}${optionalString (machine.sshUser != null) "${machine.sshUser}@"}${machine.hostName}"
|
||||
(if machine.system != null then machine.system else if machine.systems != [ ] then concatStringsSep "," machine.systems else "-")
|
||||
(if machine.sshKey != null then machine.sshKey else "-")
|
||||
(toString machine.maxJobs)
|
||||
(toString machine.speedFactor)
|
||||
(let res = (machine.supportedFeatures ++ machine.mandatoryFeatures);
|
||||
in if (res == []) then "-" else (concatStringsSep "," res))
|
||||
(let res = machine.mandatoryFeatures;
|
||||
in if (res == []) then "-" else (concatStringsSep "," machine.mandatoryFeatures))
|
||||
]
|
||||
++ optional (isNixAtLeast "2.4pre") (if machine.publicHostKey != null then machine.publicHostKey else "-")))
|
||||
+ "\n"
|
||||
)
|
||||
cfg.buildMachines;
|
||||
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./nix.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
nix = {
|
||||
buildMachines = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
options = {
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
example = "nixbuilder.example.org";
|
||||
description = lib.mdDoc ''
|
||||
The hostname of the build machine.
|
||||
'';
|
||||
};
|
||||
protocol = mkOption {
|
||||
type = types.enum [ null "ssh" "ssh-ng" ];
|
||||
default = "ssh";
|
||||
example = "ssh-ng";
|
||||
description = lib.mdDoc ''
|
||||
The protocol used for communicating with the build machine.
|
||||
Use `ssh-ng` if your remote builder and your
|
||||
local Nix version support that improved protocol.
|
||||
|
||||
Use `null` when trying to change the special localhost builder
|
||||
without a protocol which is for example used by hydra.
|
||||
'';
|
||||
};
|
||||
system = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "x86_64-linux";
|
||||
description = lib.mdDoc ''
|
||||
The system type the build machine can execute derivations on.
|
||||
Either this attribute or {var}`systems` must be
|
||||
present, where {var}`system` takes precedence if
|
||||
both are set.
|
||||
'';
|
||||
};
|
||||
systems = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "x86_64-linux" "aarch64-linux" ];
|
||||
description = lib.mdDoc ''
|
||||
The system types the build machine can execute derivations on.
|
||||
Either this attribute or {var}`system` must be
|
||||
present, where {var}`system` takes precedence if
|
||||
both are set.
|
||||
'';
|
||||
};
|
||||
sshUser = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "builder";
|
||||
description = lib.mdDoc ''
|
||||
The username to log in as on the remote host. This user must be
|
||||
able to log in and run nix commands non-interactively. It must
|
||||
also be privileged to build derivations, so must be included in
|
||||
{option}`nix.settings.trusted-users`.
|
||||
'';
|
||||
};
|
||||
sshKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "/root/.ssh/id_buildhost_builduser";
|
||||
description = lib.mdDoc ''
|
||||
The path to the SSH private key with which to authenticate on
|
||||
the build machine. The private key must not have a passphrase.
|
||||
If null, the building user (root on NixOS machines) must have an
|
||||
appropriate ssh configuration to log in non-interactively.
|
||||
|
||||
Note that for security reasons, this path must point to a file
|
||||
in the local filesystem, *not* to the nix store.
|
||||
'';
|
||||
};
|
||||
maxJobs = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = lib.mdDoc ''
|
||||
The number of concurrent jobs the build machine supports. The
|
||||
build machine will enforce its own limits, but this allows hydra
|
||||
to schedule better since there is no work-stealing between build
|
||||
machines.
|
||||
'';
|
||||
};
|
||||
speedFactor = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = lib.mdDoc ''
|
||||
The relative speed of this builder. This is an arbitrary integer
|
||||
that indicates the speed of this builder, relative to other
|
||||
builders. Higher is faster.
|
||||
'';
|
||||
};
|
||||
mandatoryFeatures = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "big-parallel" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of features mandatory for this builder. The builder will
|
||||
be ignored for derivations that don't require all features in
|
||||
this list. All mandatory features are automatically included in
|
||||
{var}`supportedFeatures`.
|
||||
'';
|
||||
};
|
||||
supportedFeatures = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "kvm" "big-parallel" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of features supported by this builder. The builder will
|
||||
be ignored for derivations that require features not in this
|
||||
list.
|
||||
'';
|
||||
};
|
||||
publicHostKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
The (base64-encoded) public host key of this builder. The field
|
||||
is calculated via {command}`base64 -w0 /etc/ssh/ssh_host_type_key.pub`.
|
||||
If null, SSH will use its regular known-hosts file when connecting.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [ ];
|
||||
description = lib.mdDoc ''
|
||||
This option lists the machines to be used if distributed builds are
|
||||
enabled (see {option}`nix.distributedBuilds`).
|
||||
Nix will perform derivations on those machines via SSH by copying the
|
||||
inputs to the Nix store on the remote machine, starting the build,
|
||||
then copying the output back to the local Nix store.
|
||||
'';
|
||||
};
|
||||
|
||||
distributedBuilds = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Whether to distribute builds to the machines listed in
|
||||
{option}`nix.buildMachines`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# distributedBuilds does *not* inhibit /etc/machines generation; caller may
|
||||
# override that nix option.
|
||||
config = mkIf cfg.enable {
|
||||
assertions =
|
||||
let badMachine = m: m.system == null && m.systems == [ ];
|
||||
in
|
||||
[
|
||||
{
|
||||
assertion = !(any badMachine cfg.buildMachines);
|
||||
message = ''
|
||||
At least one system type (via <varname>system</varname> or
|
||||
<varname>systems</varname>) must be set for every build machine.
|
||||
Invalid machine specifications:
|
||||
'' + " " +
|
||||
(concatStringsSep "\n "
|
||||
(map (m: m.hostName)
|
||||
(filter (badMachine) cfg.buildMachines)));
|
||||
}
|
||||
];
|
||||
|
||||
# List of machines for distributed Nix builds
|
||||
environment.etc."nix/machines" =
|
||||
mkIf (cfg.buildMachines != [ ]) {
|
||||
text = buildMachinesText;
|
||||
};
|
||||
|
||||
# Legacy configuration conversion.
|
||||
nix.settings = mkIf (!cfg.distributedBuilds) { builders = null; };
|
||||
};
|
||||
}
|
||||
@@ -1,383 +0,0 @@
|
||||
/*
|
||||
Manages /etc/nix.conf.
|
||||
|
||||
See also
|
||||
- ./nix-channel.nix
|
||||
- ./nix-flakes.nix
|
||||
- ./nix-remote-build.nix
|
||||
- nixos/modules/services/system/nix-daemon.nix
|
||||
*/
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
concatStringsSep
|
||||
boolToString
|
||||
escape
|
||||
floatToString
|
||||
getVersion
|
||||
isBool
|
||||
isDerivation
|
||||
isFloat
|
||||
isInt
|
||||
isList
|
||||
isString
|
||||
literalExpression
|
||||
mapAttrsToList
|
||||
mkAfter
|
||||
mkDefault
|
||||
mkIf
|
||||
mkOption
|
||||
mkRenamedOptionModuleWith
|
||||
optionalString
|
||||
optionals
|
||||
strings
|
||||
systems
|
||||
toPretty
|
||||
types
|
||||
versionAtLeast
|
||||
;
|
||||
|
||||
cfg = config.nix;
|
||||
|
||||
nixPackage = cfg.package.out;
|
||||
|
||||
isNixAtLeast = versionAtLeast (getVersion nixPackage);
|
||||
|
||||
legacyConfMappings = {
|
||||
useSandbox = "sandbox";
|
||||
buildCores = "cores";
|
||||
maxJobs = "max-jobs";
|
||||
sandboxPaths = "extra-sandbox-paths";
|
||||
binaryCaches = "substituters";
|
||||
trustedBinaryCaches = "trusted-substituters";
|
||||
binaryCachePublicKeys = "trusted-public-keys";
|
||||
autoOptimiseStore = "auto-optimise-store";
|
||||
requireSignedBinaryCaches = "require-sigs";
|
||||
trustedUsers = "trusted-users";
|
||||
allowedUsers = "allowed-users";
|
||||
systemFeatures = "system-features";
|
||||
};
|
||||
|
||||
semanticConfType = with types;
|
||||
let
|
||||
confAtom = nullOr
|
||||
(oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
path
|
||||
package
|
||||
]) // {
|
||||
description = "Nix config atom (null, bool, int, float, str, path or package)";
|
||||
};
|
||||
in
|
||||
attrsOf (either confAtom (listOf confAtom));
|
||||
|
||||
nixConf =
|
||||
assert isNixAtLeast "2.2";
|
||||
let
|
||||
|
||||
mkValueString = v:
|
||||
if v == null then ""
|
||||
else if isInt v then toString v
|
||||
else if isBool v then boolToString v
|
||||
else if isFloat v then floatToString v
|
||||
else if isList v then toString v
|
||||
else if isDerivation v then toString v
|
||||
else if builtins.isPath v then toString v
|
||||
else if isString v then v
|
||||
else if strings.isConvertibleWithToString v then toString v
|
||||
else abort "The nix conf value: ${toPretty {} v} can not be encoded";
|
||||
|
||||
mkKeyValue = k: v: "${escape [ "=" ] k} = ${mkValueString v}";
|
||||
|
||||
mkKeyValuePairs = attrs: concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs);
|
||||
|
||||
in
|
||||
pkgs.writeTextFile {
|
||||
name = "nix.conf";
|
||||
text = ''
|
||||
# WARNING: this file is generated from the nix.* options in
|
||||
# your NixOS configuration, typically
|
||||
# /etc/nixos/configuration.nix. Do not edit it!
|
||||
${mkKeyValuePairs cfg.settings}
|
||||
${cfg.extraOptions}
|
||||
'';
|
||||
checkPhase = lib.optionalString cfg.checkConfig (
|
||||
if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then ''
|
||||
echo "Ignoring validation for cross-compilation"
|
||||
''
|
||||
else
|
||||
let
|
||||
showCommand = if isNixAtLeast "2.20pre" then "config show" else "show-config";
|
||||
in
|
||||
''
|
||||
echo "Validating generated nix.conf"
|
||||
ln -s $out ./nix.conf
|
||||
set -e
|
||||
set +o pipefail
|
||||
NIX_CONF_DIR=$PWD \
|
||||
${cfg.package}/bin/nix ${showCommand} ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \
|
||||
${optionalString (isNixAtLeast "2.4pre") "--option experimental-features nix-command"} \
|
||||
|& sed -e 's/^warning:/error:/' \
|
||||
| (! grep '${if cfg.checkAllErrors then "^error:" else "^error: unknown setting"}')
|
||||
set -o pipefail
|
||||
'');
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(mkRenamedOptionModuleWith { sinceRelease = 2003; from = [ "nix" "useChroot" ]; to = [ "nix" "useSandbox" ]; })
|
||||
(mkRenamedOptionModuleWith { sinceRelease = 2003; from = [ "nix" "chrootDirs" ]; to = [ "nix" "sandboxPaths" ]; })
|
||||
] ++
|
||||
mapAttrsToList
|
||||
(oldConf: newConf:
|
||||
mkRenamedOptionModuleWith {
|
||||
sinceRelease = 2205;
|
||||
from = [ "nix" oldConf ];
|
||||
to = [ "nix" "settings" newConf ];
|
||||
})
|
||||
legacyConfMappings;
|
||||
|
||||
options = {
|
||||
nix = {
|
||||
checkConfig = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If enabled, checks that Nix can parse the generated nix.conf.
|
||||
'';
|
||||
};
|
||||
|
||||
checkAllErrors = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If enabled, checks the nix.conf parsing for any kind of error. When disabled, checks only for unknown settings.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
description = lib.mdDoc "Additional text appended to {file}`nix.conf`.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = semanticConfType;
|
||||
|
||||
options = {
|
||||
max-jobs = mkOption {
|
||||
type = types.either types.int (types.enum [ "auto" ]);
|
||||
default = "auto";
|
||||
example = 64;
|
||||
description = lib.mdDoc ''
|
||||
This option defines the maximum number of jobs that Nix will try to
|
||||
build in parallel. The default is auto, which means it will use all
|
||||
available logical cores. It is recommend to set it to the total
|
||||
number of logical cores in your system (e.g., 16 for two CPUs with 4
|
||||
cores each and hyper-threading).
|
||||
'';
|
||||
};
|
||||
|
||||
auto-optimise-store = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = lib.mdDoc ''
|
||||
If set to true, Nix automatically detects files in the store that have
|
||||
identical contents, and replaces them with hard links to a single copy.
|
||||
This saves disk space. If set to false (the default), you can still run
|
||||
nix-store --optimise to get rid of duplicate files.
|
||||
'';
|
||||
};
|
||||
|
||||
cores = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
example = 64;
|
||||
description = lib.mdDoc ''
|
||||
This option defines the maximum number of concurrent tasks during
|
||||
one build. It affects, e.g., -j option for make.
|
||||
The special value 0 means that the builder should use all
|
||||
available CPU cores in the system. Some builds may become
|
||||
non-deterministic with this option; use with care! Packages will
|
||||
only be affected if enableParallelBuilding is set for them.
|
||||
'';
|
||||
};
|
||||
|
||||
sandbox = mkOption {
|
||||
type = types.either types.bool (types.enum [ "relaxed" ]);
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If set, Nix will perform builds in a sandboxed environment that it
|
||||
will set up automatically for each build. This prevents impurities
|
||||
in builds by disallowing access to dependencies outside of the Nix
|
||||
store by using network and mount namespaces in a chroot environment.
|
||||
|
||||
This is enabled by default even though it has a possible performance
|
||||
impact due to the initial setup time of a sandbox for each build. It
|
||||
doesn't affect derivation hashes, so changing this option will not
|
||||
trigger a rebuild of packages.
|
||||
|
||||
When set to "relaxed", this option permits derivations that set
|
||||
`__noChroot = true;` to run outside of the sandboxed environment.
|
||||
Exercise caution when using this mode of operation! It is intended to
|
||||
be a quick hack when building with packages that are not easily setup
|
||||
to be built reproducibly.
|
||||
'';
|
||||
};
|
||||
|
||||
extra-sandbox-paths = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "/dev" "/proc" ];
|
||||
description = lib.mdDoc ''
|
||||
Directories from the host filesystem to be included
|
||||
in the sandbox.
|
||||
'';
|
||||
};
|
||||
|
||||
substituters = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = lib.mdDoc ''
|
||||
List of binary cache URLs used to obtain pre-built binaries
|
||||
of Nix packages.
|
||||
|
||||
By default https://cache.nixos.org/ is added.
|
||||
'';
|
||||
};
|
||||
|
||||
trusted-substituters = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "https://hydra.nixos.org/" ];
|
||||
description = lib.mdDoc ''
|
||||
List of binary cache URLs that non-root users can use (in
|
||||
addition to those specified using
|
||||
{option}`nix.settings.substituters`) by passing
|
||||
`--option binary-caches` to Nix commands.
|
||||
'';
|
||||
};
|
||||
|
||||
require-sigs = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If enabled (the default), Nix will only download binaries from binary caches if
|
||||
they are cryptographically signed with any of the keys listed in
|
||||
{option}`nix.settings.trusted-public-keys`. If disabled, signatures are neither
|
||||
required nor checked, so it's strongly recommended that you use only
|
||||
trustworthy caches and https to prevent man-in-the-middle attacks.
|
||||
'';
|
||||
};
|
||||
|
||||
trusted-public-keys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [ "hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" ];
|
||||
description = lib.mdDoc ''
|
||||
List of public keys used to sign binary caches. If
|
||||
{option}`nix.settings.trusted-public-keys` is enabled,
|
||||
then Nix will use a binary from a binary cache if and only
|
||||
if it is signed by *any* of the keys
|
||||
listed here. By default, only the key for
|
||||
`cache.nixos.org` is included.
|
||||
'';
|
||||
};
|
||||
|
||||
trusted-users = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "root" ];
|
||||
example = [ "root" "alice" "@wheel" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of names of users that have additional rights when
|
||||
connecting to the Nix daemon, such as the ability to specify
|
||||
additional binary caches, or to import unsigned NARs. You
|
||||
can also specify groups by prefixing them with
|
||||
`@`; for instance,
|
||||
`@wheel` means all users in the wheel
|
||||
group.
|
||||
'';
|
||||
};
|
||||
|
||||
system-features = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [ "kvm" "big-parallel" "gccarch-skylake" ];
|
||||
description = lib.mdDoc ''
|
||||
The set of features supported by the machine. Derivations
|
||||
can express dependencies on system features through the
|
||||
`requiredSystemFeatures` attribute.
|
||||
|
||||
By default, pseudo-features `nixos-test`, `benchmark`,
|
||||
and `big-parallel` used in Nixpkgs are set, `kvm`
|
||||
is also included if it is available.
|
||||
'';
|
||||
};
|
||||
|
||||
allowed-users = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "*" ];
|
||||
example = [ "@wheel" "@builders" "alice" "bob" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of names of users (separated by whitespace) that are
|
||||
allowed to connect to the Nix daemon. As with
|
||||
{option}`nix.settings.trusted-users`, you can specify groups by
|
||||
prefixing them with `@`. Also, you can
|
||||
allow all users by specifying `*`. The
|
||||
default is `*`. Note that trusted users are
|
||||
always allowed to connect.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
use-sandbox = true;
|
||||
show-trace = true;
|
||||
|
||||
system-features = [ "big-parallel" "kvm" "recursive-nix" ];
|
||||
sandbox-paths = { "/bin/sh" = "''${pkgs.busybox-sandbox-shell.out}/bin/busybox"; };
|
||||
}
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Configuration for Nix, see
|
||||
<https://nixos.org/manual/nix/stable/command-ref/conf-file.html> or
|
||||
{manpage}`nix.conf(5)` for available options.
|
||||
The value declared here will be translated directly to the key-value pairs Nix expects.
|
||||
|
||||
You can use {command}`nix-instantiate --eval --strict '<nixpkgs/nixos>' -A config.nix.settings`
|
||||
to view the current value. By default it is empty.
|
||||
|
||||
Nix configurations defined under {option}`nix.*` will be translated and applied to this
|
||||
option. In addition, configuration specified in {option}`nix.extraOptions` will be appended
|
||||
verbatim to the resulting config file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.etc."nix/nix.conf".source = nixConf;
|
||||
nix.settings = {
|
||||
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
|
||||
substituters = mkAfter [ "https://cache.nixos.org/" ];
|
||||
system-features = mkDefault (
|
||||
[ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++
|
||||
optionals (pkgs.stdenv.hostPlatform ? gcc.arch) (
|
||||
# a builder can run code for `gcc.arch` and inferior architectures
|
||||
[ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ] ++
|
||||
map (x: "gccarch-${x}") (systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [])
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -147,7 +147,7 @@ foreach my $g (@{$spec->{groups}}) {
|
||||
if (defined $existing) {
|
||||
$g->{gid} = $existing->{gid} if !defined $g->{gid};
|
||||
if ($g->{gid} != $existing->{gid}) {
|
||||
dry_print("warning: not applying", "warning: would not apply", "GID change of group ‘$name’ ($existing->{gid} -> $g->{gid}) in /etc/group");
|
||||
dry_print("warning: not applying", "warning: would not apply", "GID change of group ‘$name’ ($existing->{gid} -> $g->{gid})");
|
||||
$g->{gid} = $existing->{gid};
|
||||
}
|
||||
$g->{password} = $existing->{password}; # do we want this?
|
||||
@@ -209,7 +209,7 @@ foreach my $u (@{$spec->{users}}) {
|
||||
if (defined $existing) {
|
||||
$u->{uid} = $existing->{uid} if !defined $u->{uid};
|
||||
if ($u->{uid} != $existing->{uid}) {
|
||||
dry_print("warning: not applying", "warning: would not apply", "UID change of user ‘$name’ ($existing->{uid} -> $u->{uid}) in /etc/passwd");
|
||||
dry_print("warning: not applying", "warning: would not apply", "UID change of user ‘$name’ ($existing->{uid} -> $u->{uid})");
|
||||
$u->{uid} = $existing->{uid};
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -686,8 +686,6 @@ in {
|
||||
|
||||
environment.profiles = [
|
||||
"$HOME/.nix-profile"
|
||||
"\${XDG_STATE_HOME}/nix/profile"
|
||||
"$HOME/.local/state/nix/profile"
|
||||
"/etc/profiles/per-user/$USER"
|
||||
];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -31,14 +31,10 @@ in
|
||||
i2c = { };
|
||||
};
|
||||
|
||||
services.udev.packages = lib.singleton (pkgs.writeTextFile
|
||||
{ name = "i2c-udev-rules";
|
||||
text = ''
|
||||
# allow group ${cfg.group} and users with a seat use of i2c devices
|
||||
ACTION=="add", KERNEL=="i2c-[0-9]*", TAG+="uaccess", GROUP="${cfg.group}", MODE="660"
|
||||
'';
|
||||
destination = "/etc/udev/rules.d/70-i2c.rules";
|
||||
});
|
||||
services.udev.extraRules = ''
|
||||
# allow group ${cfg.group} and users with a seat use of i2c devices
|
||||
ACTION=="add", KERNEL=="i2c-[0-9]*", TAG+="uaccess", GROUP="${cfg.group}", MODE="660"
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ in
|
||||
Identifier "DisplayLink"
|
||||
MatchDriver "evdi"
|
||||
Driver "modesetting"
|
||||
Option "TearFree" "true"
|
||||
Option "AccelMethod" "none"
|
||||
EndSection
|
||||
'';
|
||||
|
||||
@@ -265,7 +265,7 @@ in
|
||||
{
|
||||
assertion = primeEnabled -> pCfg.nvidiaBusId != "" && (pCfg.intelBusId != "" || pCfg.amdgpuBusId != "");
|
||||
message = ''
|
||||
When NVIDIA PRIME is enabled, the GPU bus IDs must be configured.
|
||||
When NVIDIA PRIME is enabled, the GPU bus IDs must configured.
|
||||
'';
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ with lib;
|
||||
# ISO naming.
|
||||
isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso";
|
||||
|
||||
# BIOS booting
|
||||
isoImage.makeBiosBootable = true;
|
||||
|
||||
# EFI booting
|
||||
isoImage.makeEfiBootable = true;
|
||||
|
||||
|
||||
@@ -442,6 +442,9 @@ let
|
||||
fsck.vfat -vn "$out"
|
||||
''; # */
|
||||
|
||||
# Syslinux (and isolinux) only supports x86-based architectures.
|
||||
canx86BiosBoot = pkgs.stdenv.hostPlatform.isx86;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -540,17 +543,7 @@ in
|
||||
};
|
||||
|
||||
isoImage.makeBiosBootable = mkOption {
|
||||
# Before this option was introduced, images were BIOS-bootable if the
|
||||
# hostPlatform was x86-based. This option is enabled by default for
|
||||
# backwards compatibility.
|
||||
#
|
||||
# Also note that syslinux package currently cannot be cross-compiled from
|
||||
# non-x86 platforms, so the default is false on non-x86 build platforms.
|
||||
default = pkgs.stdenv.buildPlatform.isx86 && pkgs.stdenv.hostPlatform.isx86;
|
||||
defaultText = lib.literalMD ''
|
||||
`true` if both build and host platforms are x86-based architectures,
|
||||
e.g. i686 and x86_64.
|
||||
'';
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
description = lib.mdDoc ''
|
||||
Whether the ISO image should be a BIOS-bootable disk.
|
||||
@@ -711,11 +704,6 @@ in
|
||||
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
# Syslinux (and isolinux) only supports x86-based architectures.
|
||||
assertion = config.isoImage.makeBiosBootable -> pkgs.stdenv.hostPlatform.isx86;
|
||||
message = "BIOS boot is only supported on x86-based architectures.";
|
||||
}
|
||||
{
|
||||
assertion = !(stringLength config.isoImage.volumeID > 32);
|
||||
# https://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor
|
||||
@@ -734,7 +722,7 @@ in
|
||||
boot.loader.grub.enable = false;
|
||||
|
||||
environment.systemPackages = [ grubPkgs.grub2 grubPkgs.grub2_efi ]
|
||||
++ optional (config.isoImage.makeBiosBootable) pkgs.syslinux
|
||||
++ optional (config.isoImage.makeBiosBootable && canx86BiosBoot) pkgs.syslinux
|
||||
;
|
||||
|
||||
# In stage 1 of the boot, mount the CD as the root FS by label so
|
||||
@@ -785,7 +773,7 @@ in
|
||||
{ source = pkgs.writeText "version" config.system.nixos.label;
|
||||
target = "/version.txt";
|
||||
}
|
||||
] ++ optionals (config.isoImage.makeBiosBootable) [
|
||||
] ++ optionals (config.isoImage.makeBiosBootable && canx86BiosBoot) [
|
||||
{ source = config.isoImage.splashImage;
|
||||
target = "/isolinux/background.png";
|
||||
}
|
||||
@@ -812,7 +800,7 @@ in
|
||||
{ source = config.isoImage.efiSplashImage;
|
||||
target = "/EFI/boot/efi-background.png";
|
||||
}
|
||||
] ++ optionals (config.boot.loader.grub.memtest86.enable && config.isoImage.makeBiosBootable) [
|
||||
] ++ optionals (config.boot.loader.grub.memtest86.enable && config.isoImage.makeBiosBootable && canx86BiosBoot) [
|
||||
{ source = "${pkgs.memtest86plus}/memtest.bin";
|
||||
target = "/boot/memtest.bin";
|
||||
}
|
||||
@@ -827,10 +815,10 @@ in
|
||||
# Create the ISO image.
|
||||
system.build.isoImage = pkgs.callPackage ../../../lib/make-iso9660-image.nix ({
|
||||
inherit (config.isoImage) isoName compressImage volumeID contents;
|
||||
bootable = config.isoImage.makeBiosBootable;
|
||||
bootable = config.isoImage.makeBiosBootable && canx86BiosBoot;
|
||||
bootImage = "/isolinux/isolinux.bin";
|
||||
syslinux = if config.isoImage.makeBiosBootable then pkgs.syslinux else null;
|
||||
} // optionalAttrs (config.isoImage.makeUsbBootable && config.isoImage.makeBiosBootable) {
|
||||
syslinux = if config.isoImage.makeBiosBootable && canx86BiosBoot then pkgs.syslinux else null;
|
||||
} // optionalAttrs (config.isoImage.makeUsbBootable && config.isoImage.makeBiosBootable && canx86BiosBoot) {
|
||||
usbBootable = true;
|
||||
isohybridMbrImage = "${pkgs.syslinux}/share/syslinux/isohdpfx.bin";
|
||||
} // optionalAttrs config.isoImage.makeEfiBootable {
|
||||
|
||||
@@ -85,7 +85,7 @@ sub debug {
|
||||
|
||||
|
||||
# nixpkgs.system
|
||||
push @attrs, "nixpkgs.hostPlatform = lib.mkDefault \"@hostPlatformSystem@\";";
|
||||
push @attrs, "nixpkgs.hostPlatform = lib.mkDefault \"@system@\";";
|
||||
|
||||
|
||||
my $cpuinfo = read_file "/proc/cpuinfo";
|
||||
|
||||
@@ -35,7 +35,7 @@ let
|
||||
name = "nixos-generate-config";
|
||||
src = ./nixos-generate-config.pl;
|
||||
perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
|
||||
hostPlatformSystem = pkgs.stdenv.hostPlatform.system;
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
detectvirt = "${config.systemd.package}/bin/systemd-detect-virt";
|
||||
btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
|
||||
inherit (config.system.nixos-generate-config) configuration desktopConfiguration;
|
||||
|
||||
@@ -55,6 +55,11 @@ let
|
||||
description = "An evaluation of Nixpkgs; the top level attribute set of packages";
|
||||
};
|
||||
|
||||
# Whether `pkgs` was constructed by this module - not if nixpkgs.pkgs or
|
||||
# _module.args.pkgs is set. However, determining whether _module.args.pkgs
|
||||
# is defined elsewhere does not seem feasible.
|
||||
constructedByMe = !opt.pkgs.isDefined;
|
||||
|
||||
hasBuildPlatform = opt.buildPlatform.highestPrio < (mkOptionDefault {}).priority;
|
||||
hasHostPlatform = opt.hostPlatform.isDefined;
|
||||
hasPlatform = hasHostPlatform || hasBuildPlatform;
|
||||
@@ -332,28 +337,10 @@ in
|
||||
|
||||
config = {
|
||||
_module.args = {
|
||||
pkgs =
|
||||
# We explicitly set the default override priority, so that we do not need
|
||||
# to evaluate finalPkgs in case an override is placed on `_module.args.pkgs`.
|
||||
# After all, to determine a definition priority, we need to evaluate `._type`,
|
||||
# which is somewhat costly for Nixpkgs. With an explicit priority, we only
|
||||
# evaluate the wrapper to find out that the priority is lower, and then we
|
||||
# don't need to evaluate `finalPkgs`.
|
||||
lib.mkOverride lib.modules.defaultOverridePriority
|
||||
finalPkgs.__splicedPackages;
|
||||
pkgs = finalPkgs.__splicedPackages;
|
||||
};
|
||||
|
||||
assertions = let
|
||||
# Whether `pkgs` was constructed by this module. This is false when any of
|
||||
# nixpkgs.pkgs or _module.args.pkgs is set.
|
||||
constructedByMe =
|
||||
# We set it with default priority and it can not be merged, so if the
|
||||
# pkgs module argument has that priority, it's from us.
|
||||
(lib.modules.mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio
|
||||
== lib.modules.defaultOverridePriority
|
||||
# Although, if nixpkgs.pkgs is set, we did forward it, but we did not construct it.
|
||||
&& !opt.pkgs.isDefined;
|
||||
in [
|
||||
assertions = [
|
||||
(
|
||||
let
|
||||
nixosExpectedSystem =
|
||||
|
||||
@@ -28,7 +28,6 @@ let
|
||||
DOCUMENTATION_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/learn.html";
|
||||
SUPPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/community.html";
|
||||
BUG_REPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://github.com/NixOS/nixpkgs/issues";
|
||||
SUPPORT_END = "2023-12-31";
|
||||
} // lib.optionalAttrs (cfg.variant_id != null) {
|
||||
VARIANT_ID = cfg.variant_id;
|
||||
};
|
||||
@@ -141,6 +140,13 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
defaultChannel = mkOption {
|
||||
internal = true;
|
||||
type = types.str;
|
||||
default = "https://nixos.org/channels/nixos-unstable";
|
||||
description = lib.mdDoc "Default NixOS channel to which the root user is subscribed.";
|
||||
};
|
||||
|
||||
configurationRevision = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
./config/malloc.nix
|
||||
./config/mysql.nix
|
||||
./config/networking.nix
|
||||
./config/nix.nix
|
||||
./config/nix-channel.nix
|
||||
./config/nix-flakes.nix
|
||||
./config/nix-remote-build.nix
|
||||
./config/no-x-libs.nix
|
||||
./config/nsswitch.nix
|
||||
./config/power-management.nix
|
||||
@@ -160,7 +156,6 @@
|
||||
./programs/darling.nix
|
||||
./programs/dconf.nix
|
||||
./programs/digitalbitbox/default.nix
|
||||
./programs/direnv.nix
|
||||
./programs/dmrconfig.nix
|
||||
./programs/droidcam.nix
|
||||
./programs/environment.nix
|
||||
@@ -594,7 +589,6 @@
|
||||
./services/matrix/mjolnir.nix
|
||||
./services/matrix/mx-puppet-discord.nix
|
||||
./services/matrix/pantalaimon.nix
|
||||
./services/matrix/matrix-sliding-sync.nix
|
||||
./services/matrix/synapse.nix
|
||||
./services/misc/airsonic.nix
|
||||
./services/misc/ananicy.nix
|
||||
@@ -664,6 +658,7 @@
|
||||
./services/misc/moonraker.nix
|
||||
./services/misc/n8n.nix
|
||||
./services/misc/nitter.nix
|
||||
./services/misc/nix-daemon.nix
|
||||
./services/misc/nix-gc.nix
|
||||
./services/misc/nix-optimise.nix
|
||||
./services/misc/nix-ssh-serve.nix
|
||||
@@ -756,7 +751,6 @@
|
||||
./services/monitoring/munin.nix
|
||||
./services/monitoring/nagios.nix
|
||||
./services/monitoring/netdata.nix
|
||||
./services/monitoring/opentelemetry-collector.nix
|
||||
./services/monitoring/parsedmarc.nix
|
||||
./services/monitoring/prometheus/alertmanager-irc-relay.nix
|
||||
./services/monitoring/prometheus/alertmanager.nix
|
||||
@@ -782,7 +776,6 @@
|
||||
./services/monitoring/uptime-kuma.nix
|
||||
./services/monitoring/uptime.nix
|
||||
./services/monitoring/vmagent.nix
|
||||
./services/monitoring/vmalert.nix
|
||||
./services/monitoring/vnstat.nix
|
||||
./services/monitoring/zabbix-agent.nix
|
||||
./services/monitoring/zabbix-proxy.nix
|
||||
@@ -1140,7 +1133,6 @@
|
||||
./services/system/earlyoom.nix
|
||||
./services/system/kerberos/default.nix
|
||||
./services/system/localtimed.nix
|
||||
./services/system/nix-daemon.nix
|
||||
./services/system/nscd.nix
|
||||
./services/system/saslauthd.nix
|
||||
./services/system/self-deploy.nix
|
||||
@@ -1238,7 +1230,6 @@
|
||||
./services/web-apps/powerdns-admin.nix
|
||||
./services/web-apps/prosody-filer.nix
|
||||
./services/web-apps/restya-board.nix
|
||||
./services/web-apps/sftpgo.nix
|
||||
./services/web-apps/rss-bridge.nix
|
||||
./services/web-apps/selfoss.nix
|
||||
./services/web-apps/shiori.nix
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.programs.direnv;
|
||||
in {
|
||||
options.programs.direnv = {
|
||||
|
||||
enable = lib.mkEnableOption (lib.mdDoc ''
|
||||
direnv integration. Takes care of both installation and
|
||||
setting up the sourcing of the shell. Additionally enables nix-direnv
|
||||
integration. Note that you need to logout and login for this change to apply.
|
||||
'');
|
||||
|
||||
package = lib.mkPackageOptionMD pkgs "direnv" {};
|
||||
|
||||
direnvrcExtra = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
export FOO="foo"
|
||||
echo "loaded direnv!"
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Extra lines to append to the sourced direnvrc
|
||||
'';
|
||||
};
|
||||
|
||||
silent = lib.mkEnableOption (lib.mdDoc ''
|
||||
the hiding of direnv logging
|
||||
'');
|
||||
|
||||
persistDerivations =
|
||||
(lib.mkEnableOption (lib.mdDoc ''
|
||||
setting keep-derivations and keep-outputs to true
|
||||
to prevent shells from getting garbage collected
|
||||
''))
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
loadInNixShell =
|
||||
lib.mkEnableOption (lib.mdDoc ''
|
||||
loading direnv in `nix-shell` `nix shell` or `nix develop`
|
||||
'')
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
nix-direnv = {
|
||||
enable =
|
||||
(lib.mkEnableOption (lib.mdDoc ''
|
||||
a faster, persistent implementation of use_nix and use_flake, to replace the built-in one
|
||||
''))
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
package = lib.mkPackageOptionMD pkgs "nix-direnv" {};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs = {
|
||||
zsh.interactiveShellInit = ''
|
||||
if ${lib.boolToString cfg.loadInNixShell} || printenv PATH | grep -vqc '/nix/store'; then
|
||||
eval "$(${lib.getExe cfg.package} hook zsh)"
|
||||
fi
|
||||
'';
|
||||
|
||||
#$NIX_GCROOT for "nix develop" https://github.com/NixOS/nix/blob/6db66ebfc55769edd0c6bc70fcbd76246d4d26e0/src/nix/develop.cc#L530
|
||||
#$IN_NIX_SHELL for "nix-shell"
|
||||
bash.interactiveShellInit = ''
|
||||
if ${lib.boolToString cfg.loadInNixShell} || [ -z "$IN_NIX_SHELL$NIX_GCROOT$(printenv PATH | grep '/nix/store')" ] ; then
|
||||
eval "$(${lib.getExe cfg.package} hook bash)"
|
||||
fi
|
||||
'';
|
||||
|
||||
fish.interactiveShellInit = ''
|
||||
if ${lib.boolToString cfg.loadInNixShell};
|
||||
or printenv PATH | grep -vqc '/nix/store';
|
||||
${lib.getExe cfg.package} hook fish | source
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
nix.settings = lib.mkIf cfg.persistDerivations {
|
||||
keep-outputs = true;
|
||||
keep-derivations = true;
|
||||
};
|
||||
|
||||
environment = {
|
||||
systemPackages =
|
||||
if cfg.loadInNixShell then [cfg.package]
|
||||
else [
|
||||
#direnv has a fish library which sources direnv for some reason
|
||||
(cfg.package.overrideAttrs (old: {
|
||||
installPhase =
|
||||
(old.installPhase or "")
|
||||
+ ''
|
||||
rm -rf $out/share/fish
|
||||
'';
|
||||
}))
|
||||
];
|
||||
|
||||
variables = {
|
||||
DIRENV_CONFIG = "/etc/direnv";
|
||||
DIRENV_LOG_FORMAT = lib.mkIf cfg.silent "";
|
||||
};
|
||||
|
||||
etc = {
|
||||
"direnv/direnvrc".text = ''
|
||||
${lib.optionalString cfg.nix-direnv.enable ''
|
||||
#Load nix-direnv
|
||||
source ${cfg.nix-direnv.package}/share/nix-direnv/direnvrc
|
||||
''}
|
||||
|
||||
#Load direnvrcExtra
|
||||
${cfg.direnvrcExtra}
|
||||
|
||||
#Load user-configuration if present (~/.direnvrc or ~/.config/direnv/direnvrc)
|
||||
direnv_config_dir_home="''${DIRENV_CONFIG_HOME:-''${XDG_CONFIG_HOME:-$HOME/.config}/direnv}"
|
||||
if [[ -f $direnv_config_dir_home/direnvrc ]]; then
|
||||
source "$direnv_config_dir_home/direnvrc" >&2
|
||||
elif [[ -f $HOME/.direnvrc ]]; then
|
||||
source "$HOME/.direnvrc" >&2
|
||||
fi
|
||||
|
||||
unset direnv_config_dir_home
|
||||
'';
|
||||
|
||||
"direnv/lib/zz-user.sh".text = ''
|
||||
direnv_config_dir_home="''${DIRENV_CONFIG_HOME:-''${XDG_CONFIG_HOME:-$HOME/.config}/direnv}"
|
||||
|
||||
for lib in "$direnv_config_dir_home/lib/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
unset direnv_config_dir_home
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -9,8 +9,7 @@ let
|
||||
fmt = value:
|
||||
if isList value then concatStringsSep " " (map fmt value) else
|
||||
if isString value then value else
|
||||
if isBool value then if value then "1" else "0" else
|
||||
if isInt value then toString value else
|
||||
if isBool value || isInt value then toString value else
|
||||
throw "Unrecognized type ${typeOf value} in htop settings";
|
||||
|
||||
in
|
||||
|
||||
@@ -52,8 +52,6 @@ let
|
||||
set -s escape-time ${toString cfg.escapeTime}
|
||||
set -g history-limit ${toString cfg.historyLimit}
|
||||
|
||||
${cfg.extraConfigBeforePlugins}
|
||||
|
||||
${lib.optionalString (cfg.plugins != []) ''
|
||||
# Run plugins
|
||||
${lib.concatMapStringsSep "\n" (x: "run-shell ${x.rtp}") cfg.plugins}
|
||||
@@ -110,18 +108,10 @@ in {
|
||||
description = lib.mdDoc "Time in milliseconds for which tmux waits after an escape is input.";
|
||||
};
|
||||
|
||||
extraConfigBeforePlugins = mkOption {
|
||||
default = "";
|
||||
description = lib.mdDoc ''
|
||||
Additional contents of /etc/tmux.conf, to be run before sourcing plugins.
|
||||
'';
|
||||
type = types.lines;
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
description = lib.mdDoc ''
|
||||
Additional contents of /etc/tmux.conf, to be run after sourcing plugins.
|
||||
Additional contents of /etc/tmux.conf
|
||||
'';
|
||||
type = types.lines;
|
||||
};
|
||||
|
||||
@@ -484,9 +484,6 @@ let
|
||||
optionalString cfg.mysqlAuth ''
|
||||
account sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
||||
'' +
|
||||
optionalString (config.services.kanidm.enablePam) ''
|
||||
account sufficient ${pkgs.kanidm}/lib/pam_kanidm.so ignore_unknown_user
|
||||
'' +
|
||||
optionalString (config.services.sssd.enable && cfg.sssdStrictAccess==false) ''
|
||||
account sufficient ${pkgs.sssd}/lib/security/pam_sss.so
|
||||
'' +
|
||||
@@ -620,9 +617,6 @@ let
|
||||
optionalString use_ldap ''
|
||||
auth sufficient ${pam_ldap}/lib/security/pam_ldap.so use_first_pass
|
||||
'' +
|
||||
optionalString config.services.kanidm.enablePam ''
|
||||
auth sufficient ${pkgs.kanidm}/lib/pam_kanidm.so ignore_unknown_user use_first_pass
|
||||
'' +
|
||||
optionalString config.services.sssd.enable ''
|
||||
auth sufficient ${pkgs.sssd}/lib/security/pam_sss.so use_first_pass
|
||||
'' +
|
||||
@@ -659,9 +653,6 @@ let
|
||||
optionalString cfg.mysqlAuth ''
|
||||
password sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
||||
'' +
|
||||
optionalString config.services.kanidm.enablePam ''
|
||||
password sufficient ${pkgs.kanidm}/lib/pam_kanidm.so
|
||||
'' +
|
||||
optionalString config.services.sssd.enable ''
|
||||
password sufficient ${pkgs.sssd}/lib/security/pam_sss.so
|
||||
'' +
|
||||
@@ -723,9 +714,6 @@ let
|
||||
optionalString cfg.mysqlAuth ''
|
||||
session optional ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
||||
'' +
|
||||
optionalString config.services.kanidm.enablePam ''
|
||||
session optional ${pkgs.kanidm}/lib/pam_kanidm.so
|
||||
'' +
|
||||
optionalString config.services.sssd.enable ''
|
||||
session optional ${pkgs.sssd}/lib/security/pam_sss.so
|
||||
'' +
|
||||
@@ -1310,7 +1298,6 @@ in
|
||||
# Include the PAM modules in the system path mostly for the manpages.
|
||||
[ pkgs.pam ]
|
||||
++ optional config.users.ldap.enable pam_ldap
|
||||
++ optional config.services.kanidm.enablePam pkgs.kanidm
|
||||
++ optional config.services.sssd.enable pkgs.sssd
|
||||
++ optionals config.security.pam.krb5.enable [pam_krb5 pam_ccreds]
|
||||
++ optionals config.security.pam.enableOTPW [ pkgs.otpw ]
|
||||
@@ -1377,9 +1364,6 @@ in
|
||||
optionalString use_ldap ''
|
||||
mr ${pam_ldap}/lib/security/pam_ldap.so,
|
||||
'' +
|
||||
optionalString config.services.kanidm.enablePam ''
|
||||
mr ${pkgs.kanidm}/lib/pam_kanidm.so,
|
||||
'' +
|
||||
optionalString config.services.sssd.enable ''
|
||||
mr ${pkgs.sssd}/lib/security/pam_sss.so,
|
||||
'' +
|
||||
|
||||
@@ -167,11 +167,9 @@ in
|
||||
<!-- create mount point if not present -->
|
||||
<mkmountpoint enable="${if cfg.createMountPoints then "1" else "0"}" remove="${if cfg.removeCreatedMountPoints then "true" else "false"}" />
|
||||
<!-- specify the binaries to be called -->
|
||||
<!-- the comma in front of the options is necessary for empty options -->
|
||||
<fusemount>${pkgs.fuse}/bin/mount.fuse %(VOLUME) %(MNTPT) -o ,${concatStringsSep "," (cfg.fuseMountOptions ++ [ "%(OPTIONS)" ])}'</fusemount>
|
||||
<fusemount>${pkgs.fuse}/bin/mount.fuse %(VOLUME) %(MNTPT) -o ${concatStringsSep "," (cfg.fuseMountOptions ++ [ "%(OPTIONS)" ])}</fusemount>
|
||||
<fuseumount>${pkgs.fuse}/bin/fusermount -u %(MNTPT)</fuseumount>
|
||||
<!-- the comma in front of the options is necessary for empty options -->
|
||||
<cryptmount>${pkgs.pam_mount}/bin/mount.crypt -o ,${concatStringsSep "," (cfg.cryptMountOptions ++ [ "%(OPTIONS)" ])} %(VOLUME) %(MNTPT)</cryptmount>
|
||||
<cryptmount>${pkgs.pam_mount}/bin/mount.crypt -o ${concatStringsSep "," (cfg.cryptMountOptions ++ [ "%(OPTIONS)" ])} %(VOLUME) %(MNTPT)</cryptmount>
|
||||
<cryptumount>${pkgs.pam_mount}/bin/umount.crypt %(MNTPT)</cryptumount>
|
||||
<pmvarrun>${pkgs.pam_mount}/bin/pmvarrun -u %(USER) -o %(OPERATION)</pmvarrun>
|
||||
${optionalString oflRequired "<ofl>${fake_ofl}/bin/fake_ofl %(SIGNAL) %(MNTPT)</ofl>"}
|
||||
|
||||
@@ -6,6 +6,8 @@ let
|
||||
|
||||
cfg = config.security.sudo;
|
||||
|
||||
inherit (pkgs) sudo;
|
||||
|
||||
toUserString = user: if (isInt user) then "#${toString user}" else "${user}";
|
||||
toGroupString = group: if (isInt group) then "%#${toString group}" else "%${group}";
|
||||
|
||||
@@ -241,7 +243,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
environment.systemPackages = [ sudo ];
|
||||
|
||||
security.pam.services.sudo = { sshAgentAuth = true; usshAuth = true; };
|
||||
|
||||
|
||||
@@ -123,7 +123,9 @@ in
|
||||
};
|
||||
|
||||
sshKey = mkOption {
|
||||
type = with types; nullOr (coercedTo path toString str);
|
||||
type = types.nullOr types.path;
|
||||
# Prevent key from being copied to store
|
||||
apply = mapNullable toString;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
SSH private key file to use to login to the remote system. Can be
|
||||
@@ -203,7 +205,9 @@ in
|
||||
recursive = mkEnableOption (lib.mdDoc ''the transfer of child datasets'');
|
||||
|
||||
sshKey = mkOption {
|
||||
type = with types; nullOr (coercedTo path toString str);
|
||||
type = types.nullOr types.path;
|
||||
# Prevent key from being copied to store
|
||||
apply = mapNullable toString;
|
||||
description = lib.mdDoc ''
|
||||
SSH private key file to use to login to the remote system.
|
||||
Defaults to {option}`services.syncoid.sshKey` option.
|
||||
@@ -365,7 +369,7 @@ in
|
||||
PrivateDevices = true;
|
||||
PrivateMounts = true;
|
||||
PrivateNetwork = mkDefault false;
|
||||
PrivateUsers = false; # Enabling this breaks on zfs-2.2.0
|
||||
PrivateUsers = true;
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHome = true;
|
||||
|
||||
@@ -10,18 +10,171 @@
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
literalMD
|
||||
literalExpression
|
||||
mkIf
|
||||
mkOption
|
||||
mkRemovedOptionModule
|
||||
mkRenamedOptionModule
|
||||
types
|
||||
|
||||
;
|
||||
|
||||
cfg = config.services.hercules-ci-agent;
|
||||
cfg =
|
||||
config.services.hercules-ci-agent;
|
||||
|
||||
inherit (import ./settings.nix { inherit pkgs lib; }) format settingsModule;
|
||||
format = pkgs.formats.toml { };
|
||||
|
||||
settingsModule = { config, ... }: {
|
||||
freeformType = format.type;
|
||||
options = {
|
||||
apiBaseUrl = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
API base URL that the agent will connect to.
|
||||
|
||||
When using Hercules CI Enterprise, set this to the URL where your
|
||||
Hercules CI server is reachable.
|
||||
'';
|
||||
type = types.str;
|
||||
default = "https://hercules-ci.com";
|
||||
};
|
||||
baseDirectory = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/hercules-ci-agent";
|
||||
description = lib.mdDoc ''
|
||||
State directory (secrets, work directory, etc) for agent
|
||||
'';
|
||||
};
|
||||
concurrentTasks = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Number of tasks to perform simultaneously.
|
||||
|
||||
A task is a single derivation build, an evaluation or an effect run.
|
||||
At minimum, you need 2 concurrent tasks for `x86_64-linux`
|
||||
in your cluster, to allow for import from derivation.
|
||||
|
||||
`concurrentTasks` can be around the CPU core count or lower if memory is
|
||||
the bottleneck.
|
||||
|
||||
The optimal value depends on the resource consumption characteristics of your workload,
|
||||
including memory usage and in-task parallelism. This is typically determined empirically.
|
||||
|
||||
When scaling, it is generally better to have a double-size machine than two machines,
|
||||
because each split of resources causes inefficiencies; particularly with regards
|
||||
to build latency because of extra downloads.
|
||||
'';
|
||||
type = types.either types.ints.positive (types.enum [ "auto" ]);
|
||||
default = "auto";
|
||||
};
|
||||
labels = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
A key-value map of user data.
|
||||
|
||||
This data will be available to organization members in the dashboard and API.
|
||||
|
||||
The values can be of any TOML type that corresponds to a JSON type, but arrays
|
||||
can not contain tables/objects due to limitations of the TOML library. Values
|
||||
involving arrays of non-primitive types may not be representable currently.
|
||||
'';
|
||||
type = format.type;
|
||||
defaultText = literalExpression ''
|
||||
{
|
||||
agent.source = "..."; # One of "nixpkgs", "flake", "override"
|
||||
lib.version = "...";
|
||||
pkgs.version = "...";
|
||||
}
|
||||
'';
|
||||
};
|
||||
workDirectory = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
The directory in which temporary subdirectories are created for task state. This includes sources for Nix evaluation.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.baseDirectory + "/work";
|
||||
defaultText = literalExpression ''baseDirectory + "/work"'';
|
||||
};
|
||||
staticSecretsDirectory = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
This is the default directory to look for statically configured secrets like `cluster-join-token.key`.
|
||||
|
||||
See also `clusterJoinTokenPath` and `binaryCachesPath` for fine-grained configuration.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.baseDirectory + "/secrets";
|
||||
defaultText = literalExpression ''baseDirectory + "/secrets"'';
|
||||
};
|
||||
clusterJoinTokenPath = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Location of the cluster-join-token.key file.
|
||||
|
||||
You can retrieve the contents of the file when creating a new agent via
|
||||
<https://hercules-ci.com/dashboard>.
|
||||
|
||||
As this value is confidential, it should not be in the store, but
|
||||
installed using other means, such as agenix, NixOps
|
||||
`deployment.keys`, or manual installation.
|
||||
|
||||
The contents of the file are used for authentication between the agent and the API.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.staticSecretsDirectory + "/cluster-join-token.key";
|
||||
defaultText = literalExpression ''staticSecretsDirectory + "/cluster-join-token.key"'';
|
||||
};
|
||||
binaryCachesPath = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Path to a JSON file containing binary cache secret keys.
|
||||
|
||||
As these values are confidential, they should not be in the store, but
|
||||
copied over using other means, such as agenix, NixOps
|
||||
`deployment.keys`, or manual installation.
|
||||
|
||||
The format is described on <https://docs.hercules-ci.com/hercules-ci-agent/binary-caches-json/>.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.staticSecretsDirectory + "/binary-caches.json";
|
||||
defaultText = literalExpression ''staticSecretsDirectory + "/binary-caches.json"'';
|
||||
};
|
||||
secretsJsonPath = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Path to a JSON file containing secrets for effects.
|
||||
|
||||
As these values are confidential, they should not be in the store, but
|
||||
copied over using other means, such as agenix, NixOps
|
||||
`deployment.keys`, or manual installation.
|
||||
|
||||
The format is described on <https://docs.hercules-ci.com/hercules-ci-agent/secrets-json/>.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.staticSecretsDirectory + "/secrets.json";
|
||||
defaultText = literalExpression ''staticSecretsDirectory + "/secrets.json"'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# TODO (roberth, >=2022) remove
|
||||
checkNix =
|
||||
if !cfg.checkNix
|
||||
then ""
|
||||
else if lib.versionAtLeast config.nix.package.version "2.3.10"
|
||||
then ""
|
||||
else
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "hercules-ci-check-system-nix-src";
|
||||
inherit (config.nix.package) src patches;
|
||||
dontConfigure = true;
|
||||
buildPhase = ''
|
||||
echo "Checking in-memory pathInfoCache expiry"
|
||||
if ! grep 'PathInfoCacheValue' src/libstore/store-api.hh >/dev/null; then
|
||||
cat 1>&2 <<EOF
|
||||
|
||||
You are deploying Hercules CI Agent on a system with an incompatible
|
||||
nix-daemon. Please make sure nix.package is set to a Nix version of at
|
||||
least 2.3.10 or a master version more recent than Mar 12, 2020.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
installPhase = "touch $out";
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
@@ -45,6 +198,15 @@ in
|
||||
Support is available at [help@hercules-ci.com](mailto:help@hercules-ci.com).
|
||||
'';
|
||||
};
|
||||
checkNix = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
Whether to make sure that the system's Nix (nix-daemon) is compatible.
|
||||
|
||||
If you set this to false, please keep up with the change log.
|
||||
'';
|
||||
};
|
||||
package = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Package containing the bin/hercules-ci-agent executable.
|
||||
@@ -73,7 +235,7 @@ in
|
||||
tomlFile = mkOption {
|
||||
type = types.path;
|
||||
internal = true;
|
||||
defaultText = lib.literalMD "generated `hercules-ci-agent.toml`";
|
||||
defaultText = literalMD "generated `hercules-ci-agent.toml`";
|
||||
description = lib.mdDoc ''
|
||||
The fully assembled config file.
|
||||
'';
|
||||
@@ -81,27 +243,7 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Make sure that nix.extraOptions does not override trusted-users
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
(cfg.settings.nixUserIsTrusted or false) ->
|
||||
builtins.match ".*(^|\n)[ \t]*trusted-users[ \t]*=.*" config.nix.extraOptions == null;
|
||||
message = ''
|
||||
hercules-ci-agent: Please do not set `trusted-users` in `nix.extraOptions`.
|
||||
|
||||
The hercules-ci-agent module by default relies on `nix.settings.trusted-users`
|
||||
to be effectful, but a line like `trusted-users = ...` in `nix.extraOptions`
|
||||
will override the value set in `nix.settings.trusted-users`.
|
||||
|
||||
Instead of setting `trusted-users` in the `nix.extraOptions` string, you should
|
||||
set an option with additive semantics, such as
|
||||
- the NixOS option `nix.settings.trusted-users`, or
|
||||
- the Nix option in the `extraOptions` string, `extra-trusted-users`
|
||||
'';
|
||||
}
|
||||
];
|
||||
nix.extraOptions = ''
|
||||
nix.extraOptions = lib.addContextFrom checkNix ''
|
||||
# A store path that was missing at first may well have finished building,
|
||||
# even shortly after the previous lookup. This *also* applies to the daemon.
|
||||
narinfo-cache-negative-ttl = 0
|
||||
@@ -109,9 +251,14 @@ in
|
||||
services.hercules-ci-agent = {
|
||||
tomlFile =
|
||||
format.generate "hercules-ci-agent.toml" cfg.settings;
|
||||
settings.config._module.args = {
|
||||
packageOption = options.services.hercules-ci-agent.package;
|
||||
inherit pkgs;
|
||||
|
||||
settings.labels = {
|
||||
agent.source =
|
||||
if options.services.hercules-ci-agent.package.highestPrio == (lib.modules.mkOptionDefault { }).priority
|
||||
then "nixpkgs"
|
||||
else lib.mkOptionDefault "override";
|
||||
pkgs.version = pkgs.lib.version;
|
||||
lib.version = lib.version;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -36,14 +36,8 @@ in
|
||||
Restart = "on-failure";
|
||||
RestartSec = 120;
|
||||
|
||||
# If a worker goes OOM, don't kill the main process. It needs to
|
||||
# report the failure and it's unlikely to be part of the problem.
|
||||
OOMPolicy = "continue";
|
||||
|
||||
# Work around excessive stack use by libstdc++ regex
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86164
|
||||
# A 256 MiB stack allows between 400 KiB and 1.5 MiB file to be matched by ".*".
|
||||
LimitSTACK = 256 * 1024 * 1024;
|
||||
OOMPolicy = "continue";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
# Not a module
|
||||
{ pkgs, lib }:
|
||||
let
|
||||
inherit (lib)
|
||||
types
|
||||
literalExpression
|
||||
mkOption
|
||||
;
|
||||
|
||||
format = pkgs.formats.toml { };
|
||||
|
||||
settingsModule = { config, packageOption, pkgs, ... }: {
|
||||
freeformType = format.type;
|
||||
options = {
|
||||
apiBaseUrl = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
API base URL that the agent will connect to.
|
||||
|
||||
When using Hercules CI Enterprise, set this to the URL where your
|
||||
Hercules CI server is reachable.
|
||||
'';
|
||||
type = types.str;
|
||||
default = "https://hercules-ci.com";
|
||||
};
|
||||
baseDirectory = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/hercules-ci-agent";
|
||||
description = lib.mdDoc ''
|
||||
State directory (secrets, work directory, etc) for agent
|
||||
'';
|
||||
};
|
||||
concurrentTasks = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Number of tasks to perform simultaneously.
|
||||
|
||||
A task is a single derivation build, an evaluation or an effect run.
|
||||
At minimum, you need 2 concurrent tasks for `x86_64-linux`
|
||||
in your cluster, to allow for import from derivation.
|
||||
|
||||
`concurrentTasks` can be around the CPU core count or lower if memory is
|
||||
the bottleneck.
|
||||
|
||||
The optimal value depends on the resource consumption characteristics of your workload,
|
||||
including memory usage and in-task parallelism. This is typically determined empirically.
|
||||
|
||||
When scaling, it is generally better to have a double-size machine than two machines,
|
||||
because each split of resources causes inefficiencies; particularly with regards
|
||||
to build latency because of extra downloads.
|
||||
'';
|
||||
type = types.either types.ints.positive (types.enum [ "auto" ]);
|
||||
default = "auto";
|
||||
defaultText = lib.literalMD ''
|
||||
`"auto"`, meaning equal to the number of CPU cores.
|
||||
'';
|
||||
};
|
||||
labels = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
A key-value map of user data.
|
||||
|
||||
This data will be available to organization members in the dashboard and API.
|
||||
|
||||
The values can be of any TOML type that corresponds to a JSON type, but arrays
|
||||
can not contain tables/objects due to limitations of the TOML library. Values
|
||||
involving arrays of non-primitive types may not be representable currently.
|
||||
'';
|
||||
type = format.type;
|
||||
defaultText = literalExpression ''
|
||||
{
|
||||
agent.source = "..."; # One of "nixpkgs", "flake", "override"
|
||||
lib.version = "...";
|
||||
pkgs.version = "...";
|
||||
}
|
||||
'';
|
||||
};
|
||||
workDirectory = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
The directory in which temporary subdirectories are created for task state. This includes sources for Nix evaluation.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.baseDirectory + "/work";
|
||||
defaultText = literalExpression ''baseDirectory + "/work"'';
|
||||
};
|
||||
staticSecretsDirectory = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
This is the default directory to look for statically configured secrets like `cluster-join-token.key`.
|
||||
|
||||
See also `clusterJoinTokenPath` and `binaryCachesPath` for fine-grained configuration.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.baseDirectory + "/secrets";
|
||||
defaultText = literalExpression ''baseDirectory + "/secrets"'';
|
||||
};
|
||||
clusterJoinTokenPath = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Location of the cluster-join-token.key file.
|
||||
|
||||
You can retrieve the contents of the file when creating a new agent via
|
||||
<https://hercules-ci.com/dashboard>.
|
||||
|
||||
As this value is confidential, it should not be in the store, but
|
||||
installed using other means, such as agenix, NixOps
|
||||
`deployment.keys`, or manual installation.
|
||||
|
||||
The contents of the file are used for authentication between the agent and the API.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.staticSecretsDirectory + "/cluster-join-token.key";
|
||||
defaultText = literalExpression ''staticSecretsDirectory + "/cluster-join-token.key"'';
|
||||
};
|
||||
binaryCachesPath = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Path to a JSON file containing binary cache secret keys.
|
||||
|
||||
As these values are confidential, they should not be in the store, but
|
||||
copied over using other means, such as agenix, NixOps
|
||||
`deployment.keys`, or manual installation.
|
||||
|
||||
The format is described on <https://docs.hercules-ci.com/hercules-ci-agent/binary-caches-json/>.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.staticSecretsDirectory + "/binary-caches.json";
|
||||
defaultText = literalExpression ''staticSecretsDirectory + "/binary-caches.json"'';
|
||||
};
|
||||
secretsJsonPath = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Path to a JSON file containing secrets for effects.
|
||||
|
||||
As these values are confidential, they should not be in the store, but
|
||||
copied over using other means, such as agenix, NixOps
|
||||
`deployment.keys`, or manual installation.
|
||||
|
||||
The format is described on <https://docs.hercules-ci.com/hercules-ci-agent/secrets-json/>.
|
||||
'';
|
||||
type = types.path;
|
||||
default = config.staticSecretsDirectory + "/secrets.json";
|
||||
defaultText = literalExpression ''staticSecretsDirectory + "/secrets.json"'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
labels = {
|
||||
agent.source =
|
||||
if packageOption.highestPrio == (lib.modules.mkOptionDefault { }).priority
|
||||
then "nixpkgs"
|
||||
else lib.mkOptionDefault "override";
|
||||
pkgs.version = pkgs.lib.version;
|
||||
lib.version = lib.version;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit format settingsModule;
|
||||
}
|
||||
@@ -116,8 +116,8 @@ in
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
restartTriggers = [ config.environment.etc."exim.conf".source ];
|
||||
serviceConfig = {
|
||||
ExecStart = "!${cfg.package}/bin/exim -bdf -q${cfg.queueRunnerInterval}";
|
||||
ExecReload = "!${coreutils}/bin/kill -HUP $MAINPID";
|
||||
ExecStart = "+${cfg.package}/bin/exim -bdf -q${cfg.queueRunnerInterval}";
|
||||
ExecReload = "+${coreutils}/bin/kill -HUP $MAINPID";
|
||||
User = cfg.user;
|
||||
};
|
||||
preStart = ''
|
||||
|
||||
@@ -335,13 +335,12 @@ in {
|
||||
};
|
||||
|
||||
secrets = lib.mkOption {
|
||||
type = with types; listOf path;
|
||||
type = lib.types.path;
|
||||
description = lib.mdDoc ''
|
||||
A list of files containing the various secrets. Should be in the format
|
||||
A file containing the various secrets. Should be in the format
|
||||
expected by systemd's `EnvironmentFile` directory. Secrets can be
|
||||
referenced in the format `{env:VAR}`.
|
||||
'';
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
};
|
||||
@@ -380,7 +379,7 @@ in {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
StateDirectory = [ "maddy" ];
|
||||
EnvironmentFile = cfg.secrets;
|
||||
EnvironmentFile = lib.mkIf (cfg.secrets != null) "${cfg.secrets}";
|
||||
};
|
||||
restartTriggers = [ config.environment.etc."maddy/maddy.conf".source ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
@@ -12,14 +12,16 @@ let
|
||||
|
||||
configFile = pkgs.runCommand "matrix-appservice-irc.yml" {
|
||||
# Because this program will be run at build time, we need `nativeBuildInputs`
|
||||
nativeBuildInputs = [ (pkgs.python3.withPackages (ps: [ ps.jsonschema ])) pkgs.remarshal ];
|
||||
nativeBuildInputs = [ (pkgs.python3.withPackages (ps: [ ps.pyyaml ps.jsonschema ])) ];
|
||||
preferLocalBuild = true;
|
||||
|
||||
config = builtins.toJSON cfg.settings;
|
||||
passAsFile = [ "config" ];
|
||||
} ''
|
||||
# The schema is given as yaml, we need to convert it to json
|
||||
remarshal --if yaml --of json -i ${pkg}/config.schema.yml -o config.schema.json
|
||||
python -c 'import json; import yaml; import sys; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' \
|
||||
< ${pkg}/lib/node_modules/matrix-appservice-irc/config.schema.yml \
|
||||
> config.schema.json
|
||||
python -m jsonschema config.schema.json -i $configPath
|
||||
cp "$configPath" "$out"
|
||||
'';
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.matrix-synapse.sliding-sync;
|
||||
in
|
||||
{
|
||||
options.services.matrix-synapse.sliding-sync = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "sliding sync");
|
||||
|
||||
package = lib.mkPackageOptionMD pkgs "matrix-sliding-sync" { };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = with lib.types; attrsOf str;
|
||||
options = {
|
||||
SYNCV3_SERVER = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = lib.mdDoc ''
|
||||
The destination homeserver to talk to not including `/_matrix/` e.g `https://matrix.example.org`.
|
||||
'';
|
||||
};
|
||||
|
||||
SYNCV3_DB = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "postgresql:///matrix-sliding-sync?host=/run/postgresql";
|
||||
description = lib.mdDoc ''
|
||||
The postgres connection string.
|
||||
Refer to <https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING>.
|
||||
'';
|
||||
};
|
||||
|
||||
SYNCV3_BINDADDR = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1:8009";
|
||||
example = "[::]:8008";
|
||||
description = lib.mdDoc "The interface and port to listen on.";
|
||||
};
|
||||
|
||||
SYNCV3_LOG_LEVEL = lib.mkOption {
|
||||
type = lib.types.enum [ "trace" "debug" "info" "warn" "error" "fatal" ];
|
||||
default = "info";
|
||||
description = lib.mdDoc "The level of verbosity for messages logged.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
Freeform environment variables passed to the sliding sync proxy.
|
||||
Refer to <https://github.com/matrix-org/sliding-sync#setup> for all supported values.
|
||||
'';
|
||||
};
|
||||
|
||||
createDatabase = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
Whether to enable and configure `services.postgres` to ensure that the database user `matrix-sliding-sync`
|
||||
and the database `matrix-sliding-sync` exist.
|
||||
'';
|
||||
};
|
||||
|
||||
environmentFile = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = lib.mdDoc ''
|
||||
Environment file as defined in {manpage}`systemd.exec(5)`.
|
||||
|
||||
This must contain the {env}`SYNCV3_SECRET` variable which should
|
||||
be generated with {command}`openssl rand -hex 32`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.postgresql = lib.optionalAttrs cfg.createDatabase {
|
||||
enable = true;
|
||||
ensureDatabases = [ "matrix-sliding-sync" ];
|
||||
ensureUsers = [ rec {
|
||||
name = "matrix-sliding-sync";
|
||||
ensurePermissions."DATABASE \"${name}\"" = "ALL PRIVILEGES";
|
||||
} ];
|
||||
};
|
||||
|
||||
systemd.services.matrix-sliding-sync = {
|
||||
after = lib.optional cfg.createDatabase "postgresql.service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = cfg.settings;
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
ExecStart = lib.getExe cfg.package;
|
||||
StateDirectory = "matrix-sliding-sync";
|
||||
WorkingDirectory = "%S/matrix-sliding-sync";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -27,8 +27,7 @@ please refer to the
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
fqdn = "${config.networking.hostName}.${config.networking.domain}";
|
||||
baseUrl = "https://${fqdn}";
|
||||
clientConfig."m.homeserver".base_url = baseUrl;
|
||||
clientConfig."m.homeserver".base_url = "https://${fqdn}";
|
||||
serverConfig."m.server" = "${fqdn}:443";
|
||||
mkWellKnown = data: ''
|
||||
add_header Content-Type application/json;
|
||||
@@ -98,11 +97,6 @@ in {
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
settings.server_name = config.networking.domain;
|
||||
# The public base URL value must match the `base_url` value set in `clientConfig` above.
|
||||
# The default value here is based on `server_name`, so if your `server_name` is different
|
||||
# from the value of `fqdn` above, you will likely run into some mismatched domain names
|
||||
# in client applications.
|
||||
settings.public_baseurl = baseUrl;
|
||||
settings.listeners = [
|
||||
{ port = 8008;
|
||||
bind_addresses = [ "::1" ];
|
||||
|
||||
@@ -569,27 +569,8 @@ in {
|
||||
};
|
||||
|
||||
url_preview_url_blacklist = mkOption {
|
||||
# FIXME revert to just `listOf (attrsOf str)` after some time(tm).
|
||||
type = types.listOf (
|
||||
types.coercedTo
|
||||
types.str
|
||||
(const (throw ''
|
||||
Setting `config.services.matrix-synapse.settings.url_preview_url_blacklist`
|
||||
to a list of strings has never worked. Due to a bug, this was the type accepted
|
||||
by the module, but in practice it broke on runtime and as a result, no URL
|
||||
preview worked anywhere if this was set.
|
||||
|
||||
See https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#url_preview_url_blacklist
|
||||
on how to configure it properly.
|
||||
''))
|
||||
(types.attrsOf types.str));
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{ scheme = "http"; } # no http previews
|
||||
{ netloc = "www.acme.com"; path = "/foo"; } # block http(s)://www.acme.com/foo
|
||||
]
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Optional list of URL matches that the URL preview spider is
|
||||
denied from accessing.
|
||||
@@ -655,7 +636,6 @@ in {
|
||||
|
||||
trusted_key_servers = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
freeformType = format.type;
|
||||
options = {
|
||||
server_name = mkOption {
|
||||
type = types.str;
|
||||
@@ -664,6 +644,22 @@ in {
|
||||
Hostname of the trusted server.
|
||||
'';
|
||||
};
|
||||
|
||||
verify_keys = mkOption {
|
||||
type = types.nullOr (types.attrsOf types.str);
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
{
|
||||
"ed25519:auto" = "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw";
|
||||
}
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Attribute set from key id to base64 encoded public key.
|
||||
|
||||
If specified synapse will check that the response is signed
|
||||
by at least one of the given keys.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [ {
|
||||
|
||||
@@ -49,14 +49,6 @@ in {
|
||||
options.services.dockerRegistry = {
|
||||
enable = mkEnableOption (lib.mdDoc "Docker Registry");
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = mdDoc "Which Docker registry package to use.";
|
||||
default = pkgs.docker-distribution;
|
||||
defaultText = literalExpression "pkgs.docker-distribution";
|
||||
example = literalExpression "pkgs.gitlab-container-registry";
|
||||
};
|
||||
|
||||
listenAddress = mkOption {
|
||||
description = lib.mdDoc "Docker registry host or ip to bind to.";
|
||||
default = "127.0.0.1";
|
||||
@@ -125,7 +117,7 @@ in {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
script = ''
|
||||
${cfg.package}/bin/registry serve ${configFile}
|
||||
${pkgs.docker-distribution}/bin/registry serve ${configFile}
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
@@ -144,7 +136,7 @@ in {
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
script = ''
|
||||
${cfg.package}/bin/registry garbage-collect ${configFile}
|
||||
${pkgs.docker-distribution}/bin/registry garbage-collect ${configFile}
|
||||
/run/current-system/systemd/bin/systemctl restart docker-registry.service
|
||||
'';
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ in
|
||||
ejabberdUser = config.services.ejabberd.user;
|
||||
}; }
|
||||
// lib.optionalAttrs (config.services.mysql.enable) { mysql-database = {
|
||||
mysqlPort = config.services.mysql.settings.mysqld.port;
|
||||
mysqlPort = config.services.mysql.port;
|
||||
mysqlSocket = "/run/mysqld/mysqld.sock";
|
||||
} // lib.optionalAttrs cfg.enableAuthentication {
|
||||
mysqlUsername = "root";
|
||||
|
||||
@@ -9,24 +9,12 @@ let
|
||||
toml = pkgs.formats.toml {};
|
||||
yaml = pkgs.formats.yaml {};
|
||||
|
||||
ruby = cfg.packages.gitlab.ruby;
|
||||
|
||||
postgresqlPackage = if config.services.postgresql.enable then
|
||||
config.services.postgresql.package
|
||||
else
|
||||
pkgs.postgresql_13;
|
||||
|
||||
# gitlab 16.3.0 requires git 2.41.0, but nixos 23.05 is at 2.40.1
|
||||
gitPackage = if
|
||||
versionOlder pkgs.git.version "2.41.0" && lib.versionAtLeast (lib.getVersion cfg.packages.gitlab) "16.3"
|
||||
then
|
||||
pkgs.git.overrideAttrs (old: rec {
|
||||
version = "2.41.0";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
|
||||
hash = "sha256-50i6/UJM/oCyEsvG8bvMw6R9SGL7HreYiHd1BHhWgEA=";
|
||||
};
|
||||
})
|
||||
else
|
||||
pkgs.git;
|
||||
pkgs.postgresql_12;
|
||||
|
||||
gitlabSocket = "${cfg.statePath}/tmp/sockets/gitlab.socket";
|
||||
gitalySocket = "${cfg.statePath}/tmp/sockets/gitaly.socket";
|
||||
@@ -57,7 +45,10 @@ let
|
||||
prometheus_listen_addr = "localhost:9236"
|
||||
|
||||
[git]
|
||||
bin_path = "${gitPackage}/bin/git"
|
||||
bin_path = "${pkgs.git}/bin/git"
|
||||
|
||||
[gitaly-ruby]
|
||||
dir = "${cfg.packages.gitaly.ruby}"
|
||||
|
||||
[gitlab-shell]
|
||||
dir = "${cfg.packages.gitlab-shell}"
|
||||
@@ -98,9 +89,6 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
# Redis configuration file
|
||||
resqueYml = pkgs.writeText "resque.yml" (builtins.toJSON redisConfig);
|
||||
|
||||
gitlabConfig = {
|
||||
# These are the default settings from config/gitlab.example.yml
|
||||
production = flip recursiveUpdate cfg.extraConfig {
|
||||
@@ -166,7 +154,6 @@ let
|
||||
api_url = "http://${config.services.dockerRegistry.listenAddress}:${toString config.services.dockerRegistry.port}/";
|
||||
issuer = cfg.registry.issuer;
|
||||
};
|
||||
elasticsearch.indexer_path = "${pkgs.gitlab-elasticsearch-indexer}/bin/gitlab-elasticsearch-indexer";
|
||||
extra = {};
|
||||
uploads.storage_path = cfg.statePath;
|
||||
pages = optionalAttrs cfg.pages.enable {
|
||||
@@ -185,6 +172,7 @@ let
|
||||
SCHEMA = "${cfg.statePath}/db/structure.sql";
|
||||
GITLAB_UPLOADS_PATH = "${cfg.statePath}/uploads";
|
||||
GITLAB_LOG_PATH = "${cfg.statePath}/log";
|
||||
GITLAB_REDIS_CONFIG_FILE = pkgs.writeText "redis.yml" (builtins.toJSON redisConfig);
|
||||
prometheus_multiproc_dir = "/run/gitlab";
|
||||
RAILS_ENV = "production";
|
||||
MALLOC_ARENA_MAX = "2";
|
||||
@@ -193,7 +181,7 @@ let
|
||||
runtimeDeps = with pkgs; [
|
||||
nodejs
|
||||
gzip
|
||||
gitPackage
|
||||
git
|
||||
gnutar
|
||||
postgresqlPackage
|
||||
coreutils
|
||||
@@ -568,20 +556,6 @@ in {
|
||||
default = false;
|
||||
description = lib.mdDoc "Enable GitLab container registry.";
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default =
|
||||
if versionAtLeast config.system.stateVersion "23.11"
|
||||
then pkgs.gitlab-container-registry
|
||||
else pkgs.docker-distribution;
|
||||
defaultText = literalExpression "pkgs.docker-distribution";
|
||||
description = lib.mdDoc ''
|
||||
Container registry package to use.
|
||||
|
||||
External container registries such as `pkgs.docker-distribution` are not supported
|
||||
anymore since GitLab 16.0.0.
|
||||
'';
|
||||
};
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = config.services.gitlab.host;
|
||||
@@ -1096,18 +1070,6 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings = [
|
||||
(mkIf
|
||||
(cfg.registry.enable && versionAtLeast (getVersion cfg.packages.gitlab) "16.0.0" && cfg.registry.package == pkgs.docker-distribution)
|
||||
''Support for container registries other than gitlab-container-registry has ended since GitLab 16.0.0 and is scheduled for removal in a future release.
|
||||
Please back up your data and migrate to the gitlab-container-registry package.''
|
||||
)
|
||||
(mkIf
|
||||
(versionAtLeast (getVersion cfg.packages.gitlab) "16.2.0" && versionOlder (getVersion cfg.packages.gitlab) "16.5.0")
|
||||
''GitLab instances created or updated between versions [15.11.0, 15.11.2] have an incorrect database schema.
|
||||
Check the upstream documentation for a workaround: https://docs.gitlab.com/ee/update/versions/gitlab_16_changes.html#undefined-column-error-upgrading-to-162-or-later''
|
||||
)
|
||||
];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
@@ -1139,12 +1101,12 @@ in {
|
||||
message = "services.gitlab.secrets.jwsFile must be set!";
|
||||
}
|
||||
{
|
||||
assertion = versionAtLeast postgresqlPackage.version "13.6.0";
|
||||
message = "PostgreSQL >=13.6 is required to run GitLab 16. Follow the instructions in the manual section for upgrading PostgreSQL here: https://nixos.org/manual/nixos/stable/index.html#module-services-postgres-upgrading";
|
||||
assertion = versionAtLeast postgresqlPackage.version "12.0.0";
|
||||
message = "PostgreSQL >=12 is required to run GitLab 14. Follow the instructions in the manual section for upgrading PostgreSQL here: https://nixos.org/manual/nixos/stable/index.html#module-services-postgres-upgrading";
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = [ gitlab-rake gitlab-rails cfg.packages.gitlab-shell ];
|
||||
environment.systemPackages = [ pkgs.git gitlab-rake gitlab-rails cfg.packages.gitlab-shell ];
|
||||
|
||||
systemd.targets.gitlab = {
|
||||
description = "Common target for all GitLab services.";
|
||||
@@ -1251,7 +1213,6 @@ in {
|
||||
services.dockerRegistry = optionalAttrs cfg.registry.enable {
|
||||
enable = true;
|
||||
enableDelete = true; # This must be true, otherwise GitLab won't manage it correctly
|
||||
package = cfg.registry.package;
|
||||
extraConfig = {
|
||||
auth.token = {
|
||||
realm = "http${optionalString (cfg.https == true) "s"}://${cfg.host}/jwt/auth";
|
||||
@@ -1301,7 +1262,6 @@ in {
|
||||
"d ${gitlabConfig.production.shared.path}/pages 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${gitlabConfig.production.shared.path}/registry 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${gitlabConfig.production.shared.path}/terraform_state 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${gitlabConfig.production.shared.path}/ci_secure_files 0750 ${cfg.user} ${cfg.group} -"
|
||||
"L+ /run/gitlab/config - - - - ${cfg.statePath}/config"
|
||||
"L+ /run/gitlab/log - - - - ${cfg.statePath}/log"
|
||||
"L+ /run/gitlab/tmp - - - - ${cfg.statePath}/tmp"
|
||||
@@ -1318,7 +1278,7 @@ in {
|
||||
jq
|
||||
openssl
|
||||
replace-secret
|
||||
gitPackage
|
||||
git
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
@@ -1355,7 +1315,6 @@ in {
|
||||
cp -rf --no-preserve=mode ${cfg.packages.gitlab}/share/gitlab/db/* ${cfg.statePath}/db
|
||||
ln -sf ${extraGitlabRb} ${cfg.statePath}/config/initializers/extra-gitlab.rb
|
||||
ln -sf ${cableYml} ${cfg.statePath}/config/cable.yml
|
||||
ln -sf ${resqueYml} ${cfg.statePath}/config/resque.yml
|
||||
|
||||
${cfg.packages.gitlab-shell}/bin/install
|
||||
|
||||
@@ -1473,7 +1432,7 @@ in {
|
||||
});
|
||||
path = with pkgs; [
|
||||
postgresqlPackage
|
||||
gitPackage
|
||||
git
|
||||
ruby
|
||||
openssh
|
||||
nodejs
|
||||
@@ -1503,7 +1462,10 @@ in {
|
||||
partOf = [ "gitlab.target" ];
|
||||
path = with pkgs; [
|
||||
openssh
|
||||
gitPackage
|
||||
procps # See https://gitlab.com/gitlab-org/gitaly/issues/1562
|
||||
git
|
||||
cfg.packages.gitaly.rubyEnv
|
||||
cfg.packages.gitaly.rubyEnv.wrappedRuby
|
||||
gzip
|
||||
bzip2
|
||||
];
|
||||
@@ -1586,7 +1548,7 @@ in {
|
||||
path = with pkgs; [
|
||||
remarshal
|
||||
exiftool
|
||||
gitPackage
|
||||
git
|
||||
gnutar
|
||||
gzip
|
||||
openssh
|
||||
@@ -1654,17 +1616,16 @@ in {
|
||||
"gitlab-config.service"
|
||||
"gitlab-db-config.service"
|
||||
] ++ optional (cfg.databaseHost == "") "postgresql.service";
|
||||
requiredBy = [ "gitlab.target" ];
|
||||
wantedBy = [ "gitlab.target" ];
|
||||
partOf = [ "gitlab.target" ];
|
||||
environment = gitlabEnv;
|
||||
path = with pkgs; [
|
||||
postgresqlPackage
|
||||
gitPackage
|
||||
git
|
||||
openssh
|
||||
nodejs
|
||||
procps
|
||||
gnupg
|
||||
gzip
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "notify";
|
||||
@@ -1674,7 +1635,7 @@ in {
|
||||
Restart = "on-failure";
|
||||
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
||||
ExecStart = concatStringsSep " " [
|
||||
"${cfg.packages.gitlab.rubyEnv}/bin/bundle" "exec" "puma"
|
||||
"${cfg.packages.gitlab.rubyEnv}/bin/puma"
|
||||
"-e production"
|
||||
"-C ${cfg.statePath}/config/puma.rb"
|
||||
"-w ${cfg.puma.workers}"
|
||||
|
||||
@@ -91,30 +91,18 @@ in
|
||||
The package used in the service
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "gollum";
|
||||
description = lib.mdDoc "Specifies the owner of the wiki directory";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "gollum";
|
||||
description = lib.mdDoc "Specifies the owner group of the wiki directory";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users.gollum = mkIf (cfg.user == "gollum") {
|
||||
group = cfg.group;
|
||||
users.users.gollum = {
|
||||
group = config.users.users.gollum.name;
|
||||
description = "Gollum user";
|
||||
createHome = false;
|
||||
isSystemUser = true;
|
||||
};
|
||||
|
||||
users.groups."${cfg.group}" = { };
|
||||
users.groups.gollum = { };
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '${cfg.stateDir}' - ${config.users.users.gollum.name} ${config.users.groups.gollum.name} - -"
|
||||
@@ -132,8 +120,8 @@ in
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
User = config.users.users.gollum.name;
|
||||
Group = config.users.groups.gollum.name;
|
||||
WorkingDirectory = cfg.stateDir;
|
||||
ExecStart = ''
|
||||
${cfg.package}/bin/gollum \
|
||||
|
||||
@@ -46,8 +46,7 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.jellyfin = {
|
||||
description = "Jellyfin Media Server";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# This is mostly follows: https://github.com/jellyfin/jellyfin/blob/master/fedora/jellyfin.service
|
||||
|
||||
@@ -165,14 +165,14 @@ in
|
||||
enableDebug = mkEnableOption (lib.mdDoc "request logs and debug endpoints");
|
||||
|
||||
proxy = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = lib.mdDoc "URL to a HTTP/HTTPS proxy.";
|
||||
};
|
||||
|
||||
proxyAuth = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = lib.mdDoc "Credentials for proxy.";
|
||||
};
|
||||
|
||||
|
||||
837
nixos/modules/services/misc/nix-daemon.nix
Normal file
837
nixos/modules/services/misc/nix-daemon.nix
Normal file
@@ -0,0 +1,837 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.nix;
|
||||
|
||||
nixPackage = cfg.package.out;
|
||||
|
||||
isNixAtLeast = versionAtLeast (getVersion nixPackage);
|
||||
|
||||
makeNixBuildUser = nr: {
|
||||
name = "nixbld${toString nr}";
|
||||
value = {
|
||||
description = "Nix build user ${toString nr}";
|
||||
|
||||
/*
|
||||
For consistency with the setgid(2), setuid(2), and setgroups(2)
|
||||
calls in `libstore/build.cc', don't add any supplementary group
|
||||
here except "nixbld".
|
||||
*/
|
||||
uid = builtins.add config.ids.uids.nixbld nr;
|
||||
isSystemUser = true;
|
||||
group = "nixbld";
|
||||
extraGroups = [ "nixbld" ];
|
||||
};
|
||||
};
|
||||
|
||||
nixbldUsers = listToAttrs (map makeNixBuildUser (range 1 cfg.nrBuildUsers));
|
||||
|
||||
nixConf =
|
||||
assert isNixAtLeast "2.2";
|
||||
let
|
||||
|
||||
mkValueString = v:
|
||||
if v == null then ""
|
||||
else if isInt v then toString v
|
||||
else if isBool v then boolToString v
|
||||
else if isFloat v then floatToString v
|
||||
else if isList v then toString v
|
||||
else if isDerivation v then toString v
|
||||
else if builtins.isPath v then toString v
|
||||
else if isString v then v
|
||||
else if strings.isConvertibleWithToString v then toString v
|
||||
else abort "The nix conf value: ${toPretty {} v} can not be encoded";
|
||||
|
||||
mkKeyValue = k: v: "${escape [ "=" ] k} = ${mkValueString v}";
|
||||
|
||||
mkKeyValuePairs = attrs: concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs);
|
||||
|
||||
in
|
||||
pkgs.writeTextFile {
|
||||
name = "nix.conf";
|
||||
text = ''
|
||||
# WARNING: this file is generated from the nix.* options in
|
||||
# your NixOS configuration, typically
|
||||
# /etc/nixos/configuration.nix. Do not edit it!
|
||||
${mkKeyValuePairs cfg.settings}
|
||||
${cfg.extraOptions}
|
||||
'';
|
||||
checkPhase = lib.optionalString cfg.checkConfig (
|
||||
if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then ''
|
||||
echo "Ignoring validation for cross-compilation"
|
||||
''
|
||||
else ''
|
||||
echo "Validating generated nix.conf"
|
||||
ln -s $out ./nix.conf
|
||||
set -e
|
||||
set +o pipefail
|
||||
NIX_CONF_DIR=$PWD \
|
||||
${cfg.package}/bin/nix show-config ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \
|
||||
${optionalString (isNixAtLeast "2.4pre") "--option experimental-features nix-command"} \
|
||||
|& sed -e 's/^warning:/error:/' \
|
||||
| (! grep '${if cfg.checkAllErrors then "^error:" else "^error: unknown setting"}')
|
||||
set -o pipefail
|
||||
'');
|
||||
};
|
||||
|
||||
legacyConfMappings = {
|
||||
useSandbox = "sandbox";
|
||||
buildCores = "cores";
|
||||
maxJobs = "max-jobs";
|
||||
sandboxPaths = "extra-sandbox-paths";
|
||||
binaryCaches = "substituters";
|
||||
trustedBinaryCaches = "trusted-substituters";
|
||||
binaryCachePublicKeys = "trusted-public-keys";
|
||||
autoOptimiseStore = "auto-optimise-store";
|
||||
requireSignedBinaryCaches = "require-sigs";
|
||||
trustedUsers = "trusted-users";
|
||||
allowedUsers = "allowed-users";
|
||||
systemFeatures = "system-features";
|
||||
};
|
||||
|
||||
semanticConfType = with types;
|
||||
let
|
||||
confAtom = nullOr
|
||||
(oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
path
|
||||
package
|
||||
]) // {
|
||||
description = "Nix config atom (null, bool, int, float, str, path or package)";
|
||||
};
|
||||
in
|
||||
attrsOf (either confAtom (listOf confAtom));
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
(mkRenamedOptionModuleWith { sinceRelease = 2003; from = [ "nix" "useChroot" ]; to = [ "nix" "useSandbox" ]; })
|
||||
(mkRenamedOptionModuleWith { sinceRelease = 2003; from = [ "nix" "chrootDirs" ]; to = [ "nix" "sandboxPaths" ]; })
|
||||
(mkRenamedOptionModuleWith { sinceRelease = 2205; from = [ "nix" "daemonIONiceLevel" ]; to = [ "nix" "daemonIOSchedPriority" ]; })
|
||||
(mkRenamedOptionModuleWith { sinceRelease = 2211; from = [ "nix" "readOnlyStore" ]; to = [ "boot" "readOnlyNixStore" ]; })
|
||||
(mkRemovedOptionModule [ "nix" "daemonNiceLevel" ] "Consider nix.daemonCPUSchedPolicy instead.")
|
||||
] ++ mapAttrsToList (oldConf: newConf: mkRenamedOptionModuleWith { sinceRelease = 2205; from = [ "nix" oldConf ]; to = [ "nix" "settings" newConf ]; }) legacyConfMappings;
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
nix = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
Whether to enable Nix.
|
||||
Disabling Nix makes the system hard to modify and the Nix programs and configuration will not be made available by NixOS itself.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.nix;
|
||||
defaultText = literalExpression "pkgs.nix";
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the Nix package instance to use throughout the system.
|
||||
'';
|
||||
};
|
||||
|
||||
distributedBuilds = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Whether to distribute builds to the machines listed in
|
||||
{option}`nix.buildMachines`.
|
||||
'';
|
||||
};
|
||||
|
||||
daemonCPUSchedPolicy = mkOption {
|
||||
type = types.enum [ "other" "batch" "idle" ];
|
||||
default = "other";
|
||||
example = "batch";
|
||||
description = lib.mdDoc ''
|
||||
Nix daemon process CPU scheduling policy. This policy propagates to
|
||||
build processes. `other` is the default scheduling
|
||||
policy for regular tasks. The `batch` policy is
|
||||
similar to `other`, but optimised for
|
||||
non-interactive tasks. `idle` is for extremely
|
||||
low-priority tasks that should only be run when no other task
|
||||
requires CPU time.
|
||||
|
||||
Please note that while using the `idle` policy may
|
||||
greatly improve responsiveness of a system performing expensive
|
||||
builds, it may also slow down and potentially starve crucial
|
||||
configuration updates during load.
|
||||
|
||||
`idle` may therefore be a sensible policy for
|
||||
systems that experience only intermittent phases of high CPU load,
|
||||
such as desktop or portable computers used interactively. Other
|
||||
systems should use the `other` or
|
||||
`batch` policy instead.
|
||||
|
||||
For more fine-grained resource control, please refer to
|
||||
{manpage}`systemd.resource-control(5)` and adjust
|
||||
{option}`systemd.services.nix-daemon` directly.
|
||||
'';
|
||||
};
|
||||
|
||||
daemonIOSchedClass = mkOption {
|
||||
type = types.enum [ "best-effort" "idle" ];
|
||||
default = "best-effort";
|
||||
example = "idle";
|
||||
description = lib.mdDoc ''
|
||||
Nix daemon process I/O scheduling class. This class propagates to
|
||||
build processes. `best-effort` is the default
|
||||
class for regular tasks. The `idle` class is for
|
||||
extremely low-priority tasks that should only perform I/O when no
|
||||
other task does.
|
||||
|
||||
Please note that while using the `idle` scheduling
|
||||
class can improve responsiveness of a system performing expensive
|
||||
builds, it might also slow down or starve crucial configuration
|
||||
updates during load.
|
||||
|
||||
`idle` may therefore be a sensible class for
|
||||
systems that experience only intermittent phases of high I/O load,
|
||||
such as desktop or portable computers used interactively. Other
|
||||
systems should use the `best-effort` class.
|
||||
'';
|
||||
};
|
||||
|
||||
daemonIOSchedPriority = mkOption {
|
||||
type = types.int;
|
||||
default = 4;
|
||||
example = 1;
|
||||
description = lib.mdDoc ''
|
||||
Nix daemon process I/O scheduling priority. This priority propagates
|
||||
to build processes. The supported priorities depend on the
|
||||
scheduling policy: With idle, priorities are not used in scheduling
|
||||
decisions. best-effort supports values in the range 0 (high) to 7
|
||||
(low).
|
||||
'';
|
||||
};
|
||||
|
||||
buildMachines = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
options = {
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
example = "nixbuilder.example.org";
|
||||
description = lib.mdDoc ''
|
||||
The hostname of the build machine.
|
||||
'';
|
||||
};
|
||||
protocol = mkOption {
|
||||
type = types.enum [ null "ssh" "ssh-ng" ];
|
||||
default = "ssh";
|
||||
example = "ssh-ng";
|
||||
description = lib.mdDoc ''
|
||||
The protocol used for communicating with the build machine.
|
||||
Use `ssh-ng` if your remote builder and your
|
||||
local Nix version support that improved protocol.
|
||||
|
||||
Use `null` when trying to change the special localhost builder
|
||||
without a protocol which is for example used by hydra.
|
||||
'';
|
||||
};
|
||||
system = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "x86_64-linux";
|
||||
description = lib.mdDoc ''
|
||||
The system type the build machine can execute derivations on.
|
||||
Either this attribute or {var}`systems` must be
|
||||
present, where {var}`system` takes precedence if
|
||||
both are set.
|
||||
'';
|
||||
};
|
||||
systems = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "x86_64-linux" "aarch64-linux" ];
|
||||
description = lib.mdDoc ''
|
||||
The system types the build machine can execute derivations on.
|
||||
Either this attribute or {var}`system` must be
|
||||
present, where {var}`system` takes precedence if
|
||||
both are set.
|
||||
'';
|
||||
};
|
||||
sshUser = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "builder";
|
||||
description = lib.mdDoc ''
|
||||
The username to log in as on the remote host. This user must be
|
||||
able to log in and run nix commands non-interactively. It must
|
||||
also be privileged to build derivations, so must be included in
|
||||
{option}`nix.settings.trusted-users`.
|
||||
'';
|
||||
};
|
||||
sshKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "/root/.ssh/id_buildhost_builduser";
|
||||
description = lib.mdDoc ''
|
||||
The path to the SSH private key with which to authenticate on
|
||||
the build machine. The private key must not have a passphrase.
|
||||
If null, the building user (root on NixOS machines) must have an
|
||||
appropriate ssh configuration to log in non-interactively.
|
||||
|
||||
Note that for security reasons, this path must point to a file
|
||||
in the local filesystem, *not* to the nix store.
|
||||
'';
|
||||
};
|
||||
maxJobs = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = lib.mdDoc ''
|
||||
The number of concurrent jobs the build machine supports. The
|
||||
build machine will enforce its own limits, but this allows hydra
|
||||
to schedule better since there is no work-stealing between build
|
||||
machines.
|
||||
'';
|
||||
};
|
||||
speedFactor = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = lib.mdDoc ''
|
||||
The relative speed of this builder. This is an arbitrary integer
|
||||
that indicates the speed of this builder, relative to other
|
||||
builders. Higher is faster.
|
||||
'';
|
||||
};
|
||||
mandatoryFeatures = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "big-parallel" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of features mandatory for this builder. The builder will
|
||||
be ignored for derivations that don't require all features in
|
||||
this list. All mandatory features are automatically included in
|
||||
{var}`supportedFeatures`.
|
||||
'';
|
||||
};
|
||||
supportedFeatures = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "kvm" "big-parallel" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of features supported by this builder. The builder will
|
||||
be ignored for derivations that require features not in this
|
||||
list.
|
||||
'';
|
||||
};
|
||||
publicHostKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
The (base64-encoded) public host key of this builder. The field
|
||||
is calculated via {command}`base64 -w0 /etc/ssh/ssh_host_type_key.pub`.
|
||||
If null, SSH will use its regular known-hosts file when connecting.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [ ];
|
||||
description = lib.mdDoc ''
|
||||
This option lists the machines to be used if distributed builds are
|
||||
enabled (see {option}`nix.distributedBuilds`).
|
||||
Nix will perform derivations on those machines via SSH by copying the
|
||||
inputs to the Nix store on the remote machine, starting the build,
|
||||
then copying the output back to the local Nix store.
|
||||
'';
|
||||
};
|
||||
|
||||
# Environment variables for running Nix.
|
||||
envVars = mkOption {
|
||||
type = types.attrs;
|
||||
internal = true;
|
||||
default = { };
|
||||
description = lib.mdDoc "Environment variables used by Nix.";
|
||||
};
|
||||
|
||||
nrBuildUsers = mkOption {
|
||||
type = types.int;
|
||||
description = lib.mdDoc ''
|
||||
Number of `nixbld` user accounts created to
|
||||
perform secure concurrent builds. If you receive an error
|
||||
message saying that “all build users are currently in use”,
|
||||
you should increase this value.
|
||||
'';
|
||||
};
|
||||
|
||||
nixPath = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
|
||||
"nixos-config=/etc/nixos/configuration.nix"
|
||||
"/nix/var/nix/profiles/per-user/root/channels"
|
||||
];
|
||||
description = lib.mdDoc ''
|
||||
The default Nix expression search path, used by the Nix
|
||||
evaluator to look up paths enclosed in angle brackets
|
||||
(e.g. `<nixpkgs>`).
|
||||
'';
|
||||
};
|
||||
|
||||
checkConfig = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If enabled, checks that Nix can parse the generated nix.conf.
|
||||
'';
|
||||
};
|
||||
|
||||
checkAllErrors = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If enabled, checks the nix.conf parsing for any kind of error. When disabled, checks only for unknown settings.
|
||||
'';
|
||||
};
|
||||
|
||||
registry = mkOption {
|
||||
type = types.attrsOf (types.submodule (
|
||||
let
|
||||
referenceAttrs = with types; attrsOf (oneOf [
|
||||
str
|
||||
int
|
||||
bool
|
||||
path
|
||||
package
|
||||
]);
|
||||
in
|
||||
{ config, name, ... }:
|
||||
{
|
||||
options = {
|
||||
from = mkOption {
|
||||
type = referenceAttrs;
|
||||
example = { type = "indirect"; id = "nixpkgs"; };
|
||||
description = lib.mdDoc "The flake reference to be rewritten.";
|
||||
};
|
||||
to = mkOption {
|
||||
type = referenceAttrs;
|
||||
example = { type = "github"; owner = "my-org"; repo = "my-nixpkgs"; };
|
||||
description = lib.mdDoc "The flake reference {option}`from` is rewritten to.";
|
||||
};
|
||||
flake = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
example = literalExpression "nixpkgs";
|
||||
description = lib.mdDoc ''
|
||||
The flake input {option}`from` is rewritten to.
|
||||
'';
|
||||
};
|
||||
exact = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
Whether the {option}`from` reference needs to match exactly. If set,
|
||||
a {option}`from` reference like `nixpkgs` does not
|
||||
match with a reference like `nixpkgs/nixos-20.03`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
from = mkDefault { type = "indirect"; id = name; };
|
||||
to = mkIf (config.flake != null) (mkDefault (
|
||||
{
|
||||
type = "path";
|
||||
path = config.flake.outPath;
|
||||
} // filterAttrs
|
||||
(n: _: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash")
|
||||
config.flake
|
||||
));
|
||||
};
|
||||
}
|
||||
));
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
A system-wide flake registry.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
description = lib.mdDoc "Additional text appended to {file}`nix.conf`.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = semanticConfType;
|
||||
|
||||
options = {
|
||||
max-jobs = mkOption {
|
||||
type = types.either types.int (types.enum [ "auto" ]);
|
||||
default = "auto";
|
||||
example = 64;
|
||||
description = lib.mdDoc ''
|
||||
This option defines the maximum number of jobs that Nix will try to
|
||||
build in parallel. The default is auto, which means it will use all
|
||||
available logical cores. It is recommend to set it to the total
|
||||
number of logical cores in your system (e.g., 16 for two CPUs with 4
|
||||
cores each and hyper-threading).
|
||||
'';
|
||||
};
|
||||
|
||||
auto-optimise-store = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = lib.mdDoc ''
|
||||
If set to true, Nix automatically detects files in the store that have
|
||||
identical contents, and replaces them with hard links to a single copy.
|
||||
This saves disk space. If set to false (the default), you can still run
|
||||
nix-store --optimise to get rid of duplicate files.
|
||||
'';
|
||||
};
|
||||
|
||||
cores = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
example = 64;
|
||||
description = lib.mdDoc ''
|
||||
This option defines the maximum number of concurrent tasks during
|
||||
one build. It affects, e.g., -j option for make.
|
||||
The special value 0 means that the builder should use all
|
||||
available CPU cores in the system. Some builds may become
|
||||
non-deterministic with this option; use with care! Packages will
|
||||
only be affected if enableParallelBuilding is set for them.
|
||||
'';
|
||||
};
|
||||
|
||||
sandbox = mkOption {
|
||||
type = types.either types.bool (types.enum [ "relaxed" ]);
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If set, Nix will perform builds in a sandboxed environment that it
|
||||
will set up automatically for each build. This prevents impurities
|
||||
in builds by disallowing access to dependencies outside of the Nix
|
||||
store by using network and mount namespaces in a chroot environment.
|
||||
This is enabled by default even though it has a possible performance
|
||||
impact due to the initial setup time of a sandbox for each build. It
|
||||
doesn't affect derivation hashes, so changing this option will not
|
||||
trigger a rebuild of packages.
|
||||
'';
|
||||
};
|
||||
|
||||
extra-sandbox-paths = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "/dev" "/proc" ];
|
||||
description = lib.mdDoc ''
|
||||
Directories from the host filesystem to be included
|
||||
in the sandbox.
|
||||
'';
|
||||
};
|
||||
|
||||
substituters = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = lib.mdDoc ''
|
||||
List of binary cache URLs used to obtain pre-built binaries
|
||||
of Nix packages.
|
||||
|
||||
By default https://cache.nixos.org/ is added.
|
||||
'';
|
||||
};
|
||||
|
||||
trusted-substituters = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "https://hydra.nixos.org/" ];
|
||||
description = lib.mdDoc ''
|
||||
List of binary cache URLs that non-root users can use (in
|
||||
addition to those specified using
|
||||
{option}`nix.settings.substituters`) by passing
|
||||
`--option binary-caches` to Nix commands.
|
||||
'';
|
||||
};
|
||||
|
||||
require-sigs = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = lib.mdDoc ''
|
||||
If enabled (the default), Nix will only download binaries from binary caches if
|
||||
they are cryptographically signed with any of the keys listed in
|
||||
{option}`nix.settings.trusted-public-keys`. If disabled, signatures are neither
|
||||
required nor checked, so it's strongly recommended that you use only
|
||||
trustworthy caches and https to prevent man-in-the-middle attacks.
|
||||
'';
|
||||
};
|
||||
|
||||
trusted-public-keys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [ "hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" ];
|
||||
description = lib.mdDoc ''
|
||||
List of public keys used to sign binary caches. If
|
||||
{option}`nix.settings.trusted-public-keys` is enabled,
|
||||
then Nix will use a binary from a binary cache if and only
|
||||
if it is signed by *any* of the keys
|
||||
listed here. By default, only the key for
|
||||
`cache.nixos.org` is included.
|
||||
'';
|
||||
};
|
||||
|
||||
trusted-users = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "root" ];
|
||||
example = [ "root" "alice" "@wheel" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of names of users that have additional rights when
|
||||
connecting to the Nix daemon, such as the ability to specify
|
||||
additional binary caches, or to import unsigned NARs. You
|
||||
can also specify groups by prefixing them with
|
||||
`@`; for instance,
|
||||
`@wheel` means all users in the wheel
|
||||
group.
|
||||
'';
|
||||
};
|
||||
|
||||
system-features = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [ "kvm" "big-parallel" "gccarch-skylake" ];
|
||||
description = lib.mdDoc ''
|
||||
The set of features supported by the machine. Derivations
|
||||
can express dependencies on system features through the
|
||||
`requiredSystemFeatures` attribute.
|
||||
|
||||
By default, pseudo-features `nixos-test`, `benchmark`,
|
||||
and `big-parallel` used in Nixpkgs are set, `kvm`
|
||||
is also included if it is available.
|
||||
'';
|
||||
};
|
||||
|
||||
allowed-users = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "*" ];
|
||||
example = [ "@wheel" "@builders" "alice" "bob" ];
|
||||
description = lib.mdDoc ''
|
||||
A list of names of users (separated by whitespace) that are
|
||||
allowed to connect to the Nix daemon. As with
|
||||
{option}`nix.settings.trusted-users`, you can specify groups by
|
||||
prefixing them with `@`. Also, you can
|
||||
allow all users by specifying `*`. The
|
||||
default is `*`. Note that trusted users are
|
||||
always allowed to connect.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
use-sandbox = true;
|
||||
show-trace = true;
|
||||
|
||||
system-features = [ "big-parallel" "kvm" "recursive-nix" ];
|
||||
sandbox-paths = { "/bin/sh" = "''${pkgs.busybox-sandbox-shell.out}/bin/busybox"; };
|
||||
}
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Configuration for Nix, see
|
||||
<https://nixos.org/manual/nix/stable/#sec-conf-file> or
|
||||
{manpage}`nix.conf(5)` for available options.
|
||||
The value declared here will be translated directly to the key-value pairs Nix expects.
|
||||
|
||||
You can use {command}`nix-instantiate --eval --strict '<nixpkgs/nixos>' -A config.nix.settings`
|
||||
to view the current value. By default it is empty.
|
||||
|
||||
Nix configurations defined under {option}`nix.*` will be translated and applied to this
|
||||
option. In addition, configuration specified in {option}`nix.extraOptions` which will be appended
|
||||
verbatim to the resulting config file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages =
|
||||
[
|
||||
nixPackage
|
||||
pkgs.nix-info
|
||||
]
|
||||
++ optional (config.programs.bash.enableCompletion) pkgs.nix-bash-completions;
|
||||
|
||||
environment.etc."nix/nix.conf".source = nixConf;
|
||||
|
||||
environment.etc."nix/registry.json".text = builtins.toJSON {
|
||||
version = 2;
|
||||
flakes = mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry;
|
||||
};
|
||||
|
||||
# List of machines for distributed Nix builds in the format
|
||||
# expected by build-remote.pl.
|
||||
environment.etc."nix/machines" = mkIf (cfg.buildMachines != [ ]) {
|
||||
text =
|
||||
concatMapStrings
|
||||
(machine:
|
||||
(concatStringsSep " " ([
|
||||
"${optionalString (machine.protocol != null) "${machine.protocol}://"}${optionalString (machine.sshUser != null) "${machine.sshUser}@"}${machine.hostName}"
|
||||
(if machine.system != null then machine.system else if machine.systems != [ ] then concatStringsSep "," machine.systems else "-")
|
||||
(if machine.sshKey != null then machine.sshKey else "-")
|
||||
(toString machine.maxJobs)
|
||||
(toString machine.speedFactor)
|
||||
(let res = (machine.supportedFeatures ++ machine.mandatoryFeatures);
|
||||
in if (res == []) then "-" else (concatStringsSep "," res))
|
||||
(let res = machine.mandatoryFeatures;
|
||||
in if (res == []) then "-" else (concatStringsSep "," machine.mandatoryFeatures))
|
||||
]
|
||||
++ optional (isNixAtLeast "2.4pre") (if machine.publicHostKey != null then machine.publicHostKey else "-")))
|
||||
+ "\n"
|
||||
)
|
||||
cfg.buildMachines;
|
||||
};
|
||||
|
||||
assertions =
|
||||
let badMachine = m: m.system == null && m.systems == [ ];
|
||||
in
|
||||
[
|
||||
{
|
||||
assertion = !(any badMachine cfg.buildMachines);
|
||||
message = ''
|
||||
At least one system type (via <varname>system</varname> or
|
||||
<varname>systems</varname>) must be set for every build machine.
|
||||
Invalid machine specifications:
|
||||
'' + " " +
|
||||
(concatStringsSep "\n "
|
||||
(map (m: m.hostName)
|
||||
(filter (badMachine) cfg.buildMachines)));
|
||||
}
|
||||
];
|
||||
|
||||
systemd.packages = [ nixPackage ];
|
||||
|
||||
# Will only work once https://github.com/NixOS/nix/pull/6285 is merged
|
||||
# systemd.tmpfiles.packages = [ nixPackage ];
|
||||
|
||||
# Can be dropped for Nix > https://github.com/NixOS/nix/pull/6285
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /nix/var/nix/daemon-socket 0755 root root - -"
|
||||
];
|
||||
|
||||
systemd.sockets.nix-daemon.wantedBy = [ "sockets.target" ];
|
||||
|
||||
systemd.services.nix-daemon =
|
||||
{
|
||||
path = [ nixPackage pkgs.util-linux config.programs.ssh.package ]
|
||||
++ optionals cfg.distributedBuilds [ pkgs.gzip ];
|
||||
|
||||
environment = cfg.envVars
|
||||
// { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; }
|
||||
// config.networking.proxy.envVars;
|
||||
|
||||
unitConfig.RequiresMountsFor = "/nix/store";
|
||||
|
||||
serviceConfig =
|
||||
{
|
||||
CPUSchedulingPolicy = cfg.daemonCPUSchedPolicy;
|
||||
IOSchedulingClass = cfg.daemonIOSchedClass;
|
||||
IOSchedulingPriority = cfg.daemonIOSchedPriority;
|
||||
LimitNOFILE = 1048576;
|
||||
};
|
||||
|
||||
restartTriggers = [ nixConf ];
|
||||
|
||||
# `stopIfChanged = false` changes to switch behavior
|
||||
# from stop -> update units -> start
|
||||
# to update units -> restart
|
||||
#
|
||||
# The `stopIfChanged` setting therefore controls a trade-off between a
|
||||
# more predictable lifecycle, which runs the correct "version" of
|
||||
# the `ExecStop` line, and on the other hand the availability of
|
||||
# sockets during the switch, as the effectiveness of the stop operation
|
||||
# depends on the socket being stopped as well.
|
||||
#
|
||||
# As `nix-daemon.service` does not make use of `ExecStop`, we prefer
|
||||
# to keep the socket up and available. This is important for machines
|
||||
# that run Nix-based services, such as automated build, test, and deploy
|
||||
# services, that expect the daemon socket to be available at all times.
|
||||
#
|
||||
# Notably, the Nix client does not retry on failure to connect to the
|
||||
# daemon socket, and the in-process RemoteStore instance will disable
|
||||
# itself. This makes retries infeasible even for services that are
|
||||
# aware of the issue. Failure to connect can affect not only new client
|
||||
# processes, but also new RemoteStore instances in existing processes,
|
||||
# as well as existing RemoteStore instances that have not saturated
|
||||
# their connection pool.
|
||||
#
|
||||
# Also note that `stopIfChanged = true` does not kill existing
|
||||
# connection handling daemons, as one might wish to happen before a
|
||||
# breaking Nix upgrade (which is rare). The daemon forks that handle
|
||||
# the individual connections split off into their own sessions, causing
|
||||
# them not to be stopped by systemd.
|
||||
# If a Nix upgrade does require all existing daemon processes to stop,
|
||||
# nix-daemon must do so on its own accord, and only when the new version
|
||||
# starts and detects that Nix's persistent state needs an upgrade.
|
||||
stopIfChanged = false;
|
||||
|
||||
};
|
||||
|
||||
# Set up the environment variables for running Nix.
|
||||
environment.sessionVariables = cfg.envVars // { NIX_PATH = cfg.nixPath; };
|
||||
|
||||
environment.extraInit =
|
||||
''
|
||||
if [ -e "$HOME/.nix-defexpr/channels" ]; then
|
||||
export NIX_PATH="$HOME/.nix-defexpr/channels''${NIX_PATH:+:$NIX_PATH}"
|
||||
fi
|
||||
'';
|
||||
|
||||
nix.nrBuildUsers = mkDefault (
|
||||
if cfg.settings.auto-allocate-uids or false then 0
|
||||
else max 32 (if cfg.settings.max-jobs == "auto" then 0 else cfg.settings.max-jobs)
|
||||
);
|
||||
|
||||
users.users = nixbldUsers;
|
||||
|
||||
services.xserver.displayManager.hiddenUsers = attrNames nixbldUsers;
|
||||
|
||||
system.activationScripts.nix = stringAfter [ "etc" "users" ]
|
||||
''
|
||||
install -m 0755 -d /nix/var/nix/{gcroots,profiles}/per-user
|
||||
|
||||
# Subscribe the root user to the NixOS channel by default.
|
||||
if [ ! -e "/root/.nix-channels" ]; then
|
||||
echo "${config.system.defaultChannel} nixos" > "/root/.nix-channels"
|
||||
fi
|
||||
'';
|
||||
|
||||
# Legacy configuration conversion.
|
||||
nix.settings = mkMerge [
|
||||
{
|
||||
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
|
||||
substituters = mkAfter [ "https://cache.nixos.org/" ];
|
||||
|
||||
system-features = mkDefault (
|
||||
[ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++
|
||||
optionals (pkgs.stdenv.hostPlatform ? gcc.arch) (
|
||||
# a builder can run code for `gcc.arch` and inferior architectures
|
||||
[ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ] ++
|
||||
map (x: "gccarch-${x}") (systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
(mkIf (!cfg.distributedBuilds) { builders = null; })
|
||||
|
||||
(mkIf (isNixAtLeast "2.3pre") { sandbox-fallback = false; })
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -26,11 +26,14 @@ let
|
||||
lib.mapAttrs (_: toString) cfg.extraConfig
|
||||
);
|
||||
|
||||
manage = pkgs.writeShellScript "manage" ''
|
||||
set -o allexport # Export the following env vars
|
||||
${lib.toShellVars env}
|
||||
exec ${pkg}/bin/paperless-ngx "$@"
|
||||
'';
|
||||
manage =
|
||||
let
|
||||
setupEnv = lib.concatStringsSep "\n" (mapAttrsToList (name: val: "export ${name}=\"${val}\"") env);
|
||||
in
|
||||
pkgs.writeShellScript "manage" ''
|
||||
${setupEnv}
|
||||
exec ${pkg}/bin/paperless-ngx "$@"
|
||||
'';
|
||||
|
||||
# Secure the services
|
||||
defaultServiceConfig = {
|
||||
@@ -41,8 +44,6 @@ let
|
||||
"-/etc/nsswitch.conf"
|
||||
"-/etc/hosts"
|
||||
"-/etc/localtime"
|
||||
"-/etc/ssl/certs"
|
||||
"-/etc/static/ssl/certs"
|
||||
"-/run/postgresql"
|
||||
] ++ (optional enableRedis redisServer.unixSocket);
|
||||
BindPaths = [
|
||||
@@ -85,7 +86,8 @@ let
|
||||
SupplementaryGroups = optional enableRedis redisServer.user;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [ "@system-service" "~@privileged @setuid @keyring" ];
|
||||
UMask = "0066";
|
||||
# Does not work well with the temporary root
|
||||
#UMask = "0066";
|
||||
};
|
||||
in
|
||||
{
|
||||
@@ -171,7 +173,6 @@ in
|
||||
description = lib.mdDoc "Web interface port.";
|
||||
};
|
||||
|
||||
# FIXME this should become an RFC42-style settings attr
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
@@ -180,23 +181,11 @@ in
|
||||
|
||||
See [the documentation](https://paperless-ngx.readthedocs.io/en/latest/configuration.html)
|
||||
for available options.
|
||||
|
||||
Note that some options such as `PAPERLESS_CONSUMER_IGNORE_PATTERN` expect JSON values. Use `builtins.toJSON` to ensure proper quoting.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
||||
|
||||
PAPERLESS_DBHOST = "/run/postgresql";
|
||||
|
||||
PAPERLESS_CONSUMER_IGNORE_PATTERN = builtins.toJSON [ ".DS_STORE/*" "desktop.ini" ];
|
||||
|
||||
PAPERLESS_OCR_USER_ARGS = builtins.toJSON {
|
||||
optimize = 1;
|
||||
pdfa_image_compression = "lossless";
|
||||
};
|
||||
};
|
||||
'';
|
||||
example = {
|
||||
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
||||
PAPERLESS_DBHOST = "/run/postgresql";
|
||||
};
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
|
||||
@@ -19,7 +19,7 @@ in
|
||||
services.pufferpanel = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [ bash curl gawk gnutar gzip ];
|
||||
package = pkgs.buildFHSEnv {
|
||||
package = pkgs.buildFHSUserEnv {
|
||||
name = "pufferpanel-fhs";
|
||||
runScript = lib.getExe pkgs.pufferpanel;
|
||||
targetPkgs = pkgs': with pkgs'; [ icu openssl zlib ];
|
||||
@@ -162,7 +162,7 @@ in
|
||||
PrivateUsers = true;
|
||||
PrivateDevices = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictNamespaces = [ "user" "mnt" ]; # allow buildFHSEnv
|
||||
RestrictNamespaces = [ "user" "mnt" ]; # allow buildFHSUserEnv
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
LockPersonality = true;
|
||||
DeviceAllow = [ "" ];
|
||||
|
||||
@@ -135,7 +135,7 @@ in {
|
||||
ExecStart = "${pkgs.sssd}/libexec/sssd/sssd_kcm --uid 0 --gid 0";
|
||||
};
|
||||
restartTriggers = [
|
||||
settingsFileUnsubstituted
|
||||
config.environment.etc."sssd/sssd.conf".source
|
||||
];
|
||||
};
|
||||
systemd.sockets.sssd-kcm = {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,73 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf mkOption types getExe;
|
||||
|
||||
cfg = config.services.opentelemetry-collector;
|
||||
opentelemetry-collector = cfg.package;
|
||||
|
||||
settingsFormat = pkgs.formats.yaml {};
|
||||
in {
|
||||
options.services.opentelemetry-collector = {
|
||||
enable = mkEnableOption (lib.mdDoc "Opentelemetry Collector");
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.opentelemetry-collector;
|
||||
defaultText = lib.literalExpression "pkgs.opentelemetry-collector";
|
||||
description = lib.mdDoc "The opentelemetry-collector package to use.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = {};
|
||||
description = lib.mdDoc ''
|
||||
Specify the configuration for Opentelemetry Collector in Nix.
|
||||
|
||||
See https://opentelemetry.io/docs/collector/configuration/ for available options.
|
||||
'';
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
Specify a path to a configuration file that Opentelemetry Collector should use.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [{
|
||||
assertion = (
|
||||
(cfg.settings == {}) != (cfg.configFile == null)
|
||||
);
|
||||
message = ''
|
||||
Please specify a configuration for Opentelemetry Collector with either
|
||||
'services.opentelemetry-collector.settings' or
|
||||
'services.opentelemetry-collector.configFile'.
|
||||
'';
|
||||
}];
|
||||
|
||||
systemd.services.opentelemetry-collector = {
|
||||
description = "Opentelemetry Collector Service Daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = let
|
||||
conf = if cfg.configFile == null
|
||||
then settingsFormat.generate "config.yaml" cfg.settings
|
||||
else cfg.configFile;
|
||||
in
|
||||
{
|
||||
ExecStart = "${getExe opentelemetry-collector} --config=file:${conf}";
|
||||
DynamicUser = true;
|
||||
Restart = "always";
|
||||
ProtectSystem = "full";
|
||||
DevicePolicy = "closed";
|
||||
NoNewPrivileges = true;
|
||||
WorkingDirectory = "/var/lib/opentelemetry-collector";
|
||||
StateDirectory = "opentelemetry-collector";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -8,7 +8,7 @@ let
|
||||
|
||||
checkedConfig = file:
|
||||
if cfg.checkConfig then
|
||||
pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } ''
|
||||
pkgs.runCommand "checked-config" { buildInputs = [ cfg.package ]; } ''
|
||||
ln -s ${file} $out
|
||||
amtool check-config $out
|
||||
'' else file;
|
||||
|
||||
@@ -31,7 +31,7 @@ let
|
||||
if checkConfigEnabled then
|
||||
pkgs.runCommandLocal
|
||||
"${name}-${replaceStrings [" "] [""] what}-checked"
|
||||
{ nativeBuildInputs = [ cfg.package.cli ]; } ''
|
||||
{ buildInputs = [ cfg.package.cli ]; } ''
|
||||
ln -s ${file} $out
|
||||
promtool ${what} $out
|
||||
'' else file;
|
||||
|
||||
@@ -25,7 +25,7 @@ let
|
||||
checkConfig = file:
|
||||
pkgs.runCommand "checked-blackbox-exporter.conf" {
|
||||
preferLocalBuild = true;
|
||||
nativeBuildInputs = [ pkgs.buildPackages.prometheus-blackbox-exporter ];
|
||||
buildInputs = [ pkgs.buildPackages.prometheus-blackbox-exporter ];
|
||||
} ''
|
||||
ln -s ${coerceConfigFile file} $out
|
||||
blackbox_exporter --config.check --config.file $out
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
{ config, pkgs, lib, ... }: with lib;
|
||||
let
|
||||
cfg = config.services.vmalert;
|
||||
|
||||
format = pkgs.formats.yaml {};
|
||||
|
||||
confOpts = concatStringsSep " \\\n" (mapAttrsToList mkLine (filterAttrs (_: v: v != false) cfg.settings));
|
||||
confType = with types;
|
||||
let
|
||||
valueType = oneOf [ bool int path str ];
|
||||
in
|
||||
attrsOf (either valueType (listOf valueType));
|
||||
|
||||
mkLine = key: value:
|
||||
if value == true then "-${key}"
|
||||
else if isList value then concatMapStringsSep " " (v: "-${key}=${escapeShellArg (toString v)}") value
|
||||
else "-${key}=${escapeShellArg (toString value)}"
|
||||
;
|
||||
in
|
||||
{
|
||||
# interface
|
||||
options.services.vmalert = {
|
||||
enable = mkEnableOption (mdDoc "vmalert");
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.victoriametrics;
|
||||
defaultText = "pkgs.victoriametrics";
|
||||
description = mdDoc ''
|
||||
The VictoriaMetrics derivation to use.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = confType;
|
||||
options = {
|
||||
|
||||
"datasource.url" = mkOption {
|
||||
type = types.nonEmptyStr;
|
||||
example = "http://localhost:8428";
|
||||
description = mdDoc ''
|
||||
Datasource compatible with Prometheus HTTP API.
|
||||
'';
|
||||
};
|
||||
|
||||
"notifier.url" = mkOption {
|
||||
type = with types; listOf nonEmptyStr;
|
||||
default = [];
|
||||
example = [ "http://127.0.0.1:9093" ];
|
||||
description = mdDoc ''
|
||||
Prometheus Alertmanager URL. List all Alertmanager URLs if it runs in the cluster mode to ensure high availability.
|
||||
'';
|
||||
};
|
||||
|
||||
"rule" = mkOption {
|
||||
type = with types; listOf path;
|
||||
description = mdDoc ''
|
||||
Path to the files with alerting and/or recording rules.
|
||||
|
||||
::: {.note}
|
||||
Consider using the {option}`services.vmalert.rules` option as a convenient alternative for declaring rules
|
||||
directly in the `nix` language.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
example = {
|
||||
"datasource.url" = "http://localhost:8428";
|
||||
"datasource.disableKeepAlive" = true;
|
||||
"datasource.showURL" = false;
|
||||
"rule" = [
|
||||
"http://<some-server-addr>/path/to/rules"
|
||||
"dir/*.yaml"
|
||||
];
|
||||
};
|
||||
description = mdDoc ''
|
||||
`vmalert` configuration, passed via command line flags. Refer to
|
||||
<https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmalert/README.md#configuration>
|
||||
for details on supported values.
|
||||
'';
|
||||
};
|
||||
|
||||
rules = mkOption {
|
||||
type = format.type;
|
||||
default = {};
|
||||
example = {
|
||||
group = [
|
||||
{ name = "TestGroup";
|
||||
rules = [
|
||||
{ alert = "ExampleAlertAlwaysFiring";
|
||||
expr = ''
|
||||
sum by(job)
|
||||
(up == 1)
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
description = mdDoc ''
|
||||
A list of the given alerting or recording rules against configured `"datasource.url"` compatible with
|
||||
Prometheus HTTP API for `vmalert` to execute. Refer to
|
||||
<https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmalert/README.md#rules>
|
||||
for details on supported values.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# implementation
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.etc."vmalert/rules.yml".source = format.generate "rules.yml" cfg.rules;
|
||||
|
||||
services.vmalert.settings.rule = [
|
||||
"/etc/vmalert/rules.yml"
|
||||
];
|
||||
|
||||
systemd.services.vmalert = {
|
||||
description = "vmalert service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
reloadTriggers = [ config.environment.etc."vmalert/rules.yml".source ];
|
||||
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${cfg.package}/bin/vmalert ${confOpts}";
|
||||
ExecReload = ''${pkgs.coreutils}/bin/kill -SIGHUP "$MAINPID"'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.fakeroute;
|
||||
routeConf = pkgs.writeText "route.conf" (lib.concatStringsSep "\n" cfg.route);
|
||||
routeConf = pkgs.writeText "route.conf" (concatStringsSep "\n" cfg.route);
|
||||
|
||||
in
|
||||
|
||||
@@ -14,10 +16,16 @@ in
|
||||
|
||||
services.fakeroute = {
|
||||
|
||||
enable = lib.mkEnableOption (lib.mdDoc "the fakeroute service");
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Whether to enable the fakeroute service.
|
||||
'';
|
||||
};
|
||||
|
||||
route = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
route = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = [
|
||||
"216.102.187.130"
|
||||
@@ -38,16 +46,14 @@ in
|
||||
|
||||
###### implementation
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.fakeroute = {
|
||||
description = "Fakeroute Daemon";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
User = "fakeroute";
|
||||
DynamicUser = true;
|
||||
AmbientCapabilities = [ "CAP_NET_RAW" ];
|
||||
User = "root";
|
||||
ExecStart = "${pkgs.fakeroute}/bin/fakeroute -f ${routeConf}";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ this instance, and `url`, which holds the URL under which the sync server can be
|
||||
accessed. The `url` can be configured automatically when using nginx.
|
||||
|
||||
Options that affect the surroundings of the sync server are `enableNginx`,
|
||||
`enableTLS` and `hostname`. If `enableNginx` is set the sync server module will
|
||||
`enableTLS` and `hostnam`. If `enableNginx` is set the sync server module will
|
||||
automatically add an nginx virtual host to the system using `hostname` as the
|
||||
domain and set `url` accordingly. If `enableTLS` is set the module will also
|
||||
enable ACME certificates on the new virtual host and force all connections to
|
||||
|
||||
@@ -224,12 +224,10 @@ in
|
||||
Settings for the sync server. These take priority over values computed
|
||||
from NixOS options.
|
||||
|
||||
See the example config in
|
||||
<https://github.com/mozilla-services/syncstorage-rs/blob/master/config/local.example.toml>
|
||||
and the doc comments on the `Settings` structs in
|
||||
<https://github.com/mozilla-services/syncstorage-rs/blob/master/syncstorage-settings/src/lib.rs>
|
||||
See the doc comments on the `Settings` structs in
|
||||
<https://github.com/mozilla-services/syncstorage-rs/blob/master/syncstorage/src/settings.rs>
|
||||
and
|
||||
<https://github.com/mozilla-services/syncstorage-rs/blob/master/tokenserver-settings/src/lib.rs>
|
||||
<https://github.com/mozilla-services/syncstorage-rs/blob/master/syncstorage/src/tokenserver/settings.rs>
|
||||
for available options.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -42,15 +42,12 @@ let
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = uniq (nullOr path);
|
||||
type = uniq (nullOr types.path);
|
||||
example = "/path/to/file";
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
Specifies the path to a file containing the
|
||||
clear text password for the MQTT user.
|
||||
The file is securely passed to mosquitto by
|
||||
leveraging systemd credentials. No special
|
||||
permissions need to be set on this file.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -67,7 +64,7 @@ let
|
||||
};
|
||||
|
||||
hashedPasswordFile = mkOption {
|
||||
type = uniq (nullOr path);
|
||||
type = uniq (nullOr types.path);
|
||||
example = "/path/to/file";
|
||||
default = null;
|
||||
description = mdDoc ''
|
||||
@@ -76,9 +73,6 @@ let
|
||||
To generate hashed password install the `mosquitto`
|
||||
package and use `mosquitto_passwd`, then remove the
|
||||
`username:` prefix from the generated file.
|
||||
The file is securely passed to mosquitto by
|
||||
leveraging systemd credentials. No special
|
||||
permissions need to be set on this file.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -108,43 +102,15 @@ let
|
||||
message = "Cannot set more than one password option for user ${n} in ${prefix}";
|
||||
}) users;
|
||||
|
||||
listenerScope = index: "listener-${toString index}";
|
||||
userScope = prefix: index: "${prefix}-user-${toString index}";
|
||||
credentialID = prefix: credential: "${prefix}-${credential}";
|
||||
|
||||
toScopedUsers = listenerScope: users: pipe users [
|
||||
attrNames
|
||||
(imap0 (index: user: nameValuePair user
|
||||
(users.${user} // { scope = userScope listenerScope index; })
|
||||
))
|
||||
listToAttrs
|
||||
];
|
||||
|
||||
userCredentials = user: credentials: pipe credentials [
|
||||
(filter (credential: user.${credential} != null))
|
||||
(map (credential: "${credentialID user.scope credential}:${user.${credential}}"))
|
||||
];
|
||||
usersCredentials = listenerScope: users: credentials: pipe users [
|
||||
(toScopedUsers listenerScope)
|
||||
(mapAttrsToList (_: user: userCredentials user credentials))
|
||||
concatLists
|
||||
];
|
||||
systemdCredentials = listeners: listenerCredentials: pipe listeners [
|
||||
(imap0 (index: listener: listenerCredentials (listenerScope index) listener))
|
||||
concatLists
|
||||
];
|
||||
|
||||
makePasswordFile = listenerScope: users: path:
|
||||
makePasswordFile = users: path:
|
||||
let
|
||||
makeLines = store: file: let
|
||||
scopedUsers = toScopedUsers listenerScope users;
|
||||
in
|
||||
makeLines = store: file:
|
||||
mapAttrsToList
|
||||
(name: user: ''addLine ${escapeShellArg name} "''$(systemd-creds cat ${credentialID user.scope store})"'')
|
||||
(filterAttrs (_: user: user.${store} != null) scopedUsers)
|
||||
(n: u: "addLine ${escapeShellArg n} ${escapeShellArg u.${store}}")
|
||||
(filterAttrs (_: u: u.${store} != null) users)
|
||||
++ mapAttrsToList
|
||||
(name: user: ''addFile ${escapeShellArg name} "''${CREDENTIALS_DIRECTORY}/${credentialID user.scope file}"'')
|
||||
(filterAttrs (_: user: user.${file} != null) scopedUsers);
|
||||
(n: u: "addFile ${escapeShellArg n} ${escapeShellArg "${u.${file}}"}")
|
||||
(filterAttrs (_: u: u.${file} != null) users);
|
||||
plainLines = makeLines "password" "passwordFile";
|
||||
hashedLines = makeLines "hashedPassword" "hashedPasswordFile";
|
||||
in
|
||||
@@ -615,19 +581,6 @@ in
|
||||
ExecStart = "${cfg.package}/bin/mosquitto -c ${configFile}";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||
|
||||
# Credentials
|
||||
SetCredential = let
|
||||
listenerCredentials = listenerScope: listener:
|
||||
usersCredentials listenerScope listener.users [ "password" "hashedPassword" ];
|
||||
in
|
||||
systemdCredentials cfg.listeners listenerCredentials;
|
||||
|
||||
LoadCredential = let
|
||||
listenerCredentials = listenerScope: listener:
|
||||
usersCredentials listenerScope listener.users [ "passwordFile" "hashedPasswordFile" ];
|
||||
in
|
||||
systemdCredentials cfg.listeners listenerCredentials;
|
||||
|
||||
# Hardening
|
||||
CapabilityBoundingSet = "";
|
||||
DevicePolicy = "closed";
|
||||
@@ -700,7 +653,7 @@ in
|
||||
concatStringsSep
|
||||
"\n"
|
||||
(imap0
|
||||
(idx: listener: makePasswordFile (listenerScope idx) listener.users "${cfg.dataDir}/passwd-${toString idx}")
|
||||
(idx: listener: makePasswordFile listener.users "${cfg.dataDir}/passwd-${toString idx}")
|
||||
cfg.listeners);
|
||||
};
|
||||
|
||||
|
||||
@@ -8,36 +8,36 @@ let
|
||||
smokepingPidDir = "/run";
|
||||
configFile =
|
||||
if cfg.config == null
|
||||
then
|
||||
''
|
||||
*** General ***
|
||||
cgiurl = ${cfg.cgiUrl}
|
||||
contact = ${cfg.ownerEmail}
|
||||
datadir = ${smokepingHome}/data
|
||||
imgcache = ${smokepingHome}/cache
|
||||
imgurl = ${cfg.imgUrl}
|
||||
linkstyle = ${cfg.linkStyle}
|
||||
${lib.optionalString (cfg.mailHost != "") "mailhost = ${cfg.mailHost}"}
|
||||
owner = ${cfg.owner}
|
||||
pagedir = ${smokepingHome}/cache
|
||||
piddir = ${smokepingPidDir}
|
||||
${lib.optionalString (cfg.sendmail != null) "sendmail = ${cfg.sendmail}"}
|
||||
smokemail = ${cfg.smokeMailTemplate}
|
||||
*** Presentation ***
|
||||
template = ${cfg.presentationTemplate}
|
||||
${cfg.presentationConfig}
|
||||
*** Alerts ***
|
||||
${cfg.alertConfig}
|
||||
*** Database ***
|
||||
${cfg.databaseConfig}
|
||||
*** Probes ***
|
||||
${cfg.probeConfig}
|
||||
*** Targets ***
|
||||
${cfg.targetConfig}
|
||||
${cfg.extraConfig}
|
||||
''
|
||||
else
|
||||
cfg.config;
|
||||
then
|
||||
''
|
||||
*** General ***
|
||||
cgiurl = ${cfg.cgiUrl}
|
||||
contact = ${cfg.ownerEmail}
|
||||
datadir = ${smokepingHome}/data
|
||||
imgcache = ${smokepingHome}/cache
|
||||
imgurl = ${cfg.imgUrl}
|
||||
linkstyle = ${cfg.linkStyle}
|
||||
${lib.optionalString (cfg.mailHost != "") "mailhost = ${cfg.mailHost}"}
|
||||
owner = ${cfg.owner}
|
||||
pagedir = ${smokepingHome}/cache
|
||||
piddir = ${smokepingPidDir}
|
||||
${lib.optionalString (cfg.sendmail != null) "sendmail = ${cfg.sendmail}"}
|
||||
smokemail = ${cfg.smokeMailTemplate}
|
||||
*** Presentation ***
|
||||
template = ${cfg.presentationTemplate}
|
||||
${cfg.presentationConfig}
|
||||
*** Alerts ***
|
||||
${cfg.alertConfig}
|
||||
*** Database ***
|
||||
${cfg.databaseConfig}
|
||||
*** Probes ***
|
||||
${cfg.probeConfig}
|
||||
*** Targets ***
|
||||
${cfg.targetConfig}
|
||||
${cfg.extraConfig}
|
||||
''
|
||||
else
|
||||
cfg.config;
|
||||
|
||||
configPath = pkgs.writeText "smokeping.conf" configFile;
|
||||
cgiHome = pkgs.writeScript "smokeping.fcgi" ''
|
||||
@@ -141,7 +141,7 @@ in
|
||||
'';
|
||||
};
|
||||
linkStyle = mkOption {
|
||||
type = types.enum [ "original" "absolute" "relative" ];
|
||||
type = types.enum ["original" "absolute" "relative"];
|
||||
default = "relative";
|
||||
example = "absolute";
|
||||
description = lib.mdDoc "DNS name for the urls generated in the cgi.";
|
||||
@@ -301,8 +301,7 @@ in
|
||||
];
|
||||
security.wrappers = {
|
||||
fping =
|
||||
{
|
||||
setuid = true;
|
||||
{ setuid = true;
|
||||
owner = "root";
|
||||
group = "root";
|
||||
source = "${pkgs.fping}/bin/fping";
|
||||
@@ -340,16 +339,16 @@ in
|
||||
};
|
||||
preStart = ''
|
||||
mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data
|
||||
ln -snf ${cfg.package}/htdocs/css ${smokepingHome}/css
|
||||
ln -snf ${cfg.package}/htdocs/js ${smokepingHome}/js
|
||||
ln -snf ${cgiHome} ${smokepingHome}/smokeping.fcgi
|
||||
ln -sf ${cfg.package}/htdocs/css ${smokepingHome}/css
|
||||
ln -sf ${cfg.package}/htdocs/js ${smokepingHome}/js
|
||||
ln -sf ${cgiHome} ${smokepingHome}/smokeping.fcgi
|
||||
${cfg.package}/bin/smokeping --check --config=${configPath}
|
||||
${cfg.package}/bin/smokeping --static --config=${configPath}
|
||||
'';
|
||||
};
|
||||
systemd.services.thttpd = mkIf cfg.webService {
|
||||
requiredBy = [ "multi-user.target" ];
|
||||
requires = [ "smokeping.service" ];
|
||||
requiredBy = [ "multi-user.target"];
|
||||
requires = [ "smokeping.service"];
|
||||
path = with pkgs; [ bash rrdtool smokeping thttpd ];
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
|
||||
@@ -569,27 +569,12 @@ in
|
||||
'';
|
||||
|
||||
assertions = [{ assertion = if cfg.settings.X11Forwarding then cfgc.setXAuthLocation else true;
|
||||
message = "cannot enable X11 forwarding without setting xauth location";}
|
||||
(let
|
||||
duplicates =
|
||||
# Filter out the groups with more than 1 element
|
||||
lib.filter (l: lib.length l > 1) (
|
||||
# Grab the groups, we don't care about the group identifiers
|
||||
lib.attrValues (
|
||||
# Group the settings that are the same in lower case
|
||||
lib.groupBy lib.strings.toLower (attrNames cfg.settings)
|
||||
)
|
||||
);
|
||||
formattedDuplicates = lib.concatMapStringsSep ", " (dupl: "(${lib.concatStringsSep ", " dupl})") duplicates;
|
||||
in
|
||||
{
|
||||
assertion = lib.length duplicates == 0;
|
||||
message = ''Duplicate sshd config key; does your capitalization match the option's? Duplicate keys: ${formattedDuplicates}'';
|
||||
})]
|
||||
message = "cannot enable X11 forwarding without setting xauth location";}]
|
||||
++ forEach cfg.listenAddresses ({ addr, ... }: {
|
||||
assertion = addr != null;
|
||||
message = "addr must be specified in each listenAddresses entry";
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ let
|
||||
|
||||
# generate the new config by merging with the NixOS config options
|
||||
new_cfg=$(printf '%s\n' "$old_cfg" | ${pkgs.jq}/bin/jq -c '. * {
|
||||
"devices": ('${escapeShellArg (builtins.toJSON devices)}'${optionalString (cfg.devices == {} || ! cfg.overrideDevices) " + .devices"}),
|
||||
"folders": ('${escapeShellArg (builtins.toJSON folders)}'${optionalString (cfg.folders == {} || ! cfg.overrideFolders) " + .folders"})
|
||||
} * '${escapeShellArg (builtins.toJSON cfg.extraOptions)})
|
||||
"devices": (${builtins.toJSON devices}${optionalString (cfg.devices == {} || ! cfg.overrideDevices) " + .devices"}),
|
||||
"folders": (${builtins.toJSON folders}${optionalString (cfg.folders == {} || ! cfg.overrideFolders) " + .folders"})
|
||||
} * ${builtins.toJSON cfg.extraOptions}')
|
||||
|
||||
# send the new config
|
||||
curl -X PUT -d "$new_cfg" ${cfg.guiAddress}/rest/config
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user