pkgs/overlay/cosmic-packages: build cosmic using locked nixpkgs

but with future rust

cosmic didn't work at all when I just made it using futureNixpkgs.
This commit is contained in:
Wroclaw 2024-08-08 16:47:36 +02:00
parent 6b1ea56d8b
commit 99a59bfb6b

View file

@ -1,5 +1,7 @@
{ inputs ? import ../../inputs.nix {}}:
self: super:
let
nixos-cosmic = inputs.cosmic-modules;
cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs";
@ -11,15 +13,26 @@ let
url = "https://github.com/NixOS/nixpkgs/archive/b79cec4237cd0f655562890bf927466c68b48d68.tar.gz";
sha256 = "1mswisq9iwffg2d6rfxvr27mvi4w853d9rn222s2g76445d0iqh8";
};
cosmicOverlay = self: super: builtins.listToAttrs (
builtins.map (v: {name = v; value = self.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs
# Take rustPackages from staging nixpkgs
stagingNixpkgs = import stagingNixpkgsSrc {
localSystem = self.stdenv.buildPlatform;
config = self.config;
} // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else {
crossSystem = self.stdenv.hostPlatform;
});
futureRustPackages = stagingNixpkgs.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
);
in
self: super:
let
stagingNixpkgs = import stagingNixpkgsSrc {
cosmicNixpkgs = import inputs.nixpkgs {
localSystem = self.stdenv.buildPlatform;
config = self.config;
overlays = [ cosmicOverlay ];
@ -29,5 +42,5 @@ stagingNixpkgs = import stagingNixpkgsSrc {
in
builtins.listToAttrs (
builtins.map (v: {name = v; value = stagingNixpkgs.${v};}) cosmicPkgsDirs
builtins.map (v: {name = v; value = cosmicNixpkgs.${v};}) cosmicPkgsDirs
)