packages: custom devshell wrapper

This commit is contained in:
Max Headroom 2022-03-21 21:41:18 +01:00
parent f3206b9455
commit 181d548b52
2 changed files with 31 additions and 1 deletions

28
packages/lib/devshell.nix Normal file
View file

@ -0,0 +1,28 @@
{ inputs, pkgs, ... }:
let
inherit (pkgs) system;
inherit (inputs.devshell.legacyPackages.${system}) mkShell;
injectAttrName = name: value: value // { inherit name; };
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;
}
];
}

View file

@ -1,4 +1,4 @@
{ pkgs, inputs, ... }:
{ pkgs, inputs, ... }@args:
let
inherit (pkgs) system;
dream2nix = inputs.dream2nix.lib2.init {
@ -11,6 +11,8 @@ let
poetry2nix = pkgs.poetry2nix.overrideScope' (final: prev: {
defaultPoetryOverrides = prev.defaultPoetryOverrides.extend (import ./poetry2nix-overrides);
});
mkShell = import lib/devshell.nix args;
in
{
packages = {