summaryrefslogtreecommitdiff
path: root/system/default.nix
blob: 824c99f9658fd7b39f184ca28c0f7ceae9c3a9b9 (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
{
  lib,
  config,
  pkgs,
  inputs,
  ...
}: {
  imports = [
    inputs.home-manager.nixosModules.home-manager
    ./desktops
    ./gaming
    ./virt
    ./battery.nix
    ./bluetooth.nix
    ./desktop.nix
    ./fingerprint.nix
    ./hardware.nix
    ./networking.nix
    ./sshd.nix
    ./tpm.nix
  ];

  # allow flakes
  nix.settings.experimental-features = ["nix-command" "flakes"];

  # allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # set state version
  system.stateVersion = config.stateVersion;

  # enable nixos-rebuild-ng
  system.rebuild.enableNg = true;

  # use system packages in home manager
  home-manager.useGlobalPkgs = true;

  # install user packages to /etc/profiles and not home directory
  home-manager.useUserPackages = true;

  # root user home
  home-manager.users.root = {
    home.stateVersion = config.stateVersion;
  };

  # main user home
  home-manager.extraSpecialArgs = {inherit inputs;};
  home-manager.users.${config.user} = {
    imports = [
      ../home
      ../options.nix
      (inputs.self.lib.customConfig config)
    ];
  };

  # hostname
  networking.hostName = config.hostName;

  # common system packages
  environment.systemPackages = with pkgs; [
    # editor
    vim
    # lib
    libz
    openssl
    shared-mime-info
    # shell
    bash
    # utility
    curl
    dig
    file
    fd
    htop
    jq
    killall
    openssh
    p7zip
    ripgrep
    rsync
    sbctl
    sl
    tree
    unzip
    wget
  ];

  # system shell
  programs.zsh.enable = true;

  # use the latest kernel
  boot.kernelPackages = pkgs.linuxPackages_latest;

  # sysrq
  boot.kernel.sysctl."kernel.sysrq" = 246;

  # timezone
  time.timeZone = config.timeZone;

  # dbus
  services.dbus.implementation = "broker";

  # docs
  documentation = {
    info.enable = false;
    dev.enable = false;
    nixos.enable = false;
  };

  # locale
  i18n.defaultLocale = "en_US.UTF-8";

  # create user account
  users.users.${config.user} = {
    isNormalUser = true;
    description = config.fullName;
    extraGroups = ["wheel" "tty"];
    home = config.homePath;
    shell = pkgs.zsh;
  };

  # certs
  security.pki.certificateFiles = inputs.self.lib.certs;
}