Skip to content

Commit f570df2

Browse files
bors[bot]Mic92
andauthored
Merge #137
137: nix-update: add url parameter to override the repository discovery r=figsoda a=Mic92 Co-authored-by: Jörg Thalheim <[email protected]>
2 parents 0bfc470 + ab45f14 commit f570df2

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ In some cases this heurestic is wrong. One can override the behavior like that:
118118
$ nix-update hello --override-filename pkgs/applications/misc/hello/default.nix
119119
```
120120

121+
The `nix-update` command checks for new releases of a package using the `src`
122+
attribute. However, in some cases a package may use a non-standard release URL
123+
that is not supported by `nix-update`, but still has a repository with release
124+
information. For example, the Signal Desktop package in Nixpkgs fetches updates
125+
from https://updates.signal.org/, but also publishes release information on its
126+
GitHub page. In such cases, use the `--url` parameter to direct nix-update to
127+
the correct repository:
128+
129+
``` console
130+
nix-update --url https://github.com/signalapp/Signal-Desktop --override-filename pkgs/applications/networking/instant-messengers/signal-desktop/default.nix signal-desktop
131+
```
132+
121133
With the `--shell`, `--build`, `--test` and `--run` flags the update can be
122134
tested. Additionally, the `--review` flag can be used to
123135
initiate a run of [nixpkgs-review](https://github.com/Mic92/nixpkgs-review), which will ensure all

nix_update/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def parse_args(args: list[str]) -> Options:
4040
action="store_true",
4141
help="Use passthru.updateScript instead if possible",
4242
)
43+
parser.add_argument(
44+
"--url",
45+
help="URL to the repository to check for a release instead of using the URL in the src attribute of the package",
46+
)
4347
parser.add_argument(
4448
"--write-commit-message",
4549
metavar="FILE",
@@ -89,6 +93,7 @@ def parse_args(args: list[str]) -> Options:
8993
build=a.build,
9094
commit=a.commit,
9195
use_update_script=a.use_update_script,
96+
url=a.url,
9297
write_commit_message=a.write_commit_message,
9398
run=a.run,
9499
shell=a.shell,

nix_update/eval.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def eval_attr(opts: Options) -> Package:
132132
package = Package(attribute=opts.attribute, **out)
133133
if opts.override_filename is not None:
134134
package.filename = opts.override_filename
135+
if opts.url is not None:
136+
package.parsed_url = urlparse(opts.url)
135137
if opts.version_preference != VersionPreference.SKIP and package.old_version == "":
136138
raise UpdateError(
137139
f"Nix's builtins.parseDrvName could not parse the version from {package.name}"

nix_update/options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Options:
1414
version_regex: str = "(.*)"
1515
import_path: str = os.getcwd()
1616
override_filename: Optional[str] = None
17+
url: Optional[str] = None
1718
commit: bool = False
1819
use_update_script: bool = False
1920
write_commit_message: Optional[str] = None

0 commit comments

Comments
 (0)