Add build scripts for binary and docker image
This commit is contained in:
parent
7e3ca9c620
commit
94265ba39f
28
default.nix
Normal file
28
default.nix
Normal file
@ -0,0 +1,28 @@
|
||||
# { system ? builtins.currentSystem }:
|
||||
{ sources ? import ./nix/sources.nix
|
||||
, pkgs ? import sources.nixpkgs { }
|
||||
, callPackage ? pkgs.callPackage
|
||||
}:
|
||||
|
||||
let
|
||||
cargoNix = callPackage ./Cargo.nix { };
|
||||
|
||||
hoc = cargoNix.rootCrate.build;
|
||||
|
||||
buildInputs = [ pkgs.openssl pkgs.cacert ];
|
||||
|
||||
# version = hoc.version;
|
||||
|
||||
# in hoc.rootCrate.build
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = hoc.name;
|
||||
version = hoc.crateVersion;
|
||||
paths = [ hoc ];
|
||||
|
||||
buildInputs = [ pkgs.openssl pkgs.cacert ];
|
||||
|
||||
postBuild = ''
|
||||
rm -rf $out/bin/hoc.d
|
||||
'';
|
||||
}
|
24
docker.nix
Normal file
24
docker.nix
Normal file
@ -0,0 +1,24 @@
|
||||
# { system ? builtins.currentSystem }:
|
||||
|
||||
let
|
||||
# pkgs = import <nixpkgs> { inherit system; };
|
||||
pkgs = import <nixpkgs> { };
|
||||
|
||||
callPackage = pkgs.lib.callPackageWith pkgs;
|
||||
|
||||
hoc = callPackage ./default.nix { };
|
||||
|
||||
dockerImage = pkg:
|
||||
pkgs.dockerTools.buildImage {
|
||||
name = "vbrandl/hits-of-code";
|
||||
tag = hoc.version;
|
||||
|
||||
contents = [ pkg ];
|
||||
|
||||
config = {
|
||||
Cmd = [ "/bin/hoc" ];
|
||||
WorkingDir = "/";
|
||||
};
|
||||
};
|
||||
|
||||
in dockerImage hoc
|
Loading…
Reference in New Issue
Block a user