From c26d6f34eaa2d2584ba62ff9a2f6e6678bb27e33 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 11 Apr 2025 18:00:36 -0400 Subject: [PATCH] Start a user-specific variant of the install file command. --- .../util/install_files/default.nix | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/nix/configuration/util/install_files/default.nix b/nix/configuration/util/install_files/default.nix index ce20bf4..2e21bb4 100644 --- a/nix/configuration/util/install_files/default.nix +++ b/nix/configuration/util/install_files/default.nix @@ -15,8 +15,40 @@ in { imports = [ ]; - options.me = { - install.file = lib.mkOption { + options.me.install = { + user = lib.mkOption { + type = lib.types.attrsOf ( + lib.types.submodule ( + { username, config, ... }: + { + options = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + defaultText = "me.install.file.‹username›.enable"; + example = false; + description = "Whether we want to install files in this user's home directory."; + }; + target_username = lib.mkOption { + type = lib.types.str; + defaultText = "me.install.file.‹username›.target_username"; + example = "root"; + description = "The username for the user whose home directory will contain the file."; + }; + }; + + config = { + target_username = lib.mkDefault username; + }; + } + ) + ); + + defaultText = "me.install.user.‹username›"; + default = { }; + # TODO: example + }; + file = lib.mkOption { type = lib.types.attrsOf ( lib.types.submodule ( { name, config, ... }: