ez-configs

ez-configs lets you define multiple nixos, darwin, and home manager configurations, and reuse common modules using your flake directory structure.

Installation

To use these options, add to your flake inputs:

ez-configs.url = "github:ehllie/ez-configs";

and inside the mkFlake:

imports = [ inputs.ez-configs.flakeModule ];

Run nix flake lock and you're set.

Options

ezConfigs.darwin.configurationEntryPoint

Entry point file for darwinConfigurations.

Type: string

Default: "default.nix"

Declared by:

ezConfigs.darwin.configurationsDirectory

The directory containing darwinConfigurations.

Type: absolute path

Default: "${ezConfigs.root}/darwin-configurations"

Declared by:

ezConfigs.darwin.earlyModuleArgs

Extra arguments to pass to all darwinModules before exporting them.

Type: attribute set of anything

Default: ezConfigs.earlyModuleArgs

Declared by:

ezConfigs.darwin.hosts

Settings for creating darwinConfigurations.

It’s not neccessary to specify this option to create flake outputs. It’s only needed if you want to change the defaults for specific darwinConfigurations.

Type: attribute set of (submodule)

Default: { }

Example:

{ hostA = { userHomeModules = [ "bob" ]; }; hostB = { importDefault = false; arch = "aarch64 }; }

Declared by:

ezConfigs.darwin.hosts.<name>.importDefault

Whether to import the default module for this host.

Type: boolean

Default: true

Declared by:

ezConfigs.darwin.hosts.<name>.userHomeModules

List or attribute set of users in ${ezConfigs.hm.usersDirectory}, whose comfigurations to import as home manager darwinModules. If it’s a list, each user is assumed to have the same name as the homeModule. You can override this by using an attribute set, where the attribute name is the name of the host user, while value is the name of the homeModule. They will be put inside home-manager.${user}.imports list for this host.

When this option is set, the home-manager.extraSpecialArgs option is also set to the one it would recieve in homeManagerConfigurations output, and the appropriate homeManager module is imported.

Type: (list of string) or attribute set of string

Default: [ ]

Example:

{ alice = "alice-minimal"; bob = "bob-full"; }

Declared by:

ezConfigs.darwin.modulesDirectory

The directory containing darwinModules.

Type: absolute path

Default: "${ezConfigs.root}/darwin-modules"

Declared by:

ezConfigs.darwin.specialArgs

Extra arguments to pass to all darwinConfigurations.

Type: attribute set of anything

Default: ezConfigs.globalArgs

Declared by:

ezConfigs.earlyModuleArgs

Extra arguments to pass to all modules before exporting them.

Type: attribute set of anything

Default: { }

Example: { inherit inputs; }

Declared by:

ezConfigs.globalArgs

Extra arguments to pass to all configurations.

Type: attribute set of anything

Default: { }

Example: { inherit inputs; }

Declared by:

ezConfigs.home.configurationEntryPoint

Entry point file for homeConfigurations.

Type: string

Default: "default.nix"

Declared by:

ezConfigs.home.configurationsDirectory

The directory containing homeConfigurations.

Type: absolute path

Default: "${ezConfigs.root}/home-configurations"

Declared by:

ezConfigs.home.earlyModuleArgs

Extra arguments to pass to all homeModules before exporting them.

Type: attribute set of anything

Default: ezConfigs.earlyModuleArgs

Declared by:

ezConfigs.home.extraSpecialArgs

Extra arguments to pass to all homeConfigurations.

Type: attribute set of anything

Default: ezConfigs.globalArgs

Declared by:

ezConfigs.home.modulesDirectory

The directory containing homeModules.

Type: absolute path

Default: "${ezConfigs.root}/home-modules"

Declared by:

ezConfigs.home.users

Settings for creating homeConfigurations.

It’s not neccessary to specify this option to create flake outputs. It’s only needed if you want to change the defaults for specific homeConfigurations.

Type: attribute set of (submodule)

Default: { }

Example:

{ alice = { standalone = { enable = true; pkgs = import nixpkgs { system = "x86_64-linux"; }; }; }; bob = { importDefault = false; }; }

Declared by:

ezConfigs.home.users.<name>.importDefault

Whether to import the default module for this user.

Type: boolean

Default: true

Declared by:

ezConfigs.home.users.<name>.nameFunction

Function to generate the name of the user configuration using the host name.

Type: null or (function that evaluates to a(n) string)

Default: ${username}@${hostname}

Example: (host: "${host}-${name})")

Declared by:

ezConfigs.home.users.<name>.passInOsConfig

Whether to pass the osConfig argument to extraSpecialArgs. This will be the nixosConfiguration.config or darwinConfiguration.config, whose pkgs are being used to build this homeConfiguration.

Type: boolean

Default: true

Declared by:

ezConfigs.home.users.<name>.standalone.enable

Whether to create a standalone user configuration.

By default each user and host pair gets its own homeConfigurations attribute, and the pkgs passed into homeConfiguration function come from that system.

This will prevent the ${user}@${host} outputs from being created. Instead a standalone user configuration will be created with user name.

Type: boolean

Default: false

Declared by:

ezConfigs.home.users.<name>.standalone.pkgs

The package set with which to construct the homeManagerConfiguration.

Non standalone user configurations will use the package set of the host system.

Type: Nixpkgs package set

Example: import nixpkgs {system = "x86_64-linux"}

Declared by:

ezConfigs.nixos.configurationEntryPoint

Entry point file for nixosConfigurations.

Type: string

Default: "default.nix"

Declared by:

ezConfigs.nixos.configurationsDirectory

The directory containing nixosConfigurations.

Type: absolute path

Default: "${ezConfigs.root}/nixos-configurations"

Declared by:

ezConfigs.nixos.earlyModuleArgs

Extra arguments to pass to all nixosModules before exporting them.

Type: attribute set of anything

Default: ezConfigs.earlyModuleArgs

Declared by:

ezConfigs.nixos.hosts

Settings for creating nixosConfigurations.

It’s not neccessary to specify this option to create flake outputs. It’s only needed if you want to change the defaults for specific nixosConfigurations.

Type: attribute set of (submodule)

Default: { }

Example:

{ hostA = { userHomeModules = [ "bob" ]; }; hostB = { importDefault = false; arch = "aarch64 }; }

Declared by:

ezConfigs.nixos.hosts.<name>.importDefault

Whether to import the default module for this host.

Type: boolean

Default: true

Declared by:

ezConfigs.nixos.hosts.<name>.userHomeModules

List or attribute set of users in ${ezConfigs.hm.usersDirectory}, whose comfigurations to import as home manager nixosModules. If it’s a list, each user is assumed to have the same name as the homeModule. You can override this by using an attribute set, where the attribute name is the name of the host user, while value is the name of the homeModule. They will be put inside home-manager.${user}.imports list for this host.

When this option is set, the home-manager.extraSpecialArgs option is also set to the one it would recieve in homeManagerConfigurations output, and the appropriate homeManager module is imported.

Type: (list of string) or attribute set of string

Default: [ ]

Example:

{ alice = "alice-minimal"; bob = "bob-full"; }

Declared by:

ezConfigs.nixos.modulesDirectory

The directory containing nixosModules.

Type: absolute path

Default: "${ezConfigs.root}/nixos-modules"

Declared by:

ezConfigs.nixos.specialArgs

Extra arguments to pass to all nixosConfigurations.

Type: attribute set of anything

Default: ezConfigs.globalArgs

Declared by:

ezConfigs.root

The root from which configurations and modules should be searched.

Type: null or absolute path

Default: null

Example: ./.

Declared by: