oizys/lib/default.nix

82 lines
2 KiB
Nix
Raw Normal View History

2024-05-06 14:32:00 -05:00
inputs:
let
2024-05-13 16:31:10 -05:00
inherit (inputs) nixpkgs self zig2nix;
2024-03-01 00:26:52 -06:00
lib = nixpkgs.lib.extend (import ./extended.nix);
2024-05-06 14:32:00 -05:00
inherit (builtins)
mapAttrs
readDir
filter
listToAttrs
;
inherit (lib)
nixosSystem
genAttrs
isNixFile
mkDefaultOizysModule
mkOizysModule
enabled
;
2024-03-01 00:26:52 -06:00
inherit (lib.filesystem) listFilesRecursive;
2024-01-24 14:12:52 -06:00
2024-05-06 14:32:00 -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"];
2024-05-06 14:32:00 -05:00
supportedSystems = [ "x86_64-linux" ];
2024-06-17 09:48:54 -05:00
2024-05-06 14:32:00 -05:00
forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs { inherit system; }));
2024-05-06 14:32:00 -05:00
mkSystem =
2024-05-12 14:50:33 -05:00
hostName:
2024-01-23 11:51:13 -06:00
nixosSystem {
system = "x86_64-linux";
2024-05-12 14:50:33 -05:00
modules = [
../modules/oizys.nix
../overlays
inputs.lix-module.nixosModules.default
] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostName}"));
2024-05-06 14:32:00 -05:00
specialArgs = {
inherit
inputs
lib
self
mkDefaultOizysModule
mkOizysModule
enabled
2024-05-12 14:50:33 -05:00
hostName
2024-05-06 14:32:00 -05:00
;
};
2024-01-23 11:51:13 -06:00
};
2024-03-20 10:43:35 -05:00
2024-06-17 09:48:54 -05:00
in
{
2024-03-21 11:06:07 -05:00
oizysFlake = {
2024-06-17 09:48:54 -05:00
nixosModules = listToAttrs (findModulesList ../modules);
nixosConfigurations = mapAttrs (name: _: mkSystem name) (readDir ../hosts);
packages = forAllSystems (pkgs: rec {
oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { inherit zig2nix; };
oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { };
oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { };
oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { };
default = oizys-go;
});
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
git
deadnix
];
};
});
2024-06-17 10:06:58 -05:00
checks = forAllSystems (
pkgs:
import ./checks.nix {
inherit inputs;
system = pkgs.system;
}
);
2024-06-17 09:48:54 -05:00
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
2024-02-21 14:36:33 -06:00
};
2024-06-17 09:48:54 -05:00
2024-01-23 11:51:13 -06:00
}