summary refs log tree commit diff
path: root/modules/common.nix
blob: 2c183ef0990a529f743b4a0bb2dd440ecd823e7b (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
{ me, util, config, lib, pkgs, ... }:

{
  imports = [
    ./foundation

    ./nix.nix
    ./user.nix
    ./locale.nix
    ./nix-ld.nix
    ./vim.nix
  ];

  boot.kernelPackages = pkgs.linuxPackages_latest;
  
  # fish enables this by default,
  # it makes every nixos rebuild very slow.
  documentation.man.generateCaches = false;

  users.motd = ''

/^  /^
\ ' ' 7   < Hi, I'm ${util.titleCase me.name}
/    \

  '';

  networking = {
    hostName = me.name;
  
    firewall = {
      enable = true;
      allowedTCPPorts = [ 80 443 ];
      trustedInterfaces = [ "tailscale0" ];
    };
  };

  services.envfs.enable = true;

  virtualisation = {
    docker = {
      enable = true;
      autoPrune.enable = true;

      daemon.settings = {
        metrics-addr = "${me.tailscale.ip}:9323";
      };
    };
    oci-containers.backend = "docker";
  };

  services = {
    openssh = {
      enable = true;
      openFirewall = false;
      listenAddresses = [{ addr = me.tailscale.ip; port = 22; }];
      settings = {
        PasswordAuthentication = false;
        KbdInteractiveAuthentication = false;
        PermitRootLogin = "no";
      };
    };
    tailscale = {
      enable = true;
      useRoutingFeatures = "both";
      extraUpFlags = [ "--ssh" ];
    };
  
    # sometimes needed for gnupg
    pcscd.enable = true;
  };
 
  programs = {
    fish.enable = true;
    git.enable = true;
    tmux.enable = true;

    gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
      pinentryPackage = pkgs.pinentry-curses;
    };
  };

  environment.systemPackages = (with pkgs; [
    file unzip jq dig htop glances wget
    gnupg pinentry-curses age agenix
    inetutils pciutils lshw inxi iw
    tcpdump
    ffmpeg_7-headless

    ripgrep gnumake gdb gcc clang
    go gopls delve go-task
    meson cmake
    nil direnv nixfmt-rfc-style
    dive compose2nix nix-prefetch-docker

    borgbackup
  ]);
}