From d54fd744b86c35ce41952fc950f4383dc0a7d317 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sun, 24 Jul 2022 14:41:15 +0200 Subject: [PATCH] Initial commit --- .gitignore | 1 + README.md | 17 +++++++++++++++++ default.nix | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/README.md b/README.md new file mode 100644 index 0000000..e6f52ed --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# A lightweight Nix environment in a docker container + +This container is inteded to be used in a CI environment, +and especially with Drone CI. + +Build with: + +``` +docker load < $(nix-build) +``` + +## Notes + +Drone CI hardcodes the shell with `/bin/sh`, +so whatever the change you make to the container, +you must ensure that `/bin/sh` exists and works. + diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..519b252 --- /dev/null +++ b/default.nix @@ -0,0 +1,19 @@ +let + pkgsSrc = fetchTarball { + # As of 2022-07-19 + url = "https://github.com/NixOS/nixpkgs/archive/d2db10786f27619d5519b12b03fb10dc8ca95e59.tar.gz"; + sha256 = "0s9gigs3ylnq5b94rfcmxvrmmr3kzhs497gksajf638d5bv7zcl5"; + }; + pkgs = import pkgsSrc { }; +in + pkgs.dockerTools.buildImage { + name = "superboum/nixtainer"; + copyToRoot = pkgs.buildEnv { + name = "image-root"; + pathsToLink = [ "/bin" ]; + paths = [ + pkgs.nixStatic + pkgs.pkgsStatic.busybox + ]; + }; + }