refactor: complete rewrite
This commit is contained in:
parent
19a4bbda3c
commit
8e81943cf9
399 changed files with 3396 additions and 8042 deletions
22
modules/nixos/workstation/default.nix
Normal file
22
modules/nixos/workstation/default.nix
Normal 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"];
|
||||
};
|
||||
}
|
||||
3
modules/nixos/workstation/environment/default.nix
Normal file
3
modules/nixos/workstation/environment/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
imports = [./hyprland];
|
||||
}
|
||||
67
modules/nixos/workstation/environment/hyprland/default.nix
Normal file
67
modules/nixos/workstation/environment/hyprland/default.nix
Normal 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="];
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/nixos/workstation/gaming/default.nix
Normal file
6
modules/nixos/workstation/gaming/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./steam.nix
|
||||
./gamemode.nix
|
||||
];
|
||||
}
|
||||
50
modules/nixos/workstation/gaming/gamemode.nix
Normal file
50
modules/nixos/workstation/gaming/gamemode.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
17
modules/nixos/workstation/gaming/steam.nix
Normal file
17
modules/nixos/workstation/gaming/steam.nix
Normal 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];
|
||||
};
|
||||
};
|
||||
}
|
||||
33
modules/nixos/workstation/options.nix
Normal file
33
modules/nixos/workstation/options.nix
Normal 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 "";
|
||||
};
|
||||
};
|
||||
}
|
||||
11
modules/nixos/workstation/programs/1password.nix
Normal file
11
modules/nixos/workstation/programs/1password.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{config, ...}: let
|
||||
inherit (config.ooknet.host) admin;
|
||||
in {
|
||||
programs = {
|
||||
_1password.enable = true;
|
||||
_1password-gui = {
|
||||
enable = true;
|
||||
polkitPolicyOwners = ["${admin.name}"];
|
||||
};
|
||||
};
|
||||
}
|
||||
3
modules/nixos/workstation/programs/dconf.nix
Normal file
3
modules/nixos/workstation/programs/dconf.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
programs.dconf = {enable = true;};
|
||||
}
|
||||
7
modules/nixos/workstation/programs/default.nix
Normal file
7
modules/nixos/workstation/programs/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./1password.nix
|
||||
./dconf.nix
|
||||
./kdeconnect.nix
|
||||
];
|
||||
}
|
||||
3
modules/nixos/workstation/programs/kdeconnect.nix
Normal file
3
modules/nixos/workstation/programs/kdeconnect.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
programs.kdeconnect = {enable = true;};
|
||||
}
|
||||
11
modules/nixos/workstation/services/dbus.nix
Normal file
11
modules/nixos/workstation/services/dbus.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{pkgs, ...}: let
|
||||
inherit (builtins) attrValues;
|
||||
in {
|
||||
services.dbus = {
|
||||
enable = true;
|
||||
packages = attrValues {
|
||||
inherit (pkgs) dconf gcr udisks2;
|
||||
};
|
||||
implementation = "broker";
|
||||
};
|
||||
}
|
||||
6
modules/nixos/workstation/services/default.nix
Normal file
6
modules/nixos/workstation/services/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./dbus.nix
|
||||
./gnome-services.nix
|
||||
];
|
||||
}
|
||||
10
modules/nixos/workstation/services/gnome-services.nix
Normal file
10
modules/nixos/workstation/services/gnome-services.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
services = {
|
||||
# gnome services that I depend on
|
||||
gvfs.enable = true;
|
||||
gnome = {
|
||||
glib-networking.enable = true;
|
||||
gnome-keyring.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
5
modules/nixos/workstation/themes/default.nix
Normal file
5
modules/nixos/workstation/themes/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./minimal.nix
|
||||
];
|
||||
}
|
||||
50
modules/nixos/workstation/themes/generated-wallpaper.nix
Normal file
50
modules/nixos/workstation/themes/generated-wallpaper.nix
Normal 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";
|
||||
}
|
||||
40
modules/nixos/workstation/themes/minimal.nix
Normal file
40
modules/nixos/workstation/themes/minimal.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue