nixos-configuration/nix-os/shell.nix

160 lines
4.2 KiB
Nix

{ config, pkgs, unstablePkgs, lib, ... }:
let
rangerGit = pkgs.ranger.overrideAttrs (old: {
version = "git";
src = pkgs.fetchFromGitHub {
owner = "ranger";
repo = "ranger";
rev = "c7777d558d5b69843b21f986e9af1af311c83887";
hash = "sha256-DTVoEfc4dAaBTDLFujvWIYj5KHL89YknUiinIs9Rkeg=";
};
propagatedBuildInputs = with pkgs.python3Packages; [
# required for test suite, it's being ran during package build for some reason
flake8
pylint
pytest
setuptools
] ++ old.propagatedBuildInputs;
});
aliasDrag = pkgs.writeScriptBin "drag" ''
${pkgs.ripdrag}/bin/ripdrag -Axd $@
'';
in
{
imports = [
./unstable-packages.nix
];
environment.systemPackages = with pkgs; [
aliasDrag
rangerGit
kitty
zoxide
];
programs.bash.shellInit = ''
HISTCONTROL=ignoreboth
'';
programs.bash.interactiveShellInit = ''
HISTCONTROL=ignoreboth
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="enabled,no-sudo"
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
fi
eval "''$(zoxide init bash)"
alias bye=exit
'';
environment.etc."xdg/kitty/kitty.conf".text = ''
font_family MesloLGS Nerd Font
font_size 10.0
scrollback_lines 10000
window_border_width 0.5
window_padding_width 3
${if config.services.xserver.desktopManager.gnome.enable then "hide_window_decorations yes" else ""}
background_opacity 0.8
dynamic_background_opacity yes
map kitty_mod+alt+c copy_ansi_to_clipboard
'';
environment.etc."ranger/rc.conf".text = ''
eval import os; fm.set_option_from_string("preview_images", "true") if "KITTY_INSTALLATION_DIR" in os.environ else None;
eval import os; fm.set_option_from_string("preview_images_method", "kitty") if "KITTY_INSTALLATION_DIR" in os.environ else None;
set vcs_aware true
set show_hidden true
alias drag shell ${pkgs.ripdrag}/bin/ripdrag -Axd %p &
map <C-d> drag
'';
environment.etc."ranger/plugins/zoxide.py".source = pkgs.fetchFromGitHub {
owner = "jchook";
repo = "ranger-zoxide";
rev = "281828de060299f73fe0b02fcabf4f2f2bd78ab3";
hash = "sha256-JEuyYSVa1NS3aftezEJx/k19lwwzf7XhqBCL0jH6VT4=";
} + /__init__.py;
programs.direnv.enable = true;
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
configure = {
customRC = ''
set number
set hlsearch
set incsearch
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set updatetime=500
colorscheme vim
syntax on
set encoding=utf-8
set wildmode=longest,list,full
set listchars=space:·,tab:»
set indentkeys-=0#
" rainbow-delimeters-nvim
let g:rainbow_delimiters = {
\ 'strategy': {
\ ${"''"}: rainbow_delimiters#strategy.global,
\ },
\ }
" vim-gitguter
set signcolumn=yes
highlight SignColumn NONE
highlight GitGutterAdd ctermfg=2 guifg=#2ea043
highlight GitGutterChange ctermfg=4 guifg=#0078d4
highlight GitGutterDelete ctermfg=1 guifg=#f85149
lua require('guess-indent').setup {}
'';
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
guess-indent-nvim
vim-visual-multi
autoclose-nvim
rainbow-delimiters-nvim
vimagit
vim-gitgutter
];
};
};
};
environment.variables = lib.mkIf config.programs.neovim.enable rec {
EDITOR = "/run/current-system/sw/bin/nvim";
VISUAL = EDITOR;
};
programs.starship = {
enable = true;
settings = {
format = "$all$line_break\${custom.ranger}$jobs$battery$time$status$os$container$shell$character";
directory = {
truncation_length = 5;
truncation_symbol = "/";
};
hostname = {
ssh_only = false;
};
username = {
show_always = true;
};
status.disabled = false;
custom.ranger = {
when = "test $RANGER_LEVEL";
command = "echo \"\"";
style = "bold 208";
};
};
};
}