refactorings for homeserver

This commit is contained in:
Alexander Szczepanski
2021-08-01 19:12:05 +02:00
parent 7348a34b86
commit 6a93bf7fb6
2 changed files with 83 additions and 86 deletions

View File

@ -16,6 +16,7 @@
home-manager.useGlobalPkgs = true;
home-manager.users.alex = { pkgs, ... }: {
home.enableNixpkgsReleaseCheck = false;
home.packages = [
pkgs.cryfs
];
@ -52,12 +53,6 @@
matchBlocks."homeserver" = {
hostname = "192.168.1.100";
# remoteForwards = [ {
# bind.address = "127.0.0.1";
# bind.port = 52698;
# host.address = "127.0.0.1";
# host.port = 52698;
# } ];
};
};

View File

@ -21,8 +21,6 @@
networking.useDHCP = false;
networking.interfaces.enp3s0.useDHCP = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
snapraid
mergerfs
@ -33,25 +31,51 @@
docker-compose
];
systemd.mounts = [
{
requires = [
"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";
where = "/mnt/storage";
type = "fuse.mergerfs";
options = "defaults,allow_other,use_ino,fsname=mergerfs,minfreespace=50G,func.getattr=newest,noforget";
wantedBy = [ "multi-user.target" ];
}
];
systemd = {
mounts = [
{
requires = [
"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";
where = "/mnt/storage";
type = "fuse.mergerfs";
options = "defaults,allow_other,use_ino,fsname=mergerfs,minfreespace=50G,func.getattr=newest,noforget";
wantedBy = [ "multi-user.target" ];
}
];
services.snapraid-sync = {
#enable = true;
description = "Snapraid Sync and Diff";
serviceConfig = {
Type = "oneshot";
User = "alex";
# ExecStart="/home/alex/snapraid-sync";
};
path = [pkgs.bash pkgs.snapraid pkgs.curl pkgs.smartmontools pkgs.hdparm];
script = ''
/home/alex/snapraid-sync
'';
};
timers.snapraid-sync = {
#enable = true;
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "Mon-Sun, 23:00";
# Unit = "snapraid-sync.service";
};
};
};
powerManagement.powerUpCommands = ''
${pkgs.hdparm}/sbin/hdparm -S 241 /dev/disk/by-uuid/0301db98-264f-4b18-9423-15691063f73d
@ -64,30 +88,6 @@
${pkgs.hdparm}/sbin/hdparm -y /dev/disk/by-uuid/6cce037c-d2d4-4940-bb69-6d2b84fd41aa
'';
systemd.services.snapraid-sync = {
#enable = true;
description = "Snapraid Sync and Diff";
serviceConfig = {
Type = "oneshot";
User = "alex";
# ExecStart="/home/alex/snapraid-sync";
};
path = [pkgs.bash pkgs.snapraid pkgs.curl pkgs.smartmontools pkgs.hdparm];
script = ''
/home/alex/snapraid-sync
'';
};
systemd.timers.snapraid-sync = {
#enable = true;
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "Mon-Sun, 23:00";
# Unit = "snapraid-sync.service";
};
};
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
@ -110,44 +110,46 @@
# };
services.netdata.enable = true;
services = {
netdata.enable = true;
services.jellyfin = {
enable = true;
user = "alex";
group = "users";
};
jellyfin = {
enable = true;
user = "alex";
group = "users";
};
services.samba = {
enable = true;
securityType = "user";
extraConfig = ''
workgroup = WORKGROUP
server string = server
netbios name = server
security = user
guest account = nobody
map to guest = bad user
logging = systemd
max log size = 50
'';
shares = {
storage = {
path = "/mnt/storage";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
};
samba = {
enable = true;
securityType = "user";
extraConfig = ''
workgroup = WORKGROUP
server string = server
netbios name = server
security = user
guest account = nobody
map to guest = bad user
logging = systemd
max log size = 50
'';
shares = {
storage = {
path = "/mnt/storage";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
};
ssdstorage = {
path = "/mnt/ssdstorage";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
ssdstorage = {
path = "/mnt/ssdstorage";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
};
};
};
};