Skip to content

Commit

Permalink
Merge master into staging-next
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 11, 2024
2 parents 3ee4a54 + 1d472db commit 2a24738
Show file tree
Hide file tree
Showing 26 changed files with 1,105 additions and 1,075 deletions.
111 changes: 62 additions & 49 deletions doc/languages-frameworks/python.section.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nixos/modules/hardware/video/nvidia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ in
softdep nvidia post: nvidia-uvm
'';
};
systemd.tmpfiles.rules = lib.mkIf config.virtualisation.docker.enableNvidia "L+ /run/nvidia-docker/bin - - - - ${nvidia_x11.bin}/origBin";
systemd.tmpfiles.rules = lib.mkIf config.virtualisation.docker.enableNvidia [ "L+ /run/nvidia-docker/bin - - - - ${nvidia_x11.bin}/origBin" ];
services.udev.extraRules = ''
# Create /dev/nvidia-uvm when the nvidia-uvm module is loaded.
KERNEL=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidiactl c 195 255'"
Expand Down
154 changes: 77 additions & 77 deletions nixos/modules/misc/locate.nix
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.services.locate;
isMLocate = hasPrefix "mlocate" cfg.package.name;
isPLocate = hasPrefix "plocate" cfg.package.name;
isMLocate = lib.hasPrefix "mlocate" cfg.package.name;
isPLocate = lib.hasPrefix "plocate" cfg.package.name;
isMorPLocate = isMLocate || isPLocate;
isFindutils = hasPrefix "findutils" cfg.package.name;
isFindutils = lib.hasPrefix "findutils" cfg.package.name;
in
{
imports = [
(mkRenamedOptionModule [ "services" "locate" "period" ] [ "services" "locate" "interval" ])
(mkRenamedOptionModule [ "services" "locate" "locate" ] [ "services" "locate" "package" ])
(mkRemovedOptionModule [ "services" "locate" "includeStore" ] "Use services.locate.prunePaths")
(lib.mkRenamedOptionModule [ "services" "locate" "period" ] [ "services" "locate" "interval" ])
(lib.mkRenamedOptionModule [ "services" "locate" "locate" ] [ "services" "locate" "package" ])
(lib.mkRemovedOptionModule [ "services" "locate" "includeStore" ] "Use services.locate.prunePaths")
];

options.services.locate = with types; {
enable = mkOption {
type = bool;
options.services.locate = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
If enabled, NixOS will periodically update the database of
files used by the {command}`locate` command.
'';
};

package = mkPackageOption pkgs [ "findutils" "locate" ] {
package = lib.mkPackageOption pkgs [ "findutils" "locate" ] {
example = "mlocate";
};

interval = mkOption {
type = str;
interval = lib.mkOption {
type = lib.types.str;
default = "02:15";
example = "hourly";
description = ''
Expand All @@ -46,33 +44,33 @@ in
'';
};

extraFlags = mkOption {
type = listOf str;
extraFlags = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = ''
Extra flags to pass to {command}`updatedb`.
'';
};

output = mkOption {
type = path;
output = lib.mkOption {
type = lib.types.path;
default = "/var/cache/locatedb";
description = ''
The database file to build.
'';
};

localuser = mkOption {
type = nullOr str;
localuser = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = "nobody";
description = ''
The user to search non-network directories as, using
{command}`su`.
'';
};

pruneFS = mkOption {
type = listOf str;
pruneFS = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"afs"
"anon_inodefs"
Expand Down Expand Up @@ -158,8 +156,8 @@ in
'';
};

prunePaths = mkOption {
type = listOf path;
prunePaths = lib.mkOption {
type = lib.types.listOf lib.types.path;
default = [
"/tmp"
"/var/tmp"
Expand All @@ -175,10 +173,10 @@ in
'';
};

pruneNames = mkOption {
type = listOf str;
pruneNames = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = lib.optionals (!isFindutils) [ ".bzr" ".cache" ".git" ".hg" ".svn" ];
defaultText = literalMD ''
defaultText = lib.literalMD ''
`[ ".bzr" ".cache" ".git" ".hg" ".svn" ]`, if
supported by the locate implementation (i.e. mlocate or plocate).
'';
Expand All @@ -187,8 +185,8 @@ in
'';
};

pruneBindMounts = mkOption {
type = bool;
pruneBindMounts = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether not to index bind mounts
Expand All @@ -197,10 +195,10 @@ in

};

config = mkIf cfg.enable {
users.groups = mkMerge [
(mkIf isMLocate { mlocate = { }; })
(mkIf isPLocate { plocate = { }; })
config = lib.mkIf cfg.enable {
users.groups = lib.mkMerge [
(lib.mkIf isMLocate { mlocate = { }; })
(lib.mkIf isPLocate { plocate = { }; })
];

security.wrappers =
Expand All @@ -211,89 +209,91 @@ in
setgid = true;
setuid = false;
};
mlocate = mkIf isMLocate {
mlocate = lib.mkIf isMLocate {
group = "mlocate";
source = "${cfg.package}/bin/locate";
};
plocate = mkIf isPLocate {
plocate = lib.mkIf isPLocate {
group = "plocate";
source = "${cfg.package}/bin/plocate";
};
in
mkIf isMorPLocate {
locate = mkMerge [ common mlocate plocate ];
plocate = mkIf isPLocate (mkMerge [ common plocate ]);
lib.mkIf isMorPLocate {
locate = lib.mkMerge [ common mlocate plocate ];
plocate = lib.mkIf isPLocate (lib.mkMerge [ common plocate ]);
};

environment.systemPackages = [ cfg.package ];
environment = {
# write /etc/updatedb.conf for manual calls to `updatedb`
etc."updatedb.conf".text = ''
PRUNEFS="${lib.concatStringsSep " " cfg.pruneFS}"
PRUNENAMES="${lib.concatStringsSep " " cfg.pruneNames}"
PRUNEPATHS="${lib.concatStringsSep " " cfg.prunePaths}"
PRUNE_BIND_MOUNTS="${if cfg.pruneBindMounts then "yes" else "no"}"
'';

environment.variables.LOCATE_PATH = cfg.output;
systemPackages = [ cfg.package ];

environment.etc = {
# write /etc/updatedb.conf for manual calls to `updatedb`
"updatedb.conf" = {
text = ''
PRUNEFS="${lib.concatStringsSep " " cfg.pruneFS}"
PRUNENAMES="${lib.concatStringsSep " " cfg.pruneNames}"
PRUNEPATHS="${lib.concatStringsSep " " cfg.prunePaths}"
PRUNE_BIND_MOUNTS="${if cfg.pruneBindMounts then "yes" else "no"}"
'';
variables = lib.mkIf isFindutils {
LOCATE_PATH = cfg.output;
};
};

warnings = optional (isMorPLocate && cfg.localuser != null)
warnings = lib.optional (isMorPLocate && cfg.localuser != null)
"mlocate and plocate do not support the services.locate.localuser option. updatedb will run as root. Silence this warning by setting services.locate.localuser = null."
++ optional (isFindutils && cfg.pruneNames != [ ])
++ lib.optional (isFindutils && cfg.pruneNames != [ ])
"findutils locate does not support pruning by directory component"
++ optional (isFindutils && cfg.pruneBindMounts)
++ lib.optional (isFindutils && cfg.pruneBindMounts)
"findutils locate does not support skipping bind mounts";

systemd.services.update-locatedb = {
description = "Update Locate Database";
path = mkIf (!isMorPLocate) [ pkgs.su ];
path = lib.mkIf (!isMorPLocate) [ pkgs.su ];

# mlocate's updatedb takes flags via a configuration file or
# on the command line, but not by environment variable.
script =
if isMorPLocate then
let
toFlags = x:
optional (cfg.${x} != [ ])
"--${lib.toLower x} '${concatStringsSep " " cfg.${x}}'";
args = concatLists (map toFlags [ "pruneFS" "pruneNames" "prunePaths" ]);
lib.optional (cfg.${x} != [ ])
"--${lib.toLower x} '${lib.concatStringsSep " " cfg.${x}}'";
args = lib.concatLists (map toFlags [ "pruneFS" "pruneNames" "prunePaths" ]);
in
''
exec ${cfg.package}/bin/updatedb \
--output ${toString cfg.output} ${concatStringsSep " " args} \
--output ${toString cfg.output} ${lib.concatStringsSep " " args} \
--prune-bind-mounts ${if cfg.pruneBindMounts then "yes" else "no"} \
${concatStringsSep " " cfg.extraFlags}
${lib.concatStringsSep " " cfg.extraFlags}
''
else ''
exec ${cfg.package}/bin/updatedb \
${optionalString (cfg.localuser != null && !isMorPLocate) "--localuser=${cfg.localuser}"} \
--output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
${lib.optionalString (cfg.localuser != null && !isMorPLocate) "--localuser=${cfg.localuser}"} \
--output=${toString cfg.output} ${lib.concatStringsSep " " cfg.extraFlags}
'';
environment = optionalAttrs (!isMorPLocate) {
PRUNEFS = concatStringsSep " " cfg.pruneFS;
PRUNEPATHS = concatStringsSep " " cfg.prunePaths;
PRUNENAMES = concatStringsSep " " cfg.pruneNames;
environment = lib.optionalAttrs (!isMorPLocate) {
PRUNEFS = lib.concatStringsSep " " cfg.pruneFS;
PRUNEPATHS = lib.concatStringsSep " " cfg.prunePaths;
PRUNENAMES = lib.concatStringsSep " " cfg.pruneNames;
PRUNE_BIND_MOUNTS = if cfg.pruneBindMounts then "yes" else "no";
};
serviceConfig.Nice = 19;
serviceConfig.IOSchedulingClass = "idle";
serviceConfig.PrivateTmp = "yes";
serviceConfig.PrivateNetwork = "yes";
serviceConfig.NoNewPrivileges = "yes";
serviceConfig.ReadOnlyPaths = "/";
# Use dirOf cfg.output because mlocate creates temporary files next to
# the actual database. We could specify and create them as well,
# but that would make this quite brittle when they change something.
# NOTE: If /var/cache does not exist, this leads to the misleading error message:
# update-locatedb.service: Failed at step NAMESPACE spawning …/update-locatedb-start: No such file or directory
serviceConfig.ReadWritePaths = dirOf cfg.output;
serviceConfig = {
Nice = 19;
IOSchedulingClass = "idle";
PrivateTmp = "yes";
PrivateNetwork = "yes";
NoNewPrivileges = "yes";
ReadOnlyPaths = "/";
# Use dirOf cfg.output because mlocate creates temporary files next to
# the actual database. We could specify and create them as well,
# but that would make this quite brittle when they change something.
# NOTE: If /var/cache does not exist, this leads to the misleading error message:
# update-locatedb.service: Failed at step NAMESPACE spawning …/update-locatedb-start: No such file or directory
ReadWritePaths = dirOf cfg.output;
};
};

systemd.timers.update-locatedb = mkIf (cfg.interval != "never") {
systemd.timers.update-locatedb = lib.mkIf (cfg.interval != "never") {
description = "Update timer for locate database";
partOf = [ "update-locatedb.service" ];
wantedBy = [ "timers.target" ];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/vim/plugins/deprecated.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"new": "vim-fern"
},
"gina-vim": {
"date": "2024-05-28",
"date": "2024-06-11",
"new": "vim-gina"
},
"gist-vim": {
Expand Down Expand Up @@ -60,7 +60,7 @@
"new": "vim-suda"
},
"vim-fsharp": {
"date": "2024-05-28",
"date": "2024-06-11",
"new": "zarchive-vim-fsharp"
},
"vim-jade": {
Expand Down
Loading

0 comments on commit 2a24738

Please sign in to comment.