Skip to content

Commit ebca62d

Browse files
Merge pull request #7 from randomizedcoder/2024_08_06
2024 08 06
2 parents cfb75a6 + f096cdb commit ebca62d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3459
-223
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
.PHONY: all
55

6-
all: hp0 hp3
6+
all: hp0 hp3 hp4
77

88
hp0:
99
scp -C ./hp0/* hp0:
@@ -15,5 +15,10 @@ hp3:
1515
scp -C ./modules/* hp3:
1616
scp -C ./scripts/* hp3:
1717

18+
hp4:
19+
scp -C ./hp4/* hp4:
20+
scp -C ./modules/* hp4:
21+
scp -C ./scripts/* hp4:
22+
1823
#
1924
# end

containers/bootstrap/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# https://github.com/jhol/docker-nix-bootstrap/blob/master/flake.nix
3+
#
4+
show:
5+
nix flake show
6+
7+
buildd:
8+
nix build '.#dockerImage'

containers/bootstrap/flake.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

containers/bootstrap/flake.nix

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
##
2+
## Copyright 2023 Joel Holdsworth
3+
##
4+
## Redistribution and use in source and binary forms, with or without
5+
## modification, are permitted provided that the following conditions are met:
6+
##
7+
## 1. Redistributions of source code must retain the above copyright notice, this
8+
## list of conditions and the following disclaimer.
9+
##
10+
## 2. Redistributions in binary form must reproduce the above copyright notice,
11+
## this list of conditions and the following disclaimer in the documentation
12+
## and/or other materials provided with the distribution.
13+
##
14+
## 3. Neither the name of the copyright holder nor the names of its contributors
15+
## may be used to endorse or promote products derived from this software without
16+
## specific prior written permission.
17+
##
18+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
19+
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
##
29+
30+
{
31+
inputs = {
32+
nixpkgs.url = "nixpkgs/nixos-24.05";
33+
flake-utils.url = "github:numtide/flake-utils";
34+
};
35+
36+
outputs = { self, nixpkgs, flake-utils }:
37+
flake-utils.lib.eachDefaultSystem (system:
38+
let
39+
pkgs = import nixpkgs { inherit system; };
40+
in {
41+
packages = rec {
42+
default = pkgs.dockerTools.buildLayeredImage {
43+
name = "docker-nix-bootstrap";
44+
tag = "latest";
45+
46+
copyToRoot = pkgs.buildEnv {
47+
name = "image-root";
48+
pathsToLink = [ "/bin" "/etc" "/tmp" "/var" ];
49+
paths = with pkgs; [
50+
bashInteractive
51+
cacert
52+
coreutils
53+
git
54+
nix
55+
skopeo
56+
(pkgs.fakeNss.override {
57+
extraPasswdLines = [
58+
"nixbld1:x:997:996:Nix build user 1:/var/empty:/usr/sbin/nologin"
59+
"nobody:x:65534:65524:nobody:/var/empty:/bin/sh"
60+
];
61+
extraGroupLines = [
62+
"nixbld:x:996:nixbld1"
63+
"nobody:x:65534:"
64+
];
65+
})
66+
(writeTextDir "etc/nix/nix.conf" ''
67+
sandbox = false
68+
experimental-features = nix-command flakes
69+
'')
70+
(writeTextDir "etc/containers/policy.json" ''
71+
{ "default" : [ { "type": "insecureAcceptAnything" } ] }
72+
'')
73+
(runCommand "tmp" { } "mkdir -p $out/tmp $out/var/tmp")
74+
dockerTools.caCertificates
75+
];
76+
};
77+
78+
config = {
79+
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
80+
Env = [
81+
"NIX_PAGER=cat"
82+
"USER=nobody"
83+
];
84+
};
85+
};
86+
};
87+
88+
devShells = {
89+
default = pkgs.mkShell {
90+
buildInputs = with pkgs; [
91+
skopeo
92+
];
93+
};
94+
};
95+
});
96+
}
97+

containers/bootstrap/my.flake.nix

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
##
2+
## Copyright 2023 Joel Holdsworth
3+
##
4+
## Redistribution and use in source and binary forms, with or without
5+
## modification, are permitted provided that the following conditions are met:
6+
##
7+
## 1. Redistributions of source code must retain the above copyright notice, this
8+
## list of conditions and the following disclaimer.
9+
##
10+
## 2. Redistributions in binary form must reproduce the above copyright notice,
11+
## this list of conditions and the following disclaimer in the documentation
12+
## and/or other materials provided with the distribution.
13+
##
14+
## 3. Neither the name of the copyright holder nor the names of its contributors
15+
## may be used to endorse or promote products derived from this software without
16+
## specific prior written permission.
17+
##
18+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
19+
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
##
29+
30+
{
31+
inputs = {
32+
nixpkgs.url = "nixpkgs/nixos-24.05";
33+
};
34+
35+
outputs = { self, nixpkgs, utils }:
36+
utils.lib.eachDefaultSystem (system:
37+
let
38+
pkgs = import nixpkgs { inherit system; };
39+
in {
40+
packages = rec {
41+
default = pkgs.dockerTools.buildImageWithNixDb {
42+
name = "docker-nix-bootstrap";
43+
tag = "latest";
44+
45+
copyToRoot = pkgs.buildEnv {
46+
name = "image-root";
47+
pathsToLink = [ "/bin" "/etc" "/tmp" "/var" ];
48+
paths = with pkgs; [
49+
bashInteractive
50+
cacert
51+
coreutils
52+
git
53+
nix
54+
skopeo
55+
(pkgs.fakeNss.override {
56+
extraPasswdLines = [
57+
"nixbld1:x:997:996:Nix build user 1:/var/empty:/usr/sbin/nologin"
58+
"nobody:x:65534:65524:nobody:/var/empty:/bin/sh"
59+
];
60+
extraGroupLines = [
61+
"nixbld:x:996:nixbld1"
62+
"nobody:x:65534:"
63+
];
64+
})
65+
(writeTextDir "etc/nix/nix.conf" ''
66+
sandbox = false
67+
experimental-features = nix-command flakes
68+
'')
69+
(writeTextDir "etc/containers/policy.json" ''
70+
{ "default" : [ { "type": "insecureAcceptAnything" } ] }
71+
'')
72+
(runCommand "tmp" { } "mkdir -p $out/tmp $out/var/tmp")
73+
dockerTools.caCertificates
74+
];
75+
};
76+
77+
config = {
78+
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
79+
Env = [
80+
"NIX_PAGER=cat"
81+
"USER=nobody"
82+
];
83+
};
84+
};
85+
};
86+
87+
devShells = {
88+
default = pkgs.mkShell {
89+
buildInputs = with pkgs; [
90+
skopeo
91+
];
92+
};
93+
};
94+
});
95+
}
96+

containers/clickhouse/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.qcow2
2+
result

containers/clickhouse/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
all:
2+
nix-build clickhouse.nix
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ pkgs ? import <nixpkgs> { }
2+
, pkgsLinux ? import <nixpkgs> { system = "x86_64-linux"; }
3+
}:
4+
5+
pkgs.dockerTools.buildImage {
6+
name = "ch-docker";
7+
config = {
8+
Cmd = [ "${pkgs.clickhouse}/usr/bin/clickhouse-server" ];
9+
};
10+
}

containers/memcache/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.qcow2
2+
result

containers/memcache/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
all:
2+
nix-build memcache.nix
3+
load:
4+
docker load < result
5+
run:
6+
docker run -t memcached:latest

0 commit comments

Comments
 (0)