Merge pull request #20 from nix-community/stable-unstable-ci

Run build against both stable nix and nixUnstable in CI
This commit is contained in:
adisbladis 2022-01-08 08:17:00 +12:00 committed by GitHub
commit 63e728fcbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 32 deletions

View file

@ -1,6 +1,6 @@
{ stdenv { stdenv
, lib , lib
, nixUnstable , nix
, meson , meson
, cmake , cmake
, ninja , ninja
@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
src = if srcDir == null then filterMesonBuild ./. else srcDir; src = if srcDir == null then filterMesonBuild ./. else srcDir;
buildInputs = [ buildInputs = [
nlohmann_json nlohmann_json
nixUnstable nix
boost boost
]; ];
nativeBuildInputs = [ nativeBuildInputs = [

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1637014545, "lastModified": 1638122382,
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=", "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4", "rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -17,11 +17,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1639573498, "lastModified": 1641577433,
"narHash": "sha256-YAoywqjyjOJYuEZpA8sln84jk99GG9hYbPEYXwGEGGM=", "narHash": "sha256-T7lS8vpbC3dgtrkb2ueC9HWaX4RYUwdP7IEttnvKQ8Y=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "aef12c8678fd5e927edba764bd04f3ba2930ae15", "rev": "568e0bc498ee51fdd88e1e94089de05f2fdbd18b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -13,31 +13,38 @@
rec { rec {
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs; packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
checks = { checks =
let
mkVariant = nix: packages.nix-eval-jobs.overrideAttrs (_: {
name = "nix-eval-jobs-${nix.version}";
inherit (nix) version;
});
in
{
editorconfig = pkgs.runCommand "editorconfig-check" editorconfig = pkgs.runCommand "editorconfig-check"
{ {
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.editorconfig-checker pkgs.editorconfig-checker
]; ];
} '' } ''
editorconfig-checker ${self} editorconfig-checker ${self}
touch $out touch $out
''; '';
nixpkgs-fmt = pkgs.runCommand "fmt-check" nixpkgs-fmt = pkgs.runCommand "fmt-check"
{ {
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.nixpkgs-fmt pkgs.nixpkgs-fmt
]; ];
} '' } ''
nixpkgs-fmt --check . nixpkgs-fmt --check .
touch $out touch $out
''; '';
build = packages.nix-eval-jobs; build = mkVariant pkgs.nix;
build-unstable = mkVariant pkgs.nixUnstable;
}; };
defaultPackage = self.packages.${system}.nix-eval-jobs; defaultPackage = self.packages.${system}.nix-eval-jobs;
devShell = pkgs.callPackage ./shell.nix drvArgs; devShell = pkgs.callPackage ./shell.nix drvArgs;

View file

@ -1,8 +1,22 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? (
let
inherit (builtins) fromJSON readFile;
flakeLock = fromJSON (readFile ./flake.lock);
locked = flakeLock.nodes.nixpkgs.locked;
nixpkgs = assert locked.type == "github"; builtins.fetchTarball {
url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz";
sha256 = locked.narHash;
};
in
import nixpkgs { }
)
, srcDir ? null , srcDir ? null
}: }:
(pkgs.callPackage ./default.nix { inherit srcDir; }).overrideAttrs (old: { (pkgs.callPackage ./default.nix {
inherit srcDir;
nix = pkgs.nixUnstable;
}).overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ nativeBuildInputs = old.nativeBuildInputs ++ [