updated homeserver
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
let secrets = import ../configs/secrets.nix;
|
||||||
imports =
|
in {
|
||||||
[
|
imports = [
|
||||||
<nixos-hardware/common/cpu/intel>
|
<nixos-hardware/common/cpu/intel>
|
||||||
/etc/nixos/hardware-configuration.nix
|
/etc/nixos/hardware-configuration.nix
|
||||||
../configs/common.nix
|
../configs/common.nix
|
||||||
@ -14,14 +14,36 @@
|
|||||||
# Use the systemd-boot EFI boot loader.
|
# Use the systemd-boot EFI boot loader.
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
networking.hostName = "homeserver"; # Define your hostname.
|
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Europe/Berlin";
|
time.timeZone = "Europe/Berlin";
|
||||||
|
networking = {
|
||||||
|
hostName = "homeserver"; # Define your hostname.
|
||||||
|
useDHCP = false;
|
||||||
|
firewall.enable = false;
|
||||||
|
nat = {
|
||||||
|
enable = true;
|
||||||
|
internalInterfaces = [ "br0" ];
|
||||||
|
externalInterface = "enp3s0";
|
||||||
|
};
|
||||||
|
|
||||||
networking.useDHCP = false;
|
wireless = {
|
||||||
networking.interfaces.enp3s0.useDHCP = true;
|
enable = true;
|
||||||
|
networks.Skynet_5G.psk = secrets.wifipassword;
|
||||||
|
interfaces = [ "wlp1s0" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# libvirt uses 192.168.122.0
|
||||||
|
bridges.br0.interfaces = [ ];
|
||||||
|
interfaces.br0 = {
|
||||||
|
ipv4.addresses = [{
|
||||||
|
address = "192.168.122.1";
|
||||||
|
prefixLength = 24;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
interfaces.enp3s0.useDHCP = true;
|
||||||
|
interfaces.wlp1s0.useDHCP = true;
|
||||||
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
snapraid
|
snapraid
|
||||||
@ -32,35 +54,32 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
mounts = [
|
mounts = [{
|
||||||
{
|
requires = [ "mnt-disk1.mount" "mnt-disk2.mount" "mnt-disk3.mount" ];
|
||||||
requires = [
|
after = [ "mnt-disk1.mount" "mnt-disk2.mount" "mnt-disk3.mount" ];
|
||||||
"mnt-disk1.mount"
|
|
||||||
"mnt-disk2.mount"
|
|
||||||
"mnt-disk3.mount"
|
|
||||||
];
|
|
||||||
after = [
|
|
||||||
"mnt-disk1.mount"
|
|
||||||
"mnt-disk2.mount"
|
|
||||||
"mnt-disk3.mount"
|
|
||||||
];
|
|
||||||
what = "/mnt/disk1:/mnt/disk2:/mnt/disk3";
|
what = "/mnt/disk1:/mnt/disk2:/mnt/disk3";
|
||||||
where = "/mnt/storage";
|
where = "/mnt/storage";
|
||||||
type = "fuse.mergerfs";
|
type = "fuse.mergerfs";
|
||||||
options = "defaults,allow_other,use_ino,fsname=mergerfs,minfreespace=50G,func.getattr=newest,noforget";
|
options =
|
||||||
|
"defaults,allow_other,use_ino,fsname=mergerfs,minfreespace=50G,func.getattr=newest,noforget";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
|
|
||||||
services.snapraid-sync = {
|
services.snapraid-sync = {
|
||||||
#enable = true;
|
|
||||||
description = "Snapraid Sync and Diff";
|
description = "Snapraid Sync and Diff";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "alex";
|
User = "alex";
|
||||||
# ExecStart="/home/alex/snapraid-sync";
|
|
||||||
};
|
};
|
||||||
path = [ pkgs.bash pkgs.snapraid pkgs.curl pkgs.smartmontools pkgs.hdparm ];
|
path = [
|
||||||
|
pkgs.bash
|
||||||
|
pkgs.snapraid
|
||||||
|
pkgs.curl
|
||||||
|
pkgs.smartmontools
|
||||||
|
pkgs.hdparm
|
||||||
|
pkgs.exfatprogs
|
||||||
|
pkgs.exfat
|
||||||
|
];
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
/home/alex/snapraid-sync
|
/home/alex/snapraid-sync
|
||||||
@ -68,16 +87,17 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
timers.snapraid-sync = {
|
timers.snapraid-sync = {
|
||||||
#enable = true;
|
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
timerConfig = {
|
timerConfig = { OnCalendar = "Mon-Sun, 23:00"; };
|
||||||
OnCalendar = "Mon-Sun, 23:00";
|
|
||||||
# Unit = "snapraid-sync.service";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
powerManagement.powerUpCommands = ''
|
powerManagement = {
|
||||||
|
enable = true;
|
||||||
|
powertop.enable = true;
|
||||||
|
cpuFreqGovernor = "powersave";
|
||||||
|
|
||||||
|
powerUpCommands = ''
|
||||||
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/0301db98-264f-4b18-9423-15691063f73d
|
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/0301db98-264f-4b18-9423-15691063f73d
|
||||||
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/3c4b5d00-43c0-48be-81b8-c2b3977e015b
|
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/3c4b5d00-43c0-48be-81b8-c2b3977e015b
|
||||||
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/3e1731d7-f17e-4f6d-9197-84e0492bf4ee
|
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/3e1731d7-f17e-4f6d-9197-84e0492bf4ee
|
||||||
@ -87,6 +107,7 @@
|
|||||||
${pkgs.hdparm}/sbin/hdparm -y /dev/disk/by-uuid/3e1731d7-f17e-4f6d-9197-84e0492bf4ee
|
${pkgs.hdparm}/sbin/hdparm -y /dev/disk/by-uuid/3e1731d7-f17e-4f6d-9197-84e0492bf4ee
|
||||||
${pkgs.hdparm}/sbin/hdparm -y /dev/disk/by-uuid/6cce037c-d2d4-4940-bb69-6d2b84fd41aa
|
${pkgs.hdparm}/sbin/hdparm -y /dev/disk/by-uuid/6cce037c-d2d4-4940-bb69-6d2b84fd41aa
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
nixpkgs.config.packageOverrides = pkgs: {
|
nixpkgs.config.packageOverrides = pkgs: {
|
||||||
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
||||||
@ -103,7 +124,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
netdata.enable = true;
|
netdata.enable = false;
|
||||||
|
|
||||||
jellyfin = {
|
jellyfin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -133,20 +154,12 @@
|
|||||||
"create mask" = "0644";
|
"create mask" = "0644";
|
||||||
"directory mask" = "0755";
|
"directory mask" = "0755";
|
||||||
};
|
};
|
||||||
|
|
||||||
ssdstorage = {
|
|
||||||
path = "/mnt/ssdstorage";
|
|
||||||
browseable = "yes";
|
|
||||||
"read only" = "no";
|
|
||||||
"guest ok" = "no";
|
|
||||||
"create mask" = "0644";
|
|
||||||
"directory mask" = "0755";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
security.sudo.extraRules = [{
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
users = [ "alex" ];
|
users = [ "alex" ];
|
||||||
commands = [{
|
commands = [{
|
||||||
command = "${pkgs.hdparm}/bin/hdparm";
|
command = "${pkgs.hdparm}/bin/hdparm";
|
||||||
@ -159,9 +172,8 @@
|
|||||||
command = "${pkgs.snapraid}/bin/snapraid";
|
command = "${pkgs.snapraid}/bin/snapraid";
|
||||||
options = [ "SETENV" "NOPASSWD" ];
|
options = [ "SETENV" "NOPASSWD" ];
|
||||||
}];
|
}];
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
|
|
||||||
networking.firewall.enable = false;
|
system.stateVersion = "23.05";
|
||||||
|
|
||||||
system.stateVersion = "21.05";
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user