nix-containers/flake.nix

51 lines
1.6 KiB
Nix
Raw Normal View History

2022-06-26 05:33:17 +00:00
{
description = "various nix-based docker containers";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
2022-06-26 08:08:00 +00:00
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs:
flake-utils.lib.eachSystem ["aarch64-linux" "x86_64-linux"] (system: let
pkgs = import nixpkgs {inherit system;};
in rec {
formatter = pkgs.alejandra;
packages = {
2022-06-27 15:53:08 +00:00
buildImage = pkgs.dockerTools.buildLayeredImageWithNixDb {
2022-06-26 08:08:00 +00:00
name = "darkkirb/nix-containers";
tag = "build-container";
contents = with pkgs; [
bashInteractive
gzip
skopeo
nix
2022-06-26 09:02:13 +00:00
coreutils
nixpkgs
2022-06-27 18:13:52 +00:00
git
2022-06-26 08:08:00 +00:00
];
config.Env = [
"USER=nobody"
];
maxLayers = 125;
2022-06-27 15:53:08 +00:00
enableFakechroot = true;
2022-06-26 08:08:00 +00:00
fakeRootCommands = ''
2022-06-27 15:53:08 +00:00
mkdir /etc/nix
2022-06-26 08:08:00 +00:00
echo "substituters = https://cache.nixos.org/ https://f000.backblazeb2.com/file/cache-chir-rs/" >> /etc/nix/nix.conf
echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" >> /etc/nix/nix.conf
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
mkdir /etc/containers
echo '{"default": [{"type":"insecureAcceptAnything"}]}' > /etc/containers/policy.json
2022-06-26 09:02:13 +00:00
mkdir -p /nix/inputs
ln ${nixpkgs} /nix/inputs/nixpkgs
2022-06-26 08:08:00 +00:00
'';
};
2022-06-26 05:33:17 +00:00
};
2022-06-26 08:08:00 +00:00
});
2022-06-26 05:33:17 +00:00
}