depot/packages/lib/devshell.nix

31 lines
663 B
Nix
Raw Normal View History

2022-03-21 22:41:18 +02:00
{ inputs, pkgs, ... }:
let
inherit (pkgs) system;
inherit (inputs.devshell.legacyPackages.${system}) mkShell;
wrapInAttrs = value: if builtins.isAttrs value then value else { inherit value; };
injectAttrName = name: value: { inherit name; } // wrapInAttrs value;
2022-03-21 22:41:18 +02:00
mkNamedAttrs = builtins.mapAttrs injectAttrName;
attrsToNamedList = attrs: builtins.attrValues (mkNamedAttrs attrs);
in
{
packages ? [],
commands ? {},
env ? {},
config ? {}
}:
mkShell {
imports = [
config
{
inherit packages;
commands = attrsToNamedList commands;
env = attrsToNamedList env;
}
];
}