diff --git a/modules/fs/default.nix b/modules/fs/default.nix index 72eec2c0d..879452a33 100644 --- a/modules/fs/default.nix +++ b/modules/fs/default.nix @@ -103,19 +103,16 @@ let default = null; description = "create a file in the /nix/store with the provided text and use that as the target"; }; - targetName = mkOption { - type = types.str; - default = path-lib.leaf path; - description = "name of file to create if generated from text"; - }; }; - config = { + config = let + name = path-lib.leaf path; + in { target = lib.mkIf (config.text != null) ( (pkgs.writeTextFile { - name = path-lib.leaf path; + inherit name; text = config.text; - destination = "/${config.targetName}"; - }) + "/${config.targetName}" + destination = "/${name}"; + }) + "/${name}" ); }; });