summary refs log tree commit diff
path: root/mixins/cli.nix
blob: ceb485b016792b6e4681937b7af8664938e1300c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: {
  config = {
    home-manager.users.tzlil = {
      imports = [
        inputs.viper-nix-common.homeModules.xdg
        inputs.nix-index-database.hmModules.nix-index
      ];
      home = {
        packages = with pkgs; [
          rsync
          curl
          ripgrep
          bat

          # p2p file transfer
          croc

          nix-output-monitor

          # crap i need in my shell for general usage, mostly data science
          (pkgs.python3.withPackages (ps:
            with ps; [
              requests
              numpy
              networkx
              more-itertools
            ]))

          (
            let
              hs = pkgs.ghc.withPackages (p: with p; [relude pretty-simple pointfree]);
            in
              pkgs.writeShellScriptBin "hs" ''
                exec ${hs}/bin/ghci -ghci-script ${pkgs.writeText "ghci.conf" ''
                    :set -XNoImplicitPrelude
                    :set -XFlexibleContexts
                    :set -XFlexibleInstances
                    :set -XOverloadedStrings
                    :set -XAllowAmbiguousTypes
                    :set prompt "\ESC[38;5;208m\STXλ>\ESC[m\STX "
                    :set -ferror-spans -freverse-errors -fprint-expanded-synonyms
                    :set -interactive-print Text.Pretty.Simple.pPrint
                  :def pf \str -> return $ ":! ${hs}/bin/pointfree \"" ++ str ++ "\""
                    import Relude''}
              ''
          )
        ];
      };
      programs = {
        git = {
          userName = "tzlil";
          userEmail = "tzlils@protonmail.com";
          enable = true;
          extraConfig = {
            push.autoSetupRemote = true;
            init.defaultBranch = "master";
          };
        };
        direnv = {
          enable = true;
          nix-direnv.enable = true;
        };
        fish = {
          enable = true;
          shellAliases = {
            gc = "git clone";
            gs = "git status";
            l = "ls -alh";
            b = "bat";
          };
          functions = {
            fish_greeting = "";
            ns = ''
              set -l p
              for a in $argv
              	set p $p "nixpkgs#$a"
              end
              nix shell $p
            '';
            nr = "nix run nixpkgs#$argv[1] $argv[2..]";
            tmp = "cd (mktemp -d --suffix -$argv[1])";
            py = ''python -c "print(eval(\"\"\"$argv\"\"\"))"'';
            # fish_command_not_found = "nix shell nixpkgs#(command-not-found $argv[1] &| sed -nr 's/.*-p (.*)$/\\1/p' | ${lib.getExe pkgs.fzf} || return 0) -c $argv[1]";
          };
        };
        neovim = {
          enable = true;
          viAlias = true;
          vimAlias = true;
          defaultEditor = true;
          extraConfig = ''
            set clipboard+=unnamedplus
          '';
        };

        # nix-locate
        command-not-found.enable = lib.mkForce false;
        nix-index = {
          enable = true;
          enableFishIntegration = true;
        };

        # gpg = {
        #   enable = true;
        #   mutableKeys = false;
        #   mutableTrust = false;
        #   settings = {
        #     default-key = "E989 C39F 5AE8 2790 F41E  AD50 5FEF 5315 1562 A6CD";
        #     default-recipient-self = true;
        #     auto-key-locate = "local,wkd,keyserver";
        #     keyserver = "hkps://keys.openpgp.org";
        #     auto-key-retrieve = true;
        #     auto-key-import = true;
        #     keyserver-options = "honor-keyserver-url";
        #     no-autostart = true;
        #   };
        # };
      };
      # services.gpg-agent = let
      #   m = 60;
      #   h = 60 * m;
      #   d = 24 * h;
      #   y = 365 * d;
      # in {
      #   enable = true;
      #   enableSshSupport = true;
      #   enableFishIntegration = true;
      #   defaultCacheTtl = 6 * h;
      #   defaultCacheTtlSsh = 6 * h;
      #   maxCacheTtl = 100 * y; # effectively unlimited
      #   maxCacheTtlSsh = 100 * y; # effectively unlimited
      #   sshKeys = ["E989C39F5AE82790F41EAD505FEF53151562A6CD"];
      # };
    };
  };
}