Files
infrastructure/monitors/monitor-tui-rs/flake.nix
2025-08-11 11:28:40 -06:00

60 lines
1.7 KiB
Nix

{
description = "GNOME Monitor TUI in Rust with runtime deps";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
naersk.url = "github:nix-community/naersk";
};
outputs = { self, nixpkgs, naersk }:
let
systems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
naersk' = pkgs.callPackage naersk { };
runtimeDeps = with pkgs; [
gnome-monitor-config
xorg.xrandr
bash
coreutils
];
in {
default = naersk'.buildPackage {
pname = "monitor-tui";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.makeWrapper ];
buildInputs = [ ];
postInstall = ''
wrapProgram $out/bin/monitor-tui \
--prefix PATH : ${pkgs.lib.makeBinPath runtimeDeps}
'';
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/monitor-tui";
};
});
devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; }; in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
rustc cargo rustfmt clippy rust-analyzer
gnome-monitor-config xorg.xrandr bash coreutils
];
shellHook = ''
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
'';
};
}
);
};
}