forked from numtide/devshell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.nix
More file actions
34 lines (32 loc) · 988 Bytes
/
commands.nix
File metadata and controls
34 lines (32 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ lib, config, pkgs, ... }:
let
inherit (import ../nix/commands/convert.nix { inherit pkgs; }) commandsToMenu commandToPackage;
inherit (import ../nix/commands/devshellMenu.nix { inherit pkgs; }) mkDevshellMenuCommand;
inherit (import ../nix/commands/types.nix { inherit pkgs; }) commandsFlatType;
in
{
options.commands = lib.mkOption {
type = commandsFlatType;
default = [ ];
description = ''
Add commands to the environment.
'';
example = lib.literalExpression ''
[
{
help = "print hello";
name = "hello";
command = "echo hello";
}
{
package = "nixpkgs-fmt";
category = "formatter";
}
]
'';
};
# Add the commands to the devshell packages. Either as wrapper scripts, or
# the whole package.
config.devshell.packages = map commandToPackage ([ (mkDevshellMenuCommand config.commands) ] ++ config.commands);
# config.devshell.motd = "$(motd)";
}