Use nixpkgs from flake.lock and support attrs when importing bscpkgs
This makes `nix-build` and friends use the current flake lock instead of the outdated pinned version we had in `./nixpkgs.nix` With this, `nix-build -A ovni` and `nix build .#ovni` should produce the same result. This will fail if the flake nixpkgs input does not come from NixOS/nixpkgs. We could use edolstra/flake-compat instead, but it's overkill imho. Additionally, I made default.nix behave like nixpkgs, so that we can import bscpkgs à la nixpkgs (Apply overlays and other options that nixpkgs accepts): ```nix let pkgs = import bscpkgs { inherit system; }; in <...> ``` Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
This commit is contained in:
parent
9d1944c658
commit
43d32ac16d
22
default.nix
22
default.nix
@ -1,11 +1,19 @@
|
|||||||
let
|
let
|
||||||
bscOverlay = import ./overlay.nix;
|
bscOverlay = import ./overlay.nix;
|
||||||
|
|
||||||
# Pin the nixpkgs
|
# read flake.lock and determine revision from there
|
||||||
nixpkgsPath = import ./nixpkgs.nix;
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
inherit (lock.nodes.nixpkgs.locked) rev narHash;
|
||||||
pkgs = import nixpkgsPath {
|
fetchedNixpkgs = builtins.fetchTarball {
|
||||||
overlays = [ bscOverlay ];
|
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
|
||||||
|
sha256 = narHash;
|
||||||
};
|
};
|
||||||
|
in
|
||||||
in pkgs
|
{ overlays ? [ ]
|
||||||
|
, nixpkgs ? fetchedNixpkgs
|
||||||
|
, ...
|
||||||
|
}@attrs:
|
||||||
|
import nixpkgs (
|
||||||
|
(builtins.removeAttrs attrs [ "overlays" "nixpkgs" ]) //
|
||||||
|
{ overlays = [ bscOverlay ] ++ overlays; }
|
||||||
|
)
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
let
|
|
||||||
commit = "e4ad989506ec7d71f7302cc3067abd82730a4beb";
|
|
||||||
in builtins.fetchTarball {
|
|
||||||
# Descriptive name to make the store path easier to identify
|
|
||||||
name = "nixpkgs-${commit}";
|
|
||||||
url = "https://github.com/nixos/nixpkgs/archive/${commit}.tar.gz";
|
|
||||||
# Hash obtained using `nix-prefetch-url --unpack <url>`
|
|
||||||
sha256 = "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=";
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user