refactor: complete rewrite

This commit is contained in:
ooks-io 2024-10-23 23:46:25 +13:00
parent 19a4bbda3c
commit 8e81943cf9
399 changed files with 3396 additions and 8042 deletions

View file

@ -0,0 +1,22 @@
{
config,
self,
lib,
...
}: let
inherit (lib) mkIf;
inherit (config.ooknet.host) admin;
in {
imports = [
./options.nix
./themes
./services
./programs
./gaming
./environment
];
home-manager.users.${admin.name} = mkIf admin.homeManager {
imports = ["${self}/modules/home/workstation"];
};
}

View file

@ -0,0 +1,3 @@
{
imports = [./hyprland];
}

View file

@ -0,0 +1,67 @@
{
inputs',
config,
lib,
pkgs,
...
}: let
inherit (lib) concatStringsSep getExe mkIf;
inherit (config.ooknet.workstation) environment;
inherit (inputs'.hyprland.packages) xdg-desktop-portal-hyprland hyprland;
in {
config = mkIf (environment == "hyprland") {
programs.hyprland = {
enable = true;
package = hyprland;
portalPackage = xdg-desktop-portal-hyprland;
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
config.common = {
default = ["gtk"];
"org.freedesktop.impl.portal.Screencast" = "hyprland";
"org.freedesktop.impl.portal.Screenshot" = "hyprland";
};
};
# required for wayland screen lockers to work
security.pam.services.hyprlock.text = "auth include login";
services.greetd = {
enable = true;
vt = 2;
settings = {
default_session = {
command = concatStringsSep " " [
(getExe pkgs.greetd.tuigreet)
"--time"
"--remember"
"--cmd"
(getExe hyprland)
];
};
};
};
systemd.services.greetd.serviceConfig = {
Type = "idle";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "journal"; # Without this errors will spam on screen
# Without these bootlogs will spam on screen
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
nix.settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./steam.nix
./gamemode.nix
];
}

View file

@ -0,0 +1,50 @@
{
lib,
config,
pkgs,
inputs',
...
}: let
inherit (lib) optionalString elem getExe getExe' mkIf;
inherit (config.ooknet.workstation) profiles environment;
hyprctl = "${getExe' inputs'.hyprland.packages.hyprland "hyprctl"} -i 0";
notify-send = getExe pkgs.libnotify;
powerprofilectl = getExe pkgs.power-profiles-daemon;
optimizeScriptStart = pkgs.writeShellScript "gamemode-start" ''
${optionalString (environment == "hyprland") ''
${hyprctl} -i 0 --batch "\
keyword misc:vfr false; \
keyword render:direct_scanout true; \
keyword general:allow_tearing true" \
''}
${powerprofilectl} set performance
${notify-send} 'Gamemode Started'
'';
optimizeScriptStop = pkgs.writeShellScript "gamemode-end" ''
${optionalString (environment == "hyprland") ''
${hyprctl} -i 0 reload
''}
${powerprofilectl} set balanced
${notify-send} 'Gamemode Stopped'
'';
in {
config = mkIf (elem "gaming" profiles) {
environment.systemPackages = [pkgs.power-profiles-daemon];
programs.gamemode = {
enable = true;
settings = {
general = {
renice = 15;
softrealtime = "auto";
};
custom = {
start = optimizeScriptStart.outPath;
end = optimizeScriptStop.outPath;
};
};
};
};
}

View file

@ -0,0 +1,17 @@
{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkIf elem;
inherit (config.ooknet.workstation) profiles;
in {
config = mkIf (elem "gaming" profiles) {
programs.steam = {
enable = true;
package = pkgs.steam-small;
extraCompatPackages = [pkgs.proton-ge-bin];
};
};
}

View file

@ -0,0 +1,33 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption;
inherit (lib.types) nullOr enum listOf;
in {
options.ooknet.workstation = {
theme = mkOption {
type = nullOr (enum ["minimal"]);
default = null;
};
profiles = mkOption {
type = listOf (enum ["gaming" "communication" "productivity" "creative" "media"]);
default = [];
};
environment = mkOption {
type = nullOr (enum ["hyprland"]);
default = "hyprland";
};
default = {
browser = mkOption {
type = nullOr (enum ["firefox"]);
default = "firefox";
};
terminal = mkOption {
type = enum ["foot"];
default = "foot";
};
};
programs = {
firefox.enable = mkEnableOption "";
foot.enable = mkEnableOption "";
};
};
}

View file

@ -0,0 +1,11 @@
{config, ...}: let
inherit (config.ooknet.host) admin;
in {
programs = {
_1password.enable = true;
_1password-gui = {
enable = true;
polkitPolicyOwners = ["${admin.name}"];
};
};
}

View file

@ -0,0 +1,3 @@
{
programs.dconf = {enable = true;};
}

View file

@ -0,0 +1,7 @@
{
imports = [
./1password.nix
./dconf.nix
./kdeconnect.nix
];
}

View file

@ -0,0 +1,3 @@
{
programs.kdeconnect = {enable = true;};
}

View file

@ -0,0 +1,11 @@
{pkgs, ...}: let
inherit (builtins) attrValues;
in {
services.dbus = {
enable = true;
packages = attrValues {
inherit (pkgs) dconf gcr udisks2;
};
implementation = "broker";
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./dbus.nix
./gnome-services.nix
];
}

View file

@ -0,0 +1,10 @@
{
services = {
# gnome services that I depend on
gvfs.enable = true;
gnome = {
glib-networking.enable = true;
gnome-keyring.enable = true;
};
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./minimal.nix
];
}

View file

@ -0,0 +1,50 @@
# Credit to github:misterio77/nix-colors
{
pkgs,
config,
}: let
inherit (config.ooknet.hardware) monitors;
inherit (config.ooknet.appearance) colorscheme;
largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs));
largestWidth = largest (x: x.width) monitors;
largestHeight = largest (x: x.height) monitors;
in
{
width ? largestWidth,
height ? largestHeight,
logoScale ? 4,
backgroundColor ? colorscheme.palette.mantle,
logoColor1 ? colorscheme.palette.yellow,
logoColor2 ? colorscheme.palette.green,
}:
pkgs.stdenv.mkDerivation {
name = "generated-nix-wallpaper-${colorscheme.slug}.png";
src = pkgs.writeTextFile {
name = "template.svg";
text = ''
<svg width="${toString width}" height="${
toString height
}" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect width="${toString width}" height="${
toString height
}" fill="#${backgroundColor}"/>
<svg x="${toString (width / 2 - (logoScale * 50))}" y="${
toString (height / 2 - (logoScale * 50))
}" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g transform="scale(${toString logoScale})">
<g transform="matrix(.19936 0 0 .19936 80.161 27.828)">
<path d="m-53.275 105.84-122.2-211.68 56.157-0.5268 32.624 56.869 32.856-56.565 27.902 0.011 14.291 24.69-46.81 80.49 33.229 57.826zm-142.26 92.748 244.42 0.012-27.622 48.897-65.562-0.1813 32.559 56.737-13.961 24.158-28.528 0.031-46.301-80.784-66.693-0.1359zm-9.3752-169.2-122.22 211.67-28.535-48.37 32.938-56.688-65.415-0.1717-13.942-24.169 14.237-24.721 93.111 0.2937 33.464-57.69z" fill="#${logoColor1}"/>
<path d="m-97.659 193.01 122.22-211.67 28.535 48.37-32.938 56.688 65.415 0.1716 13.941 24.169-14.237 24.721-93.111-0.2937-33.464 57.69zm-9.5985-169.65-244.42-0.012 27.622-48.897 65.562 0.1813-32.559-56.737 13.961-24.158 28.528-0.031 46.301 80.784 66.693 0.1359zm-141.76 93.224 122.2 211.68-56.157 0.5268-32.624-56.869-32.856 56.565-27.902-0.011-14.291-24.69 46.81-80.49-33.229-57.826z" fill="#${logoColor2}" style="isolation:auto;mix-blend-mode:normal"/>
</g>
</g>
</svg>
</svg>
'';
};
buildInputs = [pkgs.inkscape];
unpackPhase = "true";
buildPhase = ''
inkscape --export-type="png" $src -w ${toString width} -h ${toString height} -o wallpaper.png
'';
installPhase = "install -Dm0644 wallpaper.png $out";
}

View file

@ -0,0 +1,40 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
inherit (config.ooknet.workstation) theme;
generatedWallpaper = import ./generated-wallpaper.nix {inherit config pkgs;} {};
in {
config = mkIf (theme == "minimal") {
ooknet.appearance = {
fonts = {
monospace = {
family = "JetBrainsMono Nerd Font";
package = pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];};
};
regular = {
family = "Fira Sans";
package = pkgs.fira;
};
};
cursor = {
name = "Bibata-Modern-Ice";
package = pkgs.bibata-cursors;
size = 22;
};
wallpaper = {
path = "${generatedWallpaper}";
};
colorscheme = {
name = "gruvbox-material-medium";
variant = "dark";
};
};
};
}