home: direnv: allow specifying default flake
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b9361dada4
commit
6530af39d8
|
@ -3,8 +3,18 @@ let
|
||||||
cfg = config.my.home.direnv;
|
cfg = config.my.home.direnv;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.home.direnv = with lib.my; {
|
options.my.home.direnv = with lib; {
|
||||||
enable = mkDisableOption "direnv configuration";
|
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 {
|
config = lib.mkIf cfg.enable {
|
||||||
|
@ -28,5 +38,9 @@ in
|
||||||
{ source = libDir + "/${name}"; };
|
{ source = libDir + "/${name}"; };
|
||||||
in
|
in
|
||||||
lib.my.genAttrs' files linkLibFile;
|
lib.my.genAttrs' files linkLibFile;
|
||||||
|
|
||||||
|
home.sessionVariables = {
|
||||||
|
DIRENV_DEFAULT_FLAKE = cfg.defaultFlake;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ use_pkgs() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local DEFAULT_FLAKE="pkgs"
|
# Use user-provided default value, or fallback to nixpkgs
|
||||||
|
local DEFAULT_FLAKE="${DIRENV_DEFAULT_FLAKE:-nixpkgs}"
|
||||||
|
|
||||||
# Allow changing the default flake through a command line switch
|
# Allow changing the default flake through a command line switch
|
||||||
if [ "$1" = "-f" ] || [ "$1" = "--flake" ]; then
|
if [ "$1" = "-f" ] || [ "$1" = "--flake" ]; then
|
||||||
|
|
Loading…
Reference in a new issue