forked from elkowar/eww
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
96 lines (87 loc) · 2.5 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
inputs = {
flake-compat.url = "github:edolstra/flake-compat/refs/pull/65/head";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
flake-compat,
}:
let
overlays = [
(import rust-overlay)
self.overlays.default
];
pkgsFor = system: import nixpkgs { inherit system overlays; };
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; };
packages = nixpkgs.lib.genAttrs targetSystems (
system:
let
pkgs = pkgsFor system;
rust = mkRustToolchain pkgs;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
};
version = (builtins.fromTOML (builtins.readFile ./crates/eww/Cargo.toml)).package.version;
in
rec {
eww = rustPlatform.buildRustPackage {
version = "${version}-dirty";
pname = "eww";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
cargoBuildFlags = [
"--bin"
"eww"
];
nativeBuildInputs = with pkgs; [
pkg-config
wrapGAppsHook
];
buildInputs = with pkgs; [
gtk3
librsvg
gtk-layer-shell
libdbusmenu-gtk3
];
};
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;
}
);
devShells = nixpkgs.lib.genAttrs targetSystems (
system:
let
pkgs = pkgsFor system;
rust = mkRustToolchain pkgs;
in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.eww ];
packages = with pkgs; [
deno
mdbook
zbus-xmlgen
];
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
};
}
);
formatter = nixpkgs.lib.genAttrs targetSystems (system: (pkgsFor system).nixfmt-rfc-style);
};
}