mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 08:10:43 +01:00
refactor: flake-parts
This commit is contained in:
parent
872c6be493
commit
42a1293f6d
63 changed files with 1118 additions and 875 deletions
61
users/ryan/programs/fish.nix
Normal file
61
users/ryan/programs/fish.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{ lib, ... }:
|
||||
let
|
||||
aliases = import ./aliases.nix;
|
||||
|
||||
shellAbbrs = builtins.mapAttrs (lib.const (builtins.getAttr "command")) (
|
||||
lib.filterAttrs (_: a: !(lib.maybeAttr "fishAlias" false a)) aliases
|
||||
);
|
||||
shellAliases = builtins.mapAttrs (lib.const (builtins.getAttr "command")) (
|
||||
lib.filterAttrs (_: a: lib.maybeAttr "fishAlias" false a) aliases
|
||||
);
|
||||
in
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
inherit shellAbbrs shellAliases;
|
||||
|
||||
shellInit = ''
|
||||
for config in ${./fish/configs}/*.fish
|
||||
source "$config"
|
||||
end
|
||||
'';
|
||||
|
||||
functions = {
|
||||
take = ''
|
||||
set dir $argv[1]
|
||||
if test -z "$dir"
|
||||
return 1
|
||||
end
|
||||
|
||||
mkdir -p "$dir"
|
||||
cd "$dir"
|
||||
'';
|
||||
|
||||
code = ''
|
||||
if test -d "$argv[1]" -o -f "$argv[1]"
|
||||
open -a "Visual Studio Code" "$argv[1]"
|
||||
else
|
||||
command code $argv
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
defaultOptions = [
|
||||
"--height 40%"
|
||||
"--layout reverse"
|
||||
"--border"
|
||||
];
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue