From d3f8c4ec86cde157987ee45bee8f2de2fa689d16 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 23 Aug 2024 18:02:21 +0200 Subject: [PATCH 1/7] BuildClan: autoimport facter.json --- flake.lock | 301 +++++++++++++++++++++++++++++++++++++- flake.nix | 12 ++ lib/build-clan/module.nix | 18 ++- 3 files changed, 327 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index e8b68d70b..59b3f3093 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,78 @@ { "nodes": { + "blueprint": { + "inputs": { + "nixpkgs": [ + "nixos-facter", + "nixpkgs" + ], + "systems": [ + "nixos-facter", + "systems" + ] + }, + "locked": { + "lastModified": 1722503414, + "narHash": "sha256-JFMBd4cERlKd2lH1FuWgiwf2Q9PzPRPsdD4HV8Fs2IQ=", + "owner": "numtide", + "repo": "blueprint", + "rev": "214500b4802d1e0149a51aa19340d6f1aefb33e8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "blueprint_2": { + "inputs": { + "nixpkgs": [ + "nixos-facter", + "hwinfo", + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1724053269, + "narHash": "sha256-DinmPyxmUSLjBUYMe3eK0GKykwe33vWbVTmp7++P4Ng=", + "owner": "numtide", + "repo": "blueprint", + "rev": "766302be9063650ca6578e5ba09cc4260b0da29c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "blueprint_3": { + "inputs": { + "nixpkgs": [ + "nixos-facter-modules", + "nixpkgs" + ], + "systems": [ + "nixos-facter-modules", + "systems" + ] + }, + "locked": { + "lastModified": 1722503414, + "narHash": "sha256-JFMBd4cERlKd2lH1FuWgiwf2Q9PzPRPsdD4HV8Fs2IQ=", + "owner": "numtide", + "repo": "blueprint", + "rev": "214500b4802d1e0149a51aa19340d6f1aefb33e8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -20,6 +93,24 @@ "type": "github" } }, + "disko_2": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1723996216, + "narHash": "sha256-QNykxbGaHF3ANP369TT+VEBHlHufwY0SQk1SvUz5RcE=", + "owner": "nix-community", + "repo": "disko", + "rev": "fd43891af43916918eabdd498eeb24788d666079", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -40,6 +131,121 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": [ + "nixos-facter", + "systems" + ] + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "nixos-facter", + "flake-utils" + ], + "nixpkgs": [ + "nixos-facter", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722589758, + "narHash": "sha256-sbbA8b6Q2vB/t/r1znHawoXLysCyD4L/6n6/RykiSnA=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "4e08ca09253ef996bd4c03afa383b23e35fe28a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, + "hwinfo": { + "inputs": { + "blueprint": "blueprint_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1724271981, + "narHash": "sha256-JqGUgN2ronkVrekLJ3t2Oa3Zt/W1JhU5oA/GD5f1nhI=", + "owner": "numtide", + "repo": "hwinfo", + "rev": "db1f44bde5b633cc68a46317773d33a80f7f28e7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "hwinfo", + "type": "github" + } + }, + "nixos-facter": { + "inputs": { + "blueprint": "blueprint", + "disko": "disko_2", + "flake-utils": "flake-utils", + "gomod2nix": "gomod2nix", + "hwinfo": "hwinfo", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1724408140, + "narHash": "sha256-NKB/72C5udfGlnoQt1BRNkfZJ0BLd9Fud/2eWnPX5UU=", + "owner": "numtide", + "repo": "nixos-facter", + "rev": "8e7131acedc57af4a17bb51d66596fbb172b71df", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nixos-facter", + "type": "github" + } + }, + "nixos-facter-modules": { + "inputs": { + "blueprint": "blueprint_3", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix_2" + }, + "locked": { + "lastModified": 1724320449, + "narHash": "sha256-0hB5P75tIwPS9lNI3nYxEorpcFtuQUJGmGHGIEgWksY=", + "owner": "numtide", + "repo": "nixos-facter-modules", + "rev": "e00d789870e72baabb79d19afcc645428c3c6980", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nixos-facter-modules", + "type": "github" + } + }, "nixos-images": { "inputs": { "nixos-stable": [], @@ -81,11 +287,13 @@ "inputs": { "disko": "disko", "flake-parts": "flake-parts", + "nixos-facter": "nixos-facter", + "nixos-facter-modules": "nixos-facter-modules", "nixos-images": "nixos-images", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_3", "sops-nix": "sops-nix", - "systems": "systems", - "treefmt-nix": "treefmt-nix" + "systems": "systems_4", + "treefmt-nix": "treefmt-nix_3" } }, "sops-nix": { @@ -124,7 +332,94 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixos-facter", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723808491, + "narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "nixos-facter-modules", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723656612, + "narHash": "sha256-6Sx+/VhRPLR+kRf6rnNUFMQ66DUz1DMYajixYUe+CUU=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "4a6d7dccf80a1aa2d04cfaa88d9e5511542a2486", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_3": { "inputs": { "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index c582ed3c2..e240d7ef2 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,11 @@ systems.url = "github:nix-systems/default"; treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; + nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; + nixos-facter-modules.inputs.nixpkgs.follows = "nixpkgs"; + + nixos-facter.url = "github:numtide/nixos-facter"; + nixos-facter.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = @@ -49,6 +54,13 @@ ./nixosModules/clanCore/vars/flake-module.nix ./pkgs/flake-module.nix ./templates/flake-module.nix + + # Inherit the nixos-facter package so its build is chached in clans binary cache + { + perSystem = {system, inputs', ...}: { + packages.nixos-facter = inputs'.nixos-facter.packages.default; + }; + } ]; } ); diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 390625248..97739c09f 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -64,14 +64,30 @@ let modules = let settings = machineSettings name; + facterJson = "${directory}/machines/${name}/facter.json"; + hwConfig = "${directory}/machines/${name}/hardware-configuration.nix"; + + facterModules = lib.optionals (builtins.pathExists facterJson) [ + clan-core.inputs.nixos-facter-modules.nixosModules.facter + { config.facter.reportPath = facterJson; } + ]; in (machineImports settings) + ++ facterModules ++ [ { # Autoinclude configuration.nix and hardware-configuration.nix imports = builtins.filter builtins.pathExists [ "${directory}/machines/${name}/configuration.nix" - "${directory}/machines/${name}/hardware-configuration.nix" + hwConfig + ]; + config.warnings = lib.optionals (builtins.all builtins.pathExists [hwConfig facterJson]) [ + '' + Duplicate hardware facts: '${hwConfig}' and '${facterJson}' exist. + Using both is not recommended. + + It is recommended to use the hardware facts from '${facterJson}', please remove '${hwConfig}'. + '' ]; } settings From 2d05b98ae380c3284061dbfb19537cdfbf88b5e4 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 23 Aug 2024 18:02:45 +0200 Subject: [PATCH 2/7] CLI: add option to generate facter.json --- pkgs/clan-cli/clan_cli/machines/hardware.py | 28 +++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/machines/hardware.py b/pkgs/clan-cli/clan_cli/machines/hardware.py index f7b28863c..5fa00cfe9 100644 --- a/pkgs/clan-cli/clan_cli/machines/hardware.py +++ b/pkgs/clan-cli/clan_cli/machines/hardware.py @@ -104,6 +104,9 @@ def generate_machine_hardware_info( password: str | None = None, keyfile: str | None = None, force: bool | None = False, + report_type: Literal[ + "nixos-generate-config", "nixos-facter" + ] = "nixos-generate-config", ) -> HardwareReport: """ Generate hardware information for a machine @@ -114,6 +117,14 @@ def generate_machine_hardware_info( if hostname is not None: machine.target_host_address = hostname + nixos_generate_cmd = [ + "nixos-generate-config", # Filesystems are managed by disko + "--no-filesystems", + "--show-hardware-config", + ] + + nixos_facter_cmd = ["nix", "run", "--refresh", "github:numtide/nixos-facter"] + host = machine.target_host target_host = f"{host.user or 'root'}@{host.host}" cmd = nix_shell( @@ -137,10 +148,11 @@ def generate_machine_hardware_info( else [] ), target_host, - "nixos-generate-config", - # Filesystems are managed by disko - "--no-filesystems", - "--show-hardware-config", + *( + nixos_generate_cmd + if report_type == "nixos-generate-config" + else nixos_facter_cmd + ), ], ) out = run(cmd) @@ -149,7 +161,9 @@ def generate_machine_hardware_info( log.error(out) raise ClanError(f"Failed to inspect {machine_name}. Address: {hostname}") - hw_file = Path(f"{clan_dir}/machines/{machine_name}/hardware-configuration.nix") + hw_file = Path( + f"{clan_dir}/machines/{machine_name}/{hw_nix_file if report_type == 'nixos-generate-config' else facter_file}" + ) hw_file.parent.mkdir(parents=True, exist_ok=True) # Check if the hardware-configuration.nix file is a template @@ -167,7 +181,7 @@ def generate_machine_hardware_info( # Backup the existing file backup_file = hw_file.with_suffix(".bak") hw_file.replace(backup_file) - print(f"Backed up existing hardware-configuration.nix to {backup_file}") + print(f"Backed up existing {hw_file} to {backup_file}") with open(hw_file, "w") as f: f.write(out.stdout) @@ -197,7 +211,7 @@ def generate_machine_hardware_info( location=f"{__name__} {hw_file}", ) - return HardwareReport("nixos-generate-config") + return HardwareReport(report_type) @dataclass From d4750f69d21c95948cb0b98d00de28ab3fb35c89 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 23 Aug 2024 18:03:09 +0200 Subject: [PATCH 3/7] Installer: add trusted nix caches --- pkgs/installer/flake-module.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/installer/flake-module.nix b/pkgs/installer/flake-module.nix index 29c25e370..04cfb96ce 100644 --- a/pkgs/installer/flake-module.nix +++ b/pkgs/installer/flake-module.nix @@ -8,6 +8,8 @@ let imports = [ ./iwd.nix self.nixosModules.installer + # Allow to download pre-build binaries from our nix caches + self.clanModules.trusted-nix-caches ]; system.stateVersion = config.system.nixos.version; From 1e63e0b1a963789f328488c1f9c755cafd5a9d66 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 23 Aug 2024 18:03:34 +0200 Subject: [PATCH 4/7] UI: use nixos-facter for hardware reports --- pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx b/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx index 237a513b9..5dddb224e 100644 --- a/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx @@ -77,7 +77,7 @@ const InstallMachine = (props: InstallMachineProps) => { machine_name: props.name, }); if (result.status === "error") throw new Error("Failed to fetch data"); - return result.data || null; + return result.data?.file === "nixos-facter" || null; } return null; }, @@ -94,7 +94,7 @@ const InstallMachine = (props: InstallMachineProps) => { } const loading_toast = toast.loading( - "Installing machine. Grab coffee (15min)...", + "Installing machine. Grab coffee (15min)..." ); const r = await callApi("install_machine", { opts: { @@ -152,6 +152,7 @@ const InstallMachine = (props: InstallMachineProps) => { machine_name: props.name, keyfile: props.sshKey?.name, hostname: props.targetHost, + report_type: "nixos-facter", }); toast.dismiss(loading_toast); hwInfoQuery.refetch(); @@ -370,7 +371,7 @@ const MachineForm = (props: MachineDetailsProps) => { }); if (machine_response.status === "error") { toast.error( - `Failed to set machine: ${machine_response.errors[0].message}`, + `Failed to set machine: ${machine_response.errors[0].message}` ); } if (machine_response.status === "success") { From c43599bfa0e23af06e246c69a2330d9299212543 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 23 Aug 2024 18:04:20 +0200 Subject: [PATCH 5/7] Format --- flake.nix | 8 +++++--- lib/build-clan/module.nix | 20 ++++++++++++------- .../app/src/routes/machines/[name]/view.tsx | 4 ++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index e240d7ef2..cd9d25b09 100644 --- a/flake.nix +++ b/flake.nix @@ -57,9 +57,11 @@ # Inherit the nixos-facter package so its build is chached in clans binary cache { - perSystem = {system, inputs', ...}: { - packages.nixos-facter = inputs'.nixos-facter.packages.default; - }; + perSystem = + { inputs', ... }: + { + packages.nixos-facter = inputs'.nixos-facter.packages.default; + }; } ]; } diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 97739c09f..8100ce4a6 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -81,14 +81,20 @@ let "${directory}/machines/${name}/configuration.nix" hwConfig ]; - config.warnings = lib.optionals (builtins.all builtins.pathExists [hwConfig facterJson]) [ - '' - Duplicate hardware facts: '${hwConfig}' and '${facterJson}' exist. - Using both is not recommended. + config.warnings = + lib.optionals + (builtins.all builtins.pathExists [ + hwConfig + facterJson + ]) + [ + '' + Duplicate hardware facts: '${hwConfig}' and '${facterJson}' exist. + Using both is not recommended. - It is recommended to use the hardware facts from '${facterJson}', please remove '${hwConfig}'. - '' - ]; + It is recommended to use the hardware facts from '${facterJson}', please remove '${hwConfig}'. + '' + ]; } settings clan-core.nixosModules.clanCore diff --git a/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx b/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx index 5dddb224e..43622b589 100644 --- a/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/[name]/view.tsx @@ -94,7 +94,7 @@ const InstallMachine = (props: InstallMachineProps) => { } const loading_toast = toast.loading( - "Installing machine. Grab coffee (15min)..." + "Installing machine. Grab coffee (15min)...", ); const r = await callApi("install_machine", { opts: { @@ -371,7 +371,7 @@ const MachineForm = (props: MachineDetailsProps) => { }); if (machine_response.status === "error") { toast.error( - `Failed to set machine: ${machine_response.errors[0].message}` + `Failed to set machine: ${machine_response.errors[0].message}`, ); } if (machine_response.status === "success") { From 3d8357ad00e7c8ddfa4d38f91cfd96747c44417b Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 26 Aug 2024 09:12:34 +0200 Subject: [PATCH 6/7] Facter: only export the standard linux package for caching --- flake.lock | 32 ++++++++++++++++++++++++++++++++ flake.nix | 8 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 59b3f3093..1ef644d43 100644 --- a/flake.lock +++ b/flake.lock @@ -268,6 +268,38 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1723603349, + "narHash": "sha256-VMg6N7MryOuvSJ8Sj6YydarnUCkL7cvMdrMcnsJnJCE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "daf7bb95821b789db24fc1ac21f613db0c1bf2cb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1723991338, + "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8a3354191c0d7144db9756a74755672387b702ba", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1724607561, "narHash": "sha256-7I922FoAJO9P2YRJrxQx1ufQom3wvozJNL/Ul6eEKLI=", diff --git a/flake.nix b/flake.nix index cd9d25b09..3271b9489 100644 --- a/flake.nix +++ b/flake.nix @@ -58,8 +58,14 @@ # Inherit the nixos-facter package so its build is chached in clans binary cache { perSystem = - { inputs', ... }: + # Facter doesnt have a package for darwin yet. { + inputs', + system, + lib, + ... + }: + lib.optionalAttrs (system == "x86_64-linux") { packages.nixos-facter = inputs'.nixos-facter.packages.default; }; } From 4ed33fbc3b735faa4a306ce25cd89dbbf63e920d Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 26 Aug 2024 11:27:41 +0200 Subject: [PATCH 7/7] Remove nixos-facter until fixed upstream --- flake.lock | 299 +++-------------------------------------------------- flake.nix | 27 ++--- 2 files changed, 22 insertions(+), 304 deletions(-) diff --git a/flake.lock b/flake.lock index 1ef644d43..36eaf72f9 100644 --- a/flake.lock +++ b/flake.lock @@ -3,37 +3,12 @@ "blueprint": { "inputs": { "nixpkgs": [ - "nixos-facter", "nixpkgs" ], "systems": [ - "nixos-facter", "systems" ] }, - "locked": { - "lastModified": 1722503414, - "narHash": "sha256-JFMBd4cERlKd2lH1FuWgiwf2Q9PzPRPsdD4HV8Fs2IQ=", - "owner": "numtide", - "repo": "blueprint", - "rev": "214500b4802d1e0149a51aa19340d6f1aefb33e8", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "blueprint", - "type": "github" - } - }, - "blueprint_2": { - "inputs": { - "nixpkgs": [ - "nixos-facter", - "hwinfo", - "nixpkgs" - ], - "systems": "systems" - }, "locked": { "lastModified": 1724053269, "narHash": "sha256-DinmPyxmUSLjBUYMe3eK0GKykwe33vWbVTmp7++P4Ng=", @@ -48,31 +23,6 @@ "type": "github" } }, - "blueprint_3": { - "inputs": { - "nixpkgs": [ - "nixos-facter-modules", - "nixpkgs" - ], - "systems": [ - "nixos-facter-modules", - "systems" - ] - }, - "locked": { - "lastModified": 1722503414, - "narHash": "sha256-JFMBd4cERlKd2lH1FuWgiwf2Q9PzPRPsdD4HV8Fs2IQ=", - "owner": "numtide", - "repo": "blueprint", - "rev": "214500b4802d1e0149a51aa19340d6f1aefb33e8", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "blueprint", - "type": "github" - } - }, "disko": { "inputs": { "nixpkgs": [ @@ -93,24 +43,6 @@ "type": "github" } }, - "disko_2": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1723996216, - "narHash": "sha256-QNykxbGaHF3ANP369TT+VEBHlHufwY0SQk1SvUz5RcE=", - "owner": "nix-community", - "repo": "disko", - "rev": "fd43891af43916918eabdd498eeb24788d666079", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "disko", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -131,106 +63,20 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": [ - "nixos-facter", - "systems" - ] - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gomod2nix": { - "inputs": { - "flake-utils": [ - "nixos-facter", - "flake-utils" - ], - "nixpkgs": [ - "nixos-facter", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722589758, - "narHash": "sha256-sbbA8b6Q2vB/t/r1znHawoXLysCyD4L/6n6/RykiSnA=", - "owner": "nix-community", - "repo": "gomod2nix", - "rev": "4e08ca09253ef996bd4c03afa383b23e35fe28a1", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "gomod2nix", - "type": "github" - } - }, - "hwinfo": { - "inputs": { - "blueprint": "blueprint_2", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1724271981, - "narHash": "sha256-JqGUgN2ronkVrekLJ3t2Oa3Zt/W1JhU5oA/GD5f1nhI=", - "owner": "numtide", - "repo": "hwinfo", - "rev": "db1f44bde5b633cc68a46317773d33a80f7f28e7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "hwinfo", - "type": "github" - } - }, - "nixos-facter": { - "inputs": { - "blueprint": "blueprint", - "disko": "disko_2", - "flake-utils": "flake-utils", - "gomod2nix": "gomod2nix", - "hwinfo": "hwinfo", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_2", - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1724408140, - "narHash": "sha256-NKB/72C5udfGlnoQt1BRNkfZJ0BLd9Fud/2eWnPX5UU=", - "owner": "numtide", - "repo": "nixos-facter", - "rev": "8e7131acedc57af4a17bb51d66596fbb172b71df", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nixos-facter", - "type": "github" - } - }, "nixos-facter-modules": { "inputs": { - "blueprint": "blueprint_3", + "blueprint": [ + "blueprint" + ], "nixpkgs": [ "nixpkgs" ], - "systems": "systems_3", - "treefmt-nix": "treefmt-nix_2" + "systems": [ + "systems" + ], + "treefmt-nix": [ + "treefmt-nix" + ] }, "locked": { "lastModified": 1724320449, @@ -268,38 +114,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1723603349, - "narHash": "sha256-VMg6N7MryOuvSJ8Sj6YydarnUCkL7cvMdrMcnsJnJCE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "daf7bb95821b789db24fc1ac21f613db0c1bf2cb", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1723991338, - "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "8a3354191c0d7144db9756a74755672387b702ba", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1724607561, "narHash": "sha256-7I922FoAJO9P2YRJrxQx1ufQom3wvozJNL/Ul6eEKLI=", @@ -317,15 +131,15 @@ }, "root": { "inputs": { + "blueprint": "blueprint", "disko": "disko", "flake-parts": "flake-parts", - "nixos-facter": "nixos-facter", "nixos-facter-modules": "nixos-facter-modules", "nixos-images": "nixos-images", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs", "sops-nix": "sops-nix", - "systems": "systems_4", - "treefmt-nix": "treefmt-nix_3" + "systems": "systems", + "treefmt-nix": "treefmt-nix" } }, "sops-nix": { @@ -364,94 +178,7 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixos-facter", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1723808491, - "narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_2": { - "inputs": { - "nixpkgs": [ - "nixos-facter-modules", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1723656612, - "narHash": "sha256-6Sx+/VhRPLR+kRf6rnNUFMQ66DUz1DMYajixYUe+CUU=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "4a6d7dccf80a1aa2d04cfaa88d9e5511542a2486", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_3": { "inputs": { "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index 3271b9489..3d6f8dd1e 100644 --- a/flake.nix +++ b/flake.nix @@ -17,11 +17,17 @@ systems.url = "github:nix-systems/default"; treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; + nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; nixos-facter-modules.inputs.nixpkgs.follows = "nixpkgs"; - - nixos-facter.url = "github:numtide/nixos-facter"; - nixos-facter.inputs.nixpkgs.follows = "nixpkgs"; + nixos-facter-modules.inputs.systems.follows = "systems"; + nixos-facter-modules.inputs.blueprint.follows = "blueprint"; + nixos-facter-modules.inputs.treefmt-nix.follows = "treefmt-nix"; + # Pinned input for nixos-facter-modules + # Allows downstream flakes to .follow override the input + blueprint.url = "github:numtide/blueprint"; + blueprint.inputs.nixpkgs.follows = "nixpkgs"; + blueprint.inputs.systems.follows = "systems"; }; outputs = @@ -54,21 +60,6 @@ ./nixosModules/clanCore/vars/flake-module.nix ./pkgs/flake-module.nix ./templates/flake-module.nix - - # Inherit the nixos-facter package so its build is chached in clans binary cache - { - perSystem = - # Facter doesnt have a package for darwin yet. - { - inputs', - system, - lib, - ... - }: - lib.optionalAttrs (system == "x86_64-linux") { - packages.nixos-facter = inputs'.nixos-facter.packages.default; - }; - } ]; } );