diff --git a/systems/PC-Fixe/configuration.nix b/systems/PC-Fixe/configuration.nix index 656a575..bbe8de0 100644 --- a/systems/PC-Fixe/configuration.nix +++ b/systems/PC-Fixe/configuration.nix @@ -17,25 +17,42 @@ efiSupport = true; device = "nodev"; zfsSupport = true; - gfxmodeEfi = "1920x1080,auto"; memtest86.enable = true; fontSize = 32; }; - boot.kernelParams = ["acpi_enforce_resources=lax"]; - boot.tmpOnTmpfs = true; + boot.kernelParams = [ + "acpi_enforce_resources=lax" + "zfs.zfs_arc_max=2147483648" + ]; + boot.tmpOnTmpfs = false; boot.supportedFilesystems = [ "zfs" ]; virtualisation.virtualbox.host.enable = true; # virtualisation.virtualbox.host.enableExtensionPack = true; - virtualisation.anbox.enable = true; + # virtualisation.anbox.enable = true; + virtualisation.podman.enable = true; services.zfs = { - trim.enable = true; + trim = { + enable = true; + interval = "monthly"; + }; + autoScrub = { + enable = true; + interval = "monthly"; + }; autoSnapshot = { enable = true; monthly = 6; }; - autoScrub.enable = true; + autoReplication = { + enable = true; + host = "nyanlout.re"; + username = "zfspaulfixe"; + identityFilePath = "/var/lib/zfs-replication/id_rsa"; + localFilesystem = "fastaf/home"; + remoteFilesystem = "loutrepool/zfs-replicate/paul-fixe"; + }; }; hardware.bluetooth.enable = true; @@ -43,6 +60,21 @@ # Logitech G920 hardware.usbWwan.enable = true; + # hardware.pulseaudio.extraConfig = '' + # load-module module-null-sink sink_name=mic_denoised_out rate=48000 + # load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono plugin=${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so control=50 + # load-module module-loopback source=alsa_input.pci-0000_09_00.4.analog-stereo sink=mic_raw_in channels=1 source_dont_move=true sink_dont_move=true + + # load-module module-echo-cancel source_name=hd_mic source_master=mic_denoised_out.monitor sink_master=alsa_output.pci-0000_09_00.4.analog-stereo + + # set-default-source hd_mic + # ''; + + # hardware.pulseaudio.configFile = pkgs.runCommand "default.pa" {} '' + # sed '/module-switch-on-port-available$/d' \ + # ${pkgs.pulseaudio}/etc/pulse/default.pa > $out + # ''; + services.udev.packages = with pkgs; [ usb-modeswitch-data # Logitech G920 ]; @@ -56,6 +88,10 @@ networking.hostName = "paul-fixe"; networking.hostId = "3a1f739e"; + networking.hosts = { + "10.30.0.1" = ["emby.nyanlout.re" "nyanlout.re"]; + }; + environment.systemPackages = with pkgs; [ usb_modeswitch ]; @@ -80,26 +116,165 @@ ]; }; - services.syncthing.enable = true; - services.syncthing.user = "paul"; - services.syncthing.group = "users"; - services.netdata.enable = true; services.openssh.enable = true; services.openssh.passwordAuthentication = false; services.openssh.forwardX11 = true; - systemd.services = { - "wol" = { - description = "Wake-on-LAN"; - wantedBy = [ "multi-user.target" ]; - requires = [ "network.target" ]; - after = [ "network.target" ]; - script = '' - ${pkgs.ethtool}/sbin/ethtool -s eno1 wol g - ''; - serviceConfig.Type = "oneshot"; + # security.pki.certificates = [ + # '' + # -----BEGIN CERTIFICATE----- + # MIIDoTCCAomgAwIBAgIGDorvJrq1MA0GCSqGSIb3DQEBCwUAMCgxEjAQBgNVBAMM + # CW1pdG1wcm94eTESMBAGA1UECgwJbWl0bXByb3h5MB4XDTIwMDgzMDE5MjA1NloX + # DTIzMDkwMTE5MjA1NlowKDESMBAGA1UEAwwJbWl0bXByb3h5MRIwEAYDVQQKDAlt + # aXRtcHJveHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsUHB2if9A + # L5ytR9VrZncwDdx3J6ZdA2+wZQe9EjtX5ax1r55bbQBoJmN2HqZCSA3vdvMzr42W + # Jx0ksNhNocEGvER2dTUIqkUKeeYQIRCc5CD9T5IpUVVKm3aeJo+FATmuzg4m23MZ + # a9Up4nCdUJwufSqzv0ZWvEHERWtRXPYRZ2t+vKqnCS+dOQ3NsGWvC+12i7kNMKyy + # 0ylFBY/BZfaH/kMVzUijAnNQPWpW3T/Wqpx7z+IXZ+ccCQ1U1N26FXhSMa/+DenW + # fo27QVNOu5cIIpAYmTl6+Oek0XLSH8oFLdjeVtBJuHFA1iAfmqPv4yJDKbSgg/d8 + # Jb46BE2ZyW6RAgMBAAGjgdAwgc0wDwYDVR0TAQH/BAUwAwEB/zARBglghkgBhvhC + # AQEEBAMCAgQweAYDVR0lBHEwbwYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcD + # BAYIKwYBBQUHAwgGCisGAQQBgjcCARUGCisGAQQBgjcCARYGCisGAQQBgjcKAwEG + # CisGAQQBgjcKAwMGCisGAQQBgjcKAwQGCWCGSAGG+EIEATAOBgNVHQ8BAf8EBAMC + # AQYwHQYDVR0OBBYEFEiFqrQtFmTV66rlQ9SCqp7ohrtsMA0GCSqGSIb3DQEBCwUA + # A4IBAQBfH5xpxt4mCdnjiISaMeEcKuur2kfVbQEKNceDeKLZJfcwEkMtAr0LeyMV + # 1hkExtvyU0JPmgyzU7Le4UHEB8pwyyD3kYx7vBtxjVSXAbK1YKgDllPmXtlJGmA/ + # SMuxnwkUXwMeZBxmu8LR1SOQiMX+aZvYbQIjigduXOC/ZSHYtJbh+RmrvHFEBu7L + # zZx8DzJKOmlfo9gohNIW1ucRM6B4B5yy5plqurGlkFPHlRqGoWkJPI4oB+cobzMh + # QidzHgk4Set3bqIuYAsqtHGxdTtnGooagQBUWt0CxmGdmonofzinsAAasKprcBl6 + # QaNGz7o/LfHprXvCM1mHjbVVbZN2 + # -----END CERTIFICATE----- + # '' + # ]; + + # services.wakeonlan.interfaces = [ { interface = "eno1"; method = "magicpacket"; } ]; + + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + package = pkgs.nginx.override { + modules = with pkgs.nginxModules; [ rtmp ]; + }; + virtualHosts."stream.nyanlout.re" = { + locations."/" = { + root = "/var/www/hls/"; + extraConfig = '' + add_header Cache-Control no-cache; + add_header Access-Control-Allow-Origin *; + ''; + }; + default = true; + }; + appendConfig = let + rootLocation = config.services.nginx.virtualHosts."stream.nyanlout.re".locations."/".root; + in '' + rtmp { + server { + listen 1935; + + application live { + live on; + interleave on; + exec_push ${pkgs.ffmpeg}/bin/ffmpeg -i rtmp://localhost/$app/$name -async 1 -vsync -1 + -c:v libx264 -c:a aac -b:v 256k -b:a 96k -vf "scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://localhost/show/$name_low + -c:v libx264 -c:a aac -b:v 768k -b:a 96k -vf "scale=720:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://localhost/show/$name_mid + -c:v libx264 -c:a aac -b:v 1024k -b:a 128k -vf "scale=960:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://localhost/show/$name_high + -c:v libx264 -c:a aac -b:v 1920k -b:a 128k -vf "scale=1280:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://localhost/show/$name_hd720 + -c copy -f flv rtmp://localhost/show/$name_src 2>>${rootLocation}/ffmpeg-$name.log; + } + + application show { + live on; + hls on; + + hls_path ${rootLocation}; + hls_fragment 5; + hls_playlist_length 10; + hls_nested on; + + hls_variant _low BANDWIDTH=352000; # Low bitrate, sub-SD resolution + hls_variant _mid BANDWIDTH=448000; # Medium bitrate, SD resolution + hls_variant _high BANDWIDTH=1152000; # High bitrate, higher-than-SD resolution + hls_variant _hd720 BANDWIDTH=2048000; # High bitrate, HD 720p resolution + hls_variant _src BANDWIDTH=8192000; # Source bitrate, source resolution + } + } + } + ''; + }; + + services.xserver.deviceSection = '' + Option "metamodes" "DP-0: 3440x1440_144 +0+0 {AllowGSYNCCompatible=On}" + ''; + + systemd = let + DP0Config = "--mode 3440x1440 --rate 144"; + DP2Config = "--auto --left-of DP-0"; + HDMIConfig = "--auto --left-of DP-0"; + in { + services = { + wol = { + description = "Wake-on-LAN"; + wantedBy = [ "multi-user.target" ]; + requires = [ "network.target" ]; + after = [ "network.target" ]; + script = '' + ${pkgs.ethtool}/sbin/ethtool -s eno1 wol g + ''; + serviceConfig.Type = "oneshot"; + }; + nginx.serviceConfig.ReadWritePaths = "/var/www/hls"; + zfs-replication.serviceConfig.StateDirectory = "zfs-replication"; + }; + user.services = { + "enableTV" = { + description = "Enable TV output"; + script = '' + ${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --mode 3440x1440 --rate 144 --primary + /run/current-system/sw/bin/nvidia-settings --assign CurrentMetaMode="DP-0: 3440x1440_144 { AllowGSYNCCompatible=On }" + ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 ${HDMIConfig} + ''; + conflicts = ["CSMode.service"]; + serviceConfig.Type = "oneshot"; + }; + "primaryTV" = { + description = "Set TV output as primary"; + script = '' + ${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --mode 3440x1440 --rate 144 + /run/current-system/sw/bin/nvidia-settings --assign CurrentMetaMode="DP-0: 3440x1440_144 { AllowGSYNCCompatible=On }" + ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 --primary ${HDMIConfig} + ''; + conflicts = ["CSMode.service"]; + serviceConfig.Type = "oneshot"; + }; + "FreeSyncMode" = { + description = "Enable FreeSync screen only"; + script = '' + ${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --mode 3440x1440 --rate 144 + /run/current-system/sw/bin/nvidia-settings --assign CurrentMetaMode="DP-0: 3440x1440_144 { AllowGSYNCCompatible=On }" + ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 --off + ''; + conflicts = ["CSMode.service"]; + serviceConfig.Type = "oneshot"; + }; + "CSMode" = { + description = "Enable 4:3 black bars"; + script = '' + ${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --mode 3440x1440 --rate 144 --primary + /run/current-system/sw/bin/nvidia-settings --assign CurrentMetaMode="DP-0: 3440x1440_144 { ViewPortIn=3440x1440, ViewPortOut=1920x1440+760+0, AllowGSYNCCompatible=On }" + ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 --off + ''; + preStop = '' + /run/current-system/sw/bin/nvidia-settings --assign CurrentMetaMode="DP-0: 3440x1440_144 { ViewPortIn=3440x1440, ViewPortOut=3440x1440+0+0, AllowGSYNCCompatible=On }" + ''; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + }; }; }; diff --git a/systems/PC-Fixe/hardware-configuration.nix b/systems/PC-Fixe/hardware-configuration.nix index 82d2592..1c08f14 100644 --- a/systems/PC-Fixe/hardware-configuration.nix +++ b/systems/PC-Fixe/hardware-configuration.nix @@ -21,46 +21,31 @@ fsType = "zfs"; }; - fileSystems."/home" = - { device = "rpool/home"; - fsType = "zfs"; - }; - fileSystems."/boot" = { device = "/dev/disk/by-uuid/F4EC-57DF"; fsType = "vfat"; }; + fileSystems."/home" = + { device = "fastaf/home"; + fsType = "zfs"; + }; + + fileSystems."/mnt/steam" = + { device = "fastaf/steam"; + fsType = "zfs"; + }; + + fileSystems."/mnt/games" = + { device = "fastaf/games"; + fsType = "zfs"; + }; + fileSystems."/mnt/hdd" = { device = "/dev/mapper/ManjaroVG-ManjaroRoot"; fsType = "ext4"; }; - fileSystems."/home/paul/Documents" = - { device = "/mnt/hdd/paul/Documents"; - options = [ "bind" ]; - }; - - fileSystems."/home/paul/Téléchargements" = - { device = "/mnt/hdd/paul/Téléchargements"; - options = [ "bind" ]; - }; - - fileSystems."/home/paul/Musique" = - { device = "/mnt/hdd/paul/Musique"; - options = [ "bind" ]; - }; - - fileSystems."/home/paul/Images" = - { device = "/mnt/hdd/paul/Images"; - options = [ "bind" ]; - }; - - fileSystems."/home/paul/Vidéos" = - { device = "/mnt/hdd/paul/Vidéos"; - options = [ "bind" ]; - }; - fileSystems."/mnt/medias" = { device = "10.30.0.1:/mnt/medias"; fsType = "nfs"; @@ -70,5 +55,5 @@ swapDevices = [ ]; nix.maxJobs = lib.mkDefault 12; - powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; } diff --git a/systems/common-cli.nix b/systems/common-cli.nix index adf9ad8..5482971 100644 --- a/systems/common-cli.nix +++ b/systems/common-cli.nix @@ -11,9 +11,11 @@ vimAlias = true; configure = { customRC = '' - set shiftwidth=2 - set softtabstop=2 + set tabstop=8 + set shiftwidth=4 + set softtabstop=0 set expandtab + set smarttab set background=dark ''; packages.myVimPackage = with pkgs.vimPlugins; { @@ -27,7 +29,7 @@ }) # Gestionnaires de version - gitFull + gitMinimal tig gitAndTools.hub quilt @@ -60,13 +62,14 @@ starship # Audio - beets + # beets # Outils borgbackup binutils bat molly-guard + nix-template # Développement openssl diff --git a/systems/common-gui.nix b/systems/common-gui.nix index a9c5b3a..dbff6b6 100644 --- a/systems/common-gui.nix +++ b/systems/common-gui.nix @@ -17,6 +17,7 @@ minecraft multimc lutris + teamspeak_client betaflight-configurator @@ -50,6 +51,7 @@ gwenview kcalc spectacle + kinfocenter kile (texlive.combine { inherit (texlive) scheme-small titling collection-langfrench cm-super; @@ -57,7 +59,7 @@ gnome-breeze - libreoffice + libreoffice-fresh gimp inkscape @@ -65,12 +67,15 @@ obs-studio vlc mpv - jftui - calibre + # jftui + # calibre + jellyfin-mpv-shim + kdenlive glxinfo i7z appimage-run + pavucontrol ]; i18n = { @@ -81,11 +86,20 @@ programs.steam.enable = true; - hardware = { - pulseaudio.enable = true; - }; + # hardware = { + # pulseaudio.enable = true; + # }; - sound.enable = true; + # sound.enable = true; + + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; networking.networkmanager.enable = true; @@ -106,6 +120,7 @@ xserver = { enable = true; layout = "fr"; + exportConfiguration = true; displayManager.sddm.enable = true; desktopManager.plasma5.enable = true; }; @@ -124,6 +139,16 @@ }; environment.etc = { + "mpv/mpv.conf" = { + text = '' + profile=gpu-hq + scale=ewa_lanczossharp + cscale=ewa_lanczossharp + video-sync=display-resample + interpolation + tscale=oversample + ''; + }; # CK3 fix "ssl/certs/f387163d.0".source = "${pkgs.cacert.unbundled}/etc/ssl/certs/Starfield_Class_2_CA.crt"; };