1# EditorConfig configuration for nixpkgs
2# https://EditorConfig.org
3
4# Top-most EditorConfig file
5root = true
6
7# Unix-style newlines with a newline ending every file, utf-8 charset
8[*]
9end_of_line = lf
10insert_final_newline = true
11trim_trailing_whitespace = true
12charset = utf-8
13
14# Ignore diffs/patches
15[*.{diff,patch}]
16end_of_line = unset
17insert_final_newline = unset
18trim_trailing_whitespace = unset
19
20# We want readFile .version to return the version without a newline.
21[.version]
22insert_final_newline = false
23
24# see https://nixos.org/nixpkgs/manual/#chap-conventions
25
26[*.{bash,css,js,json,lock,md,nix,pl,pm,py,rb,sh,xml}]
27indent_style = space
28
29# Match docbook files, set indent width of one
30[*.xml]
31indent_size = 1
32
33# Match json/lockfiles/markdown/nix/ruby files, set indent width of two
34[*.{js,json,lock,md,nix,rb}]
35indent_size = 2
36
37# Match all the Bash code in Nix files, set indent width of two
38[*.{bash,sh}]
39indent_size = 2
40
41# Match Perl and Python scripts, set indent width of four
42[*.{pl,pm,py}]
43indent_size = 4
44
45# Match gemfiles, set indent to spaces with width of two
46[Gemfile]
47indent_size = 2
48indent_style = space
49
50# Match package.json and package-lock.json, which are generally pulled from upstream and accept them as they are
51[package{,-lock}.json]
52indent_style = unset
53insert_final_newline = unset
54
55# Disable file types or individual files
56# some of these files may be auto-generated and/or require significant changes
57
58[*.{c,h}]
59insert_final_newline = unset
60trim_trailing_whitespace = unset
61
62[*.{asc,key,ovpn}]
63insert_final_newline = unset
64end_of_line = unset
65trim_trailing_whitespace = unset
66
67[*.lock]
68indent_size = unset
69
70# Although Markdown/CommonMark allows using two trailing spaces to denote
71# a hard line break, we do not use that feature in nixpkgs since
72# it forces the surrounding paragraph to become a <literallayout> which
73# does not wrap reasonably.
74# Instead of a hard line break, start a new paragraph by inserting a blank line.
75[*.md]
76trim_trailing_whitespace = true
77
78# binaries
79[*.nib]
80end_of_line = unset
81insert_final_newline = unset
82trim_trailing_whitespace = unset
83charset = unset
84
85[eggs.nix]
86trim_trailing_whitespace = unset
87
88[registry.dat]
89end_of_line = unset
90insert_final_newline = unset
91
92# Keep this hint at the bottom:
93# Please don't add entries for subfolders here.
94# Create <subfolder>/.editorconfig instead.