From c7ccaf5558c1dbeddbfd12173030d44198f2849d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 3 Dec 2024 22:44:21 +0100 Subject: [PATCH] de-vendor nixos-facter --- nix/installer.nix | 2 +- nix/kexec-installer/test.nix | 7 +--- nix/nixos-facter.nix | 71 ------------------------------------ 3 files changed, 3 insertions(+), 77 deletions(-) delete mode 100644 nix/nixos-facter.nix diff --git a/nix/installer.nix b/nix/installer.nix index 45908c0..920cc65 100644 --- a/nix/installer.nix +++ b/nix/installer.nix @@ -35,7 +35,7 @@ pkgs.rsync # alternative to nixos-generate-config # TODO: use nixpkgs again after next nixos release - (pkgs.callPackage ./nixos-facter.nix {}) + pkgs.nixos-facter pkgs.disko ]; diff --git a/nix/kexec-installer/test.nix b/nix/kexec-installer/test.nix index a756e14..26b8d94 100644 --- a/nix/kexec-installer/test.nix +++ b/nix/kexec-installer/test.nix @@ -1,7 +1,6 @@ { pkgs , lib , kexecTarball -, nixos-facter ? null }: pkgs.testers.runNixOSTest { @@ -167,10 +166,8 @@ pkgs.testers.runNixOSTest { host = ssh(["hostname"], stdout=subprocess.PIPE).stdout.strip() assert host == "nixos-installer", f"hostname is {host}, not nixos-installer" - has_nixos_facter=${if nixos-facter != null then "True" else "False"} - if has_nixos_facter == True: - data = json.loads(ssh(["nixos-facter"], stdout=subprocess.PIPE).stdout) - assert data["virtualisation"] == "kvm", f"virtualisation is {data['virtualisation']}, not kvm" + data = json.loads(ssh(["nixos-facter"], stdout=subprocess.PIPE).stdout) + assert data["virtualisation"] == "kvm", f"virtualisation is {data['virtualisation']}, not kvm" host_ed25519_after = ssh(["cat", "/etc/ssh/ssh_host_ed25519_key.pub"], stdout=subprocess.PIPE).stdout.strip() assert host_ed25519_before == host_ed25519_after, f"'{host_ed25519_before}' != '{host_ed25519_after}'" diff --git a/nix/nixos-facter.nix b/nix/nixos-facter.nix deleted file mode 100644 index 4d0bb4a..0000000 --- a/nix/nixos-facter.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ - lib, - buildGoModule, - fetchFromGitHub, - hwinfo, - libusb1, - gcc, - pkg-config, - util-linux, - pciutils, - stdenv, -}: -let - # We are waiting on some changes to be merged upstream: https://github.com/openSUSE/hwinfo/pulls - hwinfoOverride = hwinfo.overrideAttrs { - src = fetchFromGitHub { - owner = "numtide"; - repo = "hwinfo"; - rev = "a559f34934098d54096ed2078e750a8245ae4044"; - hash = "sha256-3abkWPr98qXXQ17r1Z43gh2M5hl/DHjW2hfeWl+GSAs="; - }; - }; -in -buildGoModule rec { - pname = "nixos-facter"; - version = "0.1.1"; - - src = fetchFromGitHub { - owner = "numtide"; - repo = "nixos-facter"; - rev = "v${version}"; - hash = "sha256-vlPmvCrgX64dcf//BPtQszBt7dkq35JpgQg+/LW0AqM="; - }; - - vendorHash = "sha256-5leiTNp3FJmgFd0SKhu18hxYZ2G9SuQPhZJjki2SDVs="; - - CGO_ENABLED = 1; - - buildInputs = [ - libusb1 - hwinfoOverride - ]; - - nativeBuildInputs = [ - gcc - pkg-config - ]; - - runtimeInputs = [ - libusb1 - util-linux - pciutils - ]; - - ldflags = [ - "-s" - "-w" - "-X git.numtide.com/numtide/nixos-facter/build.Name=nixos-facter" - "-X git.numtide.com/numtide/nixos-facter/build.Version=v${version}" - "-X github.com/numtide/nixos-facter/pkg/build.System=${stdenv.hostPlatform.system}" - ]; - - meta = { - description = "Declarative hardware configuration for NixOS"; - homepage = "https://github.com/numtide/nixos-facter"; - license = lib.licenses.gpl3Plus; - maintainers = [ lib.maintainers.brianmcgee ]; - mainProgram = "nixos-facter"; - platforms = lib.platforms.linux; - }; -}