mirror of
https://github.com/elwrcl/copnix.git
synced 2026-10-31 06:18:03 +03:00
dentritic refactor
This commit is contained in:
140 files changed
+2285
-2622
No files matched your search
@@ -0,0 +1,8 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.flake.darwinModules = lib.mkOption {
|
||||
type = lib.types.lazyAttrsOf lib.types.deferredModule;
|
||||
default = { };
|
||||
description = "Darwin module pool (symmetric with flake.nixosModules).";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
moduleLocation,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.lists) singleton;
|
||||
inherit (lib.modules) mkMerge;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) deferredModule lazyAttrsOf;
|
||||
|
||||
wrap =
|
||||
kind: name: value:
|
||||
let
|
||||
file = "${toString moduleLocation}#${kind}.${name}";
|
||||
in
|
||||
{
|
||||
_file = file;
|
||||
key = file;
|
||||
imports = singleton value;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.commonModules = mkOption {
|
||||
type = lazyAttrsOf deferredModule;
|
||||
default = { };
|
||||
apply = mapAttrs (wrap "commonModules");
|
||||
description = "NixOS and Darwin modules shared between both platforms.";
|
||||
};
|
||||
|
||||
config.flake.nixosModules = mkMerge [ config.commonModules ];
|
||||
config.flake.darwinModules = mkMerge [ config.commonModules ];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.flake.homeModules = lib.mkOption {
|
||||
type = lib.types.lazyAttrsOf lib.types.deferredModule;
|
||||
default = { };
|
||||
description = "home-manager modul pool (symmetric with flake.nixosModules).";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{ ... }:
|
||||
{
|
||||
commonModules.hostname-assert =
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
options.elars.expectedHostName = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "host filename must match networking.hostName.";
|
||||
};
|
||||
|
||||
config.assertions = lib.singleton {
|
||||
assertion =
|
||||
config.elars.expectedHostName == null
|
||||
|| config.networking.hostName == config.elars.expectedHostName;
|
||||
message = ''
|
||||
syntax: hostname assertion failed:
|
||||
expected (filename) : ${toString config.elars.expectedHostName}
|
||||
real (networking) : ${toString config.networking.hostName}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user