From f20db9aa1b247cc39c95455fb94d1facb09b7ca3 Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 23 Feb 2023 10:11:47 +1100 Subject: [PATCH] ci: pin nixpkgs to locked version instead of --- ci.nix | 2 +- flake-compat.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 flake-compat.nix diff --git a/ci.nix b/ci.nix index 8fc5b46..af1552f 100644 --- a/ci.nix +++ b/ci.nix @@ -9,7 +9,7 @@ # then your CI will be able to build and cache only those packages for # which this is possible. -{ pkgs ? import { } }: +{ pkgs ? import ./flake-compat.nix { src = ./.; } }: with builtins; diff --git a/flake-compat.nix b/flake-compat.nix new file mode 100644 index 0000000..68c4f5c --- /dev/null +++ b/flake-compat.nix @@ -0,0 +1,12 @@ +{ src, system ? builtins.currentSystem or "unknown-system" }: + +let + lockFilePath = "${src}/flake.lock"; + lockFile = builtins.fromJSON (builtins.readFile lockFilePath); + nixpkgs = lockFile.nodes.nixpkgs.locked; + tarball = fetchTarball { + url = "https://github.com/${nixpkgs.owner}/${nixpkgs.repo}/archive/${nixpkgs.rev}.zip"; + sha256 = nixpkgs.narHash; + }; +in +import tarball { inherit system; }