Giter Site home page Giter Site logo

nix-update's Introduction

nix-update

Nix-update updates versions/source hashes of nix packages. It is designed to work with nixpkgs but also other package sets.

Features

  • automatically figure out the latest version of packages from:
    • BitBucket
    • Codeberg
    • crates.io
    • Gitea
    • GitHub
    • GitLab
    • PyPi
    • RubyGems.org
    • Sourcehut
    • Savannah
  • update buildRustPackage's cargoHash/cargoSha256/cargoLock and cargoSetupHook's cargoDeps
  • update buildGoModule's vendorHash/vendorSha256
  • update buildNpmPackage's npmDepsHash and npmConfigHook's npmDeps
  • update buildComposerProject's vendorHash
  • update buildMavenPackage's mvnHash
  • update mixRelease's mixFodDeps
  • update fetchYarnDeps offlineCache output hash
  • update flake outputs (see --flake)
  • generate the following lockfile, Cargo.lock (see --generate-lockfile and --lockfile-metadata-path)
  • build and run the resulting package (see --build, --run or --shell
  • commit updated files (see --commit flag)
  • run update scripts (passthru.updateScript, see --use-update-script flag)
  • run package tests (see --test flag)
  • specify the system to use (see --system flag)

Installation

nix-update is included in nixpkgs.

To run without installing it, use:

$ nix-shell -p nix-update

To install it:

$ nix-env -f '<nixpkgs>' -iA nix-update

To run it from the git repository:

$ nix-build
$ ./result/bin/nix-update

If you have nix flakes enabled you can also do:

$ nix run github:Mic92/nix-update

USAGE

First change to your directory containing the nix expression (Could be a nixpkgs or your own repository). Than run nix-update as follows

$ nix-update attribute [--version version]

If your package is defined in a flake use the --flake flag instead:

$ nix-update attribute --flake [--version version]

nix-update will than try to update either the packages.{currentSystem}.{attribute} or {attribute} output attribute of the given flake. To update a package in legacyPackages, pass the full path to that package including the platform: legacyPackages.{platform}.{attribute}.

This example will fetch the latest github release:

$ nix-update nixpkgs-review

It is also possible to specify the version manually

$ nix-update --version=2.1.1 nixpkgs-review

To update an unstable package to the latest commit of the default branch:

$ nix-update --version=branch nixpkgs-review

To update an unstable package the latest commit from a certain branch:

$ nix-update --version=branch=develop nixpkgs-review

To only update sources hashes without updating the version:

$ nix-update --version=skip nixpkgs-review

To extract version information from versions with prefixes or suffixes, a regex can be used

$ nix-update jq --version-regex 'jq-(.*)'

By default nix-update will locate the file that needs to be patched using the src attribute of a derivation. In some cases this heurestic is wrong. One can override the behavior like that:

$ nix-update hello --override-filename pkgs/applications/misc/hello/default.nix

The nix-update command checks for new releases of a package using the src attribute. However, in some cases a package may use a non-standard release URL that is not supported by nix-update, but still has a repository with release information. For example, the Signal Desktop package in Nixpkgs fetches updates from https://updates.signal.org/, but also publishes release information on its GitHub page. In such cases, use the --url parameter to direct nix-update to the correct repository:

nix-update --url https://github.com/signalapp/Signal-Desktop --override-filename pkgs/applications/networking/instant-messengers/signal-desktop/default.nix   signal-desktop

With the --shell, --build, --test and --run flags the update can be tested. Additionally, the --review flag can be used to initiate a run of nixpkgs-review, which will ensure all dependent packages can be built.

In order to ensure consistent formatting, the --format flag will invoke nixfmt (nixfmt-rfc-style in nixpkgs).

# Also runs nix-build
$ nix-update --build nixpkgs-review
# Also runs nix-build nixpkgs-review.tests
$ nix-update --test nixpkgs-review
# Also runs nix-shell
$ nix-update --shell nixpkgs-review
# Also runs nix run
$ nix-update --run nixpkgs-review
# Run `nixpkgs-review wip` to validate dependent packages
$ nix-update --review nixpkgs-review
# Format file
$ nix-update --format nixpkgs-review

Nix-update also can optionally generate a commit message in the form attribute: old_version -> new_version with the applied version update:

$ nix-update --commit bitcoin-abc
...
[master 53d68a6a5a9] bitcoin-abc: 0.21.1 -> 0.21.2
1 file changed, 2 insertions(+), 2 deletions(-)

By default, nix-update will attempt to update to the next stable version of a package. Alphas, betas, release candidates and similar unstable releases will be ignored. This can be affected by changing the parameter version from its default value stable to unstable.

$ nix-update sbt
Not updating version, already 1.4.6

$ nix-update sbt --version=unstable
Update 1.4.6 -> 1.5.0-M1 in sbt

Development setup

First clone the repo to your preferred location (in the following, we assume ~/ - your home):

$ git clone https://github.com/Mic92/nix-update/ ~/nix-update

Than enter the dev shell:

$ cd ~/nix-update
$ nix develop

Change to the repository that contains the nix files you want to update, i.e. nixpkgs:

$ cd nixpkgs

Now you can run nix-update just by specifying the full path to its executable wrapper:

$ ~/git/nix-update/bin/nix-update --commit hello

TODO

  • create pull requests

Known Bugs

nix-update might not work correctly if a file contain multiple packages as it performs naive search and replace to update version numbers. This might be a problem if:

  • A file contains the same version string for multiple packages.
  • name is used instead of pname and/or ${version} is injected into name.

Related discussions:

Related projects:

  • nixpkgs-update is optimized for mass-updates in nixpkgs while nix-update is better suited for interactive usage that might require user-intervention i.e. fixing the build and testing the result. nix-update is also not limited to nixpkgs.

nix-update's People

Contributors

bors[bot] avatar daniel-sampliner avatar dependabot[bot] avatar drupol avatar ebadbeef avatar emilylange avatar figsoda avatar gaelreyrol avatar getchoo avatar github-actions[bot] avatar jonringer avatar jvanbruegge avatar katexochen avatar lilyinstarlight avatar marsam avatar mattpolzin avatar mergify[bot] avatar mic92 avatar mistydemeo avatar natsukium avatar nequissimus avatar pbsds avatar renovate[bot] avatar schnusch avatar scrumplex avatar supersandro2000 avatar teto avatar winterqt avatar yu-re-ka avatar zowoq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nix-update's Issues

Version extraction logic

Sometimes, tags/releases are prefixed or in some format that is not a "version".
I just ran into this with https://github.com/stedolan/jq
It would be great if there was something like a "version extractor", a regex that is used to extract the actual version from a tag/release.
For jq, it might be jq-(.+), so I would to be able to nix-update jq --commit --test --extractor 'jq-(.*)' or something similar

Do not rely on NIX_PATH

I do not have NIX_PATH set to avoid impurities but nix-update does not seem to work without it:

error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
Traceback (most recent call last):
  File "/nix/store/nhgmx5zj3z7cdd9z6ipqwv6ammigq96l-nix-update-0.5.0/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/nhgmx5zj3z7cdd9z6ipqwv6ammigq96l-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/__init__.py", line 196, in main
    package = update(options)
  File "/nix/store/nhgmx5zj3z7cdd9z6ipqwv6ammigq96l-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/update.py", line 150, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/nhgmx5zj3z7cdd9z6ipqwv6ammigq96l-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/update.py", line 90, in update_src_hash
    target_hash = nix_prefetch([expr])
  File "/nix/store/nhgmx5zj3z7cdd9z6ipqwv6ammigq96l-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/update.py", line 77, in nix_prefetch
    res = run(["nix-prefetch"] + cmd, extra_env=extra_env)
  File "/nix/store/nhgmx5zj3z7cdd9z6ipqwv6ammigq96l-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/utils.py", line 35, in run
    return subprocess.run(
  File "/nix/store/rppr9s436950i1dlzknbmz40m2xqqnxc-python3-3.9.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. (if (builtins.hasAttr "config" (builtins.functionArgs (import ./.))) then { config.checkMeta = false; overlays = []; } else { })).rescrobbled']' returned non-zero exit status 1.

This is especially annoying with update scripts that depend on nix-update.

It would be nice if the tool did not depend on <nixpkgs> or at least fell back on channel:nixos-unstable so that I do not have to run it with env NIX_PATH=nixpkgs=channel:nixos-unstable.

hash mismatch when trying to update kopia

❯ nix-update kopia

[...]

The package kopia-0.6.3 will be fetched as follows:
> fetchFromGitHub {
>   owner = "kopia";
>   repo = "kopia";
>   rev = "v0.6.3";
>   sha256 = "1wz4sqjcih1m4bjxxdrsggai931q72zz8ikf2rwkp4alz12wr355";
> }

trying https://github.com/kopia/kopia/archive/v0.6.3.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   119  100   119    0     0    680      0 --:--:-- --:--:-- --:--:--   683
100 14.5M    0 14.5M    0     0  2791k      0 --:--:--  0:00:05 --:--:-- 3038k
unpacking source archive /build/v0.6.3.tar.gz
hash mismatch in fixed-output derivation '/nix/store/9hjz4nv225khz9lqdcracyjrjykd1hvh-source':
  wanted: sha256:0000000000000000000000000000000000000000000000000000
  got:    sha256:0pvna3zrhwv412rarlfxgyh8d6xdxp2glx14xyn7n2xzvb0sz4i7
error: build of '/nix/store/yplp86z34fi0spzavamshw13qibsdwjz-source.drv' failed
Traceback (most recent call last):
  File "/nix/store/x3v8v59ra6zf0vanc6hxxyzgkyl7w2vp-nix-update-0.1/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/x3v8v59ra6zf0vanc6hxxyzgkyl7w2vp-nix-update-0.1/lib/python3.8/site-packages/nix_update/__init__.py", line 142, in main
    package = update(options)
  File "/nix/store/x3v8v59ra6zf0vanc6hxxyzgkyl7w2vp-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 82, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/x3v8v59ra6zf0vanc6hxxyzgkyl7w2vp-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 42, in update_src_hash
    target_hash = nix_prefetch([f"(import {opts.import_path} {{}}).{opts.attribute}"])
  File "/nix/store/x3v8v59ra6zf0vanc6hxxyzgkyl7w2vp-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 37, in nix_prefetch
    res = run(["nix-prefetch"] + cmd)
  File "/nix/store/x3v8v59ra6zf0vanc6hxxyzgkyl7w2vp-nix-update-0.1/lib/python3.8/site-packages/nix_update/utils.py", line 32, in run
    return subprocess.run(command, cwd=cwd, check=check, text=True, stdout=stdout)
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. {}).kopia']' returned non-zero exit status 1.

for the version:
/nix/store/f2psh8ldz2a1svicp2a1l20x38ik1qj2-nixpkgs-review-2.3.1/bin/nix-review

Tests

Just found out about this and now I am intrigued :D

Would it be possible to add running passthru.tests for a derivation being updated before committing?

Example:

nix-update --commit --test sbt and the commit step will only run if the tests have passed.

nix-update will not update a package twice in one day (w/ version=branch)

As I had observed previously, it seems that nix-update will not update a package multiple times in one day.

Example:

Not updating version, already unstable-2023-04-10

However, if we look at that package:

╭ zeph  ~/code/nixcfg 0.02s
╰─▶ cat ./pkgs/nushell/default.nix | ^grep -E "(rev|version|owner|repo) = \""
    version = "unstable-2023-04-10";
    rev = "0e2340051019b581bdb3eeed37310d637b7255c1";
    owner = "colemickens";
    # owner = "nushell";

╭ zeph  ~/code/nixcfg 0.46s
╰─▶ git ls-remote https://github.com/colemickens/nushell | head -1
de76c7a57debfb813f21ff0aedfcfe87b828f20d        HEAD

As shown, there is in fact a newer rev to update to.

Maybe this is intentional, or by design, but it would be nice if the rev were used instead to determine if an update is necessary.

Rust packages: I can't update rust package with `cargoLock`

Hello!
I can't update rust package with cargoLock attribute, it failed. An example package is here. The output of my attempt:

$ nix-update --flake lighthouse
nix eval --json --impure --expr
let

  inherit (builtins) getFlake stringLength substring;
  currentSystem = builtins.currentSystem;
  flake = getFlake "/home/syakovlev/src/private/ethereum.nix";
  pkg = flake.packages.${currentSystem}.lighthouse or flake.lighthouse;
  inherit (flake) outPath;
  outPathLen = stringLength outPath;
  sanitizePosition = { file, ... }@pos:
    assert substring 0 outPathLen file == outPath;
    pos // { file = "/home/syakovlev/src/private/ethereum.nix" + substring outPathLen (stringLength file - outPathLen) file; };

  raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);

  position = if pkg ? isRubyGem then
    raw_version_position
  else if pkg ? isPhpExtension then
    raw_version_position
   else
    sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
  name = pkg.name;
  old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
  inherit raw_version_position;
  filename = position.file;
  line = position.line;
  urls = pkg.src.urls or null;
  url = pkg.src.url or null;
  rev = pkg.src.rev or null;
  hash = pkg.src.outputHash or null;
  vendor_hash = pkg.vendorHash or null;
  vendor_sha256 = pkg.vendorSha256 or null;
  cargo_deps = pkg.cargoDeps.outputHash or null;
  cargo_lock =
    if pkg ? cargoDeps.lockFile then
      (sanitizePosition { file = pkg.cargoDeps.lockFile; }).file
    else
      null;
  npm_deps = pkg.npmDeps.outputHash or null;
  tests = builtins.attrNames (pkg.passthru.tests or {});
  has_update_script = false;
  src_homepage = pkg.src.meta.homepage or null;
  changelog = pkg.meta.changelog or null;
} --extra-experimental-features flakes nix-command
error: assertion '((substring 0 outPathLen file) == outPath)' failed

       at «string»:11:5:

           10|   sanitizePosition = { file, ... }@pos:
           11|     assert substring 0 outPathLen file == outPath;
             |     ^
           12|     pos // { file = "/home/syakovlev/src/private/ethereum.nix" + substring outPathLen (stringLength file - outPathLen) file; };
Traceback (most recent call last):
  File "/nix/store/9xxnv5prf7mryxq06qkifr391dnfb824-nix-update-0.16.0/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/9xxnv5prf7mryxq06qkifr391dnfb824-nix-update-0.16.0/lib/python3.11/site-packages/nix_update/__init__.py", line 287, in main
    package = update(options)
              ^^^^^^^^^^^^^^^
  File "/nix/store/9xxnv5prf7mryxq06qkifr391dnfb824-nix-update-0.16.0/lib/python3.11/site-packages/nix_update/update.py", line 284, in update
    package = eval_attr(opts)
              ^^^^^^^^^^^^^^^
  File "/nix/store/9xxnv5prf7mryxq06qkifr391dnfb824-nix-update-0.16.0/lib/python3.11/site-packages/nix_update/eval.py", line 136, in eval_attr
    res = run(cmd)
          ^^^^^^^^
  File "/nix/store/9xxnv5prf7mryxq06qkifr391dnfb824-nix-update-0.16.0/lib/python3.11/site-packages/nix_update/utils.py", line 36, in run
    return subprocess.run(
           ^^^^^^^^^^^^^^^
  File "/nix/store/hx2c957wpwa6i3fz0wiwhg72sfgq62k1-python3-3.11.2/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--expr', '\nlet\n  \n  inherit (builtins) getFlake stringLength substring;\n  currentSystem = builtins.currentSystem;\n  flake = getFlake "/home/syakovlev/src/private/ethereum.nix";\n  pkg = flake.packages.${currentSystem}.lighthouse or flake.lighthouse;\n  inherit (flake) outPath;\n  outPathLen = stringLength outPath;\n  sanitizePosition = { file, ... }@pos:\n    assert substring 0 outPathLen file == outPath;\n    pos // { file = "/home/syakovlev/src/private/ethereum.nix" + substring outPathLen (stringLength file - outPathLen) file; };\n\n  raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);\n\n  position = if pkg ? isRubyGem then\n    raw_version_position\n  else if pkg ? isPhpExtension then\n    raw_version_position\n   else\n    sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);\nin {\n  name = pkg.name;\n  old_version = pkg.version or (builtins.parseDrvName pkg.name).version;\n  inherit raw_version_position;\n  filename = position.file;\n  line = position.line;\n  urls = pkg.src.urls or null;\n  url = pkg.src.url or null;\n  rev = pkg.src.rev or null;\n  hash = pkg.src.outputHash or null;\n  vendor_hash = pkg.vendorHash or null;\n  vendor_sha256 = pkg.vendorSha256 or null;\n  cargo_deps = pkg.cargoDeps.outputHash or null;\n  cargo_lock =\n    if pkg ? cargoDeps.lockFile then\n      (sanitizePosition { file = pkg.cargoDeps.lockFile; }).file\n    else\n      null;\n  npm_deps = pkg.npmDeps.outputHash or null;\n  tests = builtins.attrNames (pkg.passthru.tests or {});\n  has_update_script = false;\n  src_homepage = pkg.src.meta.homepage or null;\n  changelog = pkg.meta.changelog or null;\n}', '--extra-experimental-features', 'flakes nix-command']' returned non-zero exit status 1.

Without cargoLock everything works fine.
I will try to investigate how to do that, and if it isn't too hard for me I will make PR.

Ref: nix-community/ethereum.nix#218

Revert version change if nix-prefetch fails - or - dont commit if version doesn't change

If nix-prefetch fails the version bump stays saved in the file
Then if you run nix-update --build --commit again it'll just build the "new version" with the old shas and then commit like so:
nerdctl: 0.6.1 -> 0.6.1

I've opened the nix-prefetch issue separately:

Some potential solutions would be:

  • Revert the version change if nix-prefetch fails
  • Don't commit a change if "Not updating version, already 0.6.1" (might be nice if it aborted the build too?)

(either or both)


Config ~/.config/nixpkgs/config.nix:

{
  packageOverrides = pkgs: {
    nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
      inherit pkgs;
    };
  };
}

Should be nothing in there that causes issues

Logs:

nix-update --build --commit nerdctl
$ nix eval --json --impure --experimental-features nix-command --expr (with import ./. {};
    let
      pkg = nerdctl;
      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;

      position = if pkg ? isRubyGem then
        raw_version_position
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      inherit raw_version_position;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
      tests = pkg.passthru.tests or null;
    })
fetch https://github.com/AkihiroSuda/nerdctl/releases.atom
Update 0.6.0 -> 0.6.1 in /home/jk/projects/personal/nixpkgs/pkgs/applications/networking/cluster/nerdctl/default.nix
$ nix-prefetch (import ./. {}).nerdctl
warning: unknown setting 'experimental-features'
warning: unknown setting 'experimental-features'
The package nerdctl-0.6.1 will be fetched as follows:
> fetchFromGitHub {
>   owner = "AkihiroSuda";
>   repo = "nerdctl";
>   rev = "v0.6.1";
>   sha256 = "sha256-QhAN30ge0dbC9dGT1yP4o0VgrcS9+g+r6YJ07ZjPJtg=";
> }

A probably-wrong output hash of zeroes has been used, yet it somehow still succeeded in building.
Please report an issue at: https://github.com/msteen/nix-prefetch/issues
Traceback (most recent call last):
  File "/nix/store/lagdrmaal96m49fh9p012g58mlyvzqa4-nix-update-0.3.2/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/lagdrmaal96m49fh9p012g58mlyvzqa4-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/__init__.py", line 172, in main
    package = update(options)
  File "/nix/store/lagdrmaal96m49fh9p012g58mlyvzqa4-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/update.py", line 139, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/lagdrmaal96m49fh9p012g58mlyvzqa4-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/update.py", line 84, in update_src_hash
    target_hash = nix_prefetch([f"(import {opts.import_path} {{}}).{opts.attribute}"])
  File "/nix/store/lagdrmaal96m49fh9p012g58mlyvzqa4-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/update.py", line 76, in nix_prefetch
    res = run(["nix-prefetch"] + cmd, extra_env=extra_env)
  File "/nix/store/lagdrmaal96m49fh9p012g58mlyvzqa4-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/utils.py", line 36, in run
    return subprocess.run(
  File "/nix/store/papbnjfxwrdkmz6xfp7v2q7nxyvgcr5l-python3-3.8.6/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. {}).nerdctl']' returned non-zero exit status 1.

# ----------- run again ----------------

nix-update --build --commit nerdctl
$ git -C ./. diff --staged
$ nix eval --json --impure --experimental-features nix-command --expr (with import ./. {};
    let
      pkg = nerdctl;
      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;

      position = if pkg ? isRubyGem then
        raw_version_position
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      inherit raw_version_position;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
      tests = pkg.passthru.tests or null;
    })
fetch https://github.com/AkihiroSuda/nerdctl/releases.atom
Not updating version, already 0.6.1
$ nix build --experimental-features nix-command -f ./. nerdctl
$ git -C ./. add /home/jk/projects/personal/nixpkgs/pkgs/applications/networking/cluster/nerdctl/default.nix
$ git -C ./. diff --staged
$ git -C ./. commit --verbose --message nerdctl: 0.6.1 -> 0.6.1
[nerdctl 2e91fd64ff8] nerdctl: 0.6.1 -> 0.6.1
 1 file changed, 1 insertion(+), 1 deletion(-)

Error while updating go package

I'm the maintainer of ntfy-sh and have been using nix-update to help with that. But recently I started getting the error below, and I can't figure out whether it's caused by something that's changed in upstream ntfy.sh or something in nix-update. Or maybe the ntfy-sh package does something wrong?
The upstream release notes don't mention anything about changes to the build method.

nix run nixpkgs#nix-update ntfy-sh
$ nix eval --json --impure --expr 
let
  
  pkgs = import /home/arjan/git/nixpkgs;
  args =  builtins.functionArgs pkgs;
  inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //
           (if args ? overlays then { overlays = [ ]; } else {});
  pkg = (pkgs inputs).ntfy-sh;
  sanitizePosition = x: x;

  raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);

  position = if pkg ? isRubyGem then
    raw_version_position
  else if pkg ? isPhpExtension then
    raw_version_position
   else
    sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
  name = pkg.name;
  old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
  inherit raw_version_position;
  filename = position.file;
  line = position.line;
  urls = pkg.src.urls or null;
  url = pkg.src.url or null;
  rev = pkg.src.rev or null;
  hash = pkg.src.outputHash or null;
  vendor_hash = pkg.vendorHash or null;
  vendor_sha256 = pkg.vendorSha256 or null;
  cargo_deps = pkg.cargoDeps.outputHash or null;
  npm_deps = pkg.npmDeps.outputHash or null;
  tests = builtins.attrNames (pkg.passthru.tests or {});
  has_update_script = pkg.passthru.updateScript or null != null;
  src_homepage = pkg.src.meta.homepage or null;
  changelog = pkg.meta.changelog or null;
} --extra-experimental-features flakes nix-command
fetch https://github.com/binwiederhier/ntfy/releases.atom
Update 2.1.2 -> 2.2.0 in /home/arjan/git/nixpkgs/pkgs/tools/misc/ntfy-sh/default.nix
$ nix-build --expr let src = (import /home/arjan/git/nixpkgs (if (builtins.hasAttr "config" (builtins.functionArgs (import /home/arjan/git/nixpkgs))) then { config.checkMeta = false; overlays = []; } else { })).ntfy-sh.src; in (src.overrideAttrs or (f: src // f src)) (_: { outputHash = ""; outputHashAlgo = "sha256"; }) --extra-experimental-features flakes nix-command
$ nix-build --expr let src = (import /home/arjan/git/nixpkgs (if (builtins.hasAttr "config" (builtins.functionArgs (import /home/arjan/git/nixpkgs))) then { config.checkMeta = false; overlays = []; } else { })).ntfy-sh.go-modules; in (src.overrideAttrs or (f: src // f src)) (_: { outputHash = ""; outputHashAlgo = "sha256"; }) --extra-experimental-features flakes nix-command
Traceback (most recent call last):
  File "/nix/store/zyzyyy1n4sna89dd4fg8z5w6k4bzi1qp-nix-update-0.15.1/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/zyzyyy1n4sna89dd4fg8z5w6k4bzi1qp-nix-update-0.15.1/lib/python3.10/site-packages/nix_update/__init__.py", line 284, in main
    package = update(options)
  File "/nix/store/zyzyyy1n4sna89dd4fg8z5w6k4bzi1qp-nix-update-0.15.1/lib/python3.10/site-packages/nix_update/update.py", line 226, in update
    update_go_modules_hash(opts, package.filename, package.vendor_sha256)
  File "/nix/store/zyzyyy1n4sna89dd4fg8z5w6k4bzi1qp-nix-update-0.15.1/lib/python3.10/site-packages/nix_update/update.py", line 125, in update_go_modules_hash
    target_hash = nix_prefetch(opts, "go-modules")
  File "/nix/store/zyzyyy1n4sna89dd4fg8z5w6k4bzi1qp-nix-update-0.15.1/lib/python3.10/site-packages/nix_update/update.py", line 110, in nix_prefetch
    raise UpdateError(f"empty hash when trying to update {opts.attribute}.{attr}")
nix_update.errors.UpdateError: empty hash when trying to update ntfy-sh.go-modules

Error while trying to update rust package

I thought I'd give this tool a go to update the version of nix-index in nixpkgs, however I ran into the following error:

❯ nix run nixpkgs\#nix-update nix-index
$ nix eval --json --impure --experimental-features nix-command --expr (
    let
      inputs = (if (builtins.hasAttr "overlays" (builtins.functionArgs (import ./.))) then { overlays = []; } else { });
    in
    with import ./. inputs;
    let
      pkg = nix-index;
      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;

      position = if pkg ? isRubyGem then
        raw_version_position
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      inherit raw_version_position;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash or null;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoHash or pkg.cargoSha256 or null;
      tests = builtins.attrNames (pkg.passthru.tests or {});
    })
error: value is null while a set was expected

       at «string»:18:18:

           17|       inherit raw_version_position;
           18|       filename = position.file;
             |                  ^
           19|       line = position.line;
Traceback (most recent call last):
  File "/nix/store/kawbc785116dj3x3a08zk3fc28b2l0x1-nix-update-0.5.0/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/kawbc785116dj3x3a08zk3fc28b2l0x1-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/__init__.py", line 196, in main
    package = update(options)
  File "/nix/store/kawbc785116dj3x3a08zk3fc28b2l0x1-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/update.py", line 140, in update
    package = eval_attr(opts)
  File "/nix/store/kawbc785116dj3x3a08zk3fc28b2l0x1-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/eval.py", line 89, in eval_attr
    res = run(cmd)
  File "/nix/store/kawbc785116dj3x3a08zk3fc28b2l0x1-nix-update-0.5.0/lib/python3.9/site-packages/nix_update/utils.py", line 35, in run
    return subprocess.run(
  File "/nix/store/jkfriidvazhzbm941q8m46397q8amnqs-python3-3.9.6/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--experimental-features', 'nix-command', '--expr', '(\n    let\n      inputs = (if (builtins.hasAttr "overlays" (builtins.functionArgs (import ./.))) then { overlays = []; } else { });\n    in\n    with import ./. inputs;\n    let\n      pkg = nix-index;\n      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;\n\n      position = if pkg ? isRubyGem then\n        raw_version_position\n      else\n        builtins.unsafeGetAttrPos "src" pkg;\n    in {\n      name = pkg.name;\n      old_version = (builtins.parseDrvName pkg.name).version;\n      inherit raw_version_position;\n      filename = position.file;\n      line = position.line;\n      urls = pkg.src.urls or null;\n      url = pkg.src.url or null;\n      rev = pkg.src.url.rev or null;\n      hash = pkg.src.outputHash or null;\n      mod_sha256 = pkg.modSha256 or null;\n      vendor_sha256 = pkg.vendorSha256 or null;\n      cargo_sha256 = pkg.cargoHash or pkg.cargoSha256 or null;\n      tests = builtins.attrNames (pkg.passthru.tests or {});\n    })']' returned non-zero exit status 1.

RE create pull requests

the todo-list states:

create pull requests

I'd suggest leaving such to dedicated cli, such as gh, good old linux style.

It has the added benefit of a superior wowkflow integration, eg with github issue/pr templates.

Using pname prefix breaks some tagging convention with github

example would the the python3Packages.lxml package, the original:

buildPythonPackage rec {
  pname = "lxml";
  version = "4.5.0";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "${pname}-${version}";
    sha256 = "1i3bhg8xb502afq4ar3kgvvi1hy83l4af2gznfwqvb5b221fr7ak";
  };

but then nix-update wants to change this to:

The package python3.8-lxml-lxml-4.5.1 will be fetched as follows:
> fetchFromGitHub {
>   owner = "lxml";
>   repo = "lxml";
>   rev = "lxml-lxml-4.5.1";
>   sha256 = "1i3bhg8xb502afq4ar3kgvvi1hy83l4af2gznfwqvb5b221fr7ak";
> }

trying https://github.com/lxml/lxml/archive/lxml-lxml-4.5.1.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   126  100   126    0     0    229      0 --:--:-- --:--:-- --:--:--   229
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found

maybe have a way to try with the prefix, then try without a prefix? or have an option to not touch rev?

Version vs GitHub tag

Here's tectonic's expression:

rustPlatform.buildRustPackage rec {
  pname = "tectonic";
  version = "0.1.15";

  src = fetchFromGitHub {
    owner = "tectonic-typesetting";
    repo = "tectonic";
    rev = "tectonic@${version}";
    sha256 = "0pzhdfsi4jsj9p5cv8ia4kc4inl7q7jsw694dfyxkcpka6ywyzsh";
  };

They use an awful revisions schema, I know. I'm a bit surprised though that nix-update isn't resiliant to this:

>>> nix-update --version 0.1.16 tectonic
$ nix eval --json (with import ./. {};
    let
      pkg = tectonic;
      position = if pkg ? isRubyGem then
        builtins.unsafeGetAttrPos "version" pkg
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
    })
Traceback (most recent call last):
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/__init__.py", line 142, in main
    package = update(options)
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 65, in update
    package = eval_attr(opts)
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/eval.py", line 57, in eval_attr
    raise UpdateError(
nix_update.errors.UpdateError: Nix's builtins.parseDrvName could not parse the version from tectonic-tectonic%400.1.16

I'd expect it to just update what is written in version = . When nix-update tries to fetch the latest tag by itself, it fails similarly:

>>> nix-update tectonic
$ nix eval --json (with import ./. {};
    let
      pkg = tectonic;
      position = if pkg ? isRubyGem then
        builtins.unsafeGetAttrPos "version" pkg
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
    })
fetch https://github.com/tectonic-typesetting/tectonic/releases.atom
Update 0.1.15 -> tectonic%400.1.16 in /home/doron/repos/nixpkgs/pkgs/tools/typesetting/tectonic/default.nix
$ nix-prefetch (import ./. {}).tectonic
The package tectonic-tectonic%400.1.16 will be fetched as follows:
> fetchFromGitHub {
>   owner = "tectonic-typesetting";
>   repo = "tectonic";
>   rev = "tectonic@tectonic%400.1.16";
>   sha256 = "0pzhdfsi4jsj9p5cv8ia4kc4inl7q7jsw694dfyxkcpka6ywyzsh";
> }

trying https://github.com/tectonic-typesetting/tectonic/archive/tectonic@tectonic%400.1.16.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   159  100   159    0     0    395      0 --:--:-- --:--:-- --:--:--   396
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
error: cannot download source from any mirror
builder for '/nix/store/ja73m41fanwdcxf22xlypp8zr0iwwxvf-source.drv' failed with exit code 1
error: build of '/nix/store/ja73m41fanwdcxf22xlypp8zr0iwwxvf-source.drv' failed
Traceback (most recent call last):
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/__init__.py", line 142, in main
    package = update(options)
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 82, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 42, in update_src_hash
    target_hash = nix_prefetch([f"(import {opts.import_path} {{}}).{opts.attribute}"])
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 37, in nix_prefetch
    res = run(["nix-prefetch"] + cmd)
  File "/nix/store/c9za2shgsx4yfc5dh1r0xgmxaxgp11c0-nix-update-0.1/lib/python3.8/site-packages/nix_update/utils.py", line 32, in run
    return subprocess.run(command, cwd=cwd, check=check, text=True, stdout=stdout)
  File "/nix/store/z65l1jqvxa58zzwwa3bvglb6asj4y8cv-python3-3.8.5/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. {}).tectonic']' returned non-zero exit status 1.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): lock file maintenance

Detected dependencies

github-actions
.github/workflows/nix-fmt-checks.yaml
  • actions/checkout v3
  • cachix/install-nix-action v22
.github/workflows/test.yml
  • actions/checkout v3
  • cachix/install-nix-action v22
nix
flake.nix
  • nixpkgs nixpkgs-unstable
setup-cfg
setup.cfg

Trying to update to a version that doesn't exist changes package version

If I do the following:

 nix-update --version 517748bcac9484df6a1f03c84f77c9a066ed8793 "pantheon.elementary-calculator"

we will get a traceback

curl: (22) The requested URL returned error: 404 Not Found
error: cannot download source from any mirror
builder for '/nix/store/swrqgasi5gr6508qk9hq30r1hk67v48y-source.drv' failed with exit code 1
error: build of '/nix/store/swrqgasi5gr6508qk9hq30r1hk67v48y-source.drv' failed
Traceback (most recent call last):
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/__init__.py", line 142, in main
    package = update(options)
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 82, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 42, in update_src_hash
    target_hash = nix_prefetch([f"(import {opts.import_path} {{}}).{opts.attribute}"])
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 37, in nix_prefetch
    res = run(["nix-prefetch"] + cmd)
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/utils.py", line 32, in run
    return subprocess.run(command, cwd=cwd, check=check, text=True, stdout=stdout)
  File "/nix/store/f87w21b91cws0wbsvyfn5vnlyv491czi-python3-3.8.3/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. {}).pantheon.elementary-calculator']' returned non-zero exit status 1.

because that archive doesn't exist.

But this has now written to the expression to have the version 517748bcac9484df6a1f03c84f77c9a066ed8793.

I believe this will require more safely modifying files by not modifying them in place until we know we have a success?

Fails to determine runtime directory on macOS

$ nix-update driftnet                                     
$ nix eval --json (with import ./. {};
    let
      pkg = driftnet;
      position = if pkg ? isRubyGem then
        builtins.unsafeGetAttrPos "version" pkg
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
    })
fetch https://github.com/deiv/driftnet/releases.atom
Update 1.1.5 -> 1.3.0 in /Users/siraben/Git/forks/nixpkgs/pkgs/tools/networking/driftnet/default.nix
$ nix-prefetch (import ./. {}).driftnet
error: Could not determine the runtime directory (i.e. XDG_RUNTIME_DIR).
Traceback (most recent call last):
  File "/nix/store/iyvrjsrqn7najwmwh5y13dmpg1z7068m-nix-update-0.1/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/iyvrjsrqn7najwmwh5y13dmpg1z7068m-nix-update-0.1/lib/python3.8/site-packages/nix_update/__init__.py", line 142, in main
    package = update(options)
  File "/nix/store/iyvrjsrqn7najwmwh5y13dmpg1z7068m-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 82, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/iyvrjsrqn7najwmwh5y13dmpg1z7068m-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 42, in update_src_hash
    target_hash = nix_prefetch([f"(import {opts.import_path} {{}}).{opts.attribute}"])
  File "/nix/store/iyvrjsrqn7najwmwh5y13dmpg1z7068m-nix-update-0.1/lib/python3.8/site-packages/nix_update/update.py", line 37, in nix_prefetch
    res = run(["nix-prefetch"] + cmd)
  File "/nix/store/iyvrjsrqn7najwmwh5y13dmpg1z7068m-nix-update-0.1/lib/python3.8/site-packages/nix_update/utils.py", line 32, in run
    return subprocess.run(command, cwd=cwd, check=check, text=True, stdout=stdout)
  File "/nix/store/65gmh01007csxmd6bbkvas8zkhlw0k7n-python3-3.8.6/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. {}).driftnet']' returned non-zero exit status 1.

rust package updates, then breaks on next (should be idempotent) invocation

I just noticed this as I was packing up but wanted to file it real quick.

--commit behaves... other than I would expect.

Right now, I'm running it in a loop with two packages. I'm running:

nix-update --flake --build --format --version branch --commit '.#pkgs.x86_64-linux.{pkgname} and it's doing this:

  • makes a commit:
    commit 1f7fb506e2bed516f80497e7fc5af17bbedda86e (HEAD -> main)
    Author: Cole Mickens <[email protected]>
    Date:   Thu Apr 6 16:00:45 2023 -0500
    
        pkgs.x86_64-linux.nushell: 943d0d1b2dc83e89c5f87338505607e3beaf4222 -> unstable-2023-04-06
    
        Diff: https://github.com/nushell/nushell/compare/943d0d1b2dc83e89c5f87338505607e3beaf4222...a29b61bd4f63469fdeab5aee25ab5f004d0413d7
    
  • spits this out and stops with -1 exit code
    0 / 1 have been reformatted
    On branch main
    Your branch and 'origin/main' refer to different commits.
      (use "git status --ahead-behind" for details)
    
    nothing to commit, working tree clean
    

error: syntax error, unexpected ')', expecting ';', at (string):5:346

I'm using flakes.

nix run github:Mic92/nix-update syncthing

$ nix-prefetch { sha256 }: (import ./. (if (builtins.hasAttr "config" (builtins.functionArgs (import ./.))) then { config.checkMeta = false; } else { }))).syncthing.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })
warning: unknown setting 'experimental-features'
warning: unknown setting 'experimental-features'
error: syntax error, unexpected ')', expecting ';', at (string):5:346
Traceback (most recent call last):
  File "/nix/store/amswx23as857lf0ds13av8jgwyadhymd-nix-update/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/amswx23as857lf0ds13av8jgwyadhymd-nix-update/lib/python3.8/site-packages/nix_update/__init__.py", line 194, in main
    package = update(options)
  File "/nix/store/amswx23as857lf0ds13av8jgwyadhymd-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 155, in update
    update_go_vendor_hash(opts, package.filename, package.vendor_sha256)
  File "/nix/store/amswx23as857lf0ds13av8jgwyadhymd-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 102, in update_go_vendor_hash
    target_hash = nix_prefetch([expr])
  File "/nix/store/amswx23as857lf0ds13av8jgwyadhymd-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 77, in nix_prefetch
    res = run(["nix-prefetch"] + cmd, extra_env=extra_env)
  File "/nix/store/amswx23as857lf0ds13av8jgwyadhymd-nix-update/lib/python3.8/site-packages/nix_update/utils.py", line 35, in run
    return subprocess.run(
  File "/nix/store/5470xw15wnn972ap0c4f7q642z4nvh6f-python3-3.8.8/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '{ sha256 }: (import ./. (if (builtins.hasAttr "config" (builtins.functionArgs (import ./.))) then { config.checkMeta = false; } else { }))).syncthing.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })']' returned non-zero exit status 1.

"v" prefix disappears from download url

following up on https://github.com/ripose-jp/Memento/releases/tag/v1.2.1 I tried to run nix-update but the v disappears from the tag which makes the download fail:

nix-update memento
$ nix eval --json --impure --expr 
let
  
  pkgs = import /home/teto/nixpkgs;
  args =  builtins.functionArgs pkgs;
  inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //
           (if args ? overlays then { overlays = [ ]; } else {});
  pkg = (pkgs inputs)."memento";
  sanitizePosition = x: x;

  raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);

  position = if pkg ? isRubyGem then
    raw_version_position
  else if pkg ? isPhpExtension then
    raw_version_position
   else
    sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
  name = pkg.name;
  old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
  inherit raw_version_position;
  filename = position.file;
  line = position.line;
  urls = pkg.src.urls or null;
  url = pkg.src.url or null;
  rev = pkg.src.rev or null;
  hash = pkg.src.outputHash or null;
  go_modules = pkg.goModules.outputHash or null;
  go_modules_old = pkg.go-modules.outputHash or null;
  cargo_deps = pkg.cargoDeps.outputHash or null;
  raw_cargo_lock =
    if pkg ? cargoDeps.lockFile then
      let
        inherit (pkg.cargoDeps) lockFile;
        res = builtins.tryEval (sanitizePosition {
          file = toString lockFile;
        });
      in
      if res.success then res.value.file else false
    else
      null;
  npm_deps = pkg.npmDeps.outputHash or null;
  tests = builtins.attrNames (pkg.passthru.tests or {});
  has_update_script = pkg.passthru.updateScript or null != null;
  src_homepage = pkg.src.meta.homepage or null;
  changelog = pkg.meta.changelog or null;
} --extra-experimental-features flakes nix-command
fetch https://github.com/ripose-jp/Memento/releases.atom
Update v1.1.0 -> 1.2.1 in /home/teto/nixpkgs/pkgs/applications/video/memento/default.nix
$ nix-build --expr let src = (import /home/teto/nixpkgs (if (builtins.hasAttr "config" (builtins.functionArgs (import /home/teto/nixpkgs))) then { config.checkMeta = false; overlays = []; } else { }))."memento".src; in (src.overrideAttrs or (f: src // f src)) (_: { outputHash = ""; outputHashAlgo = "sha256"; }) --extra-experimental-features flakes nix-command
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
  /nix/store/jd537018hgi75y6s5k1p67qcqcdpb1ap-source.drv
building '/nix/store/jd537018hgi75y6s5k1p67qcqcdpb1ap-source.drv'...

trying https://github.com/ripose-jp/Memento/archive/1.2.1.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  0    14    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0
curl: (22) The requested URL returned error: 404
error: cannot download source from any mirror
note: keeping build directory '/tmp/nix-build-source.drv-2'
error: boost::bad_format_string: format-string is ill-formed

using nix-update from unstable, aka 0.19.3

error: assertion '(stdenv).isLinux' failed

trying to run the command nix-update caddy I'm getting the following error

❯ nix-update caddy
$ nix eval --json --impure --experimental-features nix-command --expr (with import ./. {};
    let
      pkg = caddy;
      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;

      position = if pkg ? isRubyGem then
        raw_version_position
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      inherit raw_version_position;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
      tests = pkg.passthru.tests or null;
    })
error: assertion '(stdenv).isLinux' failed

       at /Users/raphael/Projects/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix:69:1:

           68|
           69| assert stdenv.isLinux;
             | ^
           70|
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
  File "/nix/store/v719fxgpkqmg5scysxiqmprn52j8sbzj-nix-update-0.4.0/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/v719fxgpkqmg5scysxiqmprn52j8sbzj-nix-update-0.4.0/lib/python3.9/site-packages/nix_update/__init__.py", line 194, in main
    package = update(options)
  File "/nix/store/v719fxgpkqmg5scysxiqmprn52j8sbzj-nix-update-0.4.0/lib/python3.9/site-packages/nix_update/update.py", line 140, in update
    package = eval_attr(opts)
  File "/nix/store/v719fxgpkqmg5scysxiqmprn52j8sbzj-nix-update-0.4.0/lib/python3.9/site-packages/nix_update/eval.py", line 84, in eval_attr
    res = run(cmd)
  File "/nix/store/v719fxgpkqmg5scysxiqmprn52j8sbzj-nix-update-0.4.0/lib/python3.9/site-packages/nix_update/utils.py", line 35, in run
    return subprocess.run(
  File "/nix/store/ad19ya4siaxhz63w0m8xh97067iahks0-python3-3.9.6/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--experimental-features', 'nix-command', '--expr', '(with import ./. {};\n    let\n      pkg = caddy;\n      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;\n\n      position = if pkg ? isRubyGem then\n        raw_version_position\n      else\n        builtins.unsafeGetAttrPos "src" pkg;\n    in {\n      name = pkg.name;\n      old_version = (builtins.parseDrvName pkg.name).version;\n      inherit raw_version_position;\n      filename = position.file;\n      line = position.line;\n      urls = pkg.src.urls or null;\n      url = pkg.src.url or null;\n      rev = pkg.src.url.rev or null;\n      hash = pkg.src.outputHash;\n      mod_sha256 = pkg.modSha256 or null;\n      vendor_sha256 = pkg.vendorSha256 or null;\n      cargo_sha256 = pkg.cargoSha256 or null;\n      tests = pkg.passthru.tests or null;\n    })']' returned non-zero exit status 1

even though caddy builds fine on darwin.
Let me know if I you need more details.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Detected dependencies

github-actions
.github/workflows/nix-fmt-checks.yaml
  • actions/checkout v3
  • cachix/install-nix-action v22
.github/workflows/test.yml
  • actions/checkout v3
  • cachix/install-nix-action v22
nix
flake.nix
  • nixpkgs nixpkgs-unstable
setup-cfg
setup.cfg

  • Check this box to trigger a request for Renovate to run again on this repository

Allow passing system

I have for any system an own fetchurl and want to update them all. It would be nice if I could redo it for an different system

Add changelog to commit message

Making use of meta.changelog to embed the changelog URL into the commit message would be a neat way to automatically create links to them, which are useful during review.

  • getting pkg.meta.changelog or null is easy
  • running eval another time is probably required to let nix interpret meta.changelog post-update & pre-commit
  • append to commit message with two newlines if it exists

That's all.

error: undefined variable 'nix_2_4'

❯ nix run github:Mic92/nix-update kopia
error: undefined variable 'nix_2_4'

       at /nix/store/x8963x5f782knqwayzx28zcrqryhrgky-source/default.nix:30:72:

           29|   makeWrapperArgs = [
           30|     "--prefix PATH" ":" (lib.makeBinPath [ pkgs.nixVersions.nix_2_4 or nix_2_4 nix-prefetch nixpkgs-fmt nixpkgs-review ])
             |                                                                        ^
           31|   ];
(use '--show-trace' to show detailed location information)

Possibly incorrect expression for cargoDeps?

Currently, cargoSha256 is updated as:

pkg.cargoDeps.overrideAttrs (_: {{ inherit sha256; }})

I'm curious if this is correct. Based on the source for fetchCargoTarball, sha256 is never passed to mkDerivation (see the removeAttrs at the bottom. Wouldn't you want to override outputHash? Here's a similar conversation:

https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393

Note that they also override the src attribute for both cargoDeps and the package.

nix-update fails on cargo packages with git deps

error: A hash was specified for reedline-0.18.0, but there is no corresponding git dependency.

I just hit this when updating nushell again. It seems nix-update doesn't handle removed git cargo deps?

attribute names should not be quoted unconditionally

The PRs associated with #178 added the escaping of attribute names.
Because of this, it is impossible to evaluate packages with namespaces such as python3Packages in nixpkgs.

$ nix run github:Mic92/nix-update/0.19.2#nix-update -- python310Packages.streamlit

...
error: attribute '"python310Packages.streamlit"' missing

       at «string»:8:9:

            7|            (if args ? overlays then { overlays = [ ]; } else {});
            8|   pkg = (pkgs inputs)."python310Packages.streamlit";
             |         ^
            9|   sanitizePosition = x: x;
Traceback (most recent call last):
...

Really, we could just do this unconditionally, since there isn't any real difference between x.y and x."y" other than variable interpolation?

This is precisely the problem. Quoting them prevents expanding the namespace.

trace some variables to make debugging easier

Hi.

I'm trying to use nix-update to update nushell to the tip-of-tree of my fork. I got it to work once, but now it seems to fail:

error: assertion '((substring 0 outPathLen file) == outPath)' failed

It would be helpful if outPath/file were traced so I could have a better idea of what's going on

`fetchgit` and `hash` don't go together

For expressions that use fetchgit, e.g. through fetchSubmodules = true, and hash instead of sha256, nix-update fails to work.
This can e.g. be reproduced with nix-update --commit chatty --version 0.6.1:

$ git -C ./. diff --staged
$ nix eval --json --impure --experimental-features nix-command --expr (
    let
      inputs = (if (builtins.hasAttr "overlays" (builtins.functionArgs (import ./.))) then { overlays = []; } else { });
    in
    with import ./. inputs;
    let
      pkg = chatty;
      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;

      position = if pkg ? isRubyGem then
        raw_version_position
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      inherit raw_version_position;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash or null;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoHash or pkg.cargoSha256 or null;
      tests = builtins.attrNames (pkg.passthru.tests or {});
    })
Update 0.6.0 -> 0.6.1 in ./pkgs/applications/networking/instant-messengers/chatty/default.nix
$ nix-prefetch (import ./. (if (builtins.hasAttr "config" (builtins.functionArgs (import ./.))) then { config.checkMeta = false; overlays = []; } else { })).chatty
error: Only one of sha256 or hash can be set

I also don't understand why nix-update --commit chatty fails to find the newest version but assume it's because internally fetchgit is used.

Slashes in the name of an attribute result in a parse error, and should be put in quotes

Consider the following example (which I'm afraid I can't release the code to), where I want to update an attribute under the name psql_15/exts/pg_hashids — traceback and some fluff omitted:

$ nix-update --flake --version=branch psql_15/exts/pg_hashids

...
error: undefined variable 'or'

       at «string»:7:40:

            6|   flake = getFlake "/home/austin/work/nix-postgres";
            7|   pkg = flake.packages.${currentSystem}.psql_15/exts/pg_hashids or flake.psql_15/exts/pg_hashids;
             |                                        ^
            8|   inherit (flake) outPath;
Traceback (most recent call last):
...

The error'ing line itself is pretty clear:

pkg = flake.packages.${currentSystem}.psql_15/exts/pg_hashids or flake.psql_15/exts/pg_hashids;

The name is generated by way of flattenTree from flake-utils so, it isn't exactly a super strange case IMO. I think just enclosing the name in general is enough if there's a slash. Really, we could just do this unconditionally, since there isn't any real difference between x.y and x."y" other than variable interpolation?

The following command works, in contrast, but is obviously strange:

nix-update --flake --version=branch \"psql_15/exts/pg_hashids\"

cargoSha256 in packages with local sources

I am trying to see if nix-update can update the cargoSha256 in https://github.com/dfinity/motoko/blob/master/nix/drun.nix, but it doesn’t quite work:

~/dfinity/motoko/nix $ nix-update --version=skip drun
$ nix eval --json --impure --experimental-features nix-command --expr (with import ./. {};
    let
      pkg = drun;
      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;

      position = if pkg ? isRubyGem then
        raw_version_position
      else
        builtins.unsafeGetAttrPos "src" pkg;
    in {
      name = pkg.name;
      old_version = (builtins.parseDrvName pkg.name).version;
      inherit raw_version_position;
      filename = position.file;
      line = position.line;
      urls = pkg.src.urls or null;
      url = pkg.src.url or null;
      rev = pkg.src.url.rev or null;
      hash = pkg.src.outputHash;
      mod_sha256 = pkg.modSha256 or null;
      vendor_sha256 = pkg.vendorSha256 or null;
      cargo_sha256 = pkg.cargoSha256 or null;
      tests = pkg.passthru.tests or null;
    })
error: value is a string with context while a set was expected

       at «string»:19:14:

           18|       rev = pkg.src.url.rev or null;
           19|       hash = pkg.src.outputHash;
             |              ^
           20|       mod_sha256 = pkg.modSha256 or null;
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
  File "/nix/store/l6iiy0siwpfs0ifr1khql90hazhxgq2z-nix-update-0.4.0/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/l6iiy0siwpfs0ifr1khql90hazhxgq2z-nix-update-0.4.0/lib/python3.8/site-packages/nix_update/__init__.py", line 194, in main
    package = update(options)
  File "/nix/store/l6iiy0siwpfs0ifr1khql90hazhxgq2z-nix-update-0.4.0/lib/python3.8/site-packages/nix_update/update.py", line 140, in update
    package = eval_attr(opts)
  File "/nix/store/l6iiy0siwpfs0ifr1khql90hazhxgq2z-nix-update-0.4.0/lib/python3.8/site-packages/nix_update/eval.py", line 84, in eval_attr
    res = run(cmd)
  File "/nix/store/l6iiy0siwpfs0ifr1khql90hazhxgq2z-nix-update-0.4.0/lib/python3.8/site-packages/nix_update/utils.py", line 35, in run
    return subprocess.run(
  File "/nix/store/kp64y3b6hlr760f073j0gk16bs3bhkh4-python3-3.8.9/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--experimental-features', 'nix-command', '--expr', '(with import ./. {};\n    let\n      pkg = drun;\n      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;\n\n      position = if pkg ? isRubyGem then\n        raw_version_position\n      else\n        builtins.unsafeGetAttrPos "src" pkg;\n    in {\n      name = pkg.name;\n      old_version = (builtins.parseDrvName pkg.name).version;\n      inherit raw_version_position;\n      filename = position.file;\n      line = position.line;\n      urls = pkg.src.urls or null;\n      url = pkg.src.url or null;\n      rev = pkg.src.url.rev or null;\n      hash = pkg.src.outputHash;\n      mod_sha256 = pkg.modSha256 or null;\n      vendor_sha256 = pkg.vendorSha256 or null;\n      cargo_sha256 = pkg.cargoSha256 or null;\n      tests = pkg.passthru.tests or null;\n    })']' returned non-zero exit status 1.

I guess the reason is that the src is not a fetch’ed thing, but rather a subdirectory of a niv-fetched source?

error: value is null while a set was expected

nix run github:Mic92/nix-update anytype

error: value is null while a set was expected

       at «string»:18:18:

           17|       inherit raw_version_position;
           18|       filename = position.file;
             |                  ^
           19|       line = position.line;
Traceback (most recent call last):
  File "/nix/store/i5f1rbgm28nbfawv1byszzmdsh431hq5-nix-update/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/i5f1rbgm28nbfawv1byszzmdsh431hq5-nix-update/lib/python3.9/site-packages/nix_update/__init__.py", line 217, in main
    package = update(options)
  File "/nix/store/i5f1rbgm28nbfawv1byszzmdsh431hq5-nix-update/lib/python3.9/site-packages/nix_update/update.py", line 140, in update
    package = eval_attr(opts)
  File "/nix/store/i5f1rbgm28nbfawv1byszzmdsh431hq5-nix-update/lib/python3.9/site-packages/nix_update/eval.py", line 89, in eval_attr
    res = run(cmd)
  File "/nix/store/i5f1rbgm28nbfawv1byszzmdsh431hq5-nix-update/lib/python3.9/site-packages/nix_update/utils.py", line 35, in run
    return subprocess.run(
  File "/nix/store/afi0ysqw20yiiw2gr2d28dx40bc4ddf8-python3-3.9.10/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--experimental-features', 'nix-command', '--expr', '(\n    let\n      inputs = (if (builtins.hasAttr "overlays" (builtins.functionArgs (import ./.))) then { overlays = []; } else { });\n    in\n    with import ./. inputs;\n    let\n      pkg = anytype;\n      raw_version_position = builtins.unsafeGetAttrPos "version" pkg;\n\n      position = if pkg ? isRubyGem then\n        raw_version_position\n      else\n        builtins.unsafeGetAttrPos "src" pkg;\n    in {\n      name = pkg.name;\n      old_version = (builtins.parseDrvName pkg.name).version;\n      inherit raw_version_position;\n      filename = position.file;\n      line = position.line;\n      urls = pkg.src.urls or null;\n      url = pkg.src.url or null;\n      rev = pkg.src.url.rev or null;\n      hash = pkg.src.outputHash or null;\n      mod_sha256 = pkg.modSha256 or null;\n      vendor_sha256 = pkg.vendorSha256 or null;\n      cargo_sha256 = pkg.cargoHash or pkg.cargoSha256 or null;\n      tests = builtins.attrNames (pkg.passthru.tests or {});\n    })']' returned non-zero exit status 1.

package doesn't build correctly

I tried building nix-update but running it gives this error:

% /nix/store/3qf1766s2bkwfryawdlnznzyx9ww56n2-nix-update-2020-04-21/bin/nix-update  
Traceback (most recent call last):
  File "/nix/store/3qf1766s2bkwfryawdlnznzyx9ww56n2-nix-update-2020-04-21/bin/.nix-update-wrapped", line 6, in <module>
    from nix_update import main
  File "/nix/store/3qf1766s2bkwfryawdlnznzyx9ww56n2-nix-update-2020-04-21/lib/python3.7/site-packages/nix_update/__init__.py", line 9, in <module>
    from .update import update
  File "/nix/store/3qf1766s2bkwfryawdlnznzyx9ww56n2-nix-update-2020-04-21/lib/python3.7/site-packages/nix_update/update.py", line 9, in <module>
    from .version import fetch_latest_version
ModuleNotFoundError: No module named 'nix_update.version'

It seems that the version module is not included by setuptools at build time:

Executing setuptoolsBuildPhase
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/nix_update
copying nix_update/utils.py -> build/lib/nix_update
copying nix_update/update.py -> build/lib/nix_update
copying nix_update/options.py -> build/lib/nix_update
copying nix_update/eval.py -> build/lib/nix_update
copying nix_update/errors.py -> build/lib/nix_update
copying nix_update/__init__.py -> build/lib/nix_update
running egg_info
creating nix_update.egg-info
writing nix_update.egg-info/PKG-INFO
writing dependency_links to nix_update.egg-info/dependency_links.txt
writing entry points to nix_update.egg-info/entry_points.txt
writing top-level names to nix_update.egg-info/top_level.txt
writing manifest file 'nix_update.egg-info/SOURCES.txt'
reading manifest file 'nix_update.egg-info/SOURCES.txt'
writing manifest file 'nix_update.egg-info/SOURCES.txt'
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/nix_update
copying build/lib/nix_update/__init__.py -> build/bdist.linux-x86_64/wheel/nix_update
copying build/lib/nix_update/errors.py -> build/bdist.linux-x86_64/wheel/nix_update
copying build/lib/nix_update/eval.py -> build/bdist.linux-x86_64/wheel/nix_update
copying build/lib/nix_update/options.py -> build/bdist.linux-x86_64/wheel/nix_update
copying build/lib/nix_update/update.py -> build/bdist.linux-x86_64/wheel/nix_update
copying build/lib/nix_update/utils.py -> build/bdist.linux-x86_64/wheel/nix_update
running install_egg_info
Copying nix_update.egg-info to build/bdist.linux-x86_64/wheel/nix_update-0.0.0-py3.7.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/nix_update-0.0.0.dist-info/WHEEL
creating 'dist/nix_update-0.0.0-py2.py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'nix_update/__init__.py'
adding 'nix_update/errors.py'
adding 'nix_update/eval.py'
adding 'nix_update/options.py'
adding 'nix_update/update.py'
adding 'nix_update/utils.py'
adding 'nix_update-0.0.0.dist-info/LICENSE.rst'
adding 'nix_update-0.0.0.dist-info/METADATA'
adding 'nix_update-0.0.0.dist-info/WHEEL'
adding 'nix_update-0.0.0.dist-info/entry_points.txt'
adding 'nix_update-0.0.0.dist-info/top_level.txt'
adding 'nix_update-0.0.0.dist-info/zip-safe'
adding 'nix_update-0.0.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Finished executing setuptoolsBuildPhase

I tried using both NUR and nix-build -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixpkgs-unstable.tar.gz from the root of this repo.

Requirements for auto-updating

As mentioned in this comment, it would be awesome to document how a package must be written to be auto-updateable.

Maybe also mention the relationship to this update mechanism.

For me, it is hard to understand how to make your package auto-updateable for nixpkgs in the "preferred way".

error building master

I'm getting this error when building master.

nix-update> ## run mypy
nix-update> tests/conftest.py:31: error:(B unused (B"type: ignore"(B comment(B
nix-update> Found 1 error in 1 file (checked 20 source files)(B

it seems the ci is not catching it though. (I'm trying to run this with the latest nixpkgs master)

black: command not found

error while trying to update the flake to the latest version

 > ## run black
       > /nix/store/ibgiw134amh5hj4znpay84s7dlb550yj-stdenv-darwin/setup: line 1579: black: command not found

Updating rust packages fails to calculate cargoSha256

Updating topgrade fails for me and I am not sure why.

nix-update topgrade                                                                                                                                                                      $ nix eval --json --impure --experimental-features nix-command --expr (with import ./. {};                                                                                                      let                                                                                                                                                                                           pkg = topgrade;                                                                                                                                                                             raw_version_position = builtins.unsafeGetAttrPos "version" pkg;                                                                                                                                                                                                                                                                                                                         position = if pkg ? isRubyGem then                                                                                                                                                            raw_version_position                                                                                                                                                                      else                                                                                                                                                                                          builtins.unsafeGetAttrPos "src" pkg;                                                                                                                                                    in {                                                                                                                                                                                          name = pkg.name;                                                                                                                                                                            old_version = (builtins.parseDrvName pkg.name).version;                                                                                                                                     inherit raw_version_position;                                                                                                                                                               filename = position.file;                                                                                                                                                                   line = position.line;                                                                                                                                                                       urls = pkg.src.urls or null;                                                                                                                                                                url = pkg.src.url or null;                                                                                                                                                                  rev = pkg.src.url.rev or null;                                                                                                                                                              hash = pkg.src.outputHash;                                                                                                                                                                  mod_sha256 = pkg.modSha256 or null;                                                                                                                                                         vendor_sha256 = pkg.vendorSha256 or null;                                                                                                                                                   cargo_sha256 = pkg.cargoSha256 or null;                                                                                                                                                     tests = pkg.passthru.tests or null;
    })
fetch https://github.com/r-darwish/topgrade/releases.atom
Update 6.5.0 -> 6.5.1 in /home/hotpi/src/nixpkgs2/pkgs/tools/misc/topgrade/default.nix
$ nix-prefetch (import ./. {}).topgrade
The package topgrade-6.5.1 will be fetched as follows:
> fetchFromGitHub {
>   owner = "r-darwish";
>   repo = "topgrade";
>   rev = "v6.5.1";
>   sha256 = "sha256-O2k9eUs+aopwtT/DXYIv9pc9z8W4K6cXUE6diqNDTrg=";
> }

$ nix-prefetch { sha256 }: (import ./. {}).topgrade.cargoDeps.overrideAttrs (_: { inherit sha256; })
error: attribute 'homepage' missing, at /home/hotpi/src/nixpkgs2/pkgs/tools/compression/brotli/default.nix:55:21
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
  File "/nix/store/slnv8k2wcblchd0zgs2h5zx4kjgf7hpk-nix-update-0.3.2/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/slnv8k2wcblchd0zgs2h5zx4kjgf7hpk-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/__init__.py", line 172, in main
    package = update(options)
  File "/nix/store/slnv8k2wcblchd0zgs2h5zx4kjgf7hpk-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/update.py", line 148, in update
    update_cargo_sha256_hash(opts, package.filename, package.cargo_sha256)
  File "/nix/store/slnv8k2wcblchd0zgs2h5zx4kjgf7hpk-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/update.py", line 102, in update_cargo_sha256_hash
    target_hash = nix_prefetch([expr])
  File "/nix/store/slnv8k2wcblchd0zgs2h5zx4kjgf7hpk-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/update.py", line 76, in nix_prefetch
    res = run(["nix-prefetch"] + cmd, extra_env=extra_env)
  File "/nix/store/slnv8k2wcblchd0zgs2h5zx4kjgf7hpk-nix-update-0.3.2/lib/python3.8/site-packages/nix_update/utils.py", line 36, in run
    return subprocess.run(
  File "/nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '{ sha256 }: (import ./. {}).topgrade.cargoDeps.overrideAttrs (_: { inherit sha256; })']' returned non-zero exit status 1.
cat ~/.config/nixpkgs/config.nix
{
  allowUnfree = true;
  checkMeta = true;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.