| 31 Jan 2024 |
Bryan | lxsameer: ^ | 16:25:50 |
lxsameer | thank you, I had a look at nix-direnv and direnv the other day, I'll try to write somthing and try it out | 16:27:29 |
lxsameer | but it would be cool to have a reference for how the store works | 16:27:46 |
Bryan | I think what I am trying to say is that you don't need to write anything. | 16:27:55 |
Bryan | lxsameer: If you're looking for something that prevents your devShell installed software from getting garbage-collected, nix-direnv just does it already | 16:29:06 |
Bryan | * lxsameer: If you're looking for something that prevents your devShell installed software from getting garbage-collected, nix-direnv just does it already (it should be noted that - by default - the layout dir is <project_directory>/.direnv, which is "inside the flake") | 16:29:57 |
Bryan | Far be it from me to say "don't write a competitor" (I am one of the maintainers for nix-direnv and I wrote one...), but if you just want to skip to the solution - you can | 16:30:48 |
lxsameer | can it handle more than one shells? | 16:30:56 |
Bryan | What does that mean? | 16:31:08 |
Bryan | "Can you do this pattern for an arbitrary number of shells"? Yes - of course. When you cd into the project directory, you'll activate the appropriate one (and you'll hit the cache if you've activated this before, assuming you have direnv and nix-direnv set up properly) | 16:32:14 |
lxsameer | for example, I have a clang based shell and a gcc based shell, would it be able to cache both and prevent all the packages to be excluded from gc? | 16:33:29 |
Bryan | Yes. | 16:33:59 |
Bryan | (Presuming you have two projects with devShell defined) | 16:34:15 |
Bryan | * (Presuming you have two flakes with devShell defined) | 16:34:22 |
lxsameer | no just one flakes file | 16:34:47 |
Bryan | How do you have two shells defined then? | 16:35:02 |
lxsameer | here is an example:
devShells.default = (pkgs.mkShell.override { stdenv = stdenv';}) {
nativeBuildInputs = buildDevToolsDeps ++ buildToolsDeps ++ shellTools;
buildInputs = buildDeps ++ testDeps;
shellHook =
''
BUILDER= ZDOTDIR=${zshDir} zsh -d && exit
'';
};
# This shell is gcc based and we use it only
# for the mathematics side of our design
devShells.math = nativePkgs.mkShell {
#nativeBuildInputs = mathDeps;
buildInputs = mathDeps;
shellHook =
''
BUILDER=Math ZDOTDIR=${zshDir} zsh -d && exit
'';
};
| 16:36:36 |
Bryan | direnv + nix-direnv will not cache these side-by-side, no. | 16:38:15 |
lxsameer | ok then, I have to write something inspired by nix-direnv then | 16:39:00 |
| @chocolatestrawberry:matrix.org changed their profile picture. | 19:02:50 |
| @chocolatestrawberry:matrix.org changed their profile picture. | 19:03:29 |
| @chocolatestrawberry:matrix.org left the room. | 19:03:49 |
netpleb | i have been trying to setup simple-nixos-mailserver using flakes inside a declarative container. But the solution here https://discourse.nixos.org/t/add-extra-modules-in-declarative-nixos-containers/38107 keeps giving me an "infinite recursion encountered" error. | 21:02:03 |
netpleb | and if I do not get the infinit recursion error, then I get an error "the option containers.mycontainername.mailserver" does not exist. There must be some trick I am missing.
| 21:04:31 |