Compare commits
2 Commits
assertions
...
clan-autor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e18afbc5ea | ||
|
|
a04443adb8 |
@@ -72,19 +72,12 @@
|
||||
clan = {
|
||||
meta.name = "clan-core";
|
||||
inventory = {
|
||||
services = { };
|
||||
machines = {
|
||||
"test-darwin-machine" = {
|
||||
machineClass = "darwin";
|
||||
};
|
||||
};
|
||||
instances = {
|
||||
users = {
|
||||
roles.default.tags."all" = { };
|
||||
roles.default.settings = {
|
||||
user = "root";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
systems = import systems;
|
||||
|
||||
@@ -275,6 +275,8 @@ in
|
||||
templates = lib.mkOption { type = lib.types.raw; };
|
||||
|
||||
machines = lib.mkOption { type = lib.types.raw; };
|
||||
|
||||
clan-cli = lib.mkOption { type = lib.types.raw; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -273,6 +273,9 @@ in
|
||||
|
||||
# machine specifics
|
||||
machines = configsPerSystem;
|
||||
|
||||
# export clan-cli in clanInternals to tie the CLI to the flake
|
||||
clan-cli = builtins.mapAttrs (_sys: pkgs: pkgs.clan-cli) clan-core.packages;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -418,29 +418,6 @@ in
|
||||
```
|
||||
'';
|
||||
};
|
||||
options.assertions = mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
Assertions for the instance.
|
||||
|
||||
This is a set of assertions that should be checked during the evaluation of the instance.
|
||||
If any assertion fails, an error is thrown.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
assertions = {
|
||||
timeout = {
|
||||
assertion = "settings.timeout > 0";
|
||||
message = "Timeout must be greater than 0";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
type = types.attrsOf types.raw;
|
||||
};
|
||||
options.nixosModule = mkOption {
|
||||
type = types.deferredModule;
|
||||
default = { };
|
||||
@@ -576,15 +553,6 @@ in
|
||||
```
|
||||
'';
|
||||
};
|
||||
options.assertions = mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
Assertions for the machine.
|
||||
|
||||
See instance assertions for more information.
|
||||
'';
|
||||
type = types.attrsOf types.raw;
|
||||
};
|
||||
options.nixosModule = mkOption {
|
||||
type = types.deferredModule;
|
||||
default = { };
|
||||
@@ -909,23 +877,5 @@ in
|
||||
}
|
||||
) config.result.allMachines;
|
||||
};
|
||||
|
||||
debug = mkOption {
|
||||
default = { };
|
||||
# result.allRoles.default.allInstances.users.allMachines.flash-installer
|
||||
};
|
||||
};
|
||||
config.result.assertions = lib.concatMapAttrs (
|
||||
roleName: role:
|
||||
lib.concatMapAttrs (
|
||||
instanceName: instance:
|
||||
lib.concatMapAttrs (
|
||||
machineName: machine:
|
||||
lib.mapAttrs' (assertion_id: value: {
|
||||
name = "${assertion_id} (instance=${instanceName}; role=${roleName}; machine=${machineName};)";
|
||||
inherit value;
|
||||
}) machine.assertions
|
||||
) instance.allMachines
|
||||
) role.allInstances
|
||||
) config.result.allRoles;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,12 @@
|
||||
];
|
||||
|
||||
perSystem =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}:
|
||||
{
|
||||
packages = {
|
||||
agit = pkgs.callPackage ./agit { };
|
||||
@@ -28,6 +33,25 @@
|
||||
classgen = pkgs.callPackage ./classgen { };
|
||||
zerotierone = pkgs.callPackage ./zerotierone { };
|
||||
update-clan-core-for-checks = pkgs.callPackage ./update-clan-core-for-checks { };
|
||||
clan-autorefresh = pkgs.symlinkJoin {
|
||||
name = "clan";
|
||||
paths = [
|
||||
(pkgs.writeScriptBin "clan" ''
|
||||
#!/bin/sh
|
||||
set -efu
|
||||
|
||||
system=$(nix config show system)
|
||||
|
||||
nix \
|
||||
--extra-experimental-features 'flakes nix-command' \
|
||||
run ".#clanInternals.clan-cli.$system" -- "$@"
|
||||
'')
|
||||
self'.packages.clan-cli
|
||||
];
|
||||
postBuild = ''
|
||||
rm -r $out/lib
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
]
|
||||
(system: {
|
||||
default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
|
||||
packages = [ clan-core.packages.${system}.clan-cli ];
|
||||
packages = [
|
||||
clan-core.packages.${system}.clan-autorefresh
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
perSystem =
|
||||
{ pkgs, inputs', ... }:
|
||||
{
|
||||
devShells.default = pkgs.mkShell { packages = [ inputs'.clan-core.packages.clan-cli ]; };
|
||||
devShells.default = pkgs.mkShell { packages = [ inputs'.clan-core.packages.clan-autorefresh ]; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user