mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
treewide reformat
This commit is contained in:
parent
de7683556e
commit
fc21bf9436
42 changed files with 1012 additions and 876 deletions
114
lib/default.nix
114
lib/default.nix
|
|
@ -1,82 +1,84 @@
|
|||
inputs @ {
|
||||
unstable,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inputs@{ unstable, self, ... }:
|
||||
let
|
||||
inherit (unstable) lib;
|
||||
|
||||
listNixFilesRecursive = path:
|
||||
builtins.filter (lib.hasSuffix "nix")
|
||||
(lib.filesystem.listFilesRecursive path);
|
||||
listNixFilesRecursive =
|
||||
path:
|
||||
builtins.filter (lib.hasSuffix "nix") (lib.filesystem.listFilesRecursive path);
|
||||
|
||||
importAll = path:
|
||||
map
|
||||
(module: (import module inputs))
|
||||
(listNixFilesRecursive path);
|
||||
importAll =
|
||||
path: map (module: (import module inputs)) (listNixFilesRecursive path);
|
||||
|
||||
mkModules = path:
|
||||
mkModules =
|
||||
path:
|
||||
lib.listToAttrs (
|
||||
map (
|
||||
name: {
|
||||
map
|
||||
(name: {
|
||||
name = lib.pipe name [
|
||||
toString
|
||||
(lib.removeSuffix ".nix")
|
||||
(lib.removePrefix "${toString path}/")
|
||||
];
|
||||
value = import name inputs;
|
||||
}
|
||||
)
|
||||
(listNixFilesRecursive path)
|
||||
})
|
||||
(listNixFilesRecursive path)
|
||||
);
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit importAll mkModules listNixFilesRecursive;
|
||||
|
||||
gerg-utils = config: f:
|
||||
lib.foldr lib.recursiveUpdate {}
|
||||
(map (system:
|
||||
f {
|
||||
inherit system;
|
||||
pkgs =
|
||||
if config == {}
|
||||
then unstable.legacyPackages.${system}
|
||||
else
|
||||
import unstable {
|
||||
inherit system config;
|
||||
};
|
||||
}) ["x86_64-linux"]);
|
||||
gerg-utils =
|
||||
config: f:
|
||||
lib.foldr lib.recursiveUpdate { } (
|
||||
map
|
||||
(
|
||||
system:
|
||||
f {
|
||||
inherit system;
|
||||
pkgs =
|
||||
if config == { } then
|
||||
unstable.legacyPackages.${system}
|
||||
else
|
||||
import unstable { inherit system config; }
|
||||
;
|
||||
}
|
||||
)
|
||||
[ "x86_64-linux" ]
|
||||
);
|
||||
#"x86_64-darwin" "aarch64-linux" "aarch64-darwin"
|
||||
|
||||
mkHosts = system: names:
|
||||
mkHosts =
|
||||
system: names:
|
||||
lib.genAttrs names (
|
||||
name:
|
||||
# Whats lib.nixosSystem? never heard of her
|
||||
lib.evalModules {
|
||||
specialArgs.modulesPath = "${unstable}/nixos/modules";
|
||||
lib.evalModules {
|
||||
specialArgs.modulesPath = "${unstable}/nixos/modules";
|
||||
|
||||
modules =
|
||||
builtins.attrValues self.nixosModules
|
||||
++ importAll "${self}/hosts/${name}"
|
||||
++ [
|
||||
{
|
||||
networking.hostName = name;
|
||||
nixpkgs.hostPlatform = system;
|
||||
}
|
||||
]
|
||||
++ (import "${unstable}/nixos/modules/module-list.nix");
|
||||
}
|
||||
);
|
||||
mkDisko = names:
|
||||
lib.genAttrs names (
|
||||
name: (import "${self}/hosts/${name}/disko.nix" inputs)
|
||||
modules =
|
||||
builtins.attrValues self.nixosModules
|
||||
++ importAll "${self}/hosts/${name}"
|
||||
++ [ {
|
||||
networking.hostName = name;
|
||||
nixpkgs.hostPlatform = system;
|
||||
} ]
|
||||
++ (import "${unstable}/nixos/modules/module-list.nix")
|
||||
;
|
||||
}
|
||||
);
|
||||
mkDisko =
|
||||
names:
|
||||
lib.genAttrs names (name: (import "${self}/hosts/${name}/disko.nix" inputs));
|
||||
|
||||
mkPackages = path: pkgs:
|
||||
mkPackages =
|
||||
path: pkgs:
|
||||
builtins.listToAttrs (
|
||||
map (module: {
|
||||
name = lib.removeSuffix ".nix" (builtins.baseNameOf module);
|
||||
value = pkgs.callPackage module {};
|
||||
})
|
||||
(listNixFilesRecursive path)
|
||||
map
|
||||
(module: {
|
||||
name = lib.removeSuffix ".nix" (builtins.baseNameOf module);
|
||||
value = pkgs.callPackage module { };
|
||||
})
|
||||
(listNixFilesRecursive path)
|
||||
);
|
||||
_file = ./default.nix;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue