nixos-configuration/pkgs/overlays/unstable.nix
Wroclaw 88f348a2c9 pkgs/overlays: create, move unstable there
also in unstable: use nixpkgs option to define
if unstable nixpkgs expressions should be from
nixos or nixpkgs channel
(default true, use nixos channel)
2024-06-17 07:35:24 +02:00

36 lines
1.4 KiB
Nix

self: super:
let
nixos = self.config.nixos or true;
useUnstable = self.config.useUnstable or true;
unstablePkgsExprs = if nixos
then builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
else builtins.fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
# Compiled nixpkgs expression eg expressions from a nix channel
nixpkgsVersion = builtins.concatStringsSep "." [
(builtins.readFile "${unstablePkgsExprs}/.version")
(builtins.readFile "${unstablePkgsExprs}/.version-suffix")
];
nixpkgsRevision = (builtins.readFile "${unstablePkgsExprs}/.git-revision");
unstablePkgsForNixpkgs = nixpkgs: import unstablePkgsExprs {
# localSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.hostPlatform ???
localSystem = nixpkgs.stdenv.hostPlatform;
# crossSystem -> nixpkgs.stdenv.targetPlatform
crossSystem = nixpkgs.stdenv.targetPlatform;
# config -> pkgs.config
config = nixpkgs.config;
# overlays -> partial of pkgs.overlays
overlays = nixpkgs.overlays;
# crossOverlays -> partial of pkgs.overlays
# crossOverlays are merged to overlays, not sure what issues that might raise.
# ignoring.
};
in
{
unstable = if useUnstable then unstablePkgsForNixpkgs self else self;
unstableVersion = self.lib.optionalString useUnstable nixpkgsVersion;
unstableRevision = self.lib.optionalString useUnstable nixpkgsRevision;
}