blob: 4dce373b126b43c66cd356ff52b8281865c04578 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
{
description = "A simple bash library for your scripting needs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
outputs = { self, flake-utils, nixpkgs, }:
with flake-utils.lib;
(eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in
{
packages.bash-lib = pkgs.bash-lib;
defaultPackage = self.packages.${system}.bash-lib;
})) // {
checks.x86_64-linux = {
runAndCheckDemo =
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlay ];
};
in
pkgs.runCommand "runAndCheckDemo" { src = ./.; nativeBuildInputs = [ pkgs.shellcheck ]; } ''
unpackFile "$src"
cd */
shellcheck ./bash-lib.sh
shellcheck -x ./demo.sh
chmod +w . demo.sh
sed '/^fatal/d' -i demo.sh
patchShebangs ./demo.sh
./demo.sh
touch $out
'';
};
overlay = final: prev: {
bash-lib = final.writeTextFile {
name = "bash-lib.sh";
text = builtins.readFile ./bash-lib.sh;
};
};
};
}
|