Move xonsh customization to an overlay

This commit is contained in:
2022-05-17 10:49:11 -07:00
parent 0aba1a4fb2
commit 0a0887680d
2 changed files with 51 additions and 20 deletions

View File

@@ -1,29 +1,14 @@
{ config, pkgs, ... }: let
# Mach-nix is a toolkit for constructing custom Python environments
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.3.0";
}) {
pkgs = pkgs;
};
xonsh_pyenv = mach-nix.mkPython {
requirements = ''
xontrib-fzf-widgets
xonsh-direnv
'';
};
xonsh_with_plugins = pkgs.xonsh.overrideAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ xonsh_pyenv.python.pkgs.selectPkgs xonsh_pyenv.python.pkgs;
});
in
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "ttm";
home.homeDirectory = builtins.getEnv "HOME";
nixpkgs.overlays = [
(import ./overlays/xonsh.nix)
];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
@@ -39,7 +24,9 @@ in
# Enable integration with generic Linux OSs
targets.genericLinux.enable = pkgs.stdenv.isLinux;
home.packages = with pkgs; [
# Defined in Xonsh overlay
xonsh_with_plugins
# Jump to directories
zoxide

44
nix/overlays/xonsh.nix Normal file
View File

@@ -0,0 +1,44 @@
final: prev: {
# xonsh = prev.xonsh.overrideAttrs (old: rec {
# version = "0.12.4";
# src = final.fetchFromGitHub {
# owner = "xonsh";
# repo = "xonsh";
# rev = version;
# sha256 = "0kdps0gf0767zy0fs6qn39rv4z3x7ck0qz1pzx6962593171yk8b";
# };
# propagatedBuildInputs = prev.xonsh.propagatedBuildInputs ++ [final.python3Packages.virtualenv];
# });
python = prev.python.override {
packageOverrides = pfinal: pprev: {
prompt-toolkit = pprev.prompt-toolkit.overrideAttrs (old: rec {
version = "3.0.29";
src = pfinal.fetchPypi {
pname = "prompt_toolkit";
inherit version;
sha256 = "";
};
});
};
};
# Mach-nix is a toolkit for constructing custom Python environments
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.4.0";
}) {
pkgs = final;
};
xonsh_pyenv = final.mach-nix.mkPython {
requirements = ''
xontrib-fzf-widgets
xonsh-direnv
'';
};
xonsh_with_plugins = final.xonsh.overrideAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ final.xonsh_pyenv.python.pkgs.selectPkgs final.xonsh_pyenv.python.pkgs;
});
}