Skip to content

Commit 3e3b488

Browse files
committed
tests: test nixpkgs.source
1 parent ae1fa0a commit 3e3b488

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

tests/main.nix

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
lib ? pkgs.lib,
77
linkFarm,
88
pkgs,
9-
pkgsUnfree,
109
self,
1110
system,
1211
}:
@@ -29,8 +28,10 @@ let
2928
inherit self system;
3029
inherit (self) inputs;
3130
};
31+
nixpkgs.config = {
32+
allowUnfree = true;
33+
};
3234
};
33-
pkgs = pkgsUnfree;
3435
};
3536

3637
# List of files containing configurations

tests/test-sources/modules/nixpkgs.nix

+24
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
inputs,
2929
system,
3030
pkgs,
31+
lib,
3132
...
3233
}:
3334
{
@@ -43,6 +44,8 @@
4344
];
4445
};
4546

47+
nixpkgs.config = lib.mkForce { };
48+
4649
nixpkgs.overlays = [
4750
(final: prev: {
4851
hello = "world";
@@ -71,4 +74,25 @@
7174
}
7275
];
7376
};
77+
78+
# Test that a nixpkgs revision can be specified using `nixpkgs.source`
79+
source =
80+
{ pkgs, ... }:
81+
{
82+
test.runNvim = false;
83+
84+
nixpkgs.source = builtins.fetchTarball {
85+
url = "https://github.com/NixOS/nixpkgs/archive/1807c2b91223227ad5599d7067a61665c52d1295.tar.gz";
86+
sha256 = "0xnj86751780hg1zhx9rjkbjr0sx0wps4wxz7zryvrj6hgwrng1z";
87+
};
88+
89+
assertions = [
90+
{
91+
assertion = pkgs.lib.version == "24.11pre-git";
92+
message = ''
93+
Expected `pkgs.lib.version` to be "24.11pre-git", but found "${pkgs.lib.version}"
94+
'';
95+
}
96+
];
97+
};
7498
}

0 commit comments

Comments
 (0)