jacg
1
I have an old shell.nix
which uses pkgs.llvmPackages_13.stdenv.mkDerivation
to ensure everything is compiled with clang.
How would I go about transforming this into a flake? Can I simply use
devShell = pkgs.llvmPackages_13.stdenv.mkDerivation { ... }
instead of
devShell = pkgs.mkShell { ... }
or are there some significant incompatibilities between the two?
NobbZ
2
IIRC pkgs.mkShell.override { stdenv = pkgs.clang13Stdenv; } { … }
.
jacg
3
AFAICT so far
devShell = pkgs.llvmPackages_13.stdenv.mkDerivation { ... }
and
devShell = pkgs.mkShell.override { stdenv = pkgs.clang13Stdenv; } { ... }
behave identically.
NobbZ
4
Not fully. mkShell
doesn’t have phases to build something (even though today it actually can be nix build
).
Though if this was not your question, then please elaborate. Both options work in flakes or in channel style nix.
jacg
5
But in the context of devShell = ...
in a flake, there is no discernable difference?
You mean that mkShell
can be bound to package.<system>.<whatever>
in a flake?
NobbZ
6
The difference is that you can’t nix build
a mkShell
and expect a meaningfull output. While a mkDerivation
should create a meaning full output.
As both create derivations, you can use either in packages
or devShells
.
1 Like