treewide: reformat

This commit is contained in:
Michael Hoang
2025-08-08 15:27:00 +10:00
parent 6b137f21de
commit a71a5880c1
40 changed files with 738 additions and 740 deletions

View File

@@ -19,8 +19,7 @@
... ...
}: }:
let let
dependencies = dependencies = [
[
pkgs.stdenv.drvPath pkgs.stdenv.drvPath
] ]
++ builtins.map (i: i.outPath) (builtins.attrValues (builtins.removeAttrs self.inputs [ "self" ])); ++ builtins.map (i: i.outPath) (builtins.attrValues (builtins.removeAttrs self.inputs [ "self" ]));
@@ -154,8 +153,7 @@
nixos-test-backups = self.clanLib.test.containerTest { nixos-test-backups = self.clanLib.test.containerTest {
name = "nixos-test-backups"; name = "nixos-test-backups";
nodes.machine = { nodes.machine = {
imports = imports = [
[
self.nixosModules.clanCore self.nixosModules.clanCore
# Some custom overrides for the backup tests # Some custom overrides for the backup tests
self.nixosModules.test-backup self.nixosModules.test-backup

View File

@@ -50,7 +50,8 @@
self.nixosConfigurations."test-flash-machine-${pkgs.hostPlatform.system}".config.system.build.toplevel self.nixosConfigurations."test-flash-machine-${pkgs.hostPlatform.system}".config.system.build.toplevel
self.nixosConfigurations."test-flash-machine-${pkgs.hostPlatform.system}".config.system.build.diskoScript self.nixosConfigurations."test-flash-machine-${pkgs.hostPlatform.system}".config.system.build.diskoScript
self.nixosConfigurations."test-flash-machine-${pkgs.hostPlatform.system}".config.system.build.diskoScript.drvPath self.nixosConfigurations."test-flash-machine-${pkgs.hostPlatform.system}".config.system.build.diskoScript.drvPath
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ]
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
closureInfo = pkgs.closureInfo { rootPaths = dependencies; }; closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
in in
{ {

View File

@@ -158,7 +158,8 @@
pkgs.stdenv.drvPath pkgs.stdenv.drvPath
pkgs.bash.drvPath pkgs.bash.drvPath
pkgs.buildPackages.xorg.lndir pkgs.buildPackages.xorg.lndir
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ]
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
}; };
in in
pkgs.lib.mkIf (pkgs.stdenv.isLinux && !pkgs.stdenv.isAarch64) { pkgs.lib.mkIf (pkgs.stdenv.isLinux && !pkgs.stdenv.isAarch64) {

View File

@@ -159,7 +159,8 @@ let
pkgs.stdenv.drvPath pkgs.stdenv.drvPath
pkgs.bash.drvPath pkgs.bash.drvPath
pkgs.buildPackages.xorg.lndir pkgs.buildPackages.xorg.lndir
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ]
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
}; };
in in

View File

@@ -35,7 +35,8 @@
pkgs.stdenv.drvPath pkgs.stdenv.drvPath
pkgs.stdenvNoCC pkgs.stdenvNoCC
self.nixosConfigurations.test-morph-machine.config.system.build.toplevel self.nixosConfigurations.test-morph-machine.config.system.build.toplevel
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ]
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
closureInfo = pkgs.closureInfo { rootPaths = dependencies; }; closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
in in

View File

@@ -112,7 +112,8 @@
pkgs.stdenv.drvPath pkgs.stdenv.drvPath
pkgs.bash.drvPath pkgs.bash.drvPath
pkgs.buildPackages.xorg.lndir pkgs.buildPackages.xorg.lndir
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ]
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
}; };
in in
self.clanLib.test.containerTest { self.clanLib.test.containerTest {

View File

@@ -112,8 +112,7 @@ in
''; '';
in in
lib.mkIf (cfg.targets != { }) { lib.mkIf (cfg.targets != { }) {
environment.systemPackages = environment.systemPackages = [
[
(pkgs.writeShellScriptBin "localbackup-create" '' (pkgs.writeShellScriptBin "localbackup-create" ''
set -efu -o pipefail set -efu -o pipefail
export PATH=${ export PATH=${

View File

@@ -116,8 +116,7 @@ in
}; };
clan.core.postgresql.databases.matrix-synapse.restore.stopOnRestore = [ "matrix-synapse" ]; clan.core.postgresql.databases.matrix-synapse.restore.stopOnRestore = [ "matrix-synapse" ];
clan.core.vars.generators = clan.core.vars.generators = {
{
"matrix-synapse" = { "matrix-synapse" = {
files."synapse-registration_shared_secret" = { }; files."synapse-registration_shared_secret" = { };
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -144,8 +143,7 @@ in
systemd.services.matrix-synapse = systemd.services.matrix-synapse =
let let
usersScript = usersScript = ''
''
while ! ${pkgs.netcat}/bin/nc -z -v ::1 8008; do while ! ${pkgs.netcat}/bin/nc -z -v ::1 8008; do
if ! kill -0 "$MAINPID"; then exit 1; fi if ! kill -0 "$MAINPID"; then exit 1; fi
sleep 1; sleep 1;

View File

@@ -18,8 +18,7 @@
config.clan.core.vars.generators.root-password.files.password-hash.path; config.clan.core.vars.generators.root-password.files.password-hash.path;
clan.core.vars.generators.root-password = { clan.core.vars.generators.root-password = {
files.password-hash = files.password-hash = {
{
neededFor = "users"; neededFor = "users";
} }
// (lib.optionalAttrs (_class == "nixos") { // (lib.optionalAttrs (_class == "nixos") {

View File

@@ -32,8 +32,7 @@ in
cfg.certificate.searchDomains != [ ] cfg.certificate.searchDomains != [ ]
) config.clan.core.vars.generators.openssh-cert.files."ssh.id_ed25519-cert.pub".path; ) config.clan.core.vars.generators.openssh-cert.files."ssh.id_ed25519-cert.pub".path;
hostKeys = hostKeys = [
[
{ {
path = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519".path; path = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519".path;
type = "ed25519"; type = "ed25519";
@@ -62,7 +61,8 @@ in
hostNames = [ hostNames = [
"localhost" "localhost"
config.networking.hostName config.networking.hostName
] ++ (lib.optional (config.networking.domain != null) config.networking.fqdn); ]
++ (lib.optional (config.networking.domain != null) config.networking.fqdn);
publicKey = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519.pub".value; publicKey = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519.pub".value;
}; };

View File

@@ -34,8 +34,9 @@ let
value = { value = {
name = machine; name = machine;
id = (lib.removeSuffix "\n" (builtins.readFile (syncthingPublicKeyPath machine))); id = (lib.removeSuffix "\n" (builtins.readFile (syncthingPublicKeyPath machine)));
addresses = addresses = [
[ "dynamic" ] "dynamic"
]
++ ( ++ (
if (lib.elem machine networkIpMachines) then if (lib.elem machine networkIpMachines) then
[ "tcp://[${(lib.removeSuffix "\n" (builtins.readFile (zerotierIpMachinePath machine)))}]:22000" ] [ "tcp://[${(lib.removeSuffix "\n" (builtins.readFile (zerotierIpMachinePath machine)))}]:22000" ]

View File

@@ -21,8 +21,7 @@ in
settings.certificateSearchDomains != [ ] settings.certificateSearchDomains != [ ]
) config.clan.core.vars.generators.openssh-cert.files."ssh.id_ed25519-cert.pub".path; ) config.clan.core.vars.generators.openssh-cert.files."ssh.id_ed25519-cert.pub".path;
hostKeys = hostKeys = [
[
{ {
path = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519".path; path = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519".path;
type = "ed25519"; type = "ed25519";
@@ -51,7 +50,8 @@ in
hostNames = [ hostNames = [
"localhost" "localhost"
config.networking.hostName config.networking.hostName
] ++ (lib.optional (config.networking.domain != null) config.networking.fqdn); ]
++ (lib.optional (config.networking.domain != null) config.networking.fqdn);
publicKey = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519.pub".value; publicKey = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519.pub".value;
}; };

View File

@@ -184,8 +184,7 @@
settings.certificate.searchDomains != [ ] settings.certificate.searchDomains != [ ]
) config.clan.core.vars.generators.openssh-cert.files."ssh.id_ed25519-cert.pub".path; ) config.clan.core.vars.generators.openssh-cert.files."ssh.id_ed25519-cert.pub".path;
hostKeys = hostKeys = [
[
{ {
path = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519".path; path = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519".path;
type = "ed25519"; type = "ed25519";
@@ -201,7 +200,8 @@
hostNames = [ hostNames = [
"localhost" "localhost"
config.networking.hostName config.networking.hostName
] ++ (lib.optional (config.networking.domain != null) config.networking.fqdn); ]
++ (lib.optional (config.networking.domain != null) config.networking.fqdn);
publicKey = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519.pub".value; publicKey = config.clan.core.vars.generators.openssh.files."ssh.id_ed25519.pub".value;
}; };
}; };

View File

@@ -157,11 +157,11 @@
value = { value = {
name = machine; name = machine;
id = readMachineVar machine "syncthing/id/value" ""; id = readMachineVar machine "syncthing/id/value" "";
addresses = addresses = [
[
"dynamic" "dynamic"
] ]
++ lib.optional (readMachineVar machine "zerotier/zerotier-ip/value" null != null) ++
lib.optional (readMachineVar machine "zerotier/zerotier-ip/value" null != null)
"tcp://[${readMachineVar machine "zerotier/zerotier-ip/value" ""}]:22000"; "tcp://[${readMachineVar machine "zerotier/zerotier-ip/value" ""}]:22000";
}; };
}) })

View File

@@ -30,8 +30,7 @@ pkgs.stdenv.mkDerivation {
]; ];
}; };
nativeBuildInputs = nativeBuildInputs = [
[
pkgs.python3 pkgs.python3
uml-c4 uml-c4
] ]

View File

@@ -156,7 +156,8 @@
type = types.submoduleWith { type = types.submoduleWith {
modules = [ modules = [
{ noInstanceOptions = true; } { noInstanceOptions = true; }
] ++ mapAttrsToList fakeInstanceOptions serviceModules; ]
++ mapAttrsToList fakeInstanceOptions serviceModules;
}; };
}; };
} }

View File

@@ -87,8 +87,9 @@
}; };
}; };
systems = import systems; systems = import systems;
imports = imports = [
[ flake-parts.flakeModules.modules ] flake-parts.flakeModules.modules
]
++ ++
# only importing existing paths allows to minimize the flake for test # only importing existing paths allows to minimize the flake for test
# by removing files # by removing files

View File

@@ -95,8 +95,7 @@
"*/asciinema-player/*" "*/asciinema-player/*"
]; ];
}; };
treefmt.programs.mypy.directories = treefmt.programs.mypy.directories = {
{
"clan-cli" = { "clan-cli" = {
directory = "pkgs/clan-cli"; directory = "pkgs/clan-cli";
extraPythonPackages = (self'.packages.clan-cli.devshellPyDeps pkgs.python3Packages); extraPythonPackages = (self'.packages.clan-cli.devshellPyDeps pkgs.python3Packages);

View File

@@ -252,7 +252,8 @@ rec {
// { // {
oneOf = [ oneOf = [
{ type = "null"; } { type = "null"; }
] ++ (lib.optional (!isExcludedOption nestedOption) (parseOption nestedOption)); ]
++ (lib.optional (!isExcludedOption nestedOption) (parseOption nestedOption));
} }
# parse bool # parse bool
else if else if

View File

@@ -61,7 +61,8 @@ let
modules = [ (config.outputs.moduleForMachine.${name} or { }) ]; modules = [ (config.outputs.moduleForMachine.${name} or { }) ];
specialArgs = { specialArgs = {
inherit clan-core; inherit clan-core;
} // specialArgs; }
// specialArgs;
} }
) allMachines; ) allMachines;
@@ -193,7 +194,8 @@ in
# - nixosModules (_class = nixos) # - nixosModules (_class = nixos)
# - darwinModules (_class = darwin) # - darwinModules (_class = darwin)
(lib.optionalAttrs (clan-core ? "${_class}Modules") clan-core."${_class}Modules".clanCore) (lib.optionalAttrs (clan-core ? "${_class}Modules") clan-core."${_class}Modules".clanCore)
] ++ lib.optionals (_class == "nixos") (v.machineImports or [ ]); ]
++ lib.optionals (_class == "nixos") (v.machineImports or [ ]);
# default hostname # default hostname
networking.hostName = lib.mkDefault name; networking.hostName = lib.mkDefault name;

View File

@@ -73,7 +73,8 @@ in
}; };
}; };
} }
] ++ lib.mapAttrsToList (_: service: service.exports) config.mappedServices; ]
++ lib.mapAttrsToList (_: service: service.exports) config.mappedServices;
}; };
default = { }; default = { };
}; };

View File

@@ -15,8 +15,7 @@
lib.evalModules { lib.evalModules {
class = "clan.service"; class = "clan.service";
specialArgs._ctx = prefix; specialArgs._ctx = prefix;
modules = modules = [
[
# Base module # Base module
./service-module.nix ./service-module.nix
# Feature modules # Feature modules

View File

@@ -130,7 +130,8 @@ in
}; };
modules = [ modules = [
(import ./all-services-wrapper.nix { inherit directory; }) (import ./all-services-wrapper.nix { inherit directory; })
] ++ modules; ]
++ modules;
}; };
servicesEval = evalServices { servicesEval = evalServices {
@@ -139,8 +140,7 @@ in
{ {
inherit exportsModule; inherit exportsModule;
mappedServices = lib.mapAttrs (_module_ident: instances: { mappedServices = lib.mapAttrs (_module_ident: instances: {
imports = imports = [
[
# Import the resolved module. # Import the resolved module.
# i.e. clan.modules.admin # i.e. clan.modules.admin
(builtins.head instances).instance.resolvedModule (builtins.head instances).instance.resolvedModule

View File

@@ -756,8 +756,7 @@ in
instanceRes instanceRes
// { // {
nixosModule = { nixosModule = {
imports = imports = [
[
# Result of the applied 'perInstance = {...}: { nixosModule = { ... }; }' # Result of the applied 'perInstance = {...}: { nixosModule = { ... }; }'
instanceRes.nixosModule instanceRes.nixosModule
] ]
@@ -877,7 +876,8 @@ in
} }
) )
(lib.setDefaultModuleLocation "Via ${config.manifest.name}.perMachine - machine='${machineName}';" machineResult.nixosModule) (lib.setDefaultModuleLocation "Via ${config.manifest.name}.perMachine - machine='${machineName}';" machineResult.nixosModule)
] ++ instanceResults.nixosModules; ]
++ instanceResults.nixosModules;
}; };
} }
) config.result.allMachines; ) config.result.allMachines;

View File

@@ -35,7 +35,8 @@ let
clan.core.settings.directory = clan-core; clan.core.settings.directory = clan-core;
} }
clan-core.nixosModules.clanCore clan-core.nixosModules.clanCore
] ++ modules; ]
++ modules;
}; };
in in
# lib.warn '' # lib.warn ''

View File

@@ -45,7 +45,8 @@ lib.mkIf (config.clan.test.useContainers or true) {
{ {
nativeBuildInputs = [ nativeBuildInputs = [
hostPkgs.makeWrapper hostPkgs.makeWrapper
] ++ lib.optionals (!config.skipTypeCheck) [ hostPkgs.mypy ]; ]
++ lib.optionals (!config.skipTypeCheck) [ hostPkgs.mypy ];
buildInputs = [ testDriver ]; buildInputs = [ testDriver ];
testScript = config.testScriptString; testScript = config.testScriptString;
preferLocalBuild = true; preferLocalBuild = true;

View File

@@ -21,7 +21,8 @@ let
colorama colorama
junit-xml junit-xml
nix nix
] ++ extraPythonPackages python3Packages; ]
++ extraPythonPackages python3Packages;
nativeBuildInputs = [ setuptools ]; nativeBuildInputs = [ setuptools ];
format = "pyproject"; format = "pyproject";
src = ./.; src = ./.;

View File

@@ -1,7 +1,6 @@
{ _class, lib, ... }: { _class, lib, ... }:
{ {
imports = imports = [
[
./backups.nix ./backups.nix
./defaults.nix ./defaults.nix
./facts ./facts

View File

@@ -90,8 +90,7 @@
default = { }; default = { };
type = lib.types.attrsOf ( type = lib.types.attrsOf (
lib.types.submodule (secret: { lib.types.submodule (secret: {
options = options = {
{
name = lib.mkOption { name = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = '' description = ''

View File

@@ -175,8 +175,7 @@
default = { }; default = { };
type = lib.types.attrsOf ( type = lib.types.attrsOf (
lib.types.submodule (secret: { lib.types.submodule (secret: {
options = options = {
{
name = lib.mkOption { name = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = '' description = ''

View File

@@ -16,8 +16,7 @@ let
}; };
in in
{ {
imports = imports = [
[
./public/in_repo.nix ./public/in_repo.nix
./secret/fs.nix ./secret/fs.nix
./secret/sops ./secret/sops

View File

@@ -198,8 +198,7 @@ in
] ]
) )
]; ];
options = options = {
{
name = mkOption { name = mkOption {
type = str; type = str;
description = '' description = ''

View File

@@ -43,8 +43,7 @@ in
secrets = lib.listToAttrs ( secrets = lib.listToAttrs (
map (secret: { map (secret: {
name = "vars/${secret.generator}/${secret.name}"; name = "vars/${secret.generator}/${secret.name}";
value = value = {
{
inherit (secret) inherit (secret)
owner owner
group group

View File

@@ -8,8 +8,7 @@ let
... ...
}: }:
{ {
imports = imports = [
[
./clanCore ./clanCore
inputs.sops-nix."${_class}Modules".sops inputs.sops-nix."${_class}Modules".sops
] ]

View File

@@ -90,7 +90,8 @@ pythonRuntime.pkgs.buildPythonApplication {
# gtk4 deps # gtk4 deps
wrapGAppsHook4 wrapGAppsHook4
] ++ runtimeDependencies; ]
++ runtimeDependencies;
# The necessity of setting buildInputs and propagatedBuildInputs to the # The necessity of setting buildInputs and propagatedBuildInputs to the
# same values for your Python package within Nix largely stems from ensuring # same values for your Python package within Nix largely stems from ensuring
@@ -98,7 +99,8 @@ pythonRuntime.pkgs.buildPythonApplication {
# at build time and runtime, # at build time and runtime,
propagatedBuildInputs = [ propagatedBuildInputs = [
(pythonRuntime.withPackages (ps: clan-cli-module ++ (pyDeps ps))) (pythonRuntime.withPackages (ps: clan-cli-module ++ (pyDeps ps)))
] ++ runtimeDependencies; ]
++ runtimeDependencies;
# also re-expose dependencies so we test them in CI # also re-expose dependencies so we test them in CI
passthru = { passthru = {

View File

@@ -35,8 +35,7 @@ mkShell {
clan-app-ui clan-app-ui
]; ];
packages = packages = [
[
# required for reload-python-api.sh script # required for reload-python-api.sh script
json2ts json2ts
] ]
@@ -63,10 +62,10 @@ mkShell {
++ (clan-app.devshellPyDeps ps) ++ (clan-app.devshellPyDeps ps)
)) ))
ruff ruff
] ++ clan-app.runtimeDeps; ]
++ clan-app.runtimeDeps;
shellHook = shellHook = ''
''
export CLAN_CORE_PATH=$(git rev-parse --show-toplevel) export CLAN_CORE_PATH=$(git rev-parse --show-toplevel)
## Clan app ## Clan app

View File

@@ -156,8 +156,7 @@ pythonRuntime.pkgs.buildPythonApplication {
propagatedBuildInputs = [ pythonRuntimeWithDeps ] ++ bundledRuntimeDependencies; propagatedBuildInputs = [ pythonRuntimeWithDeps ] ++ bundledRuntimeDependencies;
passthru.tests = passthru.tests = {
{
clan-deps = pkgs.runCommand "clan-deps" { } '' clan-deps = pkgs.runCommand "clan-deps" { } ''
# ${builtins.toString (builtins.attrValues testRuntimeDependenciesMap)} # ${builtins.toString (builtins.attrValues testRuntimeDependenciesMap)}
touch $out touch $out

View File

@@ -22,7 +22,8 @@ mkShell {
)) ))
ruff ruff
nix-unit nix-unit
] ++ clan-cli.runtimeDependencies; ]
++ clan-cli.runtimeDependencies;
inputsFrom = [ self'.devShells.default ]; inputsFrom = [ self'.devShells.default ];

View File

@@ -34,8 +34,7 @@ let
}; };
# Dependencies that are directly used in the project but nor from internal python packages # Dependencies that are directly used in the project but nor from internal python packages
externalPythonDeps = externalPythonDeps = [
[
pygobject3 pygobject3
pygobject-stubs pygobject-stubs
gtk4 gtk4

View File

@@ -27,8 +27,7 @@ in
mkShell { mkShell {
inherit (clan-vm-manager) nativeBuildInputs; inherit (clan-vm-manager) nativeBuildInputs;
name = "clan-vm-manager"; name = "clan-vm-manager";
buildInputs = buildInputs = [
[
ruff ruff
gtk4.dev # has the demo called 'gtk4-widget-factory' gtk4.dev # has the demo called 'gtk4-widget-factory'
libadwaita.devdoc # has the demo called 'adwaita-1-demo' libadwaita.devdoc # has the demo called 'adwaita-1-demo'