2019-07-05 19:43:28 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
systemd = {
|
|
|
|
services = {
|
|
|
|
"docker-build-fhs" = {
|
|
|
|
enable = true;
|
|
|
|
description = "Create fhs docker container";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
script = ''
|
|
|
|
mkdir -p /var/docker-fhs && cd /var/docker-fhs
|
|
|
|
cat > Dockerfile <<EOF
|
|
|
|
|
2019-07-09 11:34:02 +00:00
|
|
|
FROM ubuntu:disco
|
2019-07-05 19:43:28 +00:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
2019-07-09 11:34:02 +00:00
|
|
|
RUN apt update && apt upgrade -y && apt install -y wget gnupg
|
|
|
|
|
|
|
|
RUN echo 'deb http://apt.llvm.org/disco/ llvm-toolchain-disco main' \
|
|
|
|
>> /etc/apt/sources.list.d/llvm.list
|
|
|
|
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add -
|
|
|
|
RUN apt update
|
|
|
|
|
2019-07-10 07:53:14 +00:00
|
|
|
RUN apt install -y git libssl-dev bison flex bc build-essential gdb
|
2019-07-09 11:34:02 +00:00
|
|
|
RUN apt install -y libelf-dev python python3 zsh repo python3-pip
|
2019-07-10 07:53:14 +00:00
|
|
|
RUN apt install -y python3-opencv meson ninja-build cmake afl*
|
|
|
|
RUN apt install -y clang-9 lldb-9 llvm-9* libfuzzer-9-dev
|
2019-07-09 11:34:02 +00:00
|
|
|
RUN apt install -y pkg-config binutils-dev libunwind-dev
|
2019-07-12 17:06:25 +00:00
|
|
|
RUN apt install -y command-not-found libglib2.0-dev bsdmainutils
|
2019-07-05 19:43:28 +00:00
|
|
|
|
|
|
|
RUN groupmod users -g 100
|
|
|
|
RUN useradd user -u 1000 -g 100 -s /bin/zsh
|
|
|
|
|
|
|
|
RUN echo 'cd \$HOST_PWD' >> /etc/zsh/zshrc
|
|
|
|
|
|
|
|
CMD bash -c 'su user'
|
|
|
|
|
|
|
|
EOF
|
|
|
|
${pkgs.docker}/bin/docker build -t fhs .
|
|
|
|
'';
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|