From 566976b50a08d414fa118c5984b11e64db3c0cc9 Mon Sep 17 00:00:00 2001 From: Christian Ott Date: Sun, 5 May 2024 00:01:17 +0200 Subject: [PATCH] hyprland: initial dunst configuration and xdg portal --- configuration.nix | 5 +++ flake.lock | 51 +++++++++++++++++++++ flake.nix | 5 ++- home.nix | 5 ++- hyperland/default.nix | 17 +++++++ modules/dunst.nix | 100 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 modules/dunst.nix diff --git a/configuration.nix b/configuration.nix index a121b61..7c149f2 100644 --- a/configuration.nix +++ b/configuration.nix @@ -93,6 +93,11 @@ tree ]; }; + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; + configPackages = [ pkgs.xdg-desktop-portal-hyprland ]; + }; # List packages installed in system profile. To search, run: # $ nix search wget diff --git a/flake.lock b/flake.lock index 0380682..faa899d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1696158499, + "narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -21,6 +37,25 @@ "type": "github" } }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1707825078, + "narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1714465198, @@ -53,6 +88,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1697935651, + "narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1713248628, @@ -72,6 +122,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nix-colors": "nix-colors", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" diff --git a/flake.nix b/flake.nix index e80abd6..0bce994 100644 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,14 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + nix-colors.url = "github:misterio77/nix-colors"; home-manager = { url = github:nix-community/home-manager/release-23.11; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, ... }@inputs: + outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, nix-colors, ... }@inputs: let username = "chrigi"; lib = nixpkgs.lib; @@ -35,7 +36,7 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.${username} = import ./home.nix; - home-manager.extraSpecialArgs = {inherit pkgs-unstable username; }; + home-manager.extraSpecialArgs = {inherit pkgs-unstable username nix-colors; }; } ]; }; diff --git a/home.nix b/home.nix index 4bdfb43..6a8bd50 100644 --- a/home.nix +++ b/home.nix @@ -1,9 +1,12 @@ -{ config, pkgs, pkgs-unstable, username, ... }: +{ config, pkgs, pkgs-unstable, nix-colors, username, ... }: { imports = [ + nix-colors.homeManagerModules.default + ./modules/dunst.nix ./hyperland ]; + colorScheme = nix-colors.colorSchemes.gruvbox-material-dark-hard; # TODO please change the username & home directory to your own home.username = "${username}"; diff --git a/hyperland/default.nix b/hyperland/default.nix index d4cf163..5439b3e 100644 --- a/hyperland/default.nix +++ b/hyperland/default.nix @@ -1,9 +1,26 @@ { config, pkgs, pkgs-unstable, username, ... }: { + home.packages = with pkgs; [ + dunst + waybar + swww + rofi + # (pkgs.waybar.overrideAttrs (oldAttrs: { + # mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; + # })) + ]; + + wayland.windowManager.hyprland.enable = true; wayland.windowManager.hyprland.settings = { + "$mod" = "SUPER"; + exec-once = [ + "dunst" + "waybar" + ]; + bind = [ "$mod, F, exec, firefox" diff --git a/modules/dunst.nix b/modules/dunst.nix new file mode 100644 index 0000000..0980d59 --- /dev/null +++ b/modules/dunst.nix @@ -0,0 +1,100 @@ +{ + inputs, + config, + ... +}:{ + services.dunst = { + enable = true; + settings = { + global = { + background = "#${config.colorScheme.palette.base00}"; + foreground = "#${config.colorScheme.palette.base06}"; + monitor = 0; + follow = "mouse"; + width = "(0,600)"; + height = 350; + progress_bar = true; + progress_bar_height = 25; + progress_bar_frame_width = 3; + progress_bar_min_width = 460; + progress_bar_max_width = 480; + highlight = "#79dcaa"; + indicate_hidden = true; + shrink = true; + transparency = 5; + separator_height = 5; + padding = 10; + horizontal_padding = 10; + frame_width = 0; + frame_color = "#${config.colorScheme.palette.base06}"; + sort = true; + idle_threshold = 0; + font = "JetBrains Mono Nerd Font 13"; + line_height = 2; + markup = "full"; + origin = "top-right"; + offset = "10x10"; + format = "%s''\n%b"; + alignment = "left"; + show_age_threshold = 60; + word_wrap = true; + ignore_newline = true; + stack_duplicates = true; + hide_duplicate_count = false; + show_indicators = true; + icon_position = "left"; + max_icon_size = 86; + min_icon_size = 32; + icon_theme = "Papirus"; + enable_recursive_icon_lookup = true; + sticky_history = true; + history_length = 20; + browser = "firefox"; + always_run_script = true; + title = "Dunst"; + class = "Dunst"; + corner_radius = 10; + icon_corner_radius= 5; + notification_limit = 5; + mouse_left_click = "close_current"; + mouse_middle_click = "do_action"; + mouse_right_click = "context_all"; + ignore_dbusclose = true; + ellipsize = "middle"; + }; + + urgency_normal = { + timeout = 6; + background = "#${config.colorScheme.palette.base00}"; + frame_color = "#${config.colorScheme.palette.base07}"; + foreground = "#${config.colorScheme.palette.base06}"; + }; + urgency_low = { + timeout = 2; + background = "#${config.colorScheme.palette.base00}"; + frame_color = "#${config.colorScheme.palette.base07}"; + foreground = "#${config.colorScheme.palette.base06}"; + }; + urgency_critical = { + timeout = 30; + background = "#${config.colorScheme.palette.base00}"; + frame_color = "#${config.colorScheme.palette.base07}"; + foreground = "#${config.colorScheme.palette.base06}"; + }; + fullscreen_show_critical = { + msg_urgency = "critical"; + fullscreen = "pushback"; + }; + network = { + appname = "network"; + new_icon = "network"; + summary = "*"; + format = "%s''\n%b"; + }; + NetworkManager_Applet = { + appname = "NetworkManager Applet"; + new_icon = "network-wireless"; + }; + }; + }; +} \ No newline at end of file