Waybar/flake.nix

62 lines
2.0 KiB
Nix
Raw Normal View History

{
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
2023-12-01 18:10:19 +00:00
outputs = { self, nixpkgs, ... }:
let
inherit (nixpkgs) lib;
2023-12-01 18:10:19 +00:00
genSystems = func: lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
2023-12-01 18:10:19 +00:00
] (system: func (import nixpkgs { inherit system; }));
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in
{
2023-07-31 16:37:33 +00:00
overlays.default = final: prev: {
waybar = final.callPackage ./nix/default.nix {
2023-12-01 18:10:19 +00:00
# take the first "version: '...'" from meson.build
version =
(builtins.head (builtins.split "'"
(builtins.elemAt
(builtins.split " version: '" (builtins.readFile ./meson.build))
2)))
+ "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
2023-12-01 18:10:19 +00:00
packages = genSystems (pkgs:
let packages = self.overlays.default pkgs pkgs;
in packages // {
default = packages.waybar;
});
} //
2023-12-01 18:10:19 +00:00
genSystems (pkgs: {
devShells.default =
pkgs.mkShell {
name = "waybar-shell";
# most of these aren't actually used in the waybar derivation, this is just in case
# they will ever start being used
inherit (pkgs.waybar) buildInputs depsBuildBuild depsBuildBuildPropagated depsBuildTarget
depsBuildTargetPropagated depsHostHost depsHostHostPropagated depsTargetTarget
depsTargetTargetPropagated propagatedBuildInputs propagatedNativeBuildInputs strictDeps;
nativeBuildInputs = pkgs.waybar.nativeBuildInputs ++ (with pkgs; [
clang-tools
gdb
]);
};
});
}