about summary refs log tree commit diff
path: root/modules/profiles/headless.nix
blob: 5d42df069f1c3dc547f96dcc83da16488eff3847 (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
{
  config,
  lib,
  pkgs,
  this,
  ...
}:
with lib;
let
  cfg = config.nixfiles.modules.profiles.headless;
in
{
  options.nixfiles.modules.profiles.headless.enable = mkEnableOption "headless profile" // {
    default = this.isHeadless;
  };

  config = mkIf cfg.enable {
    nixfiles.modules = {
      openssh.server.enable = true;
      endlessh-go.enable = true;

      fail2ban.enable = true;

      node-exporter.enable = true;
      promtail.enable = false; # FIXME High RAM usage.
    };

    hm.home.file = {
      ".hushlogin".text = "";
      ".bash_history".source = config.hm.lib.file.mkOutOfStoreSymlink "/dev/null";
    };

    boot.kernelPackages = pkgs.linuxPackages_hardened;

    nix = {
      gc = {
        automatic = true;
        dates = "weekly";
        options = "--delete-older-than 30d";
      };

      optimise = {
        automatic = true;
        dates = [ "daily" ];
      };
    };

    environment.systemPackages = with pkgs; [
      alacritty.terminfo
      foot.terminfo
    ];

    services.udisks2.enable = false;
  };
}

Consider giving Nix/NixOS a try! <3