Skip to content

Commit

Permalink
Tweaks to shell configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
malob committed Dec 27, 2024
1 parent c06b181 commit d45151b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
10 changes: 5 additions & 5 deletions darwin/homebrew.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ let
inherit (lib) mkIf;
caskPresent = cask: lib.any (x: x.name == cask) config.homebrew.casks;
brewEnabled = config.homebrew.enable;
brewShellInit = mkIf brewEnabled ''
eval "$(${config.homebrew.brewPrefix}/brew shellenv)"
'';
in

{
environment.shellInit = mkIf brewEnabled ''
eval "$(${config.homebrew.brewPrefix}/brew shellenv)"
'';
environment.shellInit = brewShellInit;
programs.zsh.shellInit = brewShellInit; # `zsh` doesn't inherit `environment.shellInit`

# https://docs.brew.sh/Shell-Completion#configuring-completions-in-fish
# For some reason if the Fish completions are added at the end of `fish_complete_path` they don't
# seem to work, but they do work if added at the start.
programs.fish.interactiveShellInit = mkIf brewEnabled ''
if test -d (brew --prefix)"/share/fish/completions"
set -p fish_complete_path (brew --prefix)/share/fish/completions
Expand Down
23 changes: 14 additions & 9 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# See https://nixos.wiki/wiki/Flakes#Using_flakes_project_from_a_legacy_Nix
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).defaultNix
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}
).defaultNix
3 changes: 1 addition & 2 deletions home/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ in
# Add Fish plugins
home.packages = [
pkgs.fishPlugins.done
pkgs.fishPlugins.github-copilot-cli-fish
];

# Fish functions ----------------------------------------------------------------------------- {{{
Expand Down Expand Up @@ -110,7 +109,7 @@ in
# Fish configuration ------------------------------------------------------------------------- {{{

# Aliases
programs.fish.shellAliases = with pkgs; {
home.shellAliases = with pkgs; {
# Nix related
drb = "darwin-rebuild build --flake ${nixConfigDirectory}";
drs = "darwin-rebuild switch --flake ${nixConfigDirectory}";
Expand Down
3 changes: 2 additions & 1 deletion home/neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ in
# Put neovim configuration located in this repository into place in a way that edits to the
# configuration don't require rebuilding the `home-manager` environment to take effect.
xdg.configFile."nvim/lua".source = mkOutOfStoreSymlink "${nixConfigDirectory}/configs/nvim/lua";
xdg.configFile."nvim/colors".source = mkOutOfStoreSymlink "${nixConfigDirectory}/configs/nvim/colors";
xdg.configFile."nvim/colors".source =
mkOutOfStoreSymlink "${nixConfigDirectory}/configs/nvim/colors";

# Load the `init` module from the above configs
programs.neovim.extraConfig = "lua require('init')";
Expand Down
4 changes: 2 additions & 2 deletions home/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
let
inherit (lib) attrValues mkIf elem;

mkOpRunAliases = cmds:
lib.genAttrs cmds (cmd: mkIf (elem pkgs.${cmd} config.home.packages) "op run -- ${cmd}");
mkOpRunAliases =
cmds: lib.genAttrs cmds (cmd: mkIf (elem pkgs.${cmd} config.home.packages) "op run -- ${cmd}");
in

{
Expand Down

0 comments on commit d45151b

Please sign in to comment.