summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubham Saini <ssaini@fispan.com>2023-09-30 04:02:23 +0000
committerShubham Saini <ssaini@fispan.com>2023-09-30 04:02:23 +0000
commitfdf1c788488534825abdbfe8f8c0e8e95a876d57 (patch)
tree1186b8b594f8a540bf019006cb3f2544219c8cd4
parentfdb9ba23a2cff4b50a699eb89435aa9a9de77891 (diff)
nix: reorg programs into modules
-rw-r--r--darwin/home.nix61
-rw-r--r--home.nix38
-rw-r--r--modules/common.nix17
-rw-r--r--modules/fzf.nix9
-rw-r--r--modules/git.nix24
-rw-r--r--modules/lf.nix41
-rw-r--r--modules/zsh.nix2
7 files changed, 97 insertions, 95 deletions
diff --git a/darwin/home.nix b/darwin/home.nix
index 5e24a76..1188c65 100644
--- a/darwin/home.nix
+++ b/darwin/home.nix
@@ -45,65 +45,6 @@
45 }; 45 };
46 46
47 imports = [ 47 imports = [
48 ../modules/zsh.nix 48 ../modules/common.nix
49 ]; 49 ];
50
51 home.sessionVariables = {
52 PATH = "$PATH:$HOME/.bin";
53 EDITOR = "nvim";
54 MANPAGER = "nvim +Man!";
55 };
56
57 programs.home-manager.enable = true;
58 programs.fzf = {
59 enable = true;
60 enableZshIntegration = false;
61 defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ];
62 };
63 programs.git = {
64 enable = true;
65 userEmail = "ssaini@fispan.com";
66 userName = "Shubham Saini";
67 signing = {
68 key = "E0404DDE4BCF9DB5";
69 signByDefault = true;
70 };
71 };
72 programs.lf = {
73 enable = true;
74 settings = {
75 shell = "sh";
76 icons = true;
77 drawbox = true;
78 scrolloff = 10;
79 shellopts = "-eu";
80 };
81 commands = {
82 extract = ''
83 %{{
84 set -f
85 case $f in
86 *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
87 *.tar.gz|*.tgz) tar xzvf $f;;
88 *.tar.xz|*.txz) tar xJvf $f;;
89 *.zip) unzip $f;;
90 *.rar) unrar x $f;;
91 *.7z) 7z x $f;;
92 esac
93 }}
94 '';
95 open = ''
96 %{{
97 case $(file --mime-type -Lb $f) in
98 text/*) lf -remote "send $id \$$EDITOR \$fx";;
99 *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
100 esac
101 }}
102 '';
103 };
104 keybindings = {
105 "<enter>" = "shell";
106 "." = "set hidden!";
107 };
108 };
109} 50}
diff --git a/home.nix b/home.nix
index 7de67a9..0ec8399 100644
--- a/home.nix
+++ b/home.nix
@@ -24,41 +24,9 @@
24 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) 24 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
25 ]; 25 ];
26 26
27 programs.home-manager.enable = true; 27 imports = [
28 programs.zsh = { 28 ./modules/common.nix
29 enable = true; 29 ];
30 enableCompletion = true;
31 shellAliases = {
32 ll = "ls -l";
33 v = "nvim";
34 o = "xdg-open";
35 t = "tmux";
36 update = "sudo nixos-rebuild switch --flake ~/nix";
37 };
38 history = {
39 size = 10000;
40 path = "${config.xdg.dataHome}/zsh/history";
41 };
42 oh-my-zsh = {
43 enable = true;
44 plugins = [ "git" "kubectl" "sudo" ];
45 theme = "robbyrussell";
46 };
47 };
48 programs.fzf = {
49 enable = true;
50 enableZshIntegration = true;
51 defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ];
52 };
53 programs.git = {
54 enable = true;
55 userEmail = "me@ubh.sh";
56 userName = "Shubham Saini";
57 signing = {
58 key = "E0404DDE4BCF9DB5";
59 signByDefault = true;
60 };
61 };
62 30
63 services.gpg-agent = { 31 services.gpg-agent = {
64 enable = true; 32 enable = true;
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;