-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
59 lines (58 loc) · 1.5 KB
/
flake.nix
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
55
56
57
58
59
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = {
self,
nixpkgs,
}: let
eachSystem = f:
nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix (system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
in {
formatter = eachSystem ({pkgs, ...}: pkgs.alejandra);
packages = eachSystem ({pkgs, ...}: {
default = pkgs.writeShellApplication {
name = "nix-develop-gha";
runtimeInputs = [pkgs.gnugrep pkgs.openssl.bin pkgs.coreutils];
text = builtins.readFile ./nix-develop-gha.sh;
};
});
devShells = eachSystem ({pkgs, ...}: {
default = pkgs.mkShell {
packages = [pkgs.shfmt pkgs.shellcheck pkgs.actionlint];
};
});
checks = eachSystem ({
pkgs,
system,
...
}: {
package = self.packages.${system}.default;
actionlint = let
fs = pkgs.lib.fileset;
in
pkgs.runCommand "lint-actions" {
nativeBuildInputs = [
pkgs.actionlint
pkgs.git
pkgs.shellcheck # actionlint uses this to check `run:` stanzas
];
src = fs.toSource {
root = ./.;
fileset = fs.unions [./.github/workflows];
};
}
''
set -euo pipefail
cp -R $src src-copy
chmod -R +w src-copy
cd src-copy
git init --quiet
actionlint -color
touch $out
'';
});
};
}