Merge pull request #11 from aemogie/feat/direnv-init

This commit is contained in:
isabel roses 2024-05-03 13:01:36 +00:00 committed by GitHub
commit 9166d28895
Failed to generate hash of commit
3 changed files with 37 additions and 1 deletions

3
direnv/.envrc Normal file
View file

@ -0,0 +1,3 @@
if has nix_direnv_version; then
use flake
fi

29
direnv/flake.nix Normal file
View file

@ -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)!"
'';
};
});
};
}

View file

@ -17,7 +17,7 @@
in in
{ {
templates = { templates = {
default = self.templates.direnv; default = self.templates.system;
system = { system = {
path = ./system; path = ./system;
description = ""; description = "";
@ -30,6 +30,10 @@
path = ./darwin; path = ./darwin;
description = ""; description = "";
}; };
direnv = {
path = ./direnv;
description = "An empty devshell with direnv support";
};
}; };
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
}; };