current
linted
This commit is contained in:
parent
4e99a0e323
commit
7485de646a
95 changed files with 2743 additions and 2282 deletions
|
@ -1,20 +1,26 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption mkIf types;
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
inherit (builtins) listToAttrs;
|
||||
cfg = config.programs.murex;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.programs.murex = {
|
||||
enable = mkEnableOption "murex shell";
|
||||
managePlugins = mkEnableOption "plugin management";
|
||||
direnv = mkEnableOption "direnv integration";
|
||||
plugins = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
profile = mkOption {
|
||||
type = types.str;
|
||||
|
@ -27,16 +33,18 @@ in {
|
|||
useXdgConfig = mkEnableOption "override MUREX_{PRELOAD,MODULES,PROFILE} env vars to conform to XDG_CONFIG_HOME";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
home.file = let
|
||||
plugins = listToAttrs (map (plugin: {
|
||||
name = ".murex_modules/${plugin.pname}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = plugin;
|
||||
};
|
||||
})
|
||||
cfg.plugins);
|
||||
in
|
||||
home.file =
|
||||
let
|
||||
plugins = listToAttrs (
|
||||
map (plugin: {
|
||||
name = ".murex_modules/${plugin.pname}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = plugin;
|
||||
};
|
||||
}) cfg.plugins
|
||||
);
|
||||
in
|
||||
lib.mergeAttrs plugins {
|
||||
".murex_preload" = {
|
||||
text = cfg.preload;
|
||||
|
@ -47,31 +55,31 @@ in {
|
|||
text =
|
||||
cfg.profile
|
||||
+ (
|
||||
if cfg.direnv
|
||||
then ''
|
||||
direnv hook murex -> source
|
||||
''
|
||||
else ""
|
||||
if cfg.direnv then
|
||||
''
|
||||
direnv hook murex -> source
|
||||
''
|
||||
else
|
||||
""
|
||||
);
|
||||
executable = true;
|
||||
enable = cfg.direnv || cfg.profile != "";
|
||||
};
|
||||
".murex_modules/packages.json" = {
|
||||
text = builtins.toJSON (map (plugin: {
|
||||
text = builtins.toJSON (
|
||||
map (plugin: {
|
||||
Protocol = "nix";
|
||||
URI = "nix://managed.git";
|
||||
Package = plugin.pname;
|
||||
})
|
||||
cfg.plugins);
|
||||
enable = cfg.managePlugins && (cfg.plugins != []);
|
||||
}) cfg.plugins
|
||||
);
|
||||
enable = cfg.managePlugins && (cfg.plugins != [ ]);
|
||||
};
|
||||
};
|
||||
home.sessionVariables =
|
||||
mkIf
|
||||
cfg.useXdgConfig {
|
||||
MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_MODULES = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/";
|
||||
};
|
||||
home.sessionVariables = mkIf cfg.useXdgConfig {
|
||||
MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_MODULES = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue