-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
70 lines (63 loc) · 2.29 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
{
description = "Simple EWMH status listener that continuously gives json output of the current desktop state of an EWMH compatible window manager";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.flake-utils.follows = "flake-utils";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, flake-utils, nixpkgs, rust-overlay }:
let
inherit (builtins) substring;
inherit (nixpkgs) lib;
mtime = self.lastModifiedDate;
date = "${substring 0 4 mtime}-${substring 4 2 mtime}-${substring 6 2 mtime}";
mkEwmhStatusListener = { rustPlatform, xorg, ... }:
rustPlatform.buildRustPackage {
pname = "ewmh-status-listener";
version = "unstable-${date}";
src = self;
cargoLock = {
lockFile = self + "/Cargo.lock";
outputHashes."xcb-wm-0.4.0" = "sha256-KJtf7Ilyqg2aWYeSSXqThiHM5CupfsFsf4zhfMSEaBY=";
outputHashes."xcb-1.2.0" = "sha256-mjaFSH3/AmtXJUhNzpmwDoQgcqGvOpz28eSzkZkqrKU=";
};
buildInputs = [ xorg.libxcb ];
};
in
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
rustPkgs = rust-overlay.packages.${system};
in
{
packages = rec {
default = ewmh-status-listener;
ewmh-status-listener = pkgs.callPackage mkEwmhStatusListener { };
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; let
vers = lib.splitVersion rustc.version;
rustVersion = "${lib.elemAt vers 0}_${lib.elemAt vers 1}_${lib.elemAt vers 2}";
in
[
# Follows nixpkgs's version of rustc.
rustPkgs."rust_${rustVersion}"
nixpkgs-fmt
xorg.libxcb
];
RUST_BACKTRACE = "short";
NIXPKGS = nixpkgs;
};
})
// {
overlays = rec {
default = ewmh-status-listener;
ewmh-status-listener = final: prev: {
ewmh-status-listener = final.callPackage mkEwmhStatusListener { };
};
};
};
}