nixos-config/aplysia.nix

98 lines
2.1 KiB
Nix

{ config, pkgs, ... }:
{
imports =
[
./common-headless.nix
];
boot.supportedFilesystems = ["zfs"];
boot.loader.grub = {
enable = true;
version = 2;
zfsSupport = true;
mirroredBoots = [
{ devices = [ "/dev/sda" ]; path = "/boota"; }
{ devices = [ "/dev/sdb" ]; path = "/bootb"; }
{ devices = [ "/dev/sdc" ]; path = "/bootc"; }
{ devices = [ "/dev/sdd" ]; path = "/bootd"; }
{ devices = [ "/dev/sde" ]; path = "/boote"; }
{ devices = [ "/dev/sdf" ]; path = "/bootf"; }
];
};
networking = {
hostName = "aplysia";
hostId = "34a820f1";
};
users.extraUsers.gebner.extraGroups = ["transmission"];
boot.kernelPackages = pkgs.lib.mkOverride 10 pkgs.linuxPackages;
system.stateVersion = "17.03";
fileSystems."/mnt/aplysia" = pkgs.lib.mkOverride 10 {
device = "aplysia/export";
fsType = "zfs";
};
fileSystems."/boota".options = [ "nofail" ];
fileSystems."/bootb".options = [ "nofail" ];
fileSystems."/bootc".options = [ "nofail" ];
fileSystems."/bootd".options = [ "nofail" ];
fileSystems."/boote".options = [ "nofail" ];
fileSystems."/bootf".options = [ "nofail" ];
services.samba = {
enable = true;
extraConfig = ''
passdb backend = tdbsam
unix password sync = no
'';
shares = {
export = {
"guest ok" = "no";
"read only" = "no";
path = "/mnt/aplysia";
};
};
};
services.transmission = {
enable = true;
settings = {
download-dir = "/mnt/aplysia/torrents";
incomplete-dir = "/mnt/aplysia/torrents";
speed-limit-down = 5000;
speed-limit-down-enabled = true;
speed-limit-up = 800;
speed-limit-up-enabled = true;
peer-port = 51415;
};
};
networking.firewall = {
allowedTCPPorts = [
445 139 # samba
config.services.transmission.settings.peer-port
];
allowedUDPPorts = [
137 138 # samba
];
};
environment.systemPackages = with pkgs; [
transmission
samba
];
# hdd spindown
powerManagement.powerUpCommands = ''
${pkgs.hdparm}/bin/hdparm -B127 -S100 /dev/sd{a,b,c,d,e,f}
'';
}