Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Home
Ecosystem
Overview
NixOS
Package Manager
Nix Language
Nixpkgs
Hydra
Applications
Topics
Software
Hardware
Desktop
Server
Community
Learn NixOS
Overview
Guides
Tutorials
References
Cookbooks
Wiki
Contribute
Manual of Style
Recent changes
Random page
NixOS Wiki
Search
Search
English
Appearance
Create account
Log in
Personal tools
Create account
Log in
Export translations
Translate
English
Language statistics
Message group statistics
Export
Tools
Tools
move to sidebar
hide
Actions
Language statistics
Message group statistics
Export
General
Special pages
Printable version
Appearance
move to sidebar
hide
Settings
Group
Accelerated Video Playback
Appimage
Applications
Category:Community
Category:Desktop environment
Category:Hardware
Category:Server
Category:Software
Creating a NixOS live CD
Disko
Doas
Docker
FAQ
Firefox
Flakes
Hardware/System76/galp5
Honk
Hugo
Hydra
Install NixOS on Amazon EC2
Kitty
Konqueror
MediaWiki:Sidebar
Mihomo
Neovim
Nitrokey
Nix (language)
Nix (package manager)
Nix ecosystem
NixOS
NixOS as a desktop
NixOS Installation Guide
NixOS on ARM
NixOS on ARM/UEFI
NixOS Wiki
NixOS Wiki/documentation topics
NixOS Wiki/get in touch
NixOS Wiki/getting started
NixOS Wiki/setting up
NixOS Wiki/special pages
NixOS Wiki/welcome
NixOS Wiki:News
Nixpkgs
Packaging/Icons
Plymouth
Secure Boot
Smartmontools
Starship
Steam
Sudo
Systemd/Hardening
Systemd/logind
Systemd/timers
Systemd/User Services
Terms and Definitions in Nix Project
Vim
VR
Language
aa - Qafár af
aae - Arbërisht
ab - аԥсшәа
abs - bahasa ambon
ace - Acèh
acf - Kwéyòl Sent Lisi
acm - عراقي
ady - адыгабзэ
ady-cyrl - адыгабзэ
aeb - تونسي / Tûnsî
aeb-arab - تونسي
aeb-latn - Tûnsî
af - Afrikaans
aln - Gegë
alt - алтай тил
am - አማርኛ
ami - Pangcah
an - aragonés
ang - Ænglisc
ann - Obolo
anp - अंगिका
apc - شامي
ar - العربية
arc - ܐܪܡܝܐ
arn - mapudungun
arq - جازايرية
ary - الدارجة
arz - مصرى
as - অসমীয়া
ase - American sign language
ast - asturianu
atj - Atikamekw
av - авар
avk - Kotava
awa - अवधी
ay - Aymar aru
az - azərbaycanca
azb - تۆرکجه
ba - башҡортса
ban - Basa Bali
ban-bali - ᬩᬲᬩᬮᬶ
bar - Boarisch
bbc - Batak Toba
bbc-latn - Batak Toba
bcc - جهلسری بلوچی
bci - wawle
bcl - Bikol Central
bdr - Bajau Sama
be - беларуская
be-tarask - беларуская (тарашкевіца)
bew - Betawi
bg - български
bgc - हरियाणवी
bgn - روچ کپتین بلوچی
bh - भोजपुरी
bho - भोजपुरी
bi - Bislama
bjn - Banjar
blk - ပအိုဝ်ႏဘာႏသာႏ
bm - bamanankan
bn - বাংলা
bo - བོད་ཡིག
bpy - বিষ্ণুপ্রিয়া মণিপুরী
bqi - بختیاری
br - brezhoneg
brh - Bráhuí
bs - bosanski
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Basa Ugi
bxr - буряад
ca - català
cbk-zam - Chavacano de Zamboanga
ccp - 𑄌𑄋𑄴𑄟𑄳𑄦
cdo - 閩東語 / Mìng-dĕ̤ng-ngṳ̄
ce - нохчийн
ceb - Cebuano
ch - Chamoru
chn - chinuk wawa
cho - Chahta anumpa
chr - ᏣᎳᎩ
chy - Tsetsêhestâhese
ckb - کوردی
co - corsu
cps - Capiceño
cpx - 莆仙語 / Pó-sing-gṳ̂
cpx-hans - 莆仙语(简体)
cpx-hant - 莆仙語(繁體)
cpx-latn - Pó-sing-gṳ̂ (Báⁿ-uā-ci̍)
cr - Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ
crh - qırımtatarca
crh-cyrl - къырымтатарджа (Кирилл)
crh-latn - qırımtatarca (Latin)
crh-ro - tatarşa
cs - čeština
csb - kaszëbsczi
cu - словѣньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ
cv - чӑвашла
cy - Cymraeg
da - dansk
dag - dagbanli
de - Deutsch
de-at - Österreichisches Deutsch
de-ch - Schweizer Hochdeutsch
de-formal - Deutsch (Sie-Form)
dga - Dagaare
din - Thuɔŋjäŋ
diq - Zazaki
dsb - dolnoserbski
dtp - Kadazandusun
dty - डोटेली
dua - Duálá
dv - ދިވެހިބަސް
dz - ཇོང་ཁ
ee - eʋegbe
efi - Efịk
egl - Emiliàn
el - Ελληνικά
eml - emiliàn e rumagnòl
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - español
es-419 - español de América Latina
es-formal - español (formal)
et - eesti
eu - euskara
ext - estremeñu
fa - فارسی
fat - mfantse
ff - Fulfulde
fi - suomi
fit - meänkieli
fj - Na Vosa Vakaviti
fo - føroyskt
fon - fɔ̀ngbè
fr - français
frc - français cadien
frp - arpetan
frr - Nordfriisk
fur - furlan
fy - Frysk
ga - Gaeilge
gaa - Ga
gag - Gagauz
gan - 贛語
gan-hans - 赣语(简体)
gan-hant - 贛語(繁體)
gcf - kréyòl Gwadloup
gcr - kriyòl gwiyannen
gd - Gàidhlig
gl - galego
gld - на̄ни
glk - گیلکی
gn - Avañe'ẽ
gom - गोंयची कोंकणी / Gõychi Konknni
gom-deva - गोंयची कोंकणी
gom-latn - Gõychi Konknni
gor - Bahasa Hulontalo
got - 𐌲𐌿𐍄𐌹𐍃𐌺
gpe - Ghanaian Pidgin
grc - Ἀρχαία ἑλληνικὴ
gsw - Alemannisch
gu - ગુજરાતી
guc - wayuunaiki
gur - farefare
guw - gungbe
gv - Gaelg
ha - Hausa
hak - 客家語 / Hak-kâ-ngî
hak-hans - 客家语(简体)
hak-hant - 客家語(繁體)
hak-latn - Hak-kâ-ngî (Pha̍k-fa-sṳ)
haw - Hawaiʻi
he - עברית
hi - हिन्दी
hif - Fiji Hindi
hif-latn - Fiji Hindi
hil - Ilonggo
hno - ہندکو
ho - Hiri Motu
hr - hrvatski
hrx - Hunsrik
hsb - hornjoserbsce
hsn - 湘語
ht - Kreyòl ayisyen
hu - magyar
hu-formal - magyar (formal)
hy - հայերեն
hyw - Արեւմտահայերէն
hz - Otsiherero
ia - interlingua
iba - Jaku Iban
ibb - ibibio
id - Bahasa Indonesia
ie - Interlingue
ig - Igbo
igl - Igala
ii - ꆇꉙ
ik - Iñupiatun
ike-cans - ᐃᓄᒃᑎᑐᑦ
ike-latn - inuktitut
ilo - Ilokano
inh - гӀалгӀай
io - Ido
is - íslenska
isv-cyrl - меджусловјанскы
isv-latn - medžuslovjansky
it - italiano
iu - ᐃᓄᒃᑎᑐᑦ / inuktitut
ja - 日本語
jam - Patois
jbo - la .lojban.
jut - jysk
jv - Jawa
ka - ქართული
kaa - Qaraqalpaqsha
kab - Taqbaylit
kai - Karai-karai
kbd - адыгэбзэ
kbd-cyrl - адыгэбзэ
kbp - Kabɩyɛ
kcg - Tyap
kea - kabuverdianu
kg - Kongo
kge - Kumoring
khw - کھوار
ki - Gĩkũyũ
kiu - Kırmancki
kj - Kwanyama
kjh - хакас
kjp - ဖၠုံလိက်
kk - қазақша
kk-arab - قازاقشا (تٴوتە)
kk-cn - قازاقشا (جۇنگو)
kk-cyrl - қазақша (кирил)
kk-kz - қазақша (Қазақстан)
kk-latn - qazaqşa (latın)
kk-tr - qazaqşa (Türkïya)
kl - kalaallisut
km - ភាសាខ្មែរ
kn - ಕನ್ನಡ
knc - Yerwa Kanuri
ko - 한국어
ko-kp - 조선말
koi - перем коми
kr - kanuri
krc - къарачай-малкъар
kri - Krio
krj - Kinaray-a
krl - karjal
ks - कॉशुर / کٲشُر
ks-arab - کٲشُر
ks-deva - कॉशुर
ksh - Ripoarisch
ksw - စှီၤ
ku - kurdî
ku-arab - کوردی (عەرەبی)
ku-latn - kurdî (latînî)
kum - къумукъ
kus - Kʋsaal
kv - коми
kw - kernowek
ky - кыргызча
la - Latina
lad - Ladino
lb - Lëtzebuergesch
lbe - лакку
lez - лезги
lfn - Lingua Franca Nova
lg - Luganda
li - Limburgs
lij - Ligure
liv - Līvõ kēļ
lki - لەکی
lld - Ladin
lmo - lombard
ln - lingála
lo - ລາວ
loz - Silozi
lrc - لۊری شومالی
lt - lietuvių
ltg - latgaļu
lua - ciluba
lus - Mizo ţawng
luz - لئری دوٙمینی
lv - latviešu
lzh - 文言
lzz - Lazuri
mad - Madhurâ
mag - मगही
mai - मैथिली
map-bms - Basa Banyumasan
mdf - мокшень
mg - Malagasy
mh - Ebon
mhr - олык марий
mi - Māori
min - Minangkabau
mk - македонски
ml - മലയാളം
mn - монгол
mnc - manju gisun
mnc-latn - manju gisun
mnc-mong - ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ
mni - ꯃꯤꯇꯩ ꯂꯣꯟ
mnw - ဘာသာမန်
mo - молдовеняскэ
mos - moore
mr - मराठी
mrh - Mara
mrj - кырык мары
ms - Bahasa Melayu
ms-arab - بهاس ملايو
mt - Malti
mui - Baso Palembang
mus - Mvskoke
mwl - Mirandés
my - မြန်မာဘာသာ
myv - эрзянь
mzn - مازِرونی
na - Dorerin Naoero
nah - Nāhuatl
nan - 閩南語 / Bân-lâm-gú
nan-hant - 閩南語(傳統漢字)
nan-latn-pehoeji - Bân-lâm-gú (Pe̍h-ōe-jī)
nan-latn-tailo - Bân-lâm-gú (Tâi-lô)
nap - Napulitano
nb - norsk bokmål
nds - Plattdüütsch
nds-nl - Nedersaksies
ne - नेपाली
new - नेपाल भाषा
ng - Oshiwambo
nia - Li Niha
nit - కొలామి
niu - Niuē
nl - Nederlands
nl-informal - Nederlands (informeel)
nmz - nawdm
nn - norsk nynorsk
no - norsk
nod - ᨣᩤᩴᨾᩮᩬᩥᨦ
nog - ногайша
nov - Novial
nqo - ߒߞߏ
nr - isiNdebele seSewula
nrm - Nouormand
nso - Sesotho sa Leboa
nup - Nupe
nv - Diné bizaad
ny - Chi-Chewa
nyn - runyankore
nyo - Orunyoro
nys - Nyunga
oc - occitan
ojb - Ojibwemowin
olo - livvinkarjala
om - Oromoo
or - ଓଡ଼ିଆ
os - ирон
pa - ਪੰਜਾਬੀ
pag - Pangasinan
pam - Kapampangan
pap - Papiamentu
pcd - Picard
pcm - Naijá
pdc - Deitsch
pdt - Plautdietsch
pfl - Pälzisch
pi - पालि
pih - Norfuk / Pitkern
pl - polski
pms - Piemontèis
pnb - پنجابی
pnt - Ποντιακά
prg - prūsiskan
ps - پښتو
pt - português
pt-br - português do Brasil
pwn - pinayuanan
qu - Runa Simi
qug - Runa shimi
rgn - Rumagnôl
rif - Tarifit
rki - ရခိုင်
rm - rumantsch
rmc - romaňi čhib
rmy - romani čhib
rn - ikirundi
ro - română
roa-tara - tarandíne
rsk - руски
ru - русский
rue - русиньскый
rup - armãneashti
ruq - Vlăheşte
ruq-cyrl - Влахесте
ruq-latn - Vlăheşte
rut - мыхаӀбишды
rw - Ikinyarwanda
ryu - うちなーぐち
sa - संस्कृतम्
sah - саха тыла
sat - ᱥᱟᱱᱛᱟᱲᱤ
sc - sardu
scn - sicilianu
sco - Scots
sd - سنڌي
sdc - Sassaresu
sdh - کوردی خوارگ
se - davvisámegiella
se-fi - davvisámegiella (Suoma bealde)
se-no - davvisámegiella (Norgga bealde)
se-se - davvisámegiella (Ruoŧa bealde)
sei - Cmique Itom
ses - Koyraboro Senni
sg - Sängö
sgs - žemaitėška
sh - srpskohrvatski / српскохрватски
sh-cyrl - српскохрватски (ћирилица)
sh-latn - srpskohrvatski (latinica)
shi - Taclḥit
shi-latn - Taclḥit
shi-tfng - ⵜⴰⵛⵍⵃⵉⵜ
shn - ၽႃႇသႃႇတႆး
shy - tacawit
shy-latn - tacawit
si - සිංහල
simple - Simple English
sjd - кӣллт са̄мь кӣлл
sje - bidumsámegiella
sk - slovenčina
skr - سرائیکی
skr-arab - سرائیکی
sl - slovenščina
sli - Schläsch
sm - Gagana Samoa
sma - åarjelsaemien
smn - anarâškielâ
sms - nuõrttsääʹmǩiõll
sn - chiShona
so - Soomaaliga
sq - shqip
sr - српски / srpski
sr-ec - српски (ћирилица)
sr-el - srpski (latinica)
srn - Sranantongo
sro - sardu campidanesu
ss - SiSwati
st - Sesotho
stq - Seeltersk
sty - себертатар
su - Sunda
sv - svenska
sw - Kiswahili
syl - ꠍꠤꠟꠐꠤ
szl - ślůnski
szy - Sakizaya
ta - தமிழ்
tay - Tayal
tcy - ತುಳು
tdd - ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ
te - తెలుగు
tet - tetun
tg - тоҷикӣ
tg-cyrl - тоҷикӣ
tg-latn - tojikī
th - ไทย
ti - ትግርኛ
tig - ትግሬ
tk - Türkmençe
tl - Tagalog
tly - tolışi
tly-cyrl - толыши
tn - Setswana
to - lea faka-Tonga
tok - toki pona
tpi - Tok Pisin
tr - Türkçe
tru - Ṫuroyo
trv - Seediq
ts - Xitsonga
tt - татарча / tatarça
tt-cyrl - татарча
tt-latn - tatarça
ttj - Orutooro
tum - chiTumbuka
tw - Twi
ty - reo tahiti
tyv - тыва дыл
tzm - ⵜⴰⵎⴰⵣⵉⵖⵜ
udm - удмурт
ug - ئۇيغۇرچە / Uyghurche
ug-arab - ئۇيغۇرچە
ug-latn - Uyghurche
uk - українська
ur - اردو
uz - oʻzbekcha / ўзбекча
uz-cyrl - ўзбекча
uz-latn - oʻzbekcha
ve - Tshivenda
vec - vèneto
vep - vepsän kel’
vi - Tiếng Việt
vls - West-Vlams
vmf - Mainfränkisch
vmw - emakhuwa
vo - Volapük
vot - Vaďďa
vro - võro
wa - walon
wal - wolaytta
war - Winaray
wls - Fakaʻuvea
wo - Wolof
wuu - 吴语
wuu-hans - 吴语(简体)
wuu-hant - 吳語(正體)
xal - хальмг
xh - isiXhosa
xmf - მარგალური
xsy - saisiyat
yi - ייִדיש
yo - Yorùbá
yrl - Nhẽẽgatú
yue - 粵語
yue-hans - 粵语(简体)
yue-hant - 粵語(繁體)
za - Vahcuengh
zea - Zeêuws
zgh - ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ
zgh-latn - tamaziɣt tanawayt
zh - 中文
zh-cn - 中文(中国大陆)
zh-hans - 中文(简体)
zh-hant - 中文(繁體)
zh-hk - 中文(香港)
zh-mo - 中文(澳門)
zh-my - 中文(马来西亚)
zh-sg - 中文(新加坡)
zh-tw - 中文(臺灣)
zu - isiZulu
Format
Export for off-line translation
Export in native format
Export in CSV format
Fetch
{{DISPLAYTITLE:FAQ}}<languages/> 为了避免重复回答那些经常被问到的问题以及处理新手常遇到的麻烦,这些问题被收录在这里。 <div lang="en" dir="ltr" class="mw-content-ltr"> http://unix.stackexchange.com/questions/tagged/nixos can also be used for questions. </div> <span id="Why_is_there_a_new_wiki?_What_is_with_nixos.wiki?"></span> == 为什么创建了一个新的维基?nixos.wiki 怎么了? == 旧的 wiki(nixos.wiki)存在以下几个问题: * 许多组件(MediaWiki、PHP、ICU)严重过时。 ** MediaWiki 1.29(生命周期结束于 2018 年),当前版本为 1.35(生命周期结束于 2023 年 12 月) ** PHP 7.3.33(生命周期结束于 2021 年 12 月) ** ICU 64.2 * Cloudflare 的 DDoS 防御有时会导致维基编辑失败。 * 没有所见即所得(WYSIWYG)的编辑器。 * 维基的基础设施本应在上线后公开,但最终未能公开。 我们曾通过多种渠道(电子邮件、Matrix)多次尝试解决这些问题,历时多年,但始终未能得到直接答复。最后一次联系是由 zimbatm 代表 NixOS 基金会与维护者沟通,询问关于新维基合作的可能性。答案是否定的。随着旧维基不断恶化且维护者未作回应,将内容分叉到一个新维基成为了唯一的解决方法。 另请参阅: * https://wiki.nixos.org/wiki/User:Winny/WikiRisks * https://greasyfork.org/en/scripts/495011-redirect-to-wiki-nixos-org(用于将 nixos.wiki 链接重定向到此处的简单用户脚本) <span id="Why_is_Nix_written_in_C++_rather_than_a_functional_language_like_Haskell?"></span> == 为什么 Nix 是用 C++ 编写的,而不是像 Haskell 这样的函数式语言? == 主要是因为 Nix 旨在轻量级、易于学习且具有良好的可移植性(零依赖)。 <span id="How_to_keep_build-time_dependencies_around_/_be_able_to_rebuild_while_being_offline?"></span> == 如何保留构建时依赖 / 在离线状态下重新构建? == <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"># /etc/nixos/configuration.nix { config, pkgs, lib, ... }: { nix.settings = { keep-outputs = true; keep-derivations = true; # See https://nixos.org/manual/nix/stable/command-ref/conf-file.html # for a complete list of Nix configuration options. }; }</syntaxhighlight> Check 'man configuration.nix' for these options. Rebuild for these options to take effect: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight> List all store paths that form the system closure and realise them: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash"> nix-store -qR $(nix-instantiate '<nixpkgs/nixos>' -A system) | xargs nix-store -r warning: you did not specify `--add-root'; the result might be removed by the garbage collector </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <build output and list of successfully realised paths> </syntaxhighlight> Repeat for your user and further profiles: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-store -qR ~/.nix-profile | xargs nix-store -r</syntaxhighlight> The warning can be ignored for profiles that are listed/linked in ''/nix/var/nix/profiles/'' or one of its subdirectories. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Consult man pages of nix-store and nix-instantiate for further information. </div> <span id="Why_-_instead_of_-?"></span> == 为什么使用 <hash>-<name> 而不是 <name>-<hash>? == 在少数需要深入查看 /nix/store 的情况下,将哈希值的前几位放在开头更方便记忆和使用。 也就是说,几乎可以仅通过哈希的前 4-5 个字符唯一地识别一个存储路径。 (这比先输入完整的包名再加上哈希的前几位要更高效。) 此外,由于开头部分长度一致,查看一系列软件包列表时在视觉上也更容易解析。 <div lang="en" dir="ltr" class="mw-content-ltr"> If you still wonder why, run <code>ls -1 /nix/store | sort -R -t - -k 2 | less</code> in your shell. ''(? unclear)'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what might happen if you don't garbage collect frequently, or if you are testing compilation variants: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash"> q0yi2nr8i60gm2zap46ryysydd2nhzhp-automake-1.11.1/ vbi4vwwidvd6kklq2kc0kx3nniwa3acl-automake-1.11.1/ wjgzir57hcbzrq3mcgxiwkyiqss3r4aq-automake-1.11.1/ 1ch5549xnck37gg2w5fh1jgk6lkpq5mc-nixos-build-vms/ 4cmjlxknzlvcdmfwj0ih0ggqsj5q73hb-nixos-build-vms/ 7fv4kwi5wwwzd11ili3qwg28xrj8rxw2-nixos-build-vms/ 8jij13smq9kdlqv96hm7y8xmbh2c54iy-nixos-build-vms/ j714mv53xi2j4ab4g2i08knqr137fd6l-nixos-build-vms/ xvs7y09jf7j48p6l0p87iypgpq470jqw-nixos-build-vms/ </syntaxhighlight> </div> <span id="I've_updated_my_channel_and_something_is_broken,_how_can_I_rollback_to_an_earlier_channel?"></span> == 我更新了我的 channel,但出现了问题,如何回滚到之前的 channel? == 查看可用的各代 channel: <syntaxhighlight lang="bash"> nix-env --list-generations -p /nix/var/nix/profiles/per-user/root/channels 18 2014-04-17 09:16:28 19 2014-06-13 10:31:24 20 2014-08-12 19:09:20 (current) </syntaxhighlight> 回滚到上一代的方法如下: <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash"> nix-env --rollback -p /nix/var/nix/profiles/per-user/root/channels switching from generation 20 to 19 </syntaxhighlight> To switch to a particular generation: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash"> nix-env --switch-generation 18 -p /nix/var/nix/profiles/per-user/root/channels switching from generation 20 to 18 </syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == I'm working on a new package, how can I build it without adding it to nixpkgs? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-build -E 'with import <nixpkgs> { }; callPackage ./mypackage.nix { }'</syntaxhighlight> You can replace callPackage with callPackage_i686 to build the 32-bit version of your package on a 64-bit system if you want to test that. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How can I compile a package with debugging symbols included? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To build a package with -Og and -g, and without stripping debug symbols use: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-build -E 'with import <nixpkgs> { }; enableDebugging fooPackage'</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> See also [[Debug Symbols]] </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How can I force a rebuild from source even without modifying the nix expression? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As root you can run nix-build with the --check flag: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">sudo nix-build --check -A ncdu</syntaxhighlight> == How can I manage software with nix-env like with configuration.nix? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There are many ways, one is the following: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <ol style="list-style-type: decimal;"> <li><p>Create a meta package called ''userPackages'' your ''~/.config/nixpkgs/config.nix'' file with the packages you would like to have in your environment:</p> <syntaxhighlight lang="nix"> with (import <nixpkgs> {}); { packageOverrides = pkgs: with pkgs; { userPackages = buildEnv { inherit ((import <nixpkgs/nixos> {}).config.system.path) pathsToLink ignoreCollisions postBuild; extraOutputsToInstall = [ "man" ]; name = "user-packages"; paths = [ vim git wget ]; }; }; } </syntaxhighlight></li> <li><p>Install all specified packages using this command:</p> <syntaxhighlight lang="bash">nix-env -iA userPackages -f '<nixpkgs>'</syntaxhighlight></li></ol> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Now you can add and remove packages from the paths list and rerun nix-env to update your user local packages. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Another way is using [[Home Manager]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == I've downloaded a binary, but I can't run it, what can I do? == Binaries normally do not work out of the box when you download them because they normally just assume that libraries can be found in hardcoded paths such as <code>/lib</code>. However this assumption is incorrect on NixOS systems due to the inner workings of <code>nix</code> - there is no default path, everything gets set to the corresponding version on compile time. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are new to packaging proprietary software you should check out the [[Packaging Binaries|Packaging Binaries Tutorial]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are in a hurry and just want to get shit running, continue reading:<br /> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can use [https://github.com/Mic92/nix-ld nix-ld] to run compiled binaries. For example, if your binary needs zlib and openssl: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> programs.nix-ld = { enable = true; libraries = [ pkgs.zlib pkgs.openssl ]; };</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Log out and back in to apply the environment variables it sets, and you can then directly run the binary. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you don't want to configure the list of libraries manually, a quick and dirty way to run nearly any precompiled binary is the following: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> programs.nix-ld = { enable = true; libraries = pkgs.steam-run.fhsenv.args.multiPkgs pkgs; };</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This uses the libraries that are used by [[Steam]] to simulate a traditional Linux FHS environment to run games in. It's a [https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/games/steam/fhsenv.nix big list] that usually contains all the libraries your binary needs to run. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Another possibility is to use [https://nixos.org/patchelf.html patchelf] to set the library path and dynamic linker appropriately, since compiled binaries have hard-coded interpreter and require certain dynamic libraries. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> # mybinaryprogram.nix with import <nixpkgs> {}; stdenv.mkDerivation rec { name = "somename"; buildInputs = [ makeWrapper ]; buildPhase = "true"; libPath = lib.makeLibraryPath with xlibs;[ libXrandr libXinerama libXcursor ]; unpackPhase = "true"; installPhase = '' mkdir -p $out/bin cp ${./mybinaryprogram} $out/bin/mybinaryprogram ''; postFixup = '' patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${libPath}" \ $out/bin/mybinaryprogram ''; }</syntaxhighlight> This can be built with: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-build mybinaryprogram.nix</syntaxhighlight> And run with: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">./result/bin/mybinaryprogram</syntaxhighlight> Another possibility is using a FHS-compatible Sandbox with [https://nixos.org/nixpkgs/manual/#sec-fhs-environments buildFHSUserEnv] </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> # fhsUser.nix { pkgs ? import <nixpkgs> {} }: (pkgs.buildFHSUserEnv { name = "example-env"; targetPkgs = pkgs: with pkgs; [ coreutils ]; multiPkgs = pkgs: with pkgs; [ zlib xorg.libXxf86vm curl openal openssl_1_0_2 xorg.libXext xorg.libX11 xorg.libXrandr mesa_glu ]; runScript = "bash"; }).env</syntaxhighlight> the sandbox can be entered with </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-shell fhsUser.nix</syntaxhighlight> <br> If your target application can't find shared libraries inside buildFHSUserEnv, you may run [https://github.com/lexleogryfon/de-generate nix-de-generate] for target application inside FHS, which will generate newenv.nix file, an nix-expression of buildFHSUserEnv with resolved dependencies for shared libraries. == What are channels and how do they get updated? == {{main|Channel branches}} </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [https://github.com/NixOS/nixpkgs Nixpkgs] is the git repository containing all packages and NixOS modules/expressions. Installing packages directly from Nixpkgs master branch is possible but a bit risky as git commits are merged into master before being heavily tested. That's where channels are useful. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A "channel" is a name for the latest "verified" git commits in Nixpkgs. Each channel has a different definition of what "verified" means. Each time a new git commit is verified, the channel declaring this verification gets updated. Contrary to an user of the git master branch, a channel user will benefit both from verified commits and binary packages from the binary cache. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Channels are reified as git branches in the [https://github.com/NixOS/nixpkgs nixpkgs repository] and as disk images in the [https://nixos.org/channels/ channels webpage]. There are several channels, each with its own use case and verification phase: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * '''nixos-unstable''' ** '''description''' Use this when you want the latest package and module versions while still benefiting from the binary cache. You can use this channel on non-NixOS systems. This channel corresponds to NixOS’s main development branch, and may thus see radical changes between channel updates. This channel is not recommended for production systems. ** '''definition''' this channel is updated depending on [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release.nix release.nix] and [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release-lib.nix release-lib.nix] * '''nixos-unstable-small''' ** '''description''' This channel is identical to <code>nixos-unstable</code> described above, except that this channel contains fewer binary packages. This means the channel gets updated faster than <code>nixos-unstable</code> (for instance, when a critical security patch is committed to NixOS’s source tree). However, the binary cache may contain less binary packages and thus using this channel may require building more packages from source than <code>nixos-unstable</code>. This channel is mostly intended for server environments and as such contains few GUI applications. ** '''definition''' this channel is updated depending on [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release-small.nix release-small.nix] and [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release-lib.nix release-lib.nix] * '''nixos-YY.MM''' (where '''YY''' is a 2-digit year and '''MM''' is a 2-digit month, such as [https://nixos.org/channels/nixos-15.09/ ''nixos-17.03'']) ** '''description''' These channels are called '''stable''' and only get conservative bug fixes and package upgrades. For instance, a channel update may cause the Linux kernel on your system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but not from 3.4.x to 3.11.x (a major change that has the potential to break things). Stable channels are generally maintained until the next stable branch is created. ** '''definition''' this channel is updated depending on [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release.nix release.nix] and [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release-lib.nix release-lib.nix] * '''nixos-YY.MM-small''' (where '''YY''' is a 2-digit year and '''MM''' is a 2-digit month, such as [https://nixos.org/channels/nixos-15.09-small/ nixos-15.09-small]) ** '''description''' The difference between <code>nixos-YY.MM-small</code> and <code>nixos-YY.MM</code> is the same as the one between <code>nixos-unstable-small</code> and <code>nixos-unstable</code> (see above) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Channel update works as follows: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> # Each channel has a particular job at '''hydra.nixos.org''' which must succeed: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * For NixOS: the trunk-combined [http://hydra.nixos.org/job/nixos/trunk-combined/tested tested] job, which contains some automated NixOS tests. * For nixos-small: the unstable-small [http://hydra.nixos.org/job/nixos/unstable-small/tested tested] job. * For nixpkgs: the trunk [http://hydra.nixos.org/job/nixpkgs/trunk/unstable unstable] job, which contains some critical release packages. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <ol start="2" style="list-style-type: decimal;"> <li>Once the job succeeds at a particular nixpkgs commit, '''cache.nixos.org''' will download binaries from '''hydra.nixos.org'''.</li> <li>Once the above download completes, the channel updates.</li></ol> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can checkout the nixpkgs git and reset it to a particular commit of a channel. This will not affect your access to the binary cache. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How do I know where's nixpkgs channel located and at which commit? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> First <code>echo $NIX_PATH</code> to see where nix looks for the expressions. Note that nix-env uses ''~/.nix-defexpr'' regardless of ''$NIX_PATH''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you want to know where <nixpkgs> is located: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-instantiate --find-file nixpkgs</syntaxhighlight> To know the commit, open the .version-suffix file in the nixpkgs location. The hash after the dot is the git commit. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Nixpkgs branches == Branches on the nixpkgs repo have a relationship with channels, but that relationship is not 1:1. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Some branches are reified as channels (e.g. the <code>nixos-XX.YY</code> branches, or <code>nix(os|pkgs)-unstable</code>), whereas others are the starting point for those branches (e.g. the <code>master</code> or <code>release-XX.YY</code> branches). For example: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * When a change in master needs to be backported to the current NixOS release, it is cherry-picked into the current <code>release-XX.YY</code> branch * [[Channel branches#Channel_update_process|Hydra]] picks up this change, runs tests, and if those tests pass, updates the corresponding <code>nixos-XX.YY</code> branch, which is then reified as a channel. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> So in short, the <code>relase-XX.YY</code> branches have not been run through Hydra yet, whereas the <code>nixos-XX.YY</code> ones have. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == There's an updated version for $software on nixpkgs but not in channels, how can I use it? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can jump the queue and use <code>nix-shell</code> with a <code>NIX_PATH</code> pointing to a tarball of the channel to get a shell for that software. Some building may occur. This will not work for system services. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="command"> NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-17.09.tar.gz nix-shell -p $software </syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How do I install a specific version of a package for build reproducibility etc.? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> See [[FAQ/Pinning Nixpkgs]] and [[How to fetch Nixpkgs with an empty NIX PATH]]. Find the version of nixpkgs with the package version you want and pin nixpkgs to that. However, be aware that the pinning of a package of another nixpkgs version results in a much larger package size as not only the package itself but all dependencies (down to libc) have older versions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> if you just want the old version of the single package but with new dependencies it is often easier to copy the package description into your scope and add it to your <code>configuration.nix</code> via: <code> mypackage-old = pkgs.callPackage ./mypackage-old.nix {};</code>.You can try to build the package as described in [[FAQ#I.27m_working_on_a_new_package.2C_how_can_I_build_it_without_adding_it_to_nixpkgs.3F|the FAQ: building a single derivation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == An error occurs while fetching sources from an url, how do I fix it? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> First try to update the local nixpkgs expressions with <code>nix-channel --update</code> (these describe where to download sources from and how to build them). Try your build again and the url might have already been correctly updated for the package in question. You can also subscribe the unstable channel (which includes the most up-to-date expressions) with <code>nix-channel --add http://nixos.org/channels/nixpkgs-unstable</code>, update and try the build again. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If that fails you can update the url in the nix expression yourself. [https://nixos.org/wiki/FAQ#How_do_I_know_where.27s_nixpkgs_channel_located_and_at_which_commit.3F Navigate to your channel's expressions] and find the package in one of the subdirectories. Edit the respective ''default.nix'' file by altering the ''url'' and ''sha256''. You can use <code>nix-prefetch-url url</code> to get the SHA-256 hash of source distributions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If the shell complains that you do not have write privileges for the file system, you will have to enable them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> start a new shell with a private mount namespace (Linux-only) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">sudo unshare -m bash</syntaxhighlight> remount the filesystem with write privileges (as root) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">mount -o remount,rw /nix/store</syntaxhighlight> update the file </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nano <PATH_TO_PACKAGE>/default.nix</syntaxhighlight> exit to shell where /nix/store is still mounted read-only </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">exit</syntaxhighlight> Be sure to [https://github.com/NixOS/nixpkgs/issues report the incorrect url] or [https://github.com/NixOS/nixpkgs/pulls fix it yourself]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How do I know the sha256 to use with fetchgit, fetchsvn, fetchbzr or fetchcvs? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Install <code>nix-prefetch-scripts</code> and use the corresponding nix prefetch helper. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For instance to get the checksum of a git repository use: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-prefetch-git https://git.zx2c4.com/password-store</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Or, use <code>lib.fakeHash</code> as the fetcher's hash argument, and attempt to build; Nix will tell you the actual and expected hash's mismatch, and you may copy the actual hash. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Should I use http://hydra.nixos.org/ as a binary cache? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> No. As of 2017, all build artifacts are directly pushed to http://cache.nixos.org/ and are available there, therefore setting http://hydra.nixos.org/ as a binary cache no longer serves any function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == I'm trying to install NixOS but my WiFi isn't working and I don't have an ethernet port == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Most phones will allow you to share your WiFi connection over USB. On Android you can enable this setting via ''Settings'' > ''Wireless & Networks'' / More ... > ''Tethering & portable hotspot'' > ''USB tethering''. This should be enough to allow you to install NixOS, and then fix your WiFi. iPhones only let you tether using your data connection rather than WiFi. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is also possible to build a custom NixOS installation ISO containing all the dependencies needed for an offline installation, but the default installation ISOs require internet connectivity. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For connecting to your WiFi, see [[NixOS_Installation_Guide#Wireless]] </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How can I disable the binary cache and build everything locally? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Set the binary caches to an empty list: <code>nix.binaryCaches = [];</code> in <code>configuration.nix</code> or pass ad-hoc <code>--option binary-caches <nowiki>''</nowiki></code> as parameter to nix-build or its wrappers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is also useful to make simple configuration changes in NixOS (ex.: network related), when no network connectivity is available: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nixos-rebuild switch --option binary-caches ''</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How do I enable sandboxed builds on non-NixOS? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Two options have to be added to make sandboxed builds work on Nix, ''build-use-sandbox'' and ''build-sandbox-paths'': </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> # /etc/nix/nix.conf build-use-sandbox = true build-sandbox-paths = $(nix-store -qR $(nix-build '<nixpkgs>' -A bash) | xargs echo /bin/sh=$(nix-build '<nixpkgs>' -A bash)/bin/bash) </syntaxhighlight> On NixOS set the following in ''configuration.nix'': </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> nix.settings.sandbox = true; </syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> See [[Nix package manager#Sandbox_builds]] for more details. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == How can I install a package from unstable while remaining on the stable channel? == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you simply want to run a ''nix-shell'' with a package from unstable, you can run a command like the following: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nix-shell -I nixpkgs=channel:nixpkgs-unstable -p somepackage</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is possible to have multiple nix-channels simultaneously. To add the unstable channel with the specifier ''unstable'', </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable</syntaxhighlight> After updating the channel </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">sudo nix-channel --update nixos-unstable</syntaxhighlight> queries via <code>nix-env</code> will show packages from both ''stable'' and ''unstable''. Use this to install unstable packages into your user environment. The following snippet shows how this can be done in ''configuration.nix''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="nix"> { config, pkgs, ... }: let unstable = import <nixos-unstable> {}; in { environment.systemPackages = [ unstable.PACKAGE_NAME ]; } </syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This only changes what version of <code>PACKAGE_NAME</code> is available on <code>$PATH</code>. If the package you want to take from unstable is installed through a NixOS module, you must use [[overlays]]: <syntaxhighlight lang="nix"> { config, pkgs, ... }: let unstable = import <nixos-unstable> {}; in { nixpkgs.overlays = [ (self: super: { PACKAGE_NAME = unstable.PACKAGE_NAME; }) ]; } </syntaxhighlight> Note that this will rebuild all packages depending on the overlaid package, which may be a lot. Some modules offer a <code>services.foo.package</code> to change the actual derivation used by the module without and overlay, and without recompiling dependencies ([https://nixos.org/manual/nixos/stable/options.html#opt-services.gvfs.package example]). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you want to install unfree packages from unstable you need to also set allowUnfree by replacing the import statment above with: <syntaxhighlight lang="nix"> import <nixos-unstable> { config = { allowUnfree = true; }; } </syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == I'm unable to connect my USB HDD | External HDD is failing to mount automatically == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Note:''' If you're using a kernel with at least version 5.6, you don't need to explicitly add this. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> exfat is not supported in NixOS by default - since there are legality issues still with exFAT filesystem. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">su nano /etc/nixos/configuration.nix</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Add this line to your configuration file. <syntaxhighlight lang="bash">boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> After saving the file rebuild NixOS: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Restart NixOS. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == What is the origin of the name "Nix" == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The name <code>Nix</code> comes from the Dutch word [https://en.wiktionary.org/wiki/nix niks] which means ''nothing''. It reflects the fact that Nix derivations do not have access to anything that has not been explicitly declared as an input.<ref>Eelco Dolstra et al. “Nix: A Safe and Policy-Free System for Software Deployment.” LiSA (2004), https://pdfs.semanticscholar.org/5fd8/8f89bd8738816e62808a1b7fb12d3ab14a2f.pdf</ref> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == What does it mean to say that NixOS is "immutable" == Immutability is a property of data, in general, which means that the data cannot be modified after it is created. In the context of an operating system, it really means that certain parts of the system have this property. In the case of Nix and NixOS, that includes the Nix store, where files can be created but not modified after the time they are created. It does not apply to every part of the operating system, in that users can still modify their own files in their home directory, for example. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == I'm getting ‘infinite recursion’ errors when trying to do something clever with <code>imports</code> == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Evaluating the <code>imports</code> attribute of a NixOS module (such as configuration.nix) is a prerequisite for evaluating just about everything else, so trying anything clever with <code>imports</code> is a common source of infinite recursion (because the evaluator can't determine the values of packages and options without knowing what is imported, and can't determine what is imported without knowing the values of packages or options). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You should not try to conditionally import other modules based on other values. Make your imports unconditional, and make the modules that you're importing have conditional ''behavior'' based on the values of options. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If it helps, think of <code>imports</code> as akin to an <code>#include</code> directive in C. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> (Note that none of this applies to the [https://nix.dev/manual/nix/stable/language/builtins#builtins-import <code>import</code> built-in Nix language function], which is its own thing.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> {{:FAQ/Libraries}} {{:FAQ/nix-env -iA}} {{:FAQ/stateVersion}} {{:FAQ/notfound}} {{:FAQ/unfree}} <!-- Transclude subpages --> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == References == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Category:Cookbook]] </div>