templates/direnv/flake.nix

30 lines
711 B
Nix
Raw Normal View History

2024-05-02 08:05:49 +00:00
{
description = "An empty devshell with direnv support";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2024-05-02 08:05:49 +00:00
outputs =
{ nixpkgs, ... }:
let
2024-05-03 06:08:32 +00:00
forAllSystems =
function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system: function nixpkgs.legacyPackages.${system});
2024-05-02 08:05:49 +00:00
in
{
2024-05-03 06:08:32 +00:00
devShells = forAllSystems (pkgs: {
2024-05-03 06:34:06 +00:00
default = pkgs.mkShellNoCC {
2024-05-03 06:09:43 +00:00
packages = [ pkgs.hello ];
EXAMPLE_VAR = "inside the direnv template";
shellHook = ''
echo "Hello from $EXAMPLE_VAR, $(whoami)!"
'';
2024-05-03 06:09:43 +00:00
};
2024-05-03 06:08:32 +00:00
});
2024-05-02 08:05:49 +00:00
};
}