Commit efc5ae56 authored by Astro's avatar Astro
Browse files

gitlab-ci, nix: build a jailbroken release

parent cf64a490
nix:
l0dables:
stage: build
image: nixos/nix:latest
variables:
......@@ -6,9 +6,27 @@ nix:
script:
- nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs
- nix-channel --update
- nix-build -A firmware
- nix-build -A l0dables
- cp -r result/apps apps
artifacts:
paths:
- apps
expire_in: 1 week
firmware:
stage: build
image: nixos/nix:latest
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs
- nix-channel --update
- nix-build release.nix
- cp -r result/* .
artifacts:
paths:
- card10.bin
- apps
- main.py
- menu.py
expire_in: 1 week
From 93c318a284f7b0f3bce2046e1f631599190eaa10 Mon Sep 17 00:00:00 2001
From: Astro <astro@spaceboyz.net>
Date: Fri, 23 Aug 2019 19:44:45 +0200
Subject: [PATCH] feat(nix): add jailbreak arg
---
default.nix | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/default.nix b/default.nix
index dc9649bc..c49d0ab2 100644
--- a/default.nix
+++ b/default.nix
@@ -1,4 +1,8 @@
-with import <nixpkgs> {};
+{ pkgs ? import <nixpkgs> {},
+ jailbreak ? false,
+}:
+
+with pkgs;
let
py = python36;
@@ -12,6 +16,10 @@ let
sha256 = "15nkx0pa4lskwin84flpk8fsw3jqg6wic6v3s83syjqg76h6my61";
};
};
+ mesonOpt =
+ if jailbreak
+ then "-Djailbreak_card10=true"
+ else "";
in stdenv.mkDerivation rec {
name = "card10";
nativeBuildInputs = [
@@ -39,7 +47,7 @@ in stdenv.mkDerivation rec {
done
# Actually run the build.
- meson --cross-file card10-cross.ini "$build"
+ meson --cross-file card10-cross.ini ${mesonOpt} "$build"
ninja -C "$build" -j $NIX_BUILD_CORES
# Copy ELFs for debugging
--
2.22.0
......@@ -22,7 +22,7 @@ let
cp client.c server.c $out/
'';
};
firmware = rustPlatform.buildRustPackage rec {
l0dables = rustPlatform.buildRustPackage rec {
name = "rust-card10";
version = "0.0.0";
src = ./.;
......@@ -48,5 +48,5 @@ let
'';
};
in {
inherit rust rustPlatform firmware epic-stubs;
inherit rust rustPlatform l0dables epic-stubs;
}
{ pkgs ? import <nixpkgs> {},
jailbreak ? true,
}:
with pkgs;
let
cSrc = stdenv.mkDerivation {
name = "card10-src";
src = ./c;
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
patches = [
./0001-feat-nix-add-jailbreak-arg.patch
];
installPhase = ''
cp -ar . $out
'';
};
cFirmware = import "${cSrc}" { inherit pkgs jailbreak; };
rustL0dables = (import ./default.nix).l0dables;
release = stdenv.mkDerivation {
name = "card10-firmware";
buildInputs = [ cFirmware rustL0dables ];
phases = [ "installPhase" ];
installPhase = ''
mkdir $out
cp -r ${cFirmware}/card10/* $out/
chmod u+w $out/apps
cp ${rustL0dables}/apps/* $out/apps/
'';
};
in release
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment