2016-02-01 21:58:19 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
byid = dev: "/dev/disk/by-id/" + dev;
|
|
|
|
part1 = disk: disk + "-part1";
|
|
|
|
rootDisk = byid "ata-SanDisk_SDSSDP064G_140237402890";
|
2017-03-01 15:48:11 +01:00
|
|
|
primary-interface = "enp3s0"; # c8:cb:b8:cf:e4:dc
|
2016-03-06 20:57:08 +01:00
|
|
|
# N54L Chassis:
|
|
|
|
# ____________________
|
|
|
|
# |______FRONT_______|
|
|
|
|
# | [ ]|
|
|
|
|
# | [ d1 ** d3 d4 ]|
|
|
|
|
# |___[_____________]|
|
2016-02-01 21:58:19 +01:00
|
|
|
jDisk1 = byid "ata-ST4000DM000-1F2168_Z3040NEA";
|
2016-03-06 20:57:08 +01:00
|
|
|
|
|
|
|
# transfer to omo
|
|
|
|
# jDisk0 = byid "ata-ST4000DM000-1F2168_Z303HVSG";
|
2016-02-01 21:58:19 +01:00
|
|
|
jDisk2 = byid "ata-WDC_WD40EFRX-68WT0N0_WD-WCC4E0621363";
|
|
|
|
jDisk3 = byid "ata-TOSHIBA_MD04ACA400_156GK89OFSBA";
|
2016-03-06 20:57:08 +01:00
|
|
|
allDisks = [ rootDisk jDisk1 jDisk2 jDisk3 ];
|
2016-02-01 21:58:19 +01:00
|
|
|
in {
|
2015-11-06 11:01:49 +01:00
|
|
|
imports =
|
|
|
|
[ # Include the results of the hardware scan.
|
2017-07-15 19:01:02 +02:00
|
|
|
<stockholm/makefu>
|
|
|
|
<stockholm/makefu/2configs/fs/single-partition-ext4.nix>
|
|
|
|
<stockholm/makefu/2configs/smart-monitor.nix>
|
|
|
|
<stockholm/makefu/2configs/tinc/retiolum.nix>
|
|
|
|
<stockholm/makefu/2configs/filepimp-share.nix>
|
2015-11-06 11:01:49 +01:00
|
|
|
];
|
2016-10-19 12:31:13 +02:00
|
|
|
|
2015-11-06 11:01:49 +01:00
|
|
|
krebs.build.host = config.krebs.hosts.filepimp;
|
|
|
|
# AMD N54L
|
|
|
|
boot = {
|
2016-02-01 21:58:19 +01:00
|
|
|
loader.grub.device = rootDisk;
|
2015-11-06 11:01:49 +01:00
|
|
|
|
|
|
|
initrd.availableKernelModules = [
|
|
|
|
"ahci"
|
2016-01-02 21:22:00 +01:00
|
|
|
"ohci_pci"
|
2015-11-06 11:01:49 +01:00
|
|
|
"ehci_pci"
|
2016-01-02 21:22:00 +01:00
|
|
|
"pata_atiixp"
|
|
|
|
"usb_storage"
|
|
|
|
"usbhid"
|
2015-11-06 11:01:49 +01:00
|
|
|
];
|
|
|
|
|
2016-01-02 21:22:00 +01:00
|
|
|
kernelModules = [ "kvm-amd" ];
|
2015-11-06 11:01:49 +01:00
|
|
|
extraModulePackages = [ ];
|
|
|
|
};
|
2017-07-28 23:50:36 +02:00
|
|
|
hardware.enableRedistributableFirmware = true;
|
2015-11-06 11:01:49 +01:00
|
|
|
hardware.cpu.amd.updateMicrocode = true;
|
|
|
|
|
2016-01-03 06:08:01 +01:00
|
|
|
zramSwap.enable = true;
|
|
|
|
zramSwap.numDevices = 2;
|
2016-02-01 21:58:19 +01:00
|
|
|
|
|
|
|
makefu.snapraid = let
|
|
|
|
toMedia = name: "/media/" + name;
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
# todo combine creation when enabling the mount point
|
2016-03-06 20:57:08 +01:00
|
|
|
disks = map toMedia [
|
|
|
|
# "j0"
|
|
|
|
"j1"
|
|
|
|
"j2"
|
|
|
|
];
|
2016-02-01 21:58:19 +01:00
|
|
|
parity = toMedia "par0";
|
|
|
|
};
|
|
|
|
# TODO: refactor, copy-paste from omo
|
|
|
|
services.smartd.devices = builtins.map (x: { device = x; }) allDisks;
|
|
|
|
powerManagement.powerUpCommands = lib.concatStrings (map (disk: ''
|
|
|
|
${pkgs.hdparm}/sbin/hdparm -S 100 ${disk}
|
|
|
|
${pkgs.hdparm}/sbin/hdparm -B 127 ${disk}
|
|
|
|
${pkgs.hdparm}/sbin/hdparm -y ${disk}
|
|
|
|
'') allDisks);
|
|
|
|
fileSystems = let
|
|
|
|
xfsmount = name: dev:
|
|
|
|
{ "/media/${name}" = { device = dev; fsType = "xfs"; }; };
|
|
|
|
in
|
2017-07-28 23:03:19 +02:00
|
|
|
# (xfsmount "j0" (part1 jDisk0)) //
|
|
|
|
(xfsmount "j1" (part1 jDisk1)) //
|
|
|
|
(xfsmount "j2" (part1 jDisk2)) //
|
2016-03-06 20:57:08 +01:00
|
|
|
(xfsmount "par0" (part1 jDisk3))
|
|
|
|
;
|
2016-10-19 12:31:13 +02:00
|
|
|
|
|
|
|
networking.firewall.trustedInterfaces = [ primary-interface ];
|
|
|
|
|
2016-07-30 18:42:57 +02:00
|
|
|
services.wakeonlan.interfaces = [
|
|
|
|
{
|
|
|
|
interface = primary-interface;
|
|
|
|
method = "password";
|
|
|
|
password = "CA:FE:BA:BE:13:37";
|
|
|
|
}
|
|
|
|
];
|
2015-11-06 11:01:49 +01:00
|
|
|
}
|