eww/flake.nix

100 lines
2.5 KiB
Nix
Raw Normal View History

{
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-07-31 02:41:02 +03:00
outputs =
{
self,
nixpkgs,
rust-overlay,
flake-compat,
}:
let
2024-07-31 02:41:02 +03:00
overlays = [
(import rust-overlay)
self.overlays.default
];
pkgsFor = system: import nixpkgs { inherit system overlays; };
2022-08-15 11:56:05 +03:00
2024-07-31 02:41:02 +03:00
targetSystems = [
"aarch64-linux"
"x86_64-linux"
];
mkRustToolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
{
overlays.default = final: prev: { inherit (self.packages.${prev.system}) eww eww-wayland; };
2022-08-15 11:56:05 +03:00
2024-07-31 02:41:02 +03:00
packages = nixpkgs.lib.genAttrs targetSystems (
system:
let
pkgs = pkgsFor system;
rust = mkRustToolchain pkgs;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
2022-08-15 11:56:05 +03:00
};
2024-07-31 02:41:02 +03:00
version = (builtins.fromTOML (builtins.readFile ./crates/eww/Cargo.toml)).package.version;
in
rec {
eww = rustPlatform.buildRustPackage {
version = "${version}-dirty";
pname = "eww";
2022-08-15 11:56:05 +03:00
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
2024-07-31 02:41:02 +03:00
cargoBuildFlags = [
"--bin"
"eww"
];
2022-08-15 11:56:05 +03:00
2024-07-31 02:41:02 +03:00
nativeBuildInputs = with pkgs; [
pkg-config
wrapGAppsHook
];
buildInputs = with pkgs; [
gtk3
librsvg
gtk-layer-shell
libdbusmenu-gtk3
];
};
2024-07-31 02:41:02 +03:00
eww-wayland = nixpkgs.lib.warn "`eww-wayland` is deprecated due to eww building with both X11 and wayland support by default. Use `eww` instead." eww;
default = eww;
2024-07-31 02:41:02 +03:00
}
);
2022-08-15 11:56:05 +03:00
2024-07-31 02:41:02 +03:00
devShells = nixpkgs.lib.genAttrs targetSystems (
system:
let
pkgs = pkgsFor system;
rust = mkRustToolchain pkgs;
2024-07-31 02:41:02 +03:00
in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.eww ];
2024-07-31 02:41:02 +03:00
packages = with pkgs; [
deno
mdbook
zbus-xmlgen
2024-07-31 02:41:02 +03:00
];
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
};
2024-07-31 02:41:02 +03:00
}
);
2024-07-31 02:41:02 +03:00
formatter = nixpkgs.lib.genAttrs targetSystems (system: (pkgsFor system).nixfmt-rfc-style);
};
}