chore: fix trace warnings

fix: hyprland nvidia problems(WIP)
This commit is contained in:
Patrick 2024-10-12 18:05:32 +02:00
parent 838b04b12a
commit f386f780b9
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
7 changed files with 270 additions and 169 deletions

View file

@ -6,44 +6,114 @@
}: }:
let let
inherit (lib) inherit (lib)
types getExe
mkEnableOption mkEnableOption
mkPackageOption mkIf
mkOption mkOption
mkPackageOption
types
; ;
cfg = config.services.actual; cfg = config.services.actual;
configFile = formatType.generate "config.json" cfg.settings; configFile = formatType.generate "config.json" cfg.settings;
dataDir = "/var/lib/actual";
formatType = pkgs.formats.json { }; formatType = pkgs.formats.json { };
in in
{ {
options.services.actual = { options.services.actual = {
enable = mkEnableOption "actual, a privacy focused app for managing your finances"; enable = mkEnableOption "actual, a privacy focused app for managing your finances";
package = mkPackageOption pkgs "actual" { }; package = mkPackageOption pkgs "actual-server" { };
user = mkOption {
type = types.str;
default = "actual";
description = ''
User to run actual as.
::: {.note}
If left as the default value this user will automatically be created
on system activation, otherwise the sysadmin is responsible for
ensuring the user exists.
:::
'';
};
group = mkOption {
type = types.str;
default = "actual";
description = ''
Group under which to run.
::: {.note}
If left as the default value this group will automatically be created
on system activation, otherwise the sysadmin is responsible for
ensuring the user exists.
:::
'';
};
openFirewall = mkOption {
default = false;
type = types.bool;
description = "Whether to open the firewall for the specified port.";
};
settings = mkOption { settings = mkOption {
default = { }; default = { };
description = "Server settings, refer to (the documentation)[https://actualbudget.org/docs/config/] for available options.";
type = types.submodule { type = types.submodule {
freeformType = formatType.type; freeformType = formatType.type;
options = {
hostname = mkOption {
type = types.str;
description = "The address to listen on";
default = "::";
};
port = mkOption {
type = types.port;
description = "The port to listen on";
default = 3000;
};
};
config = { config = {
serverFiles = "/var/lib/actual/server-files"; serverFiles = "${dataDir}/server-files";
userFiles = "/var/lib/actual/user-files"; userFiles = "${dataDir}/user-files";
dataDir = "/var/lib/actual"; inherit dataDir;
}; };
}; };
}; };
}; };
config.systemd.services.actual = {
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.port ];
users.groups = mkIf (cfg.group == "actual") {
${cfg.group} = { };
};
users.users = mkIf (cfg.user == "actual") {
${cfg.user} = {
isSystemUser = true;
inherit (cfg) group;
home = dataDir;
};
};
systemd.services.actual = {
description = "Actual server, a local-first personal finance app";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
environment.ACTUAL_CONFIG_PATH = configFile; environment.ACTUAL_CONFIG_PATH = configFile;
serviceConfig = { serviceConfig = {
ExecStartPre = "${pkgs.coreutils}/bin/ln -sf ${cfg.package}/migrations /var/lib/actual/"; ExecStart = getExe cfg.package;
ExecStart = lib.getExe cfg.package; User = cfg.user;
User = "actual"; Group = cfg.group;
Group = "actual";
DynamicUser = true;
StateDirectory = "actual"; StateDirectory = "actual";
WorkingDirectory = "/var/lib/actual"; WorkingDirectory = dataDir;
LimitNOFILE = "1048576"; LimitNOFILE = "1048576";
PrivateTmp = true; PrivateTmp = true;
PrivateDevices = true; PrivateDevices = true;
@ -79,6 +149,6 @@ in
]; ];
UMask = "0077"; UMask = "0077";
}; };
wantedBy = [ "multi-user.target" ]; };
}; };
} }

View file

@ -1,6 +1,18 @@
{ pkgs, lib, nixosConfig, ... }: {
pkgs,
lib,
nixosConfig,
...
}:
let let
inherit (lib) mkMerge optionals elem mkIf flip concatMap; inherit (lib)
mkMerge
optionals
elem
mkIf
flip
concatMap
;
#from https://github.com/hyprwm/Hyprland/issues/3835 #from https://github.com/hyprwm/Hyprland/issues/3835
float_script = pkgs.writeShellScript "hyprland-bitwarden-float" '' float_script = pkgs.writeShellScript "hyprland-bitwarden-float" ''
handle() { handle() {
@ -34,7 +46,8 @@ let
# Listen to the Hyprland socket for events and process each line with the handle function # Listen to the Hyprland socket for events and process each line with the handle function
${pkgs.socat}/bin/socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done ${pkgs.socat}/bin/socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done
''; '';
in { in
{
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
settings = mkMerge [ settings = mkMerge [
@ -53,22 +66,28 @@ in {
touchpad = { touchpad = {
natural_scroll = true; natural_scroll = true;
disable_while_typing = true; disable_while_typing = true;
clickfinger_behavior = true;
scroll_factor = 0.7; scroll_factor = 0.7;
}; };
}; };
gestures = { workspace_swipe = true; }; gestures = {
workspace_swipe = true;
};
general = { general = {
gaps_in = 0; gaps_in = 0;
gaps_out = 0; gaps_out = 0;
allow_tearing = true; allow_tearing = true;
}; };
render = {
explicit_sync = 0;
direct_scanout = false;
};
binds = { binds = {
focus_preferred_method = 1; focus_preferred_method = 1;
workspace_center_on = 1; workspace_center_on = 1;
}; };
bind = let bind =
let
monitor_binds = { monitor_binds = {
"1" = "j"; "1" = "j";
"2" = "d"; "2" = "d";
@ -80,9 +99,11 @@ in {
"8" = "F3"; "8" = "F3";
"9" = "F4"; "9" = "F4";
}; };
in [ in
[
"SUPER,q,killactive," "SUPER,q,killactive,"
"SUPER,return,fullscreen," "SUPER,return,fullscreen,"
"SUPER + SHIFT,return,fullscreenstate,2,0,"
"SUPER,f,togglefloating" "SUPER,f,togglefloating"
"SUPER,g,togglegroup" "SUPER,g,togglegroup"
"SUPER,tab,cyclenext," "SUPER,tab,cyclenext,"
@ -129,14 +150,16 @@ in {
"CTRL,F9,exec,systemctl --user start swww-update-wallpaper" "CTRL,F9,exec,systemctl --user start swww-update-wallpaper"
"SUPER + SHIFT,q,exit" "SUPER + SHIFT,q,exit"
] ++ flip concatMap (map toString (lib.lists.range 1 9)) (x: [ ]
++ flip concatMap (map toString (lib.lists.range 1 9)) (x: [
"SUPER,${monitor_binds."${x}"},workspace,${x}" "SUPER,${monitor_binds."${x}"},workspace,${x}"
"SUPER + SHIFT,${monitor_binds."${x}"},movetoworkspacesilent,${x}" "SUPER + SHIFT,${monitor_binds."${x}"},movetoworkspacesilent,${x}"
]); ]);
cursor.no_warps = true; cursor.no_warps = true;
debug.disable_logs = false; debug.disable_logs = false;
env = [ env =
[
"NIXOS_OZONE_WL,1" "NIXOS_OZONE_WL,1"
"MOZ_ENABLE_WAYLAND,1" "MOZ_ENABLE_WAYLAND,1"
"_JAVA_AWT_WM_NONREPARENTING,1" "_JAVA_AWT_WM_NONREPARENTING,1"
@ -145,8 +168,8 @@ in {
"GDK_BACKEND,wayland" "GDK_BACKEND,wayland"
"WLR_DRM_NO_ATOMIC,1" # retest on newest nvidia driver "WLR_DRM_NO_ATOMIC,1" # retest on newest nvidia driver
"XDG_SESSION_TYPE,wayland" "XDG_SESSION_TYPE,wayland"
] ++ optionals ]
(elem "nvidia" nixosConfig.services.xserver.videoDrivers) [ ++ optionals (elem "nvidia" nixosConfig.services.xserver.videoDrivers) [
# See https://wiki.hyprland.org/Nvidia/ # See https://wiki.hyprland.org/Nvidia/
"LIBVA_DRIVER_NAME,nvidia" "LIBVA_DRIVER_NAME,nvidia"
"GBM_BACKEND,nvidia-drm" "GBM_BACKEND,nvidia-drm"
@ -191,6 +214,7 @@ in {
#baldur #baldur
"immediate, class:^(steam_app_1086940)$" "immediate, class:^(steam_app_1086940)$"
"float, class:^(steam)$, title:^(Friends List)" "float, class:^(steam)$, title:^(Friends List)"
"float, class:^(steam)$, title:(Chat)"
"workspace 2,class:^(firefox)$" "workspace 2,class:^(firefox)$"
"workspace 3,class:^(thunderbird)$" "workspace 3,class:^(thunderbird)$"
"workspace 4,class:^(bottles)$" "workspace 4,class:^(bottles)$"
@ -205,9 +229,9 @@ in {
} }
(mkIf (nixosConfig.node.name == "desktopnix") { (mkIf (nixosConfig.node.name == "desktopnix") {
monitor = [ monitor = [
"DVI-D-1,preferred,0x-1080,1" "DVI-D-1,preferred,0x0,1"
"HDMI-A-1,preferred,0x0,1" "HDMI-A-1,preferred,0x1080,1"
"DP-3,2560x1440@144.00Hz,1920x-540,1" "DP-3,2560x1440@144.00Hz,1920x540,1"
# Thank you NVIDIA for this generous, free-of-charge, extra monitor that # Thank you NVIDIA for this generous, free-of-charge, extra monitor that
# doesn't exist and crashes yoru session sometimes when moving a window to it. # doesn't exist and crashes yoru session sometimes when moving a window to it.
"Unknown-1, disable" "Unknown-1, disable"
@ -223,7 +247,7 @@ in {
"8, monitor:HDMI-A-1, default: true" "8, monitor:HDMI-A-1, default: true"
"9, monitor:HDMI-A-1" "9, monitor:HDMI-A-1"
]; ];
env = [ "HYPRLAND_FLOAT_LOCATION,3800 -400" ]; env = [ "HYPRLAND_FLOAT_LOCATION,3800 680" ];
}) })
(mkIf (nixosConfig.node.name == "patricknix") { (mkIf (nixosConfig.node.name == "patricknix") {
monitor = [ monitor = [

View file

@ -6,8 +6,10 @@
./plugins/neo-tree.nix ./plugins/neo-tree.nix
]; ];
programs.nixvim.plugins = { programs.nixvim.plugins = {
web-devicons.enable = true;
lualine = { lualine = {
enable = true; enable = true;
settings = {
extensions = [ extensions = [
"fzf" "fzf"
"nvim-dap-ui" "nvim-dap-ui"
@ -17,10 +19,10 @@
"quickfix" "quickfix"
"fugitive" "fugitive"
]; ];
componentSeparators.left = ""; component_separators.left = "";
componentSeparators.right = ""; component_separators.right = "";
sectionSeparators.left = ""; section_separators.left = "";
sectionSeparators.right = ""; section_separators.right = "";
sections = { sections = {
lualine_a = [ "mode" ]; lualine_a = [ "mode" ];
lualine_b = [ lualine_b = [
@ -48,13 +50,14 @@
lualine_z = [ "location" ]; lualine_z = [ "location" ];
}; };
}; };
};
fugitive.enable = true; fugitive.enable = true;
neogit.enable = true; neogit.enable = true;
notify.enable = true; notify.enable = true;
rainbow-delimiters.enable = true; rainbow-delimiters.enable = true;
rustaceanvim = { rustaceanvim = {
enable = true; enable = true;
settings.server.settings.files.excludeDirs = [ ".direnv" ]; settings.server.default_settings.files.excludeDirs = [ ".direnv" ];
}; };
indent-blankline = { indent-blankline = {
enable = true; enable = true;
@ -76,7 +79,7 @@
diffview.enable = true; diffview.enable = true;
treesitter = { treesitter = {
enable = true; enable = true;
indent = true; settings.indent.enable = true;
nixvimInjections = true; nixvimInjections = true;
}; };
#treesitter-context.enable = true; #treesitter-context.enable = true;

View file

@ -2,7 +2,7 @@
programs.nixvim.plugins = { programs.nixvim.plugins = {
luasnip = { luasnip = {
enable = true; enable = true;
extraConfig = { settings = {
history = true; history = true;
# Update dynamic snippets while typing # Update dynamic snippets while typing
updateevents = "TextChanged,TextChangedI"; updateevents = "TextChanged,TextChangedI";

View file

@ -49,8 +49,8 @@
pyright.enable = true; pyright.enable = true;
texlab.enable = true; texlab.enable = true;
ocamllsp.enable = true; ocamllsp.enable = true;
java-language-server.enable = true; java_language_server.enable = true;
nil-ls = { nil_ls = {
enable = true; enable = true;
settings = { settings = {
formatting.command = [ formatting.command = [

View file

@ -22,6 +22,8 @@
".config/google-chrome" ".config/google-chrome"
".cache/google-chrome" ".cache/google-chrome"
".config/Mullvad VPN"
# For nextcloud client install # For nextcloud client install
"Nextcloud" "Nextcloud"
".config/Nextcloud" ".config/Nextcloud"

View file

@ -32,6 +32,8 @@
yt-dlp yt-dlp
hyperfine
figlet figlet
cowsay cowsay
cmatrix cmatrix