From 07665aae2b89e367ac3a59baa0e133824c8a41b9 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 3 Jul 2024 13:05:25 -0500 Subject: [PATCH] add iso builder package --- lib/default.nix | 46 +++------------------------ lib/generators.nix | 66 +++++++++++++++++++++++++++++++++++++++ modules/users/default.nix | 7 ++++- 3 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 lib/generators.nix diff --git a/lib/default.nix b/lib/default.nix index f7d30d7..a98dcd4 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -3,59 +3,21 @@ let inherit (inputs) nixpkgs self; lib = nixpkgs.lib.extend (import ./extended.nix); - inherit (builtins) - mapAttrs - readDir - filter - listToAttrs - ; - inherit (lib) - nixosSystem - genAttrs - isNixFile - mkDefaultOizysModule - mkOizysModule - enabled - enableAttrs - ; - inherit (lib.filesystem) listFilesRecursive; + inherit (builtins) mapAttrs readDir listToAttrs; + inherit (lib) genAttrs; inherit (import ./find-modules.nix { inherit lib; }) findModulesList; + inherit (import ./generators.nix { inherit lib self inputs; }) mkIso mkSystem; #supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; supportedSystems = [ "x86_64-linux" ]; - forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs { inherit system; })); - - mkSystem = - hostName: - nixosSystem { - system = "x86_64-linux"; - modules = [ - ../modules/oizys.nix - ../overlays - inputs.lix-module.nixosModules.default - inputs.hyprland.nixosModules.default - ] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostName}")); - specialArgs = { - inherit - inputs - lib - self - mkDefaultOizysModule - mkOizysModule - enabled - enableAttrs - hostName - ; - }; - }; - in { oizysFlake = { nixosModules = listToAttrs (findModulesList ../modules); nixosConfigurations = mapAttrs (name: _: mkSystem name) (readDir ../hosts); packages = forAllSystems (pkgs: rec { + iso = mkIso.config.system.build.isoImage; oizys-go = pkgs.callPackage ../pkgs/oizys { }; default = oizys-go; }); diff --git a/lib/generators.nix b/lib/generators.nix new file mode 100644 index 0000000..7e5204b --- /dev/null +++ b/lib/generators.nix @@ -0,0 +1,66 @@ +{ + inputs, + self, + lib, + ... +}: +let + inherit (builtins) filter; + inherit (lib) + nixosSystem + isNixFile + mkDefaultOizysModule + mkOizysModule + enabled + enableAttrs + ; + inherit (lib.filesystem) listFilesRecursive; + + mkIso = nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.nix + self.nixosModules.essentials + ( + { pkgs, modulesPath, ... }: + { + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; + environment.systemPackages = with pkgs; [ neovim ]; + } + ) + ]; + specialArgs = { + inherit + inputs + lib + self + enabled; + }; + }; + mkSystem = + hostName: + nixosSystem { + system = "x86_64-linux"; + modules = [ + ../modules/oizys.nix + ../overlays + inputs.lix-module.nixosModules.default + inputs.hyprland.nixosModules.default + ] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostName}")); + specialArgs = { + inherit + inputs + lib + self + mkDefaultOizysModule + mkOizysModule + enabled + enableAttrs + hostName + ; + }; + }; +in +{ + inherit mkIso mkSystem; +} diff --git a/modules/users/default.nix b/modules/users/default.nix index 4710541..89b1086 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -5,7 +5,12 @@ ... }: let - inherit (lib) mkOption mkIf types optional; + inherit (lib) + mkOption + mkIf + types + optional + ; cfg = config.users.defaultUser; isDocker = config.oizys.docker.enable; isDesktop = config.oizys.desktop.enable;