mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 21:49:48 +01:00
xonsh:init
This commit is contained in:
parent
2598861031
commit
2080291ee6
2 changed files with 65 additions and 0 deletions
|
@ -254,6 +254,7 @@ let
|
||||||
./programs/wpaperd.nix
|
./programs/wpaperd.nix
|
||||||
./programs/xmobar.nix
|
./programs/xmobar.nix
|
||||||
./programs/xplr.nix
|
./programs/xplr.nix
|
||||||
|
./programs/xonsh.nix
|
||||||
./programs/yambar.nix
|
./programs/yambar.nix
|
||||||
./programs/yazi.nix
|
./programs/yazi.nix
|
||||||
./programs/yt-dlp.nix
|
./programs/yt-dlp.nix
|
||||||
|
|
64
modules/programs/xonsh.nix
Normal file
64
modules/programs/xonsh.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.programs.xonsh;
|
||||||
|
inherit (lib) types mkOption;
|
||||||
|
in {
|
||||||
|
options.programs.xonsh = {
|
||||||
|
enable = lib.mkEnableOption "xonsh";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "xonsh" { };
|
||||||
|
finalPackage = lib.mkOption {
|
||||||
|
type = types.package;
|
||||||
|
internal = true;
|
||||||
|
description = "Package that will actually get installed";
|
||||||
|
};
|
||||||
|
xonshrc = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
description = ''
|
||||||
|
The contents of .xonshrc
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
pythonPackages = mkOption {
|
||||||
|
type = types.raw;
|
||||||
|
default = pkgs.pythonPackages;
|
||||||
|
defaultText = "pkgs.pythonPackages";
|
||||||
|
description = ''
|
||||||
|
The pythonPackages set extraPackages are taken from
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
shellAliases = mkOption {
|
||||||
|
type = with types; attrsOf (listOf str);
|
||||||
|
default = { };
|
||||||
|
example = { ll = [ "ls" "-l" ]; };
|
||||||
|
description = ''
|
||||||
|
An attribute set that maps aliases (the top level attribute names in
|
||||||
|
this option) to commands
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
extraPackages = mkOption {
|
||||||
|
type = with types; functionTo (listOf package);
|
||||||
|
default = _: [ ];
|
||||||
|
defaultText = "_: []";
|
||||||
|
description = ''
|
||||||
|
List of python packages and xontrib to make avaiable
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.finalPackage ];
|
||||||
|
programs.xonsh = {
|
||||||
|
xonshrc = lib.mkMerge
|
||||||
|
(lib.mapAttrsToList (n: v: "aliases['${n}']=${builtins.toJSON v}")
|
||||||
|
cfg.shellAliases);
|
||||||
|
shellAliases = lib.mapAttrs (n: v: lib.mkDefault (lib.splitString " " v))
|
||||||
|
config.home.shellAliases;
|
||||||
|
finalPackage =
|
||||||
|
(cfg.package.override (old: { inherit (cfg) extraPackages; }));
|
||||||
|
};
|
||||||
|
xdg.configFile."xonsh/rc.xsh" = {
|
||||||
|
enable = cfg.xonshrc != "";
|
||||||
|
text = cfg.xonshrc;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue