lib/nixosSystem.nix: Wrap nixpkgs.lib.nixosSystem and include nixfiles modules and overlays by default
This commit is contained in:
@@ -10,29 +10,13 @@ let
|
|||||||
group ? null,
|
group ? null,
|
||||||
modules ? [],
|
modules ? [],
|
||||||
}: let
|
}: let
|
||||||
localNixpkgs = import ./nixpkgs.nix inputs;
|
in self.lib.nixosSystem {
|
||||||
in nixpkgs.lib.nixosSystem {
|
|
||||||
system = system;
|
system = system;
|
||||||
pkgs = localNixpkgs.${system};
|
|
||||||
modules = modules ++ [
|
modules = modules ++ [
|
||||||
self.nixosModules.nixfilesInputs
|
|
||||||
self.nixosModules.clerie
|
|
||||||
self.nixosModules.profiles
|
|
||||||
|
|
||||||
({ config, lib, ... }: {
|
({ config, lib, ... }: {
|
||||||
# Set hostname
|
# Set hostname
|
||||||
networking.hostName = lib.mkDefault name;
|
networking.hostName = lib.mkDefault name;
|
||||||
|
|
||||||
/*
|
|
||||||
Make the contents of the flake availiable to modules.
|
|
||||||
Useful for having the monitoring server scraping the
|
|
||||||
target config from all other servers automatically.
|
|
||||||
*/
|
|
||||||
_module.args = {
|
|
||||||
inputs = inputs;
|
|
||||||
_nixfiles = self;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Expose host group to monitoring
|
# Expose host group to monitoring
|
||||||
clerie.monitoring = nixpkgs.lib.attrsets.optionalAttrs (group != null) { serviceLevel = group; };
|
clerie.monitoring = nixpkgs.lib.attrsets.optionalAttrs (group != null) { serviceLevel = group; };
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@ let
|
|||||||
|
|
||||||
lib = {
|
lib = {
|
||||||
clerie-monitoring-ids = callLibs ./clerie-monitoring-ids.nix;
|
clerie-monitoring-ids = callLibs ./clerie-monitoring-ids.nix;
|
||||||
|
nixosSystem = callLibs ./nixosSystem.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
41
lib/nixosSystem.nix
Normal file
41
lib/nixosSystem.nix
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
nixfiles.lib.nixosSystem, like nixpkgs.lib.nixosSystem but
|
||||||
|
with nixfiles overlays and modules already populated
|
||||||
|
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
system ? null,
|
||||||
|
pkgs ? null,
|
||||||
|
modules ? [],
|
||||||
|
...
|
||||||
|
}@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
localNixpkgs = import ../flake/nixpkgs.nix inputs;
|
||||||
|
in inputs.nixpkgs.lib.nixosSystem ({
|
||||||
|
system = system;
|
||||||
|
pkgs = if pkgs != null then pkgs else localNixpkgs.${system};
|
||||||
|
modules = [
|
||||||
|
self.nixosModules.nixfilesInputs
|
||||||
|
self.nixosModules.clerie
|
||||||
|
self.nixosModules.profiles
|
||||||
|
({ config, lib, ... }: {
|
||||||
|
/*
|
||||||
|
Make the contents of the flake availiable to modules.
|
||||||
|
Useful for having the monitoring server scraping the
|
||||||
|
target config from all other servers automatically.
|
||||||
|
*/
|
||||||
|
_module.args = {
|
||||||
|
inputs = inputs;
|
||||||
|
_nixfiles = self;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
] ++ modules;
|
||||||
|
} // builtins.removeAttrs args [ "system" "pkgs" "modules" ] )
|
Reference in New Issue
Block a user