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

ezConfigs.darwin.hosts

ezConfigs.darwin.hosts.<name>.importDefault

ezConfigs.darwin.hosts.<name>.userHomeModules

ezConfigs.darwin.modulesDirectory

ezConfigs.darwin.specialArgs

ezConfigs.globalArgs

ezConfigs.home.configurationsDirectory

ezConfigs.home.extraSpecialArgs

ezConfigs.home.modulesDirectory

ezConfigs.home.users

ezConfigs.home.users.<name>.importDefault

ezConfigs.home.users.<name>.nameFunction

ezConfigs.home.users.<name>.passInOsConfig

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

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

ezConfigs.nixos.configurationsDirectory

ezConfigs.nixos.hosts

ezConfigs.nixos.hosts.<name>.importDefault

ezConfigs.nixos.hosts.<name>.userHomeModules

ezConfigs.nixos.modulesDirectory

ezConfigs.nixos.specialArgs

ezConfigs.root

ezConfigs.darwin.configurationsDirectory

The directory containing darwinConfigurations.

Type: path in the Nix store

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

Declared by:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

ezConfigs.darwin.hosts.<name>.importDefault

Whether to import the default module for this host.

Type: boolean

Default: true

Declared by:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

ezConfigs.darwin.modulesDirectory

The directory containing darwinModules.

Type: path in the Nix store

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

Declared by:

ez-configs/flake-module.nix

ezConfigs.darwin.specialArgs

Extra arguments to pass to all darwinConfigurations.

Type: attribute set of anything

Default: ezConfigs.globalArgs

Declared by:

ez-configs/flake-module.nix

ezConfigs.globalArgs

Extra arguments to pass to all configurations.

Type: attribute set of anything

Default: { }

Example: { inherit inputs; }

Declared by:

ez-configs/flake-module.nix

ezConfigs.home.configurationsDirectory

The directory containing homeConfigurations.

Type: path in the Nix store

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

Declared by:

ez-configs/flake-module.nix

ezConfigs.home.extraSpecialArgs

Extra arguments to pass to all homeConfigurations.

Type: attribute set of anything

Default: ezConfigs.globalArgs

Declared by:

ez-configs/flake-module.nix

ezConfigs.home.modulesDirectory

The directory containing homeModules.

Type: path in the Nix store

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

Declared by:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

ezConfigs.home.users.<name>.importDefault

Whether to import the default module for this user.

Type: boolean

Default: true

Declared by:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

ezConfigs.nixos.configurationsDirectory

The directory containing nixosConfigurations.

Type: path in the Nix store

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

Declared by:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

ezConfigs.nixos.hosts.<name>.importDefault

Whether to import the default module for this host.

Type: boolean

Default: true

Declared by:

ez-configs/flake-module.nix

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:

ez-configs/flake-module.nix

ezConfigs.nixos.modulesDirectory

The directory containing nixosModules.

Type: path in the Nix store

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

Declared by:

ez-configs/flake-module.nix

ezConfigs.nixos.specialArgs

Extra arguments to pass to all nixosConfigurations.

Type: attribute set of anything

Default: ezConfigs.globalArgs

Declared by:

ez-configs/flake-module.nix

ezConfigs.root

The root from which configurations and modules should be searched.

Type: null or path in the Nix store

Default: null

Example: ./.

Declared by:

ez-configs/flake-module.nix