aboutsummaryrefslogtreecommitdiff
path: root/modules/misc/xdg.nix
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2017-11-06 10:28:55 +0100
committerRobert Helgesson <robert@rycee.net>2017-11-06 14:24:04 +0100
commit549deb51d6f4ac9aa8fccb16a560ad4fcef2d6bc (patch)
tree73e662bf3d71991a0f9a57812908483a730b7362 /modules/misc/xdg.nix
parent4f842d9f1b137d98ad4e6393b16b038bbab2bad2 (diff)
xdg: use `fileType` for `xdg.configFile`
Diffstat (limited to 'modules/misc/xdg.nix')
-rw-r--r--modules/misc/xdg.nix55
1 files changed, 5 insertions, 50 deletions
diff --git a/modules/misc/xdg.nix b/modules/misc/xdg.nix
index 7dd5f456d38..8f47ac5dc43 100644
--- a/modules/misc/xdg.nix
+++ b/modules/misc/xdg.nix
@@ -6,55 +6,10 @@ let
cfg = config.xdg;
- fileType = basePathDesc: basePath: (types.loaOf (types.submodule (
- { name, config, ... }: {
- options = {
- target = mkOption {
- type = types.str;
- apply = p: "${basePath}/${p}";
- description = ''
- Path to target file relative to <varname>${basePathDesc}</varname>.
- '';
- };
-
- text = mkOption {
- default = null;
- type = types.nullOr types.lines;
- description = "Text of the file.";
- };
-
- source = mkOption {
- type = types.path;
- description = ''
- Path of the source file. The file name must not start
- with a period since Nix will not allow such names in
- the Nix store.
- </para><para>
- This may refer to a directory.
- '';
- };
-
- executable = mkOption {
- type = types.bool;
- default = false;
- description = "Whether the file should be executable.";
- };
- };
-
- config = {
- target = mkDefault name;
- source = mkIf (config.text != null) (
- let
- file = pkgs.writeTextFile {
- inherit (config) text executable;
- name = "user-etc-" + baseNameOf name;
- };
- in
- mkDefault file
- );
- };
- }
- )));
+ fileType = (import ../lib/file-type.nix {
+ inherit (config.home) homeDirectory;
+ inherit lib pkgs;
+ }).fileType;
defaultCacheHome = "${config.home.homeDirectory}/.cache";
defaultConfigHome = "${config.home.homeDirectory}/.config";
@@ -81,7 +36,7 @@ in
};
configFile = mkOption {
- type = fileType "xdg.configHome" cfg.configHome;
+ type = fileType "<varname>xdg.configHome</varname>" cfg.configHome;
default = {};
description = ''
Attribute set of files to link into the user's XDG