assert isinstance(sp, AliasSearchPath) # For mypy
exprs[section] = exprs[sp.alias_of]
- command = [
- 'nix-env',
- '--profile',
- args.profile,
- '--show-trace',
- '--file',
- '<nix/unpack-channel.nix>',
- '--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: