Skip to content

Commit

Permalink
Update nix and use an overlay
Browse files Browse the repository at this point in the history
This will:

- Fix and run `make nixpkgs` to update the dependencies
- Reduce duplication by using `overlay.nix`
- Pushed manually to cachix to refresh the build cache
- Switched to `pcre2` instead of `pcre`
- Removed `static.nix`, since it's not required any more

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert authored and haircommander committed Aug 15, 2023
1 parent 04cf7ba commit b0bdc23
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 153 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ endif
# Update nix/nixpkgs.json its latest stable commit
.PHONY: nixpkgs
nixpkgs:
@nix run -f channel:nixpkgs-unstable nix-prefetch-git -c nix-prefetch-git \
@nix run -f channel:nixpkgs-unstable nix-prefetch-git -- \
--no-deepClone https://github.com/nixos/nixpkgs > nix/nixpkgs.json

# Build statically linked binary
Expand Down
1 change: 1 addition & 0 deletions nix/default-amd64.nix
43 changes: 7 additions & 36 deletions nix/default-arm64.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
let
static = import ./static.nix;
pkgs = (import ./nixpkgs.nix {
crossSystem = { config = "aarch64-unknown-linux-gnu"; };
overlays = [
(final: pkg: {
pcre = (static pkg.pcre).overrideAttrs (x: {
configureFlags = x.configureFlags ++ [ "--enable-static" ];
});
})
];
config = {
packageOverrides = pkg: {
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
'';
});
};
};
});
self = import ./derivation.nix { inherit pkgs; };
in
self
(import ./nixpkgs.nix {
crossSystem = {
config = "aarch64-unknown-linux-gnu";
};
overlays = [ (import ./overlay.nix) ];
}).callPackage ./derivation.nix
{ }
43 changes: 7 additions & 36 deletions nix/default-ppc64le.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
let
static = import ./static.nix;
pkgs = (import ./nixpkgs.nix {
crossSystem = { config = "powerpc64le-unknown-linux-gnu"; };
overlays = [
(final: pkg: {
pcre = (static pkg.pcre).overrideAttrs (x: {
configureFlags = x.configureFlags ++ [ "--enable-static" ];
});
})
];
config = {
packageOverrides = pkg: {
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
'';
});
};
};
});
self = import ./derivation.nix { inherit pkgs; };
in
self
(import ./nixpkgs.nix {
crossSystem = {
config = "powerpc64le-unknown-linux-gnu";
};
overlays = [ (import ./overlay.nix) ];
}).callPackage ./derivation.nix
{ }
43 changes: 7 additions & 36 deletions nix/default-riscv64.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
let
static = import ./static.nix;
pkgs = (import ./nixpkgs.nix {
crossSystem = { config = "riscv64-unknown-linux-gnu"; };
overlays = [
(final: pkg: {
pcre = (static pkg.pcre).overrideAttrs (x: {
configureFlags = x.configureFlags ++ [ "--enable-static" ];
});
})
];
config = {
packageOverrides = pkg: {
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
'';
});
};
};
});
self = import ./derivation.nix { inherit pkgs; };
in
self
(import ./nixpkgs.nix {
crossSystem = {
config = "riscv64-unknown-linux-gnu";
};
overlays = [ (import ./overlay.nix) ];
}).callPackage ./derivation.nix
{ }
33 changes: 4 additions & 29 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,4 @@
{ system ? builtins.currentSystem }:
let
static = import ./static.nix;
pkgs = (import ./nixpkgs.nix {
overlays = [
(final: pkg: {
pcre = (static pkg.pcre).overrideAttrs (x: {
configureFlags = x.configureFlags ++ [ "--enable-static" ];
});
})
];
config = {
packageOverrides = pkg: {
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"
];
});
};
};
});
self = import ./derivation.nix { inherit pkgs; };
in
self
(import ./nixpkgs.nix {
overlays = [ (import ./overlay.nix) ];
}).callPackage ./derivation.nix
{ }
2 changes: 1 addition & 1 deletion nix/derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ with pkgs; stdenv.mkDerivation rec {
glibc
glibc.static
libseccomp
pcre
pcre2
];
prePatch = ''
export CFLAGS='-static -pthread'
Expand Down
10 changes: 6 additions & 4 deletions nix/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"url": "https://github.com/nixos/nixpkgs",
"rev": "15f5ec53d3a33a6d45c502fd8bae7e397fd1d3f6",
"date": "2021-07-29T08:45:37+02:00",
"path": "/nix/store/dalg8b7d1dv2bhvbk7bimzygfl4kmrzs-nixpkgs",
"sha256": "1npnxc86xzvzwliz028nf8a9c6qrbz6h08s23iaf4km51n3snsip",
"rev": "8353344d3236d3fda429bb471c1ee008857d3b7c",
"date": "2023-08-15T09:25:12+02:00",
"path": "/nix/store/r7sblbzjhxfl07r4l3nywhaprk3486zx-nixpkgs",
"sha256": "02431z7g8zmjrmqpmsxsnzz4r91cdl3a2sdz6kiqpsjalnlbxbv5",
"hash": "sha256-Za++qKVK6ovjNL9poQZtLKRM/re663pxzbJ+9M4Pgwg=",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
Expand Down
26 changes: 26 additions & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
self: super:
{
libseccomp = super.libseccomp.overrideAttrs (x: {
doCheck = false;
dontDisableStatic = true;
});
pcre2 = super.pcre2.overrideAttrs (x: {
configureFlags = x.configureFlags ++ [ "--enable-static" ];
});
glib = super.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
'';
});
}
10 changes: 0 additions & 10 deletions nix/static.nix

This file was deleted.

0 comments on commit b0bdc23

Please sign in to comment.