From fdf1c788488534825abdbfe8f8c0e8e95a876d57 Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Fri, 29 Sep 2023 21:02:23 -0700 Subject: nix: reorg programs into modules --- modules/common.nix | 17 +++++++++++++++++ modules/fzf.nix | 9 +++++++++ modules/git.nix | 24 ++++++++++++++++++++++++ modules/lf.nix | 41 +++++++++++++++++++++++++++++++++++++++++ modules/zsh.nix | 2 ++ 5 files changed, 93 insertions(+) create mode 100644 modules/common.nix create mode 100644 modules/fzf.nix create mode 100644 modules/git.nix create mode 100644 modules/lf.nix (limited to 'modules') diff --git a/modules/common.nix b/modules/common.nix new file mode 100644 index 0000000..747a9cc --- /dev/null +++ b/modules/common.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + programs.home-manager.enable = true; + home.sessionVariables = { + PATH = "$PATH:$HOME/.bin"; + EDITOR = "nvim"; + MANPAGER = "nvim +Man!"; + }; + + imports = [ + ./lf.nix + ./fzf.nix + ./git.nix + ./zsh.nix + ]; +} diff --git a/modules/fzf.nix b/modules/fzf.nix new file mode 100644 index 0000000..98e3ff9 --- /dev/null +++ b/modules/fzf.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + programs.fzf = { + enable = true; + enableZshIntegration = false; + defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ]; + }; +} diff --git a/modules/git.nix b/modules/git.nix new file mode 100644 index 0000000..87f6e73 --- /dev/null +++ b/modules/git.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +{ + programs.git = { + enable = true; + userEmail = "me@ubh.sh"; + userName = "Shubham Saini"; + signing = { + key = "E0404DDE4BCF9DB5"; + signByDefault = true; + }; + extraConfig = { + commit.verbose = true; + init.defaultBranch = "master"; + pull.rebase = "true"; + }; + includes = [ + { + "path" = "~/dev/gitconfig"; + "condition" = "gitdir:~/dev/"; + } + ]; + }; +} diff --git a/modules/lf.nix b/modules/lf.nix new file mode 100644 index 0000000..b0dd304 --- /dev/null +++ b/modules/lf.nix @@ -0,0 +1,41 @@ +{ config, pkgs, ... }: + +{ + programs.lf = { + enable = true; + settings = { + shell = "sh"; + icons = true; + drawbox = true; + scrolloff = 10; + shellopts = "-eu"; + }; + commands = { + extract = '' + %{{ + set -f + case $f in + *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;; + *.tar.gz|*.tgz) tar xzvf $f;; + *.tar.xz|*.txz) tar xJvf $f;; + *.zip) unzip $f;; + *.rar) unrar x $f;; + *.7z) 7z x $f;; + esac + }} + ''; + open = '' + %{{ + case $(file --mime-type -Lb $f) in + text/*) lf -remote "send $id \$$EDITOR \$fx";; + *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;; + esac + }} + ''; + }; + keybindings = { + "" = "shell"; + "." = "set hidden!"; + }; + }; +} diff --git a/modules/zsh.nix b/modules/zsh.nix index bd7a30f..8f05af4 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -1,3 +1,5 @@ +{ config, pkgs, ... }: + { programs.zsh = { enable = true; -- cgit v1.2.3