xdg: use fileType
for xdg.configFile
This commit is contained in:
parent
4f842d9f1b
commit
549deb51d6
|
@ -6,55 +6,10 @@ let
|
||||||
|
|
||||||
cfg = config.xdg;
|
cfg = config.xdg;
|
||||||
|
|
||||||
fileType = basePathDesc: basePath: (types.loaOf (types.submodule (
|
fileType = (import ../lib/file-type.nix {
|
||||||
{ name, config, ... }: {
|
inherit (config.home) homeDirectory;
|
||||||
options = {
|
inherit lib pkgs;
|
||||||
target = mkOption {
|
}).fileType;
|
||||||
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
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)));
|
|
||||||
|
|
||||||
defaultCacheHome = "${config.home.homeDirectory}/.cache";
|
defaultCacheHome = "${config.home.homeDirectory}/.cache";
|
||||||
defaultConfigHome = "${config.home.homeDirectory}/.config";
|
defaultConfigHome = "${config.home.homeDirectory}/.config";
|
||||||
|
@ -81,7 +36,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
configFile = mkOption {
|
configFile = mkOption {
|
||||||
type = fileType "xdg.configHome" cfg.configHome;
|
type = fileType "<varname>xdg.configHome</varname>" cfg.configHome;
|
||||||
default = {};
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
Attribute set of files to link into the user's XDG
|
Attribute set of files to link into the user's XDG
|
||||||
|
|
Loading…
Reference in a new issue