summary refs log tree commit diff
path: root/mixins/cli.nix
blob: 5ef2cfe922204fa225fed8ecdb498fe97f7dd857 (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
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: {
  config = {
    home-manager.users.tzlil = {
      pkgs,
      config,
      nixosConfig,
      ...
    }: {
      imports = [
        inputs.viper-nix-common.homeModules.xdg
      ];
      home = {
        packages = with pkgs; [
          rsync
          curl
          ripgrep
          bat
          croc

          # 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''}
              ''
          )
        ];
        sessionVariables = {
          EDITOR = "nvim";
        };
      };
      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";
            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
	    '';
          };
        };
        neovim = {
          enable = true;
          viAlias = true;
          vimAlias = 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"];
      # };
    };
  };
}