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.configurationsDirectory

The directory containing darwinConfigurations.

Type: path

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

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 of users in ${ezConfigs.hm.usersDirectory}, whose comfigurations to import as home manager darwinModules. They will be put inside home-manager.${user}.imports list for this host.

When this list is not empty, 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

Default: [ ]

Declared by:

ezConfigs.darwin.modulesDirectory

The directory containing darwinModules.

Type: 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.globalArgs

Extra arguments to pass to all configurations.

Type: attribute set of anything

Default: { }

Example: { inherit inputs; }

Declared by:

ezConfigs.home.configurationsDirectory

The directory containing homeConfigurations.

Type: path

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

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: 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.configurationsDirectory

The directory containing nixosConfigurations.

Type: path

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

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 of users in ${ezConfigs.hm.usersDirectory}, whose comfigurations to import as home manager nixosModules. They will be put inside home-manager.${user}.imports list for this host.

When this list is not empty, 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

Default: [ ]

Declared by:

ezConfigs.nixos.modulesDirectory

The directory containing nixosModules.

Type: 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 path

Default: null

Example: ./.

Declared by: