1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

Remove some formatting exceptions

This formats a few more file using nixfmt.
This commit is contained in:
Robert Helgesson 2024-01-13 00:57:02 +01:00
parent 6217b73598
commit f2942f3385
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
6 changed files with 157 additions and 190 deletions

View file

@ -1,9 +1,9 @@
{ homeDirectory, lib, pkgs }:
let
inherit (lib) hasPrefix hm literalExpression mkDefault mkIf mkOption removePrefix types;
in
{
inherit (lib)
hasPrefix hm literalExpression mkDefault mkIf mkOption removePrefix types;
in {
# Constructs a type suitable for a `home.file` like option. The
# target path may be either absolute or relative, in which case it
# is relative the `basePath` argument (which itself must be an
@ -13,8 +13,8 @@ in
# - opt the name of the option, for self-references
# - basePathDesc docbook compatible description of the base path
# - basePath the file base path
fileType = opt: basePathDesc: basePath: types.attrsOf (types.submodule (
{ name, config, ... }: {
fileType = opt: basePathDesc: basePath:
types.attrsOf (types.submodule ({ name, config, ... }: {
options = {
enable = mkOption {
type = types.bool;
@ -27,10 +27,8 @@ in
target = mkOption {
type = types.str;
apply = p:
let
absPath = if hasPrefix "/" p then p else "${basePath}/${p}";
in
removePrefix (homeDirectory + "/") absPath;
let absPath = if hasPrefix "/" p then p else "${basePath}/${p}";
in removePrefix (homeDirectory + "/") absPath;
defaultText = literalExpression "name";
description = ''
Path to target file relative to ${basePathDesc}.
@ -113,14 +111,11 @@ in
config = {
target = mkDefault name;
source = mkIf (config.text != null) (
mkDefault (pkgs.writeTextFile {
inherit (config) text;
executable = config.executable == true; # can be null
name = hm.strings.storeFileName name;
})
);
source = mkIf (config.text != null) (mkDefault (pkgs.writeTextFile {
inherit (config) text;
executable = config.executable == true; # can be null
name = hm.strings.storeFileName name;
}));
};
}
));
}));
}