Skip to content

Commit

Permalink
Refactor fetchurl customizations for my mirror lists; just gryphel (m…
Browse files Browse the repository at this point in the history
…inivmac) for now
  • Loading branch information
Rhys-T committed Dec 11, 2024
1 parent 963273e commit b3ad992
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ in {
wine64Full = pkgs.wine64Packages.full;
});

fetchurlRhys-T = pkgs.lib.mirrorFunctionArgs pkgs.fetchurl (args: (pkgs.fetchurl args).overrideAttrs (old: {
mirrorsFile = old.mirrorsFile.overrideAttrs (old: self.myLib.mirrors);
}));

# _ciOnly.dev = pkgs.lib.optionalAttrs (pkgs.hostPlatform.system == "x86_64-darwin") (pkgs.lib.recurseIntoAttrs {
# checkpoint = pkgs.lib.recurseIntoAttrs (pkgs.lib.mapAttrs (k: pkgs.checkpointBuildTools.prepareCheckpointBuild) {
# inherit (self)
Expand Down
1 change: 1 addition & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ with pkgs.lib; {
# Add your library functions here
#
# hexint = x: hexvals.${toLower x};
mirrors = import ./mirrors.nix;
}
7 changes: 7 additions & 0 deletions lib/mirrors.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
gryphel = [
"https://www.gryphel.com/"
"http://www.gryphel.org/"
"https://minivmac.github.io/gryphel-mirror/"
];
}
15 changes: 3 additions & 12 deletions pkgs/minivmac/fetch.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ fetchurl, lib, version, hash }: let
{ fetchurlRhys-T, lib, version, hash }: let
versionChunks = (builtins.splitVersion version);
aIndex = (lib.findFirst (x: x.v == "a") null (lib.imap0 (i: v: {inherit i v;}) versionChunks)).i or null;
alphaNumber = builtins.elemAt versionChunks (aIndex+1);
Expand All @@ -7,15 +7,6 @@
else
"mirror://gryphel/d/minivmac/minivmac-${version}/minivmac-${version}.src.tgz"
;
gryphelMirrors = [
"https://www.gryphel.com/"
"http://www.gryphel.org/"
"https://minivmac.github.io/gryphel-mirror/"
];
in (fetchurl {
in fetchurlRhys-T {
inherit url hash;
}).overrideAttrs (old: {
postHook = (if old.postHook or null != null then old.postHook else "") + ''
gryphel=${lib.escapeShellArg (builtins.concatStringsSep " " gryphelMirrors)}
'';
})
}

0 comments on commit b3ad992

Please sign in to comment.