Skip to content

Commit

Permalink
Reworked build structure for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
marzipankaiser committed Sep 17, 2019
1 parent 0131ff8 commit f3e62e0
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 23 deletions.
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: nix
nix: 2.3
services:
- docker
install:
- nix-build ./dockers.nix -A build-container
- docker load < ./result
script:
- docker run -u $(id -u) -v $(pwd):/build build-container bash -c "mkdir /build/tmp && cd /build && CURL_CA_BUNDLE='/etc/ssl/certs/ca-bundle.crt' TMP='/build/tmp' TMPDIR='/build/tmp' make all && rm -rf /build/tmp"
deploy:
provider: releases
api_key:
secure: A8UyD9OCK/Vi+hxa/OftYiI5w55SCqcBS34yXOcb+sMqPuMWu732lhhJ0uNFmTfK4a6aO717hdcIpC7aa/ERPOBpGmMbGXLoa1tdcfNPaYop497GjkimhMplC1f/rWkoHQR4lLEwUMWETavtkmKJ6un6Dc3VKIk7asFcPVSTlCqlzkr2vDVLPuqHRj79FAOYiYc2AH5UyrJo5G4oOfzT+eHKCj7f7OwkU3EZEftMTAzV2vHT9cIkz4LBBKkUW7T+5XQLctoHFDGeCkRUpfuNyIRTVK8XQRRv2bQekc8XSKT+U5VVmdMMHqjNgMvql620bKkzlvDkt/bLaTZGdhPCYUy0bPAfTdxHWoFPMAJAZxcWzqCbOtPviwA9Zx2Li55wV8ZVjOPrvYVrKJPP2HxVxxqjy2ofGNpGjwHCUZAnUZRAhLQT8ppIhNvdWcQdBzO4opk5QeTIoH3nnJYxs8PgKprLP2AAdWlCB8/XhmQMs732bYmptmZxsYYd7QDfLLqY15ZmavqC3iB88wFYNcbK+OBgVtjl3AYp7yX8kp6Jo38If7eT7coEa9gosj8LN60IWdo7wzh1YV/e5Bp1CSLVnCokYqLluZuwEFbJWoB5ECXOeirzkgb8KLZz3zDtyar8IdQyYo703dn+IMGHWNKXo2eyOj96CY0vDbLtp/3CyHA=
file_glob: true
file: packages/*
skip_cleanup: true
on:
branch: master
repo: FIUS/drinklist-cli
11 changes: 3 additions & 8 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
}:
with pkgs;
let
python-requirements = ps : with ps; [
numpy
requests
appdirs
];
python-package = (python3.withPackages python-requirements);
deps = import ./dependencies.nix { inherit pkgs; };
in
stdenvNoCC.mkDerivation rec {
name = "drinklist-cli";
Expand All @@ -22,8 +17,8 @@ stdenvNoCC.mkDerivation rec {
src = ./.;

dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ python-package ];
nativeBuildInputs = deps.nativeBuildDeps;
buildInputs = deps.buildDeps;
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/opt
Expand Down
36 changes: 36 additions & 0 deletions dependencies.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ pkgs, ... }:
rec {
pythonPackage = pkgs.python3.withPackages (ps: with ps; [
numpy
requests
appdirs
]);
buildDeps = with pkgs; [
pythonPackage
];
nativeBuildDeps = with pkgs; [
makeWrapper
];
baseSystem = with pkgs; [
# basics
bash coreutils findutils
binutils
openssl cacert curl
gnumake
gnused
gzip
gnugrep
binutils-unwrapped
file
gawk
gnutar
];
packageDeps = with pkgs; [
# general packaging
binutils git zip
# for deb packaging
dpkg
# for arch packaging
pacman libarchive fakeroot
];
}
17 changes: 17 additions & 0 deletions dockers.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ pkgs ? import <nixpkgs> {}
, buildImage ? pkgs.dockerTools.buildImage
, ...
}:
let
deps = import ./dependencies.nix { inherit pkgs; };
in
rec {
build-container = let
allDeps = deps.baseSystem ++ deps.packageDeps ++ deps.nativeBuildDeps ++ deps.buildDeps;
in buildImage {
name = "build-container";
tag = "latest";
contents = allDeps;
config.Env = [ "PATH=${builtins.concatStringsSep ":" (map (x:"${x}/bin/") allDeps)}" ];
};
}
19 changes: 4 additions & 15 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{ pkgs ? import <nixpkgs> {}
, ...
}:
with pkgs;
let
python-requirements = ps : with ps; [
numpy
requests
appdirs
];
python-package = (python3.withPackages python-requirements);
deps = import ./dependencies.nix { inherit pkgs; };
in
with pkgs;
stdenvNoCC.mkDerivation rec {
name = "drinklist-cli";

Expand All @@ -20,12 +15,6 @@ stdenvNoCC.mkDerivation rec {
};

dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
python-package
# for deb packaging
dpkg
# for arch packaging
pacman libarchive fakeroot
];
nativeBuildInputs = deps.nativeBuildDeps;
buildInputs = deps.packageDeps ++ deps.buildDeps ++ deps.packageDeps;
}

0 comments on commit f3e62e0

Please sign in to comment.