neovim lspconfig
This commit is contained in:
parent
fb5c04a84a
commit
34aaaf63d2
29 changed files with 1705 additions and 1399 deletions
|
|
@ -1,77 +1,101 @@
|
|||
{ user }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{user}: {
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.displays;
|
||||
|
||||
renderDisplaysForHyprland = displays: (map displayHyprlandSetting displays);
|
||||
|
||||
displayHyprlandSetting = display: specificDisplay display +
|
||||
", " + resToString display.resolution +
|
||||
", " + positionToHyprlandString display.position +
|
||||
", " + toString display.scaling +
|
||||
", " + "transform," + toString display.rotation;
|
||||
displayHyprlandSetting = display:
|
||||
specificDisplay display
|
||||
+ ", "
|
||||
+ resToString display.resolution
|
||||
+ ", "
|
||||
+ positionToHyprlandString display.position
|
||||
+ ", "
|
||||
+ toString display.scaling
|
||||
+ ", "
|
||||
+ "transform,"
|
||||
+ toString display.rotation;
|
||||
|
||||
swaybgJob = displays:
|
||||
{
|
||||
Unit = {
|
||||
Description = "SwayBG";
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.swaybg}/bin/swaybg " +
|
||||
concatStringsSep " " (map swaybgCmd displays);
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
swaybgJob = displays: {
|
||||
Unit = {
|
||||
Description = "SwayBG";
|
||||
};
|
||||
Service = {
|
||||
ExecStart =
|
||||
"${pkgs.swaybg}/bin/swaybg "
|
||||
+ concatStringsSep " " (map swaybgCmd displays);
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
|
||||
swaybgCmd = display:
|
||||
if (display.wallpaper != "") then "-o ${display.name} -i ${display.wallpaper} -m fill" else "";
|
||||
if (display.wallpaper != "")
|
||||
then "-o ${display.name} -i ${display.wallpaper} -m fill"
|
||||
else "";
|
||||
|
||||
specificDisplay = display:
|
||||
if display.description == ""
|
||||
then display.name
|
||||
else "desc:" + display.description;
|
||||
|
||||
positionToHyprlandString = { x, y }:
|
||||
if (x == -1 || y == -1) then "auto" else toString x + "x" + toString y;
|
||||
positionToHyprlandString = {
|
||||
x,
|
||||
y,
|
||||
}:
|
||||
if (x == -1 || y == -1)
|
||||
then "auto"
|
||||
else toString x + "x" + toString y;
|
||||
|
||||
renderDisplaysForSway = displays:
|
||||
listToAttrs (map displaySwaySetting displays);
|
||||
|
||||
displaySwaySetting = display: {
|
||||
name = display.name;
|
||||
value = let res = display.resolution; in
|
||||
{
|
||||
mode = mkIf (!resUnset res)
|
||||
"${toString res.x}x${toString res.y}@${toString res.freq}Hz";
|
||||
bg = display.wallpaper + " fill";
|
||||
scale = toString display.scaling;
|
||||
};
|
||||
value = let
|
||||
res = display.resolution;
|
||||
in {
|
||||
mode =
|
||||
mkIf (!resUnset res)
|
||||
"${toString res.x}x${toString res.y}@${toString res.freq}Hz";
|
||||
bg = display.wallpaper + " fill";
|
||||
scale = toString display.scaling;
|
||||
};
|
||||
};
|
||||
|
||||
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||
{
|
||||
options = {
|
||||
x = mkOption {
|
||||
description = "x";
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
y = mkOption {
|
||||
description = "y";
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
freq = mkOption {
|
||||
description = "frequency";
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
resolutionType = types.submodule ({
|
||||
x,
|
||||
y,
|
||||
freq,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
x = mkOption {
|
||||
description = "x";
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
});
|
||||
displayType = types.submodule
|
||||
({ ... }: {
|
||||
y = mkOption {
|
||||
description = "y";
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
freq = mkOption {
|
||||
description = "frequency";
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
};
|
||||
});
|
||||
displayType =
|
||||
types.submodule
|
||||
({...}: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
description = "name of the display";
|
||||
|
|
@ -91,7 +115,7 @@ let
|
|||
resolution = mkOption {
|
||||
description = "res";
|
||||
type = resolutionType;
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
position.x = mkOption {
|
||||
default = -1;
|
||||
|
|
@ -108,36 +132,33 @@ let
|
|||
};
|
||||
});
|
||||
|
||||
resUnset = res:
|
||||
(res.x == 0 || res.y == 0 || res.freq == 0);
|
||||
resUnset = res: (res.x == 0 || res.y == 0 || res.freq == 0);
|
||||
|
||||
resToString = res:
|
||||
if resUnset res
|
||||
then "preferred"
|
||||
else "${toString res.x}x${toString res.y}@${toString res.freq}";
|
||||
|
||||
in
|
||||
{
|
||||
options.displays =
|
||||
{
|
||||
enable = mkEnableOption "manage displays";
|
||||
displays = mkOption {
|
||||
type = types.listOf displayType;
|
||||
default = [ ];
|
||||
};
|
||||
in {
|
||||
options.displays = {
|
||||
enable = mkEnableOption "manage displays";
|
||||
displays = mkOption {
|
||||
type = types.listOf displayType;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${user}.imports = [
|
||||
{
|
||||
wayland.windowManager.hyprland.settings.monitor = mkIf (cfg.displays != [ ])
|
||||
wayland.windowManager.hyprland.settings.monitor =
|
||||
mkIf (cfg.displays != [])
|
||||
(renderDisplaysForHyprland cfg.displays);
|
||||
|
||||
systemd.user.services.swaybg = swaybgJob cfg.displays;
|
||||
wayland.windowManager.sway.config.output = mkIf (cfg.displays != [ ])
|
||||
wayland.windowManager.sway.config.output =
|
||||
mkIf (cfg.displays != [])
|
||||
(renderDisplaysForSway cfg.displays);
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue