configuration.nix.j2 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 = ''
  30. xset dpms 0 0 0
  31. xset s off -dpms
  32. '';
  33. users.users.kodi.isNormalUser = true;
  34. # Hardware
  35. sound.enable = true;
  36. hardware.pulseaudio.enable = true;
  37. boot.kernelPackages = pkgs.linuxPackages_latest; # Nix defaults to LTS kernel
  38. # Packages
  39. environment.systemPackages = with pkgs; [
  40. python3
  41. vim
  42. nano
  43. htop
  44. glances
  45. nethogs
  46. tmux
  47. inxi
  48. ];
  49. # SSH
  50. services.openssh.enable = true;
  51. users.users.root.openssh.authorizedKeys.keys = [
  52. {% for pubkey in ssh_root_keys %}
  53. "{{ pubkey }}"
  54. {% endfor %}
  55. ];
  56. # This value determines the NixOS release from which the default
  57. # settings for stateful data, like file locations and database versions
  58. # on your system were taken. It‘s perfectly fine and recommended to leave
  59. # this value at the release version of the first install of this system.
  60. # Before changing this value read the documentation for this option
  61. # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  62. system.stateVersion = "21.11"; # Did you read the comment?
  63. }