From 921231b555d3656d573401eba7b36b6868914ebc Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Mon, 25 Apr 2011 01:03:57 +0000 Subject: [PATCH] Add nixos-gui among the installer tools. Add it as a default for the graphical profile. svn path=/nixos/trunk/; revision=26960 --- gui/README | 17 +++++------ gui/application.ini | 5 ++-- gui/nixos-gui | 3 -- modules/installer/tools/tools.nix | 47 ++++++++++++++++++++++++------- modules/profiles/graphical.nix | 2 ++ 5 files changed, 49 insertions(+), 25 deletions(-) delete mode 100755 gui/nixos-gui diff --git a/gui/README b/gui/README index 7eee9040e3f..c038314a0dc 100644 --- a/gui/README +++ b/gui/README @@ -1,19 +1,16 @@ -This file should become a nix expression. +This file should become a nix expression. (see modules/installer/tools/tools.nix) you need to: -- download the latest jQuery from: - http://jqueryjs.googlecode.com/files/jquery-1.3.2.js - SHA1 Checksum: f0b95e99225f314fbe37ccf6b74ce2f916c517de +- download the latest jQuery from and copy it to chrome/content: + http://code.jquery.com/jquery-1.5.2.js - install 'xulrunner' with nix: - nix-env -i xulrunner + nix-env -Ai nixpkgs_sys.firefox40Pkgs.xulrunner -- install and add nix-intantiate in your path +- make sure nixos-option in your path - have /etc/nixos/nixpkgs - have /etc/nixos/nixos - -to run it, either: -- cd /etc/nixos/nixos/gui; ./nixos-gui -- xulrunner /etc/nixos/nixos/gui/application.ini +run it: +- xulrunner /etc/nixos/nixos/gui/application.ini -jsconsole diff --git a/gui/application.ini b/gui/application.ini index a832d9d285b..d2494a1a5cd 100644 --- a/gui/application.ini +++ b/gui/application.ini @@ -8,15 +8,16 @@ Vendor=NixOS Name=NixOS-gui ; ; This field specifies your application's version. This field is optional. -Version=0.0 +Version=0.1 ; ; This field specifies your application's build ID (timestamp). This field is ; required. -BuildID=20090925 +BuildID=20110424 ; ; This field specifies a compact copyright notice for your application. This ; field is optional. ;Copyright= + ; ; This ID is just an example. Every XUL app ought to have it's own unique ID. ; You can use the microsoft "guidgen" or "uuidgen" tools, or go on diff --git a/gui/nixos-gui b/gui/nixos-gui deleted file mode 100755 index f7728147ad3..00000000000 --- a/gui/nixos-gui +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec xulrunner "./application.ini" diff --git a/modules/installer/tools/tools.nix b/modules/installer/tools/tools.nix index b735863a34c..ece745096ce 100644 --- a/modules/installer/tools/tools.nix +++ b/modules/installer/tools/tools.nix @@ -1,33 +1,34 @@ # This module generates nixos-install, nixos-rebuild, # nixos-hardware-scan, etc. -{config, pkgs, ...}: +{config, pkgs, modulesPath, ...}: let ### implementation + cfg = config.installer; makeProg = args: pkgs.substituteAll (args // { dir = "bin"; isExecutable = true; }); - + nixosBuildVMS = makeProg { name = "nixos-build-vms"; src = ./nixos-build-vms/nixos-build-vms.sh; }; - + nixosDeployNetwork = makeProg { name = "nixos-deploy-network"; src = ./nixos-deploy-network/nixos-deploy-network.sh; }; - + nixosInstall = makeProg { name = "nixos-install"; src = ./nixos-install.sh; inherit (pkgs) perl pathsFromGraph; nix = config.environment.nix; - nixpkgsURL = config.installer.nixpkgsURL; + nixpkgsURL = cfg.nixpkgsURL; nixClosure = pkgs.runCommand "closure" {exportReferencesGraph = ["refs" config.environment.nix];} @@ -64,7 +65,7 @@ let inherit nixClosure nix; # TODO shell ? - nixpkgsURL = config.installer.nixpkgsURL; + nixpkgsURL = cfg.nixpkgsURL; }; # see ./nixos-bootstrap-archive/README-BOOTSTRAP-NIXOS @@ -90,7 +91,7 @@ let name = "nixos-hardware-scan"; src = ./nixos-hardware-scan.pl; inherit (pkgs) perl; - profile = config.installer.installProfile; + profile = cfg.installProfile; }; nixosOption = makeProg { @@ -98,11 +99,28 @@ let src = ./nixos-option.sh; }; + nixosGui = pkgs.xulrunnerWrapper { + launcher = "nixos-gui"; + application = pkgs.stdenv.mkDerivation { + name = "nixos-gui"; + buildCommand = '' + ensureDir $out + cp -r $source $out + cp $jquery $out/chrome/content/jquery-1.5.2.js + ''; + sources = pkgs.lib.cleanSource "${modulesPath}/../gui"; + jquery = pkgs.fetchurl { + url = http://code.jquery.com/jquery-1.5.2.min.js; + sha256 = "e2107c8ecdb479c36d822d82bda2a8caf4429ab2d2cf9f20d5c931f75275403c"; + }; + }; + }; + in { options = { - + installer.nixpkgsURL = pkgs.lib.mkOption { default = ""; example = http://nixos.org/releases/nix/nixpkgs-0.11pre7577; @@ -131,7 +149,16 @@ in Name of the profile used when generating the hardware-scan. ''; }; - + + installer.enableGraphicalTools = pkgs.lib.mkOption { + default = false; + type = with pkgs.lib.types; bool; + example = true; + description = '' + Enable the installation of graphical tools. + ''; + }; + }; config = { @@ -146,7 +173,7 @@ in installer2.runInChroot installer2.nixosPrepareInstall - ]; + ] ++ pkgs.lib.optional cfg.enableGraphicalTools nixosGui; system.build = { inherit nixosInstall nixosHardwareScan nixosOption; diff --git a/modules/profiles/graphical.nix b/modules/profiles/graphical.nix index 1c279a73ac9..fbf6f1d2421 100644 --- a/modules/profiles/graphical.nix +++ b/modules/profiles/graphical.nix @@ -13,4 +13,6 @@ desktopManager.default = "kde4"; desktopManager.kde4.enable = true; }; + + installer.enableGraphicalTools = true; }