move nixos-facter imports to clanCore
This commit is contained in:
@@ -63,37 +63,15 @@ let
|
|||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
modules =
|
modules =
|
||||||
let
|
let
|
||||||
settings = machineSettings name;
|
|
||||||
facterJson = "${directory}/machines/${name}/facter.json";
|
|
||||||
hwConfig = "${directory}/machines/${name}/hardware-configuration.nix";
|
hwConfig = "${directory}/machines/${name}/hardware-configuration.nix";
|
||||||
|
|
||||||
facterModules = lib.optionals (builtins.pathExists facterJson) [
|
|
||||||
{ config.facter.reportPath = facterJson; }
|
|
||||||
];
|
|
||||||
in
|
in
|
||||||
(machineImports settings)
|
[
|
||||||
++ facterModules
|
|
||||||
++ [
|
|
||||||
{
|
{
|
||||||
# Autoinclude configuration.nix and hardware-configuration.nix
|
# Autoinclude configuration.nix and hardware-configuration.nix
|
||||||
imports = builtins.filter builtins.pathExists [
|
imports = builtins.filter builtins.pathExists [
|
||||||
"${directory}/machines/${name}/configuration.nix"
|
"${directory}/machines/${name}/configuration.nix"
|
||||||
hwConfig
|
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
|
settings
|
||||||
clan-core.nixosModules.clanCore
|
clan-core.nixosModules.clanCore
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
./meta/interface.nix
|
./meta/interface.nix
|
||||||
./metadata.nix
|
./metadata.nix
|
||||||
./networking.nix
|
./networking.nix
|
||||||
|
./nixos-facter.nix
|
||||||
./nix-settings.nix
|
./nix-settings.nix
|
||||||
./options.nix
|
./options.nix
|
||||||
./outputs.nix
|
./outputs.nix
|
||||||
|
|||||||
24
nixosModules/clanCore/nixos-facter.nix
Normal file
24
nixosModules/clanCore/nixos-facter.nix
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
directory = config.clan.core.clanDir;
|
||||||
|
inherit (config.clan.core) machineName;
|
||||||
|
facterJson = "${directory}/machines/${machineName}/facter.json";
|
||||||
|
hwConfig = "${directory}/machines/${machineName}/hardware-configuration.nix";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
facter.reportPath = lib.mkIf (builtins.pathExists facterJson) facterJson;
|
||||||
|
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}'.
|
||||||
|
''
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user