Skip to content

Commit

Permalink
Allow for usage without setting the root option
Browse files Browse the repository at this point in the history
  • Loading branch information
ehllie committed Nov 21, 2023
1 parent 552e196 commit fa75b68
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 13 deletions.
9 changes: 5 additions & 4 deletions flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ let

configurationOptions = configType: {
modulesDirectory = mkOption {
default = "${cfg.root}/${configType}-modules";
default = if cfg.root != null then "${cfg.root}/${configType}-modules" else ./unset-directory;
defaultText = literalExpression "\"\${ezConfigs.root}/${configType}-modules\"";
type = types.pathInStore;
description = ''
Expand All @@ -288,7 +288,7 @@ let
};

configurationsDirectory = mkOption {
default = "${cfg.root}/${configType}-configurations";
default = if cfg.root != null then "${cfg.root}/${configType}-configurations" else ./unset-directory;
defaultText = literalExpression "\"\${ezConfigs.root}/${configType}-configurations\"";
type = types.pathInStore;
description = ''
Expand Down Expand Up @@ -375,7 +375,8 @@ in
{
options.ezConfigs = {
root = mkOption {
type = types.pathInStore;
default = null;
type = types.nullOr types.pathInStore;
example = literalExpression "./.";
description = ''
The root from which configurations and modules should be searched.
Expand All @@ -398,7 +399,7 @@ in
darwin = configurationOptions "darwin";
};

config.flake = mkIf (cfg ? root) rec {
config.flake = rec {
homeModules = readModules cfg.home.modulesDirectory;
nixosModules = readModules cfg.nixos.modulesDirectory;
darwinModules = readModules cfg.darwin.modulesDirectory;
Expand Down
Empty file.
1 change: 0 additions & 1 deletion template/darwin-configurations/dummy

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion template/darwin-modules/dummy

This file was deleted.

3 changes: 0 additions & 3 deletions template/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
systems = [ ];

ezConfigs = {
# All subdirectories under this contain a `dummy` file.
# They can be deleted after the template has been initialised.
# They are only there to preserve the directory structure within git.
root = ./.;
globalArgs = { inherit inputs; };
};
Expand Down
Empty file.
1 change: 0 additions & 1 deletion template/home-configurations/dummy

This file was deleted.

Empty file added template/home-modules/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion template/home-modules/dummy

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion template/nixos-configurations/dummy

This file was deleted.

Empty file added template/nixos-modules/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion template/nixos-modules/dummy

This file was deleted.

Empty file added unset-directory/.gitkeep
Empty file.

0 comments on commit fa75b68

Please sign in to comment.