mirror of
https://github.com/Mic92/nix-update.git
synced 2024-11-03 21:04:49 +03:00
system_flags -> extra_flags, move experimental features to extra_flags
This commit is contained in:
parent
3928ea476b
commit
bf2ee2bbf0
@ -101,7 +101,8 @@ def parse_args(args: list[str]) -> Options:
|
||||
format=a.format,
|
||||
override_filename=a.override_filename,
|
||||
system=a.system,
|
||||
system_flags=["--system", a.system] if a.system else [],
|
||||
extra_flags=(["--system", a.system] if a.system else [])
|
||||
+ ["--extra-experimental-features", "flakes nix-command"],
|
||||
)
|
||||
|
||||
|
||||
@ -112,10 +113,8 @@ def nix_shell(options: Options) -> None:
|
||||
"nix",
|
||||
"shell",
|
||||
f"{options.import_path}#{options.attribute}",
|
||||
"--extra-experimental-features",
|
||||
"flakes nix-command",
|
||||
]
|
||||
+ options.system_flags,
|
||||
+ options.extra_flags,
|
||||
stdout=None,
|
||||
check=False,
|
||||
)
|
||||
@ -125,7 +124,7 @@ def nix_shell(options: Options) -> None:
|
||||
path = os.path.join(d, "default.nix")
|
||||
with open(path, "w") as f:
|
||||
f.write(expr)
|
||||
run(["nix-shell", path] + options.system_flags, stdout=None, check=False)
|
||||
run(["nix-shell", path] + options.extra_flags, stdout=None, check=False)
|
||||
|
||||
|
||||
def git_has_diff(git_dir: str, package: Package) -> bool:
|
||||
@ -207,10 +206,8 @@ def nix_run(options: Options) -> None:
|
||||
cmd = [
|
||||
"nix",
|
||||
"shell",
|
||||
"--extra-experimental-features",
|
||||
"flakes nix-command",
|
||||
"-L",
|
||||
] + options.system_flags
|
||||
] + options.extra_flags
|
||||
|
||||
if options.flake:
|
||||
cmd.append(f"{options.import_path}#{options.attribute}")
|
||||
@ -227,10 +224,8 @@ def nix_build(options: Options) -> None:
|
||||
cmd = [
|
||||
"nix",
|
||||
"build",
|
||||
"--extra-experimental-features",
|
||||
"flakes nix-command",
|
||||
"-L",
|
||||
] + options.system_flags
|
||||
] + options.extra_flags
|
||||
if options.flake:
|
||||
cmd.append(f"{options.import_path}#{options.attribute}")
|
||||
else:
|
||||
@ -246,13 +241,11 @@ def nix_test(opts: Options, package: Package) -> None:
|
||||
cmd = [
|
||||
"nix",
|
||||
"build",
|
||||
"--experimental-features",
|
||||
"flakes nix-command",
|
||||
] + opts.system_flags
|
||||
] + opts.extra_flags
|
||||
for t in package.tests:
|
||||
cmd.append(f"{opts.import_path}#{package.attribute}.tests.{t}")
|
||||
else:
|
||||
cmd = ["nix-build"] + opts.system_flags
|
||||
cmd = ["nix-build"] + opts.extra_flags
|
||||
for t in package.tests:
|
||||
cmd.append("-A")
|
||||
cmd.append(f"{package.attribute}.tests.{t}")
|
||||
|
@ -119,11 +119,9 @@ def eval_attr(opts: Options) -> Package:
|
||||
"eval",
|
||||
"--json",
|
||||
"--impure",
|
||||
"--extra-experimental-features",
|
||||
"nix-command",
|
||||
"--expr",
|
||||
expr,
|
||||
] + opts.system_flags
|
||||
] + opts.extra_flags
|
||||
res = run(cmd)
|
||||
out = json.loads(res.stdout)
|
||||
package = Package(attribute=opts.attribute, **out)
|
||||
|
@ -24,4 +24,4 @@ class Options:
|
||||
review: bool = False
|
||||
format: bool = False
|
||||
system: Optional[str] = None
|
||||
system_flags: List[str] = field(default_factory=list)
|
||||
extra_flags: List[str] = field(default_factory=list)
|
||||
|
@ -90,7 +90,7 @@ def nix_prefetch(opts: Options, attr: str) -> str:
|
||||
"--expr",
|
||||
f'let src = {expr}; in (src.overrideAttrs or (f: src // f src)) (_: {{ outputHash = ""; outputHashAlgo = "sha256"; }})',
|
||||
]
|
||||
+ opts.system_flags,
|
||||
+ opts.extra_flags,
|
||||
extra_env=extra_env,
|
||||
stderr=subprocess.PIPE,
|
||||
check=False,
|
||||
|
Loading…
Reference in New Issue
Block a user