This commit is contained in:
joy 2024-11-24 20:15:38 +01:00
parent ea854d5559
commit 7575254865
27 changed files with 300 additions and 190 deletions

View file

@ -2,9 +2,15 @@
networking.hostName = "desktop"; networking.hostName = "desktop";
openrgb.enable = true; openrgb.enable = true;
games.enable = true; emulator.enable = true;
lact.enable = true; steam.enable = true;
norisk.enable = true;
amd-gpu.enable = true;
gnome.enable = true; gnome.enable = true;
bluetooth.enable = true;
systemd-boot.enable = true;
qemu.enable = true;
sync-client.enable = true;
imports = [ imports = [
./hardware.nix ./hardware.nix

View file

@ -1,8 +1,13 @@
{username, ...}: { {username, ...}: {
networking.hostName = "laptop"; networking.hostName = "laptop";
virtualisation.virtualbox.host.enable = true;
led.enable = true; led.enable = true;
gnome.enable = true; gnome.enable = true;
virtual-box.enalbe = true;
bluetooth.enable = true;
systemd-boot.enable = true;
qemu.enable = true;
sync-client.enable = true;
home-manager.users.${username} = { home-manager.users.${username} = {
hypridle.enable = true; hypridle.enable = true;
}; };

View file

@ -1,8 +1,14 @@
{ {
networking.hostName = "server"; networking.hostName = "server";
services.logind.lidSwitch = "ignore"; services.logind.lidSwitch = "ignore";
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
sync-server.enable = true;
nginx.enable = true;
forgejo.enable = true;
immich.enable = true;
docker.enable = true;
imports = [ imports = [
./hardware.nix ./hardware.nix
@ -10,9 +16,5 @@
../../modules/system ../../modules/system
../../modules/secrets ../../modules/secrets
../../modules/services ../../modules/services
../../modules/services/nginx
../../modules/services/forgejo
../../modules/services/syncthing
../../modules/services/immich
]; ];
} }

View file

@ -19,7 +19,10 @@
}; };
}; };
in { in {
config = lib.mkIf config.games.enable { options = {
emulator.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.emulator.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
cemu cemu
customPkgs.suyu customPkgs.suyu

View file

@ -21,7 +21,10 @@
iconurl = "https://raw.githubusercontent.com/NoRiskClient/noriskclient-launcher/refs/heads/main/src/images/norisk_logo.png"; iconurl = "https://raw.githubusercontent.com/NoRiskClient/noriskclient-launcher/refs/heads/main/src/images/norisk_logo.png";
iconsha256 = "sha256-VwWwShUrT055mcabS8QTqqb8INgRB/08U2qEEIVYHlg="; iconsha256 = "sha256-VwWwShUrT055mcabS8QTqqb8INgRB/08U2qEEIVYHlg=";
in { in {
config = lib.mkIf config.games.enable { options = {
norisk.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.norisk.enable {
environment.systemPackages = [ environment.systemPackages = [
customPkgs.no-risk-client customPkgs.no-risk-client
]; ];

View file

@ -5,9 +5,9 @@
... ...
}: { }: {
options = { options = {
games.enable = lib.mkEnableOption ""; steam.enable = lib.mkEnableOption "";
}; };
config = lib.mkIf config.games.enable { config = lib.mkIf config.steam.enable {
programs.steam.enable = true; programs.steam.enable = true;
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [

View file

@ -5,10 +5,10 @@
... ...
}: { }: {
options = { options = {
lact.enable = lib.mkEnableOption ""; amd-gpu.enable = lib.mkEnableOption "";
}; };
config = lib.mkIf config.lact.enable { config = lib.mkIf config.amd-gpu.enable {
environment.systemPackages = with pkgs; [lact]; environment.systemPackages = with pkgs; [lact];
systemd.packages = with pkgs; [lact]; systemd.packages = with pkgs; [lact];
systemd.services.lactd.wantedBy = ["multi-user.target"]; systemd.services.lactd.wantedBy = ["multi-user.target"];

View file

@ -1,4 +1,13 @@
{ {
lib,
config,
...
}: {
options = {
bluetooth.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.bluetooth.enable {
services.blueman.enable = true; services.blueman.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
};
} }

View file

@ -1,3 +0,0 @@
{
boot.loader.systemd-boot.enable = true;
}

View file

@ -3,9 +3,9 @@
./powerkey ./powerkey
./bluetooth ./bluetooth
./openrgb ./openrgb
./sound ./pipewire
./lact ./amd-gpu
./boot ./systemd-boot
./led ./led
]; ];
} }

View file

@ -0,0 +1,12 @@
{
lib,
config,
...
}: {
options = {
systemd-boot.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.systemd-boot.enable {
boot.loader.systemd-boot.enable = true;
};
}

View file

@ -1,8 +1,12 @@
{ {
imports = [ imports = [
./vm ./virt
./syncthing
./docker ./docker
./ssh ./ssh
./misc ./misc
./nginx
./forgejo
./immich
]; ];
} }

View file

@ -1,5 +1,16 @@
{username, ...}: { {
lib,
config,
username,
...
}: {
options = {
docker.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.docker.enable {
virtualisation.docker.rootless.enable = true; virtualisation.docker.rootless.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
users.users.${username}.extraGroups = ["docker"]; users.users.${username}.extraGroups = ["docker"];
};
} }

View file

@ -1,11 +1,16 @@
{ {
config,
domain, domain,
lib,
config,
... ...
}: let }: let
cfg = config.services.forgejo; cfg = config.services.forgejo;
srv = cfg.settings.server; srv = cfg.settings.server;
in { in {
options = {
forgejo.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.forgejo.enable {
services.nginx = { services.nginx = {
virtualHosts.${cfg.settings.server.DOMAIN} = { virtualHosts.${cfg.settings.server.DOMAIN} = {
forceSSL = true; forceSSL = true;
@ -29,4 +34,5 @@ in {
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
}; };
}; };
};
} }

View file

@ -1,4 +1,13 @@
{domain, ...}: { {
domain,
lib,
config,
...
}: {
options = {
immich.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.immich.enable {
services.nginx = { services.nginx = {
virtualHosts."immich.${domain}" = { virtualHosts."immich.${domain}" = {
forceSSL = true; forceSSL = true;
@ -14,4 +23,5 @@
environment.IMMICH_MACHINE_LEARNING_URL = "http://localhost:3003"; environment.IMMICH_MACHINE_LEARNING_URL = "http://localhost:3003";
}; };
users.users.immich.extraGroups = ["video" "render"]; users.users.immich.extraGroups = ["video" "render"];
};
} }

View file

@ -1,13 +0,0 @@
{domain, ...}: {
services.invidious = {
enable = true;
settings = {
db = {
user = "invidious";
dbname = "invidious";
};
};
};
services.invidious.domain = "yt.${domain}";
services.invidious.nginx.enable = true;
}

View file

@ -1,8 +1,14 @@
{ {
domain, domain,
mail, mail,
lib,
config,
... ...
}: { }: {
options = {
nginx.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.nginx.enable {
services.nginx = { services.nginx = {
virtualHosts."xn--xck.xyz" = { virtualHosts."xn--xck.xyz" = {
forceSSL = true; forceSSL = true;
@ -47,4 +53,5 @@
}; };
security.acme.defaults.email = "${mail}"; security.acme.defaults.email = "${mail}";
security.acme.acceptTerms = true; security.acme.acceptTerms = true;
};
} }

View file

@ -0,0 +1,20 @@
{
username,
lib,
config,
...
}: {
options = {
sync-client.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.sync-client.enable {
services.syncthing = {
enable = true;
dataDir = "/home/${username}";
openDefaultPorts = true;
configDir = "/home/${username}/.config/syncthing";
user = username;
group = "users";
};
};
}

View file

@ -1,31 +1,6 @@
{ {
username, imports = [
domain, ./server
... ./client
}: { ];
services.syncthing = {
enable = true;
dataDir = "/home/${username}";
openDefaultPorts = true;
configDir = "/home/${username}/.config/syncthing";
user = username;
group = "users";
guiAddress = "0.0.0.0:8384";
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."sync.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8384";
proxyWebsockets = true;
extraConfig =
"proxy_ssl_server_name on;"
+ "proxy_pass_header Authorization;";
};
};
};
} }

View file

@ -0,0 +1,38 @@
{
username,
domain,
lib,
config,
...
}: {
options = {
sync-server.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.sync-server.enable {
services.syncthing = {
enable = true;
dataDir = "/home/${username}";
openDefaultPorts = true;
configDir = "/home/${username}/.config/syncthing";
user = username;
group = "users";
guiAddress = "0.0.0.0:8384";
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."sync.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8384";
proxyWebsockets = true;
extraConfig =
"proxy_ssl_server_name on;"
+ "proxy_pass_header Authorization;";
};
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./qemu
./virtual-box
];
}

View file

@ -0,0 +1,41 @@
{
pkgs,
username,
lib,
config,
...
}: {
options = {
qemu.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.qemu.enable {
programs.dconf.enable = true;
users.users.${username}.extraGroups = ["libvirtd"];
environment.systemPackages = with pkgs; [
virt-manager
virt-viewer
spice
spice-gtk
spice-protocol
win-virtio
win-spice
virtiofsd
freerdp
];
virtualisation = {
libvirtd = {
enable = true;
qemu = {
swtpm.enable = true;
ovmf.enable = true;
ovmf.packages = [pkgs.OVMFFull.fd];
};
};
spiceUSBRedirection.enable = true;
};
services.spice-vdagentd.enable = true;
};
}

View file

@ -0,0 +1,13 @@
{
lib,
config,
...
}: {
options = {
virtual-box.enable = lib.mkEnableOption "";
};
config = lib.mkIf config.virtual-box.enable {
virtualisation.virtualbox.host.enable = true;
};
}

View file

@ -1,34 +0,0 @@
{
pkgs,
username,
...
}: {
programs.dconf.enable = true;
users.users.${username}.extraGroups = ["libvirtd"];
environment.systemPackages = with pkgs; [
virt-manager
virt-viewer
spice
spice-gtk
spice-protocol
win-virtio
win-spice
virtiofsd
freerdp
];
virtualisation = {
libvirtd = {
enable = true;
qemu = {
swtpm.enable = true;
ovmf.enable = true;
ovmf.packages = [pkgs.OVMFFull.fd];
};
};
spiceUSBRedirection.enable = true;
};
services.spice-vdagentd.enable = true;
}

View file

@ -9,7 +9,6 @@
./gnome ./gnome
./hyprland ./hyprland
./polkit ./polkit
./syncthing
]; ];
home-manager = { home-manager = {
extraSpecialArgs = { extraSpecialArgs = {

View file

@ -1,10 +0,0 @@
{username, ...}: {
services.syncthing = {
enable = true;
dataDir = "/home/${username}";
openDefaultPorts = true;
configDir = "/home/${username}/.config/syncthing";
user = username;
group = "users";
};
}