Compare commits
7 commits
9cdaccc3c6
...
7d98dd2edd
Author | SHA1 | Date | |
---|---|---|---|
7d98dd2edd | |||
ee02b803c2 | |||
6e2602a75f | |||
0db80951a2 | |||
fc0b9e3d13 | |||
917e1377c1 | |||
2585df4e81 |
11 changed files with 235 additions and 6 deletions
|
@ -46,8 +46,9 @@
|
|||
};
|
||||
|
||||
modules = [
|
||||
./home
|
||||
inputs.rose-pine.homeManagerModules.rose-pine
|
||||
./modules/home/shellAbbrs.nix
|
||||
./home
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
{ ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
maple-mono-NF
|
||||
];
|
||||
|
||||
rose-pine.pointerCursor.enable = true;
|
||||
|
||||
fonts.fontconfig.defaultFonts.monospace = [ "Maple Mono NF" ];
|
||||
|
||||
imports = [
|
||||
./gtk.nix
|
||||
./qt.nix
|
||||
|
|
|
@ -39,16 +39,13 @@
|
|||
nixfmt-rfc-style
|
||||
nil
|
||||
just
|
||||
maple-mono-NF
|
||||
];
|
||||
|
||||
fonts.fontconfig.defaultFonts.monospace = [ "Maple Mono NF" ];
|
||||
|
||||
imports = [
|
||||
./appearance
|
||||
./profile
|
||||
./programs
|
||||
./services
|
||||
./xdg.nix
|
||||
./xorg
|
||||
];
|
||||
|
||||
|
|
27
home/profile/default.nix
Normal file
27
home/profile/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
home = {
|
||||
sessionPath = [
|
||||
"${config.home.homeDirectory}/.local/bin"
|
||||
];
|
||||
|
||||
sessionVariables = rec {
|
||||
HACK = "${config.home.homeDirectory}/hackin";
|
||||
|
||||
# TODO: remove this when neovim is installed.
|
||||
EDITOR = "nvim";
|
||||
VISUAL = "${EDITOR}";
|
||||
SUDO_EDITOR = "${EDITOR}";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
c = "clear";
|
||||
e = "${config.home.sessionVariables.EDITOR}";
|
||||
v = "${config.home.sessionVariables.EDITOR}";
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./xdg.nix
|
||||
];
|
||||
}
|
|
@ -8,7 +8,9 @@
|
|||
./curl.nix
|
||||
./eza.nix
|
||||
./fish.nix
|
||||
./fzf.nix
|
||||
./gh.nix
|
||||
./go.nix
|
||||
./hyfetch.nix
|
||||
./lazygit.nix
|
||||
./less.nix
|
||||
|
|
|
@ -29,5 +29,37 @@
|
|||
src = autopair;
|
||||
}
|
||||
];
|
||||
|
||||
shellInit = # fish
|
||||
''
|
||||
set -g fish_key_bindings fish_vi_key_bindings
|
||||
'';
|
||||
|
||||
shellAbbrs = {
|
||||
cp = {
|
||||
position = "command";
|
||||
expansion = "cp -iv";
|
||||
};
|
||||
|
||||
mkdir = {
|
||||
position = "command";
|
||||
expansion = "mkdir -pv";
|
||||
};
|
||||
|
||||
mv = {
|
||||
position = "command";
|
||||
expansion = "mv -iv";
|
||||
};
|
||||
|
||||
rm = {
|
||||
position = "command";
|
||||
expansion = "rm -r";
|
||||
};
|
||||
|
||||
grep = {
|
||||
position = "command";
|
||||
expansion = "grep --color=auto";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
37
home/programs/fzf.nix
Normal file
37
home/programs/fzf.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
|
||||
rose-pine.enable = true;
|
||||
|
||||
defaultOptions = [
|
||||
"--margin=10%,5%"
|
||||
"--border=sharp"
|
||||
"--pointer= "
|
||||
"--marker= "
|
||||
"--prompt= "
|
||||
"--preview-label-pos='bottom'"
|
||||
"--preview-window='border-sharp'"
|
||||
];
|
||||
|
||||
# TODO: Check that rg is installed.
|
||||
defaultCommand = "rg --files --hidden --glob \"!.git\"";
|
||||
|
||||
# TODO: Check that fd is installed.
|
||||
changeDirWidgetCommand = "fd --type d";
|
||||
changeDirWidgetOptions = lib.mkIf config.programs.eza.enable [
|
||||
"--preview 'eza --all --color=always --sort=name --group-directories-first --level=3 {}'"
|
||||
];
|
||||
|
||||
# TODO: Check that fd is installed.
|
||||
fileWidgetCommand = "fd --type f";
|
||||
fileWidgetOptions = lib.mkIf config.programs.bat.enable [
|
||||
"--preview 'bat {}'"
|
||||
];
|
||||
|
||||
tmux.enableShellIntegration = lib.mkIf config.programs.tmux.enable true;
|
||||
};
|
||||
|
||||
home.sessionVariables.fzf_diff_highlighter = "delta --paging=never --features=arctic-fox";
|
||||
}
|
14
home/programs/go.nix
Normal file
14
home/programs/go.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
programs.go = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home.sessionPath =
|
||||
let
|
||||
goPath = config.programs.go.goPath;
|
||||
in
|
||||
[
|
||||
"${if (goPath == null) then "go" else goPath}"
|
||||
];
|
||||
}
|
|
@ -1,5 +1,16 @@
|
|||
{ ... }:
|
||||
{
|
||||
home.shellAbbrs = {
|
||||
jf = {
|
||||
position = "command";
|
||||
expansion = "sudo journalctl --follow --unit";
|
||||
};
|
||||
je = {
|
||||
position = "command";
|
||||
expansion = "sudo journalctl --pager-end --unit";
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./clipboard.nix
|
||||
./dunst.nix
|
||||
|
|
102
modules/home/shellAbbrs.nix
Normal file
102
modules/home/shellAbbrs.nix
Normal file
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
# https://github.com/nix-community/home-manager/blob/master/modules/programs/fish.nix
|
||||
abbrModule = types.submodule {
|
||||
options = {
|
||||
expansion = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The command expanded by an abbreviation.
|
||||
'';
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = "anywhere";
|
||||
description = ''
|
||||
If the position is "command", the abbreviation expands only if
|
||||
the position is a command. If it is "anywhere", the abbreviation
|
||||
expands anywhere.
|
||||
'';
|
||||
};
|
||||
|
||||
regex = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The regular expression pattern matched instead of the literal name.
|
||||
'';
|
||||
};
|
||||
|
||||
setCursor = mkOption {
|
||||
type = with types; (either bool str);
|
||||
default = false;
|
||||
description = ''
|
||||
The marker indicates the position of the cursor when the abbreviation
|
||||
is expanded. When setCursor is true, the marker is set with a default
|
||||
value of "%".
|
||||
'';
|
||||
};
|
||||
|
||||
function = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The fish function expanded instead of a literal string.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
removeFishOnly = attrsets.filterAttrs (
|
||||
_: v: if (builtins.isAttrs v) then !((v ? regex) || (v ? setCursor) || (v ? function)) else true
|
||||
);
|
||||
|
||||
abbrToAlias = attrsets.mapAttrs (
|
||||
_: v: if (builtins.isAttrs v) then v.expansion else v
|
||||
) removeFishOnly;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
# https://github.com/nix-community/home-manager/blob/master/modules/programs/fish.nix
|
||||
home.shellAbbrs = mkOption {
|
||||
type = with types; attrsOf (either str abbrModule);
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
l = "less";
|
||||
gco = "git checkout";
|
||||
"-C" = {
|
||||
position = "anywhere";
|
||||
expansion = "--color";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
An attribute set that maps aliases (the top level attribute names
|
||||
in this option) to abbreviations. Abbreviations are expanded with
|
||||
the longer phrase after they are entered.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
fishCfg = config.programs.fish;
|
||||
shellAbbrs = config.home.shellAbbrs;
|
||||
in
|
||||
{
|
||||
programs.fish.shellAbbrs = mkIf fishCfg.enable shellAbbrs;
|
||||
|
||||
home.shellAliases = mkIf (!fishCfg.enable) (abbrToAlias shellAbbrs);
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue