Skip to content

Commit

Permalink
nix.checks.openwrt: use fileset source and mkDerivation
Browse files Browse the repository at this point in the history
Including a openwrtSrc for any openwrt specific checks that we have.
Additionally, reworking the openwrt-golden test to consume from this new
src.
  • Loading branch information
sarcasticadmin committed Dec 1, 2024
1 parent 829f75d commit b19540e
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions nix/checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ let
../../switch-configuration
];
};

# Used for derivations where openwrt is the primary directory.
openwrtSrc = toSource {
root = ../..;
fileset = unions [
../../facts
../../openwrt
../../tests
];
};
in
genAttrs
[
Expand Down Expand Up @@ -112,20 +122,22 @@ genAttrs
'';
});

openwrt-golden =
pkgs.runCommand "openwrt-golden"
{
buildInputs = [
pkgs.diffutils
pkgs.gomplate
];
}
''
cp -r --no-preserve=mode ${cleanSource inputs.self}/* .
cd tests/unit/openwrt
mkdir -p $out/tmp/ar71xx
${pkgs.bash}/bin/bash test.sh -t ar71xx -o $out
'';
openwrt-golden = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "openwrt-golden";
version = "0.1.0";

src = openwrtSrc;

buildInputs = [
pkgs.diffutils
pkgs.gomplate
];
buildPhase = ''
cd tests/unit/openwrt
mkdir -p $out/tmp/ar71xx
${pkgs.bash}/bin/bash test.sh -t ar71xx -o $out
'';
});

formatting = inputs.self.formatterModule.${system}.config.build.check inputs.self;

Expand Down

0 comments on commit b19540e

Please sign in to comment.