summaryrefslogtreecommitdiff
path: root/configuration.nix
blob: 6c293fe180d24140302ce75fc9715c93d17b1844 (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
{ config, pkgs, ... }:

{
  system.stateVersion = "18.03";

  imports = [
    ./hardware-configuration.nix
    ./conf/fish.nix
  ];

  boot = {
    kernelParams = [ "vga=0x31B" ];

    loader.grub = {
      enable = true;
      version = 2;
      device = "/dev/sdb";
    };

    initrd.luks.devices = [ {
      name   = "root";
      device = "/dev/disk/by-uuid/6205da24-b1b2-402c-b175-4036e678dea9";
      preLVM        = true;
      allowDiscards = true;
    } ];
  };

  fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];

  networking = {
    hostName = "obelix";
    firewall.enable = false;
  };

  sound.enable = true;
  hardware = {
    opengl.driSupport32Bit = true;
    pulseaudio = {
      enable       = true;
      support32Bit = true;
    };
  };

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

  time.timeZone = "Europe/Berlin";

  nixpkgs.config.allowUnfree = true;

  programs = {
    bash.enableCompletion = true;
    gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
    };
  };

  services = {
    openssh = {
      enable = true;
    };

    journald = {
      extraConfig = ''Storage=volatile'';
    };

    openvpn.servers = {
      KIT = {
        config = import ./conf/vpn/kit.ovpn.nix;
        autoStart = false;
      };
    };

    xserver = {
      enable = true;
      layout = "de";
      xkbOptions = "caps:escape";

      videoDrivers = [ "nvidiaBeta" ];

      displayManager.slim = {
        enable = true;
        autoLogin = true;
        defaultUser = "common";
      };

      desktopManager.default = "none";
    };
  };

  systemd.services.spin-down-storage = {
    enable = true;
    description = "Spin down storage drive by default";
    serviceConfig = {
      Type      = "oneshot";
      ExecStart = "${pkgs.hdparm}/bin/hdparm -q -S 120 -y /dev/disk/by-label/storage";
    };
    wantedBy = [ "multi-user.target" ];
  };

  users.extraUsers.common = {
    isNormalUser = true;
    uid          = 1000;
    extraGroups  = [ "wheel" ];
    shell        = pkgs.fish;
  };

  environment = {
    systemPackages = let
      custom_vim  = import ./pkgs/vim/vim.nix pkgs;
    in with pkgs; [
      hdparm ntfs3g psmisc htop fish git silver-searcher custom_vim
    ];

    shellAliases = {
      "ls" = "ls --color=auto --group-directories-first";
    };

    shellInit = ''
      export LC_NUMERIC=de_DE.UTF8
      export LC_TIME=de_DE.UTF8
      export LC_MONETARY=de_DE.UTF8
      export LC_MEASUREMENT=de_DE.UTF8
    '';
  };
}