From 99a59bfb6b3edfa1ee0e75156521b3eddd15e651 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 16:47:36 +0200 Subject: [PATCH] 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. --- pkgs/overlays/cosmic-packages.nix | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 12d07d1..1722c18 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -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 )