add zstd tools to the base flake actions image to be able to run standard nix community actions

This commit is contained in:
Cyryl Płotnicki 2024-04-27 12:32:51 +01:00
parent 96f5f85a20
commit 09fcbbb6ee
2 changed files with 86 additions and 85 deletions

View file

@ -1,6 +1,8 @@
* `nix build '.#flakes-action' #for default platform * `nix build '.#flakes-action' #for default platform
* nix build '#packages.aarch64-linux.flakes-action' #for specific platform * nix build '#packages.aarch64-linux.flakes-action' #for specific platform
* `docker load < result` *
* `docker tag [image id] git.cyplo.dev/cyplo/base-images/flakes-action:latest` ```
* `docker push git.cyplo.dev/cyplo/base-images/flakes-action:latest` export BASE_IMAGE_DOCKER_TAG=`docker load < result | grep -i 'loaded image' | cut -f3 -d ' '`
docker tag $BASE_IMAGE_DOCKER_TAG git.cyplo.dev/cyplo/base-images/flakes-action:latest
docker push git.cyplo.dev/cyplo/base-images/flakes-action:latest
```

161
flake.nix
View file

@ -6,90 +6,89 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils }: outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem flake-utils.lib.eachDefaultSystem
(system: (system: let
let pkgs = import nixpkgs {inherit system;};
pkgs = import nixpkgs { inherit system; }; pkgsStatic = pkgs.pkgsStatic;
pkgsStatic = pkgs.pkgsStatic; lib = pkgs.lib;
lib = pkgs.lib; in {
packages = {
in hello = pkgs.dockerTools.buildImage {
{ name = "hello-docker";
packages = { config = {
hello = pkgs.dockerTools.buildImage { Cmd = ["${pkgs.hello}/bin/hello"];
name = "hello-docker"; };
config = { };
Cmd = [ "${pkgs.hello}/bin/hello" ]; flakes-action = pkgs.dockerTools.buildImageWithNixDb {
}; name = "flakes-action";
}; contents = with pkgs; [
flakes-action = pkgs.dockerTools.buildImageWithNixDb { ./root
name = "flakes-action"; bash
contents = with pkgs; [ cacert
./root coreutils
bash curl
coreutils gawk
curl gitFull
gawk git-lfs
gitFull gnused
git-lfs gnutar
gnused gzip
nodejs nixFlakes
wget nodejs
sudo openssh
nixFlakes sudo
cacert wget
gnutar xz
gzip zstd
openssh (pkgs.writeTextFile {
xz name = "nix.conf";
(pkgs.writeTextFile { destination = "/etc/nix/nix.conf";
name = "nix.conf"; text = ''
destination = "/etc/nix/nix.conf"; accept-flake-config = true
text = '' experimental-features = nix-command flakes
accept-flake-config = true
experimental-features = nix-command flakes
'';
})
];
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 = [
"LANG=en_GB.UTF-8"
"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=/usr/bin:/bin"
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"USER=root"
];
};
};
};
devShells = { extraCommands = ''
default = (pkgs.mkShell { # for /usr/bin/env
buildInputs = (with pkgs; mkdir usr
[ ln -s ../bin usr/bin
git-lfs
]);
}); # make sure /tmp exists
mkdir -m 1777 tmp
# need a HOME
mkdir -vp root
'';
config = {
Cmd = ["/bin/bash"];
Env = [
"LANG=en_GB.UTF-8"
"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=/usr/bin:/bin"
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"USER=root"
];
}; };
}); };
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
git-lfs
];
};
};
});
} }