{ inputs ? import ../../inputs.nix {}}: self: super: let nixos-cosmic = inputs.cosmic-modules; cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); # Pinned unstable nixpkgs from cosmic-modules cosmicModulesLock = builtins.fromJSON (builtins.readFile "${nixos-cosmic}/flake.lock"); pinnedNixpkgsRev = cosmicModulesLock.nodes.nixpkgs.locked.rev; pinnedNixpkgsNarHash = cosmicModulesLock.nodes.nixpkgs.locked.narHash; futureNixpkgsSrc = builtins.fetchTarball { name = "nixpkgs"; url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgsRev}.tar.gz"; sha256 = pinnedNixpkgsNarHash; }; # Take rustPackages from pinned nixpkgs futureNixpkgs = import futureNixpkgsSrc { localSystem = self.stdenv.buildPlatform; config = self.config; } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { crossSystem = self.stdenv.hostPlatform; }); futureRustPackages = futureNixpkgs.rustPackages; # Create nixpkgs with future rust nixpkgsWithFutureRust = self.extend (futureSelf: futureSuper: { rustPackages = futureRustPackages; }); # Create cosmicPkgs that contains cosmic packages built from nixpkgs with future rust cosmicOverlay = cosmicSelf: cosmicSuper: builtins.listToAttrs ( builtins.map (v: {name = v; value = nixpkgsWithFutureRust.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs ); cosmicNixpkgs = import inputs.nixpkgs { localSystem = self.stdenv.buildPlatform; config = self.config; overlays = [ cosmicOverlay ]; } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { crossSystem = self.stdenv.hostPlatform; }); in builtins.listToAttrs ( builtins.map (v: {name = v; value = cosmicNixpkgs.${v};}) cosmicPkgsDirs )