diff --git a/flake.nix b/flake.nix index e7ba34b..136195d 100644 --- a/flake.nix +++ b/flake.nix @@ -66,7 +66,8 @@ agenix.nixosModules.age ]; - hosts.nixos-laptop.modules = [ ./hosts/nixos-laptop ]; + hosts.nixos-laptop.modules = + [ ./hosts/nixos-laptop ./modules/containers ]; hosts.nixos-desktop.modules = [ ./hosts/nixos-desktop ./modules/gaming ]; }; } diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index d17925f..dcd0660 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -5,11 +5,10 @@ { config, pkgs, ... }: { - imports = - [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; # BOOT boot = { @@ -36,6 +35,8 @@ interfaces.enp42s0.useDHCP = true; }; + services.xserver.videoDrivers = [ "nvidia" ]; + # Powersaving services.tlp.enable = true; powerManagement.enable = true; diff --git a/hosts/nixos-laptop/hardware-configuration.nix b/hosts/nixos-laptop/hardware-configuration.nix index 2e1a17c..6a6dacb 100644 --- a/hosts/nixos-laptop/hardware-configuration.nix +++ b/hosts/nixos-laptop/hardware-configuration.nix @@ -4,59 +4,52 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = + [ "nvme" "xhci_pci" "ahci" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { - device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; - boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/078b81ba-238e-471d-9951-b743588532b8"; + boot.initrd.luks.devices."enc".device = + "/dev/disk/by-uuid/078b81ba-238e-471d-9951-b743588532b8"; - fileSystems."/home" = - { - device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; + fileSystems."/log" = { + device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; + fsType = "btrfs"; + options = [ "subvol=log" ]; + neededForBoot = true; + }; - fileSystems."/nix" = - { - device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; - fileSystems."/persist" = - { - device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; - fsType = "btrfs"; - options = [ "subvol=persist" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/938D-F813"; + fsType = "vfat"; + }; - fileSystems."/log" = - { - device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; - fsType = "btrfs"; - options = [ "subvol=log" ]; - neededForBoot = true; - }; + fileSystems."/persist" = { + device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; + fsType = "btrfs"; + options = [ "subvol=persist" ]; + }; - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/938D-F813"; - fsType = "vfat"; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; swapDevices = [{ device = "/dev/disk/by-uuid/29ebf65f-e6ca-4625-9f72-a9321152be1b"; }]; diff --git a/modules/containers/default.nix b/modules/containers/default.nix new file mode 100644 index 0000000..b64cb61 --- /dev/null +++ b/modules/containers/default.nix @@ -0,0 +1,6 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./media.nix ]; + virtualisation.docker.enable = true; +} diff --git a/modules/containers/media.nix b/modules/containers/media.nix new file mode 100644 index 0000000..4ee3756 --- /dev/null +++ b/modules/containers/media.nix @@ -0,0 +1,72 @@ +{ config, lib, pkgs, ... }: + +{ + virtualisation.oci-containers.containers = { + "transmission" = { + image = "haugene/transmission-openvpn"; + environmentFiles = [ /run/secrets/nordvpn ]; + environment = { + "LOCAL_NETWORK" = "192.168.0.0/24"; + "OPENVPN_PROVIDER" = "NORDVPN"; + "TRANSMISSION_ALT_SPEED_DOWN" = "20000"; + "TRANSMISSION_ALT_SPEED_TIME_ENABLED" = "true"; + "TRANSMISSION_ALT_SPEED_UP" = "2000"; + "TRANSMISSION_MAX_PEERS_GLOBAL" = "1000"; + "TRANSMISSION_PEER_LIMIT_GLOBAL" = "1000"; + "TRANSMISSION_PEER_LIMIT_PER_TORRENT" = "100"; + "TRANSMISSION_RATIO_LIMIT" = "10"; + "TRANSMISSION_RATIO_LIMIT_ENABLED" = "true"; + "TZ" = "DE"; + "ENABLE_UFW" = "true"; + "PUID" = "1000"; + "PGID" = "100"; + }; + ports = [ "9091:9091" ]; + volumes = [ "/home/moritz/Docker/Transmission:/data/" ]; + extraOptions = [ "--cap-add=NET_ADMIN" ]; + }; + + "jackett" = { + image = "linuxserver/jackett"; + environment = { + "PUID" = "1000"; + "PGID" = "100"; + "TZ" = "DE"; + }; + volumes = [ + "/home/moritz/Docker/jackett/config:/config" + "/home/moritz/Docker/jackett/blackhole:/downloads" + ]; + ports = [ "9117:9117" ]; + }; + + "radarr" = { + image = "linuxserver/radarr"; + environment = { + "PUID" = "1000"; + "PGID" = "100"; + "TZ" = "DE"; + }; + volumes = [ + "/auto/media/movies:/movies" + "/home/moritz/Docker/transmission/completed/movies:/downloads" + "/home/moritz/Docker/radarr" + ]; + ports = [ "7878:7878" ]; + }; + "sonarr" = { + image = "linuxserver/sonarr"; + environment = { + "PUID" = "1000"; + "PGID" = "100"; + "TZ" = "DE"; + }; + volumes = [ + "/auto/media/tv:/tv" + "/home/moritz/Docker/transmission/completed/movies:/downloads" + "/home/moritz/Docker/sonarr" + ]; + ports = [ "8989:8989" ]; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix index a5f80b1..0682f0e 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: { - imports = [ ./apps ./cli ./desktop ./services ./security.nix ]; + imports = [ ./apps ./cli ./desktop ./services ]; # USERS users.users.moritz = { @@ -32,6 +32,11 @@ home.username = "moritz"; home.homeDirectory = "/home/moritz"; + xdg.userDirs = { + enable = true; + createDirectories = true; + }; + home.stateVersion = "21.05"; }; } diff --git a/modules/desktop/bspwm/default.nix b/modules/desktop/bspwm/default.nix index 917f244..0983104 100644 --- a/modules/desktop/bspwm/default.nix +++ b/modules/desktop/bspwm/default.nix @@ -6,8 +6,6 @@ enable = true; layout = "de"; - videoDrivers = [ "nvidia" ]; - displayManager = { defaultSession = "none+bspwm"; @@ -15,15 +13,13 @@ enable = true; user = "moritz"; }; - lightdm = { - enable = true; - }; + lightdm = { enable = true; }; }; windowManager.bspwm.enable = true; }; }; - - console.keyMap = "de"; + + console.keyMap = "de"; home-manager.users.moritz = { xsession.windowManager.bspwm.enable = true; @@ -39,16 +35,9 @@ source = ./sxhkdrc; onChange = "pkill -USR1 -x sxhkd"; }; - "wallpaper/dracula.png" = { - source = ./dracula.png; - }; + "wallpaper/dracula.png" = { source = ./dracula.png; }; }; }; - home.packages = with pkgs; [ - feh - playerctl - pamixer - brightnessctl - ]; + home.packages = with pkgs; [ feh playerctl pamixer brightnessctl ]; }; } diff --git a/modules/services/diskstation/default.nix b/modules/services/diskstation/default.nix index 7b22b86..2be1486 100644 --- a/modules/services/diskstation/default.nix +++ b/modules/services/diskstation/default.nix @@ -4,8 +4,13 @@ services.davfs2 = { enable = true; extraConfig = '' + buf_size 32 + use_compression 1 + table_size 4096 [/auto/diskstation] trust_server_cert diskstation.pem + [/auto/media] + trust_server_cert diskstation.pem [/auto/keepass] trust_server_cert home-boehmies-de.pem ''; @@ -16,6 +21,7 @@ mapConf = pkgs.writeText "auto" '' keepass -fstype=davfs,uid=1000 :https\://davs.home.boehmies.de/home/Drive/ diskstation -fstype=davfs,uid=1000 :https\://192.168.0.2\:5006/home/Drive/ + media -fstype=davfs,uid=1000 :https\://192.168.0.2\:5006/media ''; in '' /auto file:${mapConf} @@ -34,7 +40,18 @@ enable = true; pairs = { keepass.roots = [ "/home/moritz/Keepass" "/auto/keepass" ]; - diskstation.roots = [ "/home/moritz/Documents" "/auto/diskstation" ]; + diskstation = { + roots = [ "/home/moritz/Documents" "/auto/diskstation" ]; + commandOptions = { + auto = "true"; + batch = "true"; + log = "false"; + repeat = "watch"; + sshcmd = "\${pkgs.openssh}/bin/ssh"; + ui = "text"; + fastcheck = "true"; + }; + }; }; }; }; diff --git a/secrets/davfs.age b/secrets/davfs.age index d69952a..7e4b937 100644 Binary files a/secrets/davfs.age and b/secrets/davfs.age differ diff --git a/secrets/nordvpn.age b/secrets/nordvpn.age index c5842c5..1c4d577 100644 Binary files a/secrets/nordvpn.age and b/secrets/nordvpn.age differ