mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 03:09:47 +01:00
fish: functions type to attrsOf lines, load by text
Functions in fish are now defined in terms of adding the appropriate files and `files.text` sets to `xdg.configFile`.
This commit is contained in:
parent
3de8102e7f
commit
d45e1c4adc
1 changed files with 12 additions and 7 deletions
|
@ -127,14 +127,12 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.fish.functions = mkOption {
|
programs.fish.functions = mkOption {
|
||||||
type = types.attrsOf (fileType (name: body: ''
|
type = types.attrsOf types.lines;
|
||||||
function ${name}
|
|
||||||
${body}
|
|
||||||
end
|
|
||||||
''));
|
|
||||||
default = {};
|
default = {};
|
||||||
|
example = { gitignore = "curl -sL https://www.gitignore.io/api/$argv"; };
|
||||||
description = ''
|
description = ''
|
||||||
Functions to add to fish.
|
Basic functions to add to fish. For more information see
|
||||||
|
<link xlink:href="https://fishshell.com/docs/current/commands.html#function"/>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,7 +251,14 @@ in
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
} {
|
} {
|
||||||
xdg.configFile = map (n: { target = "fish/functions/${n}.fish"; source = cfg.functions.${n}.source; }) (attrNames cfg.functions);
|
xdg.configFile = mapAttrs' (f_name: f_body: {
|
||||||
|
name = "fish/functions/${f_name}.fish";
|
||||||
|
value = {"text" = ''
|
||||||
|
function ${f_name}
|
||||||
|
${f_body}
|
||||||
|
end
|
||||||
|
'';};
|
||||||
|
}) cfg.functions;
|
||||||
} (
|
} (
|
||||||
let
|
let
|
||||||
wrappedPkgVersion = lib.getVersion pkgs.fish;
|
wrappedPkgVersion = lib.getVersion pkgs.fish;
|
||||||
|
|
Loading…
Reference in a new issue