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# Match json/lockfiles/markdown/nix/perl/python/ruby/shell/docbook files, set indent to spaces
27[*.{bash,json,lock,md,nix,pl,pm,py,rb,sh,xml}]
28indent_style = space
29
30# Match docbook files, set indent width of one
31[*.xml]
32indent_size = 1
33
34# Match json/lockfiles/markdown/nix/ruby files, set indent width of two
35[*.{json,lock,md,nix,rb}]
36indent_size = 2
37
38# Match all the Bash code in Nix files, set indent width of two
39[*.{bash,sh}]
40indent_size = 2
41
42# Match Perl and Python scripts, set indent width of four
43[*.{pl,pm,py}]
44indent_size = 4
45
46# Match gemfiles, set indent to spaces with width of two
47[Gemfile]
48indent_size = 2
49indent_style = space
50
51# Match package.json and package-lock.json, which are generally pulled from upstream and accept them as they are
52[package{,-lock}.json]
53indent_style = unset
54insert_final_newline = unset
55
56# Disable file types or individual files
57# some of these files may be auto-generated and/or require significant changes
58
59[*.{c,h}]
60insert_final_newline = unset
61trim_trailing_whitespace = unset
62
63[*.{asc,key,ovpn}]
64insert_final_newline = unset
65end_of_line = unset
66trim_trailing_whitespace = unset
67
68[*.lock]
69indent_size = unset
70
71# Although Markdown/CommonMark allows using two trailing spaces to denote
72# a hard line break, we do not use that feature in nixpkgs since
73# it forces the surrounding paragraph to become a <literallayout> which
74# does not wrap reasonably.
75# Instead of a hard line break, start a new paragraph by inserting a blank line.
76[*.md]
77trim_trailing_whitespace = true
78
79# binaries
80[*.nib]
81end_of_line = unset
82insert_final_newline = unset
83trim_trailing_whitespace = unset
84charset = unset
85
86[eggs.nix]
87trim_trailing_whitespace = unset
88
89[registry.dat]
90end_of_line = unset
91insert_final_newline = unset
92
93# Keep this hint at the bottom:
94# Please don't add entries for subfolders here.
95# Create <subfolder>/.editorconfig instead.