From 6284ce8d8642e043b623317af348c7446e33a7da Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 11 Apr 2025 18:09:52 -0400 Subject: [PATCH] Add method parameter. --- .../util/install_files/default.nix | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/nix/configuration/util/install_files/default.nix b/nix/configuration/util/install_files/default.nix index 2e21bb4..18962ed 100644 --- a/nix/configuration/util/install_files/default.nix +++ b/nix/configuration/util/install_files/default.nix @@ -51,44 +51,55 @@ in file = lib.mkOption { type = lib.types.attrsOf ( lib.types.submodule ( - { name, config, ... }: + { path, config, ... }: { options = { enable = lib.mkOption { type = lib.types.bool; default = true; - defaultText = "me.install.file.‹name›.enable"; + defaultText = "me.install.file.‹path›.enable"; example = false; description = "Whether we want to install this file."; }; + method = lib.mkOption { + type = lib.types.enum [ + "symlink" + "overwrite" + # "bind_mount" TODO: for directories? + ]; + default = "symlink"; + defaultText = "me.install.file.‹path›.method"; + example = "overwrite"; + description = "The way in which the file should be installed."; + }; mode = lib.mkOption { type = lib.types.str; default = "0444"; - defaultText = "me.install.file.‹name›.mode"; + defaultText = "me.install.file.‹path›.mode"; example = "0750"; description = "The read, write, execute permission flags."; }; source = lib.mkOption { type = lib.types.path; - defaultText = "me.install.file.‹name›.source"; + defaultText = "me.install.file.‹path›.source"; example = ./files/foo.txt; description = "The source file to install into the destination."; }; target = lib.mkOption { type = lib.types.str; - defaultText = "me.install.file.‹name›.target"; + defaultText = "me.install.file.‹path›.target"; example = ".local/share/foo/bar.txt"; description = "The path where the file should be written."; }; }; config = { - target = lib.mkDefault name; + target = lib.mkDefault path; }; } ) ); - defaultText = "me.install.file.‹name›"; + defaultText = "me.install.file.‹path›"; default = { }; example = lib.literalExpression '' {