oizys/lib/default.nix

52 lines
1.3 KiB
Nix
Raw Normal View History

2024-01-23 11:51:13 -06:00
{
inputs,
self,
2024-01-23 11:51:13 -06:00
}: let
2024-02-23 15:53:46 -06:00
inherit (inputs) nixpkgs;
2024-03-01 00:26:52 -06:00
lib = nixpkgs.lib.extend (import ./extended.nix);
2024-03-17 06:17:19 -05:00
inherit (builtins) mapAttrs readDir filter listToAttrs;
2024-03-13 10:42:36 -05:00
inherit (lib) nixosSystem genAttrs isNixFile;
2024-03-01 00:26:52 -06:00
inherit (lib.filesystem) listFilesRecursive;
2024-01-24 14:12:52 -06:00
2024-03-17 06:17:19 -05:00
inherit (import ./find-modules.nix {inherit lib;}) findModulesList;
2024-02-27 10:27:41 -06:00
#supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
supportedSystems = ["x86_64-linux"];
in rec {
forAllSystems = f: genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system});
2024-02-27 10:41:27 -06:00
2024-01-28 11:00:05 -06:00
buildOizys = _:
2024-01-24 14:12:52 -06:00
forAllSystems (
2024-01-25 10:59:03 -06:00
pkgs: let
2024-01-28 11:00:05 -06:00
pkg = pkgs.callPackage ../oizys {};
2024-01-26 13:09:15 -06:00
in {
2024-01-28 11:00:05 -06:00
oizys = pkg;
2024-01-26 13:09:15 -06:00
default = pkg;
}
2024-01-24 14:12:52 -06:00
);
2024-01-23 11:51:13 -06:00
mkSystem = hostname:
nixosSystem {
system = "x86_64-linux";
2024-02-15 12:01:08 -06:00
modules =
[
../modules/oizys.nix
2024-02-15 12:01:08 -06:00
../overlays
2024-02-15 10:57:13 -06:00
]
2024-02-15 12:01:08 -06:00
++ filter
isNixFile
(listFilesRecursive (../. + "/hosts/${hostname}"));
2024-02-15 10:57:13 -06:00
2024-02-27 10:27:41 -06:00
specialArgs = {inherit inputs lib self;};
2024-01-23 11:51:13 -06:00
};
2024-02-07 10:49:03 -06:00
mapHosts = dir: mapAttrs (name: _: mkSystem name) (readDir dir);
2024-02-19 12:24:03 -06:00
findModules = _: listToAttrs (findModulesList ../modules);
2024-02-21 14:36:33 -06:00
oizysFlake = _: {
nixosModules = findModules {};
2024-02-27 10:41:27 -06:00
nixosConfigurations = mapHosts ../hosts;
2024-02-21 14:36:33 -06:00
packages = buildOizys {};
formatter = forAllSystems (pkgs: pkgs.alejandra);
};
2024-01-23 11:51:13 -06:00
}