configuration.nix.j2 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Edit this configuration file to define what should be installed on
  2. # your system. Help is available in the configuration.nix(5) man page
  3. # and in the NixOS manual (accessible by running ‘nixos-help’).
  4. { config, pkgs, ... }:
  5. {
  6. imports =
  7. [ # Include the results of the hardware scan.
  8. ./hardware-configuration.nix
  9. ];
  10. # Boot
  11. boot.loader.timeout = 1;
  12. boot.loader.systemd-boot.enable = true;
  13. # Set hostname
  14. networking.hostName = "kodi-nix";
  15. # Set time zone.
  16. time.timeZone = "America/Los_Angeles";
  17. # Network settings
  18. networking.interfaces.{{ ansible_default_ipv4.interface }}.useDHCP = true;
  19. networking.enableIPv6 = false;
  20. networking.firewall.allowedTCPPorts = [ 8080 ];
  21. networking.firewall.allowedUDPPorts = [ 8080 ];
  22. # Kodi
  23. services.xserver.enable = true;
  24. services.xserver.desktopManager.kodi.enable = true;
  25. services.xserver.desktopManager.kodi.package = pkgs.kodi.withPackages (p: with p; [ kodi pvr-hts ]);
  26. services.xserver.displayManager.autoLogin.enable = true;
  27. services.xserver.displayManager.autoLogin.user = "kodi";
  28. services.xserver.displayManager.job.preStart = "/run/current-system/sw/bin/systemctl start network-online.target";
  29. services.xserver.displayManager.sessionCommands = "xset s off -dpms";
  30. users.users.kodi.isNormalUser = true;
  31. # Hardware
  32. sound.enable = true;
  33. hardware.pulseaudio.enable = true;
  34. boot.kernelPackages = pkgs.linuxPackages_latest; # Nix defaults to LTS kernel
  35. # Packages
  36. environment.systemPackages = with pkgs; [
  37. python3
  38. vim
  39. nano
  40. htop
  41. glances
  42. nethogs
  43. tmux
  44. inxi
  45. ];
  46. # SSH
  47. services.openssh.enable = true;
  48. users.users.root.openssh.authorizedKeys.keys = [
  49. {% for pubkey in ssh_root_keys %}
  50. "{{ pubkey }}"
  51. {% endfor %}
  52. ];
  53. # This value determines the NixOS release from which the default
  54. # settings for stateful data, like file locations and database versions
  55. # on your system were taken. It‘s perfectly fine and recommended to leave
  56. # this value at the release version of the first install of this system.
  57. # Before changing this value read the documentation for this option
  58. # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  59. system.stateVersion = "21.11"; # Did you read the comment?
  60. }