oizys/lib/default.nix

77 lines
1.8 KiB
Nix
Raw Normal View History

2024-05-06 14:32:00 -05:00
inputs:
let
2024-03-26 09:42:22 -05:00
inherit (inputs) nixpkgs self;
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" ];
in
rec {
forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs { inherit system; }));
2024-02-27 10:41:27 -06:00
2024-03-20 10:43:35 -05:00
nixosModules = listToAttrs (findModulesList ../modules);
2024-01-24 14:12:52 -06:00
2024-05-06 14:32:00 -05:00
mkSystem =
hostname:
2024-01-23 11:51:13 -06:00
nixosSystem {
system = "x86_64-linux";
2024-05-06 14:32:00 -05:00
modules = [
../modules/oizys.nix
../overlays
] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostname}"));
2024-02-15 10:57:13 -06:00
2024-05-06 14:32:00 -05:00
specialArgs = {
inherit
inputs
lib
self
mkDefaultOizysModule
mkOizysModule
enabled
;
};
2024-01-23 11:51:13 -06:00
};
2024-03-20 10:43:35 -05:00
oizysHosts = mapAttrs (name: _: mkSystem name) (readDir ../hosts);
2024-05-06 14:32:00 -05:00
oizysPkg = forAllSystems (pkgs: rec {
oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { zig2nix = inputs.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-02-21 14:36:33 -06:00
2024-03-21 11:06:07 -05:00
oizysFlake = {
2024-03-20 10:43:35 -05:00
nixosModules = nixosModules;
nixosConfigurations = oizysHosts;
packages = oizysPkg;
devShells = devShells;
2024-05-06 14:32:00 -05:00
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
2024-02-21 14:36:33 -06:00
};
2024-01-23 11:51:13 -06:00
}