configurations of hq services
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

configuration.nix 7.5KB

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