refactor(flake): wrap xonsh as a package
This commit is contained in:
parent
660c9089d4
commit
d84ed13e0f
11 changed files with 287 additions and 135 deletions
|
@ -5,10 +5,16 @@
|
|||
...
|
||||
}: let
|
||||
cfg = config.alqueva.xonsh;
|
||||
inherit (pkgs) fetchFromGitHub;
|
||||
attrsToPyDict = attrs: (lib.pipe attrs [
|
||||
(builtins.mapAttrs (n: v: "aliases['${n}'] = '${v}'"))
|
||||
builtins.attrValues
|
||||
(lib.concatStringsSep "\n")
|
||||
(s: s + "\n")
|
||||
]);
|
||||
in {
|
||||
options.alqueva.xonsh = {
|
||||
enable = lib.mkEnableOption "xonsh";
|
||||
package = lib.mkPackageOption pkgs "xonsh" {};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -16,83 +22,14 @@ in {
|
|||
xonsh = {
|
||||
config =
|
||||
"from xonsh.xontribs import get_xontribs\n"
|
||||
+ lib.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (n: v: "aliases['${n}'] = '${v}'\n") config.environment.shellAliases))
|
||||
+ attrsToPyDict config.environment.shellAliases
|
||||
+ ''
|
||||
for xontrib in get_xontribs():
|
||||
xontrib load @(xontrib)
|
||||
|
||||
execx($(zoxide init xonsh --cmd j), 'exec', __xonsh__.ctx, filename='zoxide')
|
||||
'';
|
||||
package = pkgs.xonsh.override {
|
||||
extraPackages = ps: [
|
||||
(let
|
||||
pname = "xontrib-fish-completer";
|
||||
version = "0.0.1";
|
||||
in
|
||||
ps.buildPythonPackage {
|
||||
inherit pname version;
|
||||
src = fetchFromGitHub {
|
||||
owner = "xonsh";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
hash = "sha256-PhhdZ3iLPDEIG9uDeR5ctJ9zz2+YORHBhbsiLrJckyA=";
|
||||
};
|
||||
})
|
||||
(let
|
||||
pname = "xontrib-prompt-starship";
|
||||
version = "0.3.6";
|
||||
in
|
||||
ps.buildPythonPackage {
|
||||
inherit pname version;
|
||||
src = fetchFromGitHub {
|
||||
owner = "anki-code";
|
||||
repo = pname;
|
||||
tag = version;
|
||||
hash = "sha256-CLOvMa3L4XnH53H/k6/1W9URrPakPjbX1T1U43+eSR0=";
|
||||
};
|
||||
})
|
||||
(let
|
||||
pname = "xontrib-init-ssh-agent";
|
||||
version = "1.0.1";
|
||||
in
|
||||
ps.buildPythonPackage {
|
||||
inherit pname version;
|
||||
pyproject = true;
|
||||
build-system = [
|
||||
ps.setuptools
|
||||
ps.wheel
|
||||
];
|
||||
dependencies = [
|
||||
ps.xonsh
|
||||
];
|
||||
src = fetchFromGitHub {
|
||||
owner = "amadaluzia";
|
||||
repo = pname;
|
||||
rev = "cac9cfec70ec15b0ed4f1c8a18154ea9b4f8fb47";
|
||||
hash = "sha256-UkRPdaZFNP8qv7lMwsTUalnre3k2UMfqMzmiTveLiBM=";
|
||||
};
|
||||
})
|
||||
(let
|
||||
pname = "xonsh-direnv";
|
||||
version = "1.6.5";
|
||||
in
|
||||
ps.buildPythonPackage {
|
||||
inherit pname version;
|
||||
src = fetchFromGitHub {
|
||||
owner = "74th";
|
||||
repo = pname;
|
||||
tag = version;
|
||||
hash = "sha256-huBJ7WknVCk+WgZaXHlL+Y1sqsn6TYqMP29/fsUPSyU=";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
inherit (cfg) package;
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = [
|
||||
pkgs.zoxide
|
||||
pkgs.amadaluzian-starship
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue