Compare commits

..

2 Commits

Author SHA1 Message Date
lassulus
e18afbc5ea pkgs: add clan-autorefresh
This adds a clan-cli shim that always uses nix run to run the pinned
clan-cli version. For this we need to expose the clan-cli via
clanInternals.
2025-07-16 12:03:31 +02:00
Jörg Thalheim
a04443adb8 waypipe: disable gpu for now 2025-07-16 12:03:31 +02:00
7 changed files with 35 additions and 61 deletions

View File

@@ -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;

View File

@@ -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; };
};
};
};

View File

@@ -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;
};
};
}

View File

@@ -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;
}

View File

@@ -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
'';
};
};
};
}

View File

@@ -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
];
};
});
};

View File

@@ -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 ]; };
};
};
}