organise stuff

This commit is contained in:
tristan 2023-12-30 01:31:26 +00:00
parent 3b63b8b52b
commit 52dff69cca
8 changed files with 149 additions and 124 deletions

View file

@ -2,7 +2,7 @@
user,
name,
work ? false,
displays ? [],
displays ? {},
userName,
inputs,
...

View file

@ -69,12 +69,7 @@ with lib; let
};
};
resolutionType = types.submodule ({
x,
y,
freq,
...
}: {
resolutionType = types.submodule {
options = {
x = mkOption {
description = "x";
@ -92,45 +87,57 @@ with lib; let
default = 0;
};
};
});
displayType =
types.submodule
({...}: {
options = {
name = mkOption {
description = "name of the display";
};
description = mkOption {
description = "description of display from hyprctl monitors";
default = "";
};
scaling = mkOption {
type = types.float;
default = 1.0;
};
rotation = mkOption {
type = types.int;
default = 0;
};
resolution = mkOption {
description = "res";
type = resolutionType;
default = {};
};
position.x = mkOption {
default = -1;
type = types.int;
};
position.y = mkOption {
default = -1;
type = types.int;
};
wallpaper = mkOption {
description = "path to wallpaper";
default = "";
};
displayType = types.submodule {
options = {
name = mkOption {
description = "name of the display";
};
description = mkOption {
description = "description of display from hyprctl monitors";
default = "";
};
scaling = mkOption {
type = types.float;
default = 1.0;
};
rotation = mkOption {
type = types.int;
default = 0;
};
resolution = mkOption {
description = "res";
type = resolutionType;
default = {};
};
position.x = mkOption {
default = -1;
type = types.int;
};
position.y = mkOption {
default = -1;
type = types.int;
};
wallpaper = mkOption {
description = "path to wallpaper";
default = "";
};
workspaces = mkOption {
default = {};
type = types.submodule {
options = {
start = mkOption {
type = types.int;
};
end = mkOption {
type = types.int;
};
};
};
};
});
};
};
resUnset = res: (res.x == 0 || res.y == 0 || res.freq == 0);
@ -138,26 +145,42 @@ with lib; let
if resUnset res
then "preferred"
else "${toString res.x}x${toString res.y}@${toString res.freq}";
waybarWorkspaceConf = monitors: (map (display: {
${display.name} = display.workspaces.start;
})
monitors);
renderWorkspacesForHyprland = displays: (map hyprWorkspaceSetting displays);
hyprWorkspaceSetting = display:
specificDisplay display
+ ", "
+ toString display.workspaces.start;
in {
options.displays = {
enable = mkEnableOption "manage displays";
displays = mkOption {
type = types.listOf displayType;
default = [];
type = types.attrsOf displayType;
default = {};
};
};
config = mkIf cfg.enable {
home-manager.users.${user}.imports = [
{
wayland.windowManager.hyprland.settings.monitor =
mkIf (cfg.displays != [])
(renderDisplaysForHyprland cfg.displays);
systemd.user.services.swaybg = swaybgJob (attrValues cfg.displays);
systemd.user.services.swaybg = swaybgJob cfg.displays;
wayland.windowManager.sway.config.output =
mkIf (cfg.displays != [])
(renderDisplaysForSway cfg.displays);
programs.waybar.settings.mainBar."hyprland/workspaces".persistent_workspaces = waybarWorkspaceConf (attrValues cfg.displays);
wayland.windowManager = mkIf (cfg.displays != {}) {
hyprland.settings = {
monitor = renderDisplaysForHyprland (attrValues cfg.displays);
workspace = renderWorkspacesForHyprland (attrValues cfg.displays);
};
sway.config.output =
renderDisplaysForSway (attrValues cfg.displays);
};
}
];
};

View file

@ -14,38 +14,24 @@ with lib; {
nixpkgs.config.permittedInsecurePackages = [
"electron-25.9.0"
];
nixpkgs.config.packageOverrides = pkgs: {
steam = pkgs.steam.override {
extraPkgs = pkgs:
with pkgs; [
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
libkrb5
keyutils
];
};
};
home-manager.users.${user}.imports = [
{
home.packages = with pkgs; [
# Games
airshipper
minetest
superTuxKart
xonotic
# Helpers
heroic
BeatSaberModManager
protontricks
protonup-qt
gamescope
oversteer
# vr
monado
openxr-loader
opencomposite
@ -55,7 +41,6 @@ with lib; {
desktopName = "X11 Steam Wrapper";
exec = "QT_QPA_PLATFORM=xcb SDL_VIDEODRIVER=x11 ${steam}/bin/steam";
})
oversteer
];
}
];
@ -74,22 +59,5 @@ with lib; {
dedicatedServer.openFirewall = true;
};
programs.gamemode.enable = true;
hardware.steam-hardware.enable = true;
environment.etc.logitechG920 = {
target = "usb_modeswitch.d/046d:c261";
text = ''
DefaultVendor=046d
DefaultProduct=c261
MessageEndpoint=01
ResponseEndpoint=01
TargetClass=0x03
MessageContent="0f00010142"
'';
};
services.udev.extraRules = ''
ATTR{idVendor}=="046d", ATTR{idProduct}=="c261", RUN+="${pkgs.usb-modeswitch}/bin/usb_modeswitch -c '/etc/usb_modeswitch.d/046d:c261'"
'';
hardware.new-lg4ff.enable = true;
};
}

View file

@ -17,12 +17,10 @@ in {
config = mkIf cfg.enable {
displays = mkIf cfg.displays {
enable = true;
displays = [
{
name = "eDP-1";
scaling = 1.2;
}
];
displays.internal = {
name = "eDP-1";
scaling = 1.2;
};
};
keyboard.dvorak.enable = true;

View file

@ -10,17 +10,15 @@ with lib; {
};
config = mkIf config.roles.work.enable {
displays.displays = [
{
name = "eDP-1";
description = "BOE 0x07D8";
position = {
x = 0;
y = 1080;
};
wallpaper = ../../images/nix-soft.png;
}
];
displays.displays.internal = {
name = "eDP-1";
description = "BOE 0x07D8";
position = {
x = 0;
y = 1080;
};
wallpaper = ../../images/nix-soft.png;
};
roles.email = {
enable = true;