From aa9576bceb56d4fe2fb24e6fb47001817baeab34 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 8 Oct 2015 14:53:37 +0200 Subject: installer: add graphical GNOME iso --- .../cd-dvd/installation-cd-graphical-gnome.nix | 78 +++++++++++++++ .../installation-cd-graphical-kde-new-kernel.nix | 7 ++ .../cd-dvd/installation-cd-graphical-kde.nix | 110 +++++++++++++++++++++ .../installation-cd-graphical-new-kernel.nix | 7 -- .../installer/cd-dvd/installation-cd-graphical.nix | 110 --------------------- .../services/x11/desktop-managers/gnome3.nix | 57 +++++++---- 6 files changed, 233 insertions(+), 136 deletions(-) create mode 100644 nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix create mode 100644 nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix create mode 100644 nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix delete mode 100644 nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix delete mode 100644 nixos/modules/installer/cd-dvd/installation-cd-graphical.nix (limited to 'nixos/modules') diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix new file mode 100644 index 000000000000..5725938465f5 --- /dev/null +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix @@ -0,0 +1,78 @@ +# This module defines a NixOS installation CD that contains X11 and +# GNOME 3. + +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ./installation-cd-base.nix ]; + + services.xserver = { + enable = true; + # GDM doesn't start in virtual machines with ISO + displayManager.slim = { + enable = true; + defaultUser = "root"; + autoLogin = true; + }; + desktopManager.gnome3 = { + enable = true; + extraGSettingsOverrides = '' + [org.gnome.desktop.background] + show-desktop-icons=true + + [org.gnome.nautilus.desktop] + trash-icon-visible=false + volumes-visible=false + home-icon-visible=false + network-icon-visible=false + ''; + + extraGSettingsOverridePackages = [ pkgs.gnome3.nautilus ]; + }; + }; + + environment.systemPackages = + [ # Include gparted for partitioning disks. + pkgs.gparted + + # Include some editors. + pkgs.vim + pkgs.bvi # binary editor + pkgs.joe + + pkgs.glxinfo + ]; + + # Don't start the X server by default. + services.xserver.autorun = mkForce false; + + # Auto-login as root. + services.xserver.displayManager.gdm.autoLogin = { + enable = true; + user = "root"; + }; + + system.activationScripts.installerDesktop = let + # Must be executable + desktopFile = pkgs.writeScript "nixos-manual.desktop" '' + [Desktop Entry] + Version=1.0 + Type=Link + Name=NixOS Manual + URL=${config.system.build.manual.manual}/share/doc/nixos/index.html + Icon=system-help + ''; + + # use cp and chmod +x, we must be sure the apps are in the nix store though + in '' + mkdir -p /root/Desktop + ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop + cp ${pkgs.gnome3.gnome_terminal}/share/applications/gnome-terminal.desktop /root/Desktop/gnome-terminal.desktop + chmod a+rx /root/Desktop/gnome-terminal.desktop + cp ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop + chmod a+rx /root/Desktop/gparted.desktop + ''; + +} diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix new file mode 100644 index 000000000000..a4bcd7079a4f --- /dev/null +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./installation-cd-graphical-kde.nix ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix new file mode 100644 index 000000000000..d14768bc1079 --- /dev/null +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix @@ -0,0 +1,110 @@ +# This module defines a NixOS installation CD that contains X11 and +# KDE 4. + +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ./installation-cd-base.nix ../../profiles/graphical.nix ]; + + # Provide wicd for easy wireless configuration. + #networking.wicd.enable = true; + + environment.systemPackages = + [ # Include gparted for partitioning disks. + pkgs.gparted + + # Include some editors. + pkgs.vim + pkgs.bvi # binary editor + pkgs.joe + ]; + + # Provide networkmanager for easy wireless configuration. + networking.networkmanager.enable = true; + networking.wireless.enable = mkForce false; + + # KDE complains if power management is disabled (to be precise, if + # there is no power management backend such as upower). + powerManagement.enable = true; + + # Don't start the X server by default. + services.xserver.autorun = mkForce false; + + # Auto-login as root. + services.xserver.displayManager.kdm.extraConfig = + '' + [X-*-Core] + AllowRootLogin=true + AutoLoginEnable=true + AutoLoginUser=root + AutoLoginPass="" + ''; + + # Custom kde-workspace adding some icons on the desktop + + system.activationScripts.installerDesktop = let + openManual = pkgs.writeScript "nixos-manual.sh" '' + #!${pkgs.stdenv.shell} + cd ${config.system.build.manual.manual}/share/doc/nixos/ + konqueror ./index.html + ''; + + desktopFile = pkgs.writeText "nixos-manual.desktop" '' + [Desktop Entry] + Version=1.0 + Type=Application + Name=NixOS Manual + Exec=${openManual} + Icon=konqueror + ''; + + in '' + mkdir -p /root/Desktop + ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop + ln -sfT ${pkgs.kde4.konsole}/share/applications/kde4/konsole.desktop /root/Desktop/konsole.desktop + ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop + ''; + + services.xserver.desktopManager.kde4.kdeWorkspacePackage = let + pkg = pkgs.kde4.kde_workspace; + + plasmaInit = pkgs.writeText "00-defaultLayout.js" '' + loadTemplate("org.kde.plasma-desktop.defaultPanel") + + for (var i = 0; i < screenCount; ++i) { + var desktop = new Activity + desktop.name = i18n("Desktop") + desktop.screen = i + desktop.wallpaperPlugin = 'image' + desktop.wallpaperMode = 'SingleImage' + + var folderview = desktop.addWidget("folderview"); + folderview.writeConfig("url", "desktop:/"); + + //Create more panels for other screens + if (i > 0){ + var panel = new Panel + panel.screen = i + panel.location = 'bottom' + panel.height = screenGeometry(i).height > 1024 ? 35 : 27 + var tasks = panel.addWidget("tasks") + tasks.writeConfig("showOnlyCurrentScreen", true); + } + } + ''; + + in + pkgs.stdenv.mkDerivation { + inherit (pkg) name meta; + + buildCommand = '' + mkdir -p $out + cp -prf ${pkg}/* $out/ + chmod a+w $out/share/apps/plasma-desktop/init + cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js + ''; + }; + +} diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix deleted file mode 100644 index 506b9292b01e..000000000000 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ./installation-cd-graphical.nix ]; - - boot.kernelPackages = pkgs.linuxPackages_latest; -} diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix deleted file mode 100644 index d14768bc1079..000000000000 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix +++ /dev/null @@ -1,110 +0,0 @@ -# This module defines a NixOS installation CD that contains X11 and -# KDE 4. - -{ config, lib, pkgs, ... }: - -with lib; - -{ - imports = [ ./installation-cd-base.nix ../../profiles/graphical.nix ]; - - # Provide wicd for easy wireless configuration. - #networking.wicd.enable = true; - - environment.systemPackages = - [ # Include gparted for partitioning disks. - pkgs.gparted - - # Include some editors. - pkgs.vim - pkgs.bvi # binary editor - pkgs.joe - ]; - - # Provide networkmanager for easy wireless configuration. - networking.networkmanager.enable = true; - networking.wireless.enable = mkForce false; - - # KDE complains if power management is disabled (to be precise, if - # there is no power management backend such as upower). - powerManagement.enable = true; - - # Don't start the X server by default. - services.xserver.autorun = mkForce false; - - # Auto-login as root. - services.xserver.displayManager.kdm.extraConfig = - '' - [X-*-Core] - AllowRootLogin=true - AutoLoginEnable=true - AutoLoginUser=root - AutoLoginPass="" - ''; - - # Custom kde-workspace adding some icons on the desktop - - system.activationScripts.installerDesktop = let - openManual = pkgs.writeScript "nixos-manual.sh" '' - #!${pkgs.stdenv.shell} - cd ${config.system.build.manual.manual}/share/doc/nixos/ - konqueror ./index.html - ''; - - desktopFile = pkgs.writeText "nixos-manual.desktop" '' - [Desktop Entry] - Version=1.0 - Type=Application - Name=NixOS Manual - Exec=${openManual} - Icon=konqueror - ''; - - in '' - mkdir -p /root/Desktop - ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop - ln -sfT ${pkgs.kde4.konsole}/share/applications/kde4/konsole.desktop /root/Desktop/konsole.desktop - ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop - ''; - - services.xserver.desktopManager.kde4.kdeWorkspacePackage = let - pkg = pkgs.kde4.kde_workspace; - - plasmaInit = pkgs.writeText "00-defaultLayout.js" '' - loadTemplate("org.kde.plasma-desktop.defaultPanel") - - for (var i = 0; i < screenCount; ++i) { - var desktop = new Activity - desktop.name = i18n("Desktop") - desktop.screen = i - desktop.wallpaperPlugin = 'image' - desktop.wallpaperMode = 'SingleImage' - - var folderview = desktop.addWidget("folderview"); - folderview.writeConfig("url", "desktop:/"); - - //Create more panels for other screens - if (i > 0){ - var panel = new Panel - panel.screen = i - panel.location = 'bottom' - panel.height = screenGeometry(i).height > 1024 ? 35 : 27 - var tasks = panel.addWidget("tasks") - tasks.writeConfig("showOnlyCurrentScreen", true); - } - } - ''; - - in - pkgs.stdenv.mkDerivation { - inherit (pkg) name meta; - - buildCommand = '' - mkdir -p $out - cp -prf ${pkg}/* $out/ - chmod a+w $out/share/apps/plasma-desktop/init - cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js - ''; - }; - -} diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 4dd631d87511..be7700424bc6 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -27,19 +27,24 @@ let nixos-gsettings-desktop-schemas = pkgs.stdenv.mkDerivation { name = "nixos-gsettings-desktop-schemas"; - buildInputs = [ pkgs.nixos-artwork ]; buildCommand = '' - mkdir -p $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas - cp -rf ${gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0 $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/ - chmod -R a+w $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas - cat - > $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF + mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas + cp -rf ${gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas + + ${concatMapStrings (pkg: "cp -rf ${pkg}/share/gsettings-schemas/*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas\n") cfg.extraGSettingsOverridePackages} + + chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides + cat - > $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF [org.gnome.desktop.background] picture-uri='${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png' [org.gnome.desktop.screensaver] picture-uri='${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png' + + ${cfg.extraGSettingsOverrides} EOF - ${pkgs.glib}/bin/glib-compile-schemas $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/glib-2.0/schemas/ + + ${pkgs.glib}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/ ''; }; @@ -47,19 +52,33 @@ in { options = { - services.xserver.desktopManager.gnome3.enable = mkOption { - default = false; - example = true; - description = "Enable Gnome 3 desktop manager."; - }; + services.xserver.desktopManager.gnome3 = { + enable = mkOption { + default = false; + example = true; + description = "Enable Gnome 3 desktop manager."; + }; - services.xserver.desktopManager.gnome3.sessionPath = mkOption { - default = []; - example = literalExample "[ pkgs.gnome3.gpaste ]"; - description = "Additional list of packages to be added to the session search path. - Useful for gnome shell extensions or gsettings-conditionated autostart."; - apply = list: list ++ [ gnome3.gnome_shell gnome3.gnome-shell-extensions ]; - }; + sessionPath = mkOption { + default = []; + example = literalExample "[ pkgs.gnome3.gpaste ]"; + description = "Additional list of packages to be added to the session search path. + Useful for gnome shell extensions or gsettings-conditionated autostart."; + apply = list: list ++ [ gnome3.gnome_shell gnome3.gnome-shell-extensions ]; + }; + + extraGSettingsOverrides = mkOption { + default = ""; + type = types.lines; + description = "Additional gsettings overrides."; + }; + + extraGSettingsOverridePackages = mkOption { + default = []; + type = types.listOf types.path; + description = "List of packages for which gsettings are overridden."; + }; + }; environment.gnome3.packageSet = mkOption { type = types.nullOr types.package; @@ -130,7 +149,7 @@ in { export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${mimeAppsList}/share # Override gsettings-desktop-schema - export XDG_DATA_DIRS=${nixos-gsettings-desktop-schemas}/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS + export XDG_DATA_DIRS=${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS # Let nautilus find extensions export NAUTILUS_EXTENSION_DIR=${config.system.path}/lib/nautilus/extensions-3.0/ -- cgit 1.4.1