From 05a7f0086347f85bfd052d1f3e6128a2afc12103 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sat, 28 Aug 2021 00:03:49 +0000 Subject: [PATCH 01/24] sigrok-cli: 0.7.1 -> 0.7.2 --- pkgs/development/tools/sigrok-cli/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/sigrok-cli/default.nix b/pkgs/development/tools/sigrok-cli/default.nix index 7935d10effcb..b1ba0402a3e7 100644 --- a/pkgs/development/tools/sigrok-cli/default.nix +++ b/pkgs/development/tools/sigrok-cli/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "sigrok-cli"; - version = "0.7.1"; + version = "0.7.2"; src = fetchurl { url = "https://sigrok.org/download/source/${pname}/${pname}-${version}.tar.gz"; - sha256 = "15vpn1psriadcbl6v9swwgws7dva85ld03yv6g1mgm27kx11697m"; + sha256 = "sha256-cdBEPzaJe/Vlcy3sIGgw2+oPJ4m2YBzxBTayhtEUCrg="; }; nativeBuildInputs = [ pkg-config ]; From 1574f8ceca5b9d633ef2099947ce9c3c47e4acf4 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 24 Sep 2021 12:09:31 +0200 Subject: [PATCH 02/24] teleport: 7.1.2 -> 7.1.3 --- pkgs/servers/teleport/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/teleport/default.nix b/pkgs/servers/teleport/default.nix index 42296b03260c..5acbc8e80692 100644 --- a/pkgs/servers/teleport/default.nix +++ b/pkgs/servers/teleport/default.nix @@ -10,14 +10,14 @@ let in buildGoModule rec { pname = "teleport"; - version = "7.1.2"; + version = "7.1.3"; # This repo has a private submodule "e" which fetchgit cannot handle without failing. src = fetchFromGitHub { owner = "gravitational"; repo = "teleport"; rev = "v${version}"; - sha256 = "sha256-1/Dmh7jTlGg3CqNZDFNIT8/OvgzkHG2m6Qs0ya4IM18="; + sha256 = "sha256-upzEfImMuYU/6F5HSR3Jah3QiMXEt0XMpNAPzEYV1Nk="; }; vendorSha256 = null; From 9bc37bff1afd0bc3fc5b851ee4512ea4478fc583 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 24 Sep 2021 21:17:37 +1000 Subject: [PATCH 03/24] rPackages: mark packages as broken when generating package sets The current behaviour for generate-r-packages.R is to delete packages that have been remove upstream. This patch changes the behaviour to mark packages as broken rather than removing them. This has the advantage of never breaking expressions, which previously occured when a package with overrides in default.nix was deleted. As a result, the update procedure is simplified, allowing automated updates to the package tree to run, and additionally if a package is re-established upstream the previous overrides still exist. --- doc/languages-frameworks/r.section.md | 8 -------- pkgs/development/r-modules/generate-r-packages.R | 12 ++++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/languages-frameworks/r.section.md b/doc/languages-frameworks/r.section.md index 56e3da64df2a..6b64e264b669 100644 --- a/doc/languages-frameworks/r.section.md +++ b/doc/languages-frameworks/r.section.md @@ -113,11 +113,3 @@ mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix ``` `generate-r-packages.R ` reads `-packages.nix`, therefor the renaming. - -## Testing if the Nix-expression could be evaluated {#testing-if-the-nix-expression-could-be-evaluated} - -```bash -nix-build test-evaluation.nix --dry-run -``` - -If this exits fine, the expression is ok. If not, you have to edit `default.nix` diff --git a/pkgs/development/r-modules/generate-r-packages.R b/pkgs/development/r-modules/generate-r-packages.R index f656fdca0922..8c97c651e4c4 100755 --- a/pkgs/development/r-modules/generate-r-packages.R +++ b/pkgs/development/r-modules/generate-r-packages.R @@ -82,6 +82,17 @@ pkgs$sha256 <- parApply(cl, pkgs, 1, function(p) nixPrefetch(p[1], p[2])) nix <- apply(pkgs, 1, function(p) formatPackage(p[1], p[2], p[18], p[4], p[5], p[6])) write("done", stderr()) +# Mark deleted packages as broken +setkey(readFormatted, V2) +markBroken <- function(name) { + str <- paste0(readFormatted[name], collapse='"') + if(sum(grep("broken = true;", str))) + return(str) + write(paste("marked", name, "as broken"), stderr()) + gsub("};$", "broken = true; };", str) +} +broken <- lapply(setdiff(readFormatted[[2]], pkgs[[1]]), markBroken) + cat("# This file is generated from generate-r-packages.R. DO NOT EDIT.\n") cat("# Execute the following command to update the file.\n") cat("#\n") @@ -95,6 +106,7 @@ if (mirrorType == "cran") { cat("{ snapshot = \"", paste(snapshotDate), "\"; }", cat(";\n") cat("in with self; {\n") cat(paste(nix, collapse="\n"), "\n", sep="") +cat(paste(broken, collapse="\n"), "\n", sep="") cat("}\n") stopCluster(cl) From 5309818bf744a166a236ee2f829c154975cf6bcc Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Sun, 26 Sep 2021 07:29:58 +1000 Subject: [PATCH 04/24] doc: clarify location of rPackages overrides Detail the location of rPackage overrides and how broken builds should be addressed. --- doc/languages-frameworks/r.section.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/languages-frameworks/r.section.md b/doc/languages-frameworks/r.section.md index 6b64e264b669..ad0fb10987c9 100644 --- a/doc/languages-frameworks/r.section.md +++ b/doc/languages-frameworks/r.section.md @@ -96,6 +96,11 @@ re-enter the shell. ## Updating the package set {#updating-the-package-set} +There is a script and associated environment for regenerating the package +sets and synchronising the rPackages tree to the current CRAN and matching +BIOC release. These scripts are found in the `pkgs/development/r-modules` +directory and executed as follows: + ```bash nix-shell generate-shell.nix @@ -112,4 +117,11 @@ Rscript generate-r-packages.R bioc-experiment > bioc-experiment-packages.nix.new mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix ``` -`generate-r-packages.R ` reads `-packages.nix`, therefor the renaming. +`generate-r-packages.R ` reads `-packages.nix`, therefore +the renaming. + +Some packages require overrides to specify external dependencies or other +patches and special requirements. These overrides are specified in the +`pkgs/development/r-modules/default.nix` file. As the `*-packages.nix` +contents are automatically generated it should not be edited and broken +builds should be addressed using overrides. From 3ef60d4ee42c84be5baf71a2eb0f7deb4fe4a6b9 Mon Sep 17 00:00:00 2001 From: Vonfry Date: Mon, 27 Sep 2021 08:18:20 +0800 Subject: [PATCH 05/24] fcitx5: 5.0.8 -> 5.0.9 --- pkgs/tools/inputmethods/fcitx5/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/inputmethods/fcitx5/default.nix b/pkgs/tools/inputmethods/fcitx5/default.nix index ee801fdb24a1..85b652577437 100644 --- a/pkgs/tools/inputmethods/fcitx5/default.nix +++ b/pkgs/tools/inputmethods/fcitx5/default.nix @@ -41,13 +41,13 @@ let in stdenv.mkDerivation rec { pname = "fcitx5"; - version = "5.0.8"; + version = "5.0.9"; src = fetchFromGitHub { owner = "fcitx"; repo = pname; rev = version; - sha256 = "0czj2awvgk9apdh9rj3vcb04g8x2wp1d4sshvch31nwpqs10hssr"; + sha256 = "161xgm2fs51v8l46raz6xxkjmshpgaaax64lz8208m7fcd32ll3a"; }; prePatch = '' From 5d5170c5d7719fb9e85012cdda03e6dde8ec30ad Mon Sep 17 00:00:00 2001 From: Vonfry Date: Mon, 27 Sep 2021 08:18:33 +0800 Subject: [PATCH 06/24] fcitx5-rime: 5.0.6 -> 5.0.7 --- pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix b/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix index cd362e94ef57..86e5b6ca51af 100644 --- a/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix +++ b/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix @@ -11,13 +11,13 @@ stdenv.mkDerivation rec { pname = "fcitx5-rime"; - version = "5.0.6"; + version = "5.0.7"; src = fetchFromGitHub { owner = "fcitx"; repo = pname; rev = version; - sha256 = "1r36c1pl63vka9mxa8f5x0kijapjgxzz5b4db8h87ri9kcxk7i2g"; + sha256 = "1djakg17rxc38smja4y76i0p4gwdj3lgwym8kybkaspk7lxr62zy"; }; cmakeFlags = [ From cc49c13a6bad964951093705128ab6c40c202066 Mon Sep 17 00:00:00 2001 From: V Date: Mon, 5 Jul 2021 18:40:42 +0200 Subject: [PATCH 07/24] nixos/postfix: Fix virtual alias manpage section virtual(8) is for virtual mailboxes, not aliases. --- nixos/modules/services/mail/postfix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix index 2b8edb9c51f8..da18fae4ca7d 100644 --- a/nixos/modules/services/mail/postfix.nix +++ b/nixos/modules/services/mail/postfix.nix @@ -544,7 +544,7 @@ in type = types.lines; default = ""; description = " - Entries for the virtual alias map, cf. man-page virtual(8). + Entries for the virtual alias map, cf. man-page virtual(5). "; }; From d08244d50ea6696a9fdf297fa2d81a30072ca039 Mon Sep 17 00:00:00 2001 From: Mikael Voss Date: Wed, 22 Sep 2021 17:35:02 +0200 Subject: [PATCH 08/24] sydbox: init at 2.2.0 --- pkgs/os-specific/linux/sydbox/default.nix | 77 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 79 insertions(+) create mode 100644 pkgs/os-specific/linux/sydbox/default.nix diff --git a/pkgs/os-specific/linux/sydbox/default.nix b/pkgs/os-specific/linux/sydbox/default.nix new file mode 100644 index 000000000000..bdaf77147f2e --- /dev/null +++ b/pkgs/os-specific/linux/sydbox/default.nix @@ -0,0 +1,77 @@ +{ lib +, stdenv +, fetchurl +, pkg-config +, autoreconfHook +, python3 +, perl +, libxslt +, docbook_xsl +, docbook_xml_dtd_42 +, libseccomp +, installTests ? true, gnumake, which +, debugBuild ? false, libunwind +}: + +stdenv.mkDerivation rec { + pname = "sydbox-1"; + version = "2.2.0"; + + outputs = [ "out" "dev" "man" "doc" ] + ++ lib.optional installTests "installedTests"; + + src = fetchurl { + url = "https://git.exherbo.org/${pname}.git/snapshot/${pname}-${version}.tar.xz"; + sha256 = "0664myrrzbvsw73q5b7cqwgv4hl9a7vkm642s1r96gaxm16jk0z7"; + }; + + nativeBuildInputs = [ + pkg-config + autoreconfHook + python3 + perl + libxslt.bin + docbook_xsl + docbook_xml_dtd_42 + ]; + + buildInputs = [ + libseccomp + ] ++ lib.optional debugBuild libunwind + ++ lib.optionals installTests [ + gnumake + python3 + perl + which + ]; + + enableParallelBuilding = true; + + configureFlags = [ ] + ++ lib.optionals installTests [ "--enable-installed-tests" + "--libexecdir=${placeholder "installedTests"}/libexec" ] + ++ lib.optional debugBuild "--enable-debug"; + + makeFlags = [ "SYD_INCLUDEDIR=${stdenv.cc.libc.dev}/include" ]; + + doCheck = true; + checkPhase = '' + # Many of the regular test cases in t/ do not work inside the build sandbox + make -C syd check + ''; + + postInstall = if installTests then '' + moveToOutput bin/syd-test $installedTests + '' else '' + # Tests are installed despite --disable-installed-tests + rm -r $out/bin/syd-test $out/libexec + ''; + + meta = with lib; { + homepage = "https://sydbox.exherbo.org/"; + description = "seccomp-based application sandbox"; + license = licenses.gpl2; + platforms = platforms.linux; + maintainers = with maintainers; [ mvs ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4a7e1eb4c6bd..07d3333cd235 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3417,6 +3417,8 @@ with pkgs; swego = callPackage ../servers/swego { }; + sydbox = callPackage ../os-specific/linux/sydbox { }; + syscall_limiter = callPackage ../os-specific/linux/syscall_limiter {}; syslogng = callPackage ../tools/system/syslog-ng { }; From b24780c6b427c26ac24d745bf75111a6ea9f0138 Mon Sep 17 00:00:00 2001 From: Leo Maroni Date: Fri, 24 Sep 2021 22:52:03 +0200 Subject: [PATCH 09/24] vikunja-api: 0.18.0 -> 1.18.1 --- pkgs/servers/web-apps/vikunja/api.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/web-apps/vikunja/api.nix b/pkgs/servers/web-apps/vikunja/api.nix index fc1aa09e4f69..2917c0e24008 100644 --- a/pkgs/servers/web-apps/vikunja/api.nix +++ b/pkgs/servers/web-apps/vikunja/api.nix @@ -2,14 +2,14 @@ buildGoModule rec { pname = "vikunja-api"; - version = "0.18.0"; + version = "0.18.1"; src = fetchFromGitea { domain = "kolaente.dev"; owner = "vikunja"; repo = "api"; rev = "v${version}"; - sha256 = "sha256-43y9+y5VVgbCexHPsYZ9/Up84OoPSrThHWiKR0P1h3s="; + sha256 = "sha256-ngdtK8e4mLpbuY9OP1aHk99qPX/cKwnyhb/3ImTwF6M="; }; nativeBuildInputs = @@ -24,7 +24,7 @@ buildGoModule rec { ''; in [ fakeGit mage ]; - vendorSha256 = "sha256-1tXnlOlVH61Y4jN07XBfTgZhAsU2HeudiEVAtlP+Cpk="; + vendorSha256 = "sha256-0MP04KpWX17Fa1WhLwF4yzIsDqGAeTUXxv81B+BTNe4="; # checks need to be disabled because of needed internet for some checks doCheck = false; From 7b03c7ee60844ecab58d45bd06e2c5f2f8336e64 Mon Sep 17 00:00:00 2001 From: Leo Maroni Date: Fri, 24 Sep 2021 22:52:54 +0200 Subject: [PATCH 10/24] vikunja-frontend: 0.18.0 -> 0.18.1 --- pkgs/servers/web-apps/vikunja/frontend.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/web-apps/vikunja/frontend.nix b/pkgs/servers/web-apps/vikunja/frontend.nix index 6cca64e19ae9..3c708287ca34 100644 --- a/pkgs/servers/web-apps/vikunja/frontend.nix +++ b/pkgs/servers/web-apps/vikunja/frontend.nix @@ -2,10 +2,10 @@ stdenv.mkDerivation rec { pname = "vikunja-frontend"; - version = "0.18.0"; + version = "0.18.1"; src = fetchurl { url = "https://dl.vikunja.io/frontend/${pname}-${version}.zip"; - sha256 = "sha256-LV7+HfXeNcVHuoo+n6fuAQoIb/m0lOs6JYYMNLM/jTA="; + sha256 = "sha256-u4XA6Jqn+p2J0sB2KabwZY/lFwZakZEvUUh/enrhtN4="; }; nativeBuildInputs = [ unzip ]; From 194eb792885f676df6098ae97692192e0a3abbf2 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Sep 2021 08:48:51 +0200 Subject: [PATCH 11/24] python3Packages.lupupy: init at 0.0.21 --- .../python-modules/lupupy/default.nix | 39 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 41 insertions(+) create mode 100644 pkgs/development/python-modules/lupupy/default.nix diff --git a/pkgs/development/python-modules/lupupy/default.nix b/pkgs/development/python-modules/lupupy/default.nix new file mode 100644 index 000000000000..a1248d331426 --- /dev/null +++ b/pkgs/development/python-modules/lupupy/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildPythonPackage +, colorlog +, demjson +, fetchPypi +, pythonOlder +, requests +}: + +buildPythonPackage rec { + pname = "lupupy"; + version = "0.0.21"; + format = "setuptools"; + + disabled = pythonOlder "3.6"; + + src = fetchPypi { + inherit pname version; + sha256 = "0cpamb1fp84psiqm7xr156zi4f2fv2wijbjjyk6w87z8fl2aw8xc"; + }; + + propagatedBuildInputs = [ + colorlog + demjson + requests + ]; + + # Project has no tests + doCheck = false; + + pythonImportsCheck = [ "lupupy" ]; + + meta = with lib; { + description = "Python module to control Lupusec alarm control panels"; + homepage = "https://github.com/majuss/lupupy"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 50803af17df7..4256670c1c64 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4370,6 +4370,8 @@ in { lupa = callPackage ../development/python-modules/lupa { }; + lupupy = callPackage ../development/python-modules/lupupy { }; + lxml = callPackage ../development/python-modules/lxml { inherit (pkgs) libxml2 libxslt zlib; }; From 541fd9936db69116a94fb3dbe9eff5bd00c4460f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Sep 2021 08:49:30 +0200 Subject: [PATCH 12/24] home-assistant: update component-packages --- pkgs/servers/home-assistant/component-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index b1363880f9f8..9060f82b88fe 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -478,7 +478,7 @@ "lovelace" = ps: with ps; [ ]; "luci" = ps: with ps; [ openwrt-luci-rpc ]; "luftdaten" = ps: with ps; [ luftdaten ]; - "lupusec" = ps: with ps; [ ]; # missing inputs: lupupy + "lupusec" = ps: with ps; [ lupupy ]; "lutron" = ps: with ps; [ pylutron ]; "lutron_caseta" = ps: with ps; [ aiolip pylutron-caseta ]; "lw12wifi" = ps: with ps; [ ]; # missing inputs: lw12 From a649cbca0948c39c43c63b790c75b5b6e4db1564 Mon Sep 17 00:00:00 2001 From: "Travis A. Everett" Date: Thu, 23 Sep 2021 17:40:35 -0500 Subject: [PATCH 13/24] resholvePackage: extract util functions Extract argument-handling utility functions to prepare for adding resholveScript* functions. This tracks upstream work, but I broke it up a little more semantically here in case it aids review. See: https://github.com/abathur/resholve/commit/6aab74820531673c760d95c24b28f0c29f43fe01 --- pkgs/development/misc/resholve/default.nix | 5 +- .../misc/resholve/resholve-package.nix | 74 +------------------ .../misc/resholve/resholve-utils.nix | 74 +++++++++++++++++++ 3 files changed, 80 insertions(+), 73 deletions(-) create mode 100644 pkgs/development/misc/resholve/resholve-utils.nix diff --git a/pkgs/development/misc/resholve/default.nix b/pkgs/development/misc/resholve/default.nix index dae7fdc384c1..2c8b51b6e816 100644 --- a/pkgs/development/misc/resholve/default.nix +++ b/pkgs/development/misc/resholve/default.nix @@ -12,7 +12,10 @@ rec { inherit (source) version; inherit (deps.oil) oildev; }; - resholvePackage = callPackage ./resholve-package.nix { + resholve-utils = callPackage ./resholve-utils.nix { inherit resholve; }; + resholvePackage = callPackage ./resholve-package.nix { + inherit resholve resholve-utils; + }; } diff --git a/pkgs/development/misc/resholve/resholve-package.nix b/pkgs/development/misc/resholve/resholve-package.nix index 78ee6603b9d4..836d2df34604 100644 --- a/pkgs/development/misc/resholve/resholve-package.nix +++ b/pkgs/development/misc/resholve/resholve-package.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, resholve, binlore }: +{ stdenv, lib, resholve, resholve-utils }: { pname , src @@ -9,76 +9,6 @@ }@attrs: let inherit stdenv; - /* These functions break up the work of partially validating the - 'solutions' attrset and massaging it into env/cli args. - - Note: some of the left-most args do not *have* to be passed as - deep as they are, but I've done so to provide more error context - */ - - # for brevity / line length - spaces = l: builtins.concatStringsSep " " l; - semicolons = l: builtins.concatStringsSep ";" l; - - /* Throw a fit with dotted attr path context */ - nope = path: msg: - throw "${builtins.concatStringsSep "." path}: ${msg}"; - - /* Special-case directive value representations by type */ - makeDirective = solution: env: name: val: - if builtins.isInt val then builtins.toString val - else if builtins.isString val then name - else if true == val then name - else if false == val then "" # omit! - else if null == val then "" # omit! - else if builtins.isList val then "${name}:${semicolons val}" - else nope [ solution env name ] "unexpected type: ${builtins.typeOf val}"; - - /* Build fake/fix/keep directives from Nix types */ - makeDirectives = solution: env: val: - lib.mapAttrsToList (makeDirective solution env) val; - - /* Special-case value representation by type/name */ - makeEnvVal = solution: env: val: - if env == "inputs" then lib.makeBinPath val - else if builtins.isString val then val - else if builtins.isList val then spaces val - else if builtins.isAttrs val then spaces (makeDirectives solution env val) - else nope [ solution env ] "unexpected type: ${builtins.typeOf val}"; - - /* Shell-format each env value */ - shellEnv = solution: env: value: - lib.escapeShellArg (makeEnvVal solution env value); - - /* Build a single ENV=val pair */ - makeEnv = solution: env: value: - "RESHOLVE_${lib.toUpper env}=${shellEnv solution env value}"; - - /* Discard attrs claimed by makeArgs */ - removeCliArgs = value: - removeAttrs value [ "scripts" "flags" ]; - - /* Verify required arguments are present */ - validateSolution = { scripts, inputs, interpreter, ... }: true; - - /* Pull out specific solution keys to build ENV=val pairs */ - makeEnvs = solution: value: - spaces (lib.mapAttrsToList (makeEnv solution) (removeCliArgs value)); - - /* Pull out specific solution keys to build CLI argstring */ - makeArgs = { flags ? [ ], scripts, ... }: - spaces (flags ++ scripts); - - /* Build a single resholve invocation */ - makeInvocation = solution: value: - if validateSolution value then - # we pass resholve a directory - "RESHOLVE_LORE=${binlore.collect { drvs = value.inputs; } } ${makeEnvs solution value} resholve --overwrite ${makeArgs value}" - else throw "invalid solution"; # shouldn't trigger for now - - /* Build resholve invocation for each solution. */ - makeCommands = solutions: - lib.mapAttrsToList makeInvocation solutions; self = (stdenv.mkDerivation ((removeAttrs attrs [ "solutions" ]) // { @@ -99,7 +29,7 @@ let PS4=$'\x1f'"\033[33m[resholve context]\033[0m " set -x : changing directory to $PWD - ${builtins.concatStringsSep "\n" (makeCommands solutions)} + ${builtins.concatStringsSep "\n" (resholve-utils.makeCommands solutions)} ) ''; })); diff --git a/pkgs/development/misc/resholve/resholve-utils.nix b/pkgs/development/misc/resholve/resholve-utils.nix new file mode 100644 index 000000000000..2d3c55b87563 --- /dev/null +++ b/pkgs/development/misc/resholve/resholve-utils.nix @@ -0,0 +1,74 @@ +{ lib, resholve, binlore }: + +rec { + /* These functions break up the work of partially validating the + 'solutions' attrset and massaging it into env/cli args. + + Note: some of the left-most args do not *have* to be passed as + deep as they are, but I've done so to provide more error context + */ + + # for brevity / line length + spaces = l: builtins.concatStringsSep " " l; + semicolons = l: builtins.concatStringsSep ";" l; + + /* Throw a fit with dotted attr path context */ + nope = path: msg: + throw "${builtins.concatStringsSep "." path}: ${msg}"; + + /* Special-case directive value representations by type */ + makeDirective = solution: env: name: val: + if builtins.isInt val then builtins.toString val + else if builtins.isString val then name + else if true == val then name + else if false == val then "" # omit! + else if null == val then "" # omit! + else if builtins.isList val then "${name}:${semicolons val}" + else nope [ solution env name ] "unexpected type: ${builtins.typeOf val}"; + + /* Build fake/fix/keep directives from Nix types */ + makeDirectives = solution: env: val: + lib.mapAttrsToList (makeDirective solution env) val; + + /* Special-case value representation by type/name */ + makeEnvVal = solution: env: val: + if env == "inputs" then lib.makeBinPath val + else if builtins.isString val then val + else if builtins.isList val then spaces val + else if builtins.isAttrs val then spaces (makeDirectives solution env val) + else nope [ solution env ] "unexpected type: ${builtins.typeOf val}"; + + /* Shell-format each env value */ + shellEnv = solution: env: value: + lib.escapeShellArg (makeEnvVal solution env value); + + /* Build a single ENV=val pair */ + makeEnv = solution: env: value: + "RESHOLVE_${lib.toUpper env}=${shellEnv solution env value}"; + + /* Discard attrs claimed by makeArgs */ + removeCliArgs = value: + removeAttrs value [ "scripts" "flags" ]; + + /* Verify required arguments are present */ + validateSolution = { scripts, inputs, interpreter, ... }: true; + + /* Pull out specific solution keys to build ENV=val pairs */ + makeEnvs = solution: value: + spaces (lib.mapAttrsToList (makeEnv solution) (removeCliArgs value)); + + /* Pull out specific solution keys to build CLI argstring */ + makeArgs = { flags ? [ ], scripts, ... }: + spaces (flags ++ scripts); + + /* Build a single resholve invocation */ + makeInvocation = solution: value: + if validateSolution value then + # we pass resholve a directory + "RESHOLVE_LORE=${binlore.collect { drvs = value.inputs; } } ${makeEnvs solution value} ${resholve}/bin/resholve --overwrite ${makeArgs value}" + else throw "invalid solution"; # shouldn't trigger for now + + /* Build resholve invocation for each solution. */ + makeCommands = solutions: + lib.mapAttrsToList makeInvocation solutions; +} From 67ec4fa479b82a264ee647785df261f0f12b7f05 Mon Sep 17 00:00:00 2001 From: "Travis A. Everett" Date: Thu, 23 Sep 2021 17:52:17 -0500 Subject: [PATCH 14/24] resholve: fix review nits from #138080 --- pkgs/development/misc/resholve/default.nix | 3 +-- pkgs/development/misc/resholve/oildev.nix | 23 +++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pkgs/development/misc/resholve/default.nix b/pkgs/development/misc/resholve/default.nix index 2c8b51b6e816..cb32f9f9c756 100644 --- a/pkgs/development/misc/resholve/default.nix +++ b/pkgs/development/misc/resholve/default.nix @@ -8,8 +8,7 @@ let in rec { resholve = callPackage ./resholve.nix { - inherit (source) rSrc; - inherit (source) version; + inherit (source) rSrc version; inherit (deps.oil) oildev; }; resholve-utils = callPackage ./resholve-utils.nix { diff --git a/pkgs/development/misc/resholve/oildev.nix b/pkgs/development/misc/resholve/oildev.nix index b15047b53ff9..635aca9aa57a 100644 --- a/pkgs/development/misc/resholve/oildev.nix +++ b/pkgs/development/misc/resholve/oildev.nix @@ -46,6 +46,11 @@ rec { nativeBuildInputs = [ git ]; }; + /* + Upstream isn't interested in packaging this as a library + (or accepting all of the patches we need to do so). + This creates one without disturbing upstream too much. + */ oildev = python27Packages.buildPythonPackage rec { pname = "oildev-unstable"; version = "2021-07-14"; @@ -61,22 +66,21 @@ rec { It's not critical to drop most of these; the primary target is the vendored fork of Python-2.7.13, which is ~ 55M and over 3200 files, dozens of which get interpreter script patches in fixup. + + Note: -f is necessary to keep it from being a pain to update + hash on rev updates. Command will fail w/o and not print hash. */ extraPostFetch = '' rm -rf Python-2.7.13 benchmarks metrics py-yajl rfc gold web testdata services demo devtools cpp ''; }; - # TODO: not sure why I'm having to set this for nix-build... - # can anyone tell if I'm doing something wrong? - SOURCE_DATE_EPOCH = 315532800; - # patch to support a python package, pass tests on macOS, etc. patchSrc = fetchFromGitHub { owner = "abathur"; repo = "nix-py-dev-oil"; - rev = "v0.8.12"; - hash = "sha256-/EvwxL201lGsioL0lIhzM8VTghe6FuVbc3PBJgY8c8E="; + rev = "v0.8.12.1"; + hash = "sha256-7JVnosdcvmVFN3h6SIeeqcJFcyFkai//fFuzi7ThNMY="; }; patches = [ "${patchSrc}/0001-add_setup_py.patch" @@ -102,7 +106,12 @@ rec { patchShebangs asdl build core doctools frontend native oil_lang ''; - # TODO: this may be obsolete? + /* + We did convince oil to upstream an env for specifying + this to support a shell.nix. Would need a patch if they + later drop this support. See: + https://github.com/oilshell/oil/blob/46900310c7e4a07a6223eb6c08e4f26460aad285/doctools/cmark.py#L30-L34 + */ _NIX_SHELL_LIBCMARK = "${cmark}/lib/libcmark${stdenv.hostPlatform.extensions.sharedLibrary}"; # See earlier note on glibcLocales TODO: verify needed? From b5833091d4d24e7a742df703a4b02acfe8f4ecb1 Mon Sep 17 00:00:00 2001 From: "Travis A. Everett" Date: Thu, 23 Sep 2021 18:23:52 -0500 Subject: [PATCH 15/24] resholve: 0.6.0 -> 0.6.1, add resholveScript* fns --- pkgs/development/misc/resholve/README.md | 35 ++++++++++++++++++++-- pkgs/development/misc/resholve/default.nix | 35 +++++++++++++++++++++- pkgs/development/misc/resholve/source.nix | 4 +-- pkgs/development/misc/resholve/test.nix | 18 ++++++++++- 4 files changed, 86 insertions(+), 6 deletions(-) diff --git a/pkgs/development/misc/resholve/README.md b/pkgs/development/misc/resholve/README.md index 024465f306cd..c5f7b8750b7a 100644 --- a/pkgs/development/misc/resholve/README.md +++ b/pkgs/development/misc/resholve/README.md @@ -2,7 +2,8 @@ resholve converts bare executable references in shell scripts to absolute paths. This will hopefully make its way into the Nixpkgs manual soon, but -until then I'll outline how to use the `resholvePackage` function. +until then I'll outline how to use the `resholvePackage`, `resholveScript`, +and `resholveScriptBin` functions. > Fair warning: resholve does *not* aspire to resolving all valid Shell > scripts. It depends on the OSH/Oil parser, which aims to support most (but @@ -21,7 +22,10 @@ Each "solution" (k=v pair) in this attrset describes one resholve invocation. > - Packages with scripts that require conflicting directives can use multiple > solutions to resolve the scripts separately, but produce a single package. -## Basic Example +The `resholveScript` and `resholveScriptBin` functions support a _single_ +`solution` attrset. This is basically the same as any single solution in `resholvePackage`, except that it doesn't need a `scripts` attr (it is automatically added). + +## Basic `resholvePackage` Example Here's a simple example from one of my own projects, with annotations: