refactor(treewide)
This commit is contained in:
parent
25d48ac2ac
commit
c4fc882042
99 changed files with 634 additions and 477 deletions
8
nixos/default.nix
Normal file
8
nixos/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./modules
|
||||
./options
|
||||
./profiles
|
||||
./roles
|
||||
];
|
||||
}
|
||||
|
|
@ -1,23 +1,11 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./shell
|
||||
./boot
|
||||
./nix
|
||||
./displayManager
|
||||
./networking
|
||||
./locale.nix
|
||||
./virtualization
|
||||
./nix
|
||||
./security
|
||||
./services
|
||||
./host
|
||||
./shell
|
||||
./locale.nix
|
||||
];
|
||||
|
||||
|
||||
options.ooknet = {
|
||||
virtualisation = {
|
||||
enable = lib.mkEnableOption "Enable virtualisation module";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./system76Scheduler.nix
|
||||
./dbus.nix
|
||||
./gnome.nix
|
||||
./gvfs.nix
|
||||
];
|
||||
}
|
||||
9
nixos/modules/default.nix
Normal file
9
nixos/modules/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
imports = [
|
||||
./base
|
||||
./gaming
|
||||
./host
|
||||
./programs
|
||||
./services
|
||||
];
|
||||
}
|
||||
8
nixos/modules/gaming/default.nix
Normal file
8
nixos/modules/gaming/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./steam.nix
|
||||
./gamemode.nix
|
||||
./gamescope.nix
|
||||
./openPorts.nix
|
||||
];
|
||||
}
|
||||
24
nixos/modules/gaming/gamemode.nix
Normal file
24
nixos/modules/gaming/gamemode.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.gaming.gamemode;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.gamemode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
renice = 15;
|
||||
softrealtime = "auto";
|
||||
};
|
||||
custom = {
|
||||
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
|
||||
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
16
nixos/modules/gaming/gamescope.nix
Normal file
16
nixos/modules/gaming/gamescope.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.gaming.gamescope;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
hardware.opengl.extraPackages = [ pkgs.gamescope ];
|
||||
programs.gamescope = {
|
||||
enable = true;
|
||||
capSysNice = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
22
nixos/modules/gaming/openPorts.nix
Normal file
22
nixos/modules/gaming/openPorts.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.gaming.openPorts;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 3074 ];
|
||||
allowedUDPPorts = [
|
||||
88
|
||||
500
|
||||
3074
|
||||
2075
|
||||
3544
|
||||
4500
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
35
nixos/modules/gaming/steam.nix
Normal file
35
nixos/modules/gaming/steam.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.gaming.steam;
|
||||
steamFix = pkgs.steam.override {
|
||||
extraPkgs = pkgs: with pkgs; [
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXinerama
|
||||
xorg.libXScrnSaver
|
||||
libpng
|
||||
libpulseaudio
|
||||
libvorbis
|
||||
stdenv.cc.cc.lib
|
||||
libkrb5
|
||||
keyutils
|
||||
mangohud
|
||||
winetricks
|
||||
protontricks
|
||||
gtk3
|
||||
gtk3-x11
|
||||
];
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
package = steamFix;
|
||||
extraCompatPackages = [ pkgs.proton-ge-bin.steamcompattool ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
imports = [
|
||||
./admin.nix
|
||||
./name.nix
|
||||
./type.nix
|
||||
./role.nix
|
||||
./hardware
|
||||
];
|
||||
}
|
||||
|
|
@ -4,6 +4,5 @@
|
|||
./gpu
|
||||
./features
|
||||
./common.nix
|
||||
./monitors.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -2,16 +2,17 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
host = config.ooknet.host;
|
||||
admin = config.ooknet.host.admin;
|
||||
cfg = config.ooknet.programs._1password;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (host.type != "phone") {
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
_1password.enable = true;
|
||||
_1password-gui = {
|
||||
enable = true;
|
||||
polkitPolicyOwners = [ "${host.admin.name}" ];
|
||||
polkitPolicyOwners = [ "${admin.name}" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
12
nixos/modules/programs/dconf.nix
Normal file
12
nixos/modules/programs/dconf.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.programs.dconf;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.dconf.enable = true;
|
||||
};
|
||||
}
|
||||
14
nixos/modules/programs/kdeconnect.nix
Normal file
14
nixos/modules/programs/kdeconnect.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.programs.kdeconnect;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.kdeconnect = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
steamFix = pkgs.steam.override {
|
||||
extraPkgs = pkgs: with pkgs; [
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXinerama
|
||||
xorg.libXScrnSaver
|
||||
libpng
|
||||
libpulseaudio
|
||||
libvorbis
|
||||
stdenv.cc.cc.lib
|
||||
libkrb5
|
||||
keyutils
|
||||
mangohud
|
||||
winetricks
|
||||
protontricks
|
||||
gtk3
|
||||
gtk3-x11
|
||||
];
|
||||
};
|
||||
host = config.ooknet.host;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem "gaming" host.function) {
|
||||
hardware.opengl.extraPackages = [ pkgs.gamescope ];
|
||||
services.flatpak.enable = true;
|
||||
programs = {
|
||||
steam = {
|
||||
enable = true;
|
||||
package = steamFix;
|
||||
extraCompatPackages = [ pkgs.proton-ge-bin.steamcompattool ];
|
||||
};
|
||||
gamescope = {
|
||||
enable = true;
|
||||
capSysNice = true;
|
||||
};
|
||||
gamemode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
renice = 15;
|
||||
softrealtime = "auto";
|
||||
};
|
||||
custom = {
|
||||
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
|
||||
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 3074 ];
|
||||
allowedUDPPorts = [
|
||||
88
|
||||
500
|
||||
3074
|
||||
2075
|
||||
3544
|
||||
4500
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./services
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./nixarr.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
{ config, inputs, ... }:
|
||||
|
||||
let
|
||||
admin = config.ooknet.host.admin;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [ inputs.nixarr.nixosModules.default ];
|
||||
nixarr = {
|
||||
enable = true;
|
||||
mediaDir = "/jellyfin";
|
||||
stateDir = "/var/lib/nixarr";
|
||||
mediaUsers = ["${admin.name}"];
|
||||
|
||||
jellyfin.enable = true;
|
||||
sonarr.enable = true;
|
||||
radarr.enable = true;
|
||||
prowlarr.enable = true;
|
||||
transmission.enable = true;
|
||||
};
|
||||
fileSystems."/jellyfin" = {
|
||||
device = "/dev/disk/by-label/jellyfin";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./programs
|
||||
];
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
host = config.ooknet.host;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem "workstation" host.function){
|
||||
programs.dconf.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.kdeconnect = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.lists) any elem;
|
||||
hasFunction = f: elem f config.ooknet.host.function;
|
||||
cfg = config.ooknet.services.dbus;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (any hasFunction ["workstation" "gaming"]) {
|
||||
config = mkIf cfg.enable {
|
||||
services.dbus = {
|
||||
enable = true;
|
||||
packages = with pkgs; [ dconf gcr udisks2 ];
|
||||
10
nixos/modules/services/default.nix
Normal file
10
nixos/modules/services/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
imports = [
|
||||
./system76Scheduler.nix
|
||||
./dbus.nix
|
||||
./gnome.nix
|
||||
./gvfs.nix
|
||||
# ./nixarr.nix
|
||||
./flatpak.nix
|
||||
];
|
||||
}
|
||||
12
nixos/modules/services/flatpak.nix
Normal file
12
nixos/modules/services/flatpak.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.services.flatpak;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
services.flatpak.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
host = config.ooknet.host;
|
||||
cfg = config.ooknet.services.gnomeServices;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (host.type != "phone" && host.type != "server") {
|
||||
config = mkIf cfg.enable {
|
||||
services = {
|
||||
gnome = {
|
||||
glib-networking.enable = true;
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
host = config.ooknet.host;
|
||||
cfg = config.ooknet.services.gvfs;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf ( host.type != "phone") {
|
||||
config = mkIf cfg.enable {
|
||||
services.gvfs.enable = true;
|
||||
};
|
||||
}
|
||||
29
nixos/modules/services/nixarr.nix
Normal file
29
nixos/modules/services/nixarr.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, inputs, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
admin = config.ooknet.host.admin;
|
||||
cfg = config.ooknet.services.nixarr;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [ inputs.nixarr.nixosModules.default ];
|
||||
config = mkIf cfg.enable {
|
||||
nixarr = {
|
||||
enable = true;
|
||||
mediaDir = "/jellyfin";
|
||||
stateDir = "/var/lib/nixarr";
|
||||
mediaUsers = ["${admin.name}"];
|
||||
|
||||
jellyfin.enable = true;
|
||||
sonarr.enable = true;
|
||||
radarr.enable = true;
|
||||
prowlarr.enable = true;
|
||||
transmission.enable = true;
|
||||
};
|
||||
fileSystems."/jellyfin" = {
|
||||
device = "/dev/disk/by-label/jellyfin";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
host = config.ooknet.host;
|
||||
cfg = config.ooknet.services.system76Scheduler;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (host.type != "phone") {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.system76-scheduler = {
|
||||
enable = true;
|
||||
};
|
||||
8
nixos/options/default.nix
Normal file
8
nixos/options/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./gaming.nix
|
||||
./host.nix
|
||||
./programs.nix
|
||||
./services.nix
|
||||
];
|
||||
}
|
||||
14
nixos/options/gaming.nix
Normal file
14
nixos/options/gaming.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption;
|
||||
in
|
||||
|
||||
{
|
||||
options.ooknet.gaming = {
|
||||
steam.enable = mkEnableOption "";
|
||||
gamescope.enable = mkEnableOption "";
|
||||
gamemode.enable = mkEnableOption "";
|
||||
openPorts.enable = mkEnableOption "";
|
||||
};
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ in
|
|||
};
|
||||
|
||||
profiles = mkOption {
|
||||
type = listOf (enum ["gaming" "creativity" "media-server"]);
|
||||
type = listOf (enum ["gaming" "creative" "productivity" "media-server"]);
|
||||
default = [];
|
||||
};
|
||||
|
||||
|
|
|
|||
13
nixos/options/programs.nix
Normal file
13
nixos/options/programs.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption;
|
||||
in
|
||||
|
||||
{
|
||||
options.ooknet.programs = {
|
||||
_1password.enable = mkEnableOption "";
|
||||
dconf.enable = mkEnableOption "";
|
||||
kdeconnect.enable = mkEnableOption "";
|
||||
};
|
||||
}
|
||||
16
nixos/options/services.nix
Normal file
16
nixos/options/services.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption;
|
||||
in
|
||||
|
||||
{
|
||||
options.ooknet.services = {
|
||||
nixarr.enable = mkEnableOption "";
|
||||
gnomeServices.enable = mkEnableOption "";
|
||||
gvfs.enable = mkEnableOption "";
|
||||
dbus.enable = mkEnableOption "";
|
||||
system76Scheduler.enable = mkEnableOption "";
|
||||
flatpak.enable = mkEnableOption "";
|
||||
};
|
||||
}
|
||||
6
nixos/profiles/default.nix
Normal file
6
nixos/profiles/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./gaming.nix
|
||||
./media-server.nix
|
||||
];
|
||||
}
|
||||
18
nixos/profiles/gaming.nix
Normal file
18
nixos/profiles/gaming.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
profiles = config.ooknet.host.profiles;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem "gaming" profiles) {
|
||||
ooknet.gaming = {
|
||||
steam.enable = true;
|
||||
gamescope.enable = true;
|
||||
gamemode.enable = true;
|
||||
};
|
||||
ooknet.services.flatpak.enable = true;
|
||||
};
|
||||
}
|
||||
13
nixos/profiles/media-server.nix
Normal file
13
nixos/profiles/media-server.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
profiles = config.ooknet.host.profiles;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem "media-server" profiles) {
|
||||
ooknet.services.nixarr.enable = true;
|
||||
};
|
||||
}
|
||||
5
nixos/roles/default.nix
Normal file
5
nixos/roles/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./desktop-workstation.nix
|
||||
];
|
||||
}
|
||||
24
nixos/roles/desktop-workstation.nix
Normal file
24
nixos/roles/desktop-workstation.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
host = config.ooknet.host;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (host.type == "desktop" && host.role == "workstation") {
|
||||
ooknet = {
|
||||
services = {
|
||||
gnomeServices.enable = true;
|
||||
gvfs.enable = true;
|
||||
dbus.enable = true;
|
||||
system76Scheduler.enable = true;
|
||||
};
|
||||
programs = {
|
||||
_1password.enable = true;
|
||||
dconf.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue