{
description = "DevShell for hinoirisetr";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{
nixpkgs,
rust-overlay,
...
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
overlays = [ (import rust-overlay) ];
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system overlays; });
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.rustPlatform.buildRustPackage {
pname = "hinoirisetr";
version = "1.6.2";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
postFixup = ''
patchelf $out/bin/hinoirisetr --add-rpath ${pkgs.libnotify}/lib
'';
postBuild = ''
pandoc manpages/hinoirisetr.1.md -s -t man -o $out/share/man/man1/hinoirisetr.1
'';
preBuild = ''
mkdir -p $out/share/man/man1
'';
nativeBuildInputs = [ pkgs.pandoc ];
buildInputs = [ pkgs.libnotify ];
};
}
);
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
rust = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-analyzer"
"rust-src"
];
};
in
{
default = pkgs.mkShell rec {
buildInputs = [
rust
pkgs.libnotify
pkgs.pandoc
];
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}";
'';
};
}
);
};
}