aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/generic.nix
blob: 08b3bfa62777aea4dc1d9ae486023fbb2cf50f14 (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
{ config, lib, pkgs, ... }:

with lib;

{

  config = {
    system.stateVersion = "22.05";

    nix = {
      extraOptions = "experimental-features = nix-command flakes";
      settings = {
        auto-optimise-store = true;
      };
      registry = {
        personal.to = {
          type = "git";
          url = "https://git.cynerd.cz/nixos-personal";
        };
      };
    };

    boot.loader.systemd-boot.enable = mkOverride 1100 true;
    boot.loader.efi.canTouchEfiVariables = true;
    boot.kernelPackages = pkgs.linuxPackages_latest;
    boot.kernelParams = ["boot.shell_on_fail"];
    hardware.enableAllFirmware = true;


    nixpkgs.config.allowUnfree = true;
    environment.systemPackages = with pkgs; [
      git # We need git for this repository to even work
      # Administration tools
      coreutils moreutils binutils psmisc progress lshw file
      ldns wget
      gnumake
      exfat exfatprogs
      nix-index
      usbutils

      # NCurses tools
      htop iotop glances
      mc
      screen tmux
      ncdu

      # ls tools
      tree
      mlocate
      lsof
      strace

      sourceHighlight # Colors for less
      unrar p7zip zip unzip

      # Network
      nmap netcat traceroute
      iftop nethogs
      # TODO add mdns
      sshfs

      lm_sensors

    ] ++ optional (system == "x86_64-linux") ltrace;

    users.mutableUsers = false;
    users.groups.cynerd.gid = 1000;
    users.users = {
      root = {
        passwordFile = "/run/secrets/root.pass";
      };
      cynerd = {
        group = "cynerd";
        extraGroups = ["users" "wheel" "dialout" "kvm" "uucp"];
        uid = 1000;
        subUidRanges = [{ count = 65534; startUid = 10000; }];
        subGidRanges = [{ count = 65534; startGid = 10000; }];
        isNormalUser = true;
        createHome = true;
        shell = pkgs.zsh.out;
        passwordFile = "/run/secrets/cynerd.pass";
        openssh.authorizedKeys.keyFiles = [
          (config.personal-secrets + "/unencrypted/git-private.pub")
        ];
      };
    };
    programs.zsh.enable = true;
    programs.shellrc.enable = true;
    programs.vim.defaultEditor = mkDefault true;

    security.sudo.extraRules = [
      { groups = [ "wheel" ]; commands = [ "ALL" ]; }
    ];

    services.openssh.enable = true;

    time.timeZone = "Europe/Prague";
    i18n.defaultLocale = "en_US.UTF-8";
  };

}