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

View File

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

View File

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

View File

@@ -35,7 +35,8 @@
pkgs.stdenv.drvPath
pkgs.stdenvNoCC
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; };
in

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,8 +32,7 @@ in
cfg.certificate.searchDomains != [ ]
) 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;
type = "ed25519";
@@ -62,7 +61,8 @@ in
hostNames = [
"localhost"
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;
};

View File

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

View File

@@ -21,8 +21,7 @@ in
settings.certificateSearchDomains != [ ]
) 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;
type = "ed25519";
@@ -51,7 +50,8 @@ in
hostNames = [
"localhost"
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;
};

View File

@@ -184,8 +184,7 @@
settings.certificate.searchDomains != [ ]
) 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;
type = "ed25519";
@@ -201,7 +200,8 @@
hostNames = [
"localhost"
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;
};
};

View File

@@ -157,11 +157,11 @@
value = {
name = machine;
id = readMachineVar machine "syncthing/id/value" "";
addresses =
[
addresses = [
"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";
};
})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -61,7 +61,8 @@ let
modules = [ (config.outputs.moduleForMachine.${name} or { }) ];
specialArgs = {
inherit clan-core;
} // specialArgs;
}
// specialArgs;
}
) allMachines;
@@ -193,7 +194,8 @@ in
# - nixosModules (_class = nixos)
# - darwinModules (_class = darwin)
(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
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 = { };
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,8 @@ mkShell {
))
ruff
nix-unit
] ++ clan-cli.runtimeDependencies;
]
++ clan-cli.runtimeDependencies;
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
externalPythonDeps =
[
externalPythonDeps = [
pygobject3
pygobject-stubs
gtk4

View File

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