!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

897 Members
182 Servers

Load older messages


SenderMessageTime
30 Jan 2024
@erremilia:matrix.org@erremilia:matrix.org left the room.19:55:30
31 Jan 2024
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.03:36:26
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.06:22:05
@bryan.bennett:matrix.orgBryan lxsameer: This is exactly what nix-direnv does, for the record. We create the root in the direnv layout dir (which is kind of what that directory is for - creating state that we need for direnv-related things) 15:34:40
@lxsameer:matrix.orglxsameer
In reply to @bryan.bennett:matrix.org
lxsameer: This is exactly what nix-direnv does, for the record. We create the root in the direnv layout dir (which is kind of what that directory is for - creating state that we need for direnv-related things)
what do you mean by "We create the root in the direnv layout dir"?
16:20:03
@bryan.bennett:matrix.orgBryan

There are multiple things that might require explaining there, so I'll talk about them individually:

  • the direnv layout directory is just a directory that state lives in for direnv and its plugins to use. The python layout populates it (in part) with a virtual environment, for instance.
  • The root is just a symlink that points to a derivation in the store (more or less). We create those in the layout directory.
16:25:44
@bryan.bennett:matrix.orgBryan lxsameer: ^ 16:25:50
@lxsameer:matrix.orglxsameerthank you, I had a look at nix-direnv and direnv the other day, I'll try to write somthing and try it out16:27:29
@lxsameer:matrix.orglxsameerbut it would be cool to have a reference for how the store works16:27:46
@bryan.bennett:matrix.orgBryan I think what I am trying to say is that you don't need to write anything. 16:27:55
@bryan.bennett:matrix.orgBryan 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.bennett:matrix.orgBryan * 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.bennett:matrix.orgBryanFar 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 can16:30:48
@lxsameer:matrix.orglxsameercan it handle more than one shells?16:30:56
@bryan.bennett:matrix.orgBryanWhat does that mean? 16:31:08
@bryan.bennett:matrix.orgBryan "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:matrix.orglxsameerfor 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.bennett:matrix.orgBryanYes.16:33:59
@bryan.bennett:matrix.orgBryan (Presuming you have two projects with devShell defined) 16:34:15
@bryan.bennett:matrix.orgBryan * (Presuming you have two flakes with devShell defined) 16:34:22
@lxsameer:matrix.orglxsameerno just one flakes file16:34:47
@bryan.bennett:matrix.orgBryanHow do you have two shells defined then?16:35:02
@lxsameer:matrix.orglxsameer

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.bennett:matrix.orgBryandirenv + nix-direnv will not cache these side-by-side, no.16:38:15
@lxsameer:matrix.orglxsameerok then, I have to write something inspired by nix-direnv then16:39:00
@chocolatestrawberry:matrix.org@chocolatestrawberry:matrix.org changed their profile picture.19:02:50
@chocolatestrawberry:matrix.org@chocolatestrawberry:matrix.org changed their profile picture.19:03:29
@chocolatestrawberry:matrix.org@chocolatestrawberry:matrix.org left the room.19:03:49
@netpleb:matrix.orgnetplebi 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:matrix.orgnetpleband 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

Show newer messages


Back to Room ListRoom Version: 6