Skip to content
Open
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
26 changes: 26 additions & 0 deletions .github/workflows/buildAndCache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,29 @@ jobs:

- name: Build pebbleEnv
run: nix shell -f default.nix pebbleEnv --command sh -c "echo OK"

- name: 'Build reverse dependency: no-time-for-this'
run: |
REPO=https://github.com/nilp0inter/no-time-for-this
REV=45fa8581402955adc2b626a3f6509d8fa5701bb9
git clone --depth=1 --revision "$REV" "$REPO" revdeps/no-time-for-this
RDEP=path:revdeps/no-time-for-this
nix build -L "$RDEP" --override-input pebble "$GITHUB_WORKSPACE"

- name: 'Build reverse dependency: skunk'
run: |
REPO=https://github.com/unlobito/skunk
REV=dcd7db99a408b5de2d988e6729ce0daaa70f6137
git clone --depth=1 --revision "$REV" "$REPO" revdeps/skunk
RDEP=revdeps/skunk/default.nix
DIR=$GITHUB_WORKSPACE
nix build -L --impure --expr "import $RDEP { pebbleDotNixSrc = $DIR; }"

- name: 'Build reverse dependency: kijete'
run: |
REPO=https://github.com/yellowsink/kijete
REV=4818aaf57add82666496fb56de37574cf88cdc66
git clone --depth=1 --revision "$REV" "$REPO" revdeps/kijete
RDEP=revdeps/kijete/default.nix
DIR=$GITHUB_WORKSPACE
nix build -L --impure --expr "import $RDEP { pebbleDotNixSrc = $DIR; }"
26 changes: 15 additions & 11 deletions buildTools/buildPebbleApp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pkgs,
nixpkgs,
pebble-tool,
python-libs,
system,
}:

Expand Down Expand Up @@ -32,17 +31,18 @@ let
};

nodeEnv = (pkgs.callPackage ./nodeEnv { }).nodeDependencies;
pythonEnv = pkgs.python2.withPackages (
ps: with python-libs; [
ps.freetype-py
pythonEnv = pkgs.python3.withPackages (
ps: with ps; [
freetype-py
sh
pypng
]
);

pebble-sdk = pkgs.fetchzip {
url = "https://binaries.rebble.io/sdk-core/release/sdk-core-4.3.tar.bz2";
sha256 = "0p6x76rq5v9rb3j2fjdz1s2553n1yf5v2yhzxxp7g5220hmsk40j";
url = "https://sdk.core.store/releases/4.9.169/sdk-core.tar.gz";
sha256 = "sha256-y6xlDdKdMgIQS2rKbJaH5GjV95U76ISZetNA0RdXL0E=";
stripRoot = false;
};

stringNotEmpty = str: builtins.isString str && str != "";
Expand Down Expand Up @@ -148,19 +148,23 @@ pkgsCross.gccStdenv.mkDerivation (
''
# Setup Pebble SDK
export HOME=`pwd`/home-dir
SDK_ROOT=$HOME/.pebble-sdk/SDKs/4.3
SDK_DIR=$HOME/.pebble-sdk/SDKs
SDK_ROOT=$SDK_DIR/4.9.169
mkdir -p $SDK_ROOT/sdk-core
cp -r ${pebble-sdk}/* $SDK_ROOT/sdk-core
ln -s $SDK_ROOT $SDK_ROOT/../current
ln -s ${pythonEnv} $SDK_ROOT/.env
cp -r ${pebble-sdk}/sdk-core $SDK_ROOT/
ln -s $SDK_ROOT $SDK_DIR/current
ln -s ${pythonEnv} $SDK_ROOT/.venv
ln -s ${nodeEnv}/lib/node_modules $SDK_ROOT/node_modules

chmod -R u+w $HOME

# Point pebble-tool at our SDK location; tmp link uses $TMPDIR
export PEBBLE_SDK=$HOME/.pebble-sdk
''
+ postUnpack;

CFLAGS =
"-Wno-error=builtin-macro-redefined -Wno-error=builtin-declaration-mismatch -include sys/types.h "
"-Wno-error=builtin-macro-redefined -Wno-error=builtin-declaration-mismatch"
+ CFLAGS;

buildPhase = ''
Expand Down
9 changes: 9 additions & 0 deletions derivations/pebble-tool.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ python3Packages.buildPythonPackage rec {
hash = "sha256-quBDT7Sh14v7N47H1EVsvELT3Kb7Oo9CkKx/OfvOkFs=";
};

postPatch = ''
substituteInPlace pebble_tool/sdk/__init__.py --replace \
'tmp_link = "/var/tmp/pebble-sdk"' \
'tmp_link = os.path.join(os.environ.get("TMPDIR", "/tmp"), "pebble-sdk")'
substituteInPlace pebble_tool/util/__init__.py --replace \
'dir = os.path.expanduser("~/.pebble-sdk")' \
'dir = os.environ.get("PEBBLE_SDK", os.path.expanduser("~/.pebble-sdk"))'
'';

nativeBuildInputs = [ makeWrapper ];

buildInputs = [ nodejs ];
Expand Down
3 changes: 1 addition & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
system: pkgs:
import ./buildTools/buildPebbleApp.nix {
inherit pkgs nixpkgs system;
pebble-tool = packages.pebble-tool;
python-libs = pkgs.callPackage ./derivations/pebble-tool/python-libs.nix { };
inherit (pkgs) pebble-tool;
}
);

Expand Down