-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathflake.nix
More file actions
83 lines (80 loc) · 2.32 KB
/
flake.nix
File metadata and controls
83 lines (80 loc) · 2.32 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
outputs =
{
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
scip-rust = pkgs.writeShellApplication {
name = "scip-rust";
runtimeEnv = {
SCIP_RUST_FALLBACK_CARGO = "${pkgs.cargo}/bin";
SCIP_RUST_FALLBACK_RUSTC = "${pkgs.rustc}/bin";
SCIP_RUST_FALLBACK_RUST_ANALYZER = "${pkgs.rust-analyzer}/bin";
};
text = builtins.readFile ./scip-rust;
};
in
{
packages = {
inherit scip-rust;
default = scip-rust;
}
// pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
docker = pkgs.dockerTools.buildLayeredImage {
name = "scip-rust";
tag = "latest";
contents = [
scip-rust
pkgs.dockerTools.caCertificates
pkgs.git
];
fakeRootCommands = "mkdir -p /work /tmp";
enableFakechroot = true;
config = {
Cmd = [ "scip-rust" ];
WorkingDir = "/work";
Env = [ "HOME=/tmp" ];
Labels = {
"org.opencontainers.image.source" = "https://github.com/scip-code/scip-rust";
};
};
};
};
checks = {
shellcheck = pkgs.runCommand "check-shellcheck" { } ''
${pkgs.shellcheck}/bin/shellcheck ${./scip-rust}
touch $out
'';
formatting = pkgs.runCommand "check-formatting" { } ''
${pkgs.nixfmt}/bin/nixfmt --check ${./flake.nix}
${pkgs.shfmt}/bin/shfmt -i 4 -ci -d ${./scip-rust}
touch $out
'';
renovate = pkgs.runCommand "check-renovate" { } ''
LOG_LEVEL=warn ${pkgs.renovate}/bin/renovate-config-validator \
${./.github/renovate.json}
touch $out
'';
};
devShells.default = pkgs.mkShellNoCC {
buildInputs = with pkgs; [
cargo
nixfmt
rust-analyzer
rustc
shellcheck
shfmt
];
};
}
);
}