feat: generate shell for each package but make default the combined shell

This commit is contained in:
Yusuf Bera Ertan 2022-12-21 05:01:18 +03:00
parent 0176f85f80
commit faa2b46f46
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA
3 changed files with 45 additions and 18 deletions

View File

@ -76,18 +76,32 @@
(name: version: {"${version}" = buildPackage name version;})
args.packages;
mkShellForDrvs = drvs:
pkgs.callPackage ../devshell.nix {
name = "devshell";
inherit drvs;
};
pkgShells =
l.mapAttrs
(
name: version: let
pkg = allPackages.${name}.${version};
in
mkShellForDrvs [pkg]
)
args.packages;
allPackagesList =
l.mapAttrsToList
(name: version: allPackages.${name}.${version})
args.packages;
shell = pkgs.callPackage ../devshell.nix {
name = "devshell";
drvs = allPackagesList;
};
in {
packages = allPackages;
devShells = {
default = shell;
};
devShells =
pkgShells
// {
default = mkShellForDrvs allPackagesList;
};
};
}

View File

@ -136,6 +136,22 @@
(name: version: {"${version}" = buildPackage name version;})
args.packages;
mkShellForDrvs = drvs:
pkgs.callPackage ../devshell.nix {
name = "devshell";
inherit drvs;
};
pkgShells =
l.mapAttrs
(
name: version: let
pkg = allPackages.${name}.${version};
in
mkShellForDrvs [pkg.passthru.dependencies pkg]
)
args.packages;
allPackagesList = l.flatten (
l.mapAttrsToList
(
@ -145,14 +161,12 @@
)
args.packages
);
shell = pkgs.callPackage ../devshell.nix {
name = "devshell";
drvs = allPackagesList;
};
in {
packages = allPackages;
devShells = {
default = shell;
};
devShells =
pkgShells
// {
default = mkShellForDrvs allPackagesList;
};
};
}

View File

@ -47,19 +47,18 @@
all
// env
// {
packages = (all.packages or []) ++ (env.packages or []);
buildInputs = (all.buildInputs or []) ++ (env.buildInputs or []);
nativeBuildInputs = (all.nativeBuildInputs or []) ++ (env.nativeBuildInputs or []);
propagatedBuildInputs = (all.propagatedBuildInputs or []) ++ (env.propagatedBuildInputs or []);
propagatedNativeBuildInputs = (all.propagatedNativeBuildInputs or []) ++ (env.propagatedNativeBuildInputs or []);
}
)
{}
envs;
_shellEnv = combineEnvs (l.map getEnvs drvs);
shellEnv =
(combineEnvs (l.map getEnvs drvs))
_shellEnv
// {
inherit name;
passthru.env = _shellEnv;
};
in
(mkShell.override {stdenv = (l.head drvs).stdenv;}) shellEnv