X-Git-Url: http://git.scottworley.com/pinch/blobdiff_plain/ac38f5a21500ad0e7fd8dac229a6dbadc9a14bfa..2a6cedfe22d12056af5240b983262e98cd5f131d:/pinch.py diff --git a/pinch.py b/pinch.py index 9e80c01..bdd7a6e 100644 --- a/pinch.py +++ b/pinch.py @@ -570,7 +570,9 @@ def git_revision_name( git_revision], stdout=subprocess.PIPE) v.result(process.returncode == 0 and process.stdout != b'') - return f'{os.path.basename(channel.git_repo)}-{process.stdout.decode().strip()}' + return f'{ + os.path.basename(channel.git_repo)}-{ + process.stdout.decode().strip()}' K = TypeVar('K') @@ -683,23 +685,35 @@ def updateCommand(args: argparse.Namespace) -> None: assert isinstance(sp, AliasSearchPath) # For mypy exprs[section] = exprs[sp.alias_of] - command = [ - 'nix-env', - '--profile', - args.profile, - '--show-trace', - '--file', - '', - '--install', - '--remove-all', - ] + search_paths + ['--from-expression'] + [ - exprs[name] % name for name in sorted(exprs.keys())] - if args.dry_run: - print(' '.join(map(shlex.quote, command))) - else: - v.status('Installing channels with nix-env') - process = subprocess.run(command) - v.result(process.returncode == 0) + with tempfile.NamedTemporaryFile() as unpack_channel_nix: + unpack_channel_nix.write(b''' + { name, channelName, src, }: + derivation { + inherit name channelName src; + builder = "builtin:unpack-channel"; + system = "builtin"; + preferLocalBuild = true; + } + ''') + unpack_channel_nix.flush() + + command = [ + 'nix-env', + '--profile', + args.profile, + '--show-trace', + '--file', + unpack_channel_nix.name, + '--install', + '--remove-all', + ] + search_paths + ['--from-expression'] + [ + exprs[name] % name for name in sorted(exprs.keys())] + if args.dry_run: + print(' '.join(map(shlex.quote, command))) + else: + v.status('Installing channels with nix-env') + process = subprocess.run(command) + v.result(process.returncode == 0) def main() -> None: