diff --git a/pkgs/tools/misc/calamares/default.nix b/pkgs/tools/misc/calamares/default.nix
index 911204150212..8afb103e9d49 100644
--- a/pkgs/tools/misc/calamares/default.nix
+++ b/pkgs/tools/misc/calamares/default.nix
@@ -1,24 +1,48 @@
-{ lib, fetchurl, boost, cmake, extra-cmake-modules, kparts, kpmcore
-, kservice, libatasmart, libxcb, libyamlcpp, parted, polkit-qt, python, qtbase
-, qtquickcontrols, qtsvg, qttools, qtwebengine, util-linux, tzdata
+{ lib, fetchurl, boost, cmake, extra-cmake-modules, kparts, kpmcore, kirigami2
+, kservice, libatasmart, libxcb, libyamlcpp, libpwquality, parted, polkit-qt, python
+, qtbase, qtquickcontrols, qtsvg, qttools, qtwebengine, util-linux, tzdata
, ckbcomp, xkeyboard_config, mkDerivation
+, nixos-extensions ? false
}:
mkDerivation rec {
pname = "calamares";
- version = "3.2.55";
+ version = "3.2.56";
# release including submodule
src = fetchurl {
- url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.gz";
- sha256 = "sha256-1xf02rjy6+83zbU2yxGUGjcIGJfYS8ryqi4CBzrh7kI=";
+ url = "https://github.com/calamares/calamares/releases/download/v${version}/${pname}-${version}.tar.gz";
+ sha256 = "e1402d7693659b85c5e553481a7252d91350c3f33ffea413488d7712d3281e03";
};
+ patches = lib.optionals nixos-extensions [
+ # Modifies the users module to only set passwords of user and root
+ # as the users will have already been created in the configuration.nix file
+ ./userjob.patch
+ # Makes calamares search /run/current-system/sw/share/calamares/ for extra configuration files
+ # as by default it only searches /usr/share/calamares/ and /nix/store/-calamares-/share/calamares/
+ # but calamares-nixos-extensions is not in either of these locations
+ ./nixos-extensions-paths.patch
+ # Uses pkexec within modules in order to run calamares without root permissions as a whole
+ # Also fixes storage check in the welcome module
+ ./nonroot.patch
+ # Adds unfree qml to packagechooserq
+ ./unfreeq.patch
+ # Adds config to change name of packagechooserq
+ # Upstreamed in PR: https://github.com/calamares/calamares/pull/1932
+ ./packagechooserq.patch
+ # Modifies finished module to add some NixOS resources
+ # Modifies packagechooser module to change the UI
+ ./uimod.patch
+ # Remove options for unsupported partition types
+ ./partitions.patch
+ ];
+
nativeBuildInputs = [ cmake extra-cmake-modules ];
buildInputs = [
- boost kparts.dev kpmcore.out kservice.dev
- libatasmart libxcb libyamlcpp parted polkit-qt python qtbase
- qtquickcontrols qtsvg qttools qtwebengine.dev util-linux
+ boost kparts.dev kpmcore.out kservice.dev kirigami2
+ libatasmart libxcb libyamlcpp libpwquality parted polkit-qt python
+ qtbase qtquickcontrols qtsvg qttools qtwebengine.dev util-linux
];
cmakeFlags = [
@@ -32,15 +56,28 @@ mkDerivation rec {
POLKITQT-1_POLICY_FILES_INSTALL_DIR = "$(out)/share/polkit-1/actions";
postPatch = ''
+ # Run calamares without root. Other patches make it functional as a normal user
+ sed -e "s,pkexec calamares,calamares," \
+ -i calamares.desktop
+
+ sed -e "s,X-AppStream-Ignore=true,&\nStartupWMClass=io.calamares.calamares," \
+ -i calamares.desktop
+
+ # Fix desktop reference with wayland
+ mv calamares.desktop io.calamares.calamares.desktop
+
+ sed -e "s,calamares.desktop,io.calamares.calamares.desktop," \
+ -i CMakeLists.txt
+
sed -e "s,/usr/bin/calamares,$out/bin/calamares," \
- -i calamares.desktop \
-i com.github.calamares.calamares.policy
sed -e 's,/usr/share/zoneinfo,${tzdata}/share/zoneinfo,' \
- -i src/modules/locale/SetTimezoneJob.cpp
+ -i src/modules/locale/SetTimezoneJob.cpp \
+ -i src/libcalamares/locale/TimeZone.cpp
sed -e 's,/usr/share/X11/xkb/rules/base.lst,${xkeyboard_config}/share/X11/xkb/rules/base.lst,' \
- -i src/modules/keyboard/keyboardwidget/keyboardglobal.h
+ -i src/modules/keyboard/keyboardwidget/keyboardglobal.cpp
sed -e 's,"ckbcomp","${ckbcomp}/bin/ckbcomp",' \
-i src/modules/keyboard/keyboardwidget/keyboardpreview.cpp
@@ -51,8 +88,9 @@ mkDerivation rec {
meta = with lib; {
description = "Distribution-independent installer framework";
- license = with licenses; [ gpl3Plus bsd2 ];
- maintainers = with maintainers; [ manveru ];
+ homepage = "https://calamares.io/";
+ license = with licenses; [ gpl3Plus bsd2 cc0 ];
+ maintainers = with maintainers; [ manveru vlinkz ];
platforms = platforms.linux;
};
}
diff --git a/pkgs/tools/misc/calamares/nixos-extensions-paths.patch b/pkgs/tools/misc/calamares/nixos-extensions-paths.patch
new file mode 100644
index 000000000000..4e0012160e9f
--- /dev/null
+++ b/pkgs/tools/misc/calamares/nixos-extensions-paths.patch
@@ -0,0 +1,46 @@
+diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp
+index de709156f..a0b6c5faf 100644
+--- a/src/calamares/main.cpp
++++ b/src/calamares/main.cpp
+@@ -131,6 +132,8 @@ main( int argc, char* argv[] )
+ // TODO: umount anything in /tmp/calamares-... as an emergency save function
+ #endif
+
++ CalamaresUtils::setNixosDirs();
++
+ bool is_debug = handle_args( a );
+
+ #ifdef WITH_KF5DBus
+diff --git a/src/libcalamares/utils/Dirs.cpp b/src/libcalamares/utils/Dirs.cpp
+index f333d6e64..6118fb412 100644
+--- a/src/libcalamares/utils/Dirs.cpp
++++ b/src/libcalamares/utils/Dirs.cpp
+@@ -115,6 +116,14 @@ setXdgDirs()
+ s_haveExtraDirs = !( s_extraConfigDirs.isEmpty() && s_extraDataDirs.isEmpty() );
+ }
+
++void
++setNixosDirs()
++{
++ s_extraConfigDirs << "/run/current-system/sw/share/calamares/";
++ s_extraDataDirs << "/run/current-system/sw/share/calamares/";
++ s_haveExtraDirs = !( s_extraConfigDirs.isEmpty() && s_extraDataDirs.isEmpty() );
++}
++
+ QStringList
+ extraConfigDirs()
+ {
+diff --git a/src/libcalamares/utils/Dirs.h b/src/libcalamares/utils/Dirs.h
+index 445cbe1f1..da869d446 100644
+--- a/src/libcalamares/utils/Dirs.h
++++ b/src/libcalamares/utils/Dirs.h
+@@ -50,6 +50,9 @@ DLLEXPORT bool isAppDataDirOverridden();
+ /** @brief Setup extra config and data dirs from the XDG variables.
+ */
+ DLLEXPORT void setXdgDirs();
++/** @brief Setup extra config and data dirs fir NixOS.
++ */
++DLLEXPORT void setNixosDirs();
+ /** @brief Are any extra directories configured? */
+ DLLEXPORT bool haveExtraDirs();
+ /** @brief XDG_CONFIG_DIRS, each guaranteed to end with / */
diff --git a/pkgs/tools/misc/calamares/nonroot.patch b/pkgs/tools/misc/calamares/nonroot.patch
new file mode 100644
index 000000000000..7843f45f284c
--- /dev/null
+++ b/pkgs/tools/misc/calamares/nonroot.patch
@@ -0,0 +1,105 @@
+diff --git a/src/libcalamares/utils/Runner.cpp b/src/libcalamares/utils/Runner.cpp
+index c7146c2d7..e165d9a8f 100644
+--- a/src/libcalamares/utils/Runner.cpp
++++ b/src/libcalamares/utils/Runner.cpp
+@@ -140,13 +140,13 @@ Calamares::Utils::Runner::run()
+ }
+ if ( m_location == RunLocation::RunInTarget )
+ {
+- process.setProgram( "chroot" );
+- process.setArguments( QStringList { workingDirectory.absolutePath() } << m_command );
++ process.setProgram( "pkexec" );
++ process.setArguments( QStringList { "chroot" } + QStringList { workingDirectory.absolutePath() } << m_command );
+ }
+ else
+ {
+- process.setProgram( "env" );
+- process.setArguments( m_command );
++ process.setProgram( "pkexec" );
++ process.setArguments( QStringList { "env" } + m_command );
+ }
+
+ if ( m_output )
+diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py
+index a3318d1a0..5fbe202fd 100644
+--- a/src/modules/mount/main.py
++++ b/src/modules/mount/main.py
+@@ -152,7 +152,8 @@ def mount_partition(root_mount_point, partition, partitions):
+
+ # Ensure that the created directory has the correct SELinux context on
+ # SELinux-enabled systems.
+- os.makedirs(mount_point, exist_ok=True)
++ subprocess.check_call(["pkexec", "mkdir", "-p", mount_point])
++
+ try:
+ subprocess.call(['chcon', '--reference=' + raw_mount_point, mount_point])
+ except FileNotFoundError as e:
+@@ -193,13 +194,13 @@ def mount_partition(root_mount_point, partition, partitions):
+ for s in btrfs_subvolumes:
+ if not s["subvolume"]:
+ continue
+- os.makedirs(root_mount_point + os.path.dirname(s["subvolume"]), exist_ok=True)
+- subprocess.check_call(["btrfs", "subvolume", "create",
++ subprocess.check_call(["pkexec", "mkdir", "-p", root_mount_point + os.path.dirname(s["subvolume"])])
++ subprocess.check_call(["pkexec", "btrfs", "subvolume", "create",
+ root_mount_point + s["subvolume"]])
+ if s["mountPoint"] == "/":
+ # insert the root subvolume into global storage
+ libcalamares.globalstorage.insert("btrfsRootSubvolume", s["subvolume"])
+- subprocess.check_call(["umount", "-v", root_mount_point])
++ subprocess.check_call(["pkexec", "umount", "-v", root_mount_point])
+
+ device = partition["device"]
+
+diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp
+index ca7219ca4..6ac682ba4 100644
+--- a/src/modules/welcome/checker/GeneralRequirements.cpp
++++ b/src/modules/welcome/checker/GeneralRequirements.cpp
+@@ -371,10 +371,34 @@ GeneralRequirements::checkEnoughStorage( qint64 requiredSpace )
+ cWarning() << "GeneralRequirements is configured without libparted.";
+ return false;
+ #else
+- return check_big_enough( requiredSpace );
++ return big_enough( requiredSpace );
+ #endif
+ }
+
++bool
++GeneralRequirements::big_enough( qint64 requiredSpace )
++{
++ FILE *fpipe;
++ char command[128];
++ snprintf(command, sizeof(command), "lsblk --bytes -no SIZE,TYPE | grep disk | awk '$1 > %llu {print $1}'", requiredSpace);
++ char c = 0;
++
++ if (0 == (fpipe = (FILE*)popen(command, "r")))
++ {
++ cWarning() << "Failed to check storage size.";
++ return false;
++ }
++
++ while (fread(&c, sizeof c, 1, fpipe))
++ {
++ pclose(fpipe);
++ return true;
++ }
++
++ pclose(fpipe);
++
++ return false;
++}
+
+ bool
+ GeneralRequirements::checkEnoughRam( qint64 requiredRam )
+diff --git a/src/modules/welcome/checker/GeneralRequirements.h b/src/modules/welcome/checker/GeneralRequirements.h
+index b6646da11..ea27324fa 100644
+--- a/src/modules/welcome/checker/GeneralRequirements.h
++++ b/src/modules/welcome/checker/GeneralRequirements.h
+@@ -36,6 +36,7 @@ private:
+ bool checkHasPower();
+ bool checkHasInternet();
+ bool checkIsRoot();
++ bool big_enough( qint64 requiredSpace );
+
+ qreal m_requiredStorageGiB;
+ qreal m_requiredRamGiB;
diff --git a/pkgs/tools/misc/calamares/packagechooserq.patch b/pkgs/tools/misc/calamares/packagechooserq.patch
new file mode 100644
index 000000000000..90a7b22de8b5
--- /dev/null
+++ b/pkgs/tools/misc/calamares/packagechooserq.patch
@@ -0,0 +1,136 @@
+diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp
+index 491fe5c25..667621597 100644
+--- a/src/modules/packagechooser/Config.cpp
++++ b/src/modules/packagechooser/Config.cpp
+@@ -237,6 +237,12 @@ Config::setPackageChoice( const QString& packageChoice )
+ emit packageChoiceChanged( m_packageChoice.value_or( QString() ) );
+ }
+
++QString
++Config::prettyName() const
++{
++ return m_stepName ? m_stepName->get() : tr( "Packages" );
++}
++
+ QString
+ Config::prettyStatus() const
+ {
+@@ -343,4 +349,14 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
+ cWarning() << "Single-selection QML module must use 'Legacy' method.";
+ }
+ }
++
++ bool labels_ok = false;
++ auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
++ if ( labels_ok )
++ {
++ if ( labels.contains( "step" ) )
++ {
++ m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
++ }
++ }
+ }
+diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h
+index b04b1c30b..d1b783a8d 100644
+--- a/src/modules/packagechooser/Config.h
++++ b/src/modules/packagechooser/Config.h
+@@ -98,6 +98,7 @@ public:
+ QString packageChoice() const { return m_packageChoice.value_or( QString() ); }
+ void setPackageChoice( const QString& packageChoice );
+
++ QString prettyName() const;
+ QString prettyStatus() const;
+
+ signals:
+@@ -120,6 +121,7 @@ private:
+ * Reading the property will return an empty QString.
+ */
+ std::optional< QString > m_packageChoice;
++ CalamaresUtils::Locale::TranslatedString* m_stepName; // As it appears in the sidebar
+ };
+
+
+diff --git a/src/modules/packagechooser/PackageChooserViewStep.cpp b/src/modules/packagechooser/PackageChooserViewStep.cpp
+index 9057004de..8eacf82ec 100644
+--- a/src/modules/packagechooser/PackageChooserViewStep.cpp
++++ b/src/modules/packagechooser/PackageChooserViewStep.cpp
+@@ -29,7 +29,6 @@ PackageChooserViewStep::PackageChooserViewStep( QObject* parent )
+ : Calamares::ViewStep( parent )
+ , m_config( new Config( this ) )
+ , m_widget( nullptr )
+- , m_stepName( nullptr )
+ {
+ emit nextStatusChanged( false );
+ }
+@@ -41,14 +40,12 @@ PackageChooserViewStep::~PackageChooserViewStep()
+ {
+ m_widget->deleteLater();
+ }
+- delete m_stepName;
+ }
+
+-
+ QString
+ PackageChooserViewStep::prettyName() const
+ {
+- return m_stepName ? m_stepName->get() : tr( "Packages" );
++ return m_config->prettyName();
+ }
+
+
+@@ -139,16 +136,6 @@ PackageChooserViewStep::setConfigurationMap( const QVariantMap& configurationMap
+ m_config->setDefaultId( moduleInstanceKey() );
+ m_config->setConfigurationMap( configurationMap );
+
+- bool labels_ok = false;
+- auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
+- if ( labels_ok )
+- {
+- if ( labels.contains( "step" ) )
+- {
+- m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
+- }
+- }
+-
+ if ( m_widget )
+ {
+ hookupModel();
+diff --git a/src/modules/packagechooser/PackageChooserViewStep.h b/src/modules/packagechooser/PackageChooserViewStep.h
+index 7561f2bd7..76b35aed8 100644
+--- a/src/modules/packagechooser/PackageChooserViewStep.h
++++ b/src/modules/packagechooser/PackageChooserViewStep.h
+@@ -50,7 +50,6 @@ private:
+
+ Config* m_config;
+ PackageChooserPage* m_widget;
+- CalamaresUtils::Locale::TranslatedString* m_stepName; // As it appears in the sidebar
+ };
+
+ CALAMARES_PLUGIN_FACTORY_DECLARATION( PackageChooserViewStepFactory )
+diff --git a/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp b/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp
+index 543c9771d..7c4d5fda7 100644
+--- a/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp
++++ b/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp
+@@ -29,7 +29,7 @@ PackageChooserQmlViewStep::PackageChooserQmlViewStep( QObject* parent )
+ QString
+ PackageChooserQmlViewStep::prettyName() const
+ {
+- return tr( "Packages" );
++ return m_config->prettyName();
+ }
+
+ QString
+@@ -83,4 +83,13 @@ PackageChooserQmlViewStep::setConfigurationMap( const QVariantMap& configuration
+ m_config->setDefaultId( moduleInstanceKey() );
+ m_config->setConfigurationMap( configurationMap );
+ Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
++ /*bool labels_ok = false;
++ auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
++ if ( labels_ok )
++ {
++ if ( labels.contains( "step" ) )
++ {
++ m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
++ }
++ }*/
+ }
diff --git a/pkgs/tools/misc/calamares/partitions.patch b/pkgs/tools/misc/calamares/partitions.patch
new file mode 100644
index 000000000000..ae3c7961ae64
--- /dev/null
+++ b/pkgs/tools/misc/calamares/partitions.patch
@@ -0,0 +1,28 @@
+diff --git a/src/modules/partition/gui/CreatePartitionDialog.cpp b/src/modules/partition/gui/CreatePartitionDialog.cpp
+index c5b17c69e..353b6f964 100644
+--- a/src/modules/partition/gui/CreatePartitionDialog.cpp
++++ b/src/modules/partition/gui/CreatePartitionDialog.cpp
+@@ -107,7 +107,8 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device,
+ {
+ // We need to ensure zfs is added to the list if the zfs module is enabled
+ if ( ( fs->type() == FileSystem::Type::Zfs && Calamares::Settings::instance()->isModuleEnabled( "zfs" ) )
+- || ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended ) )
++ || ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended
++ && fs->type() != FileSystem::Luks && fs->type() != FileSystem::Luks2 && fs->type() != FileSystem::Minix ) )
+ {
+ fsNames << userVisibleFS( fs ); // This is put into the combobox
+ if ( fs->type() == defaultFSType )
+diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp
+index 0bc35cabe..3cf8a7fa2 100644
+--- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp
++++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp
+@@ -95,7 +95,8 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
+ {
+ // We need to ensure zfs is added to the list if the zfs module is enabled
+ if ( ( fs->type() == FileSystem::Type::Zfs && Calamares::Settings::instance()->isModuleEnabled( "zfs" ) )
+- || ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended ) )
++ || ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended
++ && fs->type() != FileSystem::Luks && fs->type() != FileSystem::Luks2 && fs->type() != FileSystem::Minix) )
+ {
+ fsNames << userVisibleFS( fs ); // For the combo box
+ }
diff --git a/pkgs/tools/misc/calamares/uimod.patch b/pkgs/tools/misc/calamares/uimod.patch
new file mode 100644
index 000000000000..5a6ec6cdeea2
--- /dev/null
+++ b/pkgs/tools/misc/calamares/uimod.patch
@@ -0,0 +1,85 @@
+diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp
+index 6c5f9ad16..24d75e07b 100644
+--- a/src/modules/finished/FinishedPage.cpp
++++ b/src/modules/finished/FinishedPage.cpp
+@@ -71,7 +71,10 @@ FinishedPage::retranslate()
+ {
+ ui->mainText->setText( tr( "All done.
"
+ "%1 has been set up on your computer.
"
+- "You may now start using your new system." )
++ "You may now start using your new system.
"
++ "You can change every setting later except the bootloader.
"
++ "Check the manual for instructions on how to install software, upgrade the system or enable services.
"
++ "You can find ways to get in touch with the community on the website!")
+ .arg( branding->versionedName() ) );
+ ui->restartCheckBox->setToolTip( tr( ""
+ "When this box is checked, your system will "
+@@ -84,7 +87,10 @@ FinishedPage::retranslate()
+ ui->mainText->setText( tr( "
All done.
"
+ "%1 has been installed on your computer.
"
+ "You may now restart into your new system, or continue "
+- "using the %2 Live environment." )
++ "using the %2 Live environment.
"
++ "You can change every setting later except the bootloader.
"
++ "Check the manual for instructions on how to install software, upgrade the system or enable services.
"
++ "You can find ways to get in touch with the community on the website!")
+ .arg( branding->versionedName(), branding->productName() ) );
+ ui->restartCheckBox->setToolTip( tr( "
"
+ "When this box is checked, your system will "
+diff --git a/src/modules/packagechooser/PackageChooserPage.cpp b/src/modules/packagechooser/PackageChooserPage.cpp
+index 721329c1b..164b9945e 100644
+--- a/src/modules/packagechooser/PackageChooserPage.cpp
++++ b/src/modules/packagechooser/PackageChooserPage.cpp
+@@ -52,6 +52,7 @@ PackageChooserPage::currentChanged( const QModelIndex& index )
+ if ( !index.isValid() || !ui->products->selectionModel()->hasSelection() )
+ {
+ ui->productName->setText( m_introduction.name.get() );
++ ui->productName->setStyleSheet("font-weight: bold");
+ ui->productScreenshot->setPixmap( m_introduction.screenshot );
+ ui->productDescription->setText( m_introduction.description.get() );
+ }
+diff --git a/src/modules/packagechooser/page_package.ui b/src/modules/packagechooser/page_package.ui
+index d021b08b3..fecfa3060 100644
+--- a/src/modules/packagechooser/page_package.ui
++++ b/src/modules/packagechooser/page_package.ui
+@@ -38,19 +38,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
+
+ -
+-
++
+-
-
+-
+-
+-
+- 0
+- 0
+-
+-
+-
+- Product Name
+-
+-
+-
+ -
+
+
+@@ -67,6 +54,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
+
+
+
++ -
++
++
++
++ 0
++ 0
++
++
++
++ Product Name
++
++
++
+ -
+
+
diff --git a/pkgs/tools/misc/calamares/unfreeq.patch b/pkgs/tools/misc/calamares/unfreeq.patch
new file mode 100644
index 000000000000..a234113a726e
--- /dev/null
+++ b/pkgs/tools/misc/calamares/unfreeq.patch
@@ -0,0 +1,109 @@
+diff --git a/src/modules/packagechooserq/packagechooserq.qrc b/src/modules/packagechooserq/packagechooserq.qrc
+index 1b892dce1..ee80a934b 100644
+--- a/src/modules/packagechooserq/packagechooserq.qrc
++++ b/src/modules/packagechooserq/packagechooserq.qrc
+@@ -4,5 +4,6 @@
+ images/libreoffice.jpg
+ images/no-selection.png
+ images/plasma.png
++ packagechooserq@unfree.qml
+
+
+diff --git a/src/modules/packagechooserq/packagechooserq@unfree.qml b/src/modules/packagechooserq/packagechooserq@unfree.qml
+new file mode 100644
+index 000000000..cb87d864a
+--- /dev/null
++++ b/src/modules/packagechooserq/packagechooserq@unfree.qml
+@@ -0,0 +1,75 @@
++/* === This file is part of Calamares - ===
++ *
++ * SPDX-FileCopyrightText: 2021 Anke Boersma
++ * SPDX-License-Identifier: GPL-3.0-or-later
++ *
++ * Calamares is Free Software: see the License-Identifier above.
++ *
++ */
++
++import io.calamares.core 1.0
++import io.calamares.ui 1.0
++
++import QtQuick 2.15
++import QtQuick.Controls 2.15
++import QtQuick.Layouts 1.3
++
++Item {
++
++ SystemPalette {
++ id: palette
++ colorGroup: SystemPalette.Active
++ }
++
++ width: parent.width
++ height: parent.height
++
++ Rectangle {
++ anchors.fill: parent
++ color: palette.window
++
++ ButtonGroup {
++ id: switchGroup
++ }
++
++ Column {
++ id: column
++ anchors.centerIn: parent
++ spacing: 5
++
++ Rectangle {
++ width: 700
++ height: 200
++ color: palette.base
++ radius: 10
++ border.width: 0
++ Text {
++ color: palette.text
++ width: 600
++ height: 150
++ anchors.centerIn: parent
++ text: qsTr("NixOS is fully open source, but it also provides software packages with unfree licenses. By default unfree packages are not allowed, but you can enable it here. If you check this box, software installed might have additional End User License Agreements (EULAs) attached. If not enabled, some hardware might not work fully when no suitable open source drivers are available.
")
++ font.pointSize: 12
++ wrapMode: Text.WordWrap
++ }
++
++ CheckBox {
++ id: element2
++ anchors.horizontalCenter: parent.horizontalCenter
++ y: 145
++ text: qsTr("Allow unfree software")
++ checked: false
++
++ onCheckedChanged: {
++ if ( checked ) {
++ config.packageChoice = "unfree"
++ } else {
++ config.packageChoice = "free"
++ }
++ }
++ }
++ }
++ }
++ }
++
++}
+diff --git a/src/modules/packagechooserq/unfree.conf b/src/modules/packagechooserq/unfree.conf
+new file mode 100644
+index 000000000..da79a8eac
+--- /dev/null
++++ b/src/modules/packagechooserq/unfree.conf
+@@ -0,0 +1,11 @@
++# SPDX-FileCopyrightText: no
++# SPDX-License-Identifier: CC0-1.0
++#
++---
++qmlLabel:
++ label: "Unfree Software"
++method: legacy
++mode: required
++labels:
++ step: "Unfree Software"
++packageChoice: free
diff --git a/pkgs/tools/misc/calamares/userjob.patch b/pkgs/tools/misc/calamares/userjob.patch
new file mode 100644
index 000000000000..a0bfea9bb05a
--- /dev/null
+++ b/pkgs/tools/misc/calamares/userjob.patch
@@ -0,0 +1,31 @@
+diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp
+index eedfd274d..0f3e78848 100644
+--- a/src/modules/users/Config.cpp
++++ b/src/modules/users/Config.cpp
+@@ -972,26 +972,11 @@ Config::createJobs() const
+
+ Calamares::Job* j;
+
+- if ( !m_sudoersGroup.isEmpty() )
+- {
+- j = new SetupSudoJob( m_sudoersGroup, m_sudoStyle );
+- jobs.append( Calamares::job_ptr( j ) );
+- }
+-
+- j = new SetupGroupsJob( this );
+- jobs.append( Calamares::job_ptr( j ) );
+-
+- j = new CreateUserJob( this );
+- jobs.append( Calamares::job_ptr( j ) );
+-
+ j = new SetPasswordJob( loginName(), userPassword() );
+ jobs.append( Calamares::job_ptr( j ) );
+
+ j = new SetPasswordJob( "root", rootPassword() );
+ jobs.append( Calamares::job_ptr( j ) );
+
+- j = new SetHostNameJob( this );
+- jobs.append( Calamares::job_ptr( j ) );
+-
+ return jobs;
+ }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1d9884b84171..e16416b7b503 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2855,6 +2855,7 @@ with pkgs;
python = python3;
boost = boost.override { enablePython = true; python = python3; };
};
+ calamares-nixos = lowPrio (calamares.override { nixos-extensions = true; });
calamares-nixos-extensions = callPackage ../tools/misc/calamares-nixos-extensions {};
calendar-cli = callPackage ../tools/networking/calendar-cli { };