{ config, pkgs, ... }: { imports = [ ./bragi-hw.nix ./customized/autofs.nix ./custom/zsh.nix ]; boot.loader.grub.enable = true; boot.loader.grub.version = 2; boot.loader.grub.device = "/dev/sda"; boot.loader.grub.extraConfig = "serial; terminal_output.serial"; boot.kernelParams = [ "console=ttyS0,115200" ]; networking.hostName = "bragi"; networking.hostId = "2af11085"; networking.wireless.enable = true; nixpkgs.config.packageOverrides = pkgs: { trivmix = let trivmix = pkgs.haskellPackages.callPackage ./custom/trivmix.nix {}; in pkgs.stdenv.mkDerivation { name = "trivmix-wrapper"; nativeBuildInputs = [ pkgs.makeWrapper ]; buildCommand = '' mkdir -p $out/bin makeWrapper ${trivmix}/bin/trivmix $out/bin/trivmix \ --run "umask 0" \ --set JACK_PROMISCUOUS_SERVER 1 ''; }; jack2 = pkgs.callPackage ./customized/jack2.nix {}; mpd = pkgs.callPackage ./customized/mpd.nix { gmeSupport = false; game-music-emu = null; }; mpv = pkgs.stdenv.lib.overrideDerivation pkgs.mpv (oldAttrs: { buildInputs = oldAttrs.buildInputs ++ [pkgs.makeWrapper]; postInstall = '' wrapProgram $out/bin/mpv \ --set JACK_PROMISCUOUS_SERVER 1 \ --run "umask 0" ''; }); }; environment.systemPackages = with pkgs; [ git mosh rsync tmux nfs-utils jack2 trivmix ]; # List services that you want to enable: services.openssh = { enable = true; }; services.fcron = { enable = true; systab = '' %weekly * * nix-collect-garbage --delete-older-than '7d' ''; }; services.autofs = { enable = true; autoMaster = let mapConf = pkgs.writeText "auto" '' odin -fstype=nfs,ro odin.asgard.yggdrasil:/srv/media ''; in '' /media file:${mapConf} ''; }; systemd.services.jack = { wantedBy = [ "sound.target" ]; serviceConfig = { Type = "simple"; ExecStart = "${pkgs.jack2}/bin/jackd -d alsa -M -H -r 96000"; User = "jack"; Group = "audio"; }; }; systemd.services."mpdmix0" = (pkgs.callPackage ./custom/trivmix-service.nix { name = "mpdmix0"; connectOut = "system:playback_3"; group = "mpd"; }).out; systemd.services."mpdmix1" = (pkgs.callPackage ./custom/trivmix-service.nix { name = "mpdmix1"; connectOut = "system:playback_4"; group = "mpd"; }).out; systemd.services."passmix0" = (pkgs.callPackage ./custom/trivmix-service.nix { name = "passmix0"; connectOut = "system:playback_3"; connectIn = "system:capture_5"; group = "vali_out"; }).out; systemd.services."passmix1" = (pkgs.callPackage ./custom/trivmix-service.nix { name = "passmix1"; connectOut = "system:playback_4"; connectIn = "system:capture_6"; group = "vali_out"; }).out; systemd.services."passmix2" = (pkgs.callPackage ./custom/trivmix-service.nix { name = "passmix2"; connectOut = "system:playback_5"; connectIn = "system:capture_1"; group = "vali_in"; }).out; systemd.services."passmix3" = (pkgs.callPackage ./custom/trivmix-service.nix { name = "passmix3"; connectOut = "system:playback_6"; connectIn = "system:capture_1"; group = "vali_in"; }).out; services.mpd = { enable = true; musicDirectory = "/media/odin/music"; extraConfig = '' audio_output { name "JACK" type "jack" client_name "mpd" destination_ports "mpdmix0:in,mpdmix1:in" } ''; }; users.extraUsers.jack = { name = "jack"; isSystemUser = true; group = "audio"; }; users.extraUsers.gkleen = { name = "gkleen"; isNormalUser = true; uid = 1000; createHome = true; home = "/home/gkleen"; shell = "${pkgs.zsh}/bin/zsh"; openssh.authorizedKeys.keys = [ "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBABVMu+0txXdxdTSY8POAYVXbuOEDW6VxJzaYwQljc9kzM63VUZuE606R0g2ZGr9A+Gk6qO6fpCiq4SM+1Yygz5yHgGlbO750TOGaTe6KSGw+u3miaeDviejmxTqetGmiJe7BTLRAbYHjRgD5SkK/Ovos0cDSyOfZ5aha/ehox+proQKGA== gkleen@cathy" ]; extraGroups = [ "wheel" "audio" ]; hashedPassword = "$6$MBq4kwM68$Eg8O6m76mM2905VppNZO67J3EHqJVBuIWQkz.MFFa7afVQKhGuSSYHl50WkkFYXHEY5MIM7IjWYZ0UJwq2IDJ0"; }; security.setuidPrograms = ["mount.nfs"]; security.pam.loginLimits = [ { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; } { domain = "@audio"; item = "nofile"; type = "soft"; value = "99999"; } { domain = "@audio"; item = "nofile"; type = "hard"; value = "99999"; } ]; programs.bash.promptInit = '' PROMPT_COLOR="1;31m" return $UID && PROMPT_COLOR="1;32m" case "$TERM" in xterm*|rxvt*|kterm|aterm|gnome*) # Others can go here. PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] " if test "$TERM" = "xterm"; then PS1="\[\033]2;\h:\u:\w\007\]$PS1" fi ;; *) PS1="[\u@\h:\w]$ " ;; esac ''; networking.interfaces = { "enp1s0" = { useDHCP = false; ipAddress = "10.141.4.1"; prefixLength = 24; }; }; networking.nat = { enable = true; externalIP = "10.141.1.5"; externalInterface = "wlp4s0"; internalIPs = [ "10.141.4.0/24" ]; internalInterfaces = [ "enp1s0" ]; }; networking.firewall = { enable = true; allowPing = true; allowTCPPorts = [ 22 ]; allowUDPPortRanges = [ { from = 60000; to = 61000; } # mosh ]; }; services.dhcpd = { enable = true; interfaces = "enp1s0"; extraConfig = '' option subnet-mask 255.255.255.0; option broadcast-address 10.141.1.1; option domain-name-servers 10.141.1.1, 8.8.8.8, 8.8.4.4; option domain-name "bragisheimr.yggdrasil"; option routers 10.141.4.1; subnet 10.141.4.0 netmask 255.255.255.0 { range 10.141.4.100 10.141.4.254; } ''; }; }