diff --git a/flake.nix b/flake.nix index c6fc6b7..fb99f26 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ }; }; - outputs = inputs@{ flake-parts, ... }: + outputs = { flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { debug = true; diff --git a/lib/module/default.nix b/lib/module/default.nix new file mode 100644 index 0000000..3f58942 --- /dev/null +++ b/lib/module/default.nix @@ -0,0 +1,16 @@ +{ + lib, + ... +}: +{ + ## Create a NixOS module option as a one-liner. + ## + ## ```nix + ## lib.mkOpt nixpkgs.lib.types.str "My default" "Option description" + ## ``` + ## + #@ Type -> Any -> String + mkOpt = + type: default: description: + lib.mkOption { inherit type default description; }; +} diff --git a/modules/flake/arguments.nix b/modules/flake/arguments.nix index a7b2aa2..24e4a91 100644 --- a/modules/flake/arguments.nix +++ b/modules/flake/arguments.nix @@ -1,13 +1,44 @@ { + lib, inputs, config, ... }: +let + # Recursive function to load all `default.nix` files and merge them into a single attr. set + loadLibs = directory: + builtins.foldl' (acc: name: + let + path = "${directory}/${name}"; + isDir = (builtins.getAttr name (builtins.readDir directory)) == "directory"; + in + if isDir then + lib.mergeAttrs acc (loadLibs path) + else if name == "default.nix" then + lib.mergeAttrs acc (import path { inherit lib; }) + else + acc + ) {} (builtins.attrNames (builtins.readDir directory)); +in { # Overwrite and add new arguments to all flake modules. _module.args = { namespace = config.flake.namespace; + ## Recursive loading of libraries, similar to snowfall lib. + ## Logical flow: read files => merge all file outputs to single attr. set + ## The directory in question is flake-root => lib + ## The directory structure is: + ## lib/ + ## => libname + ## => default.nix + ## => libname2 + ## => default.nix + ## + ## The structure of multiple libs is simply for organization and the attrs. of all default.nix files should still be merged + ## into a single set. + puzzlelib = loadLibs ../../lib; + # Initialize nixpkgs instance with custom overlays. pkgs = import inputs.nixpkgs { overlays = [ diff --git a/systems/x86_64-nixos/puzzlevision/default.nix b/systems/x86_64-nixos/puzzlevision/default.nix index d0874c5..09a52fd 100644 --- a/systems/x86_64-nixos/puzzlevision/default.nix +++ b/systems/x86_64-nixos/puzzlevision/default.nix @@ -7,6 +7,13 @@ ./hardware.nix ]; + virtualisation.vmVariant = { + virtualisation = { + cores = 6; + memorySize = 2048; + }; + }; + # Todo: pass a set of users to enable from within easy-hosts and automatically map the corresponding home-manager configurations # ${namespace} = { # mainUser = "jo"; @@ -18,7 +25,7 @@ # Enable Plasma6 services.xserver.enable = true; - services.displayManager.sddm.wayland.enable = true; + services.displayManager.sddm.enable = true; services.desktopManager.plasma6.enable = true; environment.systemPackages = with pkgs; [