mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 11:10:47 +01:00
chore: add nix derivation
This commit is contained in:
18
README.md
18
README.md
@@ -7,6 +7,7 @@
|
||||
- [Structure](#structure)
|
||||
- [Documentation](#documentation)
|
||||
- [Add to project](#add-to-project)
|
||||
- [Nix flake](#nix-flake)
|
||||
- [Dependencies](#dependencies)
|
||||
- [Examples](#examples)
|
||||
- [Why?](#why)
|
||||
@@ -36,6 +37,23 @@ Type in:
|
||||
cargo add --git "https://github.com/szymon-jozef/libnotify-rs"
|
||||
```
|
||||
|
||||
### Nix flake
|
||||
For nix users, there is also a flake inside. If you want to use it add this to your flake:
|
||||
|
||||
```nix
|
||||
inputs = {
|
||||
libnotify-rs.url = "github:szymon-jozef/libnotify-rs";
|
||||
};
|
||||
```
|
||||
|
||||
And then to your derivation/devshell/wherever:
|
||||
|
||||
```Nix
|
||||
packages = [
|
||||
inputs.libnotify-rs.packages.${stdenv.system}.default
|
||||
];
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
To use this crate you need to have installed:
|
||||
- [libnotify](https://gitlab.gnome.org/GNOME/libnotify), duh (version 0.8.8 >= is supported)
|
||||
|
||||
59
flake.lock
generated
Normal file
59
flake.lock
generated
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788450739,
|
||||
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1790689126,
|
||||
"narHash": "sha256-VyUI5WA3WdOB9kjb04A0pxE6XTWC6cG95ZkoPSv58F0=",
|
||||
"rev": "b4fd65b198c599cbe814fcb9f42d25d021595ec9",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1082427.b4fd65b198c5/nixexprs.tar.zst"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1788057806,
|
||||
"narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
31
flake.nix
Normal file
31
flake.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
description = "Rust bindings for libnotify";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
# https://flake.parts/module-arguments.html
|
||||
flake-parts.lib.mkFlake { inherit inputs; } ({
|
||||
flake = {
|
||||
# Put your original flake attributes here.
|
||||
};
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
perSystem = { config, pkgs, ... }: {
|
||||
# Recommended: move all package definitions here.
|
||||
# e.g. (assuming you have a nixpkgs input)
|
||||
# packages.foo = pkgs.callPackage ./foo/package.nix { };
|
||||
# packages.bar = pkgs.callPackage ./bar/package.nix {
|
||||
# foo = config.packages.foo;
|
||||
# };
|
||||
packages.default = pkgs.callPackage ./package.nix { };
|
||||
};
|
||||
});
|
||||
}
|
||||
27
package.nix
Normal file
27
package.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
}:
|
||||
|
||||
let
|
||||
cargo = (fromTOML (builtins.readFile ./Cargo.toml));
|
||||
in
|
||||
|
||||
pkgs.rustPlatform.buildRustPackage {
|
||||
pname = cargo.package.name;
|
||||
version = cargo.package.version;
|
||||
|
||||
src = lib.cleanSource ./.;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
clang
|
||||
pkg-config
|
||||
rustPlatform.bindgenHook
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
libnotify.dev
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user