Compare commits

...

9 Commits

Author SHA1 Message Date
Giulio De Pasquale
b785fe04aa flake update 2024-03-14 11:15:06 +00:00
Giulio De Pasquale
8768e555df navidrome: reenable beets-import and update 2024-03-14 11:07:35 +00:00
Giulio De Pasquale
5d27c4829e navidrome: use music.giugl.io 2024-03-14 11:07:18 +00:00
Giulio De Pasquale
0fb14ce253 lidarr: move to architect options 2024-03-14 11:06:51 +00:00
Giulio De Pasquale
c0ceb7729a architect: enabled navidrome, disabled lidarr 2024-03-14 11:05:57 +00:00
Giulio De Pasquale
5c81aa0ad9 architect: commented out nvidia in main 2024-03-14 11:05:41 +00:00
Giulio De Pasquale
00973bfc59 flake: add nvidia-patch flake 2024-03-13 18:38:32 +00:00
Giulio De Pasquale
04f1d5a42b sunshine: use nvfbc 2024-03-13 18:37:35 +00:00
Giulio De Pasquale
98d2e39d28 architect: remove vdpau as default libva driver 2024-03-13 13:22:39 +00:00
6 changed files with 115 additions and 69 deletions

55
flake.lock generated
View File

@ -24,7 +24,7 @@
"local-unstable": { "local-unstable": {
"locked": { "locked": {
"lastModified": 0, "lastModified": 0,
"narHash": "sha256-IpDKZGbaoaWizPo0tst5yJ5ZIDwL6iq/juqXjGpQ7jQ=", "narHash": "sha256-po3G6QMecwbQjwevncJXrIYFWHqdOnZosO/pH+8RZ+k=",
"path": "/home/giulio/dev/nixpkgs", "path": "/home/giulio/dev/nixpkgs",
"type": "path" "type": "path"
}, },
@ -35,27 +35,27 @@
}, },
"nixos-unstable": { "nixos-unstable": {
"locked": { "locked": {
"lastModified": 1708296515, "lastModified": 1710414438,
"narHash": "sha256-FyF489fYNAUy7b6dkYV6rGPyzp+4tThhr80KNAaF/yY=", "narHash": "sha256-UmaVMvCKex3gm7JasposQxTrxD8TlpRk82gtzr//yaU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa", "rev": "3e33aea56df04bfb498f7ccbc76b1f4f87390de7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "master",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708509836, "lastModified": 1710399145,
"narHash": "sha256-Gk86rEGzpc4ZtlJs2wqCCpAlDcmVgojazG2FqkHrB6Y=", "narHash": "sha256-yhGlmdqxfstngEs3qikYyqU93iqi39GLOiJ7XDWFdPQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e837b632e2417b275998501e381be3270afc3ee2", "rev": "d3eeab67779382692725ac423b023edecbd8547e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -65,12 +65,49 @@
"type": "github" "type": "github"
} }
}, },
"nvidia-patch": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1710353022,
"narHash": "sha256-f4hsLsOqPUlh3iqg6gARj+c4pZzJhaPhoeoH36u0yQM=",
"owner": "peperunas",
"repo": "nvidia-patch-nixos",
"rev": "021ad79e03f4a2266a98f90ac63b08d3e72f0ab0",
"type": "github"
},
"original": {
"owner": "peperunas",
"repo": "nvidia-patch-nixos",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"local-unstable": "local-unstable", "local-unstable": "local-unstable",
"nixos-unstable": "nixos-unstable", "nixos-unstable": "nixos-unstable",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"nvidia-patch": "nvidia-patch"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
} }
} }
}, },

View File

@ -7,9 +7,13 @@
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nvidia-patch = {
url = "github:peperunas/nvidia-patch-nixos";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, nixpkgs, nixos-unstable, local-unstable, home-manager }: outputs = { self, nixpkgs, nixos-unstable, local-unstable, home-manager, nvidia-patch }:
let let
sysLinuxX64 = "x86_64-linux"; sysLinuxX64 = "x86_64-linux";
sysDarwin = "aarch64-darwin"; sysDarwin = "aarch64-darwin";
@ -36,6 +40,7 @@
overlays = [ overlays = [
(final: prev: { inherit unstablePkgs; }) (final: prev: { inherit unstablePkgs; })
(final: prev: { inherit localPkgs; }) (final: prev: { inherit localPkgs; })
(nvidia-patch.overlay)
]; ];
}; };
@ -54,7 +59,7 @@
}); });
pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; cudaSupport = true; }; pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; };
utilsLinuxX64Cuda = wrapUtils { system = sysLinuxX64; pkgs = pkgsLinuxX64Cuda; }; utilsLinuxX64Cuda = wrapUtils { system = sysLinuxX64; pkgs = pkgsLinuxX64Cuda; };
pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; }; pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; };

View File

@ -30,8 +30,8 @@ in
./prowlarr.nix ./prowlarr.nix
./libreddit.nix ./libreddit.nix
# ./invidious.nix # ./invidious.nix
# ./lidarr.nix # ./lidarr.nix
# ./navidrome.nix ./navidrome.nix
./jellyfin.nix ./jellyfin.nix
# ./prosody.nix # ./prosody.nix
# ./deluge.nix # ./deluge.nix
@ -146,7 +146,9 @@ in
fwupd.enable = true; fwupd.enable = true;
das_watchdog.enable = true; das_watchdog.enable = true;
zfs.autoScrub.enable = true; zfs.autoScrub.enable = true;
xserver.videoDrivers = [ "nvidia" ];
# TODO: put NVIDIA related in another module
# xserver.videoDrivers = [ "nvidia" ];
openssh = { openssh = {
enable = true; enable = true;
@ -161,9 +163,5 @@ in
}; };
smartd.enable = true; smartd.enable = true;
}; };
environment = {
variables = { LIBVA_DRIVER_NAME = "vdpau"; };
};
} }

View File

@ -1,11 +1,7 @@
{ config, lib, ... }: { config, ... }:
let let
domain = "htlid.giugl.io"; domain = "htlid.giugl.io";
auth_block = (import ./openid.nix { inherit lib; }).openresty_oidc_block;
utilities = import ./utilities.nix { inherit lib config; };
inherit (utilities) architectInterfaceAddress;
in in
{ {
services = { services = {
@ -13,23 +9,17 @@ in
enable = true; enable = true;
group = "media"; group = "media";
}; };
};
nginx.virtualHosts.${domain} = { architect.vhost.${domain} = {
forceSSL = true; dnsInterfaces = [ "lan" "tailscale" ];
enableACME = true; locations."/" = {
locations."/" = { port = 8686;
proxyPass = "http://127.0.0.1:8686"; allowLan = true;
extraConfig = auth_block { allowWAN = false;
access_role = "lidarr"; allow = [ config.architect.networks."tailscale".net ];
};
};
}; };
}; };
networking.extraHosts = ''
${architectInterfaceAddress "lan"} ${domain}
${architectInterfaceAddress "tailscale"} ${domain}
'';
users.groups.media.members = [ "lidarr" ]; users.groups.media.members = [ "lidarr" ];
} }

View File

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
domain = "music.runas.rocks"; domain = "music.giugl.io";
library_path = "/media/Music"; library_path = "/media/Music";
beets_config = "/media/beets.conf"; beets_config = "/media/beets.conf";
in in
@ -30,29 +30,30 @@ in
}; };
}; };
# systemd.services = { systemd.services = {
# "beets-update" = { "beets-update" = {
# enable = true; enable = true;
# # requires = [ "remove-badmp3.service" "remove-badflac.service" ]; # requires = [ "remove-badmp3.service" "remove-badflac.service" ];
# before = [ "beets-import.service" ]; before = [ "beets-import.service" ];
# serviceConfig = { serviceConfig = {
# Type = "oneshot"; Type = "oneshot";
# ExecStart = "${pkgs.beets}/bin/beet -c ${beets_config} update"; ExecStart = "${pkgs.beets}/bin/beet -c ${beets_config} update";
# }; };
# }; };
# "beets-import" = { "beets-import" = {
# enable = true; enable = true;
# path = [ pkgs.imagemagick ]; path = [ pkgs.imagemagick ];
# requires = [ "beets-update.service" ]; requires = [ "beets-update.service" ];
# after = [ "beets-update.service" ]; after = [ "beets-update.service" ];
# serviceConfig = { serviceConfig = {
# Type = "oneshot"; Type = "oneshot";
# ExecStart = ExecStart =
# "${pkgs.beets}/bin/beet -c ${beets_config} import --flat -q ${library_path}"; "${pkgs.beets}/bin/beet -c ${beets_config} import --flat -q ${library_path}";
# }; };
# startAt = "weekly"; startAt = "weekly";
# }; };
};
# "remove-badmp3" = { # "remove-badmp3" = {
# enable = true; # enable = true;

View File

@ -1,15 +1,14 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
# nvidia-patch rev = "c4388cf"; # revision from https://github.com/keylase/nvidia-patch to use
rev = "b63013c"; # revision from https://github.com/keylase/nvidia-patch to use hash = "sha256-ua6LpbV3ymR22hAT2AZenoMXDqr3DUJ1wtBi/Psypow="; # sha256sum for https://github.com/keylase/nvidia-patch at the specified revision
hash = "sha256-EDPoMTj3J1f/7Sv/q7P/lZ4r2aXOCdsbZ4FumbvuCWk="; # sha256sum for https://github.com/keylase/nvidia-patch at the specified revision
# create patch functions for the specified revision # create patch functions for the specified revision
nvidia-patch = pkgs.nvidia-patch rev hash; nvidia-patch = pkgs.nvidia-patch rev hash;
# nvidia package to patch # nvidia package to patch
nvidiaPackage = config.boot.kernelPackages.nvidiaPackages.stable; nvidiaPackage = config.boot.kernelPackages.nvidiaPackages.latest;
user = "sunshine"; user = "sunshine";
resolutionScript = pkgs.writeTextFile { resolutionScript = pkgs.writeTextFile {
@ -35,19 +34,23 @@ let
xrandr --output DP-0 --primary --mode ''${mode_alias} --pos 0x0 --rotate normal xrandr --output DP-0 --primary --mode ''${mode_alias} --pos 0x0 --rotate normal
/run/current-system/sw/bin/nvidia-settings -a 'SyncToVBlank=0' /run/current-system/sw/bin/nvidia-settings -a 'SyncToVBlank=0'
/run/current-system/sw/bin/nvidia-smi --persistence-mode=ENABLED
''; '';
executable = true; executable = true;
destination = "/bin/resolution.sh"; destination = "/bin/resolution.sh";
}; };
configFile = pkgs.writeText "sunshine.conf" configFile = pkgs.writeText "sunshine.conf"
'' ''
output_name=1 capture=nvfbc
encoder=nvenc
wan_encryption_mode = 0
lan_encryption_mode = 0
origin_web_ui_allowed=lan origin_web_ui_allowed=lan
channels=2 channels=2
min_threads=12 min_threads=12
global_prep_cmd=[{"do":"${pkgs.bash}/bin/bash -c \"${resolutionScript}/bin/resolution.sh ''${SUNSHINE_CLIENT_WIDTH} ''${SUNSHINE_CLIENT_HEIGHT} ''${SUNSHINE_CLIENT_FPS}\""}] global_prep_cmd=[{"do":"${pkgs.bash}/bin/bash -c \"${resolutionScript}/bin/resolution.sh ''${SUNSHINE_CLIENT_WIDTH} ''${SUNSHINE_CLIENT_HEIGHT} ''${SUNSHINE_CLIENT_FPS}\""}]
''; '';
sunshineOverride = pkgs.unstablePkgs.sunshine.override { cudaSupport = true; }; sunshinePkg = pkgs.unstablePkgs.sunshine.override { cudaSupport = true; };
in in
{ {
security = { security = {
@ -62,22 +65,29 @@ in
} }
}); });
''; '';
rtkit.enable = true;
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
sunshineOverride sunshinePkg
xorg.xrandr xorg.xrandr
xorg.xorgserver xorg.xorgserver
xorg.libxcvt xorg.libxcvt
gamemode gamemode
]; ];
environment.variables = {
VDPAU_DRIVER = "nvidia";
LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct";
};
sound.enable = true; sound.enable = true;
services.xserver = { services.xserver = {
enable = true; enable = true;
videoDrivers = [ "nvidia" ]; videoDrivers = [ "nvidia" ];
displayManager = { displayManager = {
sddm = { sddm = {
enable = true; enable = true;
@ -155,7 +165,7 @@ in
after = [ "graphical-session.target" ]; after = [ "graphical-session.target" ];
path = with pkgs; [ resolutionScript xorg.xrandr bash xorg.libxcvt xorg.xorgserver gawk gamemode ]; path = with pkgs; [ resolutionScript xorg.xrandr bash xorg.libxcvt xorg.xorgserver gawk gamemode ];
serviceConfig = { serviceConfig = {
ExecStart = "${sunshineOverride}/bin/sunshine ${configFile}"; ExecStart = "${sunshinePkg}/bin/sunshine ${configFile}";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "5s"; RestartSec = "5s";
}; };
@ -165,6 +175,10 @@ in
services.avahi.publish.userServices = true; services.avahi.publish.userServices = true;
boot.kernelModules = [ "uinput" ]; boot.kernelModules = [ "uinput" ];
services.udev.extraRules = ''
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
'';
programs.steam.enable = true; programs.steam.enable = true;
hardware = { hardware = {
@ -182,6 +196,7 @@ in
open = false; open = false;
nvidiaSettings = true; nvidiaSettings = true;
package = nvidia-patch.patch-nvenc (nvidia-patch.patch-fbc nvidiaPackage); package = nvidia-patch.patch-nvenc (nvidia-patch.patch-fbc nvidiaPackage);
# package = config.boot.kernelPackages.nvidiaPackages.production;
}; };
}; };