docker-attic-nix/flake.nix

97 lines
2.3 KiB
Nix
Raw Normal View History

2024-09-01 09:52:21 +00:00
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
attic.url = "github:zhaofengli/attic";
};
outputs = { self, nixpkgs, flake-utils, attic }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
attic.overlays.default
];
};
gitReallyMinimal = (
pkgs.git.override {
perlSupport = false;
pythonSupport = false;
withManual = false;
withpcre2 = false;
}
).overrideAttrs (
_: {
# installCheck is broken when perl is disabled
doInstallCheck = false;
}
);
in
{
packages.default = pkgs.dockerTools.buildImageWithNixDb {
name = "docker-attic-nix";
tag = "latest";
copyToRoot = [
./root
gitReallyMinimal
(pkgs.writeTextFile {
name = "nix.conf";
destination = "/etc/nix/nix.conf";
text = ''
accept-flake-config = true
experimental-features = nix-command flakes
'';
})
] ++ (builtins.attrValues {
inherit (pkgs)
coreutils
bashInteractive
nix
cacert
gnutar
gzip
openssh
xz
nodejs
iana-etc
2024-09-01 09:52:56 +00:00
attic-client
docker;
2024-09-01 09:52:21 +00:00
});
extraCommands = ''
# for /usr/bin/env
mkdir usr
ln -s ../bin usr/bin
# make sure /tmp exists
mkdir -m 1777 tmp
# need a HOME
mkdir -vp root
'';
config = {
Cmd = [ "/bin/bash" ];
Env = [
"ENV=/etc/profile.d/nix.sh"
"BASH_ENV=/etc/profile.d/nix.sh"
"NIX_BUILD_SHELL=/bin/bash"
"NIX_PATH=nixpkgs=${./fake_nixpkgs}"
"PAGER=cat"
"PATH=/root/.nix-profile/bin:/nix/var/nix/profiles/per-user/root/profile/bin:/usr/bin:/bin"
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"USER=root"
];
};
};
});
}