Merge branch 'master' into ledger-by-name

This commit is contained in:
Alexis Hildebrandt
2023-11-30 10:28:04 +01:00
2960 changed files with 32317 additions and 28206 deletions
+6
View File
@@ -27,6 +27,12 @@
/lib/asserts.nix @infinisil @Profpatsch
/lib/path.* @infinisil @fricklerhandwerk
/lib/fileset @infinisil
## Libraries / Module system
/lib/modules.nix @infinisil @roberth
/lib/types.nix @infinisil @roberth
/lib/options.nix @infinisil @roberth
/lib/tests/modules.sh @infinisil @roberth
/lib/tests/modules @infinisil @roberth
# Nixpkgs Internals
/default.nix @Ericson2314
+1 -1
View File
@@ -24,7 +24,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](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) (or backporting [23.05 Release notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md))
- [24.05 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) (or backporting [23.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md) and [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) 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
+2 -2
View File
@@ -20,11 +20,11 @@ jobs:
if: github.repository_owner == 'NixOS' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs
uses: korthout/backport-action@v2.1.1
uses: korthout/backport-action@08bafb375e6e9a9a2b53a744b987e5d81a133191 # v2.1.1
with:
# Config README: https://github.com/korthout/backport-action#backport-action
copy_labels_pattern: 'severity:\ssecurity'
+3 -3
View File
@@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest
# we don't limit this action to only NixOS repo since the checks are cheap and useful developer feedback
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: cachix/cachix-action@v12
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
- uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v13
with:
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
name: nixpkgs-ci
+2 -3
View File
@@ -49,7 +49,7 @@ jobs:
exit 1
fi
echo "mergedSha=$mergedSha" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# pull_request_target checks out the base branch by default
ref: ${{ env.mergedSha }}
@@ -61,7 +61,7 @@ jobs:
echo "baseSha=$(git rev-parse HEAD^1)" >> "$GITHUB_ENV"
echo "headSha=$(git rev-parse HEAD^2)" >> "$GITHUB_ENV"
- uses: cachix/install-nix-action@v23
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
- name: Determining channel to use for dependencies
run: |
echo "Determining the preferred channel to use for PR base branch $GITHUB_BASE_REF"
@@ -176,4 +176,3 @@ jobs:
} >> "$GITHUB_STEP_SUMMARY"
exit "$exitCode"
@@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'NixOS'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
with:
# explicitly enable sandbox
extra_nix_config: sandbox = true
+2 -2
View File
@@ -24,11 +24,11 @@ jobs:
- name: print list of changed files
run: |
cat "$HOME/changed_files"
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
with:
# nixpkgs commit is pinned so that it doesn't break
# editorconfig-checker 2.4.0
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4.3.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
+3 -3
View File
@@ -14,15 +14,15 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'NixOS'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
with:
# explicitly enable sandbox
extra_nix_config: sandbox = true
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v13
with:
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
name: nixpkgs-ci
+3 -3
View File
@@ -15,15 +15,15 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'NixOS'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
with:
# explicitly enable sandbox
extra_nix_config: sandbox = true
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v13
with:
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
name: nixpkgs-ci
+3 -3
View File
@@ -44,10 +44,10 @@ jobs:
into: staging-23.11
name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
uses: devmasx/merge-branch@1.4.0
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # 1.4.0
with:
type: now
from_branch: ${{ matrix.pairs.from }}
@@ -55,7 +55,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0
if: ${{ failure() }}
with:
issue-number: 105153
+3 -3
View File
@@ -38,10 +38,10 @@ jobs:
into: staging
name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
uses: devmasx/merge-branch@1.4.0
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # 1.4.0
with:
type: now
from_branch: ${{ matrix.pairs.from }}
@@ -49,7 +49,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0
if: ${{ failure() }}
with:
issue-number: 105153
@@ -16,8 +16,8 @@ jobs:
if: github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 # v24
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: setup
@@ -46,7 +46,7 @@ jobs:
run: |
git clean -f
- name: create PR
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with:
body: |
Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
+1 -1
View File
@@ -360,7 +360,7 @@ See [Nix Channel Status](https://status.nixos.org/) for the current channels and
Here's a brief overview of the main Git branches and what channels they're used for:
- `master`: The main branch, used for the unstable channels such as `nixpkgs-unstable`, `nixos-unstable` and `nixos-unstable-small`.
- `release-YY.MM` (e.g. `release-23.05`): The NixOS release branches, used for the stable channels such as `nixos-23.05`, `nixos-23.05-small` and `nixpkgs-23.05-darwin`.
- `release-YY.MM` (e.g. `release-23.11`): The NixOS release branches, used for the stable channels such as `nixos-23.11`, `nixos-23.11-small` and `nixpkgs-23.11-darwin`.
When a channel is updated, a corresponding Git branch is also updated to point to the corresponding commit.
So e.g. the [`nixpkgs-unstable` branch](https://github.com/nixos/nixpkgs/tree/nixpkgs-unstable) corresponds to the Git commit from the [`nixpkgs-unstable` channel](https://channels.nixos.org/nixpkgs-unstable).
+2 -2
View File
@@ -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 23.11 release](https://hydra.nixos.org/jobset/nixos/release-23.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 23.11 release](https://hydra.nixos.org/job/nixos/release-23.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
+83 -53
View File
@@ -1,74 +1,38 @@
# Nim {#nim}
## Overview {#nim-overview}
The Nim compiler, a builder function, and some packaged libraries are available
in Nixpkgs. Until now each compiler release has been effectively backwards
compatible so only the latest version is available.
## Nim program packages in Nixpkgs {#nim-program-packages-in-nixpkgs}
Nim programs can be built using `nimPackages.buildNimPackage`. In the
case of packages not containing exported library code the attribute
`nimBinOnly` should be set to `true`.
The Nim compiler and a builder function is available.
Nim programs are built using `buildNimPackage` and a lockfile containing Nim dependencies.
The following example shows a Nim program that depends only on Nim libraries:
```nix
{ lib, nimPackages, fetchFromGitHub }:
{ lib, buildNimPackage, fetchFromGitHub }:
nimPackages.buildNimPackage (finalAttrs: {
buildNimPackage { } (finalAttrs: {
pname = "ttop";
version = "1.0.1";
nimBinOnly = true;
version = "1.2.7";
src = fetchFromGitHub {
owner = "inv2004";
repo = "ttop";
rev = "v${finalAttrs.version}";
hash = "sha256-x4Uczksh6p3XX/IMrOFtBxIleVHdAPX9e8n32VAUTC4=";
hash = "sha256-oPdaUqh6eN1X5kAYVvevOndkB/xnQng9QVLX9bu5P5E=";
};
buildInputs = with nimPackages; [ asciigraph illwill parsetoml zippy ];
lockFile = ./lock.json;
})
```
## Nim library packages in Nixpkgs {#nim-library-packages-in-nixpkgs}
Nim libraries can also be built using `nimPackages.buildNimPackage`, but
often the product of a fetcher is sufficient to satisfy a dependency.
The `fetchgit`, `fetchFromGitHub`, and `fetchNimble` functions yield an
output that can be discovered during the `configurePhase` of `buildNimPackage`.
Nim library packages are listed in
[pkgs/top-level/nim-packages.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/nim-packages.nix) and implemented at
[pkgs/development/nim-packages](https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/nim-packages).
The following example shows a Nim library that propagates a dependency on a
non-Nim package:
```nix
{ lib, buildNimPackage, fetchNimble, SDL2 }:
buildNimPackage (finalAttrs: {
pname = "sdl2";
version = "2.0.4";
src = fetchNimble {
inherit (finalAttrs) pname version;
hash = "sha256-Vtcj8goI4zZPQs2TbFoBFlcR5UqDtOldaXSH/+/xULk=";
};
propagatedBuildInputs = [ SDL2 ];
nimFlags = [
"-d:NimblePkgVersion=${finalAttrs.version}"
];
})
```
## `buildNimPackage` parameters {#buildnimpackage-parameters}
All parameters from `stdenv.mkDerivation` function are still supported. The
following are specific to `buildNimPackage`:
The `buildNimPackage` function takes an attrset of parameters that are passed on to `stdenv.mkDerivation`.
* `nimBinOnly ? false`: If `true` then build only the programs listed in
the Nimble file in the packages sources.
The following parameters are specific to `buildNimPackage`:
* `lockFile`: JSON formatted lockfile.
* `nimbleFile`: Specify the Nimble file location of the package being built
rather than discover the file at build-time.
* `nimRelease ? true`: Build the package in *release* mode.
@@ -77,6 +41,72 @@ following are specific to `buildNimPackage`:
Use this to specify defines with arguments in the form of `-d:${name}=${value}`.
* `nimDoc` ? false`: Build and install HTML documentation.
* `buildInputs` ? []: The packages listed here will be searched for `*.nimble`
files which are used to populate the Nim library path. Otherwise the standard
behavior is in effect.
## Lockfiles {#nim-lockfiles}
Nim lockfiles are created with the `nim_lk` utility.
Run `nim_lk` with the source directory as an argument and it will print a lockfile to stdout.
```sh
$ cd nixpkgs
$ nix build -f . ttop.src
$ nix run -f . nim_lk ./result | jq --sort-keys > pkgs/by-name/tt/ttop/lock.json
```
## Lockfile dependency overrides {#nimoverrides}
The `buildNimPackage` function matches the libraries specified by `lockFile` to attrset of override functions that are then applied to the package derivation.
The default overrides are maintained as the top-level `nimOverrides` attrset at `pkgs/top-level/nim-overrides.nix`.
For example, to propagate a dependency on SDL2 for lockfiles that select the Nim `sdl2` library, an overlay is added to the set in the `nim-overrides.nix` file:
```nix
{ lib
/* */
, SDL2
/* */
}:
{
/* */
sdl2 =
lockAttrs:
finalAttrs:
{ buildInputs ? [ ], ... }:
{
buildInputs = buildInputs ++ [ SDL2 ];
};
/* */
}
```
The annotations in the `nim-overrides.nix` set are functions that take three arguments and return a new attrset to be overlayed on the package being built.
- lockAttrs: the attrset for this library from within a lockfile. This can be used to implement library version constraints, such as marking libraries as broken or insecure.
- finalAttrs: the final attrset passed by `buildNimPackage` to `stdenv.mkDerivation`.
- prevAttrs: the attrset produced by initial arguments to `buildNimPackage` and any preceding lockfile overlays.
### Overriding an Nim library override {#nimoverrides-overrides}
The `nimOverrides` attrset makes it possible to modify overrides in a few different ways.
Override a package internal to its definition:
```nix
{ lib, buildNimPackage, nimOverrides, libressl }:
let
buildNimPackage' = buildNimPackage.override {
nimOverrides = nimOverrides.override { openssl = libressl; };
};
in buildNimPackage' (finalAttrs: {
pname = "foo";
# …
})
```
Override a package externally:
```nix
{ pkgs }: {
foo = pkgs.foo.override {
buildNimPackage = pkgs.buildNimPackage.override {
nimOverrides = pkgs.nimOverrides.override { openssl = libressl; };
};
};
}
```
+5 -1
View File
@@ -94,7 +94,11 @@ $ sudo launchctl kickstart -k system/org.nixos.nix-daemon
system = linuxSystem;
modules = [
"${nixpkgs}/nixos/modules/profiles/macos-builder.nix"
{ virtualisation.host.pkgs = pkgs; }
{ virtualisation = {
host.pkgs = pkgs;
darwin-builder.workingDirectory = "/var/lib/darwin-builder";
};
};
];
};
in {
+45 -20
View File
@@ -34,12 +34,20 @@ rec {
default:
# The nested attribute set to select values from
set:
let attr = head attrPath;
let
lenAttrPath = length attrPath;
attrByPath' = n: s: (
if n == lenAttrPath then s
else (
let
attr = elemAt attrPath n;
in
if s ? ${attr} then attrByPath' (n + 1) s.${attr}
else default
)
);
in
if attrPath == [] then set
else if set ? ${attr}
then attrByPath (tail attrPath) default set.${attr}
else default;
attrByPath' 0 set;
/* Return if an attribute from nested attribute set exists.
@@ -58,13 +66,19 @@ rec {
attrPath:
# The nested attribute set to check
e:
let attr = head attrPath;
let
lenAttrPath = length attrPath;
hasAttrByPath' = n: s: (
n == lenAttrPath || (
let
attr = elemAt attrPath n;
in
if s ? ${attr} then hasAttrByPath' (n + 1) s.${attr}
else false
)
);
in
if attrPath == [] then true
else if e ? ${attr}
then hasAttrByPath (tail attrPath) e.${attr}
else false;
hasAttrByPath' 0 e;
/* Create a new attribute set with `value` set at the nested attribute location specified in `attrPath`.
@@ -883,7 +897,10 @@ rec {
recursiveUpdateUntil (path: lhs: rhs: !(isAttrs lhs && isAttrs rhs)) lhs rhs;
/* Returns true if the pattern is contained in the set. False otherwise.
/*
Recurse into every attribute set of the first argument and check that:
- Each attribute path also exists in the second argument.
- If the attribute's value is not a nested attribute set, it must have the same value in the right argument.
Example:
matchAttrs { cpu = {}; } { cpu = { bits = 64; }; }
@@ -895,16 +912,24 @@ rec {
matchAttrs =
# Attribute set structure to match
pattern:
# Attribute set to find patterns in
# Attribute set to check
attrs:
assert isAttrs pattern;
all id (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
let pat = head values; val = elemAt values 1; in
if length values == 1 then false
else if isAttrs pat then isAttrs val && matchAttrs pat val
else pat == val
) [pattern attrs]));
all
( # Compare equality between `pattern` & `attrs`.
attr:
# Missing attr, not equal.
attrs ? ${attr} && (
let
lhs = pattern.${attr};
rhs = attrs.${attr};
in
# If attrset check recursively
if isAttrs lhs then isAttrs rhs && matchAttrs lhs rhs
else lhs == rhs
)
)
(attrNames pattern);
/* Override only the attributes that are already present in the old set
useful for deep-overriding.
+51 -40
View File
@@ -1,5 +1,16 @@
{ lib }:
let
inherit (builtins)
intersectAttrs;
inherit (lib)
functionArgs isFunction mirrorFunctionArgs isAttrs setFunctionArgs levenshteinAtMost
optionalAttrs attrNames levenshtein filter elemAt concatStringsSep sort take length
filterAttrs optionalString flip pathIsDirectory head pipe isDerivation listToAttrs
mapAttrs seq flatten deepSeq warnIf isInOldestRelease extends
;
in
rec {
@@ -43,15 +54,15 @@ rec {
overrideDerivation = drv: f:
let
newDrv = derivation (drv.drvAttrs // (f drv));
in lib.flip (extendDerivation (builtins.seq drv.drvPath true)) newDrv (
in flip (extendDerivation (seq drv.drvPath true)) newDrv (
{ meta = drv.meta or {};
passthru = if drv ? passthru then drv.passthru else {};
}
//
(drv.passthru or {})
//
lib.optionalAttrs (drv ? __spliced) {
__spliced = {} // (lib.mapAttrs (_: sDrv: overrideDerivation sDrv f) drv.__spliced);
optionalAttrs (drv ? __spliced) {
__spliced = {} // (mapAttrs (_: sDrv: overrideDerivation sDrv f) drv.__spliced);
});
@@ -79,30 +90,30 @@ rec {
makeOverridable = f:
let
# Creates a functor with the same arguments as f
mirrorArgs = lib.mirrorFunctionArgs f;
mirrorArgs = mirrorFunctionArgs f;
in
mirrorArgs (origArgs:
let
result = f origArgs;
# Changes the original arguments with (potentially a function that returns) a set of new attributes
overrideWith = newArgs: origArgs // (if lib.isFunction newArgs then newArgs origArgs else newArgs);
overrideWith = newArgs: origArgs // (if isFunction newArgs then newArgs origArgs else newArgs);
# Re-call the function but with different arguments
overrideArgs = mirrorArgs (newArgs: makeOverridable f (overrideWith newArgs));
# Change the result of the function call by applying g to it
overrideResult = g: makeOverridable (mirrorArgs (args: g (f args))) origArgs;
in
if builtins.isAttrs result then
if isAttrs result then
result // {
override = overrideArgs;
overrideDerivation = fdrv: overrideResult (x: overrideDerivation x fdrv);
${if result ? overrideAttrs then "overrideAttrs" else null} = fdrv:
overrideResult (x: x.overrideAttrs fdrv);
}
else if lib.isFunction result then
else if isFunction result then
# Transform the result into a functor while propagating its arguments
lib.setFunctionArgs result (lib.functionArgs result) // {
setFunctionArgs result (functionArgs result) // {
override = overrideArgs;
}
else result);
@@ -140,39 +151,39 @@ rec {
*/
callPackageWith = autoArgs: fn: args:
let
f = if lib.isFunction fn then fn else import fn;
fargs = lib.functionArgs f;
f = if isFunction fn then fn else import fn;
fargs = functionArgs f;
# All arguments that will be passed to the function
# This includes automatic ones and ones passed explicitly
allArgs = builtins.intersectAttrs fargs autoArgs // args;
allArgs = intersectAttrs fargs autoArgs // args;
# a list of argument names that the function requires, but
# wouldn't be passed to it
missingArgs = lib.attrNames
missingArgs =
# Filter out arguments that have a default value
(lib.filterAttrs (name: value: ! value)
(filterAttrs (name: value: ! value)
# Filter out arguments that would be passed
(removeAttrs fargs (lib.attrNames allArgs)));
(removeAttrs fargs (attrNames allArgs)));
# Get a list of suggested argument names for a given missing one
getSuggestions = arg: lib.pipe (autoArgs // args) [
lib.attrNames
getSuggestions = arg: pipe (autoArgs // args) [
attrNames
# Only use ones that are at most 2 edits away. While mork would work,
# levenshteinAtMost is only fast for 2 or less.
(lib.filter (lib.strings.levenshteinAtMost 2 arg))
(filter (levenshteinAtMost 2 arg))
# Put strings with shorter distance first
(lib.sort (x: y: lib.strings.levenshtein x arg < lib.strings.levenshtein y arg))
(sort (x: y: levenshtein x arg < levenshtein y arg))
# Only take the first couple results
(lib.take 3)
(take 3)
# Quote all entries
(map (x: "\"" + x + "\""))
];
prettySuggestions = suggestions:
if suggestions == [] then ""
else if lib.length suggestions == 1 then ", did you mean ${lib.elemAt suggestions 0}?"
else ", did you mean ${lib.concatStringsSep ", " (lib.init suggestions)} or ${lib.last suggestions}?";
else if length suggestions == 1 then ", did you mean ${elemAt suggestions 0}?"
else ", did you mean ${concatStringsSep ", " (lib.init suggestions)} or ${lib.last suggestions}?";
errorForArg = arg:
let
@@ -180,16 +191,16 @@ rec {
# loc' can be removed once lib/minver.nix is >2.3.4, since that includes
# https://github.com/NixOS/nix/pull/3468 which makes loc be non-null
loc' = if loc != null then loc.file + ":" + toString loc.line
else if ! lib.isFunction fn then
toString fn + lib.optionalString (lib.sources.pathIsDirectory fn) "/default.nix"
else if ! isFunction fn then
toString fn + optionalString (pathIsDirectory fn) "/default.nix"
else "<unknown location>";
in "Function called without required argument \"${arg}\" at "
+ "${loc'}${prettySuggestions (getSuggestions arg)}";
# Only show the error for the first missing argument
error = errorForArg (lib.head missingArgs);
error = errorForArg missingArgs.${head (attrNames missingArgs)};
in if missingArgs == [] then makeOverridable f allArgs else abort error;
in if missingArgs == {} then makeOverridable f allArgs else abort error;
/* Like callPackage, but for a function that returns an attribute
@@ -201,17 +212,17 @@ rec {
*/
callPackagesWith = autoArgs: fn: args:
let
f = if lib.isFunction fn then fn else import fn;
auto = builtins.intersectAttrs (lib.functionArgs f) autoArgs;
f = if isFunction fn then fn else import fn;
auto = intersectAttrs (functionArgs f) autoArgs;
origArgs = auto // args;
pkgs = f origArgs;
mkAttrOverridable = name: _: makeOverridable (newArgs: (f newArgs).${name}) origArgs;
in
if lib.isDerivation pkgs then throw
if isDerivation pkgs then throw
("function `callPackages` was called on a *single* derivation "
+ ''"${pkgs.name or "<unknown-name>"}";''
+ " did you mean to use `callPackage` instead?")
else lib.mapAttrs mkAttrOverridable pkgs;
else mapAttrs mkAttrOverridable pkgs;
/* Add attributes to each output of a derivation without changing
@@ -224,7 +235,7 @@ rec {
let
outputs = drv.outputs or [ "out" ];
commonAttrs = drv // (builtins.listToAttrs outputsList) //
commonAttrs = drv // (listToAttrs outputsList) //
({ all = map (x: x.value) outputsList; }) // passthru;
outputToAttrListElement = outputName:
@@ -238,7 +249,7 @@ rec {
# TODO: give the derivation control over the outputs.
# `overrideAttrs` may not be the only attribute that needs
# updating when switching outputs.
lib.optionalAttrs (passthru?overrideAttrs) {
optionalAttrs (passthru?overrideAttrs) {
# TODO: also add overrideAttrs when overrideAttrs is not custom, e.g. when not splicing.
overrideAttrs = f: (passthru.overrideAttrs f).${outputName};
};
@@ -264,11 +275,11 @@ rec {
commonAttrs =
{ inherit (drv) name system meta; inherit outputs; }
// lib.optionalAttrs (drv._hydraAggregate or false) {
// optionalAttrs (drv._hydraAggregate or false) {
_hydraAggregate = true;
constituents = map hydraJob (lib.flatten drv.constituents);
constituents = map hydraJob (flatten drv.constituents);
}
// (lib.listToAttrs outputsList);
// (listToAttrs outputsList);
makeOutput = outputName:
let output = drv.${outputName}; in
@@ -283,9 +294,9 @@ rec {
outputsList = map makeOutput outputs;
drv' = (lib.head outputsList).value;
drv' = (head outputsList).value;
in if drv == null then null else
lib.deepSeq drv' drv';
deepSeq drv' drv';
/* Make a set of packages with a common scope. All packages called
with the provided `callPackage` will be evaluated with the same
@@ -304,11 +315,11 @@ rec {
let self = f self // {
newScope = scope: newScope (self // scope);
callPackage = self.newScope {};
overrideScope = g: makeScope newScope (lib.fixedPoints.extends g f);
overrideScope = g: makeScope newScope (extends g f);
# Remove after 24.11 is released.
overrideScope' = g: lib.warnIf (lib.isInOldestRelease 2311)
overrideScope' = g: warnIf (isInOldestRelease 2311)
"`overrideScope'` (from `lib.makeScope`) has been renamed to `overrideScope`."
(makeScope newScope (lib.fixedPoints.extends g f));
(makeScope newScope (extends g f));
packages = f;
};
in self;
@@ -384,7 +395,7 @@ rec {
overrideScope = g: (makeScopeWithSplicing'
{ inherit splicePackages newScope; }
{ inherit otherSplices keep extra;
f = lib.fixedPoints.extends g f;
f = extends g f;
});
packages = f;
};
+7
View File
@@ -38,6 +38,13 @@ in mkLicense lset) ({
redistributable = false;
};
activision = {
# https://doomwiki.org/wiki/Raven_source_code_licensing
fullName = "Activision EULA";
url = "https://www.doomworld.com/eternity/activision_eula.txt";
free = false;
};
afl20 = {
spdxId = "AFL-2.0";
fullName = "Academic Free License v2.0";
+22 -10
View File
@@ -3,6 +3,11 @@
{ lib }:
let
inherit (lib) matchAttrs any all;
inherit (builtins) isString;
in
rec {
@@ -83,14 +88,21 @@ rec {
We can inject these into a pattern for the whole of a structured platform,
and then match that.
*/
platformMatch = platform: elem: let
pattern =
if builtins.isString elem
then { system = elem; }
else if elem?parsed
then elem
else { parsed = elem; };
in lib.matchAttrs pattern platform;
platformMatch = platform: elem: (
# Check with simple string comparison if elem was a string.
#
# The majority of comparisons done with this function will be against meta.platforms
# which contains a simple platform string.
#
# Avoiding an attrset allocation results in significant performance gains (~2-30) across the board in OfBorg
# because this is a hot path for nixpkgs.
if isString elem then platform ? system && elem == platform.system
else matchAttrs (
# Normalize platform attrset.
if elem ? parsed then elem
else { parsed = elem; }
) platform
);
/* Check if a package is available on a given platform.
@@ -102,8 +114,8 @@ rec {
2. None of `meta.badPlatforms` pattern matches the given platform.
*/
availableOn = platform: pkg:
((!pkg?meta.platforms) || lib.any (platformMatch platform) pkg.meta.platforms) &&
lib.all (elem: !platformMatch platform elem) (pkg.meta.badPlatforms or []);
((!pkg?meta.platforms) || any (platformMatch platform) pkg.meta.platforms) &&
all (elem: !platformMatch platform elem) (pkg.meta.badPlatforms or []);
/* Get the corresponding attribute in lib.licenses
from the SPDX ID.
+40
View File
@@ -831,6 +831,26 @@ runTests {
};
};
testMatchAttrsMatchingExact = {
expr = matchAttrs { cpu = { bits = 64; }; } { cpu = { bits = 64; }; };
expected = true;
};
testMatchAttrsMismatch = {
expr = matchAttrs { cpu = { bits = 128; }; } { cpu = { bits = 64; }; };
expected = false;
};
testMatchAttrsMatchingImplicit = {
expr = matchAttrs { cpu = { }; } { cpu = { bits = 64; }; };
expected = true;
};
testMatchAttrsMissingAttrs = {
expr = matchAttrs { cpu = {}; } { };
expected = false;
};
testOverrideExistingEmpty = {
expr = overrideExisting {} { a = 1; };
expected = {};
@@ -1948,4 +1968,24 @@ runTests {
testGetExe'FailureSecondArg = testingThrow (
getExe' { type = "derivation"; } "dir/executable"
);
testPlatformMatch = {
expr = meta.platformMatch { system = "x86_64-linux"; } "x86_64-linux";
expected = true;
};
testPlatformMatchAttrs = {
expr = meta.platformMatch (systems.elaborate "x86_64-linux") (systems.elaborate "x86_64-linux").parsed;
expected = true;
};
testPlatformMatchNoMatch = {
expr = meta.platformMatch { system = "x86_64-darwin"; } "x86_64-linux";
expected = false;
};
testPlatformMatchMissingSystem = {
expr = meta.platformMatch { } "x86_64-linux";
expected = false;
};
}
+84 -13
View File
@@ -1771,6 +1771,12 @@
github = "auchter";
githubId = 1190483;
};
augustebaum = {
email = "auguste.apple@gmail.com";
github = "augustebaum";
githubId = 52001167;
name = "Auguste Baum";
};
auntie = {
email = "auntieNeo@gmail.com";
github = "auntieNeo";
@@ -1882,6 +1888,12 @@
githubId = 135230;
name = "Aycan iRiCAN";
};
ayes-web = {
email = "ayes2022@protonmail.com";
github = "ayes-web";
githubId = 52951851;
name = "ayes-web";
};
aynish = {
github = "Chickensoupwithrice";
githubId = 22575913;
@@ -2661,6 +2673,13 @@
githubId = 1071610;
name = "Gunnar Nitsche";
};
brokenpip3 = {
email = "brokenpip3@gmail.com";
matrix = "@brokenpip3:matrix.org";
github = "brokenpip3";
githubId = 40476330;
name = "brokenpip3";
};
bryanasdev000 = {
email = "bryanasdev000@gmail.com";
matrix = "@bryanasdev000:matrix.org";
@@ -3166,6 +3185,11 @@
githubId = 18648043;
name = "Daniel Cartwright";
};
chewblacka = {
github = "chewblacka";
githubId = 18430320;
name = "John Garcia";
};
Chili-Man = {
email = "dr.elhombrechile@gmail.com";
name = "Diego Rodriguez";
@@ -7113,6 +7137,13 @@
githubId = 287769;
name = "Sergii Paryzhskyi";
};
heisfer = {
email = "heisfer@refract.dev";
github = "heisfer";
githubId = 28564678;
matrix = "@heisfer:matrix.org";
name = "Heisfer";
};
helium = {
email = "helium.dev@tuta.io";
github = "helium18";
@@ -7909,6 +7940,12 @@
githubId = 41924494;
name = "Ivar";
};
ivarmedi = {
email = "ivar@larsson.me";
github = "ivarmedi";
githubId = 1318743;
name = "Ivar";
};
iwanb = {
email = "tracnar@gmail.com";
github = "iwanb";
@@ -8402,11 +8439,6 @@
githubId = 31008330;
name = "Jann Marc Villablanca";
};
jgarcia = {
github = "chewblacka";
githubId = 18430320;
name = "John Garcia";
};
jgart = {
email = "jgart@dismail.de";
github = "jgarte";
@@ -9547,6 +9579,12 @@
githubId = 691290;
name = "Keshav Kini";
};
kinzoku = {
email = "kinzokudev4869@gmail.com";
github = "kinzoku-dev";
githubId = 140647311;
name = "Ayman Hamza";
};
kip93 = {
name = "Leandro Reina Kiperman";
email = "leandro@kip93.net";
@@ -11375,6 +11413,12 @@
githubId = 1187050;
name = "Maximilian Huber";
};
maxhearnden = {
email = "max@hearnden.org.uk";
github = "MaxHearnden";
githubId = 8320393;
name = "Max Hearnden";
};
maxhero = {
email = "contact@maxhero.dev";
github = "themaxhero";
@@ -12121,7 +12165,7 @@
name = "Martin Milata";
};
mmlb = {
email = "manny@peekaboo.mmlb.icu";
email = "i@m.mmlb.dev";
github = "mmlb";
githubId = 708570;
name = "Manuel Mendez";
@@ -12664,6 +12708,12 @@
githubId = 330943;
name = "Nathan Bijnens";
};
nathanielbrough = {
github = "silvergasp";
githubId = 7277663;
email = "nathaniel.brough@gmail.com";
name = "Nathaniel Brough";
};
nathanruiz = {
email = "nathanruiz@protonmail.com";
github = "nathanruiz";
@@ -12710,6 +12760,13 @@
githubId = 1386642;
name = "Noah Brenowitz";
};
nbsp = {
email = "aoife@enby.space";
matrix = "@nbsp:enby.space";
github = "enbyspace";
githubId = 57151943;
name = "aoife cassidy";
};
ncfavier = {
email = "n@monade.li";
matrix = "@ncfavier:matrix.org";
@@ -13469,6 +13526,12 @@
githubId = 72201;
name = "Ole Jørgen Brønner";
};
oliver-koss = {
email = "oliver.koss06@gmail.com";
github = "oliver-koss";
githubId = 39134647;
name = "Oliver Koss";
};
ollieB = {
github = "oliverbunting";
githubId = 1237862;
@@ -15932,6 +15995,15 @@
githubId = 132835;
name = "Samuel Dionne-Riel";
};
samuel-martineau = {
name = "Samuel Martineau";
email = "samuel@smartineau.me";
github = "Samuel-Martineau";
githubId = 44237969;
keys = [{
fingerprint = "79A1 CC17 67C7 32B6 A8A2 BF4F 71E0 8761 642D ACD2";
}];
};
samuelrivas = {
email = "samuelrivas@gmail.com";
github = "samuelrivas";
@@ -16318,13 +16390,6 @@
fingerprint = "7246 B6E1 ABB9 9A48 4395 FD11 DC26 B921 A9E9 DBDE";
}];
};
sfr = {
email = "sol@solfisher.com";
matrix = "@sfr:enby.space";
github = "solfisher";
githubId = 57151943;
name = "Sol Fisher Romanoff";
};
sfrijters = {
email = "sfrijters@gmail.com";
github = "SFrijters";
@@ -18399,6 +18464,12 @@
githubId = 25440339;
name = "Tom Repetti";
};
trespaul = {
email = "paul@trespaul.com";
github = "trespaul";
githubId = 7453891;
name = "Paul Joubert";
};
trevdev = {
email = "trev@trevdev.ca";
matrix = "@trevdev:matrix.org";
-8
View File
@@ -127,14 +127,6 @@ with lib.maintainers; {
enableFeatureFreezePing = true;
};
chia = {
members = [
lourkeur
];
scope = "Maintain the Chia blockchain and its dependencies";
shortName = "Chia Blockchain";
};
coq = {
members = [
cohencyril
@@ -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-23.11`](https://channels.nixos.org/nixos-23.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
@@ -19,7 +19,7 @@ passed and all packages have been built. These channels are:
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)
- *Small channels*, such as [`nixos-23.11-small`](https://channels.nixos.org/nixos-23.11-small)
or [`nixos-unstable-small`](https://channels.nixos.org/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
@@ -38,8 +38,8 @@ 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 23.11 ISO, you will be subscribed to
the `nixos-23.11` channel. To see which NixOS channel you're subscribed
to, run the following as root:
```ShellSession
@@ -54,16 +54,16 @@ To switch to a different NixOS channel, do
```
(Be sure to include the `nixos` parameter at the end.) For instance, to
use the NixOS 23.05 stable channel:
use the NixOS 23.11 stable channel:
```ShellSession
# nix-channel --add https://channels.nixos.org/nixos-23.05 nixos
# nix-channel --add https://channels.nixos.org/nixos-23.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://channels.nixos.org/nixos-23.11-small nixos
```
And if you want to live on the bleeding edge:
@@ -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://channels.nixos.org/nixos-23.11";
```
File diff suppressed because it is too large Load Diff
@@ -14,16 +14,19 @@ In addition to numerous new and upgraded packages, this release has the followin
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
- Create the first release note entry in this section!
- [maubot](https://github.com/maubot/maubot), a plugin-based Matrix bot framework. Available as [services.maubot](#opt-services.maubot.enable).
## Backward Incompatibilities {#sec-release-24.05-incompatibilities}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
- Create the first release note entry in this section!
- `mkosi` was updated to v19. Parts of the user interface have changed. Consult the
[release notes](https://github.com/systemd/mkosi/releases/tag/v19) for a list of changes.
## Other Notable Changes {#sec-release-24.05-notable-changes}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
- Create the first release note entry in this section!
- Programs written in [Nim](https://nim-lang.org/) are built with libraries selected by lockfiles.
The `nimPackages` and `nim2Packages` sets have been removed.
See https://nixos.org/manual/nixpkgs/unstable#nim for more information.
+1 -8
View File
@@ -24,14 +24,7 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.ckb-next;
defaultText = literalExpression "pkgs.ckb-next";
description = lib.mdDoc ''
The package implementing the Corsair keyboard/mouse driver.
'';
};
package = mkPackageOption pkgs "ckb-next" { };
};
config = mkIf cfg.enable {
+4 -5
View File
@@ -16,11 +16,10 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.digitalbitbox;
defaultText = literalExpression "pkgs.digitalbitbox";
description = lib.mdDoc "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults.";
package = mkPackageOption pkgs "digitalbitbox" {
extraDescription = ''
This can be used to install a package with udev rules that differ from the defaults.
'';
};
};
+1 -8
View File
@@ -26,14 +26,7 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.opentabletdriver;
defaultText = literalExpression "pkgs.opentabletdriver";
description = lib.mdDoc ''
OpenTabletDriver derivation to use.
'';
};
package = mkPackageOption pkgs "opentabletdriver" { };
daemon = {
enable = mkOption {
+1 -1
View File
@@ -47,7 +47,7 @@ in
panel = mkOption {
type = with types; nullOr path;
default = null;
example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/lib/libexec/kimpanel-ibus-panel"'';
example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/libexec/kimpanel-ibus-panel"'';
description = lib.mdDoc "Replace the IBus panel with another panel.";
};
};
+6 -3
View File
@@ -130,7 +130,7 @@ in
'';
};
config = lib.mkIf (config.nix.enable && !config.system.disableInstallerTools) {
config = lib.mkMerge [ (lib.mkIf (config.nix.enable && !config.system.disableInstallerTools) {
system.nixos-generate-config.configuration = mkDefault ''
# Edit this configuration file to define what should be installed on
@@ -257,10 +257,13 @@ in
documentation.man.man-db.skipPackages = [ nixos-version ];
})
# These may be used in auxiliary scripts (ie not part of toplevel), so they are defined unconditionally.
({
system.build = {
inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-enter;
};
};
})];
}
+2 -8
View File
@@ -26,14 +26,8 @@ in
'';
};
package = mkOption {
type = package;
default = pkgs.findutils.locate;
defaultText = literalExpression "pkgs.findutils.locate";
example = literalExpression "pkgs.mlocate";
description = lib.mdDoc ''
The locate implementation to use
'';
package = mkPackageOption pkgs [ "findutils" "locate" ] {
example = "mlocate";
};
interval = mkOption {
+8 -3
View File
@@ -480,6 +480,7 @@
./services/desktops/telepathy.nix
./services/desktops/tumbler.nix
./services/desktops/zeitgeist.nix
./services/development/athens.nix
./services/development/blackfire.nix
./services/development/bloop.nix
./services/development/distccd.nix
@@ -621,6 +622,7 @@
./services/matrix/appservice-irc.nix
./services/matrix/conduit.nix
./services/matrix/dendrite.nix
./services/matrix/maubot.nix
./services/matrix/mautrix-facebook.nix
./services/matrix/mautrix-telegram.nix
./services/matrix/mautrix-whatsapp.nix
@@ -1218,6 +1220,7 @@
./services/torrent/peerflix.nix
./services/torrent/rtorrent.nix
./services/torrent/transmission.nix
./services/torrent/torrentstream.nix
./services/tracing/tempo.nix
./services/ttys/getty.nix
./services/ttys/gpm.nix
@@ -1439,6 +1442,7 @@
./system/boot/stratisroot.nix
./system/boot/modprobe.nix
./system/boot/networkd.nix
./system/boot/unl0kr.nix
./system/boot/plymouth.nix
./system/boot/resolved.nix
./system/boot/shutdown.nix
@@ -1536,9 +1540,10 @@
./virtualisation/waydroid.nix
./virtualisation/xe-guest-utilities.nix
./virtualisation/xen-dom0.nix
{ documentation.nixos.extraModules = [
./virtualisation/qemu-vm.nix
./image/repart.nix
{
documentation.nixos.extraModules = [
./virtualisation/qemu-vm.nix
./image/repart.nix
];
}
]
+13
View File
@@ -103,6 +103,19 @@ in
# server that QEMU provides (normally 10.0.2.3)
networking.nameservers = [ "8.8.8.8" ];
# The linux builder is a lightweight VM for remote building; not evaluation.
nix.channel.enable = false;
# remote builder uses `nix-daemon` (ssh-ng:) or `nix-store --serve` (ssh:)
# --force: do not complain when missing
# TODO: install a store-only nix
# https://github.com/NixOS/rfcs/blob/master/rfcs/0134-nix-store-layer.md#detailed-design
environment.extraSetup = ''
rm --force $out/bin/{nix-instantiate,nix-build,nix-shell,nix-prefetch*,nix}
'';
# Deployment is by image.
# TODO system.switch.enable = false;?
system.disableInstallerTools = true;
nix.settings = {
auto-optimise-store = true;
+1 -8
View File
@@ -16,14 +16,7 @@ in
enable = mkEnableOption (lib.mdDoc "Atop");
package = mkOption {
type = types.package;
default = pkgs.atop;
defaultText = literalExpression "pkgs.atop";
description = lib.mdDoc ''
Which package to use for Atop.
'';
};
package = mkPackageOption pkgs "atop" { };
netatop = {
enable = mkOption {
+3 -7
View File
@@ -5,7 +5,8 @@ let
inherit (lib)
concatStringsSep escapeShellArgs optionalString
literalExpression mkEnableOption mkIf mkOption mkOptionDefault types;
literalExpression mkEnableOption mkPackageOption mkIf mkOption
mkOptionDefault types;
requiresSetcapWrapper = config.boot.kernelPackages.kernelOlder "5.7" && cfg.bindInterface;
@@ -50,12 +51,7 @@ in
programs.captive-browser = {
enable = mkEnableOption (lib.mdDoc "captive browser");
package = mkOption {
type = types.package;
default = pkgs.captive-browser;
defaultText = literalExpression "pkgs.captive-browser";
description = lib.mdDoc "Which package to use for captive-browser";
};
package = mkPackageOption pkgs "captive-browser" { };
interface = mkOption {
type = types.str;
@@ -16,11 +16,10 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.digitalbitbox;
defaultText = literalExpression "pkgs.digitalbitbox";
description = lib.mdDoc "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults.";
package = mkPackageOption pkgs "digitalbitbox" {
extraDescription = ''
This can be used to install a package with udev rules that differ from the defaults.
'';
};
};
+1 -6
View File
@@ -21,12 +21,7 @@ in {
relatedPackages = [ "dmrconfig" ];
};
package = mkOption {
default = pkgs.dmrconfig;
type = types.package;
defaultText = literalExpression "pkgs.dmrconfig";
description = lib.mdDoc "dmrconfig derivation to use";
};
package = mkPackageOption pkgs "dmrconfig" { };
};
};
+1 -1
View File
@@ -45,7 +45,7 @@ in
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ];
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
XDG_DATA_DIRS = [ "/share" ];
LIBEXEC_PATH = [ "/lib/libexec" ];
LIBEXEC_PATH = [ "/libexec" ];
};
environment.pathsToLink = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ];
+1 -6
View File
@@ -24,12 +24,7 @@ in {
enable = mkEnableOption
(lib.mdDoc "Evince, the GNOME document viewer");
package = mkOption {
type = types.package;
default = pkgs.evince;
defaultText = literalExpression "pkgs.evince";
description = lib.mdDoc "Evince derivation to use.";
};
package = mkPackageOption pkgs "evince" { };
};
+1 -8
View File
@@ -12,14 +12,7 @@ in {
Your user needs to be in the `feedbackd` group to trigger effects
'');
package = mkOption {
description = lib.mdDoc ''
Which feedbackd package to use.
'';
type = types.package;
default = pkgs.feedbackd;
defaultText = literalExpression "pkgs.feedbackd";
};
package = mkPackageOption pkgs "feedbackd" { };
};
};
config = mkIf cfg.enable {
+1 -6
View File
@@ -23,12 +23,7 @@ in {
enable = mkEnableOption (lib.mdDoc "File Roller, an archive manager for GNOME");
package = mkOption {
type = types.package;
default = pkgs.gnome.file-roller;
defaultText = literalExpression "pkgs.gnome.file-roller";
description = lib.mdDoc "File Roller derivation to use.";
};
package = mkPackageOption pkgs [ "gnome" "file-roller" ] { };
};
+1 -6
View File
@@ -9,12 +9,7 @@ in {
programs.flexoptix-app = {
enable = mkEnableOption (lib.mdDoc "FLEXOPTIX app + udev rules");
package = mkOption {
description = lib.mdDoc "FLEXOPTIX app package to use";
type = types.package;
default = pkgs.flexoptix-app;
defaultText = literalExpression "pkgs.flexoptix-app";
};
package = mkPackageOption pkgs "flexoptix-app" { };
};
};
+1 -8
View File
@@ -23,14 +23,7 @@ in
options.programs.gamescope = {
enable = mkEnableOption (mdDoc "gamescope");
package = mkOption {
type = types.package;
default = pkgs.gamescope;
defaultText = literalExpression "pkgs.gamescope";
description = mdDoc ''
The GameScope package to use.
'';
};
package = mkPackageOption pkgs "gamescope" { };
capSysNice = mkOption {
type = types.bool;
+3 -12
View File
@@ -11,12 +11,8 @@ in
programs.git = {
enable = mkEnableOption (lib.mdDoc "git");
package = mkOption {
type = types.package;
default = pkgs.git;
defaultText = literalExpression "pkgs.git";
example = literalExpression "pkgs.gitFull";
description = lib.mdDoc "The git package to use";
package = mkPackageOption pkgs "git" {
example = "gitFull";
};
config = mkOption {
@@ -65,12 +61,7 @@ in
lfs = {
enable = mkEnableOption (lib.mdDoc "git-lfs");
package = mkOption {
type = types.package;
default = pkgs.git-lfs;
defaultText = literalExpression "pkgs.git-lfs";
description = lib.mdDoc "The git-lfs package to use";
};
package = mkPackageOption pkgs "git-lfs" { };
};
};
};
+1 -8
View File
@@ -29,14 +29,7 @@ in
{
options.programs.gnupg = {
package = mkOption {
type = types.package;
default = pkgs.gnupg;
defaultText = literalExpression "pkgs.gnupg";
description = lib.mdDoc ''
The gpg package that should be used.
'';
};
package = mkPackageOption pkgs "gnupg" { };
agent.enable = mkOption {
type = types.bool;
+1 -8
View File
@@ -18,14 +18,7 @@ in
{
options.programs.htop = {
package = mkOption {
type = types.package;
default = pkgs.htop;
defaultText = lib.literalExpression "pkgs.htop";
description = lib.mdDoc ''
The htop package that should be used.
'';
};
package = mkPackageOption pkgs "htop" { };
enable = mkEnableOption (lib.mdDoc "htop process monitor");
+5 -9
View File
@@ -13,16 +13,12 @@ in {
options = {
programs.i3lock = {
enable = mkEnableOption (mdDoc "i3lock");
package = mkOption {
type = types.package;
default = pkgs.i3lock;
defaultText = literalExpression "pkgs.i3lock";
example = literalExpression ''
pkgs.i3lock-color
'';
description = mdDoc ''
Specify which package to use for the i3lock program,
package = mkPackageOption pkgs "i3lock" {
example = "i3lock-color";
extraDescription = ''
::: {.note}
The i3lock package must include a i3lock file or link in its out directory in order for the u2fSupport option to work correctly.
:::
'';
};
u2fSupport = mkOption {
+2 -7
View File
@@ -30,13 +30,8 @@ in
'';
};
package = mkOption {
default = pkgs.jdk;
defaultText = literalExpression "pkgs.jdk";
description = lib.mdDoc ''
Java package to install. Typical values are pkgs.jdk or pkgs.jre.
'';
type = types.package;
package = mkPackageOption pkgs "jdk" {
example = "jre";
};
binfmt = mkEnableOption (lib.mdDoc "binfmt to execute java jar's and classes");
+1 -9
View File
@@ -20,15 +20,7 @@ in
default = "k40";
};
package = mkOption {
type = types.package;
default = pkgs.k40-whisperer;
defaultText = literalExpression "pkgs.k40-whisperer";
example = literalExpression "pkgs.k40-whisperer";
description = lib.mdDoc ''
K40 Whisperer package to use.
'';
};
package = mkPackageOption pkgs "k40-whisperer" { };
};
config = mkIf cfg.enable {
+2 -8
View File
@@ -11,14 +11,8 @@ with lib;
`gnomeExtensions.gsconnect` as an alternative
implementation if you use Gnome
'');
package = mkOption {
default = pkgs.plasma5Packages.kdeconnect-kde;
defaultText = literalExpression "pkgs.plasma5Packages.kdeconnect-kde";
type = types.package;
example = literalExpression "pkgs.gnomeExtensions.gsconnect";
description = lib.mdDoc ''
The package providing the implementation for kdeconnect.
'';
package = mkPackageOption pkgs [ "plasma5Packages" "kdeconnect-kde" ] {
example = "gnomeExtensions.gsconnect";
};
};
config =
+23 -10
View File
@@ -5,26 +5,39 @@
with lib;
let
cfg = config.programs.mininet;
cfg = config.programs.mininet;
generatedPath = with pkgs; makeSearchPath "bin" [
iperf ethtool iproute2 socat
telnet = pkgs.runCommand "inetutils-telnet"
{ }
''
mkdir -p $out/bin
ln -s ${pkgs.inetutils}/bin/telnet $out/bin
'';
generatedPath = with pkgs; makeSearchPath "bin" [
iperf
ethtool
iproute2
socat
# mn errors out without a telnet binary
# pkgs.inetutils brings an undesired ifconfig into PATH see #43105
nettools
telnet
];
pyEnv = pkgs.python.withPackages(ps: [ ps.mininet-python ]);
pyEnv = pkgs.python3.withPackages (ps: [ ps.mininet-python ]);
mnexecWrapped = pkgs.runCommand "mnexec-wrapper"
{ nativeBuildInputs = [ pkgs.makeWrapper pkgs.pythonPackages.wrapPython ]; }
{ nativeBuildInputs = [ pkgs.makeWrapper pkgs.python3Packages.wrapPython ]; }
''
makeWrapper ${pkgs.mininet}/bin/mnexec \
$out/bin/mnexec \
--prefix PATH : "${generatedPath}"
ln -s ${pyEnv}/bin/mn $out/bin/mn
# mn errors out without a telnet binary
# pkgs.inetutils brings an undesired ifconfig into PATH see #43105
ln -s ${pkgs.inetutils}/bin/telnet $out/bin/telnet
makeWrapper ${pyEnv}/bin/mn \
$out/bin/mn \
--prefix PYTHONPATH : "${pyEnv}/${pyEnv.sitePackages}" \
--prefix PATH : "${generatedPath}"
'';
in
{
+1 -8
View File
@@ -17,14 +17,7 @@ in {
'';
};
package = mkOption {
type = types.package;
default = pkgs.mtr;
defaultText = literalExpression "pkgs.mtr";
description = lib.mdDoc ''
The package to use.
'';
};
package = mkPackageOption pkgs "mtr" { };
};
};
+1 -6
View File
@@ -86,12 +86,7 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.neovim-unwrapped;
defaultText = literalExpression "pkgs.neovim-unwrapped";
description = lib.mdDoc "The package to use for the neovim binary.";
};
package = mkPackageOption pkgs "neovim-unwrapped" { };
finalPackage = mkOption {
type = types.package;
+1 -6
View File
@@ -5,12 +5,7 @@ in {
options.programs.nix-index = with lib; {
enable = mkEnableOption (lib.mdDoc "nix-index, a file database for nixpkgs");
package = mkOption {
type = types.package;
default = pkgs.nix-index;
defaultText = literalExpression "pkgs.nix-index";
description = lib.mdDoc "Package providing the `nix-index` tool.";
};
package = mkPackageOption pkgs "nix-index" { };
enableBashIntegration = mkEnableOption (lib.mdDoc "Bash integration") // {
default = true;
+1 -6
View File
@@ -23,12 +23,7 @@ in {
'';
};
package = mkOption {
type = types.package;
default = pkgs.nncp;
defaultText = literalExpression "pkgs.nncp";
description = lib.mdDoc "The NNCP package to use system-wide.";
};
package = mkPackageOption pkgs "nncp" { };
secrets = mkOption {
type = with types; listOf str;
+1 -8
View File
@@ -8,14 +8,7 @@ in
options.programs.noisetorch = {
enable = mkEnableOption (lib.mdDoc "noisetorch + setcap wrapper");
package = mkOption {
type = types.package;
default = pkgs.noisetorch;
defaultText = literalExpression "pkgs.noisetorch";
description = lib.mdDoc ''
The noisetorch package to use.
'';
};
package = mkPackageOption pkgs "noisetorch" { };
};
config = mkIf cfg.enable {
+2 -6
View File
@@ -13,12 +13,8 @@ in
programs.npm = {
enable = mkEnableOption (lib.mdDoc "{command}`npm` global config");
package = mkOption {
type = types.package;
description = lib.mdDoc "The npm package version / flavor to use";
default = pkgs.nodePackages.npm;
defaultText = literalExpression "pkgs.nodePackages.npm";
example = literalExpression "pkgs.nodePackages_13_x.npm";
package = mkPackageOption pkgs [ "nodePackages" "npm" ] {
example = "nodePackages_13_x.npm";
};
npmrc = mkOption {
+2 -2
View File
@@ -51,8 +51,8 @@ in {
enable = mkEnableOption (lib.mdDoc "installing proxychains configuration");
package = mkPackageOptionMD pkgs "proxychains" {
example = "pkgs.proxychains-ng";
package = mkPackageOption pkgs "proxychains" {
example = "proxychains-ng";
};
chain = {
+2 -8
View File
@@ -12,14 +12,8 @@ in
Whether to install Singularity/Apptainer with system-level overriding such as SUID support.
'';
};
package = mkOption {
type = types.package;
default = pkgs.singularity;
defaultText = literalExpression "pkgs.singularity";
example = literalExpression "pkgs.apptainer";
description = mdDoc ''
Singularity/Apptainer package to override and install.
'';
package = mkPackageOption pkgs "singularity" {
example = "apptainer";
};
packageOverriden = mkOption {
type = types.nullOr types.package;
+1 -8
View File
@@ -132,14 +132,7 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.openssh;
defaultText = literalExpression "pkgs.openssh";
description = lib.mdDoc ''
The package used for the openssh client and daemon.
'';
};
package = mkPackageOption pkgs "openssh" { };
knownHosts = mkOption {
default = {};
+4 -9
View File
@@ -5,7 +5,7 @@ let
inherit (builtins) length map;
inherit (lib.attrsets) attrNames filterAttrs hasAttr mapAttrs mapAttrsToList optionalAttrs;
inherit (lib.modules) mkDefault mkIf;
inherit (lib.options) literalExpression mkEnableOption mkOption;
inherit (lib.options) literalExpression mkEnableOption mkOption mkPackageOption;
inherit (lib.strings) concatLines optionalString toLower;
inherit (lib.types) addCheck attrsOf lines nonEmptyStr nullOr package path port str strMatching submodule;
@@ -215,14 +215,9 @@ let
TSM-depending packages used on the system.
'';
};
package = mkOption {
type = package;
default = pkgs.tsm-client;
defaultText = literalExpression "pkgs.tsm-client";
example = literalExpression "pkgs.tsm-client-withGui";
description = lib.mdDoc ''
The TSM client derivation to be
added to the system environment.
package = mkPackageOption pkgs "tsm-client" {
example = "tsm-client-withGui";
extraDescription = ''
It will be used with `.override`
to add paths to the client system-options file.
'';
+2 -8
View File
@@ -15,14 +15,8 @@ in {
'';
};
package = mkOption {
type = types.package;
default = pkgs.vim;
defaultText = literalExpression "pkgs.vim";
example = literalExpression "pkgs.vim-full";
description = lib.mdDoc ''
vim package to use.
'';
package = mkPackageOption pkgs "vim" {
example = "vim-full";
};
};
+3 -6
View File
@@ -10,12 +10,9 @@ in {
options.programs.river = {
enable = mkEnableOption (lib.mdDoc "river, a dynamic tiling Wayland compositor");
package = mkOption {
type = with types; nullOr package;
default = pkgs.river;
defaultText = literalExpression "pkgs.river";
description = lib.mdDoc ''
River package to use.
package = mkPackageOption pkgs "river" {
nullable = true;
extraDescription = ''
Set to `null` to not add any River package to your path.
This should be done if you want to use the Home Manager River module to install River.
'';
+1 -6
View File
@@ -26,12 +26,7 @@ in
'';
};
package = mkOption {
type = package;
default = pkgs.weylus;
defaultText = lib.literalExpression "pkgs.weylus";
description = lib.mdDoc "Weylus package to install.";
};
package = mkPackageOption pkgs "weylus" { };
};
config = mkIf cfg.enable {
networking.firewall = mkIf cfg.openFirewall {
+2 -7
View File
@@ -16,13 +16,8 @@ in {
setcap wrapper for 'dumpcap' for users in the 'wireshark' group.
'';
};
package = mkOption {
type = types.package;
default = pkgs.wireshark-cli;
defaultText = literalExpression "pkgs.wireshark-cli";
description = lib.mdDoc ''
Which Wireshark package to install in the global environment.
'';
package = mkPackageOption pkgs "wireshark-cli" {
example = "wireshark";
};
};
};
+2 -8
View File
@@ -24,14 +24,8 @@ in
type = types.bool;
};
package = mkOption {
type = types.package;
default = pkgs.xonsh;
defaultText = literalExpression "pkgs.xonsh";
example = literalExpression "pkgs.xonsh.override { extraPackages = ps: [ ps.requests ]; }";
description = lib.mdDoc ''
xonsh package to use.
'';
package = mkPackageOption pkgs "xonsh" {
example = "xonsh.override { extraPackages = ps: [ ps.requests ]; }";
};
config = mkOption {
+1 -9
View File
@@ -46,15 +46,7 @@ in
'';
};
package = mkOption {
default = pkgs.oh-my-zsh;
defaultText = literalExpression "pkgs.oh-my-zsh";
description = lib.mdDoc ''
Package to install for `oh-my-zsh` usage.
'';
type = types.package;
};
package = mkPackageOption pkgs "oh-my-zsh" { };
plugins = mkOption {
default = [];
+1 -9
View File
@@ -8,15 +8,7 @@ in {
options = {
programs.zsh.zsh-autoenv = {
enable = mkEnableOption (lib.mdDoc "zsh-autoenv");
package = mkOption {
default = pkgs.zsh-autoenv;
defaultText = literalExpression "pkgs.zsh-autoenv";
description = lib.mdDoc ''
Package to install for `zsh-autoenv` usage.
'';
type = types.package;
};
package = mkPackageOption pkgs "zsh-autoenv" { };
};
};
+8 -5
View File
@@ -943,6 +943,11 @@ let
value.source = pkgs.writeText "${name}.pam" service.text;
};
optionalSudoConfigForSSHAgentAuth = optionalString config.security.pam.enableSSHAgentAuth ''
# Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
Defaults env_keep+=SSH_AUTH_SOCK
'';
in
{
@@ -1532,9 +1537,7 @@ in
concatLines
]);
security.sudo.extraConfig = optionalString config.security.pam.enableSSHAgentAuth ''
# Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
Defaults env_keep+=SSH_AUTH_SOCK
'';
};
security.sudo.extraConfig = optionalSudoConfigForSSHAgentAuth;
security.sudo-rs.extraConfig = optionalSudoConfigForSSHAgentAuth;
};
}
+1 -8
View File
@@ -13,14 +13,7 @@ in
file as another user
'');
package = mkOption {
type = types.package;
default = pkgs.please;
defaultText = literalExpression "pkgs.please";
description = mdDoc ''
Which package to use for {command}`please`.
'';
};
package = mkPackageOption pkgs "please" { };
wheelNeedsPassword = mkOption {
type = types.bool;
+26 -51
View File
@@ -4,16 +4,9 @@ with lib;
let
inherit (pkgs) sudo sudo-rs;
cfg = config.security.sudo-rs;
enableSSHAgentAuth =
with config.security;
pam.enableSSHAgentAuth && pam.sudo.sshAgentAuth;
usingMillersSudo = cfg.package.pname == sudo.pname;
usingSudoRs = cfg.package.pname == sudo-rs.pname;
inherit (config.security.pam) enableSSHAgentAuth;
toUserString = user: if (isInt user) then "#${toString user}" else "${user}";
toGroupString = group: if (isInt group) then "%#${toString group}" else "%${group}";
@@ -41,33 +34,19 @@ in
defaultOptions = mkOption {
type = with types; listOf str;
default = optional usingMillersSudo "SETENV";
defaultText = literalMD ''
`[ "SETENV" ]` if using the default `sudo` implementation
'';
default = [];
description = mdDoc ''
Options used for the default rules, granting `root` and the
`wheel` group permission to run any command as any user.
'';
};
enable = mkOption {
type = types.bool;
default = false;
description = mdDoc ''
Whether to enable the {command}`sudo` command, which
allows non-root users to execute commands as root.
'';
};
enable = mkEnableOption (mdDoc ''
a memory-safe implementation of the {command}`sudo` command,
which allows non-root users to execute commands as root.
'');
package = mkOption {
type = types.package;
default = pkgs.sudo-rs;
defaultText = literalExpression "pkgs.sudo-rs";
description = mdDoc ''
Which package to use for `sudo`.
'';
};
package = mkPackageOption pkgs "sudo-rs" { };
wheelNeedsPassword = mkOption {
type = types.bool;
@@ -208,6 +187,12 @@ in
###### implementation
config = mkIf cfg.enable {
assertions = [ {
assertion = ! config.security.sudo.enable;
message = "`security.sudo` and `security.sudo-rs` cannot both be enabled";
}];
security.sudo.enable = mkDefault false;
security.sudo-rs.extraRules =
let
defaultRule = { users ? [], groups ? [], opts ? [] }: [ {
@@ -235,20 +220,16 @@ in
# Don't edit this file. Set the NixOS options security.sudo-rs.configFile
# or security.sudo-rs.extraRules instead.
''
(optionalString enableSSHAgentAuth ''
# Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
Defaults env_keep+=SSH_AUTH_SOCK
'')
(concatStringsSep "\n" (
lists.flatten (
map (
rule: optionals (length rule.commands != 0) [
(map (user: "${toUserString user} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.users)
(map (group: "${toGroupString group} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.groups)
]
) cfg.extraRules
)
) + "\n")
(pipe cfg.extraRules [
(filter (rule: length rule.commands != 0))
(map (rule: [
(map (user: "${toUserString user} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.users)
(map (group: "${toGroupString group} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.groups)
]))
flatten
(concatStringsSep "\n")
])
"\n"
(optionalString (cfg.extraConfig != "") ''
# extraConfig
${cfg.extraConfig}
@@ -265,18 +246,12 @@ in
source = "${cfg.package.out}/bin/sudo";
inherit owner group setuid permissions;
};
# sudo-rs does not yet ship a sudoedit (as of v0.2.0)
sudoedit = mkIf usingMillersSudo {
source = "${cfg.package.out}/bin/sudoedit";
inherit owner group setuid permissions;
};
};
environment.systemPackages = [ sudo ];
environment.systemPackages = [ cfg.package ];
security.pam.services.sudo = { sshAgentAuth = true; usshAuth = true; };
security.pam.services.sudo-i = mkIf usingSudoRs
{ sshAgentAuth = true; usshAuth = true; };
security.pam.services.sudo-i = { sshAgentAuth = true; usshAuth = true; };
environment.etc.sudoers =
{ source =
@@ -285,7 +260,7 @@ in
src = pkgs.writeText "sudoers-in" cfg.configFile;
preferLocalBuild = true;
}
"${pkgs.buildPackages."${cfg.package.pname}"}/bin/visudo -f $src -c && cp $src $out";
"${pkgs.buildPackages.sudo-rs}/bin/visudo -f $src -c && cp $src $out";
mode = "0440";
};
+1 -6
View File
@@ -6,12 +6,7 @@ let
in with lib; {
options.services.meshcentral = with types; {
enable = mkEnableOption (lib.mdDoc "MeshCentral computer management server");
package = mkOption {
description = lib.mdDoc "MeshCentral package to use. Replacing this may be necessary to add dependencies for extra functionality.";
type = types.package;
default = pkgs.meshcentral;
defaultText = literalExpression "pkgs.meshcentral";
};
package = mkPackageOption pkgs "meshcentral" { };
settings = mkOption {
description = lib.mdDoc ''
Settings for MeshCentral. Refer to upstream documentation for details:
+1 -8
View File
@@ -26,14 +26,7 @@ in
'';
};
package = mkOption {
default = pkgs.rabbitmq-server;
type = types.package;
defaultText = literalExpression "pkgs.rabbitmq-server";
description = lib.mdDoc ''
Which rabbitmq package to use.
'';
};
package = mkPackageOption pkgs "rabbitmq-server" { };
listenAddress = mkOption {
default = "127.0.0.1";
+1 -6
View File
@@ -14,12 +14,7 @@ in
options.services.botamusique = {
enable = mkEnableOption (lib.mdDoc "botamusique, a bot to play audio streams on mumble");
package = mkOption {
type = types.package;
default = pkgs.botamusique;
defaultText = literalExpression "pkgs.botamusique";
description = lib.mdDoc "The botamusique package to use.";
};
package = mkPackageOption pkgs "botamusique" { };
settings = mkOption {
type = with types; submodule {
+3 -8
View File
@@ -20,16 +20,11 @@ in {
JACK Audio Connection Kit. You need to add yourself to the "jackaudio" group
'');
package = mkOption {
package = mkPackageOption pkgs "jack2" {
example = "jack1";
} // {
# until jack1 promiscuous mode is fixed
internal = true;
type = types.package;
default = pkgs.jack2;
defaultText = literalExpression "pkgs.jack2";
example = literalExpression "pkgs.jack1";
description = lib.mdDoc ''
The JACK package to use.
'';
};
extraOptions = mkOption {
+1 -6
View File
@@ -9,12 +9,7 @@ in
services.jmusicbot = {
enable = mkEnableOption (lib.mdDoc "jmusicbot, a Discord music bot that's easy to set up and run yourself");
package = mkOption {
type = types.package;
default = pkgs.jmusicbot;
defaultText = literalExpression "pkgs.jmusicbot";
description = lib.mdDoc "JMusicBot package to use";
};
package = mkPackageOption pkgs "jmusicbot" { };
stateDir = mkOption {
type = types.path;
+1 -6
View File
@@ -19,12 +19,7 @@ in {
'';
};
package = mkOption {
type = types.package;
default = pkgs.slimserver;
defaultText = literalExpression "pkgs.slimserver";
description = lib.mdDoc "Slimserver package to use.";
};
package = mkPackageOption pkgs "slimserver" { };
dataDir = mkOption {
type = types.path;
+18 -17
View File
@@ -47,8 +47,21 @@ let
then [ "${name} ${value}" ]
else concatLists (mapAttrsToList (genSection name) value);
sudoRule = {
users = [ "btrbk" ];
commands = [
{ command = "${pkgs.btrfs-progs}/bin/btrfs"; options = [ "NOPASSWD" ]; }
{ command = "${pkgs.coreutils}/bin/mkdir"; options = [ "NOPASSWD" ]; }
{ command = "${pkgs.coreutils}/bin/readlink"; options = [ "NOPASSWD" ]; }
# for ssh, they are not the same than the one hard coded in ${pkgs.btrbk}
{ command = "/run/current-system/sw/bin/btrfs"; options = [ "NOPASSWD" ]; }
{ command = "/run/current-system/sw/bin/mkdir"; options = [ "NOPASSWD" ]; }
{ command = "/run/current-system/sw/bin/readlink"; options = [ "NOPASSWD" ]; }
];
};
sudo_doas =
if config.security.sudo.enable then "sudo"
if config.security.sudo.enable || config.security.sudo-rs.enable then "sudo"
else if config.security.doas.enable then "doas"
else throw "The btrbk nixos module needs either sudo or doas enabled in the configuration";
@@ -157,22 +170,10 @@ in
};
config = mkIf (sshEnabled || serviceEnabled) {
environment.systemPackages = [ pkgs.btrbk ] ++ cfg.extraPackages;
security.sudo = mkIf (sudo_doas == "sudo") {
extraRules = [
{
users = [ "btrbk" ];
commands = [
{ command = "${pkgs.btrfs-progs}/bin/btrfs"; options = [ "NOPASSWD" ]; }
{ command = "${pkgs.coreutils}/bin/mkdir"; options = [ "NOPASSWD" ]; }
{ command = "${pkgs.coreutils}/bin/readlink"; options = [ "NOPASSWD" ]; }
# for ssh, they are not the same than the one hard coded in ${pkgs.btrbk}
{ command = "/run/current-system/sw/bin/btrfs"; options = [ "NOPASSWD" ]; }
{ command = "/run/current-system/sw/bin/mkdir"; options = [ "NOPASSWD" ]; }
{ command = "/run/current-system/sw/bin/readlink"; options = [ "NOPASSWD" ]; }
];
}
];
};
security.sudo.extraRules = mkIf (sudo_doas == "sudo") [ sudoRule ];
security.sudo-rs.extraRules = mkIf (sudo_doas == "sudo") [ sudoRule ];
security.doas = mkIf (sudo_doas == "doas") {
extraRules = let
doasCmdNoPass = cmd: { users = [ "btrbk" ]; cmd = cmd; noPass = true; };
@@ -5,12 +5,8 @@ with lib;
let
receiverSubmodule = {
options = {
postgresqlPackage = mkOption {
type = types.package;
example = literalExpression "pkgs.postgresql_15";
description = lib.mdDoc ''
PostgreSQL package to use.
'';
postgresqlPackage = mkPackageOption pkgs "postgresql" {
example = "postgresql_15";
};
directory = mkOption {
@@ -57,12 +57,7 @@ in
'';
};
package = mkOption {
default = pkgs.restic-rest-server;
defaultText = literalExpression "pkgs.restic-rest-server";
type = types.package;
description = lib.mdDoc "Restic REST server package to use.";
};
package = mkPackageOption pkgs "restic-rest-server" { };
};
config = mkIf cfg.enable {
+1 -8
View File
@@ -245,14 +245,7 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.restic;
defaultText = literalExpression "pkgs.restic";
description = lib.mdDoc ''
Restic package to use.
'';
};
package = mkPackageOption pkgs "restic" { };
createWrapper = lib.mkOption {
type = lib.types.bool;
+1 -6
View File
@@ -13,12 +13,7 @@ in
services.zrepl = {
enable = mkEnableOption (lib.mdDoc "zrepl");
package = mkOption {
type = types.package;
default = pkgs.zrepl;
defaultText = literalExpression "pkgs.zrepl";
description = lib.mdDoc "Which package to use for zrepl";
};
package = mkPackageOption pkgs "zrepl" { };
settings = mkOption {
default = { };
@@ -135,12 +135,7 @@ let
default = [];
};
package = mkOption {
default = pkgs.go-ethereum.geth;
defaultText = literalExpression "pkgs.go-ethereum.geth";
type = types.package;
description = lib.mdDoc "Package to use as Go Ethereum node.";
};
package = mkPackageOption pkgs [ "go-ethereum" "geth" ] { };
};
};
in
@@ -9,12 +9,7 @@ in
options.services.corosync = {
enable = mkEnableOption (lib.mdDoc "corosync");
package = mkOption {
type = types.package;
default = pkgs.corosync;
defaultText = literalExpression "pkgs.corosync";
description = lib.mdDoc "Package that should be used for corosync.";
};
package = mkPackageOption pkgs "corosync" { };
clusterName = mkOption {
type = types.str;
@@ -199,12 +199,7 @@ with lib;
gatewayRole.enable = mkEnableOption (lib.mdDoc "gateway role for deploying hadoop configs");
package = mkOption {
type = types.package;
default = pkgs.hadoop;
defaultText = literalExpression "pkgs.hadoop";
description = lib.mdDoc "";
};
package = mkPackageOption pkgs "hadoop" { };
};
@@ -134,12 +134,7 @@ in
hbase = {
package = mkOption {
type = types.package;
default = pkgs.hbase;
defaultText = literalExpression "pkgs.hbase";
description = mdDoc "HBase package";
};
package = mkPackageOption pkgs "hbase" { };
rootdir = mkOption {
description = mdDoc ''
@@ -15,12 +15,7 @@ in
options.services.k3s = {
enable = mkEnableOption (lib.mdDoc "k3s");
package = mkOption {
type = types.package;
default = pkgs.k3s;
defaultText = literalExpression "pkgs.k3s";
description = lib.mdDoc "Package that should be used for k3s";
};
package = mkPackageOption pkgs "k3s" { };
role = mkOption {
description = lib.mdDoc ''
@@ -122,12 +122,7 @@ in {
type = types.listOf (types.enum ["master" "node"]);
};
package = mkOption {
description = lib.mdDoc "Kubernetes package to use.";
type = types.package;
default = pkgs.kubernetes;
defaultText = literalExpression "pkgs.kubernetes";
};
package = mkPackageOption pkgs "kubernetes" { };
kubeconfig = mkKubeConfigOptions "Default kubeconfig";
@@ -9,12 +9,7 @@ in
options.services.pacemaker = {
enable = mkEnableOption (lib.mdDoc "pacemaker");
package = mkOption {
type = types.package;
default = pkgs.pacemaker;
defaultText = literalExpression "pkgs.pacemaker";
description = lib.mdDoc "Package that should be used for pacemaker.";
};
package = mkPackageOption pkgs "pacemaker" { };
};
# implementation
@@ -77,20 +77,18 @@ with lib;
description = lib.mdDoc "Spark log directory.";
default = "/var/log/spark";
};
package = mkOption {
type = types.package;
description = lib.mdDoc "Spark package.";
default = pkgs.spark;
defaultText = literalExpression "pkgs.spark";
example = literalExpression ''pkgs.spark.overrideAttrs (super: rec {
pname = "spark";
version = "2.4.4";
package = mkPackageOption pkgs "spark" {
example = ''
spark.overrideAttrs (super: rec {
pname = "spark";
version = "2.4.4";
src = pkgs.fetchzip {
url = "mirror://apache/spark/"''${pname}-''${version}/''${pname}-''${version}-bin-without-hadoop.tgz";
sha256 = "1a9w5k0207fysgpxx6db3a00fs5hdc2ncx99x4ccy2s0v5ndc66g";
};
})'';
src = pkgs.fetchzip {
url = "mirror://apache/spark/"''${pname}-''${version}/''${pname}-''${version}-bin-without-hadoop.tgz";
sha256 = "1a9w5k0207fysgpxx6db3a00fs5hdc2ncx99x4ccy2s0v5ndc66g";
};
})
'';
};
};
};
@@ -27,14 +27,8 @@ in
'';
};
package = mkOption {
type = types.package;
default = pkgs.boinc;
defaultText = literalExpression "pkgs.boinc";
example = literalExpression "pkgs.boinc-headless";
description = lib.mdDoc ''
Which BOINC package to use.
'';
package = mkPackageOption pkgs "boinc" {
example = "boinc-headless";
};
dataDir = mkOption {
@@ -20,14 +20,7 @@ in
options.services.foldingathome = {
enable = mkEnableOption (lib.mdDoc "Folding@home client");
package = mkOption {
type = types.package;
default = pkgs.fahclient;
defaultText = literalExpression "pkgs.fahclient";
description = lib.mdDoc ''
Which Folding@home client to use.
'';
};
package = mkPackageOption pkgs "fahclient" { };
user = mkOption {
type = types.nullOr types.str;
@@ -63,7 +56,7 @@ in
default = [];
description = lib.mdDoc ''
Extra startup options for the FAHClient. Run
`FAHClient --help` to find all the available options.
`fah-client --help` to find all the available options.
'';
};
};
@@ -74,7 +67,7 @@ in
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
script = ''
exec ${cfg.package}/bin/FAHClient ${lib.escapeShellArgs args}
exec ${lib.getExe cfg.package} ${lib.escapeShellArgs args}
'';
serviceConfig = {
DynamicUser = true;
@@ -131,14 +131,10 @@ in
'';
};
package = mkOption {
type = types.package;
package = mkPackageOption pkgs "slurm" {
example = "slurm-full";
} // {
default = pkgs.slurm.override { enableX11 = ! cfg.enableSrunX11; };
defaultText = literalExpression "pkgs.slurm";
example = literalExpression "pkgs.slurm-full";
description = lib.mdDoc ''
The package to use for slurm binaries.
'';
};
controlMachine = mkOption {
@@ -229,12 +229,8 @@ in {
description = lib.mdDoc "Specifies port number on which the buildbot HTTP interface listens.";
};
package = mkOption {
type = types.package;
default = pkgs.buildbot-full;
defaultText = literalExpression "pkgs.buildbot-full";
description = lib.mdDoc "Package to use for buildbot.";
example = literalExpression "pkgs.buildbot";
package = mkPackageOption pkgs "buildbot-full" {
example = "buildbot";
};
packages = mkOption {
@@ -128,12 +128,8 @@ in {
'';
};
package = mkOption {
type = types.package;
default = pkgs.buildbot-worker;
defaultText = literalExpression "pkgs.python3Packages.buildbot-worker";
description = lib.mdDoc "Package to use for buildbot worker.";
example = literalExpression "pkgs.python2Packages.buildbot-worker";
package = mkPackageOption pkgs "python3Packages.buildbot-worker" {
example = "python2Packages.buildbot-worker";
};
packages = mkOption {
@@ -161,14 +161,7 @@ with lib;
default = {};
};
package = mkOption {
type = types.package;
description = lib.mdDoc ''
Which github-runner derivation to use.
'';
default = pkgs.github-runner;
defaultText = literalExpression "pkgs.github-runner";
};
package = mkPackageOption pkgs "github-runner" { };
ephemeral = mkOption {
type = types.bool;
@@ -195,12 +195,8 @@ in {
Time to wait until a graceful shutdown is turned into a forceful one.
'';
};
package = mkOption {
type = types.package;
default = pkgs.gitlab-runner;
defaultText = literalExpression "pkgs.gitlab-runner";
example = literalExpression "pkgs.gitlab-runner_1_11";
description = lib.mdDoc "Gitlab Runner package to use.";
package = mkPackageOption pkgs "gitlab-runner" {
example = "gitlab-runner_1_11";
};
extraPackages = mkOption {
type = types.listOf types.package;
@@ -16,7 +16,7 @@ let
mkRemovedOptionModule
mkRenamedOptionModule
types
mkPackageOption
;
cfg = config.services.hercules-ci-agent;
@@ -45,14 +45,7 @@ in
Support is available at [help@hercules-ci.com](mailto:help@hercules-ci.com).
'';
};
package = mkOption {
description = lib.mdDoc ''
Package containing the bin/hercules-ci-agent executable.
'';
type = types.package;
default = pkgs.hercules-ci-agent;
defaultText = literalExpression "pkgs.hercules-ci-agent";
};
package = mkPackageOption pkgs "hercules-ci-agent" { };
settings = mkOption {
description = lib.mdDoc ''
These settings are written to the `agent.toml` file.

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