Skip to content

Commit

Permalink
Merge pull request #161788 from vlinkz/calamares-nixos
Browse files Browse the repository at this point in the history
calamares: fix calamares modules, add nixos modules, and add new iso
  • Loading branch information
davidak authored May 3, 2022
2 parents 50a1e91 + 607152a commit 0114388
Show file tree
Hide file tree
Showing 22 changed files with 801 additions and 53 deletions.
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13288,6 +13288,12 @@
githubId = 1771332;
name = "László Vaskó";
};
vlinkz = {
email = "[email protected]";
github = "vlinkz";
githubId = 20145996;
name = "Victor Fuentes";
};
vlstill = {
email = "[email protected]";
github = "vlstill";
Expand Down
8 changes: 8 additions & 0 deletions nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@
default.
</para>
</listitem>
<listitem>
<para>
The GNOME and Plasma installation CDs now use
<literal>pkgs.calamares</literal> and
<literal>pkgs.calamares-nixos-extensions</literal> to allow
users to easily install and set up NixOS with a GUI.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-22.05-new-services">
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2205.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- The default GHC version has been updated from 8.10.7 to 9.0.2. `pkgs.haskellPackages` and `pkgs.ghc` will now use this version by default.

- The GNOME and Plasma installation CDs now use `pkgs.calamares` and `pkgs.calamares-nixos-extensions` to allow users to easily install and set up NixOS with a GUI.

## New Services {#sec-release-22.05-new-services}

- [aesmd](https://github.com/intel/linux-sgx#install-the-intelr-sgx-psw), the Intel SGX Architectural Enclave Service Manager. Available as [services.aesmd](#opt-services.aesmd.enable).
Expand Down
22 changes: 14 additions & 8 deletions nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,28 @@ with lib;
# Enable sound in graphical iso's.
hardware.pulseaudio.enable = true;

environment.systemPackages = [
# Spice guest additions
services.spice-vdagentd.enable = true;

# Enable plymouth
boot.plymouth.enable = true;

environment.defaultPackages = with pkgs; [
# Include gparted for partitioning disks.
pkgs.gparted
gparted

# Include some editors.
pkgs.vim
pkgs.bvi # binary editor
pkgs.joe
vim
nano

# Include some version control tools.
pkgs.git
git
rsync

# Firefox for reading the manual.
pkgs.firefox
firefox

pkgs.glxinfo
glxinfo
];

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This module defines a NixOS installation CD that contains GNOME.

{ pkgs, ... }:

{
imports = [ ./installation-cd-graphical-calamares.nix ];

isoImage.edition = "gnome";

services.xserver.desktopManager.gnome = {
# Add Firefox and other tools useful for installation to the launcher
favoriteAppsOverride = ''
[org.gnome.shell]
favorite-apps=[ 'firefox.desktop', 'nixos-manual.desktop', 'org.gnome.Console.desktop', 'org.gnome.Nautilus.desktop', 'gparted.desktop', 'io.calamares.calamares.desktop' ]
'';

# Override GNOME defaults to disable GNOME tour and disable suspend
extraGSettingsOverrides = ''
[org.gnome.shell]
welcome-dialog-last-shown-version='9999999999'
[org.gnome.settings-daemon.plugins.power]
sleep-inactive-ac-type='nothing'
sleep-inactive-battery-type='nothing'
'';

extraGSettingsOverridePackages = [ pkgs.gnome.gnome-settings-daemon ];

enable = true;
};

# Theme calamares with GNOME theme
qt5 = {
enable = true;
platformTheme = "gnome";
};

# Fix scaling for calamares on wayland
environment.variables = {
QT_QPA_PLATFORM = "$([[ $XDG_SESSION_TYPE = \"wayland\" ]] && echo \"wayland\")";
};

services.xserver.displayManager = {
gdm = {
enable = true;
# autoSuspend makes the machine automatically suspend after inactivity.
# It's possible someone could/try to ssh'd into the machine and obviously
# have issues because it's inactive.
# See:
# * https://github.com/NixOS/nixpkgs/pull/63790
# * https://gitlab.gnome.org/GNOME/gnome-control-center/issues/22
autoSuspend = false;
};
autoLogin = {
enable = true;
user = "nixos";
};
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This module defines a NixOS installation CD that contains X11 and
# Plasma 5.

{ pkgs, ... }:

{
imports = [ ./installation-cd-graphical-calamares.nix ];

isoImage.edition = "plasma5";

services.xserver = {
desktopManager.plasma5 = {
enable = true;
};

# Automatically login as nixos.
displayManager = {
sddm.enable = true;
autoLogin = {
enable = true;
user = "nixos";
};
};
};

environment.systemPackages = with pkgs; [
# Graphical text editor
kate
];

system.activationScripts.installerDesktop = let

# Comes from documentation.nix when xserver and nixos.enable are true.
manualDesktopFile = "/run/current-system/sw/share/applications/nixos-manual.desktop";

homeDir = "/home/nixos/";
desktopDir = homeDir + "Desktop/";

in ''
mkdir -p ${desktopDir}
chown nixos ${homeDir} ${desktopDir}
ln -sfT ${manualDesktopFile} ${desktopDir + "nixos-manual.desktop"}
ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop ${desktopDir + "gparted.desktop"}
ln -sfT ${pkgs.konsole}/share/applications/org.kde.konsole.desktop ${desktopDir + "org.kde.konsole.desktop"}
ln -sfT ${pkgs.calamares-nixos}/share/applications/io.calamares.calamares.desktop ${desktopDir + "io.calamares.calamares.desktop"}
'';

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This module adds the calamares installer to the basic graphical NixOS
# installation CD.

{ pkgs, ... }:
let
calamares-nixos-autostart = pkgs.makeAutostartItem { name = "io.calamares.calamares"; package = pkgs.calamares-nixos; };
in
{
imports = [ ./installation-cd-graphical-base.nix ];

environment.systemPackages = with pkgs; [
# Calamares for graphical installation
libsForQt5.kpmcore
calamares-nixos
calamares-nixos-autostart
calamares-nixos-extensions
# Needed for calamares QML module packagechooserq
libsForQt5.full
];
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# This module defines a NixOS installation CD that contains GNOME.

{ lib, ... }:

with lib;
{ ... }:

{
imports = [ ./installation-cd-graphical-base.nix ];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# This module defines a NixOS installation CD that contains X11 and
# Plasma 5.

{ config, lib, pkgs, ... }:

with lib;
{ pkgs, ... }:

{
imports = [ ./installation-cd-graphical-base.nix ];
Expand Down
4 changes: 2 additions & 2 deletions nixos/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ in rec {
});

iso_plasma5 = forMatchingSystems [ "x86_64-linux" ] (system: makeIso {
module = ./modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix;
module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix;
type = "plasma5";
inherit system;
});

iso_gnome = forMatchingSystems [ "x86_64-linux" ] (system: makeIso {
module = ./modules/installer/cd-dvd/installation-cd-graphical-gnome.nix;
module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix;
type = "gnome";
inherit system;
});
Expand Down
28 changes: 10 additions & 18 deletions pkgs/development/libraries/kpmcore/default.nix
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
{ stdenv, lib, fetchurl, fetchpatch, extra-cmake-modules
{ stdenv, lib, fetchurl, extra-cmake-modules
, qca-qt5, kauth, kio, polkit-qt, qtbase
, util-linux
}:

stdenv.mkDerivation rec {
pname = "kpmcore";
# NOTE: When changing this version, also change the version of `partition-manager`.
version = "4.2.0";
version = "22.04.0";

src = fetchurl {
url = "mirror://kde/stable/${pname}/${version}/src/${pname}-${version}.tar.xz";
hash = "sha256-MvW0CqvFZtzcJlya6DIpzorPbKJai6fxt7nKsKpJn54=";
url = "mirror://kde/stable/release-service/${version}/src/${pname}-${version}.tar.xz";
hash = "sha256-sO8WUJL6072H1ghMZd7j0xNMwEn4bJF5PXMhfEb2jbs=";
};

patches = [
# Fix build with `kcoreaddons` >= 5.77.0
(fetchpatch {
url = "https://github.com/KDE/kpmcore/commit/07e5a3ac2858e6d38cc698e0f740e7a693e9f302.patch";
sha256 = "sha256-LYzea888euo2HXM+acWaylSw28iwzOdZBvPBt/gjP1s=";
})
# Fix crash when `fstab` omits mount options.
(fetchpatch {
url = "https://github.com/KDE/kpmcore/commit/eea84fb60525803a789e55bb168afb968464c130.patch";
sha256 = "sha256-NJ3PvyRC6SKNSOlhJPrDDjepuw7IlAoufPgvml3fap0=";
})
];
nativeBuildInputs = [ extra-cmake-modules ];

buildInputs = [
qca-qt5
Expand All @@ -35,10 +24,13 @@ stdenv.mkDerivation rec {
util-linux # Needs blkid in configure script (note that this is not provided by util-linux-compat)
];

nativeBuildInputs = [ extra-cmake-modules ];

dontWrapQtApps = true;

preConfigure = ''
substituteInPlace src/util/CMakeLists.txt \
--replace \$\{POLKITQT-1_POLICY_FILES_INSTALL_DIR\} $out/share/polkit-1/actions
'';

meta = with lib; {
description = "KDE Partition Manager core library";
homepage = "https://invent.kde.org/system/kpmcore";
Expand Down
30 changes: 30 additions & 0 deletions pkgs/tools/misc/calamares-nixos-extensions/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ stdenv, fetchFromGitHub, lib }:

stdenv.mkDerivation rec {
pname = "calamares-nixos-extensions";
version = "0.3.8";

src = fetchFromGitHub {
owner = "NixOS";
repo = "calamares-nixos-extensions";
rev = version;
sha256 = "MtqAOwlY5euVNAGRl2pRkbg/OolJPNOSQcR4DS5gFz4=";
};

installPhase = ''
runHook preInstall
mkdir -p $out/{lib,share}/calamares
cp -r modules $out/lib/calamares/
cp -r config/* $out/share/calamares/
cp -r branding $out/share/calamares/
runHook postInstall
'';

meta = with lib; {
description = "Calamares modules for NixOS";
homepage = "https://github.com/NixOS/calamares-nixos-extensions";
license = with licenses; [ gpl3Plus bsd2 cc-by-40 cc-by-sa-40 cc0 ];
maintainers = with maintainers; [ vlinkz ];
platforms = platforms.linux;
};
}
Loading

0 comments on commit 0114388

Please sign in to comment.