configurations of hq services
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configuration.nix 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. let
  6. ympdPort = 8080;
  7. mpdVhost = "mpd.hq.c3d2.de";
  8. in {
  9. imports =
  10. [ # Include the results of the hardware scan.
  11. ./hardware-configuration.nix
  12. ../../lib
  13. ../../lib/admins.nix
  14. ../../lib/hq.nix
  15. ../../lib/users.nix
  16. ../../lib/mpd.nix
  17. ../../lib/yggdrasil.nix
  18. ../../lib/hail.nix
  19. ];
  20. c3d2 = {
  21. isInHq = true;
  22. mapHqHosts = true;
  23. hq.interface = "eno1";
  24. };
  25. # Use the systemd-boot EFI boot loader.
  26. boot.loader.systemd-boot.enable = true;
  27. boot.loader.efi.canTouchEfiVariables = true;
  28. boot.kernelPackages = pkgs.linuxPackages_4_19;
  29. networking.hostName = "pulsebert"; # Define your hostname.
  30. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
  31. # Configure network proxy if necessary
  32. # networking.proxy.default = "http://user:password@proxy:port/";
  33. # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
  34. # Select internationalisation properties.
  35. i18n = {
  36. consoleFont = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
  37. consoleKeyMap = "us";
  38. defaultLocale = "en_US.UTF-8";
  39. };
  40. # List packages installed in system profile. To search, run:
  41. # $ nix search wget
  42. environment.systemPackages = with pkgs; [
  43. # specific printer drivers for our printers
  44. epson-escpr
  45. splix
  46. # utilities
  47. nix-index
  48. usbutils
  49. tmux
  50. vim
  51. git
  52. openssl
  53. # NCurses Music Player Client (Plus Plus)
  54. # a commandline front-end client for mpd
  55. # 2019-01-21 mag vater gern gleich einen schoenen lokalen Verwaltung fuer MPD haben.
  56. # ncmpcpp
  57. home-manager
  58. mumble
  59. ncpamixer
  60. ffmpeg
  61. ];
  62. # Some programs need SUID wrappers, can be configured further or are
  63. # started in user sessions.
  64. # programs.mtr.enable = true;
  65. # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
  66. # List services that you want to enable:
  67. # Enable the OpenSSH daemon.
  68. services.openssh.enable = true;
  69. # X11 Forwarding for mumble...
  70. programs.ssh.forwardX11 = true;
  71. services.openssh.forwardX11 = true;
  72. # Open ports in the firewall.
  73. networking.firewall.allowedTCPPorts = [
  74. 4713 # PulseAudio
  75. 631 # cups
  76. 80 443 # Web/ympd
  77. 5000 # shairport
  78. ];
  79. networking.firewall.allowedUDPPorts = [
  80. 631
  81. ];
  82. networking.firewall.extraCommands = ''
  83. iptables -I INPUT -p udp --dport mdns -d 224.0.0.251 -j ACCEPT # zeroconf
  84. iptables -I OUTPUT -p udp --dport mdns -d 224.0.0.251 -j ACCEPT # zeroconf
  85. ''; # networking.firewall.allowedUDPPorts = [ ... ];
  86. # Or disable the firewall altogether.
  87. # networking.firewall.enable = false;
  88. # Enable CUPS to print documents.
  89. services.printing = {
  90. enable = true;
  91. browsing = true;
  92. listenAddresses = [ "*:631" ];
  93. defaultShared = true;
  94. # logLevel = "debug";
  95. drivers = [ pkgs.gutenprint pkgs.hplip pkgs.splix ];
  96. extraConf =
  97. ''
  98. DefaultAuthType Basic
  99. <Location />
  100. Order allow,deny
  101. Allow ALL
  102. </Location>
  103. <Location /admin>
  104. Order allow,deny
  105. Allow ALL
  106. </Location>
  107. <Location /admin/conf>
  108. AuthType Basic
  109. Require user @SYSTEM
  110. Order allow,deny
  111. Allow ALL
  112. </Location>
  113. <Policy default>
  114. <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
  115. Require user @OWNER @SYSTEM
  116. Order deny,allow
  117. </Limit>
  118. <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
  119. AuthType Basic
  120. Require user @SYSTEM
  121. Order deny,allow
  122. </Limit>
  123. <Limit Cancel-Job CUPS-Authenticate-Job>
  124. Require user @OWNER @SYSTEM
  125. Order deny,allow
  126. </Limit>
  127. <Limit All>
  128. Order deny,allow
  129. </Limit>
  130. </Policy>
  131. '';
  132. };
  133. # Enable sound.
  134. sound.enable = true;
  135. hardware.pulseaudio.enable = true;
  136. # PulseAudio as-a-Service
  137. hardware.pulseaudio.systemWide = true;
  138. hardware.pulseaudio.tcp.anonymousClients.allowedIpRanges = [
  139. "127.0.0.0/8" "::1/128"
  140. "172.22.99.0/24" "2a02:8106:208:5201:58::/64"
  141. ];
  142. hardware.pulseaudio.tcp.enable = true;
  143. hardware.pulseaudio.zeroconf.publish.enable = true;
  144. # tell Avahi to publish CUPS and PulseAudio
  145. services.avahi = {
  146. enable = true;
  147. publish.enable = true;
  148. publish.userServices = true;
  149. };
  150. # Enable Audio streaming for Mac clients
  151. services.shairport-sync.enable = true;
  152. # Enable the X11 windowing system.
  153. # services.xserver.enable = true;
  154. # services.xserver.layout = "us";
  155. # services.xserver.xkbOptions = "eurosign:e";
  156. # Enable touchpad support.
  157. # services.xserver.libinput.enable = true;
  158. # Enable the KDE Desktop Environment.
  159. # services.xserver.displayManager.sddm.enable = true;
  160. # services.xserver.desktopManager.plasma5.enable = true;
  161. security.sudo = {
  162. enable = true;
  163. wheelNeedsPassword = false;
  164. };
  165. # This value determines the NixOS release with which your system is to be
  166. # compatible, in order to avoid breaking some software such as database
  167. # servers. You should change this only after NixOS release notes say you
  168. # should.
  169. system.stateVersion = "18.09"; # Did you read the comment?
  170. # vater hoerte, dass menschen im space gern mpd fuer das abspielen von musik erwarten wuerden
  171. #### https://nixos.org/nixos/options.html#services.mpd.enable
  172. # See ../../mpd.nix
  173. services.mpd.extraConfig =
  174. ''
  175. audio_output {
  176. type "pulse"
  177. name "/proc"
  178. }
  179. '';
  180. services.caddy = {
  181. enable = true;
  182. agree = true;
  183. # TODO: add auth?
  184. config = ''
  185. ${mpdVhost} {
  186. proxy / localhost:${toString ympdPort}
  187. }
  188. :80 {
  189. redir https://${mpdVhost}{uri}
  190. }
  191. '';
  192. };
  193. fileSystems."/mnt/storage" = {
  194. #device = "storage-ng.hq.c3d2.de:/mnt/zroot/storage/rpool";
  195. #device = "storage-ng.hq.c3d2.de:/c3d2/rpool";
  196. device = "172.22.99.13:6789,172.22.99.15:6789,172.22.99.16:6789:/c3d2/rpool";
  197. fsType = "ceph";
  198. options = [ "rw" "relatime" "name=public" "secret=AQDgER1chJcMORAAK1ysRTN59B5x/MyniwVXFQ==" "acl" "wsize=16777216" "_netdev" ];
  199. };
  200. # MPD music playing daemon with webinterface
  201. services.ympd = {
  202. enable = true;
  203. webPort = toString ympdPort;
  204. };
  205. nixpkgs.config.packageOverrides = pkgs: with pkgs; {
  206. ympd = ympd.overrideAttrs (oldAttrs: {
  207. src = fetchFromGitHub {
  208. owner = "c3d2";
  209. repo = "ympd";
  210. rev = "feature/somafm_browser";
  211. sha256 = "17x3jfys6gxghz5yp0gvd39ylvzfm59qxg75hwc5a52rj1n2jpb1";
  212. };
  213. });
  214. };
  215. programs.bash.shellAliases = {
  216. mpv = "mpv --no-vid";
  217. };
  218. }