From 5082f7dc4051b28997d522b17fe3ebcbe6abd439 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sat, 2 Nov 2024 11:28:08 +0100 Subject: [PATCH] SHELL: WORKS NOW!!!!!!!!!!!!!!!!!!!!! --- README.md | 1 + flake.nix | 7 ++++++- modules/user/shell/aliases.nix | 2 ++ modules/user/shell/default.nix | 13 ++++++++++++- modules/user/shell/fish-on-tmpfs.patch | 10 ++++++++++ modules/user/shell/fishinit.nix | 2 +- 6 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 modules/user/shell/fish-on-tmpfs.patch diff --git a/README.md b/README.md index fc8b72d..1e95017 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,4 @@ The nix logo was designed by ![jacekpoz](https://jacekpoz.pl)! ![fufexan](https://github.com/fufexan) ![lokasku](https://github.com/lokasku/nix-config) ![NotAShelf](https://github.com/notashelf/nyx) +![viperML](https://github.com/viperml/dotfiles) diff --git a/flake.nix b/flake.nix index c2d9b28..68189f5 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,12 @@ devShells.x86_64-linux.default = pkgs.callPackage ./shell.nix {}; formatter.x86_64-linux = pkgs.alejandra; - packages.x86_64-linux= user.packages; + packages.x86_64-linux = user.packages; + + apps.x86_64-linux.default = { + type = "app"; + program = "${user.packages.fish}/bin/fish"; + }; nixosModules = { user = user.module; shell = import ./modules/shell {inherit pkgs;}; diff --git a/modules/user/shell/aliases.nix b/modules/user/shell/aliases.nix index 1816340..23b0ca8 100644 --- a/modules/user/shell/aliases.nix +++ b/modules/user/shell/aliases.nix @@ -19,4 +19,6 @@ in { cat = "${getExe pkgs.bat} --plain"; kys = "shutdown now"; + + cd = "z"; } diff --git a/modules/user/shell/default.nix b/modules/user/shell/default.nix index af42585..56b92c3 100644 --- a/modules/user/shell/default.nix +++ b/modules/user/shell/default.nix @@ -10,10 +10,21 @@ pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases); packages = import ./packages.nix pkgs; + + # this was taken from viperml, check out his config for this! + custom-fish = pkgs.fish.overrideAttrs (old: { + patches = [./fish-on-tmpfs.patch]; + doCheck = false; + postInstall = + old.postInstall + + '' + echo "source ${fishinit}" >> $out/etc/fish/config.fish + ''; + }); in (pkgs.symlinkJoin { name = "fish-wrapped"; - paths = [pkgs.fish] ++ packages; + paths = [custom-fish] ++ packages; buildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/fish --set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \ diff --git a/modules/user/shell/fish-on-tmpfs.patch b/modules/user/shell/fish-on-tmpfs.patch new file mode 100644 index 0000000..d477186 --- /dev/null +++ b/modules/user/shell/fish-on-tmpfs.patch @@ -0,0 +1,10 @@ +--- a/src/path.cpp ++++ b/src/path.cpp +@@ -384,7 +384,7 @@ static const base_directory_t &get_data_directory() { + } + + static const base_directory_t &get_config_directory() { +- static base_directory_t s_dir = make_base_directory(L"XDG_CONFIG_HOME", L"/.config/fish"); ++ static base_directory_t s_dir = make_base_directory(L"XDG_RUNTIME_DIR", L"/.config/fish"); + return s_dir; + } diff --git a/modules/user/shell/fishinit.nix b/modules/user/shell/fishinit.nix index 3ef9eac..f469eec 100644 --- a/modules/user/shell/fishinit.nix +++ b/modules/user/shell/fishinit.nix @@ -2,7 +2,7 @@ pkgs, aliasesStr, }: -pkgs.writeShellScriptBin "config.fish" '' +pkgs.writeText "config.fish" '' # source ${pkgs.fishPlugins.sponge}/share/zsh-defer/zsh-defer.plugin.zsh ${pkgs.atuin}/bin/atuin init fish | source