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.4KB

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