Files

127 lines
3.2 KiB
Nix
Raw Permalink Normal View History

2022-12-06 18:44:26 +01:00
{
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
2022-12-06 18:44:26 +01:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
2022-12-06 18:44:26 +01:00
};
2025-04-15 14:56:28 -05:00
outputs =
{ self, nixpkgs, ... }:
2022-12-06 18:44:26 +01:00
let
inherit (nixpkgs) lib;
2025-04-15 14:56:28 -05:00
genSystems =
func:
lib.genAttrs
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
func (
import nixpkgs {
inherit system;
overlays = with self.overlays; [
waybar
];
}
)
);
2022-12-06 18:44:26 +01:00
2025-04-15 14:56:28 -05:00
mkDate =
longDate:
(lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
2022-12-06 18:44:26 +01:00
in
{
2025-04-15 14:56:28 -05:00
devShells = genSystems (pkgs: {
default = pkgs.mkShell {
name = "waybar-shell";
2025-04-15 14:56:28 -05:00
# inherit attributes from upstream nixpkgs derivation
inherit (pkgs.waybar)
buildInputs
depsBuildBuild
depsBuildBuildPropagated
depsBuildTarget
depsBuildTargetPropagated
depsHostHost
depsHostHostPropagated
depsTargetTarget
depsTargetTargetPropagated
propagatedBuildInputs
propagatedNativeBuildInputs
strictDeps
;
2025-04-15 14:56:28 -05:00
# overrides for local development
nativeBuildInputs =
pkgs.waybar.nativeBuildInputs
++ (with pkgs; [
2025-08-12 13:28:07 -05:00
nixfmt
2025-04-15 14:56:28 -05:00
clang-tools
gdb
]);
};
});
2025-04-03 23:43:47 -05:00
formatter = genSystems (
pkgs:
pkgs.treefmt.withConfig {
2025-08-12 13:25:50 -05:00
settings = {
formatter = {
clang-format = {
options = [ "-i" ];
command = lib.getExe' pkgs.clang-tools "clang-format";
excludes = [ ];
includes = [
"*.c"
"*.cpp"
"*.h"
"*.hpp"
];
2025-04-03 23:43:47 -05:00
};
2025-08-12 13:25:50 -05:00
nixfmt = {
2025-08-12 13:28:07 -05:00
command = lib.getExe pkgs.nixfmt;
2025-08-12 13:25:50 -05:00
includes = [ "*.nix" ];
};
};
tree-root-file = ".git/index";
};
2025-04-03 23:43:47 -05:00
}
);
2024-05-02 23:31:39 -07:00
overlays = {
default = self.overlays.waybar;
waybar = final: prev: {
waybar = final.callPackage ./nix/default.nix {
waybar = prev.waybar;
# take the first "version: '...'" from meson.build
version =
2025-04-15 14:56:28 -05:00
(builtins.head (
builtins.split "'" (
builtins.elemAt (builtins.split " version: '" (builtins.readFile ./meson.build)) 2
)
))
+ "+date="
+ (mkDate (self.lastModifiedDate or "19700101"))
+ "_"
+ (self.shortRev or "dirty");
2024-05-02 23:31:39 -07:00
};
2022-12-06 18:44:26 +01:00
};
};
2024-05-02 23:31:39 -07:00
packages = genSystems (pkgs: {
default = self.packages.${pkgs.stdenv.hostPlatform.system}.waybar;
inherit (pkgs) waybar;
});
};
2022-12-06 18:44:26 +01:00
}