Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Separate profiles #32776

Closed
wants to merge 5 commits into from
Closed

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Dec 17, 2017

Motivation for this change

In the nixos/modules folder, it's not always clear what file is meant to be used in an module imports. I call those modules "profiles". Those mutate the system config without a mkEnableOption or similar and generally need to be scrutinized as they may clash with other profiles.

To make that separation cleaner, I propose to move them to a new nixos/profiles folder. It will make it more evident that they can be imported, and will also expose how many of those exists by not being hidden between the other nixos module files.

This is just a start, there are actually more files that are not in the nixos/modules/modules-list:

modules/testing/minimal-kernel.nix
modules/testing/test-instrumentation.nix
modules/tasks/filesystems/glusterfs.nix
modules/programs/nylas-mail.nix
modules/programs/virtualbox.nix
modules/services/networking/aria2.nix
modules/services/networking/keepalived/virtual-ip-options.nix
modules/services/networking/keepalived/vrrp-options.nix
modules/services/networking/nghttpx/frontend-params-submodule.nix
modules/services/networking/nghttpx/backend-submodule.nix
modules/services/networking/nghttpx/server-options.nix
modules/services/networking/nghttpx/nghttpx-options.nix
modules/services/networking/nghttpx/frontend-submodule.nix
modules/services/networking/nghttpx/tls-submodule.nix
modules/services/networking/nghttpx/backend-params-submodule.nix
modules/services/x11/window-managers/pekwm.nix
modules/services/x11/window-managers/openbox.nix
modules/services/x11/window-managers/windowmaker.nix
modules/services/x11/window-managers/i3.nix
modules/services/x11/window-managers/2bwm.nix
modules/services/x11/window-managers/exwm.nix
modules/services/x11/window-managers/clfswm.nix
modules/services/x11/window-managers/mwm.nix
modules/services/x11/window-managers/spectrwm.nix
modules/services/x11/window-managers/dwm.nix
modules/services/x11/window-managers/jwm.nix
modules/services/x11/window-managers/ratpoison.nix
modules/services/x11/window-managers/stumpwm.nix
modules/services/x11/window-managers/qtile.nix
modules/services/x11/window-managers/sawfish.nix
modules/services/x11/window-managers/fvwm.nix
modules/services/x11/window-managers/afterstep.nix
modules/services/x11/window-managers/oroborus.nix
modules/services/x11/window-managers/notion.nix
modules/services/x11/window-managers/evilwm.nix
modules/services/x11/window-managers/herbstluftwm.nix
modules/services/x11/desktop-managers/maxx.nix
modules/services/x11/desktop-managers/xterm.nix
modules/services/x11/desktop-managers/gnome3.nix
modules/services/x11/desktop-managers/mate.nix
modules/services/x11/desktop-managers/plasma5.nix
modules/services/x11/desktop-managers/lumina.nix
modules/services/x11/desktop-managers/enlightenment.nix
modules/services/x11/desktop-managers/kodi.nix
modules/services/x11/desktop-managers/xfce.nix
modules/services/x11/desktop-managers/lxqt.nix
modules/services/x11/desktop-managers/none.nix
modules/services/x11/terminal-server.nix
modules/services/x11/display-managers/lightdm-greeters/gtk.nix
modules/services/databases/cassandra.nix
modules/services/databases/rethinkdb.nix
modules/services/web-servers/nginx/vhost-options.nix
modules/services/web-servers/nginx/location-options.nix
modules/services/web-servers/phpfpm/pool-options.nix
modules/services/web-servers/apache-httpd/tomcat-connector.nix
modules/services/web-servers/apache-httpd/phabricator.nix
modules/services/web-servers/apache-httpd/wordpress.nix
modules/services/web-servers/apache-httpd/owncloud.nix
modules/services/web-servers/apache-httpd/mercurial.nix
modules/services/web-servers/apache-httpd/foswiki.nix
modules/services/web-servers/apache-httpd/mediawiki.nix
modules/services/web-servers/apache-httpd/limesurvey.nix
modules/services/web-servers/apache-httpd/per-server-options.nix
modules/services/web-servers/apache-httpd/zabbix.nix
modules/services/web-servers/apache-httpd/trac.nix
modules/services/misc/gitit.nix
modules/services/misc/taskserver/default.nix
modules/services/hardware/sane_extra_backends/brscan4.nix
modules/services/hardware/sane_extra_backends/brscan4_etc_files.nix
modules/services/monitoring/dd-agent/dd-agent-defaults.nix
modules/system/boot/systemd-unit-options.nix
modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix
modules/system/boot/loader/generic-extlinux-compatible/default.nix
modules/system/boot/systemd-lib.nix
modules/system/activation/no-clone.nix
modules/hardware/video/radeon.nix
modules/hardware/network/smc-2632w/default.nix
modules/hardware/network/zydas-zd1211.nix
modules/hardware/network/intel-2200bg.nix
modules/hardware/network/broadcom-43xx.nix
modules/virtualisation/nova-config.nix
modules/virtualisation/azure-bootstrap-blobs.nix
modules/virtualisation/brightbox-config.nix
modules/virtualisation/brightbox-image.nix
modules/virtualisation/azure-image.nix
modules/virtualisation/openstack/common.nix
modules/virtualisation/ec2-data.nix
modules/virtualisation/xen-domU.nix
modules/virtualisation/azure-config.nix
modules/virtualisation/google-compute-config.nix
modules/virtualisation/virtualbox-image.nix
modules/virtualisation/amazon-init.nix
modules/virtualisation/qemu-vm.nix
modules/virtualisation/google-compute-image.nix
modules/virtualisation/docker-image.nix
modules/virtualisation/azure-config-user.nix
modules/virtualisation/amazon-image.nix
modules/virtualisation/gce-images.nix
modules/virtualisation/ec2-amis.nix
modules/virtualisation/azure-common.nix
modules/virtualisation/grow-partition.nix
modules/virtualisation/azure-images.nix
modules/virtualisation/lxc-container.nix
modules/virtualisation/azure-agent.nix
modules/virtualisation/nova.nix
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Copy link
Member

@grahamc grahamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This pr is very easy to review if you go commit by commit, way to go @zimbatm!

This looks amazing, and I completely agree with why you've made the change. I'm slightly concerned about the symlinks, see my comment as to why. However -- the alternative is a bit 😬 .

Updated one good thing about using stub files in place of the symlinks is we have an opportunity to emit a trace saying it has been moved to XYZNEWPATH, meaning we don't have to maintain those stubs / symlinks forever.

# This module automatically grows the root partition on virtual machines.
# This allows an instance to be created with a bigger root filesystem
# than provided by the machine image.
# This profile is deprecated, use boot.growPartition directly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps replace this file with an entry in nixos/modules/rename.nix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Addressed in #33521

@@ -0,0 +1 @@
../profiles/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a symlink? One thing to note is nixpkgs currently has no symlinks, and it may be worth a bit of effort to keep it that way. I've considered adding a check for this in Ofborg, because symlinks can evade some of the restricted evaluation settings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can replace the symlinks with stubs that warn + import.

@@ -155,7 +155,7 @@ look like this:

{
imports =
[ <nixos/modules/installer/scan/not-detected.nix>
[ <nixos/profiles/installer/scan/not-detected.nix>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind changing the > to a >?

@@ -0,0 +1 @@
../profiles/installer/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see my other symlink comment)

@zimbatm zimbatm mentioned this pull request Jan 6, 2018
8 tasks
@zimbatm
Copy link
Member Author

zimbatm commented Jan 6, 2018

It's going to take a while to do this properly. For example <nixpkgs/nixos/modules/installer/scan/not-detected.nix> is in almost all hardware-configuration.nix.

Restore from git history if there is interest
This are installed on *all* the systems
This is not installer-specific
Modules should not have side-effects on the system unless explicitly
enabled.
Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consent with the idea. I have not tested the correctness of this pull request.

@7c6f434c
Copy link
Member

7c6f434c commented Mar 1, 2018

Re: files not imported from module-list: note that some of these are transitively imported, for example via modules/services/x11/window-managers/default.nix

@zimbatm
Copy link
Member Author

zimbatm commented Mar 1, 2018

I want to move carefully with this, I will wait until after 18.03 to start working on this again

@samueldr
Copy link
Member

samueldr commented Aug 26, 2018

Checks watch we're way past "after 18.03" ;).

Do you think you'll be able to review and shape this up for 19.03? I'm 👍 for the idea and approach.

Now that I have commented, this'll be easy to find using involves:samueldr with github search

@zimbatm zimbatm closed this Nov 21, 2018
@zimbatm zimbatm deleted the separate-profiles branch November 21, 2018 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants