summary refs log tree commit diff
path: root/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
blob: 189cca9e23b9d61f0184bfd9919e56ccc6e21305 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# 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;

  # Include gparted for partitioning disks
  environment.systemPackages = [ pkgs.gparted ];
  
  # 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
      '';
    };

}