From 3b97c44e1006452aa5b08731c5cc02aec6db853c Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Tue, 3 Oct 2023 16:50:21 +0200 Subject: [PATCH] Add a nix expression for easier development --- README.md | 4 +--- default.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 default.nix diff --git a/README.md b/README.md index 0c040b4..026b51c 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,8 @@ The used OLED display is from [Waveshare](https://www.waveshare.com/wiki/1.5inch ### Cross compile from NixOS x86_64 -Make sure to configure nixpkgs and [nur](https://github.com/nix-community/NUR) below. - ```bash -> nix-build -I nixpkgs=.../nixpkgs -I nur=.../nur-packages --arg crossSystem '(import ).systems.examples.muslpi' .../nur-packages -A raspi-oled-cross +> nix-build --arg crossSystem '(import ).systems.examples.muslpi' -E 'with import {}; pkgsCross.muslpi.callPackage ./. { }' > mkdir /tmp/nixstore > nix copy --extra-experimental-features nix-command --extra-experimental-features flakes --no-check-sigs --to /tmp/nixstore $(readlink -f result) > rsync -r --links --info=progress --compress /tmp/nixstore/nix pi@himbeere-null:~/ diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..30a41b2 --- /dev/null +++ b/default.nix @@ -0,0 +1,32 @@ +{ lib, fetchFromGitHub, rustPlatform, pkg-config, sqlite }: + +rustPlatform.buildRustPackage { + pname = "raspi-oled"; + version = "unstable-infdev-4"; + + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "ssd1351-0.3.0" = "sha256-K6QCU9qPEuU7Ur8W6fTdi4JWk8NsVz3mLfV0afpfdBA="; + # "gpio-am2302-rs-1.1.0" = "sha256-tyA/R80LtWIXoVEoxHhkmzy0IsMdMH1Oi3FTQ56XjyQ="; + }; + }; + + nativeBuildInputs = [ pkg-config ]; + + cargoBuildFlags = [ "--no-default-features" ]; + + buildInputs = [ sqlite ]; + + RUSTC_BOOTSTRAP = "1"; + + meta = with lib; { + description = "OLED display of clock/calendar/temperature"; + homepage = "https://github.com/FliegendeWurst/raspi-oled"; + license = licenses.mit; + maintainers = with maintainers; [ fliegendewurst ]; + }; +} +