From 7d7db5df0d79bd5aa48c9f63a18e38d92c0b25e3 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Tue, 14 May 2024 19:46:39 +0000 Subject: [PATCH] Let's try xonsh --- home/default.nix | 1 - home/fish.nix | 16 ---------------- sets/base.nix | 4 +--- sets/nvim.nix | 1 - sets/xonsh.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 21 deletions(-) delete mode 100644 home/fish.nix create mode 100644 sets/xonsh.nix diff --git a/home/default.nix b/home/default.nix index 9e94d15..09bf3d5 100644 --- a/home/default.nix +++ b/home/default.nix @@ -8,7 +8,6 @@ home-manager.users.artemis = { imports = [ ./dirs.nix - ./fish.nix ./git.nix ./gpg.nix ./gtk.nix diff --git a/home/fish.nix b/home/fish.nix deleted file mode 100644 index a8dc54f..0000000 --- a/home/fish.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, ... }: -{ - programs.fish = { - enable = true; - interactiveShellInit = "set -g -x GPG_TTY (tty)"; - shellAliases = { - cat = "bat"; - ls = "eza"; - nix-fish = "nix-shell --command fish"; - }; - }; - home.packages = with pkgs; [ - bat - eza - ]; -} diff --git a/sets/base.nix b/sets/base.nix index 1cc19fb..cdd4756 100644 --- a/sets/base.nix +++ b/sets/base.nix @@ -1,6 +1,5 @@ { config, - pkgs, lib, inputs, ... @@ -11,6 +10,7 @@ inputs.lix-module.nixosModules.default inputs.private.nixosModules.base inputs.private.nixosModules.substituter + ./xonsh.nix ]; nix = { @@ -85,7 +85,6 @@ time.timeZone = "Etc/UTC"; environment.shellAliases.cp = "cp --reflink=auto --sparse=always"; networking.firewall.enable = false; - programs.fish.enable = true; users = { users.artemis = { @@ -96,7 +95,6 @@ "wheel" "artemis" ]; - shell = pkgs.fish; # hashedPassword set in private }; groups.artemis.gid = config.users.users.artemis.uid; diff --git a/sets/nvim.nix b/sets/nvim.nix index e730ff6..29a6efb 100644 --- a/sets/nvim.nix +++ b/sets/nvim.nix @@ -50,7 +50,6 @@ lib.setAttrByPath setPath ( }; extraPlugins = with pkgs.vimPlugins; [ vim-fetch - vim-fish vim-flatbuffers vim-nftables vim-protobuf diff --git a/sets/xonsh.nix b/sets/xonsh.nix new file mode 100644 index 0000000..bde8ab8 --- /dev/null +++ b/sets/xonsh.nix @@ -0,0 +1,45 @@ +{ pkgs, ... }: +let + xonsh-direnv = + ps: + ps.buildPythonPackage rec { + pname = "xonsh-direnv"; + version = "1.6.1"; + src = pkgs.fetchPypi { + inherit pname version; + hash = "sha256-Nt8Da1EtMVWZ9mbBDjys7HDutLYifwoQ1HVmI5CN2Ww="; + }; + }; + xontrib-fish-completer = + ps: + ps.buildPythonPackage rec { + pname = "xontrib-fish-completer"; + version = "0.0.1"; + src = pkgs.fetchPypi { + inherit pname version; + hash = "sha256-Kr1iolx6DxqgxVNtXwwfggkLrbH9BlilGAYZahvR+3Y="; + }; + + patchPhase = "sed -i -e 's/^dependencies.*$/dependencies = []/' pyproject.toml"; + }; +in +{ + # We need fish for fish completions + programs.fish.enable = true; + + users.users.artemis.shell = "/run/current-system/sw/bin/xonsh"; + + programs.xonsh = { + enable = true; + config = '' + $UPDATE_OS_ENVIRON = True + xontrib load direnv fish_completer + ''; + package = pkgs.xonsh.override { + extraPackages = ps: [ + (xonsh-direnv ps) + (xontrib-fish-completer ps) + ]; + }; + }; +}