Install direnv.
This commit is contained in:
parent
399379cea0
commit
8847063948
@ -16,6 +16,7 @@
|
|||||||
./roles/boot
|
./roles/boot
|
||||||
./roles/chromecast
|
./roles/chromecast
|
||||||
./roles/chromium
|
./roles/chromium
|
||||||
|
./roles/direnv
|
||||||
./roles/distributed_build
|
./roles/distributed_build
|
||||||
./roles/docker
|
./roles/docker
|
||||||
./roles/ecc
|
./roles/ecc
|
||||||
@ -142,7 +143,7 @@
|
|||||||
# Runs nix-collect-garbage --delete-older-than 5d
|
# Runs nix-collect-garbage --delete-older-than 5d
|
||||||
automatic = true;
|
automatic = true;
|
||||||
persistent = true;
|
persistent = true;
|
||||||
dates = "weekly";
|
dates = "monthly";
|
||||||
# randomizedDelaySec = "14m";
|
# randomizedDelaySec = "14m";
|
||||||
options = "--delete-older-than 30d";
|
options = "--delete-older-than 30d";
|
||||||
};
|
};
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
me.bluetooth.enable = true;
|
me.bluetooth.enable = true;
|
||||||
me.chromecast.enable = true;
|
me.chromecast.enable = true;
|
||||||
me.chromium.enable = true;
|
me.chromium.enable = true;
|
||||||
|
me.direnv.enable = true;
|
||||||
me.docker.enable = true;
|
me.docker.enable = true;
|
||||||
me.ecc.enable = true;
|
me.ecc.enable = true;
|
||||||
me.emacs_flavor = "full";
|
me.emacs_flavor = "full";
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
me.bluetooth.enable = true;
|
me.bluetooth.enable = true;
|
||||||
me.chromecast.enable = true;
|
me.chromecast.enable = true;
|
||||||
me.chromium.enable = true;
|
me.chromium.enable = true;
|
||||||
|
me.direnv.enable = true;
|
||||||
me.docker.enable = true;
|
me.docker.enable = true;
|
||||||
me.ecc.enable = true;
|
me.ecc.enable = true;
|
||||||
me.emacs_flavor = "full";
|
me.emacs_flavor = "full";
|
||||||
|
55
nix/configuration/roles/direnv/default.nix
Normal file
55
nix/configuration/roles/direnv/default.nix
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
direnv_zsh_hook = pkgs.writeTextFile {
|
||||||
|
name = "direnv_zsh_hook.zsh";
|
||||||
|
text = ''
|
||||||
|
eval "$(direnv hook zsh)"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
direnv.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install direnv.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.direnv.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
direnv
|
||||||
|
nix-direnv
|
||||||
|
];
|
||||||
|
|
||||||
|
me.zsh.includes = [ direnv_zsh_hook ];
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
# List of allowed directories from `direnv allow`.
|
||||||
|
directory = ".local/share/direnv";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
@ -49,6 +49,8 @@ let
|
|||||||
|
|
||||||
source ${pkgs.zsh-histdb}/share/zsh/plugins/zsh-histdb/histdb-interactive.zsh
|
source ${pkgs.zsh-histdb}/share/zsh/plugins/zsh-histdb/histdb-interactive.zsh
|
||||||
bindkey '^r' _histdb-isearch
|
bindkey '^r' _histdb-isearch
|
||||||
|
|
||||||
|
${lib.concatMapStringsSep "\n" (item: "source ${item}") config.me.zsh.includes}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@ -62,6 +64,16 @@ in
|
|||||||
example = true;
|
example = true;
|
||||||
description = "Whether we want to install zsh.";
|
description = "Whether we want to install zsh.";
|
||||||
};
|
};
|
||||||
|
zsh.includes = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.package;
|
||||||
|
default = [ ];
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
[ (pkgs.writeTextFile {
|
||||||
|
name = "launch-kanshi.conf";
|
||||||
|
text = "exec kanshi";
|
||||||
|
}) ]'';
|
||||||
|
description = "List of zshrc files to import.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.me.zsh.enable (
|
config = lib.mkIf config.me.zsh.enable (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user