calamares-nixos-extensions: update for vendored sources + Calamares 3.4.0

K900 a5fae155 fb7d7c5f

+72 -558
+8 -9
pkgs/by-name/ca/calamares-nixos-extensions/package.nix
··· 1 1 { 2 2 stdenv, 3 - fetchFromGitHub, 4 3 lib, 4 + glibcLocales, 5 5 }: 6 6 7 7 stdenv.mkDerivation (finalAttrs: { 8 8 pname = "calamares-nixos-extensions"; 9 9 version = "0.3.23"; 10 10 11 - src = fetchFromGitHub { 12 - owner = "NixOS"; 13 - repo = "calamares-nixos-extensions"; 14 - rev = finalAttrs.version; 15 - hash = "sha256-KNRztajU7sTLNDwCwP4WOdR2IRMqfbeapdko58LcrjM="; 16 - }; 11 + src = ./src; 17 12 18 13 installPhase = '' 19 14 runHook preInstall 20 - mkdir -p $out/{lib,share}/calamares 15 + mkdir -p $out/{etc,lib,share}/calamares 21 16 cp -r modules $out/lib/calamares/ 22 - cp -r config/* $out/share/calamares/ 17 + cp -r config/* $out/etc/calamares/ 23 18 cp -r branding $out/share/calamares/ 19 + 20 + substituteInPlace $out/etc/calamares/settings.conf --replace-fail @out@ $out 21 + substituteInPlace $out/etc/calamares/modules/locale.conf --replace-fail @glibcLocales@ ${glibcLocales} 22 + 24 23 runHook postInstall 25 24 ''; 26 25
-13
pkgs/by-name/ca/calamares-nixos-extensions/src/.github/workflows/test.yml
··· 1 - name: "Test the nixos Python job module" 2 - on: 3 - pull_request: 4 - push: 5 - jobs: 6 - tests: 7 - runs-on: ubuntu-latest 8 - steps: 9 - - uses: actions/checkout@v4 10 - - uses: cachix/install-nix-action@v27 11 - with: 12 - github_access_token: ${{ secrets.GITHUB_TOKEN }} 13 - - run: nix run
-9
pkgs/by-name/ca/calamares-nixos-extensions/src/README.md
··· 30 30 Images [gfx-landing-declarative.png](branding/nixos/gfx-landing-declarative.png), [gfx-landing-reliable.png](branding/nixos/gfx-landing-reliable.png), and [gfx-landing-reproducible.png](branding/nixos/gfx-landing-reproducible.png) are licensed under [CC-BY-SA-4.0](LICENSES/CC-BY-SA-4.0.txt) 31 31 32 32 Images [nix-snowflake.svg](branding/nixos/nix-snowflake.svg) and [white.png](branding/nixos/white.png) are licensed under [CC-BY-4.0](LICENSES/CC-BY-4.0.txt) 33 - 34 - ## Tests 35 - 36 - - The `nixos` Python job module is has unit tests in [testing/](https://github.com/NixOS/calamares-nixos-extensions/tree/calamares/testing). 37 - 38 - These tests can be executed with the command: 39 - ```sh 40 - $ nix run . 41 - ```
+2 -2
pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/branding.desc
··· 117 117 strings: 118 118 productName: "${NAME}" 119 119 shortProductName: NixOS 120 - version: 121 - shortVersion: 120 + version: 121 + shortVersion: 122 122 versionedName: NixOS 123 123 shortVersionedName: NixOS 124 124 bootloaderEntryName: NixOS
+34
pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/notesqml@unfree.qml
··· 1 + import io.calamares.core 2 + 3 + import QtQuick 4 + import QtQuick.Controls 5 + import QtQuick.Layouts 6 + import org.kde.kirigami as Kirigami 7 + 8 + Page { 9 + width: parent.width 10 + height: parent.height 11 + 12 + ColumnLayout { 13 + width: parent.width 14 + spacing: Kirigami.Units.smallSpacing 15 + 16 + Column { 17 + Layout.fillWidth: true 18 + 19 + Text { 20 + text: qsTr("NixOS is fully open source, but it also provides optional software packages that do not respect users' freedom to run, copy, distribute, study, change and improve the software, and are commonly not open source. By default such \"unfree\" packages are not allowed, but you can enable it here. If you check this box, you agree that unfree software may be installed which might have additional End User License Agreements (EULAs) that you need to agree to. If not enabled, some hardware (notably Nvidia GPUs and some WiFi chips) might not work or not work optimally.<br/>") 21 + width: parent.width 22 + wrapMode: Text.WordWrap 23 + } 24 + 25 + CheckBox { 26 + text: qsTr("Allow unfree software") 27 + 28 + onCheckedChanged: { 29 + Global.insert("nixos_allow_unfree", checked) 30 + } 31 + } 32 + } 33 + } 34 + }
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/budgie.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/budgie.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/cinnamon.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/cinnamon.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/deepin.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/deepin.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/enlightenment.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/enlightenment.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/gnome.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/gnome.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/lumina.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/lumina.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/lxqt.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/lxqt.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/mate.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/mate.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/nodesktop.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/nodesktop.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/pantheon.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/pantheon.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/plasma6.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/plasma6.png
pkgs/by-name/ca/calamares-nixos-extensions/src/config/images/xfce.png pkgs/by-name/ca/calamares-nixos-extensions/src/branding/nixos/images/xfce.png
+4 -4
pkgs/by-name/ca/calamares-nixos-extensions/src/config/modules/keyboard.conf
··· 9 9 # Relative paths are assumed to be relative to /etc/X11/xorg.conf.d 10 10 xOrgConfFileName: "/etc/X11/xorg.conf.d/00-keyboard.conf" 11 11 12 - # The path to search for keymaps converted from X11 to kbd format 13 - # Leave this empty if the setting does not make sense on your distribution. 14 - #convertedKeymapPath: "/lib/kbd/keymaps/xkb" 15 - 16 12 # Write keymap configuration to /etc/default/keyboard, usually 17 13 # found on Debian-related systems. 18 14 # Defaults to true if nothing is set. 19 15 writeEtcDefaultKeyboard: false 16 + 17 + configure: 18 + # Configure keyboard when using Wayland with Gnome on Ubuntu 24.10+ 19 + gnome: true
+1 -1
pkgs/by-name/ca/calamares-nixos-extensions/src/config/modules/locale.conf
··· 27 27 # Enable only when your Distribution is using an 28 28 # custom path for locale.gen 29 29 # 30 - #localeGenPath: "PATH_TO/locale.gen" 30 + localeGenPath: @glibcLocales@/share/i18n/SUPPORTED 31 31 32 32 # GeoIP based Language settings: Leave commented out to disable GeoIP. 33 33 #
+12 -12
pkgs/by-name/ca/calamares-nixos-extensions/src/config/modules/packagechooser.conf
··· 154 154 description: "<html>Every part of GNOME has been designed to make it simple and easy to use. It provides a focused working environment that helps you get things done. GNOME is a popular choice and well tested on NixOS.<br/> 155 155 <br/> 156 156 Learn more at <a href=\"https://www.gnome.org/\">gnome.org</a></html>" 157 - screenshot: "/run/current-system/sw/share/calamares/images/gnome.png" 157 + screenshot: "images/gnome.png" 158 158 159 159 - id: plasma6 160 160 packages: [ plasma6 ] ··· 162 162 description: "<html>Plasma is made to stay out of the way as it helps you get things done. But under its light and intuitive surface, it's a highly customizable. So you're free to choose ways of usage right as you need them and when you need them. Plasma is a popular choice and well tested on NixOS.<br/> 163 163 <br/> 164 164 Learn more at <a href=\"https://kde.org/plasma-desktop/\">kde.org/plasma-desktop</a></html>" 165 - screenshot: "/run/current-system/sw/share/calamares/images/plasma6.png" 165 + screenshot: "images/plasma6.png" 166 166 167 167 - id: xfce 168 168 packages: [ xfce ] ··· 170 170 description: "<html>Xfce is a lightweight desktop environment. It aims to be fast and low on system resources, while still being visually appealing and user friendly.<br/> 171 171 <br/> 172 172 Learn more at <a href=\"https://www.xfce.org/\">xfce.org</a></html>" 173 - screenshot: "/run/current-system/sw/share/calamares/images/xfce.png" 173 + screenshot: "images/xfce.png" 174 174 175 175 - id: pantheon 176 176 packages: [ pantheon ] ··· 178 178 description: "<html>Pantheon is the default desktop of Elementary OS. It provides a productive and intuitive user experience while also being visually appealing.<br/> 179 179 <br/> 180 180 Learn more at <a href=\"https://elementary.io/docs/learning-the-basics\">elementary.io/docs/learning-the-basics</a></html>" 181 - screenshot: "/run/current-system/sw/share/calamares/images/pantheon.png" 181 + screenshot: "images/pantheon.png" 182 182 183 183 - id: cinnamon 184 184 packages: [ cinnamon ] ··· 186 186 description: "<html>Cinnamon is a desktop which provides advanced innovative features and a traditional user experience. The emphasis is put on making users feel at home and providing them with an easy to use and comfortable desktop experience.<br/> 187 187 <br/> 188 188 Learn more at <a href=\"https://projects.linuxmint.com/cinnamon/\">projects.linuxmint.com/cinnamon</a></html>" 189 - screenshot: "/run/current-system/sw/share/calamares/images/cinnamon.png" 189 + screenshot: "images/cinnamon.png" 190 190 191 191 - id: mate 192 192 packages: [ mate ] ··· 194 194 description: "<html>The MATE Desktop Environment is the continuation of GNOME 2. It provides an intuitive and attractive desktop environment.<br/> 195 195 <br/> 196 196 Learn more at <a href=\"https://mate-desktop.org/\">mate-desktop.org</a></html>" 197 - screenshot: "/run/current-system/sw/share/calamares/images/mate.png" 197 + screenshot: "images/mate.png" 198 198 199 199 - id: enlightenment 200 200 packages: [ enlightenment ] ··· 202 202 description: "<html>Enlightenment is a Window Manager, Compositor and Minimal Desktop. Enlightenment is classed as a desktop shell as it provides everything you need to operate your desktop or laptop, but it is not a full application suite.<br/> 203 203 <br/> 204 204 Learn more at <a href=\"https://www.enlightenment.org/\">enlightenment.org</a></html>" 205 - screenshot: "/run/current-system/sw/share/calamares/images/enlightenment.png" 205 + screenshot: "images/enlightenment.png" 206 206 207 207 - id: lxqt 208 208 packages: [ lxqt ] ··· 210 210 description: "<html>LXQt is a lightweight Qt desktop environment. It will not get in your way. It will not hang or slow down your system. It is focused on being a classic desktop with a modern look and feel.<br/> 211 211 <br/> 212 212 Learn more at <a href=\"https://lxqt-project.org/\">lxqt-project.org</a></html>" 213 - screenshot: "/run/current-system/sw/share/calamares/images/lxqt.png" 213 + screenshot: "images/lxqt.png" 214 214 215 215 # Lumina is not yet stable enough, once it is, simply uncommenting the lines below is all that's needed to enable it as an option 216 216 #- id: lumina ··· 218 218 # name: Lumina 219 219 # description: "<html>Lumina is designed to have a small footprint, giving your system the best performance possible. It is built to flow seamlessly between computer tasks and offers several integrated utilities in one convenient package.<br/> 220 220 # - Learn more at <a href=\"https://lumina-desktop.org/\">lumina-desktop.org</a></html>" 221 - # screenshot: "/run/current-system/sw/share/calamares/images/lumina.png" 221 + # screenshot: "images/lumina.png" 222 222 223 223 - id: budgie 224 224 packages: [ budgie ] ··· 226 226 description: "<html>The Budgie Desktop is a feature-rich, modern desktop designed to keep out the way of the user.<br/> 227 227 <br/> 228 228 Learn more at <a href=\"https://docs.buddiesofbudgie.org/\">buddiesofbudgie.org</a></html>" 229 - screenshot: "/run/current-system/sw/share/calamares/images/budgie.png" 229 + screenshot: "images/budgie.png" 230 230 231 231 - id: deepin 232 232 packages: [ deepin ] ··· 234 234 description: "<html>The Deepin Desktop Environment is an elegant, easy to use and reliable desktop environment.<br/> 235 235 <br/> 236 236 Learn more at <a href=\"https://www.deepin.org/\">deepin.org</a></html>" 237 - screenshot: "/run/current-system/sw/share/calamares/images/deepin.png" 237 + screenshot: "images/deepin.png" 238 238 239 239 - id: "" 240 240 packages: [] 241 241 name: "No desktop" 242 - screenshot: "/run/current-system/sw/share/calamares/images/nodesktop.png" 242 + screenshot: "images/nodesktop.png" 243 243 description: "A minimal system without a graphical user interface will be installed. This is great for servers or custom setups with window managers. The configuration can be changed after installation."
+2 -1
pkgs/by-name/ca/calamares-nixos-extensions/src/config/modules/partition.conf
··· 255 255 # Otherwise, the partition layout is defined as follow: 256 256 # 257 257 partitionLayout: 258 - - filesystem: "ext4" 258 + - name: "root" 259 + filesystem: "ext4" 259 260 noEncrypt: false 260 261 mountPoint: "/" 261 262 size: 100%
+3 -9
pkgs/by-name/ca/calamares-nixos-extensions/src/config/modules/unfree.conf
··· 1 - # SPDX-FileCopyrightText: no 2 - # SPDX-License-Identifier: CC0-1.0 3 - # 4 1 --- 2 + qmlSearch: branding 3 + 5 4 qmlLabel: 6 - label: "Unfree Software" 7 - method: legacy 8 - mode: required 9 - labels: 10 - step: "Unfree Software" 11 - packageChoice: free 5 + notes: "Unfree software"
+3 -3
pkgs/by-name/ca/calamares-nixos-extensions/src/config/settings.conf
··· 32 32 # 33 33 # 34 34 # YAML: list of strings. 35 - modules-search: [ local, /run/current-system/sw/lib/calamares/modules ] 35 + modules-search: [ local, @out@/lib/calamares/modules ] 36 36 37 37 # Instances section. This section is optional, and it defines custom instances 38 38 # for modules of any kind. An instance entry has these keys: ··· 87 87 # YAML: list of maps of string:string key-value pairs. 88 88 instances: 89 89 - id: unfree 90 - module: packagechooserq 90 + module: notesqml 91 91 config: unfree.conf 92 92 93 93 # Sequence section. This section describes the sequence of modules, both ··· 119 119 - keyboard 120 120 - users 121 121 - packagechooser 122 - - packagechooserq@unfree 122 + - notesqml@unfree 123 123 - partition 124 124 - summary 125 125 - exec:
-27
pkgs/by-name/ca/calamares-nixos-extensions/src/flake.lock
··· 1 - { 2 - "nodes": { 3 - "nixpkgs": { 4 - "locked": { 5 - "lastModified": 1723991338, 6 - "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=", 7 - "owner": "NixOS", 8 - "repo": "nixpkgs", 9 - "rev": "8a3354191c0d7144db9756a74755672387b702ba", 10 - "type": "github" 11 - }, 12 - "original": { 13 - "owner": "NixOS", 14 - "ref": "nixos-unstable", 15 - "repo": "nixpkgs", 16 - "type": "github" 17 - } 18 - }, 19 - "root": { 20 - "inputs": { 21 - "nixpkgs": "nixpkgs" 22 - } 23 - } 24 - }, 25 - "root": "root", 26 - "version": 7 27 - }
-34
pkgs/by-name/ca/calamares-nixos-extensions/src/flake.nix
··· 1 - { 2 - description = "Testing calamares-nixos-extensions"; 3 - 4 - inputs = { 5 - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 - }; 7 - 8 - outputs = { nixpkgs, ... }: 9 - let 10 - system = "x86_64-linux"; 11 - 12 - pkgs = import nixpkgs { 13 - inherit system; 14 - }; 15 - 16 - packages = [ 17 - (pkgs.python3.withPackages (pp: with pp; [ pytest pytest-mock ])) 18 - ]; 19 - in 20 - { 21 - packages.${system}.default = pkgs.writeShellApplication { 22 - name = "test-nixos-install"; 23 - runtimeInputs = packages; 24 - text = '' 25 - #!${pkgs.stdenv.shell} 26 - pytest -vv testing 27 - ''; 28 - }; 29 - 30 - devShells.${system}.default = pkgs.mkShell { 31 - inherit packages; 32 - }; 33 - }; 34 - }
+3 -4
pkgs/by-name/ca/calamares-nixos-extensions/src/modules/nixos/main.py
··· 700 700 701 701 # Check if unfree packages are allowed 702 702 free = True 703 - if gs.value("packagechooser_unfree") is not None: 704 - if gs.value("packagechooser_unfree") == "unfree": 705 - free = False 706 - cfg += cfgunfree 703 + if gs.value("nixos_allow_unfree"): 704 + free = False 705 + cfg += cfgunfree 707 706 708 707 cfg += cfgpkgs 709 708 # Use firefox as default as a graphical web browser, and add kate to plasma desktop
pkgs/by-name/ca/calamares-nixos-extensions/src/testing/__init__.py

This is a binary file and will not be displayed.

-172
pkgs/by-name/ca/calamares-nixos-extensions/src/testing/conftest.py
··· 1 - import os 2 - import sys 3 - 4 - import pytest 5 - 6 - 7 - @pytest.fixture 8 - def mock_translation_gettext(mocker): 9 - return mocker.Mock( 10 - "gettext.translation().gettext", 11 - # Return the translation key as the translation 12 - side_effect=lambda t: t, 13 - ) 14 - 15 - 16 - @pytest.fixture 17 - def mock_gettext_translation(mocker, mock_translation_gettext): 18 - mock_translation_object = mocker.Mock("gettext.translation()") 19 - mock_translation_object.gettext = mock_translation_gettext 20 - 21 - return mocker.Mock("gettext.translation", return_value=mock_translation_object) 22 - 23 - 24 - @pytest.fixture 25 - def globalstorage(): 26 - return { 27 - "rootMountPoint": "/mnt/root", 28 - "firmwareType": "efi", 29 - "partitions": [], 30 - "keyboardLayout": "us", 31 - "username": "username", 32 - "fullname": "fullname", 33 - } 34 - 35 - 36 - @pytest.fixture 37 - def mock_check_output(mocker): 38 - return mocker.Mock(name="subprocess.check_output") 39 - 40 - 41 - @pytest.fixture 42 - def mock_getoutput(mocker): 43 - return mocker.Mock( 44 - name="subprocess.getoutput", 45 - # subprocess.getoutput() is only called to get the output of `nixos-version` so it is hard-coded here. 46 - return_value="24.05.20240815.c3d4ac7 (Uakari)", 47 - ) 48 - 49 - 50 - @pytest.fixture 51 - def mock_Popen(mocker): 52 - mock_Popen_inst = mocker.Mock("Popen()") 53 - mock_Popen_inst.stdout = mocker.Mock("Popen().stdout") 54 - mock_Popen_inst.stdout.readline = mocker.Mock( 55 - "Popen().stdout.readline", 56 - # Make Popen print nothing (empty bytes) to stdout 57 - return_value=b"", 58 - ) 59 - mock_Popen_inst.wait = mocker.Mock( 60 - "Popen().wait", 61 - # Make Popen().wait() give a returncode of 0 62 - return_value=0, 63 - ) 64 - return mocker.Mock(name="subprocess.Popen", return_value=mock_Popen_inst) 65 - 66 - 67 - @pytest.fixture 68 - def mock_libcalamares(mocker, globalstorage): 69 - mock_libcalamares = mocker.Mock("libcalamares") 70 - 71 - mock_libcalamares.globalstorage = mocker.Mock("libcalamares.globalstorage") 72 - mock_libcalamares.globalstorage.value = mocker.Mock( 73 - "libcalamares.globalstorage.value" 74 - ) 75 - mock_libcalamares.globalstorage.value.side_effect = lambda k: globalstorage.get(k) 76 - 77 - mock_libcalamares.utils = mocker.Mock("libcalamares.utils") 78 - mock_libcalamares.utils.gettext = mocker.Mock("libcalamares.utils.gettext") 79 - mock_libcalamares.utils.gettext_path = mocker.Mock( 80 - "libcalamares.utils.gettext_path" 81 - ) 82 - mock_libcalamares.utils.gettext_languages = mocker.Mock( 83 - "libcalamares.utils.gettext_languages" 84 - ) 85 - mock_libcalamares.utils.warning = mocker.Mock("libcalamares.utils.warning") 86 - mock_libcalamares.utils.debug = mocker.Mock("libcalamares.utils.debug") 87 - mock_libcalamares.utils.host_env_process_output = mocker.Mock( 88 - "libcalamares.utils.host_env_process_output" 89 - ) 90 - 91 - mock_libcalamares.job = mocker.Mock("libcalamares.job") 92 - mock_libcalamares.job.setprogress = mocker.Mock("libcalamares.job.setprogress") 93 - 94 - return mock_libcalamares 95 - 96 - 97 - @pytest.fixture 98 - def mock_open_ngcconf(mocker): 99 - return mocker.Mock('open("nixos-generate-config.conf")') 100 - 101 - 102 - @pytest.fixture 103 - def mock_open_hwconf(mocker): 104 - return mocker.Mock('open("hardware-configuration.nix")') 105 - 106 - 107 - @pytest.fixture 108 - def mock_open_kbdmodelmap(mocker): 109 - return mocker.Mock('open("kbd-model-map")') 110 - 111 - 112 - @pytest.fixture 113 - def mock_open(mocker, mock_open_ngcconf, mock_open_hwconf, mock_open_kbdmodelmap): 114 - testing_dir = os.path.dirname(__file__) 115 - 116 - ngcconf_txt = "" 117 - with open(os.path.join(testing_dir, "nixos-generate-config.conf"), "r") as ngcconf: 118 - ngcconf_txt = ngcconf.read() 119 - 120 - hwconf_txt = "" 121 - with open(os.path.join(testing_dir, "hardware-configuration.nix"), "r") as hwconf: 122 - hwconf_txt = hwconf.read() 123 - 124 - kbdmodelmap_txt = "" 125 - with open(os.path.join(testing_dir, "kbd-model-map"), "r") as kbdmodelmap: 126 - kbdmodelmap_txt = kbdmodelmap.read() 127 - 128 - mock_open = mocker.Mock("open") 129 - 130 - def fake_open(*args, **kwargs): 131 - file, *mode = args 132 - assert len(mode) == 0 or mode[0] == "r", "open() called with non-'r' mode" 133 - 134 - if file.endswith("nixos-generate-config.conf"): 135 - return mocker.mock_open(mock=mock_open_ngcconf, read_data=ngcconf_txt)(*args) 136 - elif file.endswith("hardware-configuration.nix"): 137 - return mocker.mock_open(mock=mock_open_hwconf, read_data=hwconf_txt)(*args) 138 - elif file.endswith("kbd-model-map"): 139 - return mocker.mock_open( 140 - mock=mock_open_kbdmodelmap, read_data=kbdmodelmap_txt 141 - )(*args) 142 - else: 143 - raise AssertionError(f"open() called with unexpected file '{file}'") 144 - 145 - mock_open.side_effect = fake_open 146 - 147 - return mock_open 148 - 149 - 150 - @pytest.fixture 151 - def run( 152 - mocker, 153 - mock_gettext_translation, 154 - mock_libcalamares, 155 - mock_check_output, 156 - mock_getoutput, 157 - mock_Popen, 158 - mock_open, 159 - ): 160 - sys.modules["libcalamares"] = mock_libcalamares 161 - 162 - mocker.patch("gettext.translation", mock_gettext_translation) 163 - 164 - mocker.patch("subprocess.check_output", mock_check_output) 165 - mocker.patch("subprocess.getoutput", mock_getoutput) 166 - mocker.patch("subprocess.Popen", mock_Popen) 167 - 168 - mocker.patch("builtins.open", mock_open) 169 - 170 - from modules.nixos.main import run 171 - 172 - return run
-31
pkgs/by-name/ca/calamares-nixos-extensions/src/testing/hardware-configuration.nix
··· 1 - # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 - # and may be overwritten by future invocations. Please make changes 3 - # to /etc/nixos/configuration.nix instead. 4 - { config, lib, pkgs, modulesPath, ... }: 5 - 6 - { 7 - imports = 8 - [ (modulesPath + "/installer/scan/not-detected.nix") 9 - ]; 10 - 11 - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" ]; 12 - boot.initrd.kernelModules = [ ]; 13 - boot.kernelModules = [ "kvm-amd" ]; 14 - boot.extraModulePackages = [ ]; 15 - 16 - swapDevices = [ ]; 17 - 18 - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 19 - # (the default) this is the recommended approach. When using systemd-networkd it's 20 - # still possible to use this option, but it's recommended to use it in conjunction 21 - # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. 22 - networking.useDHCP = lib.mkDefault true; 23 - # networking.interfaces.docker0.useDHCP = lib.mkDefault true; 24 - # networking.interfaces.veth1a64ca3.useDHCP = lib.mkDefault true; 25 - # networking.interfaces.vethb5290db.useDHCP = lib.mkDefault true; 26 - # networking.interfaces.vethf60304e.useDHCP = lib.mkDefault true; 27 - # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; 28 - 29 - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 30 - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 31 - }
-72
pkgs/by-name/ca/calamares-nixos-extensions/src/testing/kbd-model-map
··· 1 - # Originally generated from system-config-keyboard's model list. 2 - # consolelayout xlayout xmodel xvariant xoptions 3 - sg ch pc105 de_nodeadkeys terminate:ctrl_alt_bksp 4 - nl nl pc105 - terminate:ctrl_alt_bksp 5 - mk-utf mk,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 6 - trq tr pc105 - terminate:ctrl_alt_bksp 7 - uk gb pc105 - terminate:ctrl_alt_bksp 8 - is-latin1 is pc105 - terminate:ctrl_alt_bksp 9 - de de pc105 - terminate:ctrl_alt_bksp 10 - la-latin1 latam pc105 - terminate:ctrl_alt_bksp 11 - us us pc105+inet - terminate:ctrl_alt_bksp 12 - ko kr pc105 - terminate:ctrl_alt_bksp 13 - ro-std ro pc105 std terminate:ctrl_alt_bksp 14 - de-latin1 de pc105 - terminate:ctrl_alt_bksp 15 - slovene si pc105 - terminate:ctrl_alt_bksp 16 - hu hu pc105 - terminate:ctrl_alt_bksp 17 - jp106 jp jp106 - terminate:ctrl_alt_bksp 18 - croat hr pc105 - terminate:ctrl_alt_bksp 19 - it2 it pc105 - terminate:ctrl_alt_bksp 20 - hu101 hu pc105 qwerty terminate:ctrl_alt_bksp 21 - sr-latin rs pc105 latin terminate:ctrl_alt_bksp 22 - fi fi pc105 - terminate:ctrl_alt_bksp 23 - fr_CH ch pc105 fr terminate:ctrl_alt_bksp 24 - dk-latin1 dk pc105 - terminate:ctrl_alt_bksp 25 - fr fr pc105 - terminate:ctrl_alt_bksp 26 - it it pc105 - terminate:ctrl_alt_bksp 27 - ua-utf ua,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 28 - fr-latin1 fr pc105 - terminate:ctrl_alt_bksp 29 - sg-latin1 ch pc105 de_nodeadkeys terminate:ctrl_alt_bksp 30 - be-latin1 be pc105 - terminate:ctrl_alt_bksp 31 - dk dk pc105 - terminate:ctrl_alt_bksp 32 - fr-pc fr pc105 - terminate:ctrl_alt_bksp 33 - bg_pho-utf8 bg,us pc105 ,phonetic terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 34 - it-ibm it pc105 - terminate:ctrl_alt_bksp 35 - cz-us-qwertz cz,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 36 - cz-qwerty cz,us pc105 qwerty, terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 37 - br-abnt2 br abnt2 - terminate:ctrl_alt_bksp 38 - ro ro pc105 - terminate:ctrl_alt_bksp 39 - us-acentos us pc105 intl terminate:ctrl_alt_bksp 40 - pt-latin1 pt pc105 - terminate:ctrl_alt_bksp 41 - ro-std-cedilla ro pc105 std_cedilla terminate:ctrl_alt_bksp 42 - tj_alt-UTF8 tj pc105 - terminate:ctrl_alt_bksp 43 - de-latin1-nodeadkeys de pc105 nodeadkeys terminate:ctrl_alt_bksp 44 - no no pc105 - terminate:ctrl_alt_bksp 45 - bg_bds-utf8 bg,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 46 - dvorak us pc105 dvorak terminate:ctrl_alt_bksp 47 - dvorak us pc105 dvorak-alt-intl terminate:ctrl_alt_bksp 48 - ru ru,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 49 - cz-lat2 cz pc105 qwerty terminate:ctrl_alt_bksp 50 - pl2 pl pc105 - terminate:ctrl_alt_bksp 51 - es es pc105 - terminate:ctrl_alt_bksp 52 - ro-cedilla ro pc105 cedilla terminate:ctrl_alt_bksp 53 - ie ie pc105 - terminate:ctrl_alt_bksp 54 - et ee pc105 - terminate:ctrl_alt_bksp 55 - sk-qwerty sk pc105 qwerty terminate:ctrl_alt_bksp 56 - sk-qwertz sk pc105 - terminate:ctrl_alt_bksp 57 - fr-latin9 fr pc105 latin9 terminate:ctrl_alt_bksp 58 - fr_CH-latin1 ch pc105 fr terminate:ctrl_alt_bksp 59 - cf ca pc105 - terminate:ctrl_alt_bksp 60 - sv-latin1 se pc105 - terminate:ctrl_alt_bksp 61 - sr-cy rs pc105 - terminate:ctrl_alt_bksp 62 - gr gr,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 63 - by by,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 64 - il il pc105 - terminate:ctrl_alt_bksp 65 - kazakh kz,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll 66 - lt.baltic lt pc105 - terminate:ctrl_alt_bksp 67 - lt.l4 lt pc105 - terminate:ctrl_alt_bksp 68 - lt lt pc105 - terminate:ctrl_alt_bksp 69 - khmer kh,us pc105 - terminate:ctrl_alt_bksp 70 - es-dvorak es microsoftpro dvorak terminate:ctrl_alt_bksp 71 - lv lv pc105 apostrophe terminate:ctrl_alt_bksp 72 - lv-tilde lv pc105 tilde terminate:ctrl_alt_bksp
-2
pkgs/by-name/ca/calamares-nixos-extensions/src/testing/nixos-generate-config.conf
··· 1 - [Defaults] 2 - Kernel=latest
-153
pkgs/by-name/ca/calamares-nixos-extensions/src/testing/test_baseline.py
··· 1 - import subprocess 2 - 3 - 4 - BASELINE_CFG = """# Edit this configuration file to define what should be installed on 5 - # your system. Help is available in the configuration.nix(5) man page 6 - # and in the NixOS manual (accessible by running ‘nixos-help’). 7 - 8 - { config, pkgs, ... }: 9 - 10 - { 11 - imports = 12 - [ # Include the results of the hardware scan. 13 - ./hardware-configuration.nix 14 - ]; 15 - 16 - # Bootloader. 17 - boot.loader.systemd-boot.enable = true; 18 - boot.loader.efi.canTouchEfiVariables = true; 19 - 20 - # Use latest kernel. 21 - boot.kernelPackages = pkgs.linuxPackages_latest; 22 - 23 - networking.hostName = "nixos"; # Define your hostname. 24 - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. 25 - 26 - # Configure network proxy if necessary 27 - # networking.proxy.default = "http://user:password@proxy:port/"; 28 - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; 29 - 30 - # Enable networking 31 - networking.networkmanager.enable = true; 32 - 33 - # Define a user account. Don't forget to set a password with ‘passwd’. 34 - users.users.username = { 35 - isNormalUser = true; 36 - description = "fullname"; 37 - extraGroups = [ "networkmanager" "wheel" ]; 38 - packages = with pkgs; [ 39 - # thunderbird 40 - ]; 41 - }; 42 - 43 - # Install firefox. 44 - programs.firefox.enable = true; 45 - 46 - # List packages installed in system profile. To search, run: 47 - # $ nix search wget 48 - environment.systemPackages = with pkgs; [ 49 - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. 50 - # wget 51 - ]; 52 - 53 - # Some programs need SUID wrappers, can be configured further or are 54 - # started in user sessions. 55 - # programs.mtr.enable = true; 56 - # programs.gnupg.agent = { 57 - # enable = true; 58 - # enableSSHSupport = true; 59 - # }; 60 - 61 - # List services that you want to enable: 62 - 63 - # Enable the OpenSSH daemon. 64 - # services.openssh.enable = true; 65 - 66 - # Open ports in the firewall. 67 - # networking.firewall.allowedTCPPorts = [ ... ]; 68 - # networking.firewall.allowedUDPPorts = [ ... ]; 69 - # Or disable the firewall altogether. 70 - # networking.firewall.enable = false; 71 - 72 - # This value determines the NixOS release from which the default 73 - # settings for stateful data, like file locations and database versions 74 - # on your system were taken. It‘s perfectly fine and recommended to leave 75 - # this value at the release version of the first install of this system. 76 - # Before changing this value read the documentation for this option 77 - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). 78 - system.stateVersion = "24.05"; # Did you read the comment? 79 - 80 - } 81 - """ 82 - 83 - 84 - def test_baseline( 85 - mocker, 86 - run, 87 - mock_gettext_translation, 88 - mock_libcalamares, 89 - mock_getoutput, 90 - mock_check_output, 91 - mock_open_ngcconf, 92 - mock_open_hwconf, 93 - mock_Popen, 94 - ): 95 - result = run() 96 - 97 - assert result is None, "nixos-install failed." 98 - 99 - mock_gettext_translation.assert_called_once_with( 100 - "calamares-python", localedir=mocker.ANY, languages=mocker.ANY, fallback=True 101 - ) 102 - 103 - # libcalamares.job.setprogress(0.1) 104 - assert mock_libcalamares.job.setprogress.mock_calls[0] == mocker.call(0.1) 105 - 106 - 107 - 108 - # libcalamares.job.setprogress(0.18) 109 - assert mock_libcalamares.job.setprogress.mock_calls[1] == mocker.call(0.18) 110 - 111 - # version = ".".join(subprocess.getoutput( 112 - # ["nixos-version"]).split(".")[:2])[:5] 113 - assert mock_getoutput.mock_calls[0] == mocker.call(["nixos-version"]) 114 - 115 - # The baseline configuration should not raise any warnings. 116 - mock_libcalamares.utils.warning.assert_not_called() 117 - 118 - # libcalamares.job.setprogress(0.25) 119 - assert mock_libcalamares.job.setprogress.mock_calls[2] == mocker.call(0.25) 120 - 121 - # subprocess.check_output( 122 - # ["pkexec", "nixos-generate-config", "--root", root_mount_point], stderr=subprocess.STDOUT) 123 - assert mock_check_output.mock_calls[0] == mocker.call( 124 - ["pkexec", "nixos-generate-config", "--root", "/mnt/root"], 125 - stderr=subprocess.STDOUT, 126 - ) 127 - 128 - mock_open_ngcconf.assert_called_once_with( 129 - "/etc/nixos-generate-config.conf" 130 - ) 131 - 132 - # hf = open(root_mount_point + "/etc/nixos/hardware-configuration.nix", "r") 133 - mock_open_hwconf.assert_called_once_with( 134 - "/mnt/root/etc/nixos/hardware-configuration.nix", "r" 135 - ) 136 - 137 - # libcalamares.utils.host_env_process_output( 138 - # ["cp", "/dev/stdin", config], None, cfg) 139 - mock_libcalamares.utils.host_env_process_output.assert_called_once_with( 140 - ["cp", "/dev/stdin", "/mnt/root/etc/nixos/configuration.nix"], None, mocker.ANY 141 - ) 142 - cfg = mock_libcalamares.utils.host_env_process_output.call_args[0][2] 143 - assert cfg == BASELINE_CFG 144 - 145 - # libcalamares.job.setprogress(0.3) 146 - assert mock_libcalamares.job.setprogress.mock_calls[3] == mocker.call(0.3) 147 - 148 - # proc = subprocess.Popen(["pkexec", "nixos-install", "--no-root-passwd", "--root", root_mount_point], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 149 - mock_Popen.assert_called_once_with( 150 - ["pkexec", "nixos-install", "--no-root-passwd", "--root", "/mnt/root"], 151 - stdout=subprocess.PIPE, 152 - stderr=subprocess.STDOUT, 153 - )