nix: format with alejandra

This commit is contained in:
Primrose 2025-02-08 12:05:12 +01:00
parent d5cad148da
commit 95eb4b71e0
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
118 changed files with 1291 additions and 1703 deletions

View file

@ -1,76 +1,72 @@
inputs:
let
inputs: let
inherit (inputs.nixpkgs) lib;
in
{
mkNixOS =
sharedModules:
{
hostname,
system,
modules ? [ ],
}:
in {
mkNixOS = sharedModules: {
hostname,
system,
modules ? [],
}:
inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit hostname;
};
modules = sharedModules { inherit hostname system; } ++ modules;
modules = sharedModules {inherit hostname system;} ++ modules;
};
mkDarwin =
sharedModules:
{
hostname,
system,
modules ? [ ],
}:
mkDarwin = sharedModules: {
hostname,
system,
modules ? [],
}:
inputs.nix-darwin.lib.darwinSystem {
specialArgs = {
inherit hostname;
};
modules = sharedModules { inherit hostname system; } ++ modules;
modules = sharedModules {inherit hostname system;} ++ modules;
};
mkHomeManager =
sharedModules:
{
hostname,
system,
modules ? [ ],
}:
let
pkgs = import inputs.nixpkgs { };
in
mkHomeManager = sharedModules: {
hostname,
system,
modules ? [],
}: let
pkgs = import inputs.nixpkgs {};
in
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit hostname;
};
modules = sharedModules { inherit hostname system; } ++ modules;
modules = sharedModules {inherit hostname system;} ++ modules;
};
many = func: builtins.mapAttrs (hostname: cfgs: func (cfgs // { inherit hostname; }));
many = func: builtins.mapAttrs (hostname: cfgs: func (cfgs // {inherit hostname;}));
maybePathOrDefault =
path: default:
maybePathOrDefault = path: default:
if
lib.pathExists # Test directory/default.nix or just the file
(if lib.pathIsDirectory path then (lib.path.append path "default.nix") else path)
then
path
else
default;
(
if lib.pathIsDirectory path
then (lib.path.append path "default.nix")
else path
)
then path
else default;
mergeAttrsWith =
f: xs: ys:
mergeAttrsWith = f: xs: ys:
builtins.foldl' (
acc: n: acc // (if acc ? ${n} then { ${n} = f xs.${n} ys.${n}; } else { ${n} = ys.${n}; })
) xs (builtins.attrNames ys);
acc: n:
acc
// (
if acc ? ${n}
then {${n} = f xs.${n} ys.${n};}
else {${n} = ys.${n};}
)
)
xs (builtins.attrNames ys);
modulesFromDir =
path:
modulesFromDir = path:
lib.pipe (builtins.readDir path) [
(lib.filterAttrs (moduleName: _: moduleName != "default.nix"))
(lib.mapAttrs' (