pkgs/nixpkgs: move to by-name
This commit is contained in:
63
pkgs/by-name/nixpkgs/common.nix
Normal file
63
pkgs/by-name/nixpkgs/common.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
nix-update-script,
|
||||
localSystem,
|
||||
system,
|
||||
src,
|
||||
rev,
|
||||
doPatch,
|
||||
passthru ? {},
|
||||
}: let
|
||||
commonNixpkgsArgs = {
|
||||
inherit localSystem;
|
||||
# reset impurities
|
||||
config = {};
|
||||
overlays = [];
|
||||
};
|
||||
unpatchedNixpkgs = import src commonNixpkgsArgs;
|
||||
|
||||
patchedSrc = unpatchedNixpkgs.applyPatches {
|
||||
inherit src;
|
||||
name = "nixpkgs-patched-uninsane";
|
||||
# version = ...
|
||||
patches = unpatchedNixpkgs.callPackage ./list.nix { };
|
||||
# skip applied patches
|
||||
prePatch = ''
|
||||
realpatch=$(command -v patch)
|
||||
patch() {
|
||||
OUT=$($realpatch "$@") || echo "$OUT" | grep "Skipping patch" -q
|
||||
}
|
||||
'';
|
||||
};
|
||||
src' = if doPatch then patchedSrc else { outPath = src; };
|
||||
|
||||
args = commonNixpkgsArgs // {
|
||||
config = {
|
||||
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
|
||||
allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
|
||||
};
|
||||
} // (if (system != localSystem) then {
|
||||
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
|
||||
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
|
||||
crossSystem = system;
|
||||
} else {});
|
||||
|
||||
nixpkgs = import "${src'}" args;
|
||||
in
|
||||
# N.B.: this is crafted to allow `nixpkgs.FOO` from other nix code
|
||||
# AND `nix-build -A nixpkgs`
|
||||
if src' ? overrideAttrs then
|
||||
src'.overrideAttrs (base: {
|
||||
# attributes needed for update scripts
|
||||
pname = "nixpkgs";
|
||||
version = "24.05-unstable-2024-10-02";
|
||||
passthru = (base.passthru or {}) // nixpkgs // {
|
||||
src = src // {
|
||||
inherit rev;
|
||||
};
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [ "--version" "branch" ];
|
||||
};
|
||||
} // passthru;
|
||||
})
|
||||
else
|
||||
nixpkgs
|
@@ -37,62 +37,20 @@ let
|
||||
staging-next.rev = "dd89098d752fcd8af9c4e59a66b97af8e8fd185b";
|
||||
staging-next.sha256 = "sha256-L/g6FGwBe9yd7IXE4271e9ptU0Cb22ycA2I1Ymn+HTk=";
|
||||
};
|
||||
lock' = lock."${variant}";
|
||||
unpatchedSrc = fetchzip {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock'.rev}.tar.gz";
|
||||
inherit (lock') sha256;
|
||||
};
|
||||
commonNixpkgsArgs = {
|
||||
inherit localSystem;
|
||||
# reset impurities
|
||||
config = {};
|
||||
overlays = [];
|
||||
};
|
||||
unpatchedNixpkgs = import unpatchedSrc commonNixpkgsArgs;
|
||||
|
||||
patchedSrc = unpatchedNixpkgs.applyPatches {
|
||||
name = "nixpkgs-patched-uninsane";
|
||||
# version = ...
|
||||
src = unpatchedSrc;
|
||||
patches = unpatchedNixpkgs.callPackage ./list.nix { };
|
||||
# skip applied patches
|
||||
prePatch = ''
|
||||
realpatch=$(command -v patch)
|
||||
patch() {
|
||||
OUT=$($realpatch "$@") || echo "$OUT" | grep "Skipping patch" -q
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
src = if doPatch then patchedSrc else { outPath = unpatchedSrc; };
|
||||
args = commonNixpkgsArgs // {
|
||||
config = {
|
||||
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
|
||||
allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
|
||||
mkVariant = variant: args: let
|
||||
lock' = lock."${variant}";
|
||||
in import ./common.nix ({
|
||||
inherit doPatch localSystem nix-update-script system;
|
||||
inherit (lock') rev;
|
||||
src = fetchzip {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock'.rev}.tar.gz";
|
||||
inherit (lock') sha256;
|
||||
};
|
||||
} // (if (system != localSystem) then {
|
||||
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
|
||||
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
|
||||
crossSystem = system;
|
||||
} else {});
|
||||
} // args);
|
||||
|
||||
nixpkgs = import "${src}" args;
|
||||
in
|
||||
# N.B.: this is crafted to allow `nixpkgs.FOO` from other nix code
|
||||
# AND `nix-build -A nixpkgs`
|
||||
if src ? overrideAttrs then
|
||||
src.overrideAttrs (base: {
|
||||
# attributes needed for update scripts
|
||||
pname = "nixpkgs";
|
||||
version = "24.05-unstable-2024-10-02";
|
||||
passthru = (base.passthru or {}) // nixpkgs // {
|
||||
src = unpatchedSrc // {
|
||||
inherit (lock') rev;
|
||||
};
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [ "--version" "branch" ];
|
||||
};
|
||||
};
|
||||
})
|
||||
else
|
||||
nixpkgs
|
||||
mkVariant "master" {
|
||||
passthru.staging = mkVariant "staging" {};
|
||||
passthru.staging-next = mkVariant "staging-next" {};
|
||||
}
|
||||
|
@@ -32,8 +32,8 @@ let
|
||||
gpodder-adaptive-configured = gpodder-configured.override {
|
||||
gpodder = gpodder-adaptive;
|
||||
};
|
||||
nixpkgs-staging = nixpkgs.override { variant = "staging"; };
|
||||
nixpkgs-next = nixpkgs.override { variant = "staging-next"; };
|
||||
nixpkgs-staging = nixpkgs.staging;
|
||||
nixpkgs-next = nixpkgs.staging-next;
|
||||
inherit (trivial-builders)
|
||||
copyIntoOwnPackage
|
||||
deepLinkIntoOwnPackage
|
||||
|
Reference in New Issue
Block a user