Wiki: https://fedoraproject.org/wiki/Changes/Nix_package_tool

Discussion Thread: https://discussion.fedoraproject.org/t/170391

**This is a proposed Change for Fedora Linux.**
This document represents a proposed Change. As part of the Changes process,
proposals are publicly announced in order to receive community feedback.
This proposal will only be implemented if approved by the Fedora
Engineering Steering Committee.

== Summary ==
Add the [https://github.com/NixOS/nix/ nix] functional package manager
developer tool to Fedora.

== Owner ==
* Name: [[User:Petersen| Jens Petersen]]
* Email: <[email protected]>
* Name: [[User:zbyszek| Zbigniew Jędrzejewski-Szmek]]
* Email: <[email protected]>


== Detailed Description ==
Nix is a cross-platform package manager for Unix-like systems with its own
package ecosystem.
It is also the package manager for the NixOS Linux operating system.
The nix package tool provides access to the [
https://github.com/NixOS/nixpkgs nixpkgs] ecosystem with over 100,000 [
https://search.nixos.org/packages packages].
Packages and environments can be specified in nix's declarative functional
programming language using so-called derivations. Nix [
https://wiki.nixos.org/wiki/Flakes flakes] provide a newer way to specify
these project development environments.

Nix has two main modes of installation/setup: multi-user mode (with
nix-daemon) and single-user mode
(below these are abbreviated as "multiuser" and "singleuser" respectively).
The Fedora package tries to support both of them, though multiuser mode
setup where available is more seamless. It does this by providing
`nix-daemon` and `nix-system` subpackages which both require
`nix-filesystem`. The `/nix` toplevel directory is defined with tmpfiles.d
and can be a Btrfs subvolume if setup.

== Feedback ==

== Benefit to Fedora ==
Some developers and upstream projects now prefer or use nix for development
and reproducible build environments.
Just as we have apt packaged in Fedora, this change adds a nix package
allowing access to its ecosystem from Fedora.

With the implementation of this Change, Fedora users will be able to
install nix easily on their system and leverage it in development projects
that may require nix.  They will also be able to easily try out some of the
many packages in nixpkgs for testing or experimenting, etc.

For some time I have maintained a nix [
https://copr.fedorainfracloud.org/coprs/petersen/nix/ copr repo] which is
quite popular (see the download numbers and note a number of other nix copr
repos also exist), but it will be easier for Fedora users to have the nix
package directly available from Fedora repos.

== Scope ==
* Proposal owners:
** prepare the [https://src.fedoraproject.org/rpms/nix package] of nix
version 2.31 or later [[https://bugzilla.redhat.com/show_bug.cgi?id=2388768
pkgreview]]

* Policies and guidelines:
** We have received an [https://pagure.io/fesco/issue/3473 exception
approval] from FESCO to allow the nix package to use /nix toplevel
directory at runtime, as it is needed to make full use of nixpkgs and
cachix binaries, etc.
** The approved exception still needs to be documented
** To be clear: nix and its subpackages will remain optional development
packages that Fedora users can install manually if they wish, and in
particular /nix is not to be used for Fedora Linux development.

* Trademark approval: N/A (not needed for this Change)

* Alignment with the Fedora Strategy:

== Upgrade/compatibility impact ==


== How To Test ==
Copr builds are available from
https://copr.fedorainfracloud.org/coprs/petersen/nix/.

Installation/setup:

Either:
* Multiuser daemon mode:
** `sudo dnf install nix`
** `sudo systemctl enable --now nix-daemon`

or

* Singleuser mode
** `sudo dnf install nix --exclude nix-daemon`
** `sudo usermod -G nixbld -a $USER`

See also `/usr/share/doc/nix/README.fedora.md` or
https://src.fedoraproject.org/rpms/nix.

Then try out the tool:
* `nix-shell -p hello`
* try the `*.nix` examples in
https://src.fedoraproject.org/rpms/nix/blob/rawhide/f/examples
* `nix search nixpkgs <package-regexp>`
* try online documentation examples or projects

Notes:
* Upstream recommends using the nix-daemon and multiuser mode.
* However `/nix` is incompatible with ostree (it can probably be used in
bootc Image Mode): so on ostree systems one should use it within a toolbox
instead.
* Since containers and toolbox normally do not have functioning systemd: it
is not possible to use nix-daemon inside containers by default
** instead install the nix-singleuser subpackage
* Be warned that nix can easily use up ''large amounts of diskspace''. You
can use `nix-collect-garbage` to clean up or clear `/nix/store/`.  In the
worst case it should be safe to remove `rm -r /nix/store/*` completely. The
`/nix` tree can also safely be removed after uninstalling nix.
* Please use nix and nixpkgs etc at your own risk, as you would other
upstream package ecosystems.

== User Experience ==
Fedora users can now seamlessly install and use the Nix package manager for
development or running its packages locally on their system.

== Dependencies ==
There are no blocking dependencies.  However:

* newer boost library would allow shipping latest nix 2.32 [in progress]
* mdbook (rust-based documentation tool) would probably allow building the
documentation (and manpages) [under review]


== Contingency Plan ==


== Documentation ==
See https://nix.dev/reference/nix-manual.html.

== Release Notes ==
* The Nix package manager developer tool has been packaged in Fedora for
users.
-- 
_______________________________________________
devel-announce mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue
-- 
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to