Skip to content

Commit

Permalink
Decouple config spec from use
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Feb 4, 2025
1 parent eb6678a commit 245e735
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Run `nix run` to activate this configuration in your system.
To browse the capabilities of [home-manager] (and to see what else can go in your `./modules/home/*.nix` -- such as shell aliases), consult [home-manager options reference](https://nix-community.github.io/home-manager/options.xhtml). You can also run `man home-configuration.nix` in the terminal.
Global configuration is in `./modules/flake-parts/config.nix`. Here, you can specify your user name, email and such settings.
Global configuration is in the `./config.nix` file. Here, you can specify your user name, email and such settings.
## What's included
Expand Down
1 change: 1 addition & 0 deletions config.nix
24 changes: 24 additions & 0 deletions modules/flake-parts/config-module.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ lib, ... }:
{
options = {
me = lib.mkOption {
default = { };
type = lib.types.submodule {
options = {
username = lib.mkOption {
type = lib.types.str;
description = "Your username as shown by `id -un`";
};
fullname = lib.mkOption {
type = lib.types.str;
description = "Your full name for use in Git config";
};
email = lib.mkOption {
type = lib.types.str;
description = "Your email for use in Git config";
};
};
};
};
};
}
31 changes: 7 additions & 24 deletions modules/flake-parts/config.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
{ lib, ... }:
# Global configuration for this repo
#
# See ./modules/flake-parts/config-module.nix for schema
{
options = {
me = lib.mkOption {
default = { };
type = lib.types.submodule {
options = {
username = lib.mkOption {
type = lib.types.str;
default = "runner";
description = "Your username as shown by `id -un`";
};
fullname = lib.mkOption {
type = lib.types.str;
default = "John Doe";
description = "Your full name for use in Git config";
};
email = lib.mkOption {
type = lib.types.str;
default = "[email protected]";
description = "Your email for use in Git config";
};
};
};
};
me = {
username = "runner";
fullname = "John Doe";
email = "[email protected]";
};
}

0 comments on commit 245e735

Please sign in to comment.