Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
nix: separate nixpkgs-unstable pin from nixpkgs pin for static binari…
Browse files Browse the repository at this point in the history
…es (#56959)

We want to get newer stuff in the devshell, but keep a stabler pin for the static binaries (until darwin stdenv stabilizes, most notably the big brain work over at NixOS/nixpkgs#256590)

## Test plan

N/A nix stuff :clueless:
  • Loading branch information
Strum355 authored Sep 22, 2023
1 parent 1e25781 commit 831c06c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
10 changes: 5 additions & 5 deletions dev/nix/nodejs.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ pkgs, fetchurl }:
pkgs.nodejs-16_x.overrideAttrs (oldAttrs: {
pkgs.nodejs-18_x.overrideAttrs (oldAttrs: {
# don't override version here, as it won't be in binary cache
# and building is super expensive
# version = "16.19.0";
Expand All @@ -13,12 +13,12 @@ pkgs.nodejs-16_x.overrideAttrs (oldAttrs: {
sha512 = "sha512-wRS8ap/SPxBqbUMzcUNkoA0suLqk9BqMlvi8dM2FRuhwUDgqVGYLc5jQ6Ww3uqVc+84zJvN2GYmTWCubaoWPtQ==";
};
};
typescript = oldAttrs.passthru.pkgs.typescript.override rec {
version = "4.9.5";
typescript = oldAttrs.passthru.pkgs.typescript.overrideAttrs (oldAttrs: rec {
version = "5.2.2";
src = fetchurl {
url = "https://registry.npmjs.org/typescript/-/typescript-${version}.tgz";
sha512 = "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==";
sha512 = "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==";
};
};
});
};
})
18 changes: 17 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 16 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,39 @@
description = "The Sourcegraph developer environment & packages Nix Flake";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/e78d25df6f1036b3fa76750ed4603dd9d5fe90fc";
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
# separate nixpkgs pin for more stable changes to binaries we build
nixpkgs-stable.url = "github:NixOS/nixpkgs/e78d25df6f1036b3fa76750ed4603dd9d5fe90fc";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, nixpkgs-stable, flake-utils }:
let
xcompileTargets = with nixpkgs.lib.systems.examples; {
"aarch64-darwin" = nixpkgs.legacyPackages.aarch64-darwin.pkgsx86_64Darwin;
"x86_64-darwin" = import nixpkgs { system = "x86_64-darwin"; crossSystem = aarch64-darwin; };
xcompileTargets = with nixpkgs-stable.lib.systems.examples; {
"aarch64-darwin" = nixpkgs-stable.legacyPackages.aarch64-darwin.pkgsx86_64Darwin;
"x86_64-darwin" = import nixpkgs-stable { system = "x86_64-darwin"; crossSystem = aarch64-darwin; };
};
inherit (import ./dev/nix/util.nix { inherit (nixpkgs) lib; }) xcompilify;
in
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgsBins = nixpkgs-stable.legacyPackages.${system};
pkgs' = import nixpkgs { inherit system; overlays = builtins.attrValues self.overlays; };
pkgsX = xcompileTargets.${system} or null;
in
{
legacyPackages = pkgs';

packages = xcompilify { inherit pkgs pkgsX; }
(pkgs: {
ctags = pkgs.callPackage ./dev/nix/ctags.nix { };
comby = pkgs.callPackage ./dev/nix/comby.nix { };
p4-fusion = pkgs.callPackage ./dev/nix/p4-fusion.nix { };
packages = xcompilify { inherit pkgsX; pkgs = pkgsBins; }
(p: {
ctags = p.callPackage ./dev/nix/ctags.nix { };
comby = p.callPackage ./dev/nix/comby.nix { };
p4-fusion = p.callPackage ./dev/nix/p4-fusion.nix { };
}) // {
nodejs-16_x = pkgs.callPackage ./dev/nix/nodejs.nix { };
# doesnt need the same stability as those above
nodejs-18_x = pkgs.callPackage ./dev/nix/nodejs.nix { };
};

# We use pkgs (not pkgs') intentionally to avoid doing extra work of
Expand All @@ -43,7 +47,7 @@
overlays = {
ctags = final: prev: { universal-ctags = self.packages.${prev.system}.ctags; };
comby = final: prev: { comby = self.packages.${prev.system}.comby; };
nodejs-16_x = final: prev: { nodejs-16_x = self.packages.${prev.system}.nodejs-16_x; };
nodejs-18_x = final: prev: { nodejs-16_x = self.packages.${prev.system}.nodejs-18_x; };
p4-fusion = final: prev: { p4-fusion = self.packages.${prev.system}.p4-fusion; };
};
};
Expand Down

0 comments on commit 831c06c

Please sign in to comment.