rustybar/flake.nix

70 lines
2.1 KiB
Nix

{
description = "sway/i3bar command in Rust";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
# We don't need rust-analyzer so don't clone it
inputs.rust-analyzer-src.follows = "";
};
};
outputs = { self, nixpkgs, utils, fenix }:
let supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
in (utils.lib.eachSystem supportedSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};
toolchain = pkgs.fenix.complete;
rustPlatform =
pkgs.makeRustPlatform { inherit (toolchain) cargo rustc; };
in rec {
packages.rustybar = rustPlatform.buildRustPackage {
name = "rustybar";
version = "0.1";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
doCheck = false;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ dbus ];
meta = with pkgs.lib; {
homepage = "https://github.com/mildlyfunctionalgays/rustybar";
description = "swaybar/i3bar command in Rust";
maintainers = with maintainers; [ artemist ];
license = with licenses; [ mit ];
platforms = supportedSystems;
};
};
defaultPackage = packages.rustybar;
apps.rustybar = utils.lib.mkApp { drv = packages.rustybar; };
defaultApp = apps.rustybar;
devShells.rustybar = with pkgs;
mkShell {
packages = [
pkg-config
dbus
toolchain.cargo
toolchain.rustc
toolchain.rustfmt
toolchain.clippy
];
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib";
};
devShell = devShells.rustybar;
formatter = pkgs.nixfmt;
})) // {
overlays.default = final: prev: {
inherit (self.packages.${prev.system}) rustybar;
};
};
}