Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ queue_rules:
- check-success=installer test on macos
- check-success=installer test on ubuntu
- check-success=vm_tests
- check-success=buildbot/nix-build
batch_size: 5

pull_request_rules:
Expand Down
40 changes: 19 additions & 21 deletions doc/manual/remove_before_wrapper.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
#!/usr/bin/env python3

import os
import subprocess
import sys
import argparse
import shutil
import typing as t
import subprocess
from pathlib import Path
from tempfile import TemporaryDirectory


def main():
if len(sys.argv) < 4 or '--' not in sys.argv:
print("Usage: remove-before-wrapper <output> -- <nix command...>")
sys.exit(1)
def main() -> None:
arg_parser = argparse.ArgumentParser(description="Remove before wrapper")
arg_parser.add_argument("output", type=Path, help="Output file")
arg_parser.add_argument("nix_command", nargs=argparse.REMAINDER, help="Nix command")
args = arg_parser.parse_args()

# Extract the parts
output: str = sys.argv[1]
nix_command_idx: int = sys.argv.index('--') + 1
nix_command: t.List[str] = sys.argv[nix_command_idx:]
output = Path(args.output)
with TemporaryDirectory(prefix=str(output.parent.resolve() / "tmp")) as temp:
output_temp = Path(temp) / "output"

output_temp: str = output + '.tmp'
# Remove the output output in case it exist
shutil.rmtree(output, ignore_errors=True)

# Remove the output and temp output in case they exist
shutil.rmtree(output, ignore_errors=True)
shutil.rmtree(output_temp, ignore_errors=True)
# Execute nix command with `--write-to` tempary output
subprocess.run([*args.nix_command, "--write-to", output_temp], check=True)

# Execute nix command with `--write-to` tempary output
nix_command_write_to = nix_command + ['--write-to', output_temp]
subprocess.run(nix_command_write_to, check=True)
# Move the temporary output to the intended location
Path(output_temp).rename(output)

# Move the temporary output to the intended location
os.rename(output_temp, output)

if __name__ == "__main__":
main()
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "The purely functional package manager";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.nixpkgs.url = "git+https://github.com/Mic92/nixpkgs?shallow=1";

inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";
Expand Down Expand Up @@ -34,7 +34,9 @@

officialRelease = false;

linux32BitSystems = [ "i686-linux" ];
linux32BitSystems = [
#"i686-linux"
];
linux64BitSystems = [
"x86_64-linux"
"aarch64-linux"
Expand Down
Loading