Skip to content

Commit 20cf89b

Browse files
committed
autoenv: init at 2024-10-16
Signed-off-by: Borja Clemente <[email protected]>
1 parent e2e4131 commit 20cf89b

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

nixos/modules/programs/autoenv.nix

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
7+
8+
let
9+
cfg = config.programs.autoenv;
10+
in
11+
{
12+
options = {
13+
programs.autoenv = {
14+
enable = lib.mkEnableOption "autoenv";
15+
package = lib.mkPackageOption pkgs "autoenv" { };
16+
};
17+
};
18+
19+
config = lib.mkIf cfg.enable {
20+
environment.systemPackages = [ pkgs.autoenv ];
21+
22+
programs = {
23+
zsh.interactiveShellInit = ''
24+
source ${cfg.package}/share/autoenv/activate.sh
25+
'';
26+
27+
bash.interactiveShellInit = ''
28+
source ${cfg.package}/share/autoenv/activate.sh
29+
'';
30+
};
31+
};
32+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
stdenv,
3+
fetchFromGitHub,
4+
lib,
5+
}:
6+
7+
stdenv.mkDerivation (finalAttrs: {
8+
pname = "autoenv";
9+
version = "0-unstable-2024-10-16";
10+
11+
src = fetchFromGitHub {
12+
owner = "hyperupcall";
13+
repo = "autoenv";
14+
rev = "90241f182d6a7c96e9de8a25c1eccaf2a2d1b43a";
15+
hash = "sha256-vZrsMPhuu+xPVAww04nKyoOl7k0upvpIaxeMrCikDio=";
16+
};
17+
18+
dontBuild = true;
19+
20+
installPhase = ''
21+
runHook preInstall
22+
mkdir -p $out/share
23+
cp -R $src $out/share/autoenv
24+
chmod +x $out/share/autoenv
25+
runHook postInstall
26+
'';
27+
28+
meta = {
29+
description = "Per-directory shell environments sourced from .env file";
30+
homepage = "https://github.com/hyperupcall/autoenv";
31+
license = lib.licenses.mit;
32+
platforms = lib.platforms.all;
33+
maintainers = with lib.maintainers; [ clebs ];
34+
};
35+
})

0 commit comments

Comments
 (0)