-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
95 lines (86 loc) · 3.21 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
inputs.pre-commit-hooks.follows = "pre-commit-hooks";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs = inputs@{ flake-parts, devenv, nixpkgs, ... }:
with devenv.lib;
with flake-parts.lib;
mkFlake { inherit inputs; } {
imports = [ devenv.flakeModule ];
systems = [ "x86_64-linux" "aarch64-linux" "i686-linux" ]
++ [ "x86_64-darwin" "aarch64-darwin" ];
perSystem = { pkgs, lib, system, ... }:
let
CI = { env.CI = "true"; };
default = { config, pkgs, ... }: {
env.XDG_CACHE_HOME = "${config.env.DEVENV_ROOT}/.cache";
# help other CLI's to discover pinned bash
env.SHELL = "${pkgs.bash}/bin/sh";
packages = [ pkgs.bash ];
};
in with lib; rec {
devenv.shells.nix = {
languages.nix.enable = true;
pre-commit.hooks = {
nixfmt.enable = true;
nil.enable = true;
deadnix.enable = true;
};
};
devenv.shells.javascript = ./examples/javascript/devenv.nix;
devenv.shells.regex = ./core/regex/devenv.nix;
devenv.shells.js-bundler = ./core/js/devenv.nix;
devenv.shells.rust-wasm = ./core/wasm/devenv.nix;
devenv.shells.site-generator = ./.site/devenv.nix;
devenv.shells.web-server = ./devenv.nix;
devShells.default = mkShell { # direnv
inherit inputs pkgs;
modules = with devenv.shells;
[ default nix javascript regex ]
++ [ js-bundler rust-wasm site-generator web-server ]
++ [ check ];
};
# Just temporary for .github/workflows/check.yaml
# Eventually it will perform browser test that most likely require devShells.default as a whole.
devenv.shells.check = {
packages = with pkgs; [ taplo luajitPackages.luacheck eclint ];
pre-commit.settings = {
denofmt.configPath = ./deno.json;
denolint.configPath = ./deno.json;
};
};
devShells.CI-check = mkShell {
inherit inputs pkgs;
modules = with devenv.shells; [ default CI ] ++ [ check ];
};
devShells.CI-package = mkShell {
inherit inputs pkgs;
modules = with devenv.shells; [ default CI ] ++ [ js-bundler ];
};
devShells.CI-site = mkShell {
inherit inputs pkgs;
modules = with devenv.shells;
[ default CI ] ++ [ js-bundler site-generator ];
};
# kinda unfortunate that flake-parts doesn't provide a clean way to consume an overlay 🙁
_module.args.pkgs = import nixpkgs {
inherit system;
overlays = [ (import ./overlay.nix) ];
config = { };
};
};
};
}