mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 22:59:15 +00:00
nix: format with alejandra
This commit is contained in:
parent
d5cad148da
commit
95eb4b71e0
118 changed files with 1291 additions and 1703 deletions
|
|
@ -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' (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue