Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://github.com/user-attachments/assets/5c054ac3-90bb-483e-a8f2-5af191805f04
* [Debian](#debian)
* [Guix](#guix)
* [rde](#rde)
* [NixOS](#nixos)
* [Other](#other)
* [Sway Usage](#sway-usage)
* [Run](#run)
Expand Down Expand Up @@ -189,6 +190,41 @@ But we recommend to use [Guix Home](https://guix.gnu.org/manual/devel/en/html_no
(feature-swaynotificationcenter)
```

### nixOS

Add it as a flake:
```
swaync-flake.url = "github:ErikReider/SwayNotificationCenter" # use optional ?ref= to point to a particular version
```
And in your config:
```
# https://mynixos.com/home-manager/options/services.swaync
services.swaync = {
enable = true; # Starts the daemon and sets up the service
package = inputs.swaync-flake.packages.${pkgs.system}.default;

settings = {
positionX = "right";
positionY = "top";
control-center-margin-top = 10;
notification-icon-size = 64;
# Add widgets, timeouts, etc. here (full options via the schema link above)
widgets = [ "title" "dnd" "notifications" "mpris" "buttons-grid" ];
# Example toggle button
"buttons-grid" = {
actions = [
{
label = "WiFi";
type = "toggle";
command = "nmcli radio wifi off"; # Simplified example
}
];
};
};
};
```


### Other

#### Dependencies
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 107 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
description = "Flake for building SwayNotificationCenter";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib;

swaync = pkgs.stdenv.mkDerivation {
pname = "swaynotificationcenter";
version = "unstable-${self.shortRev or "dirty"}";

src = self;

nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
vala
gettext
blueprint-compiler
sassc
scdoc
cmake
wayland-scanner
git
wrapGAppsHook3
glib.bin
python3
libxml2
];

buildInputs = [
pkgs.glib.dev
pkgs.gtk4.dev
pkgs.libadwaita.dev
pkgs.pantheon.granite7.dev
pkgs.json-glib.dev
pkgs.libnotify.dev
pkgs.librsvg.dev
pkgs.pango.dev
pkgs.cairo.dev
pkgs.gtk4-layer-shell.dev
pkgs.libevdev
pkgs.libinput
pkgs.libpulseaudio
pkgs.wayland.dev
pkgs.wayland-protocols
];

# Patch the shebang to the Nix python interpreter
postPatch = ''
patchShebangs build-aux/meson/postinstall.py
'';

# Configure with meson
configurePhase = ''
runHook preConfigure
meson setup build \
--prefix=$out \
--libdir=lib \
--datadir=share \
-Dman-pages=true \
-Dsystemd-service=false
runHook postConfigure
'';

# Build with ninja
buildPhase = ''
runHook preBuild
ninja -C build
runHook postBuild
'';

# Install with ninja
installPhase = ''
runHook preInstall
ninja -C build install
runHook postInstall
'';

doCheck = false;

meta = with lib; {
description = "A GTK-based notification daemon for Sway";
homepage = "https://github.com/ErikReider/SwayNotificationCenter";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
};
};
in {
packages.default = swaync;

apps.default = flake-utils.lib.mkApp {
drv = swaync;
# If the binary name is known, set it explicitly:
# program = "${swaync}/bin/swaync";
};
});
}
Loading