oizys/lib/generators.nix

79 lines
1.6 KiB
Nix

{
inputs,
self,
lib,
...
}:
let
inherit (builtins) filter;
inherit (lib)
nixosSystem
mkDefaultOizysModule
mkOizysModule
enabled
enableAttrs
isNixFile
flakeFromSystem
listify
;
inherit (lib.filesystem) listFilesRecursive;
flake = flakeFromSystem "x86_64-linux";
hostPath = host: ../. + "/hosts/${host}";
# all nix files not including pkgs.nix
# hostFiles = host: filter isNixFile (listFilesRecursive (hostPath host));
hostFiles = host: host |> hostPath |> listFilesRecursive |> filter isNixFile;
commonSpecialArgs = {
inherit
self
inputs
lib
enabled
;
};
mkIso = nixosSystem {
system = "x86_64-linux";
modules = [
inputs.lix-module.nixosModules.default
self.nixosModules.nix
self.nixosModules.essentials
self.nixosModules.iso
];
specialArgs = commonSpecialArgs;
};
mkSystem =
hostName:
nixosSystem {
system = "x86_64-linux";
modules = [
# TODO: clean this up
(
{ ... }:
{
nixpkgs.overlays = [ inputs.nim2nix.overlays.default ];
}
)
../overlays
../modules/oizys.nix
inputs.lix-module.nixosModules.default
inputs.hyprland.nixosModules.default
] ++ (hostFiles hostName);
specialArgs = commonSpecialArgs // {
inherit
mkDefaultOizysModule
mkOizysModule
listify
enableAttrs
hostName
flake
;
};
};
in
{
inherit mkIso mkSystem;
}