home: create 'modules/home' folder
Consolidating all modules under the same path, to clear out the top-level directory.
This commit is contained in:
parent
c856933803
commit
65a8f7c481
119 changed files with 2 additions and 2 deletions
46
modules/home/direnv/default.nix
Normal file
46
modules/home/direnv/default.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.home.direnv;
|
||||
in
|
||||
{
|
||||
options.my.home.direnv = with lib; {
|
||||
enable = my.mkDisableOption "direnv configuration";
|
||||
|
||||
defaultFlake = mkOption {
|
||||
type = types.str;
|
||||
default = "pkgs";
|
||||
example = "nixpkgs";
|
||||
description = ''
|
||||
Which flake from the registry should be used for
|
||||
<command>use pkgs</command> by default.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv = {
|
||||
# A better `use_nix`
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile =
|
||||
let
|
||||
libDir = ./lib;
|
||||
contents = builtins.readDir libDir;
|
||||
names = lib.attrNames contents;
|
||||
files = lib.filter (name: contents.${name} == "regular") names;
|
||||
linkLibFile = name:
|
||||
lib.nameValuePair
|
||||
"direnv/lib/${name}"
|
||||
{ source = libDir + "/${name}"; };
|
||||
in
|
||||
lib.my.genAttrs' files linkLibFile;
|
||||
|
||||
home.sessionVariables = {
|
||||
DIRENV_DEFAULT_FLAKE = cfg.defaultFlake;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue