Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ compile with the latest stable Rust, I haven't tested older versions.
In addition, you'll need development libraries for the following, which can
probably be installed via your system package manager:

- clang
- glib
- gdk-pixbuf
- gdk-pixbuf (optional, provides support for non-PNG image formats)
- pam
- cairo
- pango
- pango (optional, provides support for system font loading)
- xkbcommon

gdk-pixbuf and pango are both optional, and are enabled with the features
`gdk-pixbuf` and `pango` respectively. These features are enabled by default,
you will need to disable them if you do not plan on using these libraries.

With all of that, you should just be able to clone this repository, and run:

```sh
Expand Down
13 changes: 13 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ fn main() {
long_version.push(')');
}

let mut features = Vec::new();
if cfg!(feature = "gdk-pixbuf") {
features.push("gdk-pixbuf");
}
if cfg!(feature = "pango") {
features.push("pango");
}
if !features.is_empty() {
long_version.push_str(" (");
long_version.push_str(features.join(" ").trim());
long_version.push(')');
}

println!("cargo:rustc-env=NLOCK_VERSION={version}");
println!("cargo:rustc-env=NLOCK_LONG_VERSION={long_version}");

Expand Down
12 changes: 9 additions & 3 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
pkg-config,
version ? "git",
shortRev ? "unknown",
gdkPixbufSupport ? true,
pangoSupport ? true,
}:

rustPlatform.buildRustPackage {
Expand All @@ -24,6 +26,10 @@ rustPlatform.buildRustPackage {
lockFile = ../Cargo.lock;
};

buildNoDefaultFeatures = true;
buildFeatures =
[ ] ++ (lib.optional gdkPixbufSupport "gdk-pixbuf") ++ (lib.optional pangoSupport "pango");

nativeBuildInputs = [
installShellFiles
clang
Expand All @@ -32,12 +38,12 @@ rustPlatform.buildRustPackage {

buildInputs = [
cairo
gdk-pixbuf
glib
libxkbcommon
pam
pango
];
]
++ (lib.optional gdkPixbufSupport gdk-pixbuf)
++ (lib.optional pangoSupport pango);

postInstall = ''
installShellCompletion --cmd nlock \
Expand Down
Loading