mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +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' (
|
||||
|
|
|
|||
|
|
@ -3,22 +3,19 @@
|
|||
nerd-font-patcher,
|
||||
parallel,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
|
||||
{
|
||||
}: {
|
||||
font,
|
||||
extraArgs ? [ ],
|
||||
extraArgs ? [],
|
||||
useDefaultsArgs ? true,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
/*
|
||||
Credits:
|
||||
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572
|
||||
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422
|
||||
Credits:
|
||||
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572
|
||||
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422
|
||||
|
||||
long font names is not problematic:
|
||||
https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781
|
||||
long font names is not problematic:
|
||||
https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781
|
||||
*/
|
||||
name = "${font.name}-NerdFont";
|
||||
src = font;
|
||||
|
|
@ -27,22 +24,20 @@ stdenvNoCC.mkDerivation {
|
|||
parallel
|
||||
];
|
||||
|
||||
buildPhase =
|
||||
let
|
||||
args =
|
||||
(lib.optionals useDefaultsArgs [
|
||||
"--careful"
|
||||
"--complete"
|
||||
"--quiet"
|
||||
"--no-progressbars"
|
||||
])
|
||||
++ extraArgs;
|
||||
in
|
||||
''
|
||||
mkdir -p nerd-font
|
||||
find \( -name \*.ttf -o -name \*.otf \) | parallel nerd-font-patcher {} \
|
||||
--outputdir nerd-font ${builtins.concatStringsSep " " args}
|
||||
'';
|
||||
buildPhase = let
|
||||
args =
|
||||
(lib.optionals useDefaultsArgs [
|
||||
"--careful"
|
||||
"--complete"
|
||||
"--quiet"
|
||||
"--no-progressbars"
|
||||
])
|
||||
++ extraArgs;
|
||||
in ''
|
||||
mkdir -p nerd-font
|
||||
find \( -name \*.ttf -o -name \*.otf \) | parallel nerd-font-patcher {} \
|
||||
--outputdir nerd-font ${builtins.concatStringsSep " " args}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
exists() { [ -e "$1" ]; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue