# Shared data for every aspect: who owns this flake and where the secrets are. # Top-level flake-parts options, not a flake output. Read them in any module # through the flake-parts `config`, bound in a `let` before any lower-level # module so the NixOS/home-manager `config` cannot shadow it: # # { config, ... }: # let # inherit (config.meta) owner; # in # { # flake.modules.nixos.foo = { pkgs, ... }: { users.users.${owner.name}.shell = pkgs.zsh; }; # flake.modules.homeManager.foo = { programs.git.settings.user.email = owner.email; }; # } { lib, ... }: let inherit (lib) mkOption types; in { options.meta = { owner = mkOption { description = "The single interactive user of every host in this flake."; type = types.submodule { options = { name = mkOption { type = types.str; description = "Login name."; }; fullName = mkOption { type = types.str; description = "Display name (GECOS), also the git author name."; }; email = mkOption { type = types.str; description = "E-mail address, used for git."; }; uid = mkOption { type = types.int; default = 1000; description = "Numeric user id."; }; sshAuthorizedKeys = mkOption { type = types.listOf types.str; default = [ ]; description = "Public keys allowed to log in over SSH."; }; sshKeys = mkOption { type = types.listOf types.str; default = [ "id_ed25519" ]; description = '' Private SSH key names. Each one is installed as ~/.ssh/ when secrets/ssh-.age exists (and ~/.ssh/.pub when secrets/ssh-.pub exists). ''; }; }; }; }; secretsDir = mkOption { type = types.path; default = ../../secrets; defaultText = lib.literalExpression "./secrets"; description = '' Directory with the agenix *.age files. A secret is declared only when its file exists, so a fresh clone still evaluates. Flakes only see files that git tracks: `git add` new secrets before building. ''; }; }; }