1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/direnv.nix

40 lines
904 B
Nix
Raw Normal View History

2019-08-24 12:02:38 +02:00
{ pkgs, ... }:
2019-08-25 15:39:41 +02:00
let nixify = pkgs.writers.writeDashBin "nixify" ''
set -efuC
if [ ! -e ./.envrc ]; then
echo use_nix > .envrc
direnv allow
fi
if [ ! -e shell.nix ]; then
cat > shell.nix <<'EOF'
2019-08-25 15:39:41 +02:00
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [];
shellHook = "export HISTFILE=''${toString ./.history}";
2019-08-25 15:39:41 +02:00
}
EOF
''${EDITOR:-vim} shell.nix
2019-08-25 15:39:41 +02:00
fi
'';
in {
environment.systemPackages = [
pkgs.direnv
nixify
];
2019-08-24 12:02:38 +02:00
home-manager.users.me.programs.direnv = {
enable = true;
stdlib = builtins.readFile ("${pkgs.fetchFromGitHub {
owner = "Mic92";
repo = "dotfiles";
rev = "a0a9b7e358fa70a85cd468f8ca1fbb02ae0a91df";
sha256 = "1y9h5s1lf59sczsm0ksq2x1yhl98ba9lwk5yil3q53rg7n4574pg";
}}/home/.direnvrc");
};
programs.zsh.interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
'';
}