From 26a2459088658c8e395c67f18a232ee3ce9e2dc0 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 8 Jan 2025 22:59:47 +0530 Subject: [PATCH] feat: add --option flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #316 Co-authored-by: Jörg Thalheim --- nix_update/__init__.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/nix_update/__init__.py b/nix_update/__init__.py index 2ea5d54..2f74a7c 100644 --- a/nix_update/__init__.py +++ b/nix_update/__init__.py @@ -114,8 +114,22 @@ def parse_args(args: list[str]) -> Options: help="Attribute of a subpackage that nix-update should try to update hashes for", default=None, ) + parser.add_argument( + "--option", + help="Nix option to set", + action="append", + nargs=2, + metavar=("name", "value"), + default=[], + ) a = parser.parse_args(args) + extra_flags = ["--extra-experimental-features", "flakes nix-command"] + if a.system: + extra_flags.extend(["--system", a.system]) + for name, value in a.option: + extra_flags.extend(["--option", name, value]) + return Options( import_path=os.path.realpath(a.file), flake=a.flake, @@ -139,8 +153,7 @@ def parse_args(args: list[str]) -> Options: system=a.system, generate_lockfile=a.generate_lockfile, lockfile_metadata_path=a.lockfile_metadata_path, - extra_flags=(["--system", a.system] if a.system else []) - + ["--extra-experimental-features", "flakes nix-command"], + extra_flags=extra_flags, )