~ruther/nixos-config

ref: 65631fe7158253199eb7d1ad180d17e4d9d57704 nixos-config/nixos/hosts/configuration.nix -rw-r--r-- 4.1 KiB
65631fe7 — Frantisek Bohacek feat: add support for Guix 7 months ago
                                                                                
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
{ lib, stable, pkgs, inputs, config, ... }:

{
  imports = [
    inputs.home-manager.nixosModules.home-manager
    ../modules
    inputs.noshell.nixosModules.default
  ];
  users.users.root.shell = pkgs.bash;
  programs.noshell.enable = true;

  services.xserver.displayManager.startx.enable = true;

  home-manager.useUserPackages = true;
  home-manager.useGlobalPkgs = true;
  home-manager.extraSpecialArgs = {
    inherit inputs stable;
  };
  home-manager.users.${config.nixos-config.defaultUser} = {
    imports = [
      inputs.nix-index-database.hmModules.nix-index
      ./${config.networking.hostName}/home.nix
      ../../home
      {
        inherit (config) nixos-config;
      }
    ];
  };

  boot.tmp = {
    cleanOnBoot = true;
    useTmpfs = true;
  };

  hardware.pulseaudio.enable = false;

  users.users.${config.nixos-config.defaultUser} = {
    isNormalUser = true;
    extraGroups = [
      "wheel" "video" "audio" "camera"
      "networkmanager" "lp" "scanner"
      "plex" ];
  };

  networking.networkmanager.enable = true;
  programs.command-not-found.enable = false;
  security.sudo.wheelNeedsPassword = true;
  programs.dconf.enable = true;
  services.udisks2.enable = true;

  time.timeZone = "Europe/Prague";        # Time zone and internationalisation
  i18n = {
    defaultLocale = "en_US.UTF-8";
  };

  console = {
    font = "Lat2-Terminus16";
    keyMap = "us";
  };

  security.rtkit.enable = true;
  systemd.services.rtkit-daemon = {
    serviceConfig = {
      LogLevelMax = 4;
      ExecStart = [
        ""
        "${pkgs.rtkit}/libexec/rtkit-daemon --processes-per-user-max=1000 --processes-per-user-max=10000 --actions-per-burst-max=1000 --actions-burst-sec=10 --canary-cheep-msec=30000 --canary-watchdog-msec=60000"
      ];
    };
  };

  services.xserver.serverFlagsSection = ''
    Option "BlankTime" "15"
    Option "StandbyTime" "30"
    Option "SuspendTime" "30"
    Option "OffTime" "60"
  '';

  security.polkit.enable = true;

  fonts.packages = with pkgs; [                # Fonts
    hack-font
    inter
    ubuntu_font_family
    fira-code
    roboto
    carlito
    vegur
    source-code-pro
    jetbrains-mono
    noto-fonts
    noto-fonts-color-emoji
    font-awesome
    corefonts
    vistafonts
    (nerdfonts.override {                   # Nerdfont Icons override
      fonts = [
        "FiraCode"
        "Ubuntu"
      ];
    })
  ];

  fonts.fontconfig = {
    defaultFonts = {
      serif = [ "Ubuntu" ];
      sansSerif = [ "Ubuntu" ];
      monospace = [ "Ubuntu Mono" ];
    };
  };

  environment = {
    pathsToLink = [ "/share/zsh" ];
    systemPackages = with pkgs; [           # Default packages installed system-wide
      alsa-utils
      jq
      killall
      nano
      pciutils
      ripgrep
      bat
      socat
      usbutils
      wget
    ];
  };

  services = {
    tumbler.enable = true;
    pipewire = {                            # Sound
      enable = true;
      alsa = {
        enable = true;
        support32Bit = true;
      };
      pulse.enable = true;
      jack.enable = true;
    };
  };

  systemd.network = {
    wait-online.enable = false;
  };

  nix = {                                   # Nix Package Manager settings
    registry = lib.mapAttrs (n: input: {
      flake = input;
    }) inputs;

    nixPath = [
      "nixpkgs=flake:nixpkgs"
      "nixpkgs-stable=flake:nixpkgs-stable"
    ];

    settings = {
      connect-timeout = 5;

      flake-registry = ""; # Do not pollute with external flake registry

      auto-optimise-store = true;           # Optimise syslinks
      substituters = [
        "https://cache.nixos.org"
      ];

      keep-outputs = true;
      keep-derivations = true;
      experimental-features = [ "nix-command" "flakes" ];
    };

    gc = {                                  # Automatic garbage collection
      automatic = true;
      dates = "weekly";
      options = "--delete-older-than 2d";
    };
  };
  nixpkgs.config.allowUnfree = true;

  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

  system = {
    stateVersion = "23.05";
  };

  virtualisation.vmVariant = {
    users.users.ruther.password = "vm";
    users.users.root.password = "vm";
  };
}
Do not follow this link