Merge pull request #10288 from lethalman/gnomeiso

installer: add graphical GNOME iso
This commit is contained in:
Luca Bruno 2016-02-29 15:56:47 +01:00
commit 55c20bfe89
9 changed files with 140 additions and 23 deletions

View File

@ -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
'';
}

View File

@ -1,7 +1,7 @@
{ config, pkgs, ... }:
{
imports = [ ./installation-cd-graphical.nix ];
imports = [ ./installation-cd-graphical-kde.nix ];
boot.kernelPackages = pkgs.linuxPackages_latest;
}

View File

@ -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/

View File

@ -115,7 +115,7 @@ in rec {
});
iso_graphical = forAllSystems (system: makeIso {
module = ./modules/installer/cd-dvd/installation-cd-graphical.nix;
module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix;
type = "graphical";
inherit system;
});

View File

@ -37,7 +37,8 @@ stdenv.mkDerivation rec {
--prefix PATH : "${unzip}/bin" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
--suffix XDG_DATA_DIRS : "${gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"
--prefix XDG_DATA_DIRS : "${gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS" \
--suffix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
wrapProgram "$out/libexec/gnome-shell-calendar-server" \
--prefix XDG_DATA_DIRS : "${evolution_data_server}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"

View File

@ -13,7 +13,8 @@ stdenv.mkDerivation rec {
wrapProgram "$out/bin/nautilus" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$out/share:$GSETTINGS_SCHEMAS_PATH"
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$out/share" \
--suffix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
'';
patches = [ ./extension_dir.patch ];

View File

@ -65,6 +65,9 @@ let
# Simplify the nixos module and gnome packages
defaultIconTheme = adwaita-icon-theme;
# ISO installer
installerIso = callPackage ./installer.nix {};
#### Core (http://ftp.acc.umu.se/pub/GNOME/core/)
adwaita-icon-theme = callPackage ./core/adwaita-icon-theme { };

View File

@ -0,0 +1,15 @@
{ isoBaseName ? "nixos-graphical-gnome", system ? builtins.currentSystem
, extraModules ? [] }:
let
module = ../../../../nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix;
config = (import ../../../../nixos/lib/eval-config.nix {
inherit system;
modules = [ module { isoImage.isoBaseName = isoBaseName; } ] ++ extraModules;
}).config;
in
config.system.build.isoImage