about summary refs log tree commit diff
path: root/machines/sternenseemann/base.nix
blob: 765bfbf518084bac123ccd0a5c1f82f333cc1773 (plain) (blame)
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
{ config, lib, pkgs, ... }:

let

  inherit (pkgs.vuizvui.profpatsch)
    getBins
    ;

  bins = getBins pkgs.less [ "less" ];

in {
  imports = [
    ./vim-basic.nix
  ];

  config = {
    boot.cleanTmpDir = true;

    nix = {
      # new --show-trace is so noisy, I wouldn't be able to debug something to save my life
      package = pkgs.nix_2_3;
      settings = {
        sandbox = true;
        gc-keep-derivations = false;
        builders-use-substitutes = true;
      };
    };

    nixpkgs.config.allowUnfree = true;

    services.journald.extraConfig = lib.mkDefault "SystemMaxUse=500M";

    console.keyMap = lib.mkDefault "de-latin1";

    time.timeZone = lib.mkDefault "Europe/Berlin";

    i18n = {
      defaultLocale = "en_US.UTF-8";
    };

    programs.fish = {
      enable = true;
      vendor.completions.enable = true;
      shellAliases = {
        "sd" = "systemctl";
      };
      shellInit = ''
        set -x fish_greeting ""

        # an adisbladis original
        function bonk
          for arg in $argv
            set -l store_path (string unescape (nix-instantiate --eval --expr "with (import <nixpkgs> {}); builtins.toString (lib.getBin $arg)"))
            nix-store --realise "$store_path"
            set PATH "$store_path/bin" $PATH
          end
        end
      '';
    };

    documentation = {
      enable = true;
      dev.enable = true;
      man = {
        enable = true;
        generateCaches = true;
        man-db.enable = false;
        mandoc = {
          enable = true;
          manPath = [ "share/man" "share/man/de" ];
        };
      };
    };

    # HACK: create man0p, man1p, man3p etc. as directories in the environment
    # out path to work around the makewhatis(8) bug that it always assumes
    # symlinks are files. Since man3p etc. comes from a single package,
    # buildEnv just symlinks the entire directory and makewhatis(8) then
    # ignores it.
    environment.extraSetup = lib.mkBefore ''
      for dir in $out/share/man/*; do
        section="$(basename "$dir")"
        sectionDir="$out/share/man/$section"

        if test -L "$sectionDir"; then
          dest="$(realpath "$sectionDir")"

          if test -d "$dest"; then
            echo "Recreating $sectionDir and linking everything from $dest..." 1>&2

            rm "$sectionDir"
            mkdir "$sectionDir"

            for f in "$dest"/*; do
              ln -s "$f" -t "$sectionDir"
            done
          fi
        fi
      done
    '';

    environment.systemPackages = with pkgs; [
      curl wget
      man-pages
      man-pages-posix
      vuizvui.tvl.users.sterni.dot-time-man-pages
      gitFull
      file htop psmisc tmux
    ];

    environment.variables = {
      PAGER = "${bins.less} -R";
      # git-diff without the extra options passed to less
      GIT_PAGER = bins.less;
      LESS = "-R";
    };
  };
}