-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathflake.nix
More file actions
153 lines (143 loc) · 4.18 KB
/
Copy pathflake.nix
File metadata and controls
153 lines (143 loc) · 4.18 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
emacs-elisp-autofmt = {
url = "git+https://codeberg.org/ideasman42/emacs-elisp-autofmt.git";
flake = false;
};
};
outputs =
inputs@{
nixpkgs,
flake-parts,
treefmt-nix,
emacs-overlay,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
treefmt-nix.flakeModule
];
systems = [
"aarch64-linux"
"x86_64-linux"
];
perSystem =
{
pkgs,
system,
...
}:
let
emacs-overlay-pkgs = import nixpkgs {
inherit system;
overlays = [
emacs-overlay.overlays.default
];
};
emacsForIt = emacs-overlay-pkgs.emacsWithPackagesFromPackageRequires {
packageElisp = builtins.readFile ./auto-sudoedit.el;
};
in
{
treefmt.config = {
projectRootFile = "flake.nix";
programs = {
actionlint.enable = true;
deadnix.enable = true;
nixfmt.enable = true;
prettier.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
statix.enable = true;
typos.enable = true;
zizmor.enable = true;
};
settings.formatter = {
editorconfig-checker = {
command = pkgs.editorconfig-checker;
includes = [ "*" ];
};
elisp-autofmt = {
command = pkgs.writeShellApplication {
name = "elisp-autofmt";
runtimeInputs = with pkgs; [
emacs
python3
];
text = ''
python3 ${inputs.emacs-elisp-autofmt}/elisp-autofmt-cmd.py "$@"
'';
};
includes = [ "*.el" ];
};
zizmor.options = [ "--pedantic" ];
};
};
checks = {
inherit emacsForIt;
ert = pkgs.runCommand "auto-sudoedit-ert-test" { } ''
${emacsForIt}/bin/emacs -Q --batch \
-L ${./.} \
-l ${./test/auto-sudoedit-test.el} \
-f ert-run-tests-batch-and-exit
touch $out
'';
};
packages = {
# flake.lockの管理バージョンをre-exportすることで安定した利用を促進。
inherit (pkgs) nix-fast-build;
inherit emacsForIt;
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# treefmtで指定したプログラムの単体版。
actionlint
deadnix
editorconfig-checker
emacsPackages.elisp-autofmt
nixfmt
prettier
shellcheck
shfmt
statix
typos
zizmor
# nixの関連ツール。
nil
nix-fast-build
# GitHub関連ツール。
gh
# Emacs関連ツール。
emacsForIt
];
};
};
};
nixConfig = {
extra-substituters = [
"https://cache.nixos.org/"
"https://niks3-public.ncaq.net/"
"https://ncaq.cachix.org/"
"https://nix-community.cachix.org/"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"niks3-public.ncaq.net-1:e/B9GomqDchMBmx3IW/TMQDF8sjUCQzEofKhpehXl04="
"ncaq.cachix.org-1:XF346GXI2n77SB5Yzqwhdfo7r0nFcZBaHsiiMOEljiE="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
}