From 88f912da4852c38a5db25e882f3d89dac23a421c Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 12 Feb 2025 14:38:20 +0700 Subject: [PATCH 01/46] Docs: migrate format of comments to doc-comments --- lib/fileset/internal.nix | 38 ++- lib/licenses.nix | 13 +- lib/modules.nix | 591 +++++++++++++++++++++++++++----------- lib/network/internal.nix | 4 +- lib/options.nix | 178 +++++++++--- lib/path/default.nix | 491 ++++++++++++++++++++----------- lib/sources.nix | 157 ++++++++-- lib/strings-with-deps.nix | 62 ++-- lib/versions.nix | 143 +++++++-- 9 files changed, 1199 insertions(+), 478 deletions(-) diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix index 7f002216bc7f..1fd0a7e2350d 100644 --- a/lib/fileset/internal.nix +++ b/lib/fileset/internal.nix @@ -267,7 +267,7 @@ rec { # Set all entries not present to null mapAttrs (name: value: null) (readDir path) // value; - /* + /** A normalisation of a filesetTree suitable filtering with `builtins.path`: - Replace all directories that have no files with `null`. This removes directories that would be empty @@ -276,7 +276,22 @@ rec { Note that this function is strict, it evaluates the entire tree - Type: Path -> filesetTree -> filesetTree + + # Inputs + + `path` + + : 1\. Function argument + + `tree` + + : 2\. Function argument + + # Type + + ``` + Path -> filesetTree -> filesetTree + ``` */ _normaliseTreeFilter = path: tree: @@ -298,7 +313,7 @@ rec { else tree; - /* + /** A minimal normalisation of a filesetTree, intended for pretty-printing: - If all children of a path are recursively included or empty directories, the path itself is also recursively included - If all children of a path are fully excluded or empty directories, the path itself is an empty directory @@ -307,7 +322,22 @@ rec { Note that this function is partially lazy. - Type: Path -> filesetTree -> filesetTree (with "emptyDir"'s) + + # Inputs + + `path` + + : 1\. Function argument + + `tree` + + : 2\. Function argument + + # Type + + ``` + Path -> filesetTree -> filesetTree (with "emptyDir"'s) + ``` */ _normaliseTreeMinimal = path: tree: diff --git a/lib/licenses.nix b/lib/licenses.nix index f72efa5a6145..5d0aff11b7a3 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -24,10 +24,11 @@ let in lib.mapAttrs mkLicense ({ - /* License identifiers from spdx.org where possible. - * If you cannot find your license here, then look for a similar license or - * add it to this list. The URL mentioned above is a good source for inspiration. - */ + /** + License identifiers from spdx.org where possible. + If you cannot find your license here, then look for a similar license or + add it to this list. The URL mentioned above is a good source for inspiration. + */ abstyles = { spdxId = "Abstyles"; @@ -37,7 +38,9 @@ lib.mapAttrs mkLicense ({ acsl14 = { fullName = "Anti-Capitalist Software License v1.4"; url = "https://anticapitalist.software/"; - /* restrictions on corporations apply for both use and redistribution */ + /** + restrictions on corporations apply for both use and redistribution + */ free = false; redistributable = false; }; diff --git a/lib/modules.nix b/lib/modules.nix index 4d2d8e0b08b6..935ef4baabad 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -74,14 +74,16 @@ let decls )); - /* See https://nixos.org/manual/nixpkgs/unstable/#module-system-lib-evalModules - or file://./../doc/module-system/module-system.chapter.md + /** + See https://nixos.org/manual/nixpkgs/unstable/#module-system-lib-evalModules + or file://./../doc/module-system/module-system.chapter.md - !!! Please think twice before adding to this argument list! The more - that is specified here instead of in the modules themselves the harder - it is to transparently move a set of modules to be a submodule of another - config (as the proper arguments need to be replicated at each call to - evalModules) and the less declarative the module set is. */ + !!! Please think twice before adding to this argument list! The more + that is specified here instead of in the modules themselves the harder + it is to transparently move a set of modules to be a submodule of another + config (as the proper arguments need to be replicated at each call to + evalModules) and the less declarative the module set is. + */ evalModules = evalModulesArgs@ { modules , prefix ? [] @@ -378,30 +380,30 @@ let else m: m; - /* - Collects all modules recursively into the form + /** + Collects all modules recursively into the form - { - disabled = [ ]; - # All modules of the main module list - modules = [ - { - key = ; - module = ; - # All modules imported by the module for key1 - modules = [ - { - key = ; - module = ; - # All modules imported by the module for key1-1 - modules = [ ... ]; - } - ... - ]; - } - ... - ]; - } + { + disabled = [ ]; + # All modules of the main module list + modules = [ + { + key = ; + module = ; + # All modules imported by the module for key1 + modules = [ + { + key = ; + module = ; + # All modules imported by the module for key1-1 + modules = [ ... ]; + } + ... + ]; + } + ... + ]; + } */ collectStructuredModules = let @@ -459,12 +461,42 @@ let in modulesPath: initialModules: args: filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args); - /* Wrap a module with a default location for reporting errors. */ + /** + Wrap a module with a default location for reporting errors. + + + # Inputs + + `file` + + : 1\. Function argument + + `m` + + : 2\. Function argument + */ setDefaultModuleLocation = file: m: { _file = file; imports = [ m ]; }; - /* Massage a module into canonical form, that is, a set consisting - of ‘options’, ‘config’ and ‘imports’ attributes. */ + /** + Massage a module into canonical form, that is, a set consisting + of ‘options’, ‘config’ and ‘imports’ attributes. + + + # Inputs + + `file` + + : 1\. Function argument + + `key` + + : 2\. Function argument + + `m` + + : 3\. Function argument + */ unifyModuleSyntax = file: key: m: let addMeta = config: if m ? meta @@ -528,26 +560,38 @@ let # works. in f (args // extraArgs); - /* Merge a list of modules. This will recurse over the option - declarations in all modules, combining them into a single set. - At the same time, for each option declaration, it will merge the - corresponding option definitions in all machines, returning them - in the ‘value’ attribute of each option. + /** + Merge a list of modules. This will recurse over the option + declarations in all modules, combining them into a single set. + At the same time, for each option declaration, it will merge the + corresponding option definitions in all machines, returning them + in the ‘value’ attribute of each option. - This returns a set like - { - # A recursive set of options along with their final values - matchedOptions = { - foo = { _type = "option"; value = "option value of foo"; ... }; - bar.baz = { _type = "option"; value = "option value of bar.baz"; ... }; - ... - }; - # A list of definitions that weren't matched by any option - unmatchedDefns = [ - { file = "file.nix"; prefix = [ "qux" ]; value = "qux"; } - ... - ]; - } + This returns a set like + { + # A recursive set of options along with their final values + matchedOptions = { + foo = { _type = "option"; value = "option value of foo"; ... }; + bar.baz = { _type = "option"; value = "option value of bar.baz"; ... }; + ... + }; + # A list of definitions that weren't matched by any option + unmatchedDefns = [ + { file = "file.nix"; prefix = [ "qux" ]; value = "qux"; } + ... + ]; + } + + + # Inputs + + `prefix` + + : 1\. Function argument + + `modules` + + : 2\. Function argument */ mergeModules = prefix: modules: mergeModules' prefix modules @@ -740,17 +784,30 @@ let in throw (concatStringsSep "\n\n" paragraphs); - /* Merge multiple option declarations into a single declaration. In - general, there should be only one declaration of each option. - The exception is the ‘options’ attribute, which specifies - sub-options. These can be specified multiple times to allow one - module to add sub-options to an option declared somewhere else - (e.g. multiple modules define sub-options for ‘fileSystems’). + /** + Merge multiple option declarations into a single declaration. In + general, there should be only one declaration of each option. + The exception is the ‘options’ attribute, which specifies + sub-options. These can be specified multiple times to allow one + module to add sub-options to an option declared somewhere else + (e.g. multiple modules define sub-options for ‘fileSystems’). - 'loc' is the list of attribute names where the option is located. + 'loc' is the list of attribute names where the option is located. - 'opts' is a list of modules. Each module has an options attribute which - correspond to the definition of 'loc' in 'opt.file'. */ + 'opts' is a list of modules. Each module has an options attribute which + correspond to the definition of 'loc' in 'opt.file'. + + + # Inputs + + `loc` + + : 1\. Function argument + + `opts` + + : 2\. Function argument + */ mergeOptionDecls = loc: opts: foldl' (res: opt: @@ -819,8 +876,25 @@ let } // typeSet ) { inherit loc; declarations = []; declarationPositions = []; options = []; } opts; - /* Merge all the definitions of an option to produce the final - config value. */ + /** + Merge all the definitions of an option to produce the final + config value. + + + # Inputs + + `loc` + + : 1\. Function argument + + `opt` + + : 2\. Function argument + + `defs` + + : 3\. Function argument + */ evalOptionValue = loc: opt: defs: let # Add in the default value for this option, if any. @@ -902,20 +976,28 @@ let else {}; }; - /* Given a config set, expand mkMerge properties, and push down the - other properties into the children. The result is a list of - config sets that do not have properties at top-level. For - example, + /** + Given a config set, expand mkMerge properties, and push down the + other properties into the children. The result is a list of + config sets that do not have properties at top-level. For + example, - mkMerge [ { boot = set1; } (mkIf cond { boot = set2; services = set3; }) ] + mkMerge [ { boot = set1; } (mkIf cond { boot = set2; services = set3; }) ] - is transformed into + is transformed into - [ { boot = set1; } { boot = mkIf cond set2; services = mkIf cond set3; } ]. + [ { boot = set1; } { boot = mkIf cond set2; services = mkIf cond set3; } ]. - This transform is the critical step that allows mkIf conditions - to refer to the full configuration without creating an infinite - recursion. + This transform is the critical step that allows mkIf conditions + to refer to the full configuration without creating an infinite + recursion. + + + # Inputs + + `cfg` + + : 1\. Function argument */ pushDownProperties = cfg: if cfg._type or "" == "merge" then @@ -927,15 +1009,23 @@ let else # FIXME: handle mkOrder? [ cfg ]; - /* Given a config value, expand mkMerge properties, and discharge - any mkIf conditions. That is, this is the place where mkIf - conditions are actually evaluated. The result is a list of - config values. For example, ‘mkIf false x’ yields ‘[]’, - ‘mkIf true x’ yields ‘[x]’, and + /** + Given a config value, expand mkMerge properties, and discharge + any mkIf conditions. That is, this is the place where mkIf + conditions are actually evaluated. The result is a list of + config values. For example, ‘mkIf false x’ yields ‘[]’, + ‘mkIf true x’ yields ‘[x]’, and - mkMerge [ 1 (mkIf true 2) (mkIf true (mkIf false 3)) ] + mkMerge [ 1 (mkIf true 2) (mkIf true (mkIf false 3)) ] - yields ‘[ 1 2 ]’. + yields ‘[ 1 2 ]’. + + + # Inputs + + `def` + + : 1\. Function argument */ dischargeProperties = def: if def._type or "" == "merge" then @@ -951,24 +1041,32 @@ let else [ def ]; - /* Given a list of config values, process the mkOverride properties, - that is, return the values that have the highest (that is, - numerically lowest) priority, and strip the mkOverride - properties. For example, + /** + Given a list of config values, process the mkOverride properties, + that is, return the values that have the highest (that is, + numerically lowest) priority, and strip the mkOverride + properties. For example, - [ { file = "/1"; value = mkOverride 10 "a"; } - { file = "/2"; value = mkOverride 20 "b"; } - { file = "/3"; value = "z"; } - { file = "/4"; value = mkOverride 10 "d"; } - ] + [ { file = "/1"; value = mkOverride 10 "a"; } + { file = "/2"; value = mkOverride 20 "b"; } + { file = "/3"; value = "z"; } + { file = "/4"; value = mkOverride 10 "d"; } + ] - yields + yields - [ { file = "/1"; value = "a"; } - { file = "/4"; value = "d"; } - ] + [ { file = "/1"; value = "a"; } + { file = "/4"; value = "d"; } + ] - Note that "z" has the default priority 100. + Note that "z" has the default priority 100. + + + # Inputs + + `defs` + + : 1\. Function argument */ filterOverrides = defs: (filterOverrides' defs).values; @@ -982,9 +1080,18 @@ let inherit highestPrio; }; - /* Sort a list of properties. The sort priority of a property is - defaultOrderPriority by default, but can be overridden by wrapping the property - using mkOrder. */ + /** + Sort a list of properties. The sort priority of a property is + defaultOrderPriority by default, but can be overridden by wrapping the property + using mkOrder. + + + # Inputs + + `defs` + + : 1\. Function argument + */ sortProperties = defs: let strip = def: @@ -1004,14 +1111,24 @@ 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 } + + # Inputs + + `opt` + + : 1\. Function argument + + # Type + + ``` + option -> attrsOf { highestPrio, value } + ``` */ mergeAttrDefinitionsWithPrio = opt: let @@ -1038,7 +1155,20 @@ let }) defsByAttr; - /* Properties. */ + /** + Properties. + + + # Inputs + + `condition` + + : 1\. Function argument + + `content` + + : 2\. Function argument + */ mkIf = condition: content: { _type = "if"; @@ -1116,21 +1246,46 @@ let mkAliasIfDef = option: mkIf (isOption option && option.isDefined); - /* Compatibility. */ + /** + Compatibility. + + + # Inputs + + `modules` + + : 1\. Function argument + + `args` + + : 2\. Function argument + */ fixMergeModules = modules: args: evalModules { inherit modules args; check = false; }; - /* Return a module that causes a warning to be shown if the - specified option is defined. For example, + /** + Return a module that causes a warning to be shown if the + specified option is defined. For example, - mkRemovedOptionModule [ "boot" "loader" "grub" "bootDevice" ] "" + mkRemovedOptionModule [ "boot" "loader" "grub" "bootDevice" ] "" - causes a assertion if the user defines boot.loader.grub.bootDevice. + causes a assertion if the user defines boot.loader.grub.bootDevice. - replacementInstructions is a string that provides instructions on - how to achieve the same functionality without the removed option, - or alternatively a reasoning why the functionality is not needed. - replacementInstructions SHOULD be provided! + replacementInstructions is a string that provides instructions on + how to achieve the same functionality without the removed option, + or alternatively a reasoning why the functionality is not needed. + replacementInstructions SHOULD be provided! + + + # Inputs + + `optionName` + + : 1\. Function argument + + `replacementInstructions` + + : 2\. Function argument */ mkRemovedOptionModule = optionName: replacementInstructions: { options, ... }: @@ -1148,18 +1303,30 @@ let }]; }; - /* Return a module that causes a warning to be shown if the - specified "from" option is defined; the defined value is however - forwarded to the "to" option. This can be used to rename options - while providing backward compatibility. For example, + /** + Return a module that causes a warning to be shown if the + specified "from" option is defined; the defined value is however + forwarded to the "to" option. This can be used to rename options + while providing backward compatibility. For example, - mkRenamedOptionModule [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ] + mkRenamedOptionModule [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ] - forwards any definitions of boot.copyKernels to - boot.loader.grub.copyKernels while printing a warning. + forwards any definitions of boot.copyKernels to + boot.loader.grub.copyKernels while printing a warning. - This also copies over the priority from the aliased option to the - non-aliased option. + This also copies over the priority from the aliased option to the + non-aliased option. + + + # Inputs + + `from` + + : 1\. Function argument + + `to` + + : 2\. Function argument */ mkRenamedOptionModule = from: to: doRename { inherit from to; @@ -1169,12 +1336,16 @@ let }; mkRenamedOptionModuleWith = { - /* Old option path as list of strings. */ + /** + Old option path as list of strings. + */ from, - /* New option path as list of strings. */ + /** + New option path as list of strings. + */ to, - /* + /** Release number of the first release that contains the rename, ignoring backports. Set it to the upcoming release, matching the nixpkgs/.version file. */ @@ -1188,33 +1359,49 @@ let "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'."; }; - /* Return a module that causes a warning to be shown if any of the "from" - option is defined; the defined values can be used in the "mergeFn" to set - the "to" value. - This function can be used to merge multiple options into one that has a - different type. + /** + Return a module that causes a warning to be shown if any of the "from" + option is defined; the defined values can be used in the "mergeFn" to set + the "to" value. + This function can be used to merge multiple options into one that has a + different type. - "mergeFn" takes the module "config" as a parameter and must return a value - of "to" option type. + "mergeFn" takes the module "config" as a parameter and must return a value + of "to" option type. - mkMergedOptionModule - [ [ "a" "b" "c" ] - [ "d" "e" "f" ] ] - [ "x" "y" "z" ] - (config: - let value = p: getAttrFromPath p config; - in - if (value [ "a" "b" "c" ]) == true then "foo" - else if (value [ "d" "e" "f" ]) == true then "bar" - else "baz") + mkMergedOptionModule + [ [ "a" "b" "c" ] + [ "d" "e" "f" ] ] + [ "x" "y" "z" ] + (config: + let value = p: getAttrFromPath p config; + in + if (value [ "a" "b" "c" ]) == true then "foo" + else if (value [ "d" "e" "f" ]) == true then "bar" + else "baz") - - options.a.b.c is a removed boolean option - - options.d.e.f is a removed boolean option - - options.x.y.z is a new str option that combines a.b.c and d.e.f - functionality + - options.a.b.c is a removed boolean option + - options.d.e.f is a removed boolean option + - options.x.y.z is a new str option that combines a.b.c and d.e.f + functionality - This show a warning if any a.b.c or d.e.f is set, and set the value of - x.y.z to the result of the merge function + This show a warning if any a.b.c or d.e.f is set, and set the value of + x.y.z to the result of the merge function + + + # Inputs + + `from` + + : 1\. Function argument + + `to` + + : 2\. Function argument + + `mergeFn` + + : 3\. Function argument */ mkMergedOptionModule = from: to: mergeFn: { config, options, ... }: @@ -1240,33 +1427,62 @@ let (mergeFn config))); }; - /* Single "from" version of mkMergedOptionModule. - Return a module that causes a warning to be shown if the "from" option is - defined; the defined value can be used in the "mergeFn" to set the "to" - value. - This function can be used to change an option into another that has a - different type. + /** + Single "from" version of mkMergedOptionModule. + Return a module that causes a warning to be shown if the "from" option is + defined; the defined value can be used in the "mergeFn" to set the "to" + value. + This function can be used to change an option into another that has a + different type. - "mergeFn" takes the module "config" as a parameter and must return a value of - "to" option type. + "mergeFn" takes the module "config" as a parameter and must return a value of + "to" option type. - mkChangedOptionModule [ "a" "b" "c" ] [ "x" "y" "z" ] - (config: - let value = getAttrFromPath [ "a" "b" "c" ] config; - in - if value > 100 then "high" - else "normal") + mkChangedOptionModule [ "a" "b" "c" ] [ "x" "y" "z" ] + (config: + let value = getAttrFromPath [ "a" "b" "c" ] config; + in + if value > 100 then "high" + else "normal") - - options.a.b.c is a removed int option - - options.x.y.z is a new str option that supersedes a.b.c + - options.a.b.c is a removed int option + - options.x.y.z is a new str option that supersedes a.b.c - This show a warning if a.b.c is set, and set the value of x.y.z to the - result of the change function + This show a warning if a.b.c is set, and set the value of x.y.z to the + result of the change function + + + # Inputs + + `from` + + : 1\. Function argument + + `to` + + : 2\. Function argument + + `changeFn` + + : 3\. Function argument */ mkChangedOptionModule = from: to: changeFn: mkMergedOptionModule [ from ] to changeFn; - /* Like ‘mkRenamedOptionModule’, but doesn't show a warning. */ + /** + Like ‘mkRenamedOptionModule’, but doesn't show a warning. + + + # Inputs + + `from` + + : 1\. Function argument + + `to` + + : 2\. Function argument + */ mkAliasOptionModule = from: to: doRename { inherit from to; visible = true; @@ -1274,13 +1490,15 @@ let use = id; }; - /* Transitional version of mkAliasOptionModule that uses MD docs. + /** + Transitional version of mkAliasOptionModule that uses MD docs. - This function is no longer necessary and merely an alias of `mkAliasOptionModule`. + This function is no longer necessary and merely an alias of `mkAliasOptionModule`. */ mkAliasOptionModuleMD = mkAliasOptionModule; - /* mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b + /** + mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b Create config definitions with the same priority as the definition of another option. This should be used for option definitions where one option sets the value of another as a convenience. @@ -1288,6 +1506,17 @@ let value using `mkDerivedConfig options.text (pkgs.writeText "filename.conf")`. It takes care of setting the right priority using `mkOverride`. + + + # Inputs + + `opt` + + : 1\. Function argument + + `f` + + : 2\. Function argument */ # TODO: make the module system error message include information about `opt` in # error messages about conflicts. E.g. introduce a variation of `mkOverride` which @@ -1300,10 +1529,10 @@ let (opt.highestPrio or defaultOverridePriority) (f opt.value); - /* + /** Return a module that help declares an option that has been renamed. When a value is defined for the old option, it is forwarded to the `to` option. - */ + */ doRename = { # List of strings representing the attribute path of the old option. from, @@ -1450,18 +1679,34 @@ let modulePath: staticArg: lib.setDefaultModuleLocation modulePath (import modulePath staticArg); - /* Use this function to import a JSON file as NixOS configuration. + /** + Use this function to import a JSON file as NixOS configuration. - modules.importJSON :: path -> attrs + modules.importJSON :: path -> attrs + + + # Inputs + + `file` + + : 1\. Function argument */ importJSON = file: { _file = file; config = lib.importJSON file; }; - /* Use this function to import a TOML file as NixOS configuration. + /** + Use this function to import a TOML file as NixOS configuration. - modules.importTOML :: path -> attrs + modules.importTOML :: path -> attrs + + + # Inputs + + `file` + + : 1\. Function argument */ importTOML = file: { _file = file; diff --git a/lib/network/internal.nix b/lib/network/internal.nix index 3e05be90c547..20a18e073af5 100644 --- a/lib/network/internal.nix +++ b/lib/network/internal.nix @@ -16,7 +16,7 @@ let inherit (lib.lists) last; - /* + /** IPv6 addresses are 128-bit identifiers. The preferred form is 'x:x:x:x:x:x:x:x', where the 'x's are one to four hexadecimal digits of the eight 16-bit pieces of the address. See RFC 4291. @@ -138,7 +138,7 @@ let parseIpv6FromString = addr: parseExpandedIpv6 (expandIpv6 addr); in { - /* + /** Internally, an IPv6 address is stored as a list of 16-bit integers with 8 elements. Wherever you see `IPv6` in internal functions docs, it means that it is a list of integers produced by one of the internal parsers, such as diff --git a/lib/options.nix b/lib/options.nix index fe665040ad03..08ac385ff46f 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -426,18 +426,29 @@ rec { else if all isInt list && all (x: x == head list) list then head list else throw "Cannot merge definitions of `${showOption loc}'. Definition values:${showDefs defs}"; - /* + /** Require a single definition. WARNING: Does not perform nested checks, as this does not run the merge function! */ mergeOneOption = mergeUniqueOption { message = ""; }; - /* + /** Require a single definition. NOTE: When the type is not checked completely by check, pass a merge function for further checking (of sub-attributes, etc). - */ + + + # Inputs + + `loc` + + : 2\. Function argument + + `defs` + + : 3\. Function argument + */ mergeUniqueOption = args@{ message, # WARNING: the default merge function assumes that the definition is a valid (option) value. You MUST pass a merge function if the return value needs to be @@ -452,7 +463,20 @@ rec { assert length defs > 1; throw "The option `${showOption loc}' is defined multiple times while it's expected to be unique.\n${message}\nDefinition values:${showDefs defs}\n${prioritySuggestion}"; - /* "Merge" option definitions by checking that they all have the same value. */ + /** + "Merge" option definitions by checking that they all have the same value. + + + # Inputs + + `loc` + + : 1\. Function argument + + `defs` + + : 2\. Function argument + */ mergeEqualOption = loc: defs: if defs == [] then abort "This case should never happen." # Return early if we only have one element @@ -465,23 +489,47 @@ rec { else first) (head defs) (tail defs)).value; - /* Extracts values of all "value" keys of the given list. + /** + Extracts values of all "value" keys of the given list. - Type: getValues :: [ { value :: a; } ] -> [a] + # Type - Example: - getValues [ { value = 1; } { value = 2; } ] // => [ 1 2 ] - getValues [ ] // => [ ] + ``` + getValues :: [ { value :: a; } ] -> [a] + ``` + + # Examples + :::{.example} + ## `getValues` usage example + + ```nix + getValues [ { value = 1; } { value = 2; } ] // => [ 1 2 ] + getValues [ ] // => [ ] + ``` + + ::: */ getValues = map (x: x.value); - /* Extracts values of all "file" keys of the given list + /** + Extracts values of all "file" keys of the given list - Type: getFiles :: [ { file :: a; } ] -> [a] + # Type - Example: - getFiles [ { file = "file1"; } { file = "file2"; } ] // => [ "file1" "file2" ] - getFiles [ ] // => [ ] + ``` + getFiles :: [ { file :: a; } ] -> [a] + ``` + + # Examples + :::{.example} + ## `getFiles` usage example + + ```nix + getFiles [ { file = "file1"; } { file = "file2"; } ] // => [ "file1" "file2" ] + getFiles [ ] // => [ ] + ``` + + ::: */ getFiles = map (x: x.file); @@ -530,16 +578,24 @@ rec { [ docOption ] ++ optionals subOptionsVisible subOptions) (collect isOption options); - /* This function recursively removes all derivation attributes from - `x` except for the `name` attribute. + /** + This function recursively removes all derivation attributes from + `x` except for the `name` attribute. - This is to make the generation of `options.xml` much more - efficient: the XML representation of derivations is very large - (on the order of megabytes) and is not actually used by the - manual generator. + This is to make the generation of `options.xml` much more + efficient: the XML representation of derivations is very large + (on the order of megabytes) and is not actually used by the + manual generator. - This function was made obsolete by renderOptionValue and is kept for - compatibility with out-of-tree code. + This function was made obsolete by renderOptionValue and is kept for + compatibility with out-of-tree code. + + + # Inputs + + `x` + + : 1\. Function argument */ scrubOptionValue = x: if isDerivation x then @@ -549,8 +605,16 @@ rec { else x; - /* Ensures that the given option value (default or example) is a `_type`d string - by rendering Nix values to `literalExpression`s. + /** + Ensures that the given option value (default or example) is a `_type`d string + by rendering Nix values to `literalExpression`s. + + + # Inputs + + `v` + + : 1\. Function argument */ renderOptionValue = v: if v ? _type && v ? text then v @@ -560,10 +624,18 @@ rec { } v); - /* For use in the `defaultText` and `example` option attributes. Causes the - given string to be rendered verbatim in the documentation as Nix code. This - is necessary for complex values, e.g. functions, or values that depend on - other values or packages. + /** + For use in the `defaultText` and `example` option attributes. Causes the + given string to be rendered verbatim in the documentation as Nix code. This + is necessary for complex values, e.g. functions, or values that depend on + other values or packages. + + + # Inputs + + `text` + + : 1\. Function argument */ literalExpression = text: if ! isString text then throw "literalExpression expects a string." @@ -571,9 +643,17 @@ rec { literalExample = lib.warn "lib.literalExample is deprecated, use lib.literalExpression instead, or use lib.literalMD for a non-Nix description." literalExpression; - /* For use in the `defaultText` and `example` option attributes. Causes the - given MD text to be inserted verbatim in the documentation, for when - a `literalExpression` would be too hard to read. + /** + For use in the `defaultText` and `example` option attributes. Causes the + given MD text to be inserted verbatim in the documentation, for when + a `literalExpression` would be too hard to read. + + + # Inputs + + `text` + + : 1\. Function argument */ literalMD = text: if ! isString text then throw "literalMD expects a string." @@ -581,18 +661,34 @@ rec { # Helper functions. - /* Convert an option, described as a list of the option parts to a - human-readable version. + /** + Convert an option, described as a list of the option parts to a + human-readable version. - Example: - (showOption ["foo" "bar" "baz"]) == "foo.bar.baz" - (showOption ["foo" "bar.baz" "tux"]) == "foo.\"bar.baz\".tux" - (showOption ["windowManager" "2bwm" "enable"]) == "windowManager.\"2bwm\".enable" - Placeholders will not be quoted as they are not actual values: - (showOption ["foo" "*" "bar"]) == "foo.*.bar" - (showOption ["foo" "" "bar"]) == "foo..bar" - (showOption ["foo" "" "bar"]) == "foo..bar" + # Inputs + + `parts` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `showOption` usage example + + ```nix + (showOption ["foo" "bar" "baz"]) == "foo.bar.baz" + (showOption ["foo" "bar.baz" "tux"]) == "foo.\"bar.baz\".tux" + (showOption ["windowManager" "2bwm" "enable"]) == "windowManager.\"2bwm\".enable" + + Placeholders will not be quoted as they are not actual values: + (showOption ["foo" "*" "bar"]) == "foo.*.bar" + (showOption ["foo" "" "bar"]) == "foo..bar" + (showOption ["foo" "" "bar"]) == "foo..bar" + ``` + + ::: */ showOption = parts: let # If the part is a named placeholder of the form "<...>" don't escape it. diff --git a/lib/path/default.nix b/lib/path/default.nix index e8f0c646c545..62c5b7d3c5da 100644 --- a/lib/path/default.nix +++ b/lib/path/default.nix @@ -165,7 +165,7 @@ in # No rec! Add dependencies on this file at the top. { - /* + /** Append a subpath string to a path. Like `path + ("/" + string)` but safer, because it errors instead of returning potentially surprising results. @@ -178,34 +178,55 @@ in append p s == append p (subpath.normalise s) - Type: - append :: Path -> String -> Path - Example: - append /foo "bar/baz" - => /foo/bar/baz + # Inputs - # subpaths don't need to be normalised - append /foo "./bar//baz/./" - => /foo/bar/baz + `path` - # can append to root directory - append /. "foo/bar" - => /foo/bar + : The absolute path to append to - # first argument needs to be a path value type - append "/foo" "bar" - => + `subpath` - # second argument needs to be a valid subpath string - append /foo /bar - => - append /foo "" - => - append /foo "/bar" - => - append /foo "../bar" - => + : The subpath string to append + + # Type + + ``` + append :: Path -> String -> Path + ``` + + # Examples + :::{.example} + ## `append` usage example + + ```nix + append /foo "bar/baz" + => /foo/bar/baz + + # subpaths don't need to be normalised + append /foo "./bar//baz/./" + => /foo/bar/baz + + # can append to root directory + append /. "foo/bar" + => /foo/bar + + # first argument needs to be a path value type + append "/foo" "bar" + => + + # second argument needs to be a valid subpath string + append /foo /bar + => + append /foo "" + => + append /foo "/bar" + => + append /foo "../bar" + => + ``` + + ::: */ append = # The absolute path to append to @@ -219,7 +240,7 @@ in ${subpathInvalidReason subpath}''; path + ("/" + subpath); - /* + /** Whether the first path is a component-wise prefix of the second path. Laws: @@ -228,18 +249,35 @@ in - `hasPrefix` is a [non-strict partial order](https://en.wikipedia.org/wiki/Partially_ordered_set#Non-strict_partial_order) over the set of all path values. - Type: - hasPrefix :: Path -> Path -> Bool - Example: - hasPrefix /foo /foo/bar - => true - hasPrefix /foo /foo - => true - hasPrefix /foo/bar /foo - => false - hasPrefix /. /foo - => true + # Inputs + + `path1` + + : 1\. Function argument + + # Type + + ``` + hasPrefix :: Path -> Path -> Bool + ``` + + # Examples + :::{.example} + ## `hasPrefix` usage example + + ```nix + hasPrefix /foo /foo/bar + => true + hasPrefix /foo /foo + => true + hasPrefix /foo/bar /foo + => false + hasPrefix /. /foo + => true + ``` + + ::: */ hasPrefix = path1: @@ -261,7 +299,7 @@ in take (length path1Deconstructed.components) path2Deconstructed.components == path1Deconstructed.components; - /* + /** Remove the first path as a component-wise prefix from the second path. The result is a [normalised subpath string](#function-library-lib.path.subpath.normalise). @@ -271,18 +309,35 @@ in removePrefix p (append p s) == subpath.normalise s - Type: - removePrefix :: Path -> Path -> String - Example: - removePrefix /foo /foo/bar/baz - => "./bar/baz" - removePrefix /foo /foo - => "./." - removePrefix /foo/bar /foo - => - removePrefix /. /foo - => "./foo" + # Inputs + + `path1` + + : 1\. Function argument + + # Type + + ``` + removePrefix :: Path -> Path -> String + ``` + + # Examples + :::{.example} + ## `removePrefix` usage example + + ```nix + removePrefix /foo /foo/bar/baz + => "./bar/baz" + removePrefix /foo /foo + => "./." + removePrefix /foo/bar /foo + => + removePrefix /. /foo + => "./foo" + ``` + + ::: */ removePrefix = path1: @@ -310,7 +365,7 @@ in second argument: "${toString path2}" with root "${toString path2Deconstructed.root}"''; joinRelPath components; - /* + /** Split the filesystem root from a [path](https://nixos.org/manual/nix/stable/language/values.html#type-path). The result is an attribute set with these attributes: - `root`: The filesystem root of the path, meaning that this directory has no parent directory. @@ -328,22 +383,39 @@ in dirOf (splitRoot p).root == (splitRoot p).root - Type: - splitRoot :: Path -> { root :: Path, subpath :: String } - Example: - splitRoot /foo/bar - => { root = /.; subpath = "./foo/bar"; } + # Inputs - splitRoot /. - => { root = /.; subpath = "./."; } + `path` - # Nix neutralises `..` path components for all path values automatically - splitRoot /foo/../bar - => { root = /.; subpath = "./bar"; } + : The path to split the root off of - splitRoot "/foo/bar" - => + # Type + + ``` + splitRoot :: Path -> { root :: Path, subpath :: String } + ``` + + # Examples + :::{.example} + ## `splitRoot` usage example + + ```nix + splitRoot /foo/bar + => { root = /.; subpath = "./foo/bar"; } + + splitRoot /. + => { root = /.; subpath = "./."; } + + # Nix neutralises `..` path components for all path values automatically + splitRoot /foo/../bar + => { root = /.; subpath = "./bar"; } + + splitRoot "/foo/bar" + => + ``` + + ::: */ splitRoot = # The path to split the root off of @@ -358,7 +430,7 @@ in subpath = joinRelPath deconstructed.components; }; - /* + /** Whether a [path](https://nixos.org/manual/nix/stable/language/values.html#type-path) has a [store path](https://nixos.org/manual/nix/stable/store/store-path.html#store-path) as a prefix. @@ -371,33 +443,50 @@ in which occur when Nix files in the store use relative path expressions. ::: - Type: - hasStorePathPrefix :: Path -> Bool - Example: - # Subpaths of derivation outputs have a store path as a prefix - hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo/bar/baz - => true + # Inputs - # The store directory itself is not a store path - hasStorePathPrefix /nix/store - => false + `path` - # Derivation outputs are store paths themselves - hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo - => true + : 1\. Function argument - # Paths outside the Nix store don't have a store path prefix - hasStorePathPrefix /home/user - => false + # Type - # Not all paths under the Nix store are store paths - hasStorePathPrefix /nix/store/.links/10gg8k3rmbw8p7gszarbk7qyd9jwxhcfq9i6s5i0qikx8alkk4hq - => false + ``` + hasStorePathPrefix :: Path -> Bool + ``` - # Store derivations are also store paths themselves - hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo.drv - => true + # Examples + :::{.example} + ## `hasStorePathPrefix` usage example + + ```nix + # Subpaths of derivation outputs have a store path as a prefix + hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo/bar/baz + => true + + # The store directory itself is not a store path + hasStorePathPrefix /nix/store + => false + + # Derivation outputs are store paths themselves + hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo + => true + + # Paths outside the Nix store don't have a store path prefix + hasStorePathPrefix /home/user + => false + + # Not all paths under the Nix store are store paths + hasStorePathPrefix /nix/store/.links/10gg8k3rmbw8p7gszarbk7qyd9jwxhcfq9i6s5i0qikx8alkk4hq + => false + + # Store derivations are also store paths themselves + hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo.drv + => true + ``` + + ::: */ hasStorePathPrefix = path: @@ -414,7 +503,7 @@ in "lib.path.hasStorePathPrefix: Argument has a filesystem root (${toString deconstructed.root}) that's not /, which is currently not supported."; componentsHaveStorePathPrefix deconstructed.components; - /* + /** Whether a value is a valid subpath string. A subpath string points to a specific file or directory within an absolute base directory. @@ -428,39 +517,56 @@ in - The string doesn't contain any `..` path components. - Type: - subpath.isValid :: String -> Bool - Example: - # Not a string - subpath.isValid null - => false + # Inputs - # Empty string - subpath.isValid "" - => false + `value` - # Absolute path - subpath.isValid "/foo" - => false + : The value to check - # Contains a `..` path component - subpath.isValid "../foo" - => false + # Type - # Valid subpath - subpath.isValid "foo/bar" - => true + ``` + subpath.isValid :: String -> Bool + ``` - # Doesn't need to be normalised - subpath.isValid "./foo//bar/" - => true + # Examples + :::{.example} + ## `subpath.isValid` usage example + + ```nix + # Not a string + subpath.isValid null + => false + + # Empty string + subpath.isValid "" + => false + + # Absolute path + subpath.isValid "/foo" + => false + + # Contains a `..` path component + subpath.isValid "../foo" + => false + + # Valid subpath + subpath.isValid "foo/bar" + => true + + # Doesn't need to be normalised + subpath.isValid "./foo//bar/" + => true + ``` + + ::: */ subpath.isValid = # The value to check value: subpathInvalidReason value == null; - /* + /** Join subpath strings together using `/`, returning a normalised subpath string. Like `concatStringsSep "/"` but safer, specifically: @@ -492,30 +598,47 @@ in ps != [] -> subpath.join ps == subpath.normalise (concatStringsSep "/" ps) - Type: - subpath.join :: [ String ] -> String - Example: - subpath.join [ "foo" "bar/baz" ] - => "./foo/bar/baz" + # Inputs - # normalise the result - subpath.join [ "./foo" "." "bar//./baz/" ] - => "./foo/bar/baz" + `subpaths` - # passing an empty list results in the current directory - subpath.join [ ] - => "./." + : The list of subpaths to join together - # elements must be valid subpath strings - subpath.join [ /foo ] - => - subpath.join [ "" ] - => - subpath.join [ "/foo" ] - => - subpath.join [ "../foo" ] - => + # Type + + ``` + subpath.join :: [ String ] -> String + ``` + + # Examples + :::{.example} + ## `subpath.join` usage example + + ```nix + subpath.join [ "foo" "bar/baz" ] + => "./foo/bar/baz" + + # normalise the result + subpath.join [ "./foo" "." "bar//./baz/" ] + => "./foo/bar/baz" + + # passing an empty list results in the current directory + subpath.join [ ] + => "./." + + # elements must be valid subpath strings + subpath.join [ /foo ] + => + subpath.join [ "" ] + => + subpath.join [ "/foo" ] + => + subpath.join [ "../foo" ] + => + ``` + + ::: */ subpath.join = # The list of subpaths to join together @@ -537,7 +660,7 @@ in ${subpathInvalidReason path}'' ) 0 subpaths; - /* + /** Split [a subpath](#function-library-lib.path.subpath.isValid) into its path component strings. Throw an error if the subpath isn't valid. Note that the returned path components are also [valid subpath strings](#function-library-lib.path.subpath.isValid), though they are intentionally not [normalised](#function-library-lib.path.subpath.normalise). @@ -548,18 +671,35 @@ in subpath.join (subpath.components s) == subpath.normalise s - Type: - subpath.components :: String -> [ String ] - Example: - subpath.components "." - => [ ] + # Inputs - subpath.components "./foo//bar/./baz/" - => [ "foo" "bar" "baz" ] + `subpath` - subpath.components "/foo" - => + : The subpath string to split into components + + # Type + + ``` + subpath.components :: String -> [ String ] + ``` + + # Examples + :::{.example} + ## `subpath.components` usage example + + ```nix + subpath.components "." + => [ ] + + subpath.components "./foo//bar/./baz/" + => [ "foo" "bar" "baz" ] + + subpath.components "/foo" + => + ``` + + ::: */ subpath.components = # The subpath string to split into components @@ -569,7 +709,7 @@ in ${subpathInvalidReason subpath}''; splitRelPath subpath; - /* + /** Normalise a subpath. Throw an error if the subpath isn't [valid](#function-library-lib.path.subpath.isValid). - Limit repeating `/` to a single one. @@ -602,45 +742,62 @@ in builtins.tryEval (subpath.normalise p)).success == subpath.isValid p - Type: - subpath.normalise :: String -> String - Example: - # limit repeating `/` to a single one - subpath.normalise "foo//bar" - => "./foo/bar" + # Inputs - # remove redundant `.` components - subpath.normalise "foo/./bar" - => "./foo/bar" + `subpath` - # add leading `./` - subpath.normalise "foo/bar" - => "./foo/bar" + : The subpath string to normalise - # remove trailing `/` - subpath.normalise "foo/bar/" - => "./foo/bar" + # Type - # remove trailing `/.` - subpath.normalise "foo/bar/." - => "./foo/bar" + ``` + subpath.normalise :: String -> String + ``` - # Return the current directory as `./.` - subpath.normalise "." - => "./." + # Examples + :::{.example} + ## `subpath.normalise` usage example - # error on `..` path components - subpath.normalise "foo/../bar" - => + ```nix + # limit repeating `/` to a single one + subpath.normalise "foo//bar" + => "./foo/bar" - # error on empty string - subpath.normalise "" - => + # remove redundant `.` components + subpath.normalise "foo/./bar" + => "./foo/bar" - # error on absolute path - subpath.normalise "/foo" - => + # add leading `./` + subpath.normalise "foo/bar" + => "./foo/bar" + + # remove trailing `/` + subpath.normalise "foo/bar/" + => "./foo/bar" + + # remove trailing `/.` + subpath.normalise "foo/bar/." + => "./foo/bar" + + # Return the current directory as `./.` + subpath.normalise "." + => "./." + + # error on `..` path components + subpath.normalise "foo/../bar" + => + + # error on empty string + subpath.normalise "" + => + + # error on absolute path + subpath.normalise "/foo" + => + ``` + + ::: */ subpath.normalise = # The subpath string to normalise diff --git a/lib/sources.nix b/lib/sources.nix index 168e58225889..0fcdb18fdfaf 100644 --- a/lib/sources.nix +++ b/lib/sources.nix @@ -18,10 +18,21 @@ let pathIsRegularFile ; - /* + /** A basic filter for `cleanSourceWith` that removes directories of version control system, backup files (*~) and some generated files. + + + # Inputs + + `name` + + : 1\. Function argument + + `type` + + : 2\. Function argument */ cleanSourceFilter = name: type: @@ -52,11 +63,26 @@ let (type == "unknown") ); - /* + /** Filters a source tree removing version control files and directories using cleanSourceFilter. - Example: - cleanSource ./. + + # Inputs + + `src` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `cleanSource` usage example + + ```nix + cleanSource ./. + ``` + + ::: */ cleanSource = src: @@ -65,23 +91,31 @@ let inherit src; }; - /* + /** Like `builtins.filterSource`, except it will compose with itself, allowing you to chain multiple calls together without any intermediate copies being put in the nix store. - Example: - lib.cleanSourceWith { - filter = f; - src = lib.cleanSourceWith { - filter = g; - src = ./.; - }; - } - # Succeeds! - builtins.filterSource f (builtins.filterSource g ./.) - # Fails! + # Examples + :::{.example} + ## `cleanSourceWith` usage example + + ```nix + lib.cleanSourceWith { + filter = f; + src = lib.cleanSourceWith { + filter = g; + src = ./.; + }; + } + # Succeeds! + + builtins.filterSource f (builtins.filterSource g ./.) + # Fails! + ``` + + ::: */ cleanSourceWith = { @@ -107,10 +141,21 @@ let name = if name != null then name else orig.name; }; - /* + /** Add logging to a source, for troubleshooting the filtering behavior. - Type: - sources.trace :: sourceLike -> Source + + + # Inputs + + `src` + + : Source to debug. The returned source will behave like this source, but also log its filter invocations. + + # Type + + ``` + sources.trace :: sourceLike -> Source + ``` */ trace = # Source to debug. The returned source will behave like this source, but also log its filter invocations. @@ -133,10 +178,30 @@ let satisfiesSubpathInvariant = src ? satisfiesSubpathInvariant && src.satisfiesSubpathInvariant; }; - /* + /** Filter sources by a list of regular expressions. - Example: src = sourceByRegex ./my-subproject [".*\.py$" "^database.sql$"] + + # Inputs + + `src` + + : 1\. Function argument + + `regexes` + + : 2\. Function argument + + + # Examples + :::{.example} + ## `sourceByRegex` usage example + + ```nix + src = sourceByRegex ./my-subproject [".*\.py$" "^database.sql$"] + ``` + + ::: */ sourceByRegex = src: regexes: @@ -155,16 +220,38 @@ let inherit src; }; - /* + /** Get all files ending with the specified suffices from the given source directory or its descendants, omitting files that do not match any suffix. The result of the example below will include files like `./dir/module.c` and `./dir/subdir/doc.xml` if present. - Type: sourceLike -> [String] -> Source - Example: - sourceFilesBySuffices ./. [ ".xml" ".c" ] + # Inputs + + `src` + + : Path or source containing the files to be returned + + `exts` + + : A list of file suffix strings + + # Type + + ``` + sourceLike -> [String] -> Source + ``` + + # Examples + :::{.example} + ## `sourceFilesBySuffices` usage example + + ```nix + sourceFilesBySuffices ./. [ ".xml" ".c" ] + ``` + + ::: */ sourceFilesBySuffices = # Path or source containing the files to be returned @@ -183,10 +270,26 @@ let pathIsGitRepo = path: (_commitIdFromGitRepoOrError path) ? value; - /* + /** Get the commit id of a git repo. - Example: commitIdFromGitRepo + + # Inputs + + `path` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `commitIdFromGitRepo` usage example + + ```nix + commitIdFromGitRepo + ``` + + ::: */ commitIdFromGitRepo = path: diff --git a/lib/strings-with-deps.nix b/lib/strings-with-deps.nix index 900827fe0e4b..e22e19def581 100644 --- a/lib/strings-with-deps.nix +++ b/lib/strings-with-deps.nix @@ -1,44 +1,44 @@ { lib }: -/* -Usage: +/** + Usage: - You define you custom builder script by adding all build steps to a list. - for example: - builder = writeScript "fsg-4.4-builder" - (textClosure [doUnpack addInputs preBuild doMake installPhase doForceShare]); + You define you custom builder script by adding all build steps to a list. + for example: + builder = writeScript "fsg-4.4-builder" + (textClosure [doUnpack addInputs preBuild doMake installPhase doForceShare]); - a step is defined by noDepEntry, fullDepEntry or packEntry. - To ensure that prerequisite are met those are added before the task itself by - textClosureDupList. Duplicated items are removed again. + a step is defined by noDepEntry, fullDepEntry or packEntry. + To ensure that prerequisite are met those are added before the task itself by + textClosureDupList. Duplicated items are removed again. - See trace/nixpkgs/trunk/pkgs/top-level/builder-defs.nix for some predefined build steps + See trace/nixpkgs/trunk/pkgs/top-level/builder-defs.nix for some predefined build steps - Attention: + Attention: - let - pkgs = (import ) {}; - in let - inherit (pkgs.stringsWithDeps) fullDepEntry packEntry noDepEntry textClosureMap; - inherit (pkgs.lib) id; + let + pkgs = (import ) {}; + in let + inherit (pkgs.stringsWithDeps) fullDepEntry packEntry noDepEntry textClosureMap; + inherit (pkgs.lib) id; - nameA = noDepEntry "Text a"; - nameB = fullDepEntry "Text b" ["nameA"]; - nameC = fullDepEntry "Text c" ["nameA"]; + nameA = noDepEntry "Text a"; + nameB = fullDepEntry "Text b" ["nameA"]; + nameC = fullDepEntry "Text c" ["nameA"]; - stages = { - nameHeader = noDepEntry "#! /bin/sh \n"; - inherit nameA nameB nameC; - }; - in - textClosureMap id stages - [ "nameHeader" "nameA" "nameB" "nameC" - nameC # <- added twice. add a dep entry if you know that it will be added once only [1] - "nameB" # <- this will not be added again because the attr name (reference) is used - ] + stages = { + nameHeader = noDepEntry "#! /bin/sh \n"; + inherit nameA nameB nameC; + }; + in + textClosureMap id stages + [ "nameHeader" "nameA" "nameB" "nameC" + nameC # <- added twice. add a dep entry if you know that it will be added once only [1] + "nameB" # <- this will not be added again because the attr name (reference) is used + ] - # result: Str("#! /bin/sh \n\nText a\nText b\nText c\nText c",[]) + # result: Str("#! /bin/sh \n\nText a\nText b\nText c\nText c",[]) - [1] maybe this behaviour should be removed to keep things simple (?) + [1] maybe this behaviour should be removed to keep things simple (?) */ let diff --git a/lib/versions.nix b/lib/versions.nix index 32b4b5fbf945..cde0acaef0a9 100644 --- a/lib/versions.nix +++ b/lib/versions.nix @@ -3,62 +3,149 @@ rec { - /* + /** Break a version string into its component parts. - Example: - splitVersion "1.2.3" - => ["1" "2" "3"] + + # Examples + :::{.example} + ## `splitVersion` usage example + + ```nix + splitVersion "1.2.3" + => ["1" "2" "3"] + ``` + + ::: */ splitVersion = builtins.splitVersion; - /* + /** Get the major version string from a string. - Example: - major "1.2.3" - => "1" + + # Inputs + + `v` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `major` usage example + + ```nix + major "1.2.3" + => "1" + ``` + + ::: */ major = v: builtins.elemAt (splitVersion v) 0; - /* + /** Get the minor version string from a string. - Example: - minor "1.2.3" - => "2" + + # Inputs + + `v` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `minor` usage example + + ```nix + minor "1.2.3" + => "2" + ``` + + ::: */ minor = v: builtins.elemAt (splitVersion v) 1; - /* + /** Get the patch version string from a string. - Example: - patch "1.2.3" - => "3" + + # Inputs + + `v` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `patch` usage example + + ```nix + patch "1.2.3" + => "3" + ``` + + ::: */ patch = v: builtins.elemAt (splitVersion v) 2; - /* + /** Get string of the first two parts (major and minor) of a version string. - Example: - majorMinor "1.2.3" - => "1.2" + + # Inputs + + `v` + + : 1\. Function argument + + + # Examples + :::{.example} + ## `majorMinor` usage example + + ```nix + majorMinor "1.2.3" + => "1.2" + ``` + + ::: */ majorMinor = v: builtins.concatStringsSep "." (lib.take 2 (splitVersion v)); - /* + /** Pad a version string with zeros to match the given number of components. - Example: - pad 3 "1.2" - => "1.2.0" - pad 3 "1.3-rc1" - => "1.3.0-rc1" - pad 3 "1.2.3.4" - => "1.2.3" + + # Inputs + + `n` + + : 1\. Function argument + + `version` + + : 2\. Function argument + + + # Examples + :::{.example} + ## `pad` usage example + + ```nix + pad 3 "1.2" + => "1.2.0" + pad 3 "1.3-rc1" + => "1.3.0-rc1" + pad 3 "1.2.3.4" + => "1.2.3" + ``` + + ::: */ pad = n: version: From 80d5b411f6397d5c3e755a0635d95742f76f3c75 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 12 Feb 2025 14:51:56 +0700 Subject: [PATCH 02/46] Format: lib/sources.nix --- lib/sources.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/sources.nix b/lib/sources.nix index 0fcdb18fdfaf..e165439998a1 100644 --- a/lib/sources.nix +++ b/lib/sources.nix @@ -23,7 +23,6 @@ let directories of version control system, backup files (*~) and some generated files. - # Inputs `name` @@ -66,14 +65,12 @@ let /** Filters a source tree removing version control files and directories using cleanSourceFilter. - # Inputs `src` : 1\. Function argument - # Examples :::{.example} ## `cleanSource` usage example @@ -96,7 +93,6 @@ let allowing you to chain multiple calls together without any intermediate copies being put in the nix store. - # Examples :::{.example} ## `cleanSourceWith` usage example @@ -144,7 +140,6 @@ let /** Add logging to a source, for troubleshooting the filtering behavior. - # Inputs `src` @@ -181,7 +176,6 @@ let /** Filter sources by a list of regular expressions. - # Inputs `src` @@ -192,7 +186,6 @@ let : 2\. Function argument - # Examples :::{.example} ## `sourceByRegex` usage example @@ -226,7 +219,6 @@ let any suffix. The result of the example below will include files like `./dir/module.c` and `./dir/subdir/doc.xml` if present. - # Inputs `src` @@ -273,14 +265,12 @@ let /** Get the commit id of a git repo. - # Inputs `path` : 1\. Function argument - # Examples :::{.example} ## `commitIdFromGitRepo` usage example From e0fe216f4912dd88a021d12a44155fd2cfeb31c8 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 12 Feb 2025 14:52:12 +0700 Subject: [PATCH 03/46] Format: lib/fileset/internal.nix --- lib/fileset/internal.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix index 1fd0a7e2350d..4674a321b3ae 100644 --- a/lib/fileset/internal.nix +++ b/lib/fileset/internal.nix @@ -276,7 +276,6 @@ rec { Note that this function is strict, it evaluates the entire tree - # Inputs `path` @@ -322,7 +321,6 @@ rec { Note that this function is partially lazy. - # Inputs `path` From d89ad6c70e0e89aaae75e9f886878ea4e103965a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 12 Feb 2025 14:52:23 +0700 Subject: [PATCH 04/46] Format: lib/versions.nix --- lib/versions.nix | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/versions.nix b/lib/versions.nix index cde0acaef0a9..2355655f179a 100644 --- a/lib/versions.nix +++ b/lib/versions.nix @@ -6,7 +6,6 @@ rec { /** Break a version string into its component parts. - # Examples :::{.example} ## `splitVersion` usage example @@ -23,14 +22,12 @@ rec { /** Get the major version string from a string. - # Inputs `v` : 1\. Function argument - # Examples :::{.example} ## `major` usage example @@ -47,14 +44,12 @@ rec { /** Get the minor version string from a string. - # Inputs `v` : 1\. Function argument - # Examples :::{.example} ## `minor` usage example @@ -71,14 +66,12 @@ rec { /** Get the patch version string from a string. - # Inputs `v` : 1\. Function argument - # Examples :::{.example} ## `patch` usage example @@ -96,14 +89,12 @@ rec { Get string of the first two parts (major and minor) of a version string. - # Inputs `v` : 1\. Function argument - # Examples :::{.example} ## `majorMinor` usage example @@ -120,7 +111,6 @@ rec { /** Pad a version string with zeros to match the given number of components. - # Inputs `n` @@ -131,7 +121,6 @@ rec { : 2\. Function argument - # Examples :::{.example} ## `pad` usage example From ef85e0daa092c9eae0d32c7ce16b889728a5fbc0 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 12 Feb 2025 14:52:38 +0700 Subject: [PATCH 05/46] Format: lib/path.nix --- lib/path/default.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/path/default.nix b/lib/path/default.nix index 62c5b7d3c5da..4ffee65e1cf5 100644 --- a/lib/path/default.nix +++ b/lib/path/default.nix @@ -178,7 +178,6 @@ in append p s == append p (subpath.normalise s) - # Inputs `path` @@ -249,7 +248,6 @@ in - `hasPrefix` is a [non-strict partial order](https://en.wikipedia.org/wiki/Partially_ordered_set#Non-strict_partial_order) over the set of all path values. - # Inputs `path1` @@ -309,7 +307,6 @@ in removePrefix p (append p s) == subpath.normalise s - # Inputs `path1` @@ -383,7 +380,6 @@ in dirOf (splitRoot p).root == (splitRoot p).root - # Inputs `path` @@ -443,7 +439,6 @@ in which occur when Nix files in the store use relative path expressions. ::: - # Inputs `path` @@ -517,7 +512,6 @@ in - The string doesn't contain any `..` path components. - # Inputs `value` @@ -598,7 +592,6 @@ in ps != [] -> subpath.join ps == subpath.normalise (concatStringsSep "/" ps) - # Inputs `subpaths` @@ -671,7 +664,6 @@ in subpath.join (subpath.components s) == subpath.normalise s - # Inputs `subpath` @@ -742,7 +734,6 @@ in builtins.tryEval (subpath.normalise p)).success == subpath.isValid p - # Inputs `subpath` From c224c447a8902814454a6575b2f6738b4a9d2823 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 12 Feb 2025 14:56:58 +0700 Subject: [PATCH 06/46] .git-blame-ignore-revs: add formatting of doc-comment migrations in lib --- .git-blame-ignore-revs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index b8aeaadf4141..8724f5d5c3a7 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -229,3 +229,9 @@ adb9714bd909df283c66bbd641bd631ff50a4260 # tmuxPlugins sha-to-sri.py script 516b1e74c358a9c4b06e5591f8c1a2897aad0c33 + +# treewide: migrate comments in lib to rfc145 style +ef85e0daa092c9eae0d32c7ce16b889728a5fbc0 +d89ad6c70e0e89aaae75e9f886878ea4e103965a +e0fe216f4912dd88a021d12a44155fd2cfeb31c8 +80d5b411f6397d5c3e755a0635d95742f76f3c75 From d82f85b92605f7ff85ef88c5c7ee907757a55907 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 15 Feb 2025 10:00:46 +0100 Subject: [PATCH 07/46] python313Packages.browserforge: init at 1.1.0 Intelligent browser header & fingerprint generator https://github.com/daijro/browserforge --- .../python-modules/browserforge/default.nix | 49 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 51 insertions(+) create mode 100644 pkgs/development/python-modules/browserforge/default.nix diff --git a/pkgs/development/python-modules/browserforge/default.nix b/pkgs/development/python-modules/browserforge/default.nix new file mode 100644 index 000000000000..a9c9b50ac338 --- /dev/null +++ b/pkgs/development/python-modules/browserforge/default.nix @@ -0,0 +1,49 @@ +{ + lib, + aiofiles, + buildPythonPackage, + click, + fetchFromGitHub, + httpx, + orjson, + poetry-core, + pythonOlder, + rich, +}: + +buildPythonPackage rec { + pname = "browserforge"; + version = "1.1.0"; + pyproject = true; + + disabled = pythonOlder "3.11"; + + src = fetchFromGitHub { + owner = "daijro"; + repo = "browserforge"; + tag = "v${version}"; + hash = "sha256-+uBKVugPScr0gggYaxAdelLKKrmXGY6rWTwhFqBMTcA="; + }; + + build-system = [ poetry-core ]; + + dependencies = [ + aiofiles + click + httpx + orjson + rich + ]; + + # Module has no test + doCheck = false; + + pythonImportsCheck = [ "browserforge" ]; + + meta = { + description = "Intelligent browser header & fingerprint generator"; + homepage = "https://github.com/daijro/browserforge"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 34c3ba4022d3..65303f03893b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1938,6 +1938,8 @@ self: super: with self; { browser-cookie3 = callPackage ../development/python-modules/browser-cookie3 { }; + browserforge = callPackage ../development/python-modules/browserforge { }; + brunt = callPackage ../development/python-modules/brunt { }; bsddb3 = callPackage ../development/python-modules/bsddb3 { }; From 83781e885212ce909e302f00a0c650d95c6d2a66 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Sat, 15 Feb 2025 20:22:47 +0000 Subject: [PATCH 08/46] python312Packages.linode-api: 5.26.0 -> 5.27.0 --- pkgs/development/python-modules/linode-api/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/linode-api/default.nix b/pkgs/development/python-modules/linode-api/default.nix index a32ed18f7194..20be7c053f3b 100644 --- a/pkgs/development/python-modules/linode-api/default.nix +++ b/pkgs/development/python-modules/linode-api/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { pname = "linode-api"; - version = "5.26.0"; + version = "5.27.0"; pyproject = true; disabled = pythonOlder "3.9"; @@ -24,7 +24,7 @@ buildPythonPackage rec { owner = "linode"; repo = "python-linode-api"; tag = "v${version}"; - hash = "sha256-+Co8c0JJKzA2IBj/RUrY+iNTCI0nCvqQUW1F7Crd2mc="; + hash = "sha256-hMxCRSba0hjOsq+TFyrb04uMfy13GZEO7elAKmqgnzY="; }; build-system = [ setuptools ]; From 7a56ddaf9d42e9aee8ddbf2d95f9ea82502d094c Mon Sep 17 00:00:00 2001 From: r-vdp Date: Mon, 17 Feb 2025 12:06:27 +0100 Subject: [PATCH 09/46] switch-to-configuration-ng: don't block when the lockfile is already locked When the lockfile is already locked, stc-ng currently blocks without any message indicating what is going on. This is very confusing to users, especially because most will not know about the lockfile. Since the current call blocks, we actually never end up in the else branch. Switching to a non-blocking call, makes sure that we print out an error and exit in case the lockfile is already locked by another process, which makes it a lot clearer what's going on and gives the user a clue as to what to do to unblock the situation. --- pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs b/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs index a64d8566225b..64fc71e85aed 100644 --- a/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs +++ b/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs @@ -1037,7 +1037,7 @@ fn do_system_switch(action: Action) -> anyhow::Result<()> { die(); }; - let Ok(_lock) = Flock::lock(lock, FlockArg::LockExclusive) else { + let Ok(_lock) = Flock::lock(lock, FlockArg::LockExclusiveNonblock) else { eprintln!("Could not acquire lock"); die(); }; From 125edf84247b22c830776cc0cf21c182c2179712 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Mon, 17 Feb 2025 13:14:25 +0100 Subject: [PATCH 10/46] switch-to-configuration: don't block on flock, see 7a56ddaf9d42e9aee8ddbf2d95f9ea82502d094c --- nixos/modules/system/activation/switch-to-configuration.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index 672291541d03..8eee52bfa332 100755 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -95,7 +95,7 @@ if (!-f "/etc/NIXOS" && (read_file("/etc/os-release", err_mode => "quiet") // "" make_path("/run/nixos", { mode => oct(755) }); open(my $stc_lock, '>>', '/run/nixos/switch-to-configuration.lock') or die "Could not open lock - $!"; -flock($stc_lock, LOCK_EX) or die "Could not acquire lock - $!"; +flock($stc_lock, LOCK_EX|LOCK_NB) or die "Could not acquire lock - $!"; openlog("nixos", "", LOG_USER); # run pre-switch checks From 1aa7e7a131e88cec8bdce48d1a291947e6379593 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Mon, 17 Feb 2025 13:15:01 +0100 Subject: [PATCH 11/46] switch-to-configuration: add a test to make sure that we don't block on the lockfile We should exit with a clear error message instead. --- nixos/tests/switch-test.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nixos/tests/switch-test.nix b/nixos/tests/switch-test.nix index 4ad08b726bf5..ba1a6f329cd3 100644 --- a/nixos/tests/switch-test.nix +++ b/nixos/tests/switch-test.nix @@ -732,6 +732,23 @@ in { out = switch_to_specialisation("${machine}", "modifiedSystemConf") assert_contains(out, "starting the following units: ${dbusService}\n") + with subtest("aborts on already locked lock file"): + (exitcode, _) = machine.execute( + 'flock -x --nb /run/nixos/switch-to-configuration.lock -c "${otherSystem}/bin/switch-to-configuration test"', + timeout=5 + ) + # See man timeout, exit codes above 124 come from the timeout command + # We want to make sure that stc actually exited with an error code, + # if instead we hit the timeout, then it means that stc hangs, which is + # what we don't want + # TODO: We cannot match on the exact exit code since it's not consistent between + # stc and stc-ng, since errno/last_os_error is not a very stable interface, + # we should probably get rid of that in stc-ng once we got rid of the + # perl implementation + assert exitcode < 124, \ + "switch-to-configuration did not abort as expected, " + \ + f"probably it timed out instead (exit code: {exitcode}), 124 means timeout" + with subtest("fstab mounts"): switch_to_specialisation("${machine}", "") # add a mountpoint From bdddb0c51702e8cb10ab1f4df739dfbffc55a9d6 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 17 Feb 2025 16:17:39 +0100 Subject: [PATCH 12/46] Revert "lib.types.attrsWith: remove failing test" This reverts commit ce8f304bb68f88be5e32975c3299f2e16abe05c0. The problem was simply a typo (nestedTypes.elemType -> type.nestedTypes.elemType) ! And CI didn't run for lib in the orginal PR which is why it didn't get caught. --- lib/tests/modules.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 243fbce1ecb5..d6614822ea00 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -398,6 +398,10 @@ checkConfigError 'infinite recursion encountered' config.nonLazyResult ./lazy-at checkConfigOutput '^"mergedName..nested"$' config.result ./name-merge-attrsWith-1.nix checkConfigError 'The option .mergedName. in .*\.nix. is already declared in .*\.nix' config.mergedName ./name-merge-attrsWith-2.nix +# Test the attrsOf functor.wrapped warning +# shellcheck disable=2016 +NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `type.functor.wrapped` attribute of the option `mergedLazyLazy` is accessed, use `type.nestedTypes.elemType` instead.' options.mergedLazyLazy.type.functor.wrapped ./lazy-attrsWith.nix + # Even with multiple assignments, a type error should be thrown if any of them aren't valid checkConfigError 'A definition for option .* is not of type .*' \ config.value ./declare-int-unsigned-value.nix ./define-value-list.nix ./define-value-int-positive.nix From 57c96ff6efac77ea0a9d40abf540f4e099f5a8c1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Giraudeau Date: Tue, 18 Feb 2025 09:41:55 +0100 Subject: [PATCH 13/46] nixos-container: avoid subshell when testing $PRIVATE_USERS So that the script is not rejected by https://www.shellcheck.net/wiki/SC2235 under `systemd.enableStrictShellChecks = true;` --- nixos/modules/virtualisation/nixos-containers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 823e7e0fe909..04fc77bbf5da 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -118,7 +118,7 @@ let NIX_BIND_OPT="" if [ -n "$PRIVATE_USERS" ]; then extraFlags+=("--private-users=$PRIVATE_USERS") - if [ "$PRIVATE_USERS" = "pick" ] || ( [ "$PRIVATE_USERS" != "identity" ] && [ "$PRIVATE_USERS" -gt 0 ] ); then + if [ "$PRIVATE_USERS" = "pick" ] || { [ "$PRIVATE_USERS" != "identity" ] && [ "$PRIVATE_USERS" -gt 0 ]; }; then # when user namespacing is enabled, we use `idmap` mount option # so that bind mounts under /nix get proper owner (and not nobody/nogroup). NIX_BIND_OPT=":idmap" From 6a3f025e54d8fd007b97ea60ece540e27e8cebc2 Mon Sep 17 00:00:00 2001 From: GovanifY Date: Wed, 22 Jan 2025 14:13:48 +0100 Subject: [PATCH 14/46] nixos/ghidra: init --- .../manual/release-notes/rl-2505.section.md | 2 + nixos/modules/module-list.nix | 1 + nixos/modules/programs/ghidra.nix | 47 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 nixos/modules/programs/ghidra.nix diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 994a4e95b4ab..b0c800a11edc 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -67,6 +67,8 @@ - [Homer](https://homer-demo.netlify.app/), a very simple static homepage for your server. Available as [services.homer](options.html#opt-services.homer). +- [Ghidra](https://ghidra-sre.org/), a software reverse engineering (SRE) suite of tools. Available as [programs.ghidra](options.html#opt-programs.ghidra). + - [Omnom](https://github.com/asciimoo/omnom), a webpage bookmarking and snapshotting service. Available as [services.omnom](options.html#opt-services.omnom.enable). - [Yggdrasil-Jumper](https://github.com/one-d-wide/yggdrasil-jumper) is an independent project that aims to transparently reduce latency of a connection over Yggdrasil network, utilizing NAT traversal to automatically bypass intermediary nodes. diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index a07a08dbdd7c..47de3efbdd4e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -209,6 +209,7 @@ ./programs/gamescope.nix ./programs/gdk-pixbuf.nix ./programs/geary.nix + ./programs/ghidra.nix ./programs/git.nix ./programs/git-worktree-switcher.nix ./programs/gnome-disks.nix diff --git a/nixos/modules/programs/ghidra.nix b/nixos/modules/programs/ghidra.nix new file mode 100644 index 000000000000..a832a2161e76 --- /dev/null +++ b/nixos/modules/programs/ghidra.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.programs.ghidra; +in +{ + options.programs.ghidra = { + enable = lib.mkEnableOption "Ghidra, a software reverse engineering (SRE) suite of tools"; + + gdb = lib.mkOption { + default = true; + type = lib.types.bool; + description = '' + Whether to add to gdbinit the python modules required to make Ghidra's debugger work. + ''; + }; + + package = lib.mkPackageOption pkgs "ghidra" { example = "ghidra-bin"; }; + }; + + config = lib.mkIf cfg.enable { + environment = { + systemPackages = [ cfg.package ]; + + etc = lib.mkIf cfg.gdb { + "gdb/gdbinit.d/ghidra-modules.gdb".text = with pkgs.python3.pkgs; '' + python + import sys + [sys.path.append(p) for p in "${ + (makePythonPath [ + psutil + protobuf + ]) + }".split(":")] + end + ''; + }; + }; + }; + + meta.maintainers = with lib.maintainers; [ govanify ]; +} From be8612e15a2849936faf954d46da0d29e3f2c24e Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 18 Feb 2025 10:20:13 +0100 Subject: [PATCH 15/46] postgresql: fetch from GitHub instead of tarball This allows us to fetch newer releases a few days before they are officially released and the tarballs have been pushed. The regular release cycle is like this: - Sunday, the release notes are committed. - Monday, the version is "stamped", i.e. the version bump committed. - Thursday, the release is made. There are not going to be any changes from Monday on, so we can kick off our builds at that time already - they still need time to hit unstable anyway. --- pkgs/servers/sql/postgresql/13.nix | 3 ++- pkgs/servers/sql/postgresql/14.nix | 3 ++- pkgs/servers/sql/postgresql/15.nix | 3 ++- pkgs/servers/sql/postgresql/16.nix | 3 ++- pkgs/servers/sql/postgresql/17.nix | 3 ++- pkgs/servers/sql/postgresql/generic.nix | 25 ++++++++++++++----------- pkgs/servers/sql/postgresql/libpq.nix | 11 +++++++---- 7 files changed, 31 insertions(+), 20 deletions(-) diff --git a/pkgs/servers/sql/postgresql/13.nix b/pkgs/servers/sql/postgresql/13.nix index 72a8dd8bb392..b2a189592310 100644 --- a/pkgs/servers/sql/postgresql/13.nix +++ b/pkgs/servers/sql/postgresql/13.nix @@ -1,6 +1,7 @@ import ./generic.nix { version = "13.18"; - hash = "sha256-zuqSq+4qjBlAjSeLaN5qeLa9PbtPotZT+nynRdZmqrE="; + rev = "ref/tags/REL_13_18"; + hash = "sha256-Lw8rd6MAvKZ7/Y1a0ccauL7K6lHxsp5huK4QFun9wcc="; muslPatches = { disable-test-collate-icu-utf8 = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql13/disable-test-collate.icu.utf8.patch?id=69faa146ec9fff3b981511068f17f9e629d4688b"; diff --git a/pkgs/servers/sql/postgresql/14.nix b/pkgs/servers/sql/postgresql/14.nix index e5011f5314ca..cf4141008ffc 100644 --- a/pkgs/servers/sql/postgresql/14.nix +++ b/pkgs/servers/sql/postgresql/14.nix @@ -1,6 +1,7 @@ import ./generic.nix { version = "14.15"; - hash = "sha256-AuiR4xS06e4ky9eAKNq3xz+cG6PjCDW8vvcf4iBAH8U="; + rev = "ref/tags/REL_14_15"; + hash = "sha256-slb6UiJyIzDaNS782/ZDVztBw4B4qTY6OuEWI+HZ+Ds="; muslPatches = { disable-test-collate-icu-utf8 = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/disable-test-collate.icu.utf8.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7"; diff --git a/pkgs/servers/sql/postgresql/15.nix b/pkgs/servers/sql/postgresql/15.nix index bf17a088f2bd..3b654c8fee95 100644 --- a/pkgs/servers/sql/postgresql/15.nix +++ b/pkgs/servers/sql/postgresql/15.nix @@ -1,6 +1,7 @@ import ./generic.nix { version = "15.10"; - hash = "sha256-VavnONRB8OWGWLPsb4gJenE7XjtzE59iMNe1xMOJ5XM="; + rev = "ref/tags/REL_15_10"; + hash = "sha256-5RNcoqcmcYCCBK8bmz2Wruky1mzDh5SrDF3OOV31GMw="; muslPatches = { dont-use-locale-a = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql15/dont-use-locale-a-on-musl.patch?id=f424e934e6d076c4ae065ce45e734aa283eecb9c"; diff --git a/pkgs/servers/sql/postgresql/16.nix b/pkgs/servers/sql/postgresql/16.nix index fd1957b89386..4ce791d49b19 100644 --- a/pkgs/servers/sql/postgresql/16.nix +++ b/pkgs/servers/sql/postgresql/16.nix @@ -1,6 +1,7 @@ import ./generic.nix { version = "16.6"; - hash = "sha256-Izac2szUUnCsXcww+p2iBdW+M/pQXh8XoEGNLK7KR3s="; + rev = "ref/tags/REL_16_6"; + hash = "sha256-cw/bSR9ZI6HFtbSTQxvuB7ng7V6g5SZZ7B0oMCz4E7Q="; muslPatches = { dont-use-locale-a = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql16/dont-use-locale-a-on-musl.patch?id=08a24be262339fd093e641860680944c3590238e"; diff --git a/pkgs/servers/sql/postgresql/17.nix b/pkgs/servers/sql/postgresql/17.nix index 34d2ddeccb27..e76114ee1aa6 100644 --- a/pkgs/servers/sql/postgresql/17.nix +++ b/pkgs/servers/sql/postgresql/17.nix @@ -1,6 +1,7 @@ import ./generic.nix { version = "17.2"; - hash = "sha256-gu8nwK83UWldf2Ti2WNYMAX7tqDD32PQ5LQiEdcCEWQ="; + rev = "ref/tags/REL_17_2"; + hash = "sha256-P7IwvMcOI6vW14PiB2R0NEzAEPeaKg0zaUKTw2GJ5DA="; muslPatches = { dont-use-locale-a = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql17/dont-use-locale-a-on-musl.patch?id=d69ead2c87230118ae7f72cef7d761e761e1f37e"; diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index 00b9f0e15ce1..569eb87f8e97 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -4,6 +4,7 @@ let # utils { stdenv, + fetchFromGitHub, fetchpatch, fetchurl, lib, @@ -13,6 +14,7 @@ let # source specification hash, muslPatches ? { }, + rev, version, # runtime dependencies @@ -130,9 +132,12 @@ let inherit version; pname = pname + lib.optionalString jitSupport "-jit"; - src = fetchurl { - url = "mirror://postgresql/source/v${version}/${pname}-${version}.tar.bz2"; - inherit hash; + src = fetchFromGitHub { + owner = "postgres"; + repo = "postgres"; + # rev, not tag, on purpose: allows updating when new versions + # are "stamped" a few days before release (tag). + inherit hash rev; }; __structuredAttrs = true; @@ -215,22 +220,20 @@ let nativeBuildInputs = [ + bison + docbook-xsl-nons + docbook_xml_dtd_45 + flex libxml2 + libxslt makeWrapper + perl pkg-config removeReferencesTo ] ++ lib.optionals jitSupport [ llvmPackages.llvm.dev nukeReferences - ] - ++ lib.optionals (atLeast "17") [ - bison - flex - perl - docbook_xml_dtd_45 - docbook-xsl-nons - libxslt ]; enableParallelBuilding = true; diff --git a/pkgs/servers/sql/postgresql/libpq.nix b/pkgs/servers/sql/postgresql/libpq.nix index 0c064e45cf99..62e7fc9df6c7 100644 --- a/pkgs/servers/sql/postgresql/libpq.nix +++ b/pkgs/servers/sql/postgresql/libpq.nix @@ -1,7 +1,7 @@ { # utils stdenv, - fetchurl, + fetchFromGitHub, lib, # runtime dependencies @@ -31,9 +31,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "libpq"; version = "17.2"; - src = fetchurl { - url = "mirror://postgresql/source/v${finalAttrs.version}/postgresql-${finalAttrs.version}.tar.bz2"; - hash = "sha256-gu8nwK83UWldf2Ti2WNYMAX7tqDD32PQ5LQiEdcCEWQ="; + src = fetchFromGitHub { + owner = "postgres"; + repo = "postgres"; + # rev, not tag, on purpose: see generic.nix. + rev = "ref/tags/REL_17_2"; + hash = "sha256-P7IwvMcOI6vW14PiB2R0NEzAEPeaKg0zaUKTw2GJ5DA="; }; __structuredAttrs = true; From 8e25714eeec98b1cdacb32a4b0df438400ef6b21 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 15 Feb 2025 11:26:30 +0100 Subject: [PATCH 16/46] postgresql_13: 13.18 -> 13.20 ChangeLog: https://www.postgresql.org/about/news/postgresql-173-167-1511-1416-and-1319-released-3015/ https://www.postgresql.org/about/news/out-of-cycle-release-scheduled-for-february-20-2025-3016/ Co-authored-by: Wolfgang Walther --- pkgs/servers/sql/postgresql/13.nix | 7 ++++--- pkgs/servers/sql/postgresql/generic.nix | 5 ----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pkgs/servers/sql/postgresql/13.nix b/pkgs/servers/sql/postgresql/13.nix index b2a189592310..8f1493c6c366 100644 --- a/pkgs/servers/sql/postgresql/13.nix +++ b/pkgs/servers/sql/postgresql/13.nix @@ -1,7 +1,8 @@ import ./generic.nix { - version = "13.18"; - rev = "ref/tags/REL_13_18"; - hash = "sha256-Lw8rd6MAvKZ7/Y1a0ccauL7K6lHxsp5huK4QFun9wcc="; + version = "13.20"; + # "Stamp 13.20" + rev = "c8f198c3acb59ed858b5b9b88b4fbc55cece544e"; + hash = "sha256-GkDtzqwjMJipvr0wykM9Z5Tb0R7WgJA/PGPTVUXxf7Q="; muslPatches = { disable-test-collate-icu-utf8 = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql13/disable-test-collate.icu.utf8.patch?id=69faa146ec9fff3b981511068f17f9e629d4688b"; diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index 569eb87f8e97..ca157411536e 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -302,11 +302,6 @@ let ./patches/paths-for-split-outputs.patch ./patches/paths-with-postgresql-suffix.patch - (fetchpatch { - url = "https://github.com/postgres/postgres/commit/8108674f0e5639baebcf03b54b7ccf9e9a8662a2.patch"; - hash = "sha256-EQJkDR0eb7QWCjyMzXMn+Vbcwx3MMdC83oN7XSVJP0U="; - }) - (replaceVars ./patches/locale-binary-path.patch { locale = "${ if stdenv.hostPlatform.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc From 903de708a8d4221119e6f2faa2bcab8ed7ff7615 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 15 Feb 2025 11:27:29 +0100 Subject: [PATCH 17/46] postgresql_14: 14.15 -> 14.17 ChangeLog: https://www.postgresql.org/about/news/postgresql-173-167-1511-1416-and-1319-released-3015/ https://www.postgresql.org/about/news/out-of-cycle-release-scheduled-for-february-20-2025-3016/ Co-authored-by: Wolfgang Walther --- pkgs/servers/sql/postgresql/14.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/sql/postgresql/14.nix b/pkgs/servers/sql/postgresql/14.nix index cf4141008ffc..bee593a35fd2 100644 --- a/pkgs/servers/sql/postgresql/14.nix +++ b/pkgs/servers/sql/postgresql/14.nix @@ -1,7 +1,8 @@ import ./generic.nix { - version = "14.15"; - rev = "ref/tags/REL_14_15"; - hash = "sha256-slb6UiJyIzDaNS782/ZDVztBw4B4qTY6OuEWI+HZ+Ds="; + version = "14.17"; + # "Stamp 14.17" + rev = "e5cabe28006995d90cc9ebc613dad072c44c7f4a"; + hash = "sha256-BvmfxHHTcxRkWZoawvHanQeAuqHnQIh77RQjxPo5fuI="; muslPatches = { disable-test-collate-icu-utf8 = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/disable-test-collate.icu.utf8.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7"; From e9a5ab86073f5ba26d5828b4cbd3e0841b30c2f5 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 15 Feb 2025 11:28:15 +0100 Subject: [PATCH 18/46] postgresql_15: 15.10 -> 15.12 ChangeLog: https://www.postgresql.org/about/news/postgresql-173-167-1511-1416-and-1319-released-3015/ https://www.postgresql.org/about/news/out-of-cycle-release-scheduled-for-february-20-2025-3016/ Co-authored-by: Wolfgang Walther --- pkgs/servers/sql/postgresql/15.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/sql/postgresql/15.nix b/pkgs/servers/sql/postgresql/15.nix index 3b654c8fee95..c9d7f2f22a2a 100644 --- a/pkgs/servers/sql/postgresql/15.nix +++ b/pkgs/servers/sql/postgresql/15.nix @@ -1,7 +1,8 @@ import ./generic.nix { - version = "15.10"; - rev = "ref/tags/REL_15_10"; - hash = "sha256-5RNcoqcmcYCCBK8bmz2Wruky1mzDh5SrDF3OOV31GMw="; + version = "15.12"; + # "Stamp 15.12" + rev = "50d3d22baba63613d1f1406b2ed460dc9b03c3fc"; + hash = "sha256-6my9UzW05iYwTWR9y/VTZ1RQVNudavMFfUT9dpUQ15o="; muslPatches = { dont-use-locale-a = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql15/dont-use-locale-a-on-musl.patch?id=f424e934e6d076c4ae065ce45e734aa283eecb9c"; From 172fa69cbdf07b2e4a9d2c84929c7d65cebe6156 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 15 Feb 2025 11:28:40 +0100 Subject: [PATCH 19/46] postgresql_16: 16.6 -> 16.8 ChangeLog: https://www.postgresql.org/about/news/postgresql-173-167-1511-1416-and-1319-released-3015/ https://www.postgresql.org/about/news/out-of-cycle-release-scheduled-for-february-20-2025-3016/ Co-authored-by: Wolfgang Walther --- pkgs/servers/sql/postgresql/16.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/sql/postgresql/16.nix b/pkgs/servers/sql/postgresql/16.nix index 4ce791d49b19..6213c4d1b25c 100644 --- a/pkgs/servers/sql/postgresql/16.nix +++ b/pkgs/servers/sql/postgresql/16.nix @@ -1,7 +1,8 @@ import ./generic.nix { - version = "16.6"; - rev = "ref/tags/REL_16_6"; - hash = "sha256-cw/bSR9ZI6HFtbSTQxvuB7ng7V6g5SZZ7B0oMCz4E7Q="; + version = "16.8"; + # "Stamp 16.8" + rev = "71eb35c0b18de96537bd3876ec9bf8075bfd484f"; + hash = "sha256-nVUGBuvCDFXozTyEDAAQa+IR3expCdztH90J68FhAXQ="; muslPatches = { dont-use-locale-a = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql16/dont-use-locale-a-on-musl.patch?id=08a24be262339fd093e641860680944c3590238e"; From 70d670e42c6519b1c35cd27f1a2d7697e4b124aa Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 15 Feb 2025 11:29:09 +0100 Subject: [PATCH 20/46] postgresql_17: 17.2 -> 17.4 ChangeLog: https://www.postgresql.org/about/news/postgresql-173-167-1511-1416-and-1319-released-3015/ https://www.postgresql.org/about/news/out-of-cycle-release-scheduled-for-february-20-2025-3016/ Co-authored-by: Wolfgang Walther --- pkgs/servers/sql/postgresql/17.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/sql/postgresql/17.nix b/pkgs/servers/sql/postgresql/17.nix index e76114ee1aa6..130ef4216ef8 100644 --- a/pkgs/servers/sql/postgresql/17.nix +++ b/pkgs/servers/sql/postgresql/17.nix @@ -1,7 +1,8 @@ import ./generic.nix { - version = "17.2"; - rev = "ref/tags/REL_17_2"; - hash = "sha256-P7IwvMcOI6vW14PiB2R0NEzAEPeaKg0zaUKTw2GJ5DA="; + version = "17.4"; + # "Stamp 17.4" + rev = "f8554dee417ffc4540c94cf357f7bf7d4b6e5d80"; + hash = "sha256-TEpvX28chR3CXiOQsNY12t8WfM9ywoZVX1e/6mj9DqE="; muslPatches = { dont-use-locale-a = { url = "https://git.alpinelinux.org/aports/plain/main/postgresql17/dont-use-locale-a-on-musl.patch?id=d69ead2c87230118ae7f72cef7d761e761e1f37e"; From 7a8b7390d88ff3af49ac1749e93314b8d0ff4572 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Fri, 14 Feb 2025 12:44:21 +0000 Subject: [PATCH 21/46] libpq: 17.2 -> 17.4 ChangeLog: https://www.postgresql.org/about/news/postgresql-173-167-1511-1416-and-1319-released-3015/ https://www.postgresql.org/about/news/out-of-cycle-release-scheduled-for-february-20-2025-3016/ Co-authored-by: Maximilian Bosch Co-authored-by: Wolfgang Walther --- pkgs/servers/sql/postgresql/libpq.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/sql/postgresql/libpq.nix b/pkgs/servers/sql/postgresql/libpq.nix index 62e7fc9df6c7..16f361b1f2a2 100644 --- a/pkgs/servers/sql/postgresql/libpq.nix +++ b/pkgs/servers/sql/postgresql/libpq.nix @@ -29,14 +29,14 @@ stdenv.mkDerivation (finalAttrs: { pname = "libpq"; - version = "17.2"; + version = "17.4"; src = fetchFromGitHub { owner = "postgres"; repo = "postgres"; # rev, not tag, on purpose: see generic.nix. - rev = "ref/tags/REL_17_2"; - hash = "sha256-P7IwvMcOI6vW14PiB2R0NEzAEPeaKg0zaUKTw2GJ5DA="; + rev = "f8554dee417ffc4540c94cf357f7bf7d4b6e5d80"; + hash = "sha256-TEpvX28chR3CXiOQsNY12t8WfM9ywoZVX1e/6mj9DqE="; }; __structuredAttrs = true; From 5c4f0b02f991e5ef60cbd19b8d301f64f64240e5 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Tue, 18 Feb 2025 12:33:08 +0000 Subject: [PATCH 22/46] ddcutil: 2.1.4 -> 2.2.0 --- pkgs/by-name/dd/ddcutil/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/dd/ddcutil/package.nix b/pkgs/by-name/dd/ddcutil/package.nix index cd0ad0b31990..12754468dea7 100644 --- a/pkgs/by-name/dd/ddcutil/package.nix +++ b/pkgs/by-name/dd/ddcutil/package.nix @@ -15,11 +15,11 @@ stdenv.mkDerivation rec { pname = "ddcutil"; - version = "2.1.4"; + version = "2.2.0"; src = fetchurl { url = "https://www.ddcutil.com/tarballs/ddcutil-${version}.tar.gz"; - hash = "sha256-4U/igqtgw2rwyuhEkV1pWYPIyNZEt2N6hlXJ9bDUyRw="; + hash = "sha256-7Qx58cWCafSRuNyhcdSSuf7xM0JzcOG6UFiWa5K5VS4="; }; nativeBuildInputs = [ From 5553f68fab67f8886a5b5352dddf8def9b5d2c8a Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Tue, 18 Feb 2025 17:03:46 -0800 Subject: [PATCH 23/46] doc: include no-broken-symlinks and nixLog in release notes --- doc/release-notes/rl-2505.section.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/release-notes/rl-2505.section.md b/doc/release-notes/rl-2505.section.md index 6e5ad92b4240..301cb6d172a0 100644 --- a/doc/release-notes/rl-2505.section.md +++ b/doc/release-notes/rl-2505.section.md @@ -8,6 +8,14 @@ - `services.rippleDataApi` has been removed, as `ripple-data-api` was broken and had not been updated since 2022. +- The [`no-broken-symlinks` hook](#no-broken-symlinks.sh) was added to catch builds containing dangling or reflexive symlinks, as these are indicative of problems with packaging. + The hook can be disabled by providing `dontCheckForBrokenSymlinks = true;` as an argument to `mkDerivation`. + For more information, [check the docs](#no-broken-symlinks.sh) or [see this PR](https://github.com/NixOS/nixpkgs/pull/370750). + +- The `nixLog*` family of functions made available through the standard environment have been rewritten to prefix messages with both the debug level and the function name of the caller. + The `nixLog` function, which logs unconditionally, was also re-introduced and modified to prefix messages with the function name of the caller. + For more information, [see this PR](https://github.com/NixOS/nixpkgs/pull/370742). + - The `rustPlatform.fetchCargoTarball` function is deprecated, because it relied on `cargo vendor` not changing its output format to keep fixed-output derivation hashes the same, which is a Nix invariant, and Cargo 1.84.0 changed `cargo vendor`'s output format. It should generally be replaced with `rustPlatform.fetchCargoVendor`, but `rustPlatform.importCargoLock` may also be appropriate in some circumstances. `rustPlatform.buildRustPackage` users must set `useFetchCargoVendor` to `true` and regenerate the `cargoHash`. From 0edfca8337208b8656923cccad5414e99dc4420e Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 01:42:40 +0000 Subject: [PATCH 24/46] filesender: 2.51 -> 2.52 --- pkgs/by-name/fi/filesender/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/fi/filesender/package.nix b/pkgs/by-name/fi/filesender/package.nix index 32eb0249d55b..bfaa8b09db89 100644 --- a/pkgs/by-name/fi/filesender/package.nix +++ b/pkgs/by-name/fi/filesender/package.nix @@ -6,13 +6,13 @@ }: stdenv.mkDerivation (finalAttrs: { pname = "filesender"; - version = "2.51"; + version = "2.52"; src = fetchFromGitHub { owner = "filesender"; repo = "filesender"; tag = "filesender-${finalAttrs.version}"; - hash = "sha256-HQ5/Df4F4Gwon0OhlIRTZ0NHTb9SJgQD+BDbH/aIeKw="; + hash = "sha256-Nl/3Kpo67dr5t/9+EWTyPmzi+sqW8pg5lzLC/jVtCkg="; }; patches = [ From 61e75bf4306eed3e3b9fd8e72b0841cfd48b30db Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 04:04:15 +0000 Subject: [PATCH 25/46] retrospy: 6.8.2 -> 6.8.3 --- pkgs/by-name/re/retrospy/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/re/retrospy/package.nix b/pkgs/by-name/re/retrospy/package.nix index 9b0d85e0f082..3f4e951ed29a 100644 --- a/pkgs/by-name/re/retrospy/package.nix +++ b/pkgs/by-name/re/retrospy/package.nix @@ -8,13 +8,13 @@ runCommandLocal, }: let - version = "6.8.2"; + version = "6.8.3"; src = fetchFromGitHub { owner = "retrospy"; repo = "RetroSpy"; rev = "v${version}"; - hash = "sha256-0f4rtBGjPSdCl3M72YPD6A6T4pOnpm9fde6ktvHcPLY="; + hash = "sha256-NuLfFSRGOIB6h4b5XZ7Qs8y5L+fqozQfMr8q0xZAurQ="; }; executables = [ From 256cc8ac8ed5c10dfdb53ff923bc3e68ea683067 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 05:27:21 +0000 Subject: [PATCH 26/46] home-assistant-custom-components.solis-sensor: 3.8.1 -> 3.9.0 --- .../home-assistant/custom-components/solis-sensor/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/home-assistant/custom-components/solis-sensor/package.nix b/pkgs/servers/home-assistant/custom-components/solis-sensor/package.nix index ca9f788e2454..2d1a056407cf 100644 --- a/pkgs/servers/home-assistant/custom-components/solis-sensor/package.nix +++ b/pkgs/servers/home-assistant/custom-components/solis-sensor/package.nix @@ -9,13 +9,13 @@ buildHomeAssistantComponent rec { owner = "hultenvp"; domain = "solis"; - version = "3.8.1"; + version = "3.9.0"; src = fetchFromGitHub { owner = "hultenvp"; repo = "solis-sensor"; rev = "v${version}"; - hash = "sha256-sjLHridYiF2x5XzW869BNjH9y2WtfvXXsNICKUmpOYM="; + hash = "sha256-RgsKIav3ozWYO9CXzvhMVmvOW74L/AHGOW8OWOMFBcQ="; }; dependencies = [ aiofiles ]; From eda3f940b127a115bfdd6de115fc2b1e296acedd Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 05:40:34 +0000 Subject: [PATCH 27/46] python312Packages.pygmt: 0.14.1 -> 0.14.2 --- pkgs/development/python-modules/pygmt/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pygmt/default.nix b/pkgs/development/python-modules/pygmt/default.nix index 9bd66ac91c0c..2be1633af886 100644 --- a/pkgs/development/python-modules/pygmt/default.nix +++ b/pkgs/development/python-modules/pygmt/default.nix @@ -18,7 +18,7 @@ buildPythonPackage rec { pname = "pygmt"; - version = "0.14.1"; + version = "0.14.2"; pyproject = true; disabled = pythonOlder "3.11"; @@ -27,7 +27,7 @@ buildPythonPackage rec { owner = "GenericMappingTools"; repo = "pygmt"; tag = "v${version}"; - hash = "sha256-F0BwKr8DTYa5mHvVpTFd4rds/esQ+tgPJn8shr3VUsk="; + hash = "sha256-UwqkJxO+LbJz7BVbQnulxm4sMrKHoY3ayqLHfZy7Ji4="; }; postPatch = '' @@ -65,7 +65,7 @@ buildPythonPackage rec { description = "Python interface for the Generic Mapping Tools"; homepage = "https://github.com/GenericMappingTools/pygmt"; license = lib.licenses.bsd3; - changelog = "https://github.com/GenericMappingTools/pygmt/releases/tag/v${version}"; + changelog = "https://github.com/GenericMappingTools/pygmt/releases/tag/${src.tag}"; maintainers = lib.teams.geospatial.members; }; } From 12a603b817573f4c867bb62341d2e73a01e39b17 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 06:18:19 +0000 Subject: [PATCH 28/46] opencomposite: 0-unstable-2025-01-23 -> 0-unstable-2025-02-08 --- pkgs/by-name/op/opencomposite/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/op/opencomposite/package.nix b/pkgs/by-name/op/opencomposite/package.nix index 620f58daf5d8..72263a013b89 100644 --- a/pkgs/by-name/op/opencomposite/package.nix +++ b/pkgs/by-name/op/opencomposite/package.nix @@ -16,14 +16,14 @@ stdenv.mkDerivation { pname = "opencomposite"; - version = "0-unstable-2025-01-23"; + version = "0-unstable-2025-02-08"; src = fetchFromGitLab { owner = "znixian"; repo = "OpenOVR"; - rev = "d37c9e7a4bc41f2b636282064eb39efb9e50d48b"; + rev = "175e3b3a5408ff120bd21036faa703deb57159fc"; fetchSubmodules = true; - hash = "sha256-Bc+lQdQeiojaHjglj7gZhXB5BMho0vb/HErfh50pcmA="; + hash = "sha256-kwu8eM/rQBcZfs91loh7QAB46a01F9n5Xm1DmMd53MQ="; }; nativeBuildInputs = [ From 9fabdffafc2ba4f9d7ac29609f93c85d9c859bd2 Mon Sep 17 00:00:00 2001 From: Brian McGillion Date: Wed, 19 Feb 2025 11:00:56 +0400 Subject: [PATCH 29/46] snort: 3.6.3.0 -> 3.7.0.0 update snort changelog: https://github.com/snort3/snort3/releases/tag/3.7.0.0/CHANGELOG.md Signed-off-by: Brian McGillion --- pkgs/by-name/li/libdaq/package.nix | 4 ++++ pkgs/by-name/sn/snort/package.nix | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/li/libdaq/package.nix b/pkgs/by-name/li/libdaq/package.nix index c182572de779..36c4df30b053 100644 --- a/pkgs/by-name/li/libdaq/package.nix +++ b/pkgs/by-name/li/libdaq/package.nix @@ -5,6 +5,7 @@ autoreconfHook, pkg-config, libpcap, + nix-update-script, }: stdenv.mkDerivation (finalAttrs: { @@ -46,6 +47,8 @@ stdenv.mkDerivation (finalAttrs: { done ''; + passthru.updateScript = nix-update-script { }; + meta = { description = "Data AcQuisition library (libDAQ), for snort packet I/O"; homepage = "https://www.snort.org"; @@ -53,6 +56,7 @@ stdenv.mkDerivation (finalAttrs: { aycanirican brianmcgillion ]; + changelog = "https://github.com/snort3/libdaq/releases/tag/v${finalAttrs.version}/changelog.md"; license = lib.licenses.gpl2; outputsToInstall = [ "lib" diff --git a/pkgs/by-name/sn/snort/package.nix b/pkgs/by-name/sn/snort/package.nix index 0fd10533ad91..390edbac2cd8 100644 --- a/pkgs/by-name/sn/snort/package.nix +++ b/pkgs/by-name/sn/snort/package.nix @@ -14,17 +14,18 @@ pkg-config, zlib, xz, + nix-update-script, }: stdenv.mkDerivation (finalAttrs: { pname = "snort"; - version = "3.6.3.0"; + version = "3.7.0.0"; src = fetchFromGitHub { owner = "snort3"; repo = "snort3"; - rev = "refs/tags/${finalAttrs.version}"; - hash = "sha256-loMmmpoaEncW31FUIE9Zf9w635Prvke6vCY+mIt6oGI="; + tag = finalAttrs.version; + hash = "sha256-KwKgKY+zcH7bZrtfMpkwb0LopGeImTwOf79hqZeYv/k="; }; nativeBuildInputs = [ @@ -53,6 +54,8 @@ stdenv.mkDerivation (finalAttrs: { enableParallelBuilding = true; + passthru.updateScript = nix-update-script { }; + meta = { description = "Network intrusion prevention and detection system (IDS/IPS)"; homepage = "https://www.snort.org"; @@ -60,6 +63,7 @@ stdenv.mkDerivation (finalAttrs: { aycanirican brianmcgillion ]; + changelog = "https://github.com/snort3/snort3/releases/tag/${finalAttrs.version}/CHANGELOG.md"; license = lib.licenses.gpl2; platforms = with lib.platforms; linux; }; From 7a6bb7c38258d1755067af3392aed4fa3dd33062 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 07:10:25 +0000 Subject: [PATCH 30/46] python312Packages.cvss: 3.3 -> 3.4 --- pkgs/development/python-modules/cvss/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/cvss/default.nix b/pkgs/development/python-modules/cvss/default.nix index 0ada48e67d44..791bd43df9fe 100644 --- a/pkgs/development/python-modules/cvss/default.nix +++ b/pkgs/development/python-modules/cvss/default.nix @@ -10,7 +10,7 @@ buildPythonPackage rec { pname = "cvss"; - version = "3.3"; + version = "3.4"; pyproject = true; disabled = pythonOlder "3.7"; @@ -19,7 +19,7 @@ buildPythonPackage rec { owner = "RedHatProductSecurity"; repo = "cvss"; tag = "v${version}"; - hash = "sha256-+8aKNPcHFPcDyBvOO9QCVb1OIbpQHAEeJgt8fob0+lM="; + hash = "sha256-g6+ccoIgqs7gZPrTuKm3em+PzLvpupb9JXOGMqf2Uv0="; }; build-system = [ setuptools ]; @@ -38,7 +38,7 @@ buildPythonPackage rec { meta = with lib; { description = "Library for CVSS2/3/4"; homepage = "https://github.com/RedHatProductSecurity/cvss"; - changelog = "https://github.com/RedHatProductSecurity/cvss/releases/tag/v${version}"; + changelog = "https://github.com/RedHatProductSecurity/cvss/releases/tag/${src.tag}"; license = licenses.lgpl3Plus; maintainers = with maintainers; [ fab ]; mainProgram = "cvss_calculator"; From b659f50342c0eaa76e0bd2d01d4e063992d5dd57 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 19 Feb 2025 07:21:23 +0000 Subject: [PATCH 31/46] python312Packages.aiocomelit: 0.10.1 -> 0.11.0 --- pkgs/development/python-modules/aiocomelit/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/aiocomelit/default.nix b/pkgs/development/python-modules/aiocomelit/default.nix index fe285194d4b5..cd329446bef3 100644 --- a/pkgs/development/python-modules/aiocomelit/default.nix +++ b/pkgs/development/python-modules/aiocomelit/default.nix @@ -13,7 +13,7 @@ buildPythonPackage rec { pname = "aiocomelit"; - version = "0.10.1"; + version = "0.11.0"; pyproject = true; disabled = pythonOlder "3.12"; @@ -22,7 +22,7 @@ buildPythonPackage rec { owner = "chemelli74"; repo = "aiocomelit"; tag = "v${version}"; - hash = "sha256-1XH2RwdnXDi57FUf1R7HLiFFNxyT3A6MroZ+kk1xIGo="; + hash = "sha256-6eTeBisAt5vP1+140qfMJ3GqSqclzHGiNpN3lzBvoqQ="; }; build-system = [ poetry-core ]; @@ -43,7 +43,7 @@ buildPythonPackage rec { meta = with lib; { description = "Library to control Comelit Simplehome"; homepage = "https://github.com/chemelli74/aiocomelit"; - changelog = "https://github.com/chemelli74/aiocomelit/blob/v${version}/CHANGELOG.md"; + changelog = "https://github.com/chemelli74/aiocomelit/blob/${src.tag}/CHANGELOG.md"; license = licenses.asl20; maintainers = with maintainers; [ fab ]; }; From a2281c7ac726715eb21ea08fb25d806ecfe4f406 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 14 Feb 2025 16:45:11 +0300 Subject: [PATCH 32/46] fluidd: 1.31.4 -> 1.32.3, build from source --- pkgs/by-name/fl/fluidd/hardcode-version.patch | 15 ++++++++ pkgs/by-name/fl/fluidd/package.nix | 37 +++++++++++-------- 2 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 pkgs/by-name/fl/fluidd/hardcode-version.patch diff --git a/pkgs/by-name/fl/fluidd/hardcode-version.patch b/pkgs/by-name/fl/fluidd/hardcode-version.patch new file mode 100644 index 000000000000..4b12a7823464 --- /dev/null +++ b/pkgs/by-name/fl/fluidd/hardcode-version.patch @@ -0,0 +1,15 @@ +diff --git a/vite.config.inject-version.ts b/vite.config.inject-version.ts +index d1321fcf..fb3e4c6d 100644 +--- a/vite.config.inject-version.ts ++++ b/vite.config.inject-version.ts +@@ -29,9 +29,7 @@ const vitePluginInjectVersion = (): Plugin => { + return { + name: 'version', + config: () => { +- const git_hash = child_process +- .execSync('git rev-parse --short HEAD') +- .toString() ++ const git_hash = '@version@' + + return { + define: { diff --git a/pkgs/by-name/fl/fluidd/package.nix b/pkgs/by-name/fl/fluidd/package.nix index 275be923db0e..dea7aeb2f819 100644 --- a/pkgs/by-name/fl/fluidd/package.nix +++ b/pkgs/by-name/fl/fluidd/package.nix @@ -1,28 +1,33 @@ -{ lib, stdenvNoCC, fetchurl, unzip, nixosTests }: +{ + lib, + buildNpmPackage, + fetchFromGitHub, + replaceVars, + nixosTests, +}: -stdenvNoCC.mkDerivation rec { +buildNpmPackage rec { pname = "fluidd"; - version = "1.31.4"; + version = "1.32.3"; - src = fetchurl { - name = "fluidd-v${version}.zip"; - url = "https://github.com/fluidd-core/fluidd/releases/download/v${version}/fluidd.zip"; - sha256 = "sha256-gqwVZg37pZA+XjT3FpTMYkrOIT1KKUN6upg7e1vh1t0="; + src = fetchFromGitHub { + owner = "fluidd-core"; + repo = "fluidd"; + tag = "v${version}"; + hash = "sha256-3sfjwwfanmRy45hrjG9X0lYVPsC41S2oZkbISz6YzYo="; }; - nativeBuildInputs = [ unzip ]; + patches = [ + (replaceVars ./hardcode-version.patch { + inherit version; + }) + ]; - dontConfigure = true; - dontBuild = true; - - unpackPhase = '' - mkdir fluidd - unzip $src -d fluidd - ''; + npmDepsHash = "sha256-bwdlBXq1Z6ZoxwGhfMtPQy74/oxRt2aGxh+HXjREWMQ="; installPhase = '' mkdir -p $out/share/fluidd - cp -r fluidd $out/share/fluidd/htdocs + cp -r dist $out/share/fluidd/htdocs ''; passthru.tests = { inherit (nixosTests) fluidd; }; From 22393388bca6cc54f744fc8c8b65f97102ff38b7 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 14 Feb 2025 17:02:05 +0300 Subject: [PATCH 33/46] klipper-estimator: report version correctly --- pkgs/applications/misc/klipper-estimator/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/applications/misc/klipper-estimator/default.nix b/pkgs/applications/misc/klipper-estimator/default.nix index 967eac699f01..609414f21d7f 100644 --- a/pkgs/applications/misc/klipper-estimator/default.nix +++ b/pkgs/applications/misc/klipper-estimator/default.nix @@ -24,6 +24,8 @@ rustPlatform.buildRustPackage rec { useFetchCargoVendor = true; cargoHash = "sha256-wMgFkzgoHjvE+5t+cA5OW2COXbUj/5tWXz0Zp9cd5lw="; + env.TOOL_VERSION = "v${version}"; + buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ From 220a833bea7d89d5d89023259849f7de69ba42c2 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 14 Feb 2025 16:17:14 +0300 Subject: [PATCH 34/46] moonraker: 0.9.3-unstable-2024-11-17 -> 0.9.3-unstable-2025-02-18 --- pkgs/by-name/mo/moonraker/package.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/mo/moonraker/package.nix b/pkgs/by-name/mo/moonraker/package.nix index 7e4f3bd45acb..300b4edfedff 100644 --- a/pkgs/by-name/mo/moonraker/package.nix +++ b/pkgs/by-name/mo/moonraker/package.nix @@ -25,7 +25,7 @@ let zeroconf preprocess-cancellation jinja2 - dbus-next + dbus-fast apprise python-periphery ldap3 @@ -35,13 +35,13 @@ let in stdenvNoCC.mkDerivation rec { pname = "moonraker"; - version = "0.9.3-unstable-2024-11-17"; + version = "0.9.3-unstable-2025-02-18"; src = fetchFromGitHub { owner = "Arksine"; repo = "moonraker"; - rev = "ccfe32f2368a5ff6c2497478319909daeeeb8edf"; - sha256 = "sha256-aCYE3EmflMRIHnGnkZ/0+zScVA5liHSbavScQ7XRf/4="; + rev = "62051108ea16d5db5fa382651e01a51d89c041c9"; + sha256 = "sha256-mKbWnEnpCWhoiYY9T5HrNI0vVGM4LwrJqAzhJa+Rj4Y="; }; nativeBuildInputs = [ makeWrapper ]; From 550696628ccffb598c7cec6491717b0eebe82ed9 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 14 Feb 2025 16:22:05 +0300 Subject: [PATCH 35/46] nixos/moonraker: allow configuring analysis --- nixos/modules/services/misc/moonraker.nix | 28 +++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/misc/moonraker.nix b/nixos/modules/services/misc/moonraker.nix index 620eb71bd74f..43d46a690915 100644 --- a/nixos/modules/services/misc/moonraker.nix +++ b/nixos/modules/services/misc/moonraker.nix @@ -110,6 +110,8 @@ in for details on what clients are able to do. ''; }; + + analysis.enable = lib.mkEnableOption "Runtime analysis with klipper-estimator"; }; }; @@ -170,9 +172,15 @@ in in format.generate "moonraker.cfg" fullConfig; - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' - ${cfg.user} ${cfg.group} - -" - ] ++ lib.optional (cfg.configDir != null) "d '${cfg.configDir}' - ${cfg.user} ${cfg.group} - -"; + systemd.tmpfiles.rules = + [ + "d '${cfg.stateDir}' - ${cfg.user} ${cfg.group} - -" + ] + ++ lib.optional (cfg.configDir != null) "d '${cfg.configDir}' - ${cfg.user} ${cfg.group} - -" + ++ lib.optionals cfg.analysis.enable [ + "d '${cfg.stateDir}/tools/klipper_estimator' - ${cfg.user} ${cfg.group} - -" + "L+ '${cfg.stateDir}/tools/klipper_estimator/klipper_estimator_linux' - - - - ${lib.getExe pkgs.klipper-estimator}" + ]; systemd.services.moonraker = { description = "Moonraker, an API web server for Klipper"; @@ -206,10 +214,16 @@ in }; }; - # set this to false, otherwise we'll get a warning indicating that `/etc/klipper.cfg` - # is not located in the moonraker config directory. - services.moonraker.settings = lib.mkIf (!config.services.klipper.mutableConfig) { - file_manager.check_klipper_config_path = false; + services.moonraker.settings = { + # set this to false, otherwise we'll get a warning indicating that `/etc/klipper.cfg` + # is not located in the moonraker config directory. + file_manager.check_klipper_config_path = lib.mkIf (!config.services.klipper.mutableConfig) false; + + # enable analysis with our own klipper-estimator, disable updating it + analysis = lib.mkIf (cfg.analysis.enable) { + platform = "linux"; + enable_estimator_updates = false; + }; }; security.polkit.extraConfig = lib.optionalString cfg.allowSystemControl '' From 04be434adbe49a46c20a825ae6ca0b94676a5668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=82=E0=B8=97=E0=B8=AA=E0=B8=BA=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A5?= Date: Wed, 19 Feb 2025 15:16:06 +0700 Subject: [PATCH 36/46] h2o: mruby on by default After playing around with configs & examples, too many things are under the expectation that Mruby is on by default. It seems this would be a better default for Nix users. --- pkgs/by-name/h2/h2o/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/h2/h2o/package.nix b/pkgs/by-name/h2/h2o/package.nix index d908919589d4..66f1e5712bef 100644 --- a/pkgs/by-name/h2/h2o/package.nix +++ b/pkgs/by-name/h2/h2o/package.nix @@ -13,7 +13,7 @@ libuv, wslay, zlib, - withMruby ? false, + withMruby ? true, bison, ruby, }: From 52b329edeff0b54b798e71051fcf0e06aa01a38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 19 Feb 2025 09:20:13 +0100 Subject: [PATCH 37/46] python3Packages.m2crypto: 0.43.0 -> 0.44.0 https://gitlab.com/m2crypto/m2crypto/-/tags/0.44.0 Also pull a Debian patch to fix build: https://hydra.nixos.org/build/289647638/nixlog/3/tail --- pkgs/development/python-modules/m2crypto/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/m2crypto/default.nix b/pkgs/development/python-modules/m2crypto/default.nix index 4b1f3ca07aa2..1767050052fc 100644 --- a/pkgs/development/python-modules/m2crypto/default.nix +++ b/pkgs/development/python-modules/m2crypto/default.nix @@ -3,6 +3,7 @@ stdenv, buildPythonPackage, fetchPypi, + fetchurl, openssl, pytestCheckHook, pythonOlder, @@ -12,15 +13,21 @@ buildPythonPackage rec { pname = "m2crypto"; - version = "0.43.0"; + version = "0.44.0"; pyproject = true; disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; - hash = "sha256-bCwce7DoqnaPfKgD2n28JmbUADsmvXrfcCM6/FnYzzM="; + hash = "sha256-OEu0y9F47g50AVMRt7H58sN342huA/oHCz7C9JRnHA8="; }; + patches = [ + (fetchurl { + url = "https://sources.debian.org/data/main/m/m2crypto/0.42.0-2.1/debian/patches/0004-swig-Workaround-for-reading-sys-select.h-ending-with.patch"; + hash = "sha256-/Bkuqu/Od+S56AUWo0ZzpZF7FGMxP766K2GJnfKXrOI="; + }) + ]; build-system = [ setuptools ]; From 42e7b59a9d157e1e0443a31051e02b5619ea0021 Mon Sep 17 00:00:00 2001 From: Kirill Radzikhovskyy Date: Wed, 19 Feb 2025 19:24:10 +1100 Subject: [PATCH 38/46] nodejs_20: nixfmt --- pkgs/development/web/nodejs/v20.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/web/nodejs/v20.nix b/pkgs/development/web/nodejs/v20.nix index 66dbd357f028..dca76d89b8b4 100644 --- a/pkgs/development/web/nodejs/v20.nix +++ b/pkgs/development/web/nodejs/v20.nix @@ -1,4 +1,3 @@ - { callPackage, fetchpatch2, From 3ec52358bca7edbfd6747a7f5f7b0b1f8b024477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 19 Feb 2025 09:55:07 +0100 Subject: [PATCH 39/46] rubyPackages.charlock_holmes: 0.7.7 -> 0.7.9 Also the same inside schleuder gem-lock. https://github.com/brianmario/charlock_holmes/compare/v0.7.7...v0.7.9 In particular this fixes build, probably after icu upgrade: https://hydra.nixos.org/build/289930518/nixlog/3/tail --- pkgs/tools/security/schleuder/Gemfile.lock | 2 +- pkgs/tools/security/schleuder/gemset.nix | 4 ++-- pkgs/top-level/ruby-packages.nix | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/security/schleuder/Gemfile.lock b/pkgs/tools/security/schleuder/Gemfile.lock index 96970097b875..5fa592457fe8 100644 --- a/pkgs/tools/security/schleuder/Gemfile.lock +++ b/pkgs/tools/security/schleuder/Gemfile.lock @@ -16,7 +16,7 @@ GEM tzinfo (~> 2.0) zeitwerk (~> 2.3) bcrypt (3.1.20) - charlock_holmes (0.7.7) + charlock_holmes (0.7.9) concurrent-ruby (1.3.1) daemons (1.4.1) eventmachine (1.2.7) diff --git a/pkgs/tools/security/schleuder/gemset.nix b/pkgs/tools/security/schleuder/gemset.nix index ec334c67ac5f..025c6aa9e997 100644 --- a/pkgs/tools/security/schleuder/gemset.nix +++ b/pkgs/tools/security/schleuder/gemset.nix @@ -56,10 +56,10 @@ platforms = [ ]; source = { remotes = [ "https://rubygems.org" ]; - sha256 = "0hybw8jw9ryvz5zrki3gc9r88jqy373m6v46ynxsdzv1ysiyr40p"; + sha256 = "1c1dws56r7p8y363dhyikg7205z59a3bn4amnv2y488rrq8qm7ml"; type = "gem"; }; - version = "0.7.7"; + version = "0.7.9"; }; concurrent-ruby = { groups = [ "default" ]; diff --git a/pkgs/top-level/ruby-packages.nix b/pkgs/top-level/ruby-packages.nix index 3bf08ddf5be8..b321a80017f4 100644 --- a/pkgs/top-level/ruby-packages.nix +++ b/pkgs/top-level/ruby-packages.nix @@ -322,10 +322,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0hybw8jw9ryvz5zrki3gc9r88jqy373m6v46ynxsdzv1ysiyr40p"; + sha256 = "1c1dws56r7p8y363dhyikg7205z59a3bn4amnv2y488rrq8qm7ml"; type = "gem"; }; - version = "0.7.7"; + version = "0.7.9"; }; childprocess = { dependecnies = ["logger"]; From 20fe96061cacbbb2a93fe6c8a0a1b65ecfb3bed2 Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 19 Feb 2025 12:58:07 +0300 Subject: [PATCH 40/46] maintainers/scripts/kde: handle duplicate tarballs properly --- maintainers/scripts/kde/generate-sources.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/maintainers/scripts/kde/generate-sources.py b/maintainers/scripts/kde/generate-sources.py index b03ef3cc5f6b..e4241cced120 100755 --- a/maintainers/scripts/kde/generate-sources.py +++ b/maintainers/scripts/kde/generate-sources.py @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.beautifulsoup4 ps.click ps.httpx ps.jinja2 ps.pyyaml ])" +#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.beautifulsoup4 ps.click ps.httpx ps.jinja2 ps.packaging ps.pyyaml ])" import base64 import binascii import json @@ -11,6 +11,7 @@ import bs4 import click import httpx import jinja2 +import packaging.version as v import utils @@ -104,6 +105,12 @@ def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: Optional[st hash = client.get(url + ".sha256").text.split(" ", maxsplit=1)[0] assert hash + if existing := results.get(project_name): + old_version = existing["version"] + if v.parse(old_version) > v.parse(version): + print(f"{project_name} {old_version} is newer than {version}, skipping...") + continue + results[project_name] = { "version": version, "url": "mirror://kde" + urlparse(url).path, From 8ddfa70f499ffb7dfcbe8a988b1ab4c73567cf88 Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 19 Feb 2025 12:58:27 +0300 Subject: [PATCH 41/46] kdePackages.spectacle: 6.3.1 -> 6.3.1.2 --- pkgs/kde/generated/sources/plasma.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/kde/generated/sources/plasma.json b/pkgs/kde/generated/sources/plasma.json index 9b10cdc176d1..ce5a54b7fa28 100644 --- a/pkgs/kde/generated/sources/plasma.json +++ b/pkgs/kde/generated/sources/plasma.json @@ -315,9 +315,9 @@ "hash": "sha256-vy5JcIKk5bYpa4NZKYkNI9qbobPbSU+GEjfWlvbEmb8=" }, "spectacle": { - "version": "6.3.1", - "url": "mirror://kde/stable/plasma/6.3.1/spectacle-6.3.1.tar.xz", - "hash": "sha256-DzZLBd/MDGPB62luWTGPg6nIPUFi9WVrT6X+KdrMgU4=" + "version": "6.3.1.2", + "url": "mirror://kde/stable/plasma/6.3.1/spectacle-6.3.1.2.tar.xz", + "hash": "sha256-g35ejQ745SL01qN9pInk+G2DZJkfz3lsWP0FJvgc+go=" }, "systemsettings": { "version": "6.3.1", From 83377f8253f985a8dd25e57c046b89d7ec23bc4b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 18 Feb 2025 10:39:59 +0100 Subject: [PATCH 42/46] linux_6_12: 6.12.14 -> 6.12.15 --- pkgs/os-specific/linux/kernel/kernels-org.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/kernels-org.json b/pkgs/os-specific/linux/kernel/kernels-org.json index 3284b4d54aa0..c0508af46707 100644 --- a/pkgs/os-specific/linux/kernel/kernels-org.json +++ b/pkgs/os-specific/linux/kernel/kernels-org.json @@ -28,8 +28,8 @@ "hash": "sha256:1z2913y38clnlmhvwj49h7p4pic24s4d8np7nmd4lk7m2xz8w532" }, "6.12": { - "version": "6.12.14", - "hash": "sha256:054gi5fp60d2536z06b1lmys9zlraixh22yb75z42xfqnjzz88wl" + "version": "6.12.15", + "hash": "sha256:02k3yzlri0h9s4hcx20sif5jvafhjk9vab9h6wsca8hfxa2bvxaz" }, "6.13": { "version": "6.13.3", From dc080d6cf6459ae15c430696702be4896134b4e1 Mon Sep 17 00:00:00 2001 From: Brian McGillion Date: Wed, 19 Feb 2025 08:28:33 +0400 Subject: [PATCH 43/46] optinix: enable auto-update with nix-update ask the bot to do the bumps. Signed-off-by: Brian McGillion --- pkgs/by-name/op/optinix/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/op/optinix/package.nix b/pkgs/by-name/op/optinix/package.nix index 1f0e0466b5f9..221b72130dae 100644 --- a/pkgs/by-name/op/optinix/package.nix +++ b/pkgs/by-name/op/optinix/package.nix @@ -3,6 +3,7 @@ fetchFromGitLab, buildGoModule, installShellFiles, + nix-update-script, }: buildGoModule rec { pname = "optinix"; @@ -11,7 +12,7 @@ buildGoModule rec { src = fetchFromGitLab { owner = "hmajid2301"; repo = "optinix"; - rev = "v${version}"; + tag = "v${version}"; hash = "sha256-OuzLTygfJj1ILT0lAcBC28vU5YLuq0ErZHsLHoQNWBA="; }; @@ -31,6 +32,8 @@ buildGoModule rec { --zsh <($out/bin/optinix completion zsh) ''; + passthru.updateScript = nix-update-script { }; + meta = { description = "Tool for searching options in Nix"; homepage = "https://gitlab.com/hmajid2301/optinix"; From 4ba2c1d45a06ad312fa39bbbd300adcd317ab9b9 Mon Sep 17 00:00:00 2001 From: Brian McGillion Date: Wed, 19 Feb 2025 08:30:54 +0400 Subject: [PATCH 44/46] optinix: add myself to maintainers Signed-off-by: Brian McGillion --- pkgs/by-name/op/optinix/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/op/optinix/package.nix b/pkgs/by-name/op/optinix/package.nix index 221b72130dae..044b190e4e20 100644 --- a/pkgs/by-name/op/optinix/package.nix +++ b/pkgs/by-name/op/optinix/package.nix @@ -38,7 +38,10 @@ buildGoModule rec { description = "Tool for searching options in Nix"; homepage = "https://gitlab.com/hmajid2301/optinix"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ hmajid2301 ]; + maintainers = with lib.maintainers; [ + hmajid2301 + brianmcgillion + ]; changelog = "https://gitlab.com/hmajid2301/optinix/-/releases/v${version}"; mainProgram = "optinix"; }; From ffed5a94967344a2aafb97782330a541d8a2a57c Mon Sep 17 00:00:00 2001 From: Ingo Reitz <9l@9lo.re> Date: Wed, 19 Feb 2025 11:37:51 +0100 Subject: [PATCH 45/46] breeze-icons: add qtsvg as a propagatedBuildInput --- pkgs/kde/frameworks/breeze-icons/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/kde/frameworks/breeze-icons/default.nix b/pkgs/kde/frameworks/breeze-icons/default.nix index e7c75aad85fb..e01f7f6b1896 100644 --- a/pkgs/kde/frameworks/breeze-icons/default.nix +++ b/pkgs/kde/frameworks/breeze-icons/default.nix @@ -2,6 +2,7 @@ mkKdeDerivation, python3, libxml2, + qtsvg, }: mkKdeDerivation { pname = "breeze-icons"; @@ -11,6 +12,11 @@ mkKdeDerivation { libxml2 ]; + # This package contains an SVG icon theme and an API forcing its use + extraPropagatedBuildInputs = [ + qtsvg + ]; + # lots of icons, takes forever, does absolutely nothing dontStrip = true; } From a56a3d7d3530b84b23bf49d6ae01fa3a722ae40d Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 19 Feb 2025 14:15:44 +0300 Subject: [PATCH 46/46] kdePackages.plasma-desktop: 6.3.1 -> 6.3.1.1 Includes the build fix upstream. --- pkgs/kde/generated/sources/plasma.json | 6 +- pkgs/kde/plasma/plasma-desktop/default.nix | 5 - .../kde/plasma/plasma-desktop/fix-build.patch | 107 ------------------ 3 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 pkgs/kde/plasma/plasma-desktop/fix-build.patch diff --git a/pkgs/kde/generated/sources/plasma.json b/pkgs/kde/generated/sources/plasma.json index ce5a54b7fa28..fa0a9437ff7f 100644 --- a/pkgs/kde/generated/sources/plasma.json +++ b/pkgs/kde/generated/sources/plasma.json @@ -195,9 +195,9 @@ "hash": "sha256-kaSXmq4aChMZSLCz+JcIvREGsH59sPwdU708omjaYSc=" }, "plasma-desktop": { - "version": "6.3.1", - "url": "mirror://kde/stable/plasma/6.3.1/plasma-desktop-6.3.1.tar.xz", - "hash": "sha256-EZydNhJ0NnBIMghky6/8YSUwy6TqYtbf1QTz7+WyVKQ=" + "version": "6.3.1.1", + "url": "mirror://kde/stable/plasma/6.3.1/plasma-desktop-6.3.1.1.tar.xz", + "hash": "sha256-zgKHR9MeF2vem/RoA7LaVKy8Beu8/52cWFzALpsmrP0=" }, "plasma-dialer": { "version": "6.3.1", diff --git a/pkgs/kde/plasma/plasma-desktop/default.nix b/pkgs/kde/plasma/plasma-desktop/default.nix index 2a8e8df9d740..7933541b4501 100644 --- a/pkgs/kde/plasma/plasma-desktop/default.nix +++ b/pkgs/kde/plasma/plasma-desktop/default.nix @@ -43,11 +43,6 @@ mkKdeDerivation { (replaceVars ./wallpaper-paths.patch { wallpapers = "${lib.getBin breeze}/share/wallpapers"; }) - - # Fix build failure due to C++ template nonsense - # Submitted upstream: https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2833 - # FIXME: remove when merged - ./fix-build.patch ]; extraNativeBuildInputs = [ pkg-config ]; diff --git a/pkgs/kde/plasma/plasma-desktop/fix-build.patch b/pkgs/kde/plasma/plasma-desktop/fix-build.patch deleted file mode 100644 index 9729ffb46bb5..000000000000 --- a/pkgs/kde/plasma/plasma-desktop/fix-build.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff --git a/kcms/libkwindevices/inputdevice.cpp b/kcms/libkwindevices/inputdevice.cpp -index 9a437137077390a61152be96ac69b4f5e992d062..aea0952143a29a4b2bf06777f737a84cbd6e5b6d 100644 ---- a/kcms/libkwindevices/inputdevice.cpp -+++ b/kcms/libkwindevices/inputdevice.cpp -@@ -10,44 +10,6 @@ - - #include "logging.h" - --template --bool InputDevice::Prop::save() --{ -- if (!isSupported() || !m_value || m_prop.isConstant()) { -- qCDebug(LIBKWINDEVICES) << "skipping" << this << m_value.has_value() << isSupported() << m_prop.name(); -- return false; -- } -- -- auto iface = m_device->m_iface.get(); -- const bool ret = m_prop.write(iface, *m_value); -- if (ret) { -- m_configValue = *m_value; -- } -- return ret; --} -- --template --void InputDevice::Prop::set(T newVal) --{ -- if (!m_value) { -- value(); -- } -- -- Q_ASSERT(isSupported()); -- if (m_value != newVal) { -- m_value = newVal; -- if (m_changedSignalFunction) { -- (m_device->*m_changedSignalFunction)(); -- } -- } --} -- --template --bool InputDevice::Prop::changed() const --{ -- return m_value.has_value() && m_value.value() != m_configValue; --} -- - InputDevice::InputDevice(const QString &dbusName, QObject *parent) - : QObject(parent) - { -diff --git a/kcms/libkwindevices/inputdevice.h b/kcms/libkwindevices/inputdevice.h -index 93f9753cfae3c8795c5493566f7e51c806710983..f5589b095f39aa76071f67b8ee544a71585a479a 100644 ---- a/kcms/libkwindevices/inputdevice.h -+++ b/kcms/libkwindevices/inputdevice.h -@@ -269,12 +269,29 @@ private: - } - } - -- void set(T newVal); -+ void set(T newVal) { -+ if (!m_value) { -+ value(); -+ } -+ -+ Q_ASSERT(isSupported()); -+ if (m_value != newVal) { -+ m_value = newVal; -+ if (m_changedSignalFunction) { -+ (m_device->*m_changedSignalFunction)(); -+ } -+ } -+ } -+ - T defaultValue() const - { - return m_defaultValueFunction ? (m_device->m_iface.get()->*m_defaultValueFunction)() : T(); - } -- bool changed() const; -+ -+ bool changed() const { -+ return m_value.has_value() && m_value.value() != m_configValue; -+ } -+ - void set(const Prop &p) - { - set(p.value()); -@@ -286,7 +303,20 @@ private: - return !m_supportedFunction || (iface->*m_supportedFunction)(); - } - -- bool save(); -+ bool save() { -+ if (!isSupported() || !m_value || m_prop.isConstant()) { -+ qDebug() << "skipping" << this << m_value.has_value() << isSupported() << m_prop.name(); -+ return false; -+ } -+ -+ auto iface = m_device->m_iface.get(); -+ const bool ret = m_prop.write(iface, *m_value); -+ if (ret) { -+ m_configValue = *m_value; -+ } -+ return ret; -+ } -+ - bool isDefaults() const - { - return m_value == defaultValue();