Merge master into staging-next

This commit is contained in:
nixpkgs-ci[bot]
2025-03-08 00:12:07 +00:00
committed by GitHub
42 changed files with 1582 additions and 812 deletions
+149
View File
@@ -165,6 +165,64 @@ testers.shellcheck {
A derivation that runs `shellcheck` on the given script(s).
The build will fail if `shellcheck` finds any issues.
## `shfmt` {#tester-shfmt}
Run files through `shfmt`, a shell script formatter, failing if any files are reformatted.
:::{.example #ex-shfmt}
# Run `testers.shfmt`
A single script
```nix
testers.shfmt {
name = "script";
src = ./script.sh;
}
```
Multiple files
```nix
let
inherit (lib) fileset;
in
testers.shfmt {
name = "nixbsd";
src = fileset.toSource {
root = ./.;
fileset = fileset.unions [
./lib.sh
./nixbsd-activate
];
};
}
```
:::
### Inputs {#tester-shfmt-inputs}
`name` (string)
: The name of the test.
`name` is required because it massively improves traceability of test failures.
The name of the derivation produced by the tester is `shfmt-${name}`.
`src` (path-like)
: The path to the shell script(s) to check.
This can be a single file or a directory containing shell files.
All files in `src` will be checked, so you may want to provide `fileset`-based source instead of a whole directory.
`indent` (integer, optional)
: The number of spaces to use for indentation.
Defaults to `2`.
A value of `0` indents with tabs.
### Return value {#tester-shfmt-return}
A derivation that runs `shfmt` on the given script(s), producing an empty output upon success.
The build will fail if `shfmt` reformats anything.
## `testVersion` {#tester-testVersion}
Checks that the output from running a command contains the specified version string in it as a whole word.
@@ -347,6 +405,97 @@ testers.testEqualContents {
:::
## `testEqualArrayOrMap` {#tester-testEqualArrayOrMap}
Check that bash arrays (including associative arrays, referred to as "maps") are populated correctly.
This can be used to ensure setup hooks are registered in a certain order, or to write unit tests for shell functions which transform arrays.
:::{.example #ex-testEqualArrayOrMap-test-function-add-cowbell}
# Test a function which appends a value to an array
```nix
testers.testEqualArrayOrMap {
name = "test-function-add-cowbell";
valuesArray = [
"cowbell"
"cowbell"
];
expectedArray = [
"cowbell"
"cowbell"
"cowbell"
];
script = ''
addCowbell() {
local -rn arrayNameRef="$1"
arrayNameRef+=( "cowbell" )
}
nixLog "appending all values in valuesArray to actualArray"
for value in "''${valuesArray[@]}"; do
actualArray+=( "$value" )
done
nixLog "applying addCowbell"
addCowbell actualArray
'';
}
```
:::
### Inputs {#tester-testEqualArrayOrMap-inputs}
NOTE: Internally, this tester uses `__structuredAttrs` to handle marshalling between Nix expressions and shell variables.
This imposes the restriction that arrays and "maps" have values which are string-like.
NOTE: At least one of `expectedArray` and `expectedMap` must be provided.
`name` (string)
: The name of the test.
`script` (string)
: The singular task of `script` is to populate `actualArray` or `actualMap` (it may populate both).
To do this, `script` may access the following shell variables:
- `valuesArray` (available when `valuesArray` is provided to the tester)
- `valuesMap` (available when `valuesMap` is provided to the tester)
- `actualArray` (available when `expectedArray` is provided to the tester)
- `actualMap` (available when `expectedMap` is provided to the tester)
While both `expectedArray` and `expectedMap` are in scope during the execution of `script`, they *must not* be accessed or modified from within `script`.
`valuesArray` (array of string-like values, optional)
: An array of string-like values.
This array may be used within `script`.
`valuesMap` (attribute set of string-like values, optional)
: An attribute set of string-like values.
This attribute set may be used within `script`.
`expectedArray` (array of string-like values, optional)
: An array of string-like values.
This array *must not* be accessed or modified from within `script`.
When provided, `script` is expected to populate `actualArray`.
`expectedMap` (attribute set of string-like values, optional)
: An attribute set of string-like values.
This attribute set *must not* be accessed or modified from within `script`.
When provided, `script` is expected to populate `actualMap`.
### Return value {#tester-testEqualArrayOrMap-return}
The tester produces an empty output and only succeeds when `expectedArray` and `expectedMap` match `actualArray` and `actualMap`, respectively, when non-null.
The build log will contain differences encountered.
## `testEqualDerivation` {#tester-testEqualDerivation}
Checks that two packages produce the exact same build instructions.
+24
View File
@@ -8,9 +8,15 @@
"ex-build-helpers-extendMkDerivation": [
"index.html#ex-build-helpers-extendMkDerivation"
],
"ex-shfmt": [
"index.html#ex-shfmt"
],
"ex-testBuildFailurePrime-doc-example": [
"index.html#ex-testBuildFailurePrime-doc-example"
],
"ex-testEqualArrayOrMap-test-function-add-cowbell": [
"index.html#ex-testEqualArrayOrMap-test-function-add-cowbell"
],
"neovim": [
"index.html#neovim"
],
@@ -335,6 +341,15 @@
"footnote-stdenv-find-inputs-location.__back.0": [
"index.html#footnote-stdenv-find-inputs-location.__back.0"
],
"tester-shfmt": [
"index.html#tester-shfmt"
],
"tester-shfmt-inputs": [
"index.html#tester-shfmt-inputs"
],
"tester-shfmt-return": [
"index.html#tester-shfmt-return"
],
"tester-testBuildFailurePrime": [
"index.html#tester-testBuildFailurePrime"
],
@@ -344,6 +359,15 @@
"tester-testBuildFailurePrime-return": [
"index.html#tester-testBuildFailurePrime-return"
],
"tester-testEqualArrayOrMap": [
"index.html#tester-testEqualArrayOrMap"
],
"tester-testEqualArrayOrMap-inputs": [
"index.html#tester-testEqualArrayOrMap-inputs"
],
"tester-testEqualArrayOrMap-return": [
"index.html#tester-testEqualArrayOrMap-return"
],
"variables-specifying-dependencies": [
"index.html#variables-specifying-dependencies"
],
+6
View File
@@ -69,6 +69,10 @@
fi
'';
# See https://nixos.org/manual/nixpkgs/unstable/#tester-testEqualArrayOrMap
# or doc/build-helpers/testers.chapter.md
testEqualArrayOrMap = callPackage ./testEqualArrayOrMap { };
# See https://nixos.org/manual/nixpkgs/unstable/#tester-testVersion
# or doc/build-helpers/testers.chapter.md
testVersion =
@@ -190,4 +194,6 @@
testMetaPkgConfig = callPackage ./testMetaPkgConfig/tester.nix { };
shellcheck = callPackage ./shellcheck/tester.nix { };
shfmt = callPackage ./shfmt { };
}
@@ -0,0 +1,29 @@
{
lib,
shfmt,
stdenvNoCC,
}:
# See https://nixos.org/manual/nixpkgs/unstable/#tester-shfmt
# or doc/build-helpers/testers.chapter.md
{
name,
src,
indent ? 2,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
__structuredAttrs = true;
strictDeps = true;
inherit src indent;
name = "shfmt-${name}";
dontUnpack = true; # Unpack phase tries to extract archive
nativeBuildInputs = [ shfmt ];
doCheck = true;
dontConfigure = true;
dontBuild = true;
checkPhase = ''
shfmt --diff --indent $indent --simplify "$src"
'';
installPhase = ''
touch "$out"
'';
})
@@ -0,0 +1,3 @@
hello() {
echo "hello"
}
@@ -0,0 +1,43 @@
{ lib, testers }:
lib.recurseIntoAttrs {
# Positive tests
indent2 = testers.shfmt {
name = "indent2";
indent = 2;
src = ./src/indent2.sh;
};
indent2Bin = testers.shfmt {
name = "indent2Bin";
indent = 2;
src = ./src;
};
# Negative tests
indent2With0 = testers.testBuildFailure' {
drv = testers.shfmt {
name = "indent2";
indent = 0;
src = ./src/indent2.sh;
};
};
indent2BinWith0 = testers.testBuildFailure' {
drv = testers.shfmt {
name = "indent2Bin";
indent = 0;
src = ./src;
};
};
indent2With4 = testers.testBuildFailure' {
drv = testers.shfmt {
name = "indent2";
indent = 4;
src = ./src/indent2.sh;
};
};
indent2BinWith4 = testers.testBuildFailure' {
drv = testers.shfmt {
name = "indent2Bin";
indent = 4;
src = ./src;
};
};
}
@@ -39,6 +39,8 @@ lib.recurseIntoAttrs {
shellcheck = pkgs.callPackage ../shellcheck/tests.nix { };
shfmt = pkgs.callPackages ../shfmt/tests.nix { };
runCommand = lib.recurseIntoAttrs {
bork = pkgs.python3Packages.bork.tests.pytest-network;
@@ -356,4 +358,6 @@ lib.recurseIntoAttrs {
touch -- "$out"
'';
};
testEqualArrayOrMap = pkgs.callPackages ../testEqualArrayOrMap/tests.nix { };
}
@@ -0,0 +1,71 @@
# shellcheck shell=bash
# Tests if an array is declared.
isDeclaredArray() {
# shellcheck disable=SC2034
local -nr arrayRef="$1" && [[ ${!arrayRef@a} =~ a ]]
}
# Asserts that two arrays are equal, printing out differences if they are not.
# Does not short circuit on the first difference.
assertEqualArray() {
if (($# != 2)); then
nixErrorLog "expected two arguments!"
nixErrorLog "usage: assertEqualArray expectedArrayRef actualArrayRef"
exit 1
fi
local -nr expectedArrayRef="$1"
local -nr actualArrayRef="$2"
if ! isDeclaredArray "${!expectedArrayRef}"; then
nixErrorLog "first arugment expectedArrayRef must be an array reference to a declared array"
exit 1
fi
if ! isDeclaredArray "${!actualArrayRef}"; then
nixErrorLog "second arugment actualArrayRef must be an array reference to a declared array"
exit 1
fi
local -ir expectedLength=${#expectedArrayRef[@]}
local -ir actualLength=${#actualArrayRef[@]}
local -i hasDiff=0
if ((expectedLength != actualLength)); then
nixErrorLog "arrays differ in length: expectedArray has length $expectedLength but actualArray has length $actualLength"
hasDiff=1
fi
local -i idx=0
local expectedValue
local actualValue
# We iterate so long as at least one array has indices we've not considered.
# This means that `idx` is a valid index to *at least one* of the arrays.
for ((idx = 0; idx < expectedLength || idx < actualLength; idx++)); do
# Update values for variables which are still in range/valid.
if ((idx < expectedLength)); then
expectedValue="${expectedArrayRef[idx]}"
fi
if ((idx < actualLength)); then
actualValue="${actualArrayRef[idx]}"
fi
# Handle comparisons.
if ((idx >= expectedLength)); then
nixErrorLog "arrays differ at index $idx: expectedArray has no such index but actualArray has value ${actualValue@Q}"
hasDiff=1
elif ((idx >= actualLength)); then
nixErrorLog "arrays differ at index $idx: expectedArray has value ${expectedValue@Q} but actualArray has no such index"
hasDiff=1
elif [[ $expectedValue != "$actualValue" ]]; then
nixErrorLog "arrays differ at index $idx: expectedArray has value ${expectedValue@Q} but actualArray has value ${actualValue@Q}"
hasDiff=1
fi
done
((hasDiff)) && exit 1 || return 0
}
@@ -0,0 +1,102 @@
# shellcheck shell=bash
# Tests if a map is declared.
isDeclaredMap() {
# shellcheck disable=SC2034
local -nr mapRef="$1" && [[ ${!mapRef@a} =~ A ]]
}
# Asserts that two maps are equal, printing out differences if they are not.
# Does not short circuit on the first difference.
assertEqualMap() {
if (($# != 2)); then
nixErrorLog "expected two arguments!"
nixErrorLog "usage: assertEqualMap expectedMapRef actualMapRef"
exit 1
fi
local -nr expectedMapRef="$1"
local -nr actualMapRef="$2"
if ! isDeclaredMap "${!expectedMapRef}"; then
nixErrorLog "first arugment expectedMapRef must be an associative array reference to a declared associative array"
exit 1
fi
if ! isDeclaredMap "${!actualMapRef}"; then
nixErrorLog "second arugment actualMapRef must be an associative array reference to a declared associative array"
exit 1
fi
# NOTE:
# From the `sort` manpage: "The locale specified by the environment affects sort order. Set LC_ALL=C to get the
# traditional sort order that uses native byte values."
# We specify the environment variable in a subshell to avoid polluting the caller's environment.
local -a sortedExpectedKeys
mapfile -d '' -t sortedExpectedKeys < <(printf '%s\0' "${!expectedMapRef[@]}" | LC_ALL=C sort --stable --zero-terminated)
local -a sortedActualKeys
mapfile -d '' -t sortedActualKeys < <(printf '%s\0' "${!actualMapRef[@]}" | LC_ALL=C sort --stable --zero-terminated)
local -ir expectedLength=${#expectedMapRef[@]}
local -ir actualLength=${#actualMapRef[@]}
local -i hasDiff=0
if ((expectedLength != actualLength)); then
nixErrorLog "maps differ in length: expectedMap has length $expectedLength but actualMap has length $actualLength"
hasDiff=1
fi
local -i expectedKeyIdx=0
local expectedKey
local expectedValue
local -i actualKeyIdx=0
local actualKey
local actualValue
# We iterate so long as at least one map has keys we've not considered.
while ((expectedKeyIdx < expectedLength || actualKeyIdx < actualLength)); do
# Update values for variables which are still in range/valid.
if ((expectedKeyIdx < expectedLength)); then
expectedKey="${sortedExpectedKeys["$expectedKeyIdx"]}"
expectedValue="${expectedMapRef["$expectedKey"]}"
fi
if ((actualKeyIdx < actualLength)); then
actualKey="${sortedActualKeys["$actualKeyIdx"]}"
actualValue="${actualMapRef["$actualKey"]}"
fi
# In the case actualKeyIdx is valid and expectedKey comes after actualKey or expectedKeyIdx is invalid, actualMap
# has an extra key relative to expectedMap.
# NOTE: In Bash, && and || have the same precedence, so use the fact they're left-associative to enforce groups.
if ((actualKeyIdx < actualLength)) && [[ $expectedKey > $actualKey ]] || ((expectedKeyIdx >= expectedLength)); then
nixErrorLog "maps differ at key ${actualKey@Q}: expectedMap has no such key but actualMap has value ${actualValue@Q}"
hasDiff=1
actualKeyIdx+=1
# In the case actualKeyIdx is invalid or expectedKey comes before actualKey, expectedMap has an extra key relative
# to actualMap.
# NOTE: By virtue of the previous condition being false, we know the negation is true. Namely, expectedKeyIdx is
# valid AND (actualKeyIdx is invalid OR expectedKey <= actualKey).
elif ((actualKeyIdx >= actualLength)) || [[ $expectedKey < $actualKey ]]; then
nixErrorLog "maps differ at key ${expectedKey@Q}: expectedMap has value ${expectedValue@Q} but actualMap has no such key"
hasDiff=1
expectedKeyIdx+=1
# In the case where both key indices are valid and the keys are equal.
else
if [[ $expectedValue != "$actualValue" ]]; then
nixErrorLog "maps differ at key ${expectedKey@Q}: expectedMap has value ${expectedValue@Q} but actualMap has value ${actualValue@Q}"
hasDiff=1
fi
expectedKeyIdx+=1
actualKeyIdx+=1
fi
done
((hasDiff)) && exit 1 || return 0
}
@@ -0,0 +1,61 @@
# shellcheck shell=bash
set -eu
# NOTE: If neither expectedArray nor expectedMap are declared, the test is meaningless.
# This precondition is checked in the Nix expression through an assert.
preScript() {
if isDeclaredArray valuesArray; then
# shellcheck disable=SC2154
nixLog "using valuesArray: $(declare -p valuesArray)"
fi
if isDeclaredMap valuesMap; then
# shellcheck disable=SC2154
nixLog "using valuesMap: $(declare -p valuesMap)"
fi
if isDeclaredArray expectedArray; then
# shellcheck disable=SC2154
nixLog "using expectedArray: $(declare -p expectedArray)"
declare -ag actualArray=()
fi
if isDeclaredMap expectedMap; then
# shellcheck disable=SC2154
nixLog "using expectedMap: $(declare -p expectedMap)"
declare -Ag actualMap=()
fi
return 0
}
scriptPhase() {
runHook preScript
runHook script
runHook postScript
}
postScript() {
if isDeclaredArray expectedArray; then
nixLog "using actualArray: $(declare -p actualArray)"
nixLog "comparing actualArray against expectedArray"
assertEqualArray expectedArray actualArray
nixLog "actualArray matches expectedArray"
fi
if isDeclaredMap expectedMap; then
nixLog "using actualMap: $(declare -p actualMap)"
nixLog "comparing actualMap against expectedMap"
assertEqualMap expectedMap actualMap
nixLog "actualMap matches expectedMap"
fi
return 0
}
runHook scriptPhase
touch "${out:?}"
@@ -0,0 +1,35 @@
{
lib,
stdenvNoCC,
}:
lib.makeOverridable (
{
name,
valuesArray ? null,
valuesMap ? null,
expectedArray ? null,
expectedMap ? null,
script,
}:
assert lib.assertMsg (
expectedArray != null || expectedMap != null
) "testEqualArrayOrMap: at least one of 'expectedArray' or 'expectedMap' must be provided";
stdenvNoCC.mkDerivation {
__structuredAttrs = true;
strictDeps = true;
inherit name;
nativeBuildInputs = [
./assert-equal-array.sh
./assert-equal-map.sh
];
inherit valuesArray valuesMap;
inherit expectedArray expectedMap;
inherit script;
buildCommandPath = ./build-command.sh;
}
)
@@ -0,0 +1,202 @@
# NOTE: We must use `pkgs.runCommand` instead of `testers.runCommand` for negative tests -- those wrapped with
# `testers.testBuildFailure`. This is due to the fact that `testers.testBuildFailure` modifies the derivation such that
# it produces an output containing the exit code, logs, and other things. Since `testers.runCommand` expects the empty
# derivation, it produces a hash mismatch.
{ lib, testers }:
let
inherit (lib.attrsets) recurseIntoAttrs;
inherit (testers) testBuildFailure' testEqualArrayOrMap;
concatValuesArrayToActualArray = ''
nixLog "appending all values in valuesArray to actualArray"
for value in "''${valuesArray[@]}"; do
actualArray+=( "$value" )
done
'';
concatValuesMapToActualMap = ''
nixLog "adding all values in valuesMap to actualMap"
for key in "''${!valuesMap[@]}"; do
actualMap["$key"]="''${valuesMap["$key"]}"
done
'';
in
recurseIntoAttrs {
# NOTE: This particular test is used in the docs:
# See https://nixos.org/manual/nixpkgs/unstable/#tester-testEqualArrayOrMap
# or doc/build-helpers/testers.chapter.md
docs-test-function-add-cowbell = testEqualArrayOrMap {
name = "test-function-add-cowbell";
valuesArray = [
"cowbell"
"cowbell"
];
expectedArray = [
"cowbell"
"cowbell"
"cowbell"
];
script = ''
addCowbell() {
local -rn arrayNameRef="$1"
arrayNameRef+=( "cowbell" )
}
nixLog "appending all values in valuesArray to actualArray"
for value in "''${valuesArray[@]}"; do
actualArray+=( "$value" )
done
nixLog "applying addCowbell"
addCowbell actualArray
'';
};
array-append = testEqualArrayOrMap {
name = "testEqualArrayOrMap-array-append";
valuesArray = [
"apple"
"bee"
"cat"
];
expectedArray = [
"apple"
"bee"
"cat"
"dog"
];
script = ''
${concatValuesArrayToActualArray}
actualArray+=( "dog" )
'';
};
array-prepend = testEqualArrayOrMap {
name = "testEqualArrayOrMap-array-prepend";
valuesArray = [
"apple"
"bee"
"cat"
];
expectedArray = [
"dog"
"apple"
"bee"
"cat"
];
script = ''
actualArray+=( "dog" )
${concatValuesArrayToActualArray}
'';
};
array-empty = testEqualArrayOrMap {
name = "testEqualArrayOrMap-array-empty";
valuesArray = [
"apple"
"bee"
"cat"
];
expectedArray = [ ];
script = ''
# doing nothing
'';
};
array-missing-value = testBuildFailure' {
drv = testEqualArrayOrMap {
name = "testEqualArrayOrMap-array-missing-value";
valuesArray = [ "apple" ];
expectedArray = [ ];
script = concatValuesArrayToActualArray;
};
expectedBuilderLogEntries = [
"ERROR: assertEqualArray: arrays differ in length: expectedArray has length 0 but actualArray has length 1"
"ERROR: assertEqualArray: arrays differ at index 0: expectedArray has no such index but actualArray has value 'apple'"
];
};
map-insert = testEqualArrayOrMap {
name = "testEqualArrayOrMap-map-insert";
valuesMap = {
apple = "0";
bee = "1";
cat = "2";
};
expectedMap = {
apple = "0";
bee = "1";
cat = "2";
dog = "3";
};
script = ''
${concatValuesMapToActualMap}
actualMap["dog"]="3"
'';
};
map-remove = testEqualArrayOrMap {
name = "testEqualArrayOrMap-map-remove";
valuesMap = {
apple = "0";
bee = "1";
cat = "2";
dog = "3";
};
expectedMap = {
apple = "0";
cat = "2";
dog = "3";
};
script = ''
${concatValuesMapToActualMap}
unset 'actualMap[bee]'
'';
};
map-missing-key = testBuildFailure' {
drv = testEqualArrayOrMap {
name = "testEqualArrayOrMap-map-missing-key";
valuesMap = {
bee = "1";
cat = "2";
dog = "3";
};
expectedMap = {
apple = "0";
bee = "1";
cat = "2";
dog = "3";
};
script = concatValuesMapToActualMap;
};
expectedBuilderLogEntries = [
"ERROR: assertEqualMap: maps differ in length: expectedMap has length 4 but actualMap has length 3"
"ERROR: assertEqualMap: maps differ at key 'apple': expectedMap has value '0' but actualMap has no such key"
];
};
map-missing-key-with-empty = testBuildFailure' {
drv = testEqualArrayOrMap {
name = "testEqualArrayOrMap-map-missing-key-with-empty";
valuesArray = [ ];
expectedMap.apple = 1;
script = "";
};
expectedBuilderLogEntries = [
"ERROR: assertEqualMap: maps differ in length: expectedMap has length 1 but actualMap has length 0"
"ERROR: assertEqualMap: maps differ at key 'apple': expectedMap has value '1' but actualMap has no such key"
];
};
map-extra-key = testBuildFailure' {
drv = testEqualArrayOrMap {
name = "testEqualArrayOrMap-map-extra-key";
valuesMap = {
apple = "0";
bee = "1";
cat = "2";
dog = "3";
};
expectedMap = {
apple = "0";
bee = "1";
dog = "3";
};
script = concatValuesMapToActualMap;
};
expectedBuilderLogEntries = [
"ERROR: assertEqualMap: maps differ in length: expectedMap has length 3 but actualMap has length 4"
"ERROR: assertEqualMap: maps differ at key 'cat': expectedMap has no such key but actualMap has value '2'"
];
};
}
+34 -9
View File
@@ -4,7 +4,8 @@
fetchurl,
pkg-config,
systemd,
util-linux,
unixtools,
libusb-compat-0_1,
coreutils,
wall,
hostname,
@@ -28,14 +29,29 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
pkg-config
man
util-linux
unixtools.col
];
buildInputs = lib.optional enableCgiScripts gd;
prePatch = ''
sed -e "s,\$(INSTALL_PROGRAM) \$(STRIP),\$(INSTALL_PROGRAM)," \
-i ./src/apcagent/Makefile ./autoconf/targets.mak
'';
buildInputs =
lib.optional enableCgiScripts gd
++ lib.optionals stdenv.hostPlatform.isDarwin [
libusb-compat-0_1
];
prePatch =
''
sed -e "s,\$(INSTALL_PROGRAM) \$(STRIP),\$(INSTALL_PROGRAM)," \
-i ./src/apcagent/Makefile ./autoconf/targets.mak
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/apcagent/Makefile \
--replace-fail "Applications" "$out/Applications"
substituteInPlace include/libusb.h.in \
--replace-fail "@LIBUSBH@" "${libusb-compat-0_1.dev}/include/usb.h"
substituteInPlace platforms/darwin/Makefile \
--replace-fail "/Library/LaunchDaemons" "$out/Library/LaunchDaemons" \
--replace-fail "/System/Library/Extensions" "$out/System/Library/Extensions"
'';
preConfigure = ''
sed -i 's|/bin/cat|${coreutils}/bin/cat|' configure
@@ -57,20 +73,29 @@ stdenv.mkDerivation rec {
"--with-lock-dir=/run/lock"
"--with-pid-dir=/run"
"--enable-usb"
"ac_cv_path_SHUTDOWN=${systemd}/sbin/shutdown"
"ac_cv_path_WALL=${wall}/bin/wall"
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"ac_cv_path_SHUTDOWN=${systemd}/sbin/shutdown"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"ac_cv_path_SHUTDOWN=/sbin/shutdown"
"ac_cv_func_which_gethostbyname_r=no"
]
++ lib.optionals enableCgiScripts [
"--enable-cgi"
"--with-cgi-bin=${placeholder "out"}/libexec/cgi-bin"
];
enableParallelBuilding = true;
postInstall = ''
for file in "$out"/etc/apcupsd/*; do
sed -i -e 's|^WALL=.*|WALL="${wall}/bin/wall"|g' \
-e 's|^HOSTNAME=.*|HOSTNAME=`${hostname}/bin/hostname`|g' \
"$file"
done
rm -f "$out/bin/apcupsd-uninstall"
'';
passthru.tests.smoke = nixosTests.apcupsd;
@@ -79,7 +104,7 @@ stdenv.mkDerivation rec {
description = "Daemon for controlling APC UPSes";
homepage = "http://www.apcupsd.com/";
license = licenses.gpl2Only;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = [ maintainers.bjornfor ];
};
}
@@ -8,11 +8,11 @@
let
pname = "fiddler-everywhere";
version = "6.1.0";
version = "6.2.0";
src = fetchurl {
url = "https://downloads.getfiddler.com/linux/fiddler-everywhere-${version}.AppImage";
hash = "sha256-fxGwOt/+3T7LDK69H/Nm1dyGiT588YhSR4D5xO36xKk=";
hash = "sha256-bUFogQkMOr0n95wYd/M9eq9Y6xxVFJTaznBnmFMvjC4=";
};
appimageContents = appimageTools.extract {
+2 -2
View File
@@ -24,11 +24,11 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "filebot";
version = "5.1.6";
version = "5.1.7";
src = fetchurl {
url = "https://web.archive.org/web/20230917142929/https://get.filebot.net/filebot/FileBot_${finalAttrs.version}/FileBot_${finalAttrs.version}-portable.tar.xz";
hash = "sha256-9XRYhedCDWtNPjAKzK4lOprHwbJjOgF6HN2MZnlZ9IE=";
hash = "sha256-GpjWo2+AsT0hD3CJJ8Pf/K5TbWtG0ZE2tIpH/UEGTws=";
};
unpackPhase = "tar xvf $src";
+3 -3
View File
@@ -8,11 +8,11 @@
stdenv.mkDerivation (finalAttrs: {
pname = "mill";
version = "0.12.5";
version = "0.12.8";
src = fetchurl {
url = "https://github.com/com-lihaoyi/mill/releases/download/${finalAttrs.version}/${finalAttrs.version}-assembly";
hash = "sha256-DHslQS/uzwbZVdATQY3pqQgM51W+26x2AckQnDPVoFc=";
url = "https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/${finalAttrs.version}/mill-dist-${finalAttrs.version}-assembly.jar";
hash = "sha256-l+DaOvk7Tajla9IirLfEIij6thZcKI4Zk7wYLnnsiU8=";
};
nativeBuildInputs = [ makeWrapper ];
+3 -3
View File
@@ -7,13 +7,13 @@
buildGoModule {
pname = "mjmap";
version = "0.1.0-unstable-2023-11-13";
version = "0.1.0-unstable-2025-03-06";
src = fetchFromSourcehut {
owner = "~rockorager";
repo = "mjmap";
rev = "d54badae8152b4db6eec8b03a7bd7c5ff1724aa7";
hash = "sha256-yFYYnklNNOHTfoT54kOIVoM4t282/0Ir4l72GmqlGSY=";
rev = "fdc1658f1a3d57594479535692ed06c6e19cc859";
hash = "sha256-178S4Y4h31z0OCedS44udxyv8TfgZoDykApg3pX15oQ=";
};
vendorHash = "sha256-fJuPrzjRH0FpYj2D9CsFdsdzYT0C3/D2PhmJIZTsgfQ=";
+2 -2
View File
@@ -6,14 +6,14 @@
python3.pkgs.buildPythonApplication rec {
pname = "prowler";
version = "5.3.0";
version = "5.4.0";
pyproject = true;
src = fetchFromGitHub {
owner = "prowler-cloud";
repo = "prowler";
tag = version;
hash = "sha256-OLq8lmqoydumUhInvDck2ImD/awDqWBlMcFP4RxMBiI=";
hash = "sha256-D+GifYxAqB5/Y7+x5CRdG2tF99MBWQF5meD1TIUI0ZE=";
};
pythonRelaxDeps = true;
+6 -2
View File
@@ -6,19 +6,21 @@
python3.pkgs.buildPythonApplication rec {
pname = "tunnelgraf";
version = "0.7.2";
version = "1.0.6";
pyproject = true;
src = fetchFromGitHub {
owner = "denniswalker";
repo = "tunnelgraf";
tag = "v${version}";
hash = "sha256-pwHP9eAf2S08ucUawxrQvzMBJNITxbddoLzEoSNUdao=";
hash = "sha256-6t/rUdz0RyxWxZM0QO1ynRTNQq4GZMIAxMYBB2lfA54=";
};
pythonRelaxDeps = [
"click"
"deepmerge"
"paramiko"
"psutil"
"pydantic"
];
@@ -28,10 +30,12 @@ python3.pkgs.buildPythonApplication rec {
click
deepmerge
paramiko
psutil
pydantic
python-hosts
pyyaml
sshtunnel
wcwidth
];
# Project has no tests
@@ -26,7 +26,7 @@
buildPythonPackage rec {
pname = "aioesphomeapi";
version = "29.3.1";
version = "29.4.0";
pyproject = true;
disabled = pythonOlder "3.9";
@@ -35,7 +35,7 @@ buildPythonPackage rec {
owner = "esphome";
repo = "aioesphomeapi";
tag = "v${version}";
hash = "sha256-Gv3uM3ZKxcU5BA8HfzHJqTEODM8sfcKbLGfk96yb8u4=";
hash = "sha256-KBQYLaE2J/5/VYquajknF3gCJEwRENjgkxiZahqnRZA=";
};
build-system = [
@@ -4,30 +4,35 @@
fetchFromGitHub,
pytestCheckHook,
requests,
flit-core,
}:
buildPythonPackage rec {
pname = "asgineer";
version = "0.8.3";
format = "setuptools";
version = "0.9.3";
pyproject = true;
# PyPI tarball doesn't include tests directory
src = fetchFromGitHub {
owner = "almarklein";
repo = pname;
repo = "asgineer";
tag = "v${version}";
sha256 = "sha256-9F/66Yi394C1tZWK/BiaCltvRZGVNq+cREDHUoyVLr4=";
hash = "sha256-Uk1kstEBt321BVeNcfdhZuonmm1i9IXSBnZLa4eDS2E=";
};
build-system = [ flit-core ];
nativeCheckInputs = [
pytestCheckHook
requests
];
pythonImportsCheck = [ "asgineer" ];
meta = with lib; {
description = "Really thin ASGI web framework";
license = licenses.bsd2;
homepage = "https://asgineer.readthedocs.io";
maintainers = [ maintainers.matthiasbeyer ];
changelog = "https://github.com/almarklein/asgineer/releases/tag/v${src.tag}";
license = licenses.bsd2;
maintainers = with maintainers; [ matthiasbeyer ];
};
}
@@ -5,43 +5,38 @@
beautifulsoup4,
buildPythonPackage,
fetchFromGitLab,
pathlib2,
pyfakefs,
python-dateutil,
pythonOlder,
setuptools,
six,
setuptools-scm,
unittestCheckHook,
urllib3,
}:
buildPythonPackage rec {
pname = "cryptodatahub";
version = "0.12.5";
version = "1.0.0";
pyproject = true;
disabled = pythonOlder "3.7";
disabled = pythonOlder "3.9";
src = fetchFromGitLab {
owner = "coroner";
repo = "cryptodatahub";
rev = "refs/tags/v${version}";
hash = "sha256-jYMzvh4tgfLS7Za0MYHbWbczptAvENfzfTEV9Drlfto=";
hash = "sha256-taYpSYkfucc9GQpVDiAZgCt/D3Akld20LkFEhsdKH0Q=";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace-fail "attrs>=20.3.0,<22.0.1" "attrs>=20.3.0"
'';
build-system = [ setuptools ];
build-system = [
setuptools
setuptools-scm
];
dependencies = [
asn1crypto
attrs
pathlib2
python-dateutil
six
urllib3
];
@@ -14,6 +14,7 @@
pythonOlder,
requests,
setuptools,
setuptools-scm,
urllib3,
}:
@@ -22,22 +23,21 @@ buildPythonPackage rec {
version = "1.0.0";
pyproject = true;
disabled = pythonOlder "3.7";
disabled = pythonOlder "3.9";
src = fetchPypi {
inherit pname version;
hash = "sha256-rRiRaXONLMNirKsK+QZWMSvaGeSLrHN9BpM8dhxoaxY=";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace-warn "attrs>=20.3.0,<22.0.1" "attrs>=20.3.0" \
--replace-warn "bs4" "beautifulsoup4"
'';
pythonRemoveDeps = [ "bs4" ];
nativeBuildInputs = [ setuptools ];
build-system = [
setuptools
setuptools-scm
];
propagatedBuildInputs = [
dependencies = [
attrs
beautifulsoup4
certvalidator
@@ -8,6 +8,7 @@
python-dateutil,
pythonOlder,
setuptools,
setuptools-scm,
urllib3,
}:
@@ -16,19 +17,17 @@ buildPythonPackage rec {
version = "1.0.0";
pyproject = true;
disabled = pythonOlder "3.7";
disabled = pythonOlder "3.9";
src = fetchPypi {
inherit pname version;
hash = "sha256-bEvhMVcm9sXlfhxUD2K4N10nusgxpGYFJQLtJE1/qok=";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace-fail "attrs>=20.3.0,<22.0.1" "attrs>=20.3.0"
'';
build-system = [ setuptools ];
build-system = [
setuptools
setuptools-scm
];
dependencies = [
asn1crypto
@@ -13,15 +13,14 @@
buildPythonPackage rec {
pname = "formencode";
version = "2.1.0";
version = "2.1.1";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
pname = "FormEncode";
inherit version;
hash = "sha256-63TSIweKKM8BX6iJZsbjTy0Y11EnMY1lwUS+2a/EJj8=";
inherit pname version;
hash = "sha256-4X8WGZ0jLlT2eRIATzrTM827uBoaGhAjis8JurmfkZk=";
};
postPatch = ''
@@ -1,34 +1,36 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
requests,
fetchPypi,
hatchling,
httpx,
}:
buildPythonPackage rec {
pname = "googletrans";
version = "4.0.0";
format = "setuptools";
version = "4.0.2";
pyproject = true;
src = fetchFromGitHub {
owner = "ssut";
repo = "py-googletrans";
tag = "v${version}";
sha256 = "sha256-R6LJLHHitJL8maXBCZyx2W47uJh0ZctVDA9oRIEhG5U=";
src = fetchPypi {
inherit pname version;
hash = "sha256-2e8Sa12S+r7sC7ndzb7s1Dhl/ADhfx36B3F4N4J6F94=";
};
propagatedBuildInputs = [ requests ];
build-system = [ hatchling ];
# majority of tests just try to ping Google's Translate API endpoint
dependencies = [ httpx ] ++ httpx.optional-dependencies.http2;
# Majority of tests just try to ping Google's Translate API endpoint
doCheck = false;
pythonImportsCheck = [ "googletrans" ];
meta = with lib; {
description = "Googletrans is python library to interact with Google Translate API";
mainProgram = "translate";
description = "Library to interact with Google Translate API";
homepage = "https://py-googletrans.readthedocs.io";
changelog = "https://github.com/ssut/py-googletrans/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ unode ];
mainProgram = "translate";
};
}
@@ -17,7 +17,7 @@
buildPythonPackage rec {
pname = "johnnycanencrypt";
version = "0.15.0";
version = "0.16.0";
pyproject = true;
disabled = pythonOlder "3.8";
@@ -26,13 +26,13 @@ buildPythonPackage rec {
owner = "kushaldas";
repo = "johnnycanencrypt";
tag = "v${version}";
hash = "sha256-tbHW3x+vwFz0nqFGWvgxjhw8XH6/YKz1uagU339SZyk=";
hash = "sha256-9T8B6zG3zMOBMX9C+u34MGBAgQ8YR44CW2BTdO1CciI=";
};
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
name = "${pname}-${version}";
hash = "sha256-2kgp3RD2QbxL/Xk4iljjJZ8yEfo2umFtcN5CEtheyw8=";
hash = "sha256-V1z16GKaSQVjp+stWir7kAO2wsnOYPdhKi4KzIKmKx8=";
};
build-system = with rustPlatform; [
@@ -71,6 +71,11 @@ buildPythonPackage rec {
"test_extended_syntaxes"
];
disabledTestPaths = [
# Assertion errors
"tests/test_sphinx/"
];
meta = with lib; {
description = "Extended commonmark compliant parser, with bridges to docutils/sphinx";
homepage = "https://github.com/executablebooks/MyST-Parser";
@@ -34,9 +34,7 @@ buildPythonPackage rec {
optional-dependencies = {
aiohttp = [ aiohttp ];
nkeys = [ nkeys ];
# fast_parse = [
# fast-mail-parser
# ];
# fast_parse = [ fast-mail-parser ];
};
nativeCheckInputs = [
@@ -47,6 +45,8 @@ buildPythonPackage rec {
disabledTests =
[
# Timeouts
"ClientTLS"
# AssertionError
"test_fetch_n"
"test_kv_simple"
@@ -17,7 +17,7 @@
buildPythonPackage rec {
pname = "pyoverkiz";
version = "1.16.1";
version = "1.16.2";
pyproject = true;
disabled = pythonOlder "3.10";
@@ -26,7 +26,7 @@ buildPythonPackage rec {
owner = "iMicknl";
repo = "python-overkiz-api";
tag = "v${version}";
hash = "sha256-Y5iXNRjsw85QUByFtqCA3XNbmuGIogEVqJp6Xa5iW10=";
hash = "sha256-yNRo1rF/00McpDhjjLmjirOKx3kMZk+kTDYGSdx/Mvo=";
};
build-system = [ poetry-core ];
@@ -50,7 +50,7 @@ buildPythonPackage rec {
meta = with lib; {
description = "Module to interact with the Somfy TaHoma API or other OverKiz APIs";
homepage = "https://github.com/iMicknl/python-overkiz-api";
changelog = "https://github.com/iMicknl/python-overkiz-api/releases/tag/v${version}";
changelog = "https://github.com/iMicknl/python-overkiz-api/releases/tag/${src.tag}";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
@@ -25,7 +25,7 @@ buildPythonPackage rec {
dependencies = [ aiohttp ];
pythonImportsCheck = [ "pytedee_async" ];
pythonImportsCheck = [ "aiotedee" ];
# Module has no tests
doCheck = false;
@@ -1,12 +1,14 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
pytestCheckHook,
setuptools,
cachecontrol,
fetchFromGitHub,
legacy-cgi,
lxml-html-clean,
pytestCheckHook,
pythonAtLeast,
requests,
setuptools,
six,
}:
@@ -22,10 +24,6 @@ buildPythonPackage rec {
hash = "sha256-XTPk3doF9dqImsLtTB03YKMWLzQrJpJtjNXe+691rZo=";
};
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "pywebcopy" ];
build-system = [ setuptools ];
dependencies = [
@@ -33,7 +31,11 @@ buildPythonPackage rec {
lxml-html-clean
requests
six
];
] ++ lib.optionals (pythonAtLeast "3.13") [ legacy-cgi ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "pywebcopy" ];
meta = {
changelog = "https://github.com/rajatomar788/pywebcopy/blob/master/docs/changelog.md";
@@ -16,7 +16,7 @@
buildPythonPackage rec {
pname = "sense-energy";
version = "0.13.6";
version = "0.13.7";
pyproject = true;
disabled = pythonOlder "3.9";
@@ -25,7 +25,7 @@ buildPythonPackage rec {
owner = "scottbonline";
repo = "sense";
tag = version;
hash = "sha256-DV0f0HYUo9qNxKmBb3ARuWnqb3Wv2zdN/UeaXlkc82w=";
hash = "sha256-RCJKx0FvB3hKQC1pwv1LWqwbM23SoY/2qUxBnrXd14k=";
};
postPatch = ''
@@ -52,7 +52,7 @@ buildPythonPackage rec {
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"pytest-runner==5.2",' ""
--replace-fail '"pytest-runner==6.0.1",' ""
'';
build-system = [ setuptools ];
@@ -107,6 +107,8 @@ buildPythonPackage rec {
disabledTests = [
# Require network access
"test_failure"
# TypeError
"test_oauth"
];
meta = {
@@ -13,7 +13,7 @@
buildPythonPackage rec {
pname = "sqlobject";
version = "3.12.0";
version = "3.13.0";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -22,7 +22,7 @@ buildPythonPackage rec {
owner = "sqlobject";
repo = "sqlobject";
tag = version;
hash = "sha256-fxENuVTmp/EcDAdVqQWdtqtEW1mI+dfaImgWzGAaWfQ=";
hash = "sha256-KcpbGqNsR77kwbTLKwvwWpyLvF1UowIsKM7Kirs7Zw4=";
};
build-system = [ setuptools ];
File diff suppressed because it is too large Load Diff
@@ -364,13 +364,13 @@
buildPythonPackage rec {
pname = "types-aiobotocore";
version = "2.20.0";
version = "2.21.1";
pyproject = true;
src = fetchPypi {
pname = "types_aiobotocore";
inherit version;
hash = "sha256-+i/wA7aK6WW+AdfhMI8T+4+YwaPWP3Uh4G/gkXpgo5c=";
hash = "sha256-rQmXEGNaFqBt+Z2a65V+DEiDWCAd//X3b3P17CmH/Ds=";
};
build-system = [ setuptools ];
@@ -3,6 +3,7 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
# build-system
setuptools,
@@ -27,14 +28,14 @@
buildPythonPackage rec {
pname = "universal-silabs-flasher";
version = "0.0.29";
version = "0.0.30";
pyproject = true;
src = fetchFromGitHub {
owner = "NabuCasa";
repo = "universal-silabs-flasher";
tag = "v${version}";
hash = "sha256-dXLk1lwSGPRNTwhi9MY6AcqlBtZwFt/EMS0juI4IpjQ=";
hash = "sha256-AAF3MswdhGgSVS6efUp+QylWykbNqHz2ThfBdD8E/ew=";
};
postPatch = ''
@@ -45,21 +46,18 @@ buildPythonPackage rec {
build-system = [ setuptools ];
pythonRelaxDeps = [
# https://github.com/NabuCasa/universal-silabs-flasher/pull/50
"gpiod"
];
propagatedBuildInputs = [
async-timeout
bellows
click
coloredlogs
crc
pyserial-asyncio-fast
typing-extensions
zigpy
] ++ lib.optionals (stdenv.hostPlatform.isLinux) [ libgpiod ];
dependencies =
[
bellows
click
coloredlogs
crc
pyserial-asyncio-fast
typing-extensions
zigpy
]
++ lib.optionals (pythonOlder "3.11") [ async-timeout ]
++ lib.optionals (stdenv.hostPlatform.isLinux) [ libgpiod ];
nativeCheckInputs = [
pytestCheckHook
@@ -6,19 +6,18 @@
pythonOlder,
requests,
setuptools,
simplejson,
}:
buildPythonPackage rec {
pname = "wallbox";
version = "0.7.0";
version = "0.8.0";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-8taZpC1N5ZsVurh10WosZvg7WDmord+PDfhHpRlfqBE=";
hash = "sha256-S1JP7/D3U853fQU3a2pyL+dt/hVLDP3TB82tcGlcXVQ=";
};
build-system = [
@@ -28,7 +27,6 @@ buildPythonPackage rec {
dependencies = [
aenum
requests
simplejson
];
# no tests implemented
@@ -37,7 +35,7 @@ buildPythonPackage rec {
pythonImportsCheck = [ "wallbox" ];
meta = with lib; {
description = "Module for interacting with Wallbox EV charger api";
description = "Module for interacting with Wallbox EV charger API";
homepage = "https://github.com/cliviu74/wallbox";
changelog = "https://github.com/cliviu74/wallbox/releases/tag/${version}";
license = licenses.mit;
@@ -13,14 +13,14 @@
buildPythonPackage rec {
pname = "weheat";
version = "2025.2.27";
version = "2025.3.7";
pyproject = true;
src = fetchFromGitHub {
owner = "wefabricate";
repo = "wh-python";
tag = version;
hash = "sha256-DrBOx++Rp/5s8sU07+/cuy2Je27i84WCY3/mljLfawk=";
hash = "sha256-PGGlgzcx/pUyTcsFj73x5LqfcPRCh2VMXNsIJjcpEZE=";
};
pythonRelaxDeps = [
@@ -2,7 +2,9 @@
lib,
buildPythonPackage,
fetchPypi,
pytest,
hatch-vcs,
hatchling,
pytestCheckHook,
pyyaml,
hypothesis,
pythonOlder,
@@ -11,7 +13,7 @@
buildPythonPackage rec {
pname = "yamlloader";
version = "1.5.1";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -20,11 +22,16 @@ buildPythonPackage rec {
hash = "sha256-jezhmwUKyxxqjKFKoweTOI+b4VT3NLgmVB+aGCjUHOw=";
};
propagatedBuildInputs = [ pyyaml ];
build-system = [
hatch-vcs
hatchling
];
dependencies = [ pyyaml ];
nativeCheckInputs = [
hypothesis
pytest
pytestCheckHook
];
pythonImportsCheck = [
@@ -7,7 +7,7 @@
stdenv.mkDerivation rec {
name = "facetimehd-${version}-${kernel.version}";
version = "0.6.8.2";
version = "0.6.13";
# Note: When updating this revision:
# 1. Also update pkgs/os-specific/linux/firmware/facetimehd-firmware/
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
owner = "patjak";
repo = "facetimehd";
rev = version;
sha256 = "sha256-dw4wEdYTtYyZI52CpoygI7KM6vsShDIYnKgIAAL/adY=";
sha256 = "sha256-3BDIQNMdNeZyuEgnAkJ0uy7b5lOOx1CfS3eamyZyZm8=";
};
preConfigure = ''