Skip to content

Commit 69a161b

Browse files
committed
add cwiid and adafruit-blinka
1 parent ad8f2a0 commit 69a161b

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

nixos/adafruit-blinka/default.nix

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{ lib
2+
, pkgs
3+
}:
4+
let
5+
rpi-gpio = pkgs.callPackage ./rpi-gpio { };
6+
in
7+
with pkgs.python3Packages;
8+
buildPythonPackage rec {
9+
pname = "Adafruit-Blinka";
10+
version = "7.2.0";
11+
12+
src = fetchPypi {
13+
inherit pname;
14+
inherit version;
15+
sha256 = "1xsw4c01vzd4kwwg80mq7x850cc4nd289h3mpgyg3fzmhkfwnysj";
16+
};
17+
18+
nativeBuildInputs = [
19+
setuptools-scm
20+
];
21+
22+
propagatedBuildInputs = [
23+
setuptools
24+
adafruit-platformdetect
25+
adafruit-pureio
26+
rpi-gpio
27+
pyftdi
28+
sysv_ipc
29+
];
30+
31+
# Physical SMBus is not present
32+
#doCheck = false;
33+
pythonImportsCheck = [ "adafruit_blinka" ];
34+
35+
meta = with lib; {
36+
description = "Python interface to Linux IO including I2C and SPI";
37+
homepage = "https://github.com/adafruit/Adafruit_Python_PureIO";
38+
license = with licenses; [ mit ];
39+
maintainers = with maintainers; [ fab ];
40+
};
41+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{ lib
2+
, pkgs
3+
}:
4+
with pkgs.python3Packages;
5+
buildPythonPackage rec {
6+
pname = "RPi.GPIO";
7+
version = "0.7.1";
8+
9+
src = fetchPypi {
10+
inherit pname;
11+
inherit version;
12+
sha256 = "0w1v6zxi6ixaj1z5wag03333773lcacfmkss9ax2pdip7jqc8qfd";
13+
};
14+
15+
nativeBuildInputs = [
16+
setuptools-scm
17+
];
18+
19+
propagatedBuildInputs = [
20+
];
21+
22+
# Physical SMBus is not present
23+
#doCheck = false;
24+
pythonImportsCheck = [ "RPi.GPIO" ];
25+
26+
meta = with lib; {
27+
description = "Python interface to Linux IO including I2C and SPI";
28+
homepage = "https://github.com/adafruit/Adafruit_Python_PureIO";
29+
license = with licenses; [ mit ];
30+
maintainers = with maintainers; [ fab ];
31+
};
32+
}

nixos/configuration.nix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{ config, pkgs, lib, ... }:
2+
let
3+
adafruit-blinka = pkgs.callPackage ./adafruit-blinka { };
4+
in
25
{
36
boot.loader.grub.enable = false;
47

@@ -7,11 +10,16 @@
710
vim
811
htop bottom
912
git
10-
libgpiod gpio-utils
13+
gpio-utils
1114
i2c-tools
1215
evtest
16+
(cwiid.overrideAttrs (oldAttrs: {
17+
# needed for cross compilation
18+
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ bintools-unwrapped bison flex ];
19+
}))
1320
(python3.withPackages(ps: with ps;[
1421
adafruit-pureio
22+
adafruit-blinka
1523
pyserial
1624
evdev
1725
# quick fix for failing cross compilation
@@ -48,7 +56,7 @@
4856
};
4957

5058
services = {
51-
getty.autologinUser = "nixos";
59+
#getty.autologinUser = "nixos";
5260
openssh = {
5361
enable = true;
5462
# enable password authentication if no public key is set
@@ -63,6 +71,7 @@
6371
};
6472

6573
hardware.i2c.enable = true;
74+
hardware.bluetooth.enable = true;
6675

6776
fileSystems = {
6877
"/" = {

0 commit comments

Comments
 (0)