From 639ddb7f88f0e73ff8511c1c01c8366ee9dfcb5b Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Thu, 11 Apr 2024 23:12:08 +0200 Subject: [PATCH] transition to using mainProgram defined in meta --- common/firefox.nix | 2 +- common/gaming.nix | 6 +++--- common/networking.nix | 42 +++++++++++++++++-------------------- common/pass.nix | 7 ++----- common/portals.nix | 8 +++++-- common/sway.nix | 4 ++-- common/toolchains.nix | 2 +- modules/system-packages.nix | 8 +------ modules/users.nix | 1 + sway/sway-conf.nix | 20 +++++++++--------- 10 files changed, 46 insertions(+), 54 deletions(-) diff --git a/common/firefox.nix b/common/firefox.nix index 6bfa770..63327e3 100644 --- a/common/firefox.nix +++ b/common/firefox.nix @@ -12,7 +12,7 @@ in enable = true; nativeMessagingHosts.packages = [ ] ++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ]; - languagePacks = [ "de" "en-US" ]; + languagePacks = lib.optionals cfg.locale [ "de" "en-US" ]; policies = { ExtensionSettings = lib.mkMerge [ (lib.mkIf cfg.firefox.disableUserPlugins { diff --git a/common/gaming.nix b/common/gaming.nix index f7e3f54..4e6d841 100644 --- a/common/gaming.nix +++ b/common/gaming.nix @@ -20,8 +20,8 @@ in renice = 10; }; custom = { - start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; - end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; + start = "${lib.getExe pkgs.libnotify} 'GameMode started'"; + end = "${lib.getExe pkgs.libnotify} 'GameMode ended'"; }; }; }; @@ -39,7 +39,7 @@ in (pkgs.symlinkJoin { name = "osu"; paths = [ - (pkgs.writeShellScriptBin "osu!" ''exec gamemoderun ${pkgs.osu-lazer-bin}/bin/'osu!' + (pkgs.writeShellScriptBin "osu!" ''exec gamemoderun ${lib.getExe pkgs.osu-lazer-bin} '') pkgs.osu-lazer-bin ]; diff --git a/common/networking.nix b/common/networking.nix index d78d33e..593c636 100644 --- a/common/networking.nix +++ b/common/networking.nix @@ -3,29 +3,25 @@ let cfg = config.grimmShared; in { - config = lib.mkMerge [ - (with cfg; lib.mkIf (enable && network) { - networking.networkmanager.enable = true; - networking.useDHCP = lib.mkDefault true; - networking.firewall.enable = true; + config = with cfg; lib.mkIf (enable && network) { + networking.networkmanager.enable = true; + networking.useDHCP = lib.mkDefault true; + networking.firewall.enable = true; - hardware.bluetooth.enable = true; + hardware.bluetooth.enable = true; - environment.systemPackages = with pkgs; [ - wireguard-tools - bluetuith - ]; - }) - (with cfg; lib.mkIf (enable && network && graphical) { - services.blueman.enable = true; - }) - (with cfg; lib.mkIf (enable && network && sound) { - systemd.user.services.mpris-proxy = { - description = "Mpris proxy"; - after = [ "network.target" "sound.target" ]; - wantedBy = [ "default.target" ]; - serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; - }; - }) - ]; + environment.systemPackages = with pkgs; [ + wireguard-tools + bluetuith + ]; + + services.blueman.enable = graphical; + + systemd.user.services.mpris-proxy = lib.mkIf sound { + description = "Mpris proxy"; + after = [ "network.target" "sound.target" ]; + wantedBy = [ "default.target" ]; + serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + }; } diff --git a/common/pass.nix b/common/pass.nix index 1eb1b85..14c39d6 100644 --- a/common/pass.nix +++ b/common/pass.nix @@ -13,18 +13,15 @@ in pass libsecret (writeShellScriptBin "passw" "pass $@") - ] ++ lib.optionals cfg.graphical [ - lxqt.lxqt-policykit - ]; + ] ++ lib.optional graphical lxqt.lxqt-policykit; services.passSecretService.enable = true; programs.gnupg.agent = { settings = { - # default-cache-ttl = 6000; + # default-cache-ttl = 6000; }; pinentryPackage = lib.mkForce pkgs.pinentry; enable = true; - # enableSSHSupport = true; }; }; } diff --git a/common/portals.nix b/common/portals.nix index 413effe..25d38b3 100644 --- a/common/portals.nix +++ b/common/portals.nix @@ -6,19 +6,19 @@ in config = with cfg; lib.mkIf (enable && portals) { xdg.portal = { enable = true; - wlr.enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-kde xdg-desktop-portal-gtk ]; + wlr.enable = true; wlr.settings = lib.mapAttrs' (name: value: lib.nameValuePair ("screencast_" + name) { output_name = value.id; max_fps = value.fps; chooser_type = "simple"; - chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or"; + chooser_cmd = "${lib.getExe pkgs.slurp} -f %o -or"; }) cfg.screens; }; @@ -28,6 +28,10 @@ in FREETYPE_PROPERTIES = "cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"; }; + environment.systemPackages = with pkgs; [ + xwaylandvideobridge + ]; + fonts.fontDir.enable = true; }; } diff --git a/common/sway.nix b/common/sway.nix index ba22d56..9bdada0 100644 --- a/common/sway.nix +++ b/common/sway.nix @@ -6,14 +6,14 @@ in config = let waybar_full = pkgs.writeShellScriptBin "waybar-full" ( - "${config.programs.waybar.package}/bin/waybar" + (lib.getExe config.programs.waybar.package) + (if isNull cfg.sway.bar.config then "" else " -c ${cfg.sway.bar.config}") + (if isNull cfg.sway.bar.style then "" else " -s ${cfg.sway.bar.style}") ); bar_config = '' bar { - swaybar_command ${waybar_full}/bin/waybar-full + swaybar_command ${lib.getExe waybar_full} } ''; diff --git a/common/toolchains.nix b/common/toolchains.nix index 3c8e883..71ed762 100644 --- a/common/toolchains.nix +++ b/common/toolchains.nix @@ -58,7 +58,7 @@ in config = { init.defaultBranch = "main"; credential.username = cfg.tooling.git_user; - core.editor = "${pkgs.neovim}/bin/nvim"; + core.editor = lib.getExe pkgs.neovim; user.name = cfg.tooling.git_user; user.email = cfg.tooling.git_email; }; diff --git a/modules/system-packages.nix b/modules/system-packages.nix index 920525d..2c7618a 100644 --- a/modules/system-packages.nix +++ b/modules/system-packages.nix @@ -1,15 +1,9 @@ { pkgs, ... }: { environment.systemPackages = with pkgs; [ - spice-gtk - kate oci-cli xcb-util-cursor krfb - kdePackages.audiocd-kio - - (writeShellScriptBin "rebuild" '' - pkexec nixos-rebuild switch --flake /home/grimmauld/grimm-nixos-laptop - '') + (writeShellScriptBin "rebuild" "nixos-rebuild switch --flake .") ]; } diff --git a/modules/users.nix b/modules/users.nix index 10b9cae..3ae48f9 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -13,6 +13,7 @@ ]; packages = with pkgs; [ + geany webcord discord kwrited diff --git a/sway/sway-conf.nix b/sway/sway-conf.nix index db75136..bbb51be 100644 --- a/sway/sway-conf.nix +++ b/sway/sway-conf.nix @@ -19,16 +19,16 @@ style = ./bar/style.css; }; - config = { + config = with lib; { definitions = { mod = "Mod4"; left = "h"; down = "j"; up = "k"; right = "l"; - term = "alacritty"; - menu = "rmenu -r drun | xargs swaymsg exec --"; - menu_run = "rmenu -r run | xargs swaymsg exec --"; + term = getExe pkgs.alacritty; + menu = "${getExe pkgs.rmenu} -r drun | xargs swaymsg exec --"; + menu_run = "${getExe pkgs.rmenu} -r run | xargs swaymsg exec --"; primecol = "#8800FF"; accentcol = "#5700a0"; @@ -41,7 +41,7 @@ keybinds = { "$mod+d" = "exec $menu"; "$mod+Shift+d" = "exec $menu_run"; - "$mod+Shift+s" = ''exec grim -g "$(slurp -d)" - | wl-copy''; + "$mod+Shift+s" = ''exec ${getExe pkgs.grim} -g "$(${getExe pkgs.slurp} -d)" - | wl-copy''; "$mod+Return" = "exec $term"; "$mod+Shift+q" = "kill"; "$mod+Shift+c" = "reload"; @@ -124,7 +124,7 @@ "$mod+Shift+minus" = "move scratchpad"; "$mod+minus" = "scratchpad show"; - "$mod+r" = ''mode "resize"''; + "$mod+r" = "mode \"resize\""; XF86AudioRaiseVolume = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; XF86AudioLowerVolume = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; @@ -134,16 +134,16 @@ XF86AudioPlay = "exec playerctl play-pause"; XF86AudioNext = "exec playerctl next"; XF86AudioPrev = "exec playerctl previous"; - "$mod+c" = "exec swaymux"; - XF86MonBrightnessUp = "exec brightnessctl s 10+%"; - XF86MonBrightnessDown = "exec brightnessctl s 10-%"; + "$mod+c" = "exec ${getExe pkgs.swaymux}"; + XF86MonBrightnessUp = "exec ${getExe pkgs.brightnessctl} s 10+%"; + XF86MonBrightnessDown = "exec ${getExe pkgs.brightnessctl} s 10-%"; }; autolaunch = [ # fixme: absolute paths "blueman-applet" "lxqt-policykit-agent" "otd-daemon" - "dunst" + (getExe pkgs.dunst) "systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP" ]; extraConfig = ''