Add a nix expression for easier development

This commit is contained in:
FliegendeWurst 2023-10-03 16:50:21 +02:00
parent c73ba50caf
commit 3b97c44e10
2 changed files with 33 additions and 3 deletions

View File

@ -20,10 +20,8 @@ The used OLED display is from [Waveshare](https://www.waveshare.com/wiki/1.5inch
### Cross compile from NixOS x86_64 ### Cross compile from NixOS x86_64
Make sure to configure nixpkgs and [nur](https://github.com/nix-community/NUR) below.
```bash ```bash
> nix-build -I nixpkgs=.../nixpkgs -I nur=.../nur-packages --arg crossSystem '(import <nixpkgs/lib>).systems.examples.muslpi' .../nur-packages -A raspi-oled-cross > nix-build --arg crossSystem '(import <nixpkgs/lib>).systems.examples.muslpi' -E 'with import <nixpkgs> {}; pkgsCross.muslpi.callPackage ./. { }'
> mkdir /tmp/nixstore > mkdir /tmp/nixstore
> nix copy --extra-experimental-features nix-command --extra-experimental-features flakes --no-check-sigs --to /tmp/nixstore $(readlink -f result) > 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:~/ > rsync -r --links --info=progress --compress /tmp/nixstore/nix pi@himbeere-null:~/

32
default.nix Normal file
View File

@ -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 ];
};
}