Compare commits

..

No commits in common. "b785fe04aa9353ffb4e6a52c547637cc346a40b1" and "f68a48e38b6d5afa9946c407486019a4107dc00d" have entirely different histories.

6 changed files with 69 additions and 115 deletions

55
flake.lock generated
View File

@ -24,7 +24,7 @@
"local-unstable": { "local-unstable": {
"locked": { "locked": {
"lastModified": 0, "lastModified": 0,
"narHash": "sha256-po3G6QMecwbQjwevncJXrIYFWHqdOnZosO/pH+8RZ+k=", "narHash": "sha256-IpDKZGbaoaWizPo0tst5yJ5ZIDwL6iq/juqXjGpQ7jQ=",
"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": 1710414438, "lastModified": 1708296515,
"narHash": "sha256-UmaVMvCKex3gm7JasposQxTrxD8TlpRk82gtzr//yaU=", "narHash": "sha256-FyF489fYNAUy7b6dkYV6rGPyzp+4tThhr80KNAaF/yY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3e33aea56df04bfb498f7ccbc76b1f4f87390de7", "rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "master", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1710399145, "lastModified": 1708509836,
"narHash": "sha256-yhGlmdqxfstngEs3qikYyqU93iqi39GLOiJ7XDWFdPQ=", "narHash": "sha256-Gk86rEGzpc4ZtlJs2wqCCpAlDcmVgojazG2FqkHrB6Y=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d3eeab67779382692725ac423b023edecbd8547e", "rev": "e837b632e2417b275998501e381be3270afc3ee2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -65,49 +65,12 @@
"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,13 +7,9 @@
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, nvidia-patch }: outputs = { self, nixpkgs, nixos-unstable, local-unstable, home-manager }:
let let
sysLinuxX64 = "x86_64-linux"; sysLinuxX64 = "x86_64-linux";
sysDarwin = "aarch64-darwin"; sysDarwin = "aarch64-darwin";
@ -40,7 +36,6 @@
overlays = [ overlays = [
(final: prev: { inherit unstablePkgs; }) (final: prev: { inherit unstablePkgs; })
(final: prev: { inherit localPkgs; }) (final: prev: { inherit localPkgs; })
(nvidia-patch.overlay)
]; ];
}; };
@ -59,7 +54,7 @@
}); });
pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; }; pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; cudaSupport = true; };
utilsLinuxX64Cuda = wrapUtils { system = sysLinuxX64; pkgs = pkgsLinuxX64Cuda; }; utilsLinuxX64Cuda = wrapUtils { system = sysLinuxX64; pkgs = pkgsLinuxX64Cuda; };
pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; }; pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; };

View File

@ -31,7 +31,7 @@ in
./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,9 +146,7 @@ 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;
@ -163,5 +161,9 @@ in
}; };
smartd.enable = true; smartd.enable = true;
}; };
environment = {
variables = { LIBVA_DRIVER_NAME = "vdpau"; };
};
} }

View File

@ -1,7 +1,11 @@
{ config, ... }: { config, lib, ... }:
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 = {
@ -9,17 +13,23 @@ in
enable = true; enable = true;
group = "media"; group = "media";
}; };
nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8686";
extraConfig = auth_block {
access_role = "lidarr";
};
};
};
}; };
architect.vhost.${domain} = { networking.extraHosts = ''
dnsInterfaces = [ "lan" "tailscale" ]; ${architectInterfaceAddress "lan"} ${domain}
locations."/" = { ${architectInterfaceAddress "tailscale"} ${domain}
port = 8686; '';
allowLan = true;
allowWAN = false;
allow = [ config.architect.networks."tailscale".net ];
};
};
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.giugl.io"; domain = "music.runas.rocks";
library_path = "/media/Music"; library_path = "/media/Music";
beets_config = "/media/beets.conf"; beets_config = "/media/beets.conf";
in in
@ -30,30 +30,29 @@ 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,14 +1,15 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
rev = "c4388cf"; # revision from https://github.com/keylase/nvidia-patch to use # nvidia-patch
hash = "sha256-ua6LpbV3ymR22hAT2AZenoMXDqr3DUJ1wtBi/Psypow="; # sha256sum for https://github.com/keylase/nvidia-patch at the specified revision rev = "b63013c"; # revision from https://github.com/keylase/nvidia-patch to use
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.latest; nvidiaPackage = config.boot.kernelPackages.nvidiaPackages.stable;
user = "sunshine"; user = "sunshine";
resolutionScript = pkgs.writeTextFile { resolutionScript = pkgs.writeTextFile {
@ -34,23 +35,19 @@ 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"
'' ''
capture=nvfbc output_name=1
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}\""}]
''; '';
sunshinePkg = pkgs.unstablePkgs.sunshine.override { cudaSupport = true; }; sunshineOverride = pkgs.unstablePkgs.sunshine.override { cudaSupport = true; };
in in
{ {
security = { security = {
@ -65,29 +62,22 @@ in
} }
}); });
''; '';
rtkit.enable = true;
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
sunshinePkg sunshineOverride
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;
@ -165,7 +155,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 = "${sunshinePkg}/bin/sunshine ${configFile}"; ExecStart = "${sunshineOverride}/bin/sunshine ${configFile}";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "5s"; RestartSec = "5s";
}; };
@ -175,10 +165,6 @@ 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 = {
@ -196,7 +182,6 @@ 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;
}; };
}; };