Skip to content

Commit

Permalink
gitOverride: refactorate (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroHLC authored Oct 7, 2023
1 parent ec71c7d commit d9fdadb
Show file tree
Hide file tree
Showing 29 changed files with 541 additions and 558 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rec {
schemas = import ./maintenance/schemas { flakes = inputs; };

# The stars: our overlay and our modules.
overlays.default = import ./overlays { flakes = inputs; selfOverlay = overlays.default; };
overlays.default = import ./overlays { flakes = inputs; };
nixosModules = import ./modules/nixos { flakes = inputs; };
homeManagerModules = import ./modules/home-manager { flakes = inputs; };

Expand Down
14 changes: 9 additions & 5 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# NOTE:
# - `*_next` packages will be removed once merged into nixpkgs-unstable.

{ flakes, selfOverlay }: final: prev:
{ flakes, self ? flakes.self, selfOverlay ? self.overlays.default }:
final: prev:
let
# Required to load version files.
inherit (final.lib.trivial) importJSON;
Expand Down Expand Up @@ -53,7 +54,12 @@ let
};

# Magic helper for _git packages.
gitOverride = import ../shared/git-override.nix { inherit (final) lib callPackage; };
gitOverride = import ../shared/git-override.nix {
inherit (final) lib callPackage fetchFromGitHub fetchFromGitLab;
nyx = self;
fetchRevFromGitHub = final.callPackage ../shared/github-rev-fetcher.nix { };
fetchRevFromGitLab = final.callPackage ../shared/gitlab-rev-fetcher.nix { };
};
in
{
inherit nyxUtils;
Expand Down Expand Up @@ -171,9 +177,7 @@ in
callOverride32 ../pkgs/mangohud-git { }
else throw "No mangohud32_git for non-x86";

mesa_git = callOverride ../pkgs/mesa-git {
gbmDriver = true;
};
mesa_git = callOverride ../pkgs/mesa-git { gbmDriver = true; };
mesa32_git =
if final.stdenv.hostPlatform.isLinux && final.stdenv.hostPlatform.isx86
then
Expand Down
34 changes: 16 additions & 18 deletions pkgs/alacritty-git/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{ final, prev, gitOverride, ... }:
{ prev, gitOverride, ... }:

gitOverride {
nyxKey = "alacritty_git";
versionNyxPath = "pkgs/alacritty-git/version.json";
versionLocalPath = ./version.json;
prev = prev.alacritty;
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitHub ({
owner = "alacritty";
repo = "alacritty";
} // finalArgs);
fetchLatestRev = src: final.callPackage ../../shared/github-rev-fetcher.nix { inherit src; ref = "master"; };

postOverrides = [
(prevAttrs: {
postInstall =
builtins.replaceStrings
[ "extra/alacritty.man" "extra/alacritty-msg.man" "install -Dm 644 alacritty.yml $out/share/doc/alacritty.yml" ]
[ "extra/alacritty.*" "extra/alacritty-msg.*" "" ]
prevAttrs.postInstall;
})
];
versionNyxPath = "pkgs/alacritty-git/version.json";
fetcher = "fetchFromGitHub";
fetcherData = {
owner = "alacritty";
repo = "alacritty";
};
ref = "master";

postOverride = prevAttrs: {
postInstall =
builtins.replaceStrings
[ "extra/alacritty.man" "extra/alacritty-msg.man" "install -Dm 644 alacritty.yml $out/share/doc/alacritty.yml" ]
[ "extra/alacritty.*" "extra/alacritty-msg.*" "" ]
prevAttrs.postInstall;
};
}
19 changes: 8 additions & 11 deletions pkgs/extra-cmake-modules-git/latest.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{ final, prev, gitOverride, ... }:

let
src = {
gitOverride {
nyxKey = "extra-cmake-modules_git";
prev = final.qt6.callPackage ./default.nix { };

versionNyxPath = "pkgs/extra-cmake-modules-git/version.json";
fetcher = "fetchFromGitLab";
fetcherData = {
domain = "invent.kde.org";
owner = "frameworks";
repo = "extra-cmake-modules";
};
in
gitOverride {
nyxKey = "extra-cmake-modules_git";
versionNyxPath = "pkgs/extra-cmake-modules-git/version.json";
versionLocalPath = ./version.json;
prev = final.qt6.callPackage ./default.nix { };
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitLab (src // finalArgs);
fetchLatestRev = _src: final.callPackage ../../shared/gitlab-rev-fetcher.nix { inherit src; ref = "master"; };
ref = "master";
}
26 changes: 15 additions & 11 deletions pkgs/gamescope-git/default.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{ final, prev, gitOverride, ... }:
{ prev, gitOverride, ... }:

gitOverride {
nyxKey = "gamescope_git";
versionNyxPath = "pkgs/gamescope-git/version.json";
versionLocalPath = ./version.json;
prev = prev.gamescope;
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitHub ({
owner = "ValveSoftware";
repo = "gamescope";
} // finalArgs);
fetchLatestRev = src: final.callPackage ../../shared/github-rev-fetcher.nix { inherit src; ref = "master"; };
hasSubmodules = true;
postOverrides = [ (_prevAttrs: { postUnpack = ""; }) ]; # erase wlroots replacement since we're fetching submodules.

versionNyxPath = "pkgs/gamescope-git/version.json";
fetcher = "fetchFromGitHub";
fetcherData = {
owner = "ValveSoftware";
repo = "gamescope";
fetchSubmodules = true;
};
ref = "master";

postOverride = _prevAttrs: {
# erase wlroots replacement since we're fetching submodules.
postUnpack = "";
};
}
42 changes: 18 additions & 24 deletions pkgs/glib-git/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
{ prev, final, nyxUtils, gitOverride, ... }:

let
srcMeta = {
gitOverride {
nyxKey = "glib_git";
prev = prev.glib;

versionNyxPath = "pkgs/glib-git/version.json";
fetcher = "fetchFromGitLab";
fetcherData = {
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "glib";
fetchSubmodules = true;
};
in
gitOverride {
nyxKey = "glib_git";
versionNyxPath = "pkgs/glib-git/version.json";
versionLocalPath = ./version.json;
prev = prev.glib;
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitLab (srcMeta // finalArgs);
fetchLatestRev = src: final.callPackage ../../shared/gitlab-rev-fetcher.nix { src = src // srcMeta; ref = "main"; };
hasSubmodules = true;

postOverrides = [
(prevAttrs: rec {
patches =
(nyxUtils.removeByBaseName "split-dev-programs.patch" prevAttrs.patches)
++ [
(final.fetchpatch {
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/8f5cf46a9b75b934323971b8bc9dc571888164f0/pkgs/development/libraries/glib/split-dev-programs.patch";
hash = "sha256-fPGXPBPMNdpwZn+VJMRTzDK2UX/0q09RAyigbIf2jq4=";
})
];
})
];
postOverride = prevAttrs: {
patches =
(nyxUtils.removeByBaseName "split-dev-programs.patch" prevAttrs.patches)
++ [
(final.fetchpatch {
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/8f5cf46a9b75b934323971b8bc9dc571888164f0/pkgs/development/libraries/glib/split-dev-programs.patch";
hash = "sha256-fPGXPBPMNdpwZn+VJMRTzDK2UX/0q09RAyigbIf2jq4=";
})
];
};
}
66 changes: 31 additions & 35 deletions pkgs/glibmm-git/default.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
{ prev, final, gitOverride, ... }:

let
srcMeta = {
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "glibmm";
};
in
gitOverride {
newInputs = with final; { glib = glib_git; };

nyxKey = "glibmm_git";
versionNyxPath = "pkgs/glibmm-git/version.json";
versionLocalPath = ./version.json;
prev = prev.glibmm_2_68;
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitLab (srcMeta // finalArgs);
fetchLatestRev = src: final.callPackage ../../shared/gitlab-rev-fetcher.nix { src = src // srcMeta; ref = "master"; };

postOverrides = [
(prevAttrs: rec {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with final; [
doxygen
graphviz-nox
libxslt
(mm-common.overrideAttrs (_prevAttrs: {
postInstall = ''
patchShebangs $out/bin
'';
}))
perl538
perl538Packages.XMLParser
python310
]);
mesonFlags = [
(final.lib.strings.mesonBool "maintainer-mode" true)
];
preConfigure = ''
patchShebangs tools
'';
})
];
versionNyxPath = "pkgs/glibmm-git/version.json";
fetcher = "fetchFromGitLab";
fetcherData = {
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "glibmm";
};
ref = "master";

postOverride = prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with final; [
doxygen
graphviz-nox
libxslt
(mm-common.overrideAttrs (_prevAttrs: {
postInstall = ''
patchShebangs $out/bin
'';
}))
perl538
perl538Packages.XMLParser
python310
]);
mesonFlags = [
(final.lib.strings.mesonBool "maintainer-mode" true)
];
preConfigure = ''
patchShebangs tools
'';
};
}
42 changes: 20 additions & 22 deletions pkgs/input-leap-git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@

gitOverride {
nyxKey = "input-leap_git";
versionNyxPath = "pkgs/input-leap-git/version.json";
versionLocalPath = ./version.json;
prev = prev.input-leap;
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitHub ({
owner = "input-leap";
repo = "input-leap";
} // finalArgs);
fetchLatestRev = src: final.callPackage ../../shared/github-rev-fetcher.nix { inherit src; ref = "master"; };

postOverrides = [
(prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with final; [
gtest
ghc_filesystem
]);
buildInputs = prevAttrs.buildInputs ++ (with final; [
libuuid
]);
cmakeFlags = [
"-DINPUTLEAP_USE_EXTERNAL_GTEST=ON"
];
})
];
versionNyxPath = "pkgs/input-leap-git/version.json";
fetcher = "fetchFromGitHub";
fetcherData = {
owner = "input-leap";
repo = "input-leap";
};
ref = "master";

postOverride = prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with final; [
gtest
ghc_filesystem
]);
buildInputs = prevAttrs.buildInputs ++ (with final; [
libuuid
]);
cmakeFlags = [
"-DINPUTLEAP_USE_EXTERNAL_GTEST=ON"
];
};
}
21 changes: 9 additions & 12 deletions pkgs/kf6coreaddons-git/latest.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{ final, prev, gitOverride, ... }:

let
src = {
domain = "invent.kde.org";
owner = "frameworks";
repo = "kcoreaddons";
};
in
gitOverride {
nyxKey = "kf6coreaddons_git";
versionNyxPath = "pkgs/kf6coreaddons-git/version.json";
versionLocalPath = ./version.json;
prev = final.qt6.callPackage ./default.nix {
extra-cmake-modules = final.extra-cmake-modules_git;
};
fetcher =
_prevAttrs: finalArgs: final.fetchFromGitLab (src // finalArgs);
fetchLatestRev = _src: final.callPackage ../../shared/gitlab-rev-fetcher.nix { inherit src; ref = "master"; };

versionNyxPath = "pkgs/kf6coreaddons-git/version.json";
fetcher = "fetchFromGitLab";
fetcherData = {
domain = "invent.kde.org";
owner = "frameworks";
repo = "kcoreaddons";
};
ref = "master";
}
Loading

0 comments on commit d9fdadb

Please sign in to comment.