diff options
| author | Shubham Saini <ssaini@fispan.com> | 2023-09-30 04:02:23 +0000 |
|---|---|---|
| committer | Shubham Saini <ssaini@fispan.com> | 2023-09-30 04:02:23 +0000 |
| commit | fdf1c788488534825abdbfe8f8c0e8e95a876d57 (patch) | |
| tree | 1186b8b594f8a540bf019006cb3f2544219c8cd4 /modules | |
| parent | fdb9ba23a2cff4b50a699eb89435aa9a9de77891 (diff) | |
nix: reorg programs into modules
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/common.nix | 17 | ||||
| -rw-r--r-- | modules/fzf.nix | 9 | ||||
| -rw-r--r-- | modules/git.nix | 24 | ||||
| -rw-r--r-- | modules/lf.nix | 41 | ||||
| -rw-r--r-- | modules/zsh.nix | 2 |
5 files changed, 93 insertions, 0 deletions
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 @@ | |||
| 1 | { config, pkgs, ... }: | ||
| 2 | |||
| 3 | { | ||
| 4 | programs.home-manager.enable = true; | ||
| 5 | home.sessionVariables = { | ||
| 6 | PATH = "$PATH:$HOME/.bin"; | ||
| 7 | EDITOR = "nvim"; | ||
| 8 | MANPAGER = "nvim +Man!"; | ||
| 9 | }; | ||
| 10 | |||
| 11 | imports = [ | ||
| 12 | ./lf.nix | ||
| 13 | ./fzf.nix | ||
| 14 | ./git.nix | ||
| 15 | ./zsh.nix | ||
| 16 | ]; | ||
| 17 | } | ||
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 @@ | |||
| 1 | { config, pkgs, ... }: | ||
| 2 | |||
| 3 | { | ||
| 4 | programs.fzf = { | ||
| 5 | enable = true; | ||
| 6 | enableZshIntegration = false; | ||
| 7 | defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ]; | ||
| 8 | }; | ||
| 9 | } | ||
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 @@ | |||
| 1 | { config, pkgs, ... }: | ||
| 2 | |||
| 3 | { | ||
| 4 | programs.git = { | ||
| 5 | enable = true; | ||
| 6 | userEmail = "me@ubh.sh"; | ||
| 7 | userName = "Shubham Saini"; | ||
| 8 | signing = { | ||
| 9 | key = "E0404DDE4BCF9DB5"; | ||
| 10 | signByDefault = true; | ||
| 11 | }; | ||
| 12 | extraConfig = { | ||
| 13 | commit.verbose = true; | ||
| 14 | init.defaultBranch = "master"; | ||
| 15 | pull.rebase = "true"; | ||
| 16 | }; | ||
| 17 | includes = [ | ||
| 18 | { | ||
| 19 | "path" = "~/dev/gitconfig"; | ||
| 20 | "condition" = "gitdir:~/dev/"; | ||
| 21 | } | ||
| 22 | ]; | ||
| 23 | }; | ||
| 24 | } | ||
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 @@ | |||
| 1 | { config, pkgs, ... }: | ||
| 2 | |||
| 3 | { | ||
| 4 | programs.lf = { | ||
| 5 | enable = true; | ||
| 6 | settings = { | ||
| 7 | shell = "sh"; | ||
| 8 | icons = true; | ||
| 9 | drawbox = true; | ||
| 10 | scrolloff = 10; | ||
| 11 | shellopts = "-eu"; | ||
| 12 | }; | ||
| 13 | commands = { | ||
| 14 | extract = '' | ||
| 15 | %{{ | ||
| 16 | set -f | ||
| 17 | case $f in | ||
| 18 | *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;; | ||
| 19 | *.tar.gz|*.tgz) tar xzvf $f;; | ||
| 20 | *.tar.xz|*.txz) tar xJvf $f;; | ||
| 21 | *.zip) unzip $f;; | ||
| 22 | *.rar) unrar x $f;; | ||
| 23 | *.7z) 7z x $f;; | ||
| 24 | esac | ||
| 25 | }} | ||
| 26 | ''; | ||
| 27 | open = '' | ||
| 28 | %{{ | ||
| 29 | case $(file --mime-type -Lb $f) in | ||
| 30 | text/*) lf -remote "send $id \$$EDITOR \$fx";; | ||
| 31 | *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;; | ||
| 32 | esac | ||
| 33 | }} | ||
| 34 | ''; | ||
| 35 | }; | ||
| 36 | keybindings = { | ||
| 37 | "<enter>" = "shell"; | ||
| 38 | "." = "set hidden!"; | ||
| 39 | }; | ||
| 40 | }; | ||
| 41 | } | ||
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 @@ | |||
| 1 | { config, pkgs, ... }: | ||
| 2 | |||
| 1 | { | 3 | { |
| 2 | programs.zsh = { | 4 | programs.zsh = { |
| 3 | enable = true; | 5 | enable = true; |
