Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bin/crio.cross.%: .gopathok .explicit_phony
$(GO_BUILD) $(GO_LDFLAGS) -tags "containers_image_openpgp btrfs_noversion" -o "$@" $(PROJECT)/cmd/crio

nixpkgs:
@nix run -f channel:nixos-20.09 nix-prefetch-git -c nix-prefetch-git \
@nix run -f channel:nixpkgs-unstable nix-prefetch-git -c nix-prefetch-git \
--no-deepClone https://github.com/nixos/nixpkgs > nix/nixpkgs.json


Expand Down
79 changes: 7 additions & 72 deletions nix/default-arm64.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
let
static = import ./static.nix;

pkgs = (import ./nixpkgs.nix {
crossSystem = {
config = "aarch64-unknown-linux-gnu";
Expand All @@ -9,81 +11,14 @@ let
libassuan = (static pkg.libassuan);
libgpgerror = (static pkg.libgpgerror);
libseccomp = (static pkg.libseccomp);
glib = (static pkg.glib).overrideAttrs (x: {
outputs = [ "bin" "out" "dev" ];
mesonFlags = [
"-Ddefault_library=static"
"-Ddevbindir=${placeholder ''dev''}/bin"
"-Dgtk_doc=false"
"-Dnls=disabled"
];
postInstall = ''
moveToOutput "share/glib-2.0" "$dev"
substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev"
sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|"
sed '1i#line 1 "${x.pname}-${x.version}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \
-i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c
'';
});
gnupg = pkg.gnupg.override {
libusb1 = null;
pcsclite = null;
};
};
};
});

static = pkg: pkg.overrideAttrs (x: {
doCheck = false;
configureFlags = (x.configureFlags or [ ]) ++ [
"--without-shared"
"--disable-shared"
];
dontDisableStatic = true;
enableSharedExecutables = false;
enableStatic = true;
});

self = with pkgs; buildGoModule {
name = "cri-o";
src = ./..;
vendorSha256 = null;
doCheck = false;
enableParallelBuilding = true;
outputs = [ "out" ];
nativeBuildInputs = with buildPackages; [
bash
gitMinimal
go-md2man
installShellFiles
makeWrapper
pkg-config
which
];
buildInputs = [
glibc
glibc.static
gpgme
libassuan
libgpgerror
libseccomp
libapparmor
libselinux
];
prePatch = ''
export CFLAGS='-static -pthread'
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
export CGO_ENABLED=1
'';
buildPhase = ''
patchShebangs .
make bin/crio
make bin/crio-status
make bin/pinns
'';
installPhase = ''
install -Dm755 bin/crio $out/bin/crio
install -Dm755 bin/crio-status $out/bin/crio-status
install -Dm755 bin/pinns $out/bin/pinns
'';
};
self = import ./derivation.nix { inherit pkgs; };
in
self
58 changes: 9 additions & 49 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,61 +1,21 @@
{ system ? builtins.currentSystem }:
let
static = import ./static.nix;

pkgs = (import ./nixpkgs.nix {
config = {
packageOverrides = pkg: {
gpgme = (static pkg.gpgme);
libassuan = (static pkg.libassuan);
libgpgerror = (static pkg.libgpgerror);
libseccomp = (static pkg.libseccomp);
glib = (static pkg.glib).overrideAttrs(x: {
outputs = [ "bin" "out" "dev" ];
mesonFlags = [
"-Ddefault_library=static"
"-Ddevbindir=${placeholder ''dev''}/bin"
"-Dgtk_doc=false"
"-Dnls=disabled"
];
});
gnupg = pkg.gnupg.override {
libusb1 = null;
pcsclite = null;
};
};
};
});

static = pkg: pkg.overrideAttrs(x: {
doCheck = false;
configureFlags = (x.configureFlags or []) ++ [
"--without-shared"
"--disable-shared"
];
dontDisableStatic = true;
enableSharedExecutables = false;
enableStatic = true;
});

self = with pkgs; buildGoModule rec {
name = "cri-o";
src = ./..;
vendorSha256 = null;
doCheck = false;
enableParallelBuilding = true;
outputs = [ "out" ];
nativeBuildInputs = [ bash gitMinimal go-md2man installShellFiles makeWrapper pkg-config which ];
buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp libapparmor libselinux ];
prePatch = ''
export CFLAGS='-static -pthread'
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
'';
buildPhase = ''
patchShebangs .
make bin/crio
make bin/crio-status
make bin/pinns
'';
installPhase = ''
install -Dm755 bin/crio $out/bin/crio
install -Dm755 bin/crio-status $out/bin/crio-status
install -Dm755 bin/pinns $out/bin/pinns
'';
};
in self
self = import ./derivation.nix { inherit pkgs; };
in
self
46 changes: 46 additions & 0 deletions nix/derivation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ pkgs }:
with pkgs; buildGoModule {
name = "cri-o";
src = ./..;
vendorSha256 = null;
doCheck = false;
enableParallelBuilding = true;
outputs = [ "out" ];
nativeBuildInputs = with buildPackages; [
bash
gitMinimal
go-md2man
installShellFiles
makeWrapper
pkg-config
which
];
buildInputs = [
glibc
glibc.static
gpgme
libassuan
libgpgerror
libseccomp
libapparmor
libselinux
];
prePatch = ''
export CFLAGS='-static -pthread'
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
export CGO_ENABLED=1
'';
buildPhase = ''
patchShebangs .
make bin/crio
make bin/crio-status
make bin/pinns
'';
installPhase = ''
install -Dm755 bin/crio $out/bin/crio
install -Dm755 bin/crio-status $out/bin/crio-status
install -Dm755 bin/pinns $out/bin/pinns
'';
}
8 changes: 4 additions & 4 deletions nix/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"url": "https://github.com/nixos/nixpkgs",
"rev": "30c2fb65feaf1068b1c413a0b75470afd351c291",
"date": "2021-01-28T21:27:34-05:00",
"path": "/nix/store/zk71rlw37vg9hqc5j0vqi9x8qzb2ir0m-nixpkgs",
"sha256": "0b1y1lgzbagpgh9cvi9szkm162laifz0q2ss4pibns3j3gqpf5gl",
"rev": "d5bece83ba1adef9542e30ed250b1b1bb56b49cf",
"date": "2021-07-21T10:48:39+02:00",
"path": "/nix/store/3ff7rdqakhgnhizdzp8vjrlm6cvh2fn6-nixpkgs",
"sha256": "1sj99n6ni7q60psx1asiqxycsn4fk8jcwn9y86xkzs10fh8p83zg",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
Expand Down
10 changes: 10 additions & 0 deletions nix/static.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pkg: pkg.overrideAttrs (x: {
doCheck = false;
configureFlags = (x.configureFlags or [ ]) ++ [
"--without-shared"
"--disable-shared"
];
dontDisableStatic = true;
enableSharedExecutables = false;
enableStatic = true;
})