diff --git a/direnv/.envrc b/direnv/.envrc new file mode 100644 index 0000000..c702436 --- /dev/null +++ b/direnv/.envrc @@ -0,0 +1,3 @@ +if has nix_direnv_version; then + use flake +fi \ No newline at end of file diff --git a/direnv/flake.nix b/direnv/flake.nix new file mode 100644 index 0000000..1df77ea --- /dev/null +++ b/direnv/flake.nix @@ -0,0 +1,29 @@ +{ + description = "An empty devshell with direnv support"; + + inputs.nixpkgs.url = "github:auxolotl/nixpkgs/nixpkgs-unstable"; + + outputs = + { nixpkgs, ... }: + let + 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 ]; + EXAMPLE_VAR = "inside the direnv template"; + shellHook = '' + echo "Hello from $EXAMPLE_VAR, $(whoami)!" + ''; + }; + }); + }; +} diff --git a/flake.nix b/flake.nix index 574347b..f4918c9 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ in { templates = { - default = self.templates.direnv; + default = self.templates.system; system = { path = ./system; description = ""; @@ -30,6 +30,10 @@ path = ./darwin; description = ""; }; + direnv = { + path = ./direnv; + description = "An empty devshell with direnv support"; + }; }; formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); };