2022-03-21 22:41:18 +02:00
|
|
|
{ inputs, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (pkgs) system;
|
|
|
|
|
|
|
|
inherit (inputs.devshell.legacyPackages.${system}) mkShell;
|
|
|
|
|
2022-03-21 22:42:02 +02:00
|
|
|
wrapInAttrs = value: if builtins.isAttrs value then value else { inherit value; };
|
|
|
|
|
2022-03-22 00:10:20 +02:00
|
|
|
wrapPackage = package: { inherit package; };
|
|
|
|
|
2022-03-21 22:42:02 +02:00
|
|
|
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 ? [],
|
2022-03-22 00:10:20 +02:00
|
|
|
tools ? [],
|
2022-03-21 22:41:18 +02:00
|
|
|
commands ? {},
|
|
|
|
env ? {},
|
|
|
|
config ? {}
|
|
|
|
}:
|
|
|
|
mkShell {
|
|
|
|
imports = [
|
|
|
|
config
|
2022-03-22 00:10:20 +02:00
|
|
|
{
|
|
|
|
commands = map wrapPackage tools;
|
|
|
|
}
|
2022-03-21 22:41:18 +02:00
|
|
|
{
|
|
|
|
inherit packages;
|
|
|
|
commands = attrsToNamedList commands;
|
|
|
|
env = attrsToNamedList env;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|