Loading pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/models.py +15 −17 Original line number Diff line number Diff line Loading @@ -63,20 +63,6 @@ class BuildAttr: return cls(Path(file or "default.nix"), attr) def _get_hostname(target_host: Remote | None) -> str | None: if target_host: try: return run_wrapper( ["uname", "-n"], capture_output=True, remote=target_host, ).stdout.strip() except (AttributeError, subprocess.CalledProcessError): return None else: return platform.node() @dataclass(frozen=True) class Flake: path: str Loading @@ -95,9 +81,7 @@ class Flake: m = cls._re.match(flake_str) assert m is not None, f"got no matches for {flake_str}" attr = m.group("attr") nixos_attr = ( f'nixosConfigurations."{attr or _get_hostname(target_host) or "default"}"' ) nixos_attr = f'nixosConfigurations."{attr or cls._get_hostname(target_host) or "default"}"' path = m.group("path") return cls(path, nixos_attr) Loading Loading @@ -126,6 +110,20 @@ class Flake: except FileNotFoundError: return self.path @staticmethod def _get_hostname(target_host: Remote | None) -> str | None: if target_host: try: return run_wrapper( ["uname", "-n"], capture_output=True, remote=target_host, ).stdout.strip() except (AttributeError, subprocess.CalledProcessError): return None else: return platform.node() @dataclass(frozen=True) class Generation: Loading Loading
pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/models.py +15 −17 Original line number Diff line number Diff line Loading @@ -63,20 +63,6 @@ class BuildAttr: return cls(Path(file or "default.nix"), attr) def _get_hostname(target_host: Remote | None) -> str | None: if target_host: try: return run_wrapper( ["uname", "-n"], capture_output=True, remote=target_host, ).stdout.strip() except (AttributeError, subprocess.CalledProcessError): return None else: return platform.node() @dataclass(frozen=True) class Flake: path: str Loading @@ -95,9 +81,7 @@ class Flake: m = cls._re.match(flake_str) assert m is not None, f"got no matches for {flake_str}" attr = m.group("attr") nixos_attr = ( f'nixosConfigurations."{attr or _get_hostname(target_host) or "default"}"' ) nixos_attr = f'nixosConfigurations."{attr or cls._get_hostname(target_host) or "default"}"' path = m.group("path") return cls(path, nixos_attr) Loading Loading @@ -126,6 +110,20 @@ class Flake: except FileNotFoundError: return self.path @staticmethod def _get_hostname(target_host: Remote | None) -> str | None: if target_host: try: return run_wrapper( ["uname", "-n"], capture_output=True, remote=target_host, ).stdout.strip() except (AttributeError, subprocess.CalledProcessError): return None else: return platform.node() @dataclass(frozen=True) class Generation: Loading