diff options
Diffstat (limited to 'nixpkgs/pkgs/development/misc')
14 files changed, 261 insertions, 171 deletions
diff --git a/nixpkgs/pkgs/development/misc/h3/default.nix b/nixpkgs/pkgs/development/misc/h3/default.nix index a5299f865d5d..99b7f8fdc325 100644 --- a/nixpkgs/pkgs/development/misc/h3/default.nix +++ b/nixpkgs/pkgs/development/misc/h3/default.nix @@ -1,4 +1,5 @@ -{ lib, stdenv +{ lib +, stdenv , cmake , fetchFromGitHub }: @@ -22,9 +23,11 @@ stdenv.mkDerivation rec { ]; meta = with lib; { - homepage = "https://github.com/uber/h3"; + homepage = "https://h3geo.org/"; description = "Hexagonal hierarchical geospatial indexing system"; license = licenses.asl20; + changelog = "https://github.com/uber/h3/raw/v${version}/CHANGELOG.md"; + platforms = platforms.all; maintainers = [ maintainers.kalbasit ]; }; } diff --git a/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-engine.nix b/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-engine.nix index d8faf1714510..ba9d1d5bf9f4 100644 --- a/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-engine.nix +++ b/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-engine.nix @@ -3,35 +3,37 @@ { mkDerivation, aeson, aeson-casing, ansi-wl-pprint, asn1-encoding , asn1-types, async, attoparsec, attoparsec-iso8601, auto-update , base, base16-bytestring, base64-bytestring, binary, byteorder -, bytestring, case-insensitive, ci-info, containers, cron -, cryptonite, data-has, deepseq, dependent-map, dependent-sum -, directory, ekg-core, ekg-json, exceptions, fast-logger, fetchgit -, file-embed, filepath, ghc-heap-view, graphql-parser, hashable -, hashable-time, hspec, hspec-core, hspec-expectations -, hspec-expectations-lifted, http-api-data, http-client -, http-client-tls, http-conduit, http-types, immortal -, insert-ordered-containers, jose, kan-extensions, lens, lens-aeson -, lib, lifted-async, lifted-base, list-t, memory, mime-types -, mmorph, monad-control, monad-loops, monad-validate, mtl, mustache -, mysql, mysql-simple, natural-transformation, network, network-uri -, odbc, optparse-applicative, pem, pg-client, postgresql-binary +, bytestring, case-insensitive, ci-info, connection, containers +, cron, cryptonite, data-default-class, data-has, deepseq +, dependent-map, dependent-sum, directory, ekg-core, ekg-json +, exceptions, fast-logger, fetchgit, file-embed, filepath +, ghc-heap-view, graphql-parser, hashable, hashable-time, hspec +, hspec-core, hspec-expectations, hspec-expectations-lifted +, http-api-data, http-client, http-client-tls, http-conduit +, http-types, immortal, insert-ordered-containers, jose +, kan-extensions, lens, lens-aeson, lib, lifted-async, lifted-base +, list-t, memory, mime-types, mmorph, monad-control, monad-loops +, monad-validate, mtl, mustache, mysql, mysql-simple +, natural-transformation, network, network-uri, odbc +, optparse-applicative, pem, pg-client, postgresql-binary , postgresql-libpq, pretty-simple, process, profunctors, psqueues , QuickCheck, quickcheck-instances, random, regex-tdfa , resource-pool, retry, safe, safe-exceptions, scientific , semialign, semigroups, semver, shakespeare, some, split , Spock-core, stm, stm-containers, tagged, template-haskell, text -, text-builder, text-conversions, these, time, transformers +, text-builder, text-conversions, these, time, tls, transformers , transformers-base, unix, unordered-containers, uri-encode , utf8-string, uuid, validation, vector, vector-instances, wai -, warp, websockets, wreq, x509, x509-store, yaml, zlib +, warp, websockets, wreq, x509, x509-store, x509-system +, x509-validation, yaml, zlib }: mkDerivation { pname = "graphql-engine"; version = "1.0.0"; src = fetchgit { url = "https://github.com/hasura/graphql-engine.git"; - sha256 = "04s8rczvm0l5dbh14g2vav2wbqb4fg51471fncqf36s59img14b7"; - rev = "cf6f3edc1f6df7843dfb91be6dcb0fd7cc94d133"; + sha256 = "0ky23f700pmzb6anx44xzh6dixixmn7kq1ypj0yy4kqiqzqdb2dg"; + rev = "7c35ffb36561214390d0d545d418746f29a29ba4"; fetchSubmodules = true; }; postUnpack = "sourceRoot+=/server; echo source root reset to $sourceRoot"; @@ -41,23 +43,24 @@ mkDerivation { aeson aeson-casing ansi-wl-pprint asn1-encoding asn1-types async attoparsec attoparsec-iso8601 auto-update base base16-bytestring base64-bytestring binary byteorder bytestring case-insensitive - ci-info containers cron cryptonite data-has deepseq dependent-map - dependent-sum directory ekg-core ekg-json exceptions fast-logger - file-embed filepath ghc-heap-view graphql-parser hashable - hashable-time http-api-data http-client http-client-tls - http-conduit http-types immortal insert-ordered-containers jose - kan-extensions lens lens-aeson lifted-async lifted-base list-t - memory mime-types mmorph monad-control monad-loops monad-validate - mtl mustache mysql mysql-simple network network-uri odbc - optparse-applicative pem pg-client postgresql-binary - postgresql-libpq pretty-simple process profunctors psqueues - QuickCheck quickcheck-instances random regex-tdfa resource-pool - retry safe-exceptions scientific semialign semigroups semver - shakespeare some split Spock-core stm stm-containers tagged - template-haskell text text-builder text-conversions these time - transformers transformers-base unix unordered-containers uri-encode - utf8-string uuid validation vector vector-instances wai warp - websockets wreq x509 x509-store yaml zlib + ci-info connection containers cron cryptonite data-default-class + data-has deepseq dependent-map dependent-sum directory ekg-core + ekg-json exceptions fast-logger file-embed filepath ghc-heap-view + graphql-parser hashable hashable-time http-api-data http-client + http-client-tls http-conduit http-types immortal + insert-ordered-containers jose kan-extensions lens lens-aeson + lifted-async lifted-base list-t memory mime-types mmorph + monad-control monad-loops monad-validate mtl mustache mysql + mysql-simple network network-uri odbc optparse-applicative pem + pg-client postgresql-binary postgresql-libpq pretty-simple process + profunctors psqueues QuickCheck quickcheck-instances random + regex-tdfa resource-pool retry safe-exceptions scientific semialign + semigroups semver shakespeare some split Spock-core stm + stm-containers tagged template-haskell text text-builder + text-conversions these time tls transformers transformers-base unix + unordered-containers uri-encode utf8-string uuid validation vector + vector-instances wai warp websockets wreq x509 x509-store + x509-system x509-validation yaml zlib ]; executableHaskellDepends = [ base bytestring ekg-core kan-extensions pg-client text diff --git a/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-parser.nix b/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-parser.nix index 0033584a1593..a447ac015401 100644 --- a/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-parser.nix +++ b/nixpkgs/pkgs/development/misc/haskell/hasura/graphql-parser.nix @@ -10,8 +10,8 @@ mkDerivation { version = "0.2.0.0"; src = fetchgit { url = "https://github.com/hasura/graphql-parser-hs.git"; - sha256 = "015b1h475k8wmhm9hkrvyxr985x7d8yc0xgcdqj7vmziixvfwwwj"; - rev = "79beb0e85e00422a8a15318c0bc573765fc7b246"; + sha256 = "0zqrh7y0cjjrscsw2hmyhdcm4nzvb5pw394pcxk8q19xx13jp9xd"; + rev = "43562a5b7b41d380e3e31732b48637702e5aa97d"; fetchSubmodules = true; }; libraryHaskellDepends = [ diff --git a/nixpkgs/pkgs/development/misc/haskell/hasura/pg-client.nix b/nixpkgs/pkgs/development/misc/haskell/hasura/pg-client.nix index d1eb5e156e6c..52f179f9923c 100644 --- a/nixpkgs/pkgs/development/misc/haskell/hasura/pg-client.nix +++ b/nixpkgs/pkgs/development/misc/haskell/hasura/pg-client.nix @@ -13,8 +13,8 @@ mkDerivation { version = "0.1.0"; src = fetchgit { url = "https://github.com/hasura/pg-client-hs.git"; - sha256 = "1y79s3ai4h82szpm1j5n5ygybqr7cza9l0raxf39vgn66jhy1jd2"; - rev = "92975d0f8f933c8d06913dc97af259253bf7fb5f"; + sha256 = "00h9hskv3p4mg35php5wsr2d2rjahcv29rqidb2lxl11r05psr4m"; + rev = "5e8a2d7ebe8b96518e5a70f4d61be2550eaa4e70"; fetchSubmodules = true; }; setupHaskellDepends = [ base Cabal ]; diff --git a/nixpkgs/pkgs/development/misc/haskell/hasura/pool.nix b/nixpkgs/pkgs/development/misc/haskell/hasura/pool.nix index a12d61f0fe21..48954114a4a1 100644 --- a/nixpkgs/pkgs/development/misc/haskell/hasura/pool.nix +++ b/nixpkgs/pkgs/development/misc/haskell/hasura/pool.nix @@ -8,8 +8,8 @@ mkDerivation { version = "0.2.3.2"; src = fetchgit { url = "https://github.com/hasura/pool.git"; - sha256 = "00q1fxh72fgjwl1pi3lnp4xg8f3kfm6q12gs9scinwbymfgzarms"; - rev = "bc4c3f739a8fb8ec4444336a34662895831c9acf"; + sha256 = "02wa32fl5wq5fk59id54xmxiqjl564r4rhsc79xsgf2j2spj0v94"; + rev = "dc56753338e7b61220a09bed0469c6dcc5e9fb52"; fetchSubmodules = true; }; libraryHaskellDepends = [ diff --git a/nixpkgs/pkgs/development/misc/newlib/default.nix b/nixpkgs/pkgs/development/misc/newlib/default.nix index 870aa068afe8..60ad50a8e4f7 100644 --- a/nixpkgs/pkgs/development/misc/newlib/default.nix +++ b/nixpkgs/pkgs/development/misc/newlib/default.nix @@ -1,4 +1,9 @@ -{ stdenv, fetchurl, buildPackages }: +{ stdenv, fetchurl, buildPackages +, # "newlib-nano" is what the official ARM embedded toolchain calls this build + # configuration that prioritizes low space usage. We include it as a preset + # for embedded projects striving for a similar configuration. + nanoizeNewlib ? false +}: stdenv.mkDerivation rec { pname = "newlib"; @@ -22,10 +27,21 @@ stdenv.mkDerivation rec { "--disable-newlib-supplied-syscalls" "--disable-nls" + "--enable-newlib-retargetable-locking" + ] ++ (if !nanoizeNewlib then [ "--enable-newlib-io-long-long" "--enable-newlib-register-fini" - "--enable-newlib-retargetable-locking" - ]; + ] else [ + "--enable-newlib-reent-small" + "--disable-newlib-fvwrite-in-streamio" + "--disable-newlib-fseek-optimization" + "--disable-newlib-wide-orient" + "--enable-newlib-nano-malloc" + "--disable-newlib-unbuf-stream-opt" + "--enable-lite-exit" + "--enable-newlib-global-atexit" + "--enable-newlib-nano-formatted-io" + ]); dontDisableStatic = true; diff --git a/nixpkgs/pkgs/development/misc/resholve/README.md b/nixpkgs/pkgs/development/misc/resholve/README.md index 024465f306cd..0b4bcb371ade 100644 --- a/nixpkgs/pkgs/development/misc/resholve/README.md +++ b/nixpkgs/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: <!-- @@ -68,6 +72,28 @@ resholvePackage rec { } ``` +## Basic `resholveScript` and `resholveScriptBin` examples + +Both of these functions have the same basic API. This example is a little +trivial for now. If you have a real usage that you find helpful, please PR it. + +```nix +resholvedScript = resholveScript "name" { + inputs = [ file ]; + interpreter = "${bash}/bin/bash"; + } '' + echo "Hello" + file . + ''; +resholvedScriptBin = resholveScriptBin "name" { + inputs = [ file ]; + interpreter = "${bash}/bin/bash"; + } '' + echo "Hello" + file . + ''; +``` + ## Options `resholvePackage` maps Nix types/idioms into the flags and environment variables @@ -79,7 +105,7 @@ that the `resholve` CLI expects. Here's an overview: | inputs | list | packages to resolve executables from | | interpreter | string | 'none' or abspath for shebang | | prologue | file | text to insert before the first code-line | -| epilogue | file | text to isnert after the last code-line | +| epilogue | file | text to insert after the last code-line | | flags | list | strings to pass as flags | | fake | attrset | [directives](#controlling-resolution-with-directives) | | fix | attrset | [directives](#controlling-resolution-with-directives) | @@ -135,31 +161,31 @@ from the manpage, and the Nix equivalents: ```nix # --fake 'f:setUp;tearDown builtin:setopt source:/etc/bashrc' fake = { - # fake accepts the initial of valid identifier types as a CLI convienience. + # fake accepts the initial of valid identifier types as a CLI convenience. # Use full names in the Nix API. function = [ "setUp" "tearDown" ]; builtin = [ "setopt" ]; source = [ "/etc/bashrc" ]; }; -# --fix 'aliases xargs:ls $GIT:gix' +# --fix 'aliases $GIT:gix /bin/bash' fix = { # all single-word directives use `true` as value aliases = true; - xargs = [ "ls" ]; "$GIT" = [ "gix" ]; + "/bin/bash"; }; -# --keep 'which:git;ls .:$HOME $LS:exa /etc/bashrc ~/.bashrc' +# --keep 'source:$HOME /etc/bashrc ~/.bashrc' keep = { - which = [ "git" "ls" ]; - "." = [ "$HOME" ]; - "$LS" = [ "exa" ]; + source = [ "$HOME" ]; "/etc/bashrc" = true; "~/.bashrc" = true; }; ``` +> **Note:** For now, at least, you'll need to reference the manpage to completely understand these examples. + ## Controlling nested resolution with lore Initially, resolution of commands in the arguments to command-executing @@ -177,6 +203,11 @@ some of the more common commands. - "wrapper" lore maps shell exec wrappers to the programs they exec so that resholve can substitute an executable's verdict for its wrapper's. +> **Caution:** At least when it comes to common utilities, it's best to treat +> overrides as a stopgap until they can be properly handled in resholve and/or +> binlore. Please report things you have to override and, if possible, help +> get them sorted. + There will be more mechanisms for controlling this process in the future (and your reports/experiences will play a role in shaping them...) For now, the main lever is the ability to substitute your own lore. This is how you'd diff --git a/nixpkgs/pkgs/development/misc/resholve/default.nix b/nixpkgs/pkgs/development/misc/resholve/default.nix index dae7fdc384c1..714c4ecabe08 100644 --- a/nixpkgs/pkgs/development/misc/resholve/default.nix +++ b/nixpkgs/pkgs/development/misc/resholve/default.nix @@ -1,5 +1,5 @@ { callPackage -, ... +, writeTextFile }: let @@ -8,11 +8,46 @@ let in rec { resholve = callPackage ./resholve.nix { - inherit (source) rSrc; - inherit (source) version; + inherit (source) rSrc 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; + }; + resholveScript = name: partialSolution: text: + writeTextFile { + inherit name text; + executable = true; + checkPhase = '' + ( + PS4=$'\x1f'"\033[33m[resholve context]\033[0m " + set -x + ${resholve-utils.makeInvocation name (partialSolution // { + scripts = [ "${placeholder "out"}" ]; + })} + ) + ${partialSolution.interpreter} -n $out + ''; + }; + resholveScriptBin = name: partialSolution: text: + writeTextFile rec { + inherit name text; + executable = true; + destination = "/bin/${name}"; + checkPhase = '' + ( + cd "$out" + PS4=$'\x1f'"\033[33m[resholve context]\033[0m " + set -x + : changing directory to $PWD + ${resholve-utils.makeInvocation name (partialSolution // { + scripts = [ "bin/${name}" ]; + })} + ) + ${partialSolution.interpreter} -n $out/bin/${name} + ''; + }; } diff --git a/nixpkgs/pkgs/development/misc/resholve/oildev.nix b/nixpkgs/pkgs/development/misc/resholve/oildev.nix index b15047b53ff9..635aca9aa57a 100644 --- a/nixpkgs/pkgs/development/misc/resholve/oildev.nix +++ b/nixpkgs/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? diff --git a/nixpkgs/pkgs/development/misc/resholve/resholve-package.nix b/nixpkgs/pkgs/development/misc/resholve/resholve-package.nix index 78ee6603b9d4..89852efb8bac 100644 --- a/nixpkgs/pkgs/development/misc/resholve/resholve-package.nix +++ b/nixpkgs/pkgs/development/misc/resholve/resholve-package.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, resholve, binlore }: +{ stdenv, lib, resholve, resholve-utils }: { pname , src @@ -9,81 +9,11 @@ }@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" ]) // { inherit pname version src; - buildInputs = [ resholve ]; + buildInputs = (lib.optionals (builtins.hasAttr "buildInputs" attrs) attrs.buildInputs) ++ [ resholve ]; # enable below for verbose debug info if needed # supports default python.logging levels @@ -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/nixpkgs/pkgs/development/misc/resholve/resholve-utils.nix b/nixpkgs/pkgs/development/misc/resholve/resholve-utils.nix new file mode 100644 index 000000000000..2d3c55b87563 --- /dev/null +++ b/nixpkgs/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; +} diff --git a/nixpkgs/pkgs/development/misc/resholve/source.nix b/nixpkgs/pkgs/development/misc/resholve/source.nix index 32ffeb98fd7e..5633e90f4bb0 100644 --- a/nixpkgs/pkgs/development/misc/resholve/source.nix +++ b/nixpkgs/pkgs/development/misc/resholve/source.nix @@ -3,7 +3,7 @@ }: rec { - version = "0.6.0"; + version = "0.6.6"; rSrc = # local build -> `make ci`; `make clean` to restore # return to remote source @@ -14,6 +14,6 @@ rec { owner = "abathur"; repo = "resholve"; rev = "v${version}"; - hash = "sha256-GfhhU9f5kiYcuYTPKWXCIkAGsz7GhAUGjAmIZ8Ww5X4="; + hash = "sha256-bupf3c9tNPAEMzFEDcvg483bSiwZFuB3ZqveG89dgkE="; }; } diff --git a/nixpkgs/pkgs/development/misc/resholve/test.nix b/nixpkgs/pkgs/development/misc/resholve/test.nix index f263c019d813..dd847462420b 100644 --- a/nixpkgs/pkgs/development/misc/resholve/test.nix +++ b/nixpkgs/pkgs/development/misc/resholve/test.nix @@ -3,6 +3,8 @@ , callPackage , resholve , resholvePackage +, resholveScript +, resholveScriptBin , shunit2 , coreutils , gnused @@ -22,35 +24,6 @@ }: let - inherit (callPackage ./default.nix { }) - resholve resholvePackage; - - # ourCoreutils = coreutils.override { singleBinary = false; }; - - /* - TODO: wrapped copy of find so that we can eventually test - our ability to see through wrappers. Unused for now. - Note: grep can serve the negative case; grep doesn't match, and - egrep is a shell wrapper for grep. - */ - # wrapfind = runCommand "wrapped-find" { } '' - # source ${makeWrapper}/nix-support/setup-hook - # makeWrapper ${findutils}/bin/find $out/bin/wrapped-find - # ''; - /* TODO: - unrelated, but is there already a function (or would - there be demand for one?) along the lines of: - wrap = { drv, executable(s?), args ? { } }: that: - - generates a sane output name - - sources makewrapper - - retargets real executable if already wrapped - - wraps the executable - - I wonder because my first thought here was overrideAttrs, - but I realized rebuilding just for a custom wrapper is an - ongoing waste of time. If it is a common pattern in the - wild, it would be a nice QoL improvement. - */ in rec { @@ -224,4 +197,20 @@ rec { fi ''; }; + + # Caution: ci.nix asserts the equality of both of these w/ diff + resholvedScript = resholveScript "resholved-script" { + inputs = [ file ]; + interpreter = "${bash}/bin/bash"; + } '' + echo "Hello" + file . + ''; + resholvedScriptBin = resholveScriptBin "resholved-script-bin" { + inputs = [ file ]; + interpreter = "${bash}/bin/bash"; + } '' + echo "Hello" + file . + ''; } diff --git a/nixpkgs/pkgs/development/misc/yelp-tools/default.nix b/nixpkgs/pkgs/development/misc/yelp-tools/default.nix index fc3be7421adb..d6864b80f9ed 100644 --- a/nixpkgs/pkgs/development/misc/yelp-tools/default.nix +++ b/nixpkgs/pkgs/development/misc/yelp-tools/default.nix @@ -13,13 +13,13 @@ python3.pkgs.buildPythonApplication rec { pname = "yelp-tools"; - version = "40.0"; + version = "41.0"; format = "other"; src = fetchurl { url = "mirror://gnome/sources/yelp-tools/${lib.versions.major version}/${pname}-${version}.tar.xz"; - sha256 = "1bkanqp3qwmirv06mi99qv2acr5ba5rlhy9zlh0fyrfxygraqjv6"; + sha256 = "N/GswCvL5ooxuG4HwSmoOb0yduZW3Inrf8CpJ0bv8nI="; }; nativeBuildInputs = [ |