From 1700d0058809db5fa3bf64cdde79c1f417d760ea Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 1 Oct 2024 05:59:38 +0200 Subject: [PATCH] ci: Add default.nix with exposed pkgs Allows reusing it in more places --- ci/default.nix | 27 +++++++++++++++++++++++++++ shell.nix | 15 ++------------- 2 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 ci/default.nix diff --git a/ci/default.nix b/ci/default.nix new file mode 100644 index 000000000000..fb5ca04fe728 --- /dev/null +++ b/ci/default.nix @@ -0,0 +1,27 @@ +let + pinnedNixpkgs = builtins.fromJSON (builtins.readFile ./pinned-nixpkgs.json); +in +{ + system ? builtins.currentSystem, + + nixpkgs ? null, +}: +let + nixpkgs' = + if nixpkgs == null then + fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgs.rev}.tar.gz"; + sha256 = pinnedNixpkgs.sha256; + } + else + nixpkgs; + + pkgs = import nixpkgs' { + inherit system; + config = { }; + overlays = [ ]; + }; +in +{ + inherit pkgs; +} diff --git a/shell.nix b/shell.nix index 0722f4efd734..b8a9fe7df19f 100644 --- a/shell.nix +++ b/shell.nix @@ -11,23 +11,12 @@ # # nix-shell --arg nixpkgs ./. # -let - pinnedNixpkgs = builtins.fromJSON (builtins.readFile ci/pinned-nixpkgs.json); -in { system ? builtins.currentSystem, - - nixpkgs ? fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgs.rev}.tar.gz"; - sha256 = pinnedNixpkgs.sha256; - }, + nixpkgs ? null, }: let - pkgs = import nixpkgs { - inherit system; - config = { }; - overlays = [ ]; - }; + inherit (import ./ci { inherit nixpkgs system; }) pkgs; in pkgs.mkShellNoCC { packages = with pkgs; [