flake: apply nixpkgs-fmt treewide

This commit is contained in:
Infinidoge 2024-05-26 04:57:59 -04:00
parent 8c3d03e9cb
commit b3c0bc9cb0
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A
13 changed files with 279 additions and 276 deletions

View file

@ -1,70 +1,71 @@
{ lib }:
lib.makeExtensible (self:
with lib;
rec {
flattenListSet = imports: (flatten (concatLists (attrValues imports)));
flattenSetList = attrSet: (mapAttrs (name: value: flatten value) attrSet);
lib.makeExtensible
(self:
with lib;
rec {
flattenListSet = imports: (flatten (concatLists (attrValues imports)));
flattenSetList = attrSet: (mapAttrs (name: value: flatten value) attrSet);
# ["/home/user/" "/.screenrc"] -> ["home" "user" ".screenrc"]
splitPath = paths:
(filter
(s: builtins.typeOf s == "string" && s != "")
(concatMap (builtins.split "/") paths)
);
# ["/home/user/" "/.screenrc"] -> ["home" "user" ".screenrc"]
splitPath = paths:
(filter
(s: builtins.typeOf s == "string" && s != "")
(concatMap (builtins.split "/") paths)
);
# ["home" "user" ".screenrc"] -> "home/user/.screenrc"
dirListToPath = dirList: (concatStringsSep "/" dirList);
# ["home" "user" ".screenrc"] -> "home/user/.screenrc"
dirListToPath = dirList: (concatStringsSep "/" dirList);
# ["/home/user/" "/.screenrc"] -> "/home/user/.screenrc"
concatPaths = paths:
let
prefix = optionalString (hasPrefix "/" (head paths)) "/";
path = dirListToPath (splitPath paths);
in
prefix + path;
# ["/home/user/" "/.screenrc"] -> "/home/user/.screenrc"
concatPaths = paths:
let
prefix = optionalString (hasPrefix "/" (head paths)) "/";
path = dirListToPath (splitPath paths);
in
prefix + path;
sanitizeName = name:
replaceStrings
[ "." ] [ "" ]
(sanitizeDerivationName (removePrefix "/" name));
sanitizeName = name:
replaceStrings
[ "." ] [ "" ]
(sanitizeDerivationName (removePrefix "/" name));
mapGenAttrs = list: func: attrs:
lib.genAttrs list (name: func (if builtins.typeOf attrs == "lambda" then attrs name else attrs));
mapGenAttrs = list: func: attrs:
lib.genAttrs list (name: func (if builtins.typeOf attrs == "lambda" then attrs name else attrs));
dirsOf = dir: lib.attrNames (lib.filterAttrs (file: type: type == "directory") (builtins.readDir dir));
dirsOf = dir: lib.attrNames (lib.filterAttrs (file: type: type == "directory") (builtins.readDir dir));
# Only useful for functors
recMap = f: list:
if list == [ ] then f
else recMap (f (head list)) (tail list)
;
# Only useful for functors
recMap = f: list:
if list == [ ] then f
else recMap (f (head list)) (tail list)
;
chain = {
func = id;
__functor = self: input:
if (typeOf input) == "lambda"
then self // { func = e: input (self.func e); }
else self.func input;
};
chain = {
func = id;
__functor = self: input:
if (typeOf input) == "lambda"
then self // { func = e: input (self.func e); }
else self.func input;
};
spread = function: list: if list == [ ] then function else spread (function (head list)) (tail list);
spread = function: list: if list == [ ] then function else spread (function (head list)) (tail list);
# Takes a function and makes it lazy, by consuming arguments and applying it to the inner function first
# before calling the original function
lazy = func: inner: {
inherit func;
app = inner;
__functor = self: input:
let app = self.app input; in
if (typeOf app) == "lambda" then self // { inherit app; }
else self.func app;
};
} // (
import ./digga.nix { inherit lib; }
) // (
import ./hosts.nix { inherit lib; }
) // (
import ./options.nix { inherit lib; }
)) // {
# Takes a function and makes it lazy, by consuming arguments and applying it to the inner function first
# before calling the original function
lazy = func: inner: {
inherit func;
app = inner;
__functor = self: input:
let app = self.app input; in
if (typeOf app) == "lambda" then self // { inherit app; }
else self.func app;
};
} // (
import ./digga.nix { inherit lib; }
) // (
import ./hosts.nix { inherit lib; }
) // (
import ./options.nix { inherit lib; }
)) // {
disko = import ./disko.nix { inherit lib; };
}

View file

@ -51,7 +51,7 @@ rec {
mkBtrfsSubvols' = mountOptions: mapAttrs (n: v: {
mountpoint = n;
mountOptions = mountOptions ++ (optionals (v ? mountOptions) v.mountOptions);
} // (removeAttrs v ["mountOptions"]));
} // (removeAttrs v [ "mountOptions" ]));
mkBtrfsSubvols = mkBtrfsSubvols' defaultMountOptions;
# ZFS