pkgs/overlays/cosmic-packages: use packages constructor from upstream

This commit is contained in:
Wroclaw 2024-10-02 02:20:46 +02:00
parent e4813107c3
commit 667f7d8199

View file

@ -4,8 +4,6 @@ self: super:
let let
nixos-cosmic = inputs.cosmic-modules; 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 # Pinned unstable nixpkgs from cosmic-modules
cosmicModulesLock = builtins.fromJSON (builtins.readFile "${nixos-cosmic}/flake.lock"); cosmicModulesLock = builtins.fromJSON (builtins.readFile "${nixos-cosmic}/flake.lock");
@ -18,33 +16,17 @@ let
sha256 = pinnedNixpkgsNarHash; sha256 = pinnedNixpkgsNarHash;
}; };
# Take rustPackages from pinned nixpkgs # Initialize pinned nixpkgs
futureNixpkgs = import futureNixpkgsSrc { futureNixpkgs = import futureNixpkgsSrc {
localSystem = self.stdenv.buildPlatform; localSystem = self.stdenv.buildPlatform;
config = self.config; config = self.config;
} // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else {
crossSystem = self.stdenv.hostPlatform; 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 in
builtins.listToAttrs ( import "${nixos-cosmic}/pkgs" {
builtins.map (v: {name = v; value = cosmicNixpkgs.${v};}) cosmicPkgsDirs final = self;
) prev = super;
rustPlatform = futureNixpkgs.rustPlatform;
}