From fec7b3e120de467770ba96edc42b63710fbb82d9 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 28 Aug 2024 10:32:41 +0200 Subject: [PATCH] Flake: nixos-facter-module with flake: false --- flake.lock | 17 +++++++++++++++++ flake.nix | 15 +++++---------- lib/build-clan/module.nix | 10 +++++----- nixosModules/clanCore/metadata.nix | 7 +++++-- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/flake.lock b/flake.lock index e8b68d70b..78f4e0904 100644 --- a/flake.lock +++ b/flake.lock @@ -40,6 +40,22 @@ "type": "github" } }, + "nixos-facter-modules": { + "flake": false, + "locked": { + "lastModified": 1724681057, + "narHash": "sha256-wxx2Sh/urE3sKY/1v3tmrWTNMIQ3RoJtd7bcuqVpY2Y=", + "owner": "numtide", + "repo": "nixos-facter-modules", + "rev": "55088bf19810d23ca7cb86fb71516c95d97f035b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nixos-facter-modules", + "type": "github" + } + }, "nixos-images": { "inputs": { "nixos-stable": [], @@ -81,6 +97,7 @@ "inputs": { "disko": "disko", "flake-parts": "flake-parts", + "nixos-facter-modules": "nixos-facter-modules", "nixos-images": "nixos-images", "nixpkgs": "nixpkgs", "sops-nix": "sops-nix", diff --git a/flake.nix b/flake.nix index 821ad2ab4..74d392a6f 100644 --- a/flake.nix +++ b/flake.nix @@ -18,16 +18,11 @@ 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-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"; + nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; + # TODO: remove this once the upstream doesnt have dependencies + nixos-facter-modules.flake = false; + # nixos-facter-modules.inputs.nixpkgs.follows = "nixpkgs"; + }; outputs = diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 947d63ed9..22b154a3b 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -67,13 +67,13 @@ let 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}/modules/nixos/facter.nix" + { config.facter.reportPath = facterJson; } + ]; in - #facterModules = lib.optionals (builtins.pathExists facterJson) [ - # clan-core.inputs.nixos-facter-modules.nixosModules.facter - # { config.facter.reportPath = facterJson; } - #]; (machineImports settings) - #++ facterModules + ++ facterModules ++ [ { # Autoinclude configuration.nix and hardware-configuration.nix diff --git a/nixosModules/clanCore/metadata.nix b/nixosModules/clanCore/metadata.nix index d37f62c75..2e5fb7188 100644 --- a/nixosModules/clanCore/metadata.nix +++ b/nixosModules/clanCore/metadata.nix @@ -45,8 +45,11 @@ }; clanDir = lib.mkOption { type = lib.types.path; - # TODO: @DavHau: before we can remove this, we need to make sure that Palo's config case works - default = ./.; + # documentation.nixos.extraModules = [ + # ... + # clan-core.nixosModules.clanCore + # { clan.core.clanDir = ./path/to/flake; } + # ]; description = '' the location of the flake repo, used to calculate the location of facts and secrets '';