Add inline documentation for lib

This commit is contained in:
DashieTM 2024-08-25 18:16:09 +02:00
parent c4f6dae54b
commit 8c9f699269

View file

@ -1,48 +1,63 @@
{ inputs, pkgs, ... }: { { inputs, pkgs, ... }:
/* * {
Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. /**
Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well.
A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration.
The second parameter is the root of your configuration, which should be ./. in most cases. The second parameter is the root of your configuration, which should be ./. in most cases.
# Inputs # Inputs
`systems` `systems`
: a list of strings with hostnames : a list of strings with hostnames
`root` `root`
: the root path of your configuration : the root path of your configuration
# Example usage # Example usage
:::{.example} :::{.example}
```nix ```nix
nixosConfigurations = nixosConfigurations =
(inputs.dashNix.dashNixLib.build_systems [ "nixos" ] ./.); (build_systems [ "nixos" ] ./.);
``` ```
::: :::
*/ */
build_systems = systems: root: build_systems =
builtins.listToAttrs (map (name: { systems: root:
name = name; builtins.listToAttrs (
value = let map (name: {
mod = root + /hosts/${name}/configuration.nix; name = name;
additionalNixosConfig = root + /hosts/${name}/hardware.nix; value =
additionalHomeConfig = root + /hosts/${name}/home.nix; let
in inputs.nixpkgs.lib.nixosSystem { mod = root + /hosts/${name}/configuration.nix;
specialArgs = { inherit inputs pkgs mod additionalHomeConfig root; }; additionalNixosConfig = root + /hosts/${name}/hardware.nix;
modules = [ additionalHomeConfig = root + /hosts/${name}/home.nix;
inputs.home-manager.nixosModules.home-manager in
inputs.stylix.nixosModules.stylix inputs.nixpkgs.lib.nixosSystem {
../base specialArgs = {
../home inherit
../modules inputs
mod pkgs
] ++ inputs.nixpkgs.lib.optional mod
(builtins.pathExists additionalNixosConfig) additionalNixosConfig additionalHomeConfig
++ inputs.nixpkgs.lib.optional (builtins.pathExists mod) mod; root
}; ;
}) systems); };
modules =
[
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
../base
../home
../modules
mod
]
++ inputs.nixpkgs.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig
++ inputs.nixpkgs.lib.optional (builtins.pathExists mod) mod;
};
}) systems
);
} }