feat(direnv): init #11

Merged
aemogie merged 7 commits from feat/direnv-init into main 2024-05-03 13:01:37 +00:00
aemogie commented 2024-05-02 08:12:07 +00:00 (Migrated from github.com)
  1. Should we use flake-utils? I see some discussion on it in the forum, but no resolution (https://forum.aux.computer/t/a-basic-template/254/7)
  2. Should this template have an example environment variable as well?
  3. Should pkgs.mkShell be used? I've seen some discussion about it adding too much to the runtime closure, because it depends on stdenv.mkDerivation (but I'm not sure what the alternative is)

edit: closes #13

1. Should we use flake-utils? I see some discussion on it in the forum, but no resolution (https://forum.aux.computer/t/a-basic-template/254/7) 2. Should this template have an example environment variable as well? 3. Should `pkgs.mkShell` be used? I've seen some discussion about it adding too much to the runtime closure, because it depends on `stdenv.mkDerivation` (but I'm not sure what the alternative is) edit: closes #13
getchoo (Migrated from github.com) requested changes 2024-05-02 22:58:33 +00:00
getchoo (Migrated from github.com) left a comment

Should we use flake-utils

i would say no. this is a very simple template, and using flake-utils for one function isn't great

but I'm not sure what the alternative is

mkShellNoCC. see below

and for a last comment: i honestly don't see much reason to make this a template. i feel we're already pushing it a bit with home-manager (as aux does not have a home-manager fork), and putting this on top of it would continue to be a duplication of documentation. i would much rather see a template like this in nix-direnv itself rather than here, as it's definitely not aux specific and the only thing differentiating it from a standard "devShell" template is an .envrc

> Should we use flake-utils i would say no. this is a very simple template, and using flake-utils for one function isn't great > but I'm not sure what the alternative is `mkShellNoCC`. see below and for a last comment: i honestly don't see much reason to make this a template. i feel we're already pushing it a bit with home-manager (as aux does not have a home-manager fork), and putting this on top of it would continue to be a duplication of documentation. i would much rather see a template like this in `nix-direnv` itself rather than here, as it's definitely not aux specific and the only thing differentiating it from a standard "devShell" template is an .envrc
getchoo (Migrated from github.com) commented 2024-05-02 22:50:51 +00:00
if has nix_direnv_version; then
  use flake
fi

this is very annoying for anyone who uses direnv but not nix(-direnv)

```suggestion if has nix_direnv_version; then use flake fi ``` this is very annoying for anyone who uses direnv but not nix(-direnv)
getchoo (Migrated from github.com) commented 2024-05-02 22:53:04 +00:00
      forAllSystems =
        function:
        nixpkgs.lib.genAttrs [
          "x86_64-linux"
          "aarch64-linux"
          "x86_64-darwin"
          "aarch64-darwin"
        ] (system: function nixpkgs.legacyPackages.${system});
    in
    {
      devShells = forAllSystems (pkgs: {
        default = pkgs.mkShellNoCC {
          packages = [ pkgs.hello ];
          IN_SHELL = "yes!";
        };
      });
    };

we can follow our own flake here. mkShellNoCC should also be used as to avoid any massive download of toolchains. as for the env var, we could put the command echo $IN_SHELL in a tutorial

```suggestion forAllSystems = function: nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (system: function nixpkgs.legacyPackages.${system}); in { devShells = forAllSystems (pkgs: { default = pkgs.mkShellNoCC { packages = [ pkgs.hello ]; IN_SHELL = "yes!"; }; }); }; ``` we can follow our own flake here. `mkShellNoCC` should also be used as to avoid any massive download of toolchains. as for the env var, we could put the command `echo $IN_SHELL` in a tutorial
aemogie commented 2024-05-03 06:42:52 +00:00 (Migrated from github.com)

and for a last comment: i honestly don't see much reason to make this a template.

i assume at one point our goal is to diverge from upstream nix, so this might be useful. but on the other hand, we don't plan to do that for a while from what i understand so this might not be relevant now

> and for a last comment: i honestly don't see much reason to make this a template. i assume at one point our goal is to diverge from upstream nix, so this *might* be useful. but on the other hand, we don't plan to do that for a while from what i understand so this might not be relevant now
aemogie commented 2024-05-03 06:44:51 +00:00 (Migrated from github.com)

also, another question: do we need a shellHook in here as well? maybe something that just runs echo Hello, $(whoami)! or prints the IN_SHELL env var?

also, another question: do we need a `shellHook` in here as well? maybe something that just runs `echo Hello, $(whoami)!` or prints the `IN_SHELL` env var?
isabelroses commented 2024-05-03 08:54:51 +00:00 (Migrated from github.com)

also, another question: do we need a shellHook in here as well? maybe something that just runs echo Hello, $(whoami)! or prints the IN_SHELL env var?

I think that would be pretty cool. And maybe change the IN_SHELL env var to direnv template?

Also amazing work so far.

> also, another question: do we need a `shellHook` in here as well? maybe something that just runs `echo Hello, $(whoami)!` or prints the `IN_SHELL` env var? I think that would be pretty cool. And maybe change the `IN_SHELL` env var to direnv template? Also amazing work so far.
aemogie commented 2024-05-03 12:10:58 +00:00 (Migrated from github.com)

IN_SHELL = "direnv template" made it seem like a variable which is important for direnv to load. renamed it to EXAMPLE_VAR as that makes it more clear.

`IN_SHELL = "direnv template"` made it seem like a variable which is important for direnv to load. renamed it to `EXAMPLE_VAR` as that makes it more clear.
isabelroses commented 2024-05-03 12:24:01 +00:00 (Migrated from github.com)

Amazing just as a last request can you change the default template to the NixOS template.

Amazing just as a last request can you change the default template to the NixOS template.
aemogie commented 2024-05-03 12:37:36 +00:00 (Migrated from github.com)

done

done
isabelroses (Migrated from github.com) approved these changes 2024-05-03 13:01:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: auxolotl/templates#11
No description provided.