Skip to content

Commit

Permalink
treewide: minor fixes, add hyprland variables patch
Browse files Browse the repository at this point in the history
update flake
remove polkit pantheon service as it can't be started this way.
better to start it using exec once
  • Loading branch information
JohnRTitor committed Jul 21, 2024
1 parent 2a660ba commit ab2fb63
Show file tree
Hide file tree
Showing 12 changed files with 325 additions and 237 deletions.
358 changes: 208 additions & 150 deletions flake.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion flake/hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ in {
specialArgs = {inherit self inputs systemSettings userSettings;};
modules =
[
{_module.args = { inherit pkgs-edge; };}
{_module.args = {inherit pkgs-edge;};}
../default-host/configuration.nix # main nix configuration
inputs.chaotic.nixosModules.default # chaotic nix bleeding edge packages
inputs.nur.nixosModules.nur
Expand Down
2 changes: 1 addition & 1 deletion home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
./vscode.nix
./devenv.nix # development environment
./cli-tools.nix # Useful CLI tools
./thunar.nix
# ./thunar.nix

./nix-tools.nix

Expand Down
3 changes: 2 additions & 1 deletion home-manager/thunar.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{...}: {
{pkgs, ...}: {
home.packages = [pkgs.thunar];
home.file.".config/xfce4/helpers.rc".text = ''
WebBrowser=google-chrome-stable
Editor=code
Expand Down
2 changes: 1 addition & 1 deletion home-manager/vscode.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ in {
enable = true;
enableUpdateCheck = false;
package = (
pkgs.callPackage ../pkgs/vscode-repackaged.nix { }
pkgs.callPackage ../pkgs/vscode-repackaged.nix {}
);

# Since not all extensions are provided via nixpkgs,
Expand Down
4 changes: 3 additions & 1 deletion modules-overlays/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
libs,
pkgs,
pkgs-edge,
inputs,
...
}: {
Expand All @@ -10,7 +11,8 @@

nixpkgs.overlays = [
(final: prev: {
bcachefs-tools = inputs.bcachefs-tools.packages.${pkgs.system}.bcachefs-tools;
bcachefs-tools = pkgs-edge.bcachefs-tools;
# bcachefs-tools = inputs.bcachefs-tools.packages.${pkgs.system}.bcachefs-tools;
})
];
}
2 changes: 1 addition & 1 deletion pkgs/user-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
# emacs

# IDEs #
android-studio-full
android-studio
(jetbrains.plugins.addPlugins jetbrains.phpstorm [
"github-copilot"
"nixidea"
Expand Down
74 changes: 39 additions & 35 deletions pkgs/vscode-repackaged.nix
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
# This file is specifically for overriding desktop item of VSCode
# to make it work with my encrypted SSH keys by passing environment variables
{ pkgs, makeDesktopItem, ... }:
let
{
pkgs,
makeDesktopItem,
...
}: let
executableName = "code";
longName = "Visual Studio Code";
shortName = "Code";
envVars = "env SSH_AUTH_SOCK=/run/user/1001/gnupg/S.gpg-agent.ssh";
in ((pkgs.vscode.override {
# if keyring does not work, try either "libsecret" or "gnome"
commandLineArgs = ''--password-store=gnome-libsecret'';
}).overrideAttrs {
desktopItem = makeDesktopItem {
name = executableName;
desktopName = longName;
comment = "Code Editing. Redefined.";
genericName = "Text Editor";
exec = "${envVars} ${executableName} %F";
icon = "vs${executableName}";
startupNotify = true;
startupWMClass = shortName;
categories = [ "Utility" "TextEditor" "Development" "IDE" ];
mimeTypes = [ "text/plain" "inode/directory" ];
keywords = [ "vscode" ];
actions.new-empty-window = {
name = "New Empty Window";
exec = "${executableName} --new-window %F";
# if keyring does not work, try either "libsecret" or "gnome"
commandLineArgs = ''--password-store=gnome-libsecret'';
})
.overrideAttrs {
desktopItem = makeDesktopItem {
name = executableName;
desktopName = longName;
comment = "Code Editing. Redefined.";
genericName = "Text Editor";
exec = "${envVars} ${executableName} %F";
icon = "vs${executableName}";
startupNotify = true;
startupWMClass = shortName;
categories = ["Utility" "TextEditor" "Development" "IDE"];
mimeTypes = ["text/plain" "inode/directory"];
keywords = ["vscode"];
actions.new-empty-window = {
name = "New Empty Window";
exec = "${executableName} --new-window %F";
icon = "vs${executableName}";
};
};
};

urlHandlerDesktopItem = makeDesktopItem {
name = executableName + "-url-handler";
desktopName = longName + " - URL Handler";
comment = "Code Editing. Redefined.";
genericName = "Text Editor";
exec = envVars + executableName + " --open-url %U";
icon = "vs${executableName}";
startupNotify = true;
categories = [ "Utility" "TextEditor" "Development" "IDE" ];
mimeTypes = [ "x-scheme-handler/vs${executableName}" ];
keywords = [ "vscode" ];
noDisplay = true;
};
})
urlHandlerDesktopItem = makeDesktopItem {
name = executableName + "-url-handler";
desktopName = longName + " - URL Handler";
comment = "Code Editing. Redefined.";
genericName = "Text Editor";
exec = envVars + executableName + " --open-url %U";
icon = "vs${executableName}";
startupNotify = true;
categories = ["Utility" "TextEditor" "Development" "IDE"];
mimeTypes = ["x-scheme-handler/vs${executableName}"];
keywords = ["vscode"];
noDisplay = true;
};
})
47 changes: 47 additions & 0 deletions system/add-env-vars-to-export.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index d1c51075..811a5c16 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -311,10 +311,10 @@ void CCompositor::cleanEnvironment() {
if (m_sWLRSession) {
const auto CMD =
#ifdef USES_SYSTEMD
- "systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS && hash "
+ "systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_DATA_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR SSH_AUTH_SOCK LIBEXEC_PATH INFOPATH QT_PLUGIN_PATH && hash "
"dbus-update-activation-environment 2>/dev/null && "
#endif
- "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS";
+ "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_DATA_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR SSH_AUTH_SOCK LIBEXEC_PATH INFOPATH QT_PLUGIN_PATH";
g_pKeybindManager->spawn(CMD);
}
}
@@ -569,10 +569,10 @@ void CCompositor::startCompositor() {
if (m_sWLRSession /* Session-less Hyprland usually means a nest, don't update the env in that case */) {
const auto CMD =
#ifdef USES_SYSTEMD
- "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS && hash "
+ "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_DATA_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR SSH_AUTH_SOCK LIBEXEC_PATH INFOPATH QT_PLUGIN_PATH && hash "
"dbus-update-activation-environment 2>/dev/null && "
#endif
- "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS";
+ "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_DATA_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR SSH_AUTH_SOCK LIBEXEC_PATH INFOPATH QT_PLUGIN_PATH";
g_pKeybindManager->spawn(CMD);
}

diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 944aa0b2..8e3bc1b5 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1287,10 +1287,10 @@ void CConfigManager::dispatchExecOnce() {
if (g_pCompositor->m_sWLRSession)
handleRawExec("",
#ifdef USES_SYSTEMD
- "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS && hash "
+ "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_DATA_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR SSH_AUTH_SOCK LIBEXEC_PATH INFOPATH QT_PLUGIN_PATH && hash "
"dbus-update-activation-environment 2>/dev/null && "
#endif
- "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS");
+ "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_DATA_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR SSH_AUTH_SOCK LIBEXEC_PATH INFOPATH QT_PLUGIN_PATH");

firstExecDispatched = true;

1 change: 0 additions & 1 deletion system/hardware/audio.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This conf file is used to configure audio and sound related settings
{...}: {
# Enable sound with pipewire, don't enable pulseaudio.
sound.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true; # alsa support
Expand Down
65 changes: 21 additions & 44 deletions system/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ in {
# Enable Hyprland Window Manager
programs.hyprland = {
enable = true;
systemd.setPath.enable = lib.versionOlder config.programs.hyprland.package.version "0.41.2";
package =
(pkgs-hyprland.hyprland.override {stdenv = pkgs.clangStdenv;}).overrideAttrs
(pkgs.hyprland.override {stdenv = pkgs.clangStdenv;}).overrideAttrs
(prevAttrs: {
patches =
(prevAttrs.patches or [])
Expand All @@ -34,9 +33,10 @@ in {
url = "https://github.com/hyprwm/Hyprland/pull/5874/commits/efd0a869fffe3ad6d3ffc4b4907ef68d1ef115a7.patch";
hash = "sha256-UFFB1K/funTh5aggliyYmAzIhcQ1TKSvt79aViFGzN4=";
})
./add-env-vars-to-export.patch
];
});
portalPackage = pkgs-hyprland.xdg-desktop-portal-hyprland;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};

# hyprland portal is already included, gtk is also needed for compatibility
Expand Down Expand Up @@ -79,18 +79,6 @@ in {
programs = {
evince.enable = true; # document viewer
file-roller.enable = true; # archive manager
/*
thunar = {# Xfce file manager
enable = true;
plugins = with pkgs.xfce; [
exo
mousepad # text editor
thunar-archive-plugin # archive manager
thunar-volman
];
};
nm-applet.enable = true; # network manager applet for xorg
*/
};

services.gnome = {
Expand All @@ -115,24 +103,25 @@ in {
pamixer
pavucontrol # audio control
playerctl # media player control
# pywal # for automatic color schemes from wallpaper
pantheon.pantheon-agent-polkit # polkit agent for root prompt
# POLKIT service is manually started
# as defined in Hyprland-Dots repo
rofi-wayland
slurp # screenshots
swappy # screenshots
swaynotificationcenter # notification daemon
swww
wlsunset # for night mode
wl-clipboard
wlogout
wl-clipboard # clipboard manager
wlogout # logout dialog
yad

gsettings-desktop-schemas
wlr-randr # xrandr but for wayland
ydotool

## Graphical apps ##
gnome.gnome-system-monitor # system monitor
loupe # image viewer

kitty # default terminal on hyprland
linux-wifi-hotspot # for wifi hotspot
(mpv-unwrapped.override {
Expand All @@ -141,14 +130,6 @@ in {
vapoursynthSupport = true;
}) # for video playback, needed for some scripts
mpvScripts.mpris
gnome.nautilus # file manager
gnome-text-editor # text editor
shotcut # video editor

## QT theming and apps support ##
qt5.qtwayland
qt6.qmake
qt6.qtwayland

## Utilities ##
desktop-file-utils
Expand All @@ -157,24 +138,29 @@ in {
xdg-user-dirs
xorg.xhost # needed for some packages running x11 like gparted

## GNOME Suite ##
gnome.nautilus # file manager
gnome-text-editor # text editor
shotcut # video editor
gnome.gnome-system-monitor # system monitor
loupe # image viewer

## Hypr ecosystem ##
# hyprcursor
# hyprpicker # does not work
# hyprpaper # alternative to swww, but shit
pyprland
hyprcursor
pyprland # hyprland plugin, dropdown term, etc
ags # widgets pipup
])
++ [
python-packages # needed for Weather.py from dotfiles
inputs.hyprcursor.packages.${pkgs.system}.hyprcursor
# inputs.hyprcursor.packages.${pkgs.system}.hyprcursor
# inputs.pyprland.packages.${pkgs.system}.pyprland
inputs.ags.packages.${pkgs.system}.ags
# inputs.ags.packages.${pkgs.system}.ags
inputs.wallust.packages.${pkgs.system}.wallust
];

# Environment variables to start the session with
environment.sessionVariables = {
GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas";
# WLR_NO_HARDWARE_CURSORS = "1"; # cursor not visible, needed for nvidia

NIXOS_OZONE_WL = "1"; # for electron and chromium apps to run on wayland
MOZ_ENABLE_WAYLAND = "1"; # firefox should always run on wayland
Expand All @@ -186,13 +172,4 @@ in {

# Run XDG autostart, this is needed for a DE-less setup like Hyprland
services.xserver.desktopManager.runXdgAutostartIfNone = true;

systemd.user.services."pantheon-polkit-agent" = {
description = "Pantheon Polkit Agent";
wantedBy = [ "graphical-session.target" ];
upheldBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
script = "${pkgs.pantheon.pantheon-agent-polkit}/libexec/policykit-1-pantheon/io.elementary.desktop.agent-polkit";
};

}
2 changes: 1 addition & 1 deletion system/services/gnome-keyring.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# apps like vscode stores encrypted data using it
{...}: {
services.gnome.gnome-keyring.enable = true;
security.pam.services.gdm-password.enableGnomeKeyring = true; # load gnome-keyring at startup
security.pam.services.login.enableGnomeKeyring = true; # load gnome-keyring at startup
programs.seahorse.enable = true; # enable the graphical frontend for managing
# NOTE: GNOME keyring does not enable a ssh agent/GPG agent in NixOS
}

0 comments on commit ab2fb63

Please sign in to comment.