diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..2cccff28 --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +(import + ( + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { src = ./.; } +).defaultNix diff --git a/flake.lock b/flake.lock index 6d3b6b8e..b10c9bf7 100644 --- a/flake.lock +++ b/flake.lock @@ -6,11 +6,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1667210711, - "narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=", + "lastModified": 1676293499, + "narHash": "sha256-uIOTlTxvrXxpKeTvwBI1JGDGtCxMXE3BI0LFwoQMhiQ=", "owner": "numtide", "repo": "devshell", - "rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7", + "rev": "71e3022e3ab20bbf1342640547ef5bc14fb43bf4", "type": "github" }, "original": { @@ -19,6 +19,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1642700792, @@ -36,11 +52,11 @@ }, "flake-utils_2": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -67,11 +83,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1670152712, - "narHash": "sha256-LJttwIvJqsZIj8u1LxVRv82vwUtkzVqQVi7Wb8gxPS4=", + "lastModified": 1676300157, + "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "14ddeaebcbe9a25748221d1d7ecdf98e20e2325e", + "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462", "type": "github" }, "original": { @@ -84,6 +100,7 @@ "root": { "inputs": { "devshell": "devshell", + "flake-compat": "flake-compat", "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_2" } diff --git a/flake.nix b/flake.nix index d9091867..97f4ed57 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,13 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; devshell.url = "github:numtide/devshell"; flake-utils.url = "github:numtide/flake-utils"; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; }; - outputs = { self, flake-utils, devshell, nixpkgs }: + outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }: let inherit (nixpkgs) lib; genSystems = lib.genAttrs [ @@ -26,9 +30,9 @@ ]); in { - overlays.default = _: prev: rec { + overlays.default = _: prev: { waybar = prev.callPackage ./nix/default.nix { - version = "0.9.16" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + version = prev.waybar.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); }; }; packages = genSystems @@ -57,8 +61,32 @@ devshell.packages = with pkgs; [ clang-tools gdb - ]; - language.c.libraries = with pkgs; [ + # from nativeBuildInputs + gnumake + meson + ninja + pkg-config + scdoc + ] ++ (map lib.getDev [ + # from buildInputs + wayland wlroots gtkmm3 libsigcxx jsoncpp spdlog gtk-layer-shell howard-hinnant-date libxkbcommon + # optional dependencies + gobject-introspection glib playerctl python3.pkgs.pygobject3 + libevdev libinput libjack2 libmpdclient playerctl libnl + libpulseaudio sndio sway libdbusmenu-gtk3 udev upower wireplumber + + # from propagated build inputs? + at-spi2-atk atkmm cairo cairomm catch2 fmt_8 fontconfig + gdk-pixbuf glibmm gtk3 harfbuzz pango pangomm wayland-protocols + ]); + env = with pkgs; [ + { name = "CPLUS_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include"; } + { name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/lib/pkgconfig"; } + { name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/share/pkgconfig"; } + { name = "PATH"; prefix = "${wayland.bin}/bin"; } + { name = "LIBRARY_PATH"; prefix = "${lib.getLib sndio}/lib"; } + { name = "LIBRARY_PATH"; prefix = "${lib.getLib zlib}/lib"; } + { name = "LIBRARY_PATH"; prefix = "${lib.getLib howard-hinnant-date}/lib"; } ]; }; }); diff --git a/nix/default.nix b/nix/default.nix index 26654466..fc77225d 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,60 +1,11 @@ { lib -, stdenv -, fetchFromGitHub -, meson -, pkg-config -, ninja -, wrapGAppsHook -, wayland -, wlroots -, gtkmm3 -, libsigcxx -, jsoncpp -, scdoc -, spdlog -, gtk-layer-shell -, howard-hinnant-date -, libinotify-kqueue -, libxkbcommon -, evdevSupport ? true -, libevdev -, inputSupport ? true -, libinput -, jackSupport ? true -, libjack2 -, mpdSupport ? true -, libmpdclient -, nlSupport ? true -, libnl -, pulseSupport ? true -, libpulseaudio -, rfkillSupport ? true -, runTests ? true -, catch2_3 -, sndioSupport ? true -, sndio -, swaySupport ? true -, sway -, traySupport ? true -, libdbusmenu-gtk3 -, udevSupport ? true -, udev -, upowerSupport ? true -, upower -, wireplumberSupport ? true -, wireplumber -, withMediaPlayer ? false -, glib -, gobject-introspection -, python3 -, playerctl +, waybar , version }: -stdenv.mkDerivation rec { - pname = "waybar"; +waybar.overrideAttrs (prev: { inherit version; - # version = "0.9.16"; + # version = "0.9.17"; src = lib.cleanSourceWith { filter = name: type: @@ -66,74 +17,4 @@ stdenv.mkDerivation rec { ); src = lib.cleanSource ../.; }; - - nativeBuildInputs = [ - meson - ninja - pkg-config - scdoc - wrapGAppsHook - ] ++ lib.optional withMediaPlayer gobject-introspection; - - propagatedBuildInputs = lib.optionals withMediaPlayer [ - glib - playerctl - python3.pkgs.pygobject3 - ]; - strictDeps = false; - - buildInputs = with lib; - [ wayland wlroots gtkmm3 libsigcxx jsoncpp spdlog gtk-layer-shell howard-hinnant-date libxkbcommon ] - ++ optional (!stdenv.isLinux) libinotify-kqueue - ++ optional evdevSupport libevdev - ++ optional inputSupport libinput - ++ optional jackSupport libjack2 - ++ optional mpdSupport libmpdclient - ++ optional nlSupport libnl - ++ optional pulseSupport libpulseaudio - ++ optional sndioSupport sndio - ++ optional swaySupport sway - ++ optional traySupport libdbusmenu-gtk3 - ++ optional udevSupport udev - ++ optional upowerSupport upower - ++ optional wireplumberSupport wireplumber; - - checkInputs = [ catch2_3 ]; - doCheck = runTests; - - mesonFlags = (lib.mapAttrsToList - (option: enable: "-D${option}=${if enable then "enabled" else "disabled"}") - { - dbusmenu-gtk = traySupport; - jack = jackSupport; - libinput = inputSupport; - libnl = nlSupport; - libudev = udevSupport; - mpd = mpdSupport; - pulseaudio = pulseSupport; - rfkill = rfkillSupport; - sndio = sndioSupport; - tests = runTests; - upower_glib = upowerSupport; - wireplumber = wireplumberSupport; - } - ) ++ [ - "-Dsystemd=disabled" - "-Dgtk-layer-shell=enabled" - "-Dman-pages=enabled" - ]; - - preFixup = lib.optionalString withMediaPlayer '' - cp $src/resources/custom_modules/mediaplayer.py $out/bin/waybar-mediaplayer.py - wrapProgram $out/bin/waybar-mediaplayer.py \ - --prefix PYTHONPATH : "$PYTHONPATH:$out/${python3.sitePackages}" - ''; - - meta = with lib; { - description = "Highly customizable Wayland bar for Sway and Wlroots based compositors"; - license = licenses.mit; - maintainers = with maintainers; [ FlorianFranzen minijackson synthetica lovesegfault ]; - platforms = platforms.unix; - homepage = "https://github.com/alexays/waybar"; - }; -} +})