From a7e1ea970b92794c98c3a40c331144fc61bd7aff Mon Sep 17 00:00:00 2001 From: Jared Baur <jaredbaur@fastmail.com> Date: Wed, 5 Jun 2024 20:12:09 -0700 Subject: [PATCH 1/4] nixos/perlless: enable switch-to-configuration-ng for perlless profile The switch-to-configuration-ng program provides a perl-free way of switching nixos systems, we can use it for the perlless profile. --- nixos/modules/profiles/perlless.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nixos/modules/profiles/perlless.nix b/nixos/modules/profiles/perlless.nix index 010e4f8f2a28..f75c2f558b94 100644 --- a/nixos/modules/profiles/perlless.nix +++ b/nixos/modules/profiles/perlless.nix @@ -6,10 +6,12 @@ { - # Disable switching to a new configuration. This is not a necessary - # limitation of a perlless system but just a current one. In the future, - # perlless switching might be possible. - system.switch.enable = lib.mkDefault false; + # switch-to-configuration-ng reimplements switch-to-configuration, but + # without perl. + system.switch = lib.mkDefault { + enable = false; + enableNg = true; + }; # Remove perl from activation boot.initrd.systemd.enable = lib.mkDefault true; From 317c95620a59bd2b53b508424a2f30e01da0343a Mon Sep 17 00:00:00 2001 From: Jared Baur <jaredbaur@fastmail.com> Date: Wed, 5 Jun 2024 20:23:19 -0700 Subject: [PATCH 2/4] switch-to-configuration-ng: add a README Add a README so nixpkgs folks can have a cursory understanding of what this program is here for. --- pkgs/by-name/sw/switch-to-configuration-ng/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pkgs/by-name/sw/switch-to-configuration-ng/README.md diff --git a/pkgs/by-name/sw/switch-to-configuration-ng/README.md b/pkgs/by-name/sw/switch-to-configuration-ng/README.md new file mode 100644 index 000000000000..7401a037dfcb --- /dev/null +++ b/pkgs/by-name/sw/switch-to-configuration-ng/README.md @@ -0,0 +1,3 @@ +# switch-to-configuration-ng + +This program is a reimplementation of [switch-to-configuration](nixos/modules/system/activation/switch-to-configuration.pl) in Rust. The goal is to be compatible in as many ways as possible to the original implementation, at least as long as the original is still in nixpkgs. Any behavioral modifications to this program should also be implemented in the original, and vice versa. From 0144b6a270f25097d0db2f2b773de1d8862eafea Mon Sep 17 00:00:00 2001 From: Jared Baur <jaredbaur@fastmail.com> Date: Wed, 5 Jun 2024 20:24:21 -0700 Subject: [PATCH 3/4] nixos/switch-to-configuration: add a note for future modifications Any future behavioral modifications to switch-to-configuration should also be made to switch-to-configuration-ng. Leave a note at the top of the script to ensure people don't forget. --- nixos/modules/system/activation/switch-to-configuration.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index cabc1dcc2d65..4beca4f0a42a 100755 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -1,5 +1,10 @@ #! @perl@/bin/perl +# NOTE: This script has an alternative implementation at +# <nixpkgs/pkgs/by-name/sw/switch-to-configuration-ng>. Any behavioral +# modifications to this script should also be made to that implementation. + + # Issue #166838 uncovered a situation in which a configuration not suitable # for the target architecture caused a cryptic error message instead of # a clean failure. Due to this mismatch, the perl interpreter in the shebang From 6f1f3c810dc147ae3dfa07265f3ed6e27b2c3ff0 Mon Sep 17 00:00:00 2001 From: Jared Baur <jaredbaur@fastmail.com> Date: Fri, 21 Jun 2024 23:27:58 -0700 Subject: [PATCH 4/4] nixos/perlless: fix perl showing up! The install-grub script is perl, so the perlless profile should disable it by default. --- nixos/modules/profiles/perlless.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/profiles/perlless.nix b/nixos/modules/profiles/perlless.nix index f75c2f558b94..6257589ef9eb 100644 --- a/nixos/modules/profiles/perlless.nix +++ b/nixos/modules/profiles/perlless.nix @@ -23,6 +23,7 @@ programs.less.lessopen = lib.mkDefault null; programs.command-not-found.enable = lib.mkDefault false; boot.enableContainers = lib.mkDefault false; + boot.loader.grub.enable = lib.mkDefault false; environment.defaultPackages = lib.mkDefault [ ]; documentation.info.enable = lib.mkDefault false;