Compare commits

..

2 Commits

Author SHA1 Message Date
Johannes Kirschbauer
4cfe69d7f5 WIP 2025-07-16 12:03:25 +02:00
Jörg Thalheim
1c5257f5fe waypipe: disable gpu for now 2025-07-16 12:03:25 +02:00
7 changed files with 61 additions and 35 deletions

View File

@@ -72,12 +72,19 @@
clan = { clan = {
meta.name = "clan-core"; meta.name = "clan-core";
inventory = { inventory = {
services = { };
machines = { machines = {
"test-darwin-machine" = { "test-darwin-machine" = {
machineClass = "darwin"; machineClass = "darwin";
}; };
}; };
instances = {
users = {
roles.default.tags."all" = { };
roles.default.settings = {
user = "root";
};
};
};
}; };
}; };
systems = import systems; systems = import systems;

View File

@@ -275,8 +275,6 @@ in
templates = lib.mkOption { type = lib.types.raw; }; templates = lib.mkOption { type = lib.types.raw; };
machines = lib.mkOption { type = lib.types.raw; }; machines = lib.mkOption { type = lib.types.raw; };
clan-cli = lib.mkOption { type = lib.types.raw; };
}; };
}; };
}; };

View File

@@ -273,9 +273,6 @@ in
# machine specifics # machine specifics
machines = configsPerSystem; 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;
}; };
}; };
} }

View File

@@ -418,6 +418,29 @@ 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 { options.nixosModule = mkOption {
type = types.deferredModule; type = types.deferredModule;
default = { }; default = { };
@@ -553,6 +576,15 @@ in
``` ```
''; '';
}; };
options.assertions = mkOption {
default = { };
description = ''
Assertions for the machine.
See instance assertions for more information.
'';
type = types.attrsOf types.raw;
};
options.nixosModule = mkOption { options.nixosModule = mkOption {
type = types.deferredModule; type = types.deferredModule;
default = { }; default = { };
@@ -877,5 +909,23 @@ in
} }
) config.result.allMachines; ) 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;
} }

View File

@@ -13,12 +13,7 @@
]; ];
perSystem = perSystem =
{ { config, pkgs, ... }:
config,
pkgs,
self',
...
}:
{ {
packages = { packages = {
agit = pkgs.callPackage ./agit { }; agit = pkgs.callPackage ./agit { };
@@ -33,25 +28,6 @@
classgen = pkgs.callPackage ./classgen { }; classgen = pkgs.callPackage ./classgen { };
zerotierone = pkgs.callPackage ./zerotierone { }; zerotierone = pkgs.callPackage ./zerotierone { };
update-clan-core-for-checks = pkgs.callPackage ./update-clan-core-for-checks { }; 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
'';
};
}; };
}; };
} }

View File

@@ -25,9 +25,7 @@
] ]
(system: { (system: {
default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell { default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
packages = [ packages = [ clan-core.packages.${system}.clan-cli ];
clan-core.packages.${system}.clan-autorefresh
];
}; };
}); });
}; };

View File

@@ -28,7 +28,7 @@
perSystem = perSystem =
{ pkgs, inputs', ... }: { pkgs, inputs', ... }:
{ {
devShells.default = pkgs.mkShell { packages = [ inputs'.clan-core.packages.clan-autorefresh ]; }; devShells.default = pkgs.mkShell { packages = [ inputs'.clan-core.packages.clan-cli ]; };
}; };
}; };
} }