- there were many easy merge conflicts - cc-wrapper needed nontrivial changes Many other problems might've been created by interaction of the branches, but stdenv and a few other packages build fine now.wip/yesman
commit
bf414c9d4f
@ -0,0 +1,6 @@ |
||||
language: python |
||||
python: "3.4" |
||||
sudo: required |
||||
before_install: ./maintainers/scripts/travis-nox-review-pr.sh nix |
||||
install: ./maintainers/scripts/travis-nox-review-pr.sh nox |
||||
script: ./maintainers/scripts/travis-nox-review-pr.sh build |
@ -1,10 +1,26 @@ |
||||
Nixpkgs is a collection of packages for [Nix](http://nixos.org/nix/) package |
||||
manager. Nixpkgs also includes [NixOS](http://nixos.org/nixos/) linux distribution source code. |
||||
|
||||
* [NixOS installation instructions](http://nixos.org/nixos/manual/#ch-installation) |
||||
* [Manual (How to write packages for Nix)](http://nixos.org/nixpkgs/manual/) |
||||
* [Manual (NixOS)](http://nixos.org/nixos/manual/) |
||||
* [Continuous build](http://hydra.nixos.org/jobset/nixos/trunk-combined) |
||||
* [Tests](http://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents) |
||||
[<img src="http://nixos.org/logo/nixos-hires.png" width="500px" alt="logo" /> |
||||
](https://nixos.org/nixos) |
||||
|
||||
[![Build Status](https://travis-ci.org/NixOS/nixpkgs.svg?branch=master)](https://travis-ci.org/NixOS/nixpkgs) [![Issue Stats](http://www.issuestats.com/github/nixos/nixpkgs/badge/pr)](http://www.issuestats.com/github/nixos/nixpkgs) [![Issue Stats](http://www.issuestats.com/github/nixos/nixpkgs/badge/issue)](http://www.issuestats.com/github/nixos/nixpkgs) |
||||
|
||||
Nixpkgs is a collection of packages for [Nix](https://nixos.org/nix/) package |
||||
manager. |
||||
|
||||
[NixOS](https://nixos.org/nixos/) linux distribution source code is located inside `nixos/` folder. |
||||
|
||||
* [NixOS installation instructions](https://nixos.org/nixos/manual/#ch-installation) |
||||
* [Documentation (Nix Expression Language chapter)](https://nixos.org/nix/manual/#ch-expression-language) |
||||
* [Manual (How to write packages for Nix)](https://nixos.org/nixpkgs/manual/) |
||||
* [Manual (NixOS)](https://nixos.org/nixos/manual/) |
||||
* [Continuous package builds for unstable/master](https://hydra.nixos.org/jobset/nixos/trunk-combined) |
||||
* [Continuous package builds for 14.12 release](https://hydra.nixos.org/jobset/nixos/release-14.12) |
||||
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents) |
||||
* [Tests for 14.12 release](https://hydra.nixos.org/job/nixos/release-14.12/tested#tabs-constituents) |
||||
|
||||
Communication: |
||||
|
||||
* [Mailing list](http://lists.science.uu.nl/mailman/listinfo/nix-dev) |
||||
* [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos) |
||||
|
||||
--- |
||||
[![Throughput Graph](https://graphs.waffle.io/nixos/nixpkgs/throughput.svg)](https://waffle.io/nixos/nixpkgs/metrics) |
||||
|
@ -0,0 +1,70 @@ |
||||
<chapter xmlns="http://docbook.org/ns/docbook" |
||||
xmlns:xlink="http://www.w3.org/1999/xlink" |
||||
xml:id="chap-packageconfig"> |
||||
|
||||
<title><filename>~/.nixpkgs/config.nix</filename>: global configuration</title> |
||||
|
||||
<para> |
||||
Nix packages can be configured to allow or deny certain options. |
||||
</para> |
||||
|
||||
<para> |
||||
To apply the configuration edit <filename>~/.nixpkgs/config.nix</filename> |
||||
and set it like |
||||
<programlisting>{ |
||||
allowUnfree = true; |
||||
}</programlisting> |
||||
and will allow the Nix package manager to install unfree licensed packages. |
||||
|
||||
The configuration as listed also applies to NixOS under <option>nixpkgs.config</option> set. |
||||
</para> |
||||
|
||||
<itemizedlist> |
||||
<listitem> |
||||
<para> |
||||
Allow installing of packages that are distributed under unfree license by setting |
||||
<programlisting>allowUnfree = true;</programlisting> |
||||
or deny them by setting it to <literal>false</literal>. |
||||
</para> |
||||
<para> |
||||
Same can be achieved by setting the environment variable: |
||||
<programlisting>$ export NIXPKGS_ALLOW_UNFREE=1</programlisting> |
||||
</para> |
||||
</listitem> |
||||
|
||||
<listitem> |
||||
<para> |
||||
Whenever unfree packages are not allowed, single packages can |
||||
still be allowed by a predicate function that accepts package |
||||
as an argument and should return a boolean: |
||||
<programlisting>allowUnfreePredicate = (pkg: ...);</programlisting> |
||||
|
||||
Example to allow flash player only: |
||||
<programlisting>allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);</programlisting> |
||||
</para> |
||||
</listitem> |
||||
|
||||
<listitem> |
||||
<para> |
||||
Whenever unfree packages are not allowed, packages can still be |
||||
whitelisted by their license: |
||||
<programlisting>whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];</programlisting> |
||||
</para> |
||||
</listitem> |
||||
|
||||
<listitem> |
||||
<para> |
||||
In addition to whitelisting licenses which are denied by the |
||||
<literal>allowUnfree</literal> setting, you can also explicitely |
||||
deny installation of packages which have a certain license: |
||||
<programlisting>blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];</programlisting> |
||||
</para> |
||||
</listitem> |
||||
</itemizedlist> |
||||
|
||||
<para> |
||||
A complete list of licenses can be found in the file |
||||
<filename>lib/licenses.nix</filename> of the nix package tree. |
||||
</para> |
||||
|
||||
</chapter> |
@ -1,44 +0,0 @@ |
||||
<?xml version="1.0"?> |
||||
|
||||
<xsl:stylesheet |
||||
version="1.0" |
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
||||
xmlns:str="http://exslt.org/strings" |
||||
extension-element-prefixes="str"> |
||||
|
||||
<xsl:output method="xml"/> |
||||
|
||||
<xsl:template match="function|command|literal|varname|filename|option|quote">`<xsl:apply-templates/>'</xsl:template> |
||||
|
||||
<xsl:template match="token"><xsl:text> </xsl:text><xsl:apply-templates /><xsl:text> |
||||
</xsl:text></xsl:template> |
||||
|
||||
<xsl:template match="screen|programlisting"> |
||||
<screen><xsl:apply-templates select="str:split(., '
')" /></screen> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="section[following::section]"> |
||||
<section> |
||||
<xsl:apply-templates /> |
||||
<screen><xsl:text> |
||||
</xsl:text></screen> |
||||
</section> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="*"> |
||||
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> |
||||
<xsl:copy-of select="namespace::*" /> |
||||
<xsl:for-each select="@*"> |
||||
<xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}"> |
||||
<xsl:value-of select="."/> |
||||
</xsl:attribute> |
||||
</xsl:for-each> |
||||
<xsl:apply-templates/> |
||||
</xsl:element> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="text()"> |
||||
<xsl:value-of select="translate(., '‘’“”—', concat("`'", '""-'))" /> |
||||
</xsl:template> |
||||
|
||||
</xsl:stylesheet> |
@ -0,0 +1,119 @@ |
||||
#!/bin/sh |
||||
# |
||||
# This script is used to test that the module system is working as expected. |
||||
# By default it test the version of nixpkgs which is defined in the NIX_PATH. |
||||
|
||||
cd ./modules |
||||
|
||||
pass=0 |
||||
fail=0 |
||||
|
||||
evalConfig() { |
||||
local attr=$1 |
||||
shift; |
||||
local script="import ./default.nix { modules = [ $@ ];}" |
||||
nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only |
||||
} |
||||
|
||||
reportFailure() { |
||||
local attr=$1 |
||||
shift; |
||||
local script="import ./default.nix { modules = [ $@ ];}" |
||||
echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only" |
||||
evalConfig "$attr" "$@" |
||||
fail=$((fail + 1)) |
||||
} |
||||
|
||||
checkConfigOutput() { |
||||
local outputContains=$1 |
||||
shift; |
||||
if evalConfig "$@" 2>/dev/null | grep --silent "$outputContains" ; then |
||||
pass=$((pass + 1)) |
||||
return 0; |
||||
else |
||||
echo 2>&1 "error: Expected result matching '$outputContains', while evaluating" |
||||
reportFailure "$@" |
||||
return 1 |
||||
fi |
||||
} |
||||
|
||||
checkConfigError() { |
||||
local errorContains=$1 |
||||
local err="" |
||||
shift; |
||||
if err==$(evalConfig "$@" 2>&1 >/dev/null); then |
||||
echo 2>&1 "error: Expected error code, got exit code 0, while evaluating" |
||||
reportFailure "$@" |
||||
return 1 |
||||
else |
||||
if echo "$err" | grep --silent "$errorContains" ; then |
||||
pass=$((pass + 1)) |
||||
return 0; |
||||
else |
||||
echo 2>&1 "error: Expected error matching '$errorContains', while evaluating" |
||||
reportFailure "$@" |
||||
return 1 |
||||
fi |
||||
fi |
||||
} |
||||
|
||||
# Check boolean option. |
||||
checkConfigOutput "false" config.enable ./declare-enable.nix |
||||
checkConfigError 'The option .* defined in .* does not exist.' config.enable ./define-enable.nix |
||||
|
||||
# Check mkForce without submodules. |
||||
set -- config.enable ./declare-enable.nix ./define-enable.nix |
||||
checkConfigOutput "true" "$@" |
||||
checkConfigOutput "false" "$@" ./define-force-enable.nix |
||||
checkConfigOutput "false" "$@" ./define-enable-force.nix |
||||
|
||||
# Check mkForce with option and submodules. |
||||
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix |
||||
checkConfigOutput 'false' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix |
||||
set -- config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo-enable.nix |
||||
checkConfigOutput 'true' "$@" |
||||
checkConfigOutput 'false' "$@" ./define-force-loaOfSub-foo-enable.nix |
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-force-foo-enable.nix |
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-force-enable.nix |
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-force.nix |
||||
|
||||
# Check overriding effect of mkForce on submodule definitions. |
||||
checkConfigError 'attribute .*bar.* .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix |
||||
checkConfigOutput 'false' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar.nix |
||||
set -- config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar-enable.nix |
||||
checkConfigOutput 'true' "$@" |
||||
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix |
||||
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix |
||||
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-force-enable.nix |
||||
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-enable-force.nix |
||||
|
||||
# Check mkIf with submodules. |
||||
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-enable.nix ./declare-loaOfSub-any-enable.nix |
||||
set -- config.loaOfSub.foo.enable ./declare-enable.nix ./declare-loaOfSub-any-enable.nix |
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-if-loaOfSub-foo-enable.nix |
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-loaOfSub-if-foo-enable.nix |
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-loaOfSub-foo-if-enable.nix |
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-if.nix |
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-if-loaOfSub-foo-enable.nix |
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-if-foo-enable.nix |
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-if-enable.nix |
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-enable-if.nix |
||||
|
||||
# Check _module.args. |
||||
checkConfigOutput "true" config.enable ./declare-enable.nix ./custom-arg-define-enable.nix |
||||
|
||||
# Check _module.check. |
||||
set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-loaOfSub-foo.nix |
||||
checkConfigError 'The option .* defined in .* does not exist.' "$@" |
||||
checkConfigOutput "true" "$@" ./define-module-check.nix |
||||
|
||||
cat <<EOF |
||||
====== module tests ====== |
||||
$pass Pass |
||||
$fail Fail |
||||
EOF |
||||
|
||||
if test $fail -ne 0; then |
||||
exit 1 |
||||
fi |
||||
exit 0 |
@ -0,0 +1,8 @@ |
||||
{ lib, custom, ... }: |
||||
|
||||
{ |
||||
config = { |
||||
_module.args.custom = true; |
||||
enable = custom; |
||||
}; |
||||
} |
@ -0,0 +1,14 @@ |
||||
{ lib, ... }: |
||||
|
||||
{ |
||||
options = { |
||||
enable = lib.mkOption { |
||||
default = false; |
||||
example = true; |
||||
type = lib.types.bool; |
||||
description = '' |
||||
Some descriptive text |
||||
''; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1,29 @@ |
||||
{ lib, ... }: |
||||
|
||||
let |
||||
submod = { ... }: { |
||||
options = { |
||||
enable = lib.mkOption { |
||||
default = false; |
||||
example = true; |
||||
type = lib.types.bool; |
||||
description = '' |
||||
Some descriptive text |
||||
''; |
||||
}; |
||||
}; |
||||
}; |
||||
in |
||||
|
||||
{ |
||||
options = { |
||||
loaOfSub = lib.mkOption { |
||||
default = {}; |
||||
example = {}; |
||||
type = lib.types.loaOf (lib.types.submodule [ submod ]); |
||||
description = '' |
||||
Some descriptive text |
||||
''; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1,7 @@ |
||||
{ lib ? import <nixpkgs/lib>, modules ? [] }: |
||||
|
||||
{ |
||||
inherit (lib.evalModules { |
||||
inherit modules; |
||||
}) config options; |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ lib, ... }: |
||||
|
||||
{ |
||||
enable = lib.mkForce false; |
||||
} |
@ -0,0 +1,3 @@ |
||||
{ |
||||
enable = true; |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ lib, ... }: |
||||
|
||||
lib.mkForce { |
||||
enable = false; |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ lib, ... }: |
||||
|
||||
lib.mkForce { |
||||
loaOfSub.foo.enable = false; |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ config, lib, ... }: |
||||
|
||||
lib.mkIf config.enable { |
||||
loaOfSub.foo.enable = true; |
||||
} |
@ -0,0 +1,3 @@ |
||||
{ |
||||
loaOfSub.bar.enable = true; |
||||
} |
@ -0,0 +1,3 @@ |
||||
{ |
||||
loaOfSub.bar = {}; |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ lib, ... }: |
||||
|
||||
{ |
||||
loaOfSub.foo.enable = lib.mkForce false; |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ config, lib, ... }: |
||||
|
||||
{ |
||||
loaOfSub.foo.enable = lib.mkIf config.enable true; |
||||
} |
@ -0,0 +1,3 @@ |
||||
{ |
||||
loaOfSub.foo.enable = true; |
||||
} |
@ -0,0 +1,7 @@ |
||||
{ lib, ... }: |
||||
|
||||
{ |
||||
loaOfSub.foo = lib.mkForce { |
||||
enable = false; |
||||
}; |
||||
} |
@ -0,0 +1,7 @@ |
||||
{ config, lib, ... }: |
||||
|
||||
{ |
||||
loaOfSub.foo = lib.mkIf config.enable { |
||||
enable = true; |
||||
}; |
||||
} |
@ -0,0 +1,3 @@ |
||||
{ |
||||
loaOfSub.foo = {}; |
||||
} |
@ -0,0 +1,7 @@ |
||||
{ lib, ... }: |
||||
|
||||
{ |
||||
loaOfSub = lib.mkForce { |
||||
foo.enable = false; |
||||
}; |
||||
} |
@ -0,0 +1,7 @@ |
||||
{ config, lib, ... }: |
||||
|
||||
{ |
||||
loaOfSub = lib.mkIf config.enable { |
||||
foo.enable = true; |
||||
}; |
||||
} |
@ -0,0 +1,3 @@ |
||||
{ |
||||
_module.check = false; |
||||
} |
@ -0,0 +1,31 @@ |
||||
{ nixpkgs }: |
||||
|
||||
with import ./../.. { }; |
||||
with lib; |
||||
|
||||
stdenv.mkDerivation { |
||||
name = "nixpkgs-lib-tests"; |
||||
buildInputs = [ nix ]; |
||||
NIX_PATH="nixpkgs=${nixpkgs}"; |
||||
|
||||
buildCommand = '' |
||||
datadir="${nix}/share" |
||||
export TEST_ROOT=$(pwd)/test-tmp |
||||
export NIX_STORE_DIR=$TEST_ROOT/store |
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var |
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix |
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix |
||||
export NIX_DB_DIR=$TEST_ROOT/db |
||||
export NIX_CONF_DIR=$TEST_ROOT/etc |
||||
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests |
||||
export NIX_BUILD_HOOK= |
||||
export PAGER=cat |
||||
cacheDir=$TEST_ROOT/binary-cache |
||||
nix-store --init |
||||
|
||||
cd ${nixpkgs}/lib/tests |
||||
./modules.sh |
||||
|
||||
touch $out |
||||
''; |
||||
} |
@ -0,0 +1,14 @@ |
||||
*~ |
||||
,* |
||||
.*.swp |
||||
.*.swo |
||||
result |
||||
result-* |
||||
/doc/NEWS.html |
||||
/doc/NEWS.txt |
||||
/doc/manual.html |
||||
/doc/manual.pdf |
||||
.version-suffix |
||||
|
||||
.DS_Store |
||||
.git |
@ -0,0 +1,12 @@ |
||||
FROM busybox |
||||
|
||||
RUN dir=`mktemp -d` && trap 'rm -rf "$dir"' EXIT && \ |
||||
wget -O- https://nixos.org/releases/nix/nix-1.7/nix-1.7-x86_64-linux.tar.bz2 | bzcat | tar x -C $dir && \ |
||||
mkdir -m 0755 /nix && USER=root sh $dir/*/install && \ |
||||
echo ". /root/.nix-profile/etc/profile.d/nix.sh" >> /etc/profile |
||||
|
||||
ADD . /root/nix/nixpkgs |
||||
ONBUILD ENV NIX_PATH nixpkgs=/root/nix/nixpkgs:nixos=/root/nix/nixpkgs/nixos |
||||
ONBUILD ENV PATH /root/.nix-profile/bin:/root/.nix-profile/sbin:/bin:/sbin:/usr/bin:/usr/sbin |
||||
ONBUILD ENV ENV /etc/profile |
||||
ENV ENV /etc/profile |
@ -0,0 +1,41 @@ |
||||
#! /usr/bin/env bash |
||||
set -e |
||||
|
||||
export NIX_CURL_FLAGS=-sS |
||||
|
||||
if [[ $1 == nix ]]; then |
||||
echo "=== Installing Nix..." |
||||
# Install Nix |
||||
bash <(curl -sS https://nixos.org/nix/install) |
||||
source $HOME/.nix-profile/etc/profile.d/nix.sh |
||||
|
||||
# Make sure we can use hydra's binary cache |
||||
sudo mkdir /etc/nix |
||||
sudo tee /etc/nix/nix.conf <<EOF >/dev/null |
||||
binary-caches = http://cache.nixos.org http://hydra.nixos.org |
||||
trusted-binary-caches = http://hydra.nixos.org |
||||
build-max-jobs = 4 |
||||
EOF |
||||
|
||||
# Verify evaluation |
||||
echo "=== Verifying that nixpkgs evaluates..." |
||||
nix-env -f. -qa --json >/dev/null |
||||
elif [[ $1 == nox ]]; then |
||||
echo "=== Installing nox..." |
||||
git clone -q https://github.com/madjar/nox |
||||
pip --quiet install -e nox |
||||
elif [[ $1 == build ]]; then |
||||
source $HOME/.nix-profile/etc/profile.d/nix.sh |
||||
|
||||
if [[ $TRAVIS_PULL_REQUEST == false ]]; then |
||||
echo "=== Not a pull request" |
||||
else |
||||
echo "=== Checking PR" |
||||
nox-review pr ${TRAVIS_PULL_REQUEST} |
||||
fi |
||||
# echo "=== Checking tarball creation" |
||||
# nix-build pkgs/top-level/release.nix -A tarball |
||||
else |
||||
echo "$0: Unknown option $1" >&2 |
||||
false |
||||
fi |
@ -0,0 +1,112 @@ |
||||
#!/bin/sh |
||||
set -e |
||||
|
||||
: ${NIXOS_CHANNELS:=https://nixos.org/channels/} |
||||
: ${CHANNELS_NAMESPACE:=refs/heads/channels/} |
||||
|
||||
# List all channels which are currently in the repository which we would |
||||
# have to remove if they are not found again. |
||||
deadChannels=$(git for-each-ref --format="%(refname)" "$CHANNELS_NAMESPACE") |
||||
|
||||
updateRef() { |
||||
local channelName=$1 |
||||
local newRev=$2 |
||||
|
||||
# if the inputs are not valid, then we do not update any branch. |
||||
test -z "$newRev" -o -z "$channelName" && return; |
||||
|
||||
# Update the local refs/heads/channels/* branches to be in-sync with the |
||||
# channel references. |
||||
local branch=$CHANNELS_NAMESPACE$channelName |
||||
oldRev=$(git rev-parse --short "$branch" 2>/dev/null || true) |
||||
if test "$oldRev" != "$newRev"; then |
||||
if git update-ref "$branch" "$newRev" 2>/dev/null; then |
||||
if test -z "$oldRev"; then |
||||
echo " * [new branch] $newRev -> ${branch#refs/heads/}" |
||||
else |
||||
echo " $oldRev..$newRev -> ${branch#refs/heads/}" |
||||
fi |
||||
else |
||||
if test -z "$oldRev"; then |
||||
echo " * [missing rev] $newRev -> ${branch#refs/heads/}" |
||||
else |
||||
echo " [missing rev] $oldRev..$newRev -> ${branch#refs/heads/}" |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
# Filter out the current channel from the list of dead channels. |
||||
deadChannels=$(grep -v "$CHANNELS_NAMESPACE$channelName" <<EOF |
||||
$deadChannels |
||||
EOF |
||||
) ||true |
||||
} |
||||
|
||||
# Find the name of all channels which are listed in the directory. |
||||
echo "Fetching channels from $NIXOS_CHANNELS:" |
||||
for channelName in : $(curl -s "$NIXOS_CHANNELS" | sed -n '/folder/ { s,.*href=",,; s,/".*,,; p }'); do |
||||
test "$channelName" = : && continue; |
||||
|
||||
# Do not follow redirections, such that we can extract the |
||||
# short-changeset from the name of the directory where we are |
||||
# redirected to. |
||||
sha1=$(curl -sI "$NIXOS_CHANNELS$channelName" | sed -n '/Location/ { s,.*\.\([a-f0-9]*\)[ \r]*$,\1,; p; }') |
||||
|
||||
updateRef "remotes/$channelName" "$sha1" |
||||
done |
||||
|
||||
echo "Fetching channels from nixos-version:" |
||||
if currentSystem=$(nixos-version 2>/dev/null); then |
||||
# If the system is entirely build from a custom nixpkgs version, |
||||
# then the version is not annotated in git version. This sed |
||||
# expression is basically matching that the expressions end with |
||||
# ".<sha1> (Name)" to extract the sha1. |
||||
sha1=$(echo "$currentSystem" | sed -n 's,^.*\.\([a-f0-9]*\) *(.*)$,\1,; T skip; p; :skip;') |
||||
|
||||
updateRef current-system "$sha1" |
||||
fi |
||||
|
||||
echo "Fetching channels from $HOME/.nix-defexpr:" |
||||
for revFile in : $(find -L "$HOME/.nix-defexpr/" -maxdepth 4 -name svn-revision); do |
||||
test "$revFile" = : && continue; |
||||
|
||||
# Deconstruct a path such as, into: |
||||
# |
||||
# /home/luke/.nix-defexpr/channels_root/nixos/nixpkgs/svn-revision |
||||
# channelName = root/nixos |
||||
# |
||||
# /home/luke/.nix-defexpr/channels/nixpkgs/svn-revision |
||||
# channelName = nixpkgs |
||||
# |
||||
user=${revFile#*.nix-defexpr/channels} |
||||
repo=${user#*/} |
||||
repo=${repo%%/*} |
||||
user=${user%%/*} |
||||
user=${user#_} |
||||
test -z "$user" && user=$USER |
||||
channelName="$user${user:+/}$repo" |
||||
|
||||
sha1=$(sed -n 's,^.*\.\([a-f0-9]*\)$,\1,; T skip; p; :skip;' "$revFile") |
||||
|
||||
updateRef "$channelName" "$sha1" |
||||
done |
||||
|
||||
# Suggest to remove channel branches which are no longer found by this |
||||
# script. This is to handle the cases where a local/remote channel |
||||
# disappear. We should not attempt to remove manually any branches, as they |
||||
# might be user branches. |
||||
if test -n "$deadChannels"; then |
||||
|
||||
echo " |
||||
Some old channel branches are still in your repository, if you |
||||
want to remove them, run the following command(s): |
||||
" |
||||
|
||||
while read branch; do |
||||
echo " git update-ref -d $branch" |
||||
done <<EOF |
||||
$deadChannels |
||||
EOF |
||||
|
||||
echo |
||||
fi |
@ -0,0 +1,7 @@ |
||||
viric viriketo@gmail.com |
||||
Pjotr Prins pjotr.public01@thebird.nl |
||||
Pjotr Prins pjotr.public05@thebird.nl |
||||
Wouter den Breejen wbreejen |
||||
MarcWeber marcweber |
||||
Ricardo Correia Ricardo M. Correia |
||||
ertesx@gmx.de ertes |
@ -0,0 +1,122 @@ |
||||
#! /bin/sh |
||||
|
||||
export LANG=C LC_ALL=C LC_COLLATE=C |
||||
|
||||
# Load git log |
||||
raw_git_log="$(git log)" |
||||
git_data="$(echo "$raw_git_log" | grep 'Author:' | |
||||
sed -e 's/^ *Author://; s/\\//g; s/^ *//; s/ *$//; |
||||
s/ @ .*//; s/ *[<]/\t/; s/[>]//')" |
||||
|
||||
# Name - nick - email correspondence from log and from maintainer list |
||||
# Also there are a few manual entries |
||||
maintainers="$(cat "$(dirname "$0")/../../lib/maintainers.nix" | |
||||
grep '=' | sed -re 's/\\"/''/g; |
||||
s/ *([^ =]*) *= *" *(.*[^ ]) *[<](.*)[>] *".*/\1\t\2\t\3/')" |
||||
git_lines="$( ( echo "$git_data"; |
||||
cat "$(dirname "$0")/vanity-manual-equalities.txt") | sort |uniq)" |
||||
|
||||
emails="$( |
||||
( echo "$maintainers" | cut -f 3; echo "$git_data" | cut -f 2 ) | |
||||
sort | uniq | grep -E ".+@.+[.].+" |
||||
)" |
||||
|
||||
fetchGithubName () { |
||||
commitid="$( |
||||
echo "$raw_git_log" | grep -B3 "Author: .*[<]$1[>]" | head -n 3 | |
||||
grep '^commit ' | tail -n 1 | sed -e 's/^commit //' |
||||
)" |
||||
userid="$( |
||||
curl https://github.com/NixOS/nixpkgs/commit/"$commitid" 2>/dev/null | |
||||
grep authored -B10 | grep 'href="/' | |
||||
sed -re 's@.* href="/@@; s@".*@@' | |
||||
grep -v "/commit/" |
||||
)"; |
||||
echo "$userid" |
||||
} |
||||
|
||||
[ -n "$NIXPKGS_GITHUB_NAME_CACHE" ] && { |
||||
echo "$emails" | while read email; do |
||||
line="$(grep "$email " "$NIXPKGS_GITHUB_NAME_CACHE")" |
||||
[ -z "$line" ] && { |
||||
echo "$email $(fetchGithubName "$email")" >> \ |
||||
"$NIXPKGS_GITHUB_NAME_CACHE" |
||||
} |
||||
done |
||||
} |
||||
|
||||
# For RDF |
||||
normalize_name () { |
||||
sed -e 's/%/%25/g; s/ /%20/g; s/'\''/%27/g; s/"/%22/g; s/`/%60/g; s/\^/%5e/g; ' |
||||
} |
||||
|
||||
denormalize_name () { |
||||
sed -e 's/%20/ /g; s/%27/'\''/g; s/%22/"/g; s/%60/`/g; s/%5e/^/g; s/%25/%/g;'; |
||||
} |
||||
|
||||
n3="$(mktemp --suffix .n3)" |
||||
|
||||
# «The same person» relation and a sorting hint |
||||
# Full name is something with a space |
||||
( |
||||
echo "$git_lines" | sed -re 's@(.*)\t(.*)@<my://name/\1> <my://can-be> <my://name/\2>.@' |
||||
echo "$git_lines" | sed -re 's@(.*)\t(.*)@<my://name/\2> <my://can-be> <my://name/\1>.@' |
||||
echo "$maintainers" | sed -re 's@(.*)\t(.*)\t(.*)@<my://name/\1> <my://can-be> <my://name/\2>.@' |
||||
echo "$maintainers" | sed -re 's@(.*)\t(.*)\t(.*)@<my://name/\2> <my://can-be> <my://name/\3>.@' |
||||
echo "$maintainers" | sed -re 's@(.*)\t(.*)\t(.*)@<my://name/\3> <my://can-be> <my://name/\1>.@' |
||||
echo "$git_lines" | grep ' ' | cut -f 1 | sed -e 's@.*@<my://name/&> <my://is-name> <my://0>.@' |
||||
echo "$git_lines" | grep -v ' ' | cut -f 1 | sed -e 's@.*@<my://name/&> <my://is-name> <my://1>.@' |
||||
echo "$maintainers" | cut -f 2 | sed -e 's@.*@<my://name/&> <my://is-name> <my://0>.@' |
||||
[ -n "$NIXPKGS_GITHUB_NAME_CACHE" ] && cat "$NIXPKGS_GITHUB_NAME_CACHE" | |
||||
grep -v " $" | |
||||
sed -re 's@(.*)\t(.*)@<my://name/\1> <my://at-github> <my://github/\2>.@' |
||||
) | normalize_name | grep -E '<my://[-a-z]+>' | sort | uniq > "$n3" |
||||
|
||||
# Get transitive closure |
||||
sparql="$(nix-build '<nixpkgs>' -Q -A apache-jena --no-out-link)/bin/sparql" |
||||
name_list="$( |
||||
"$sparql" --results=TSV --data="$n3" " |
||||
select ?x ?y ?g where { |
||||
?x <my://can-be>+ ?y. |
||||
?x <my://is-name> ?g. |
||||
} |
||||
" | tail -n +2 | |
||||
sed -re 's@<my://name/@@g; s@<my://@@g; s@>@@g;' | |
||||
sort -k 2,3 -t ' ' |
||||
)" |
||||
github_name_list="$( |
||||
"$sparql" --results=TSV --data="$n3" " |
||||
select ?x ?y where { |
||||
?x (<my://can-be>+ / <my://at-github>) ?y. |
||||
} |
||||
" | tail -n +2 | |
||||
sed -re 's@<my://(name|github)/@@g; s@<my://@@g; s@>@@g;' |
||||
)" |
||||
|
||||
# Take first spelling option for every person |
||||
name_list_canonical="$(echo "$name_list" | cut -f 1,2 | uniq -f1)" |
||||
|
||||
cleaner_script="$(echo "$name_list_canonical" | denormalize_name | |
||||
sed -re 's/(.*)\t(.*)/s#^\2$#\1#g/g')" |
||||
|
||||
# Add github usernames |
||||
if [ -n "$NIXPKGS_GITHUB_NAME_CACHE" ]; then |
||||
github_adder_script="$(echo "$github_name_list" | |
||||
grep -E "$(echo "$name_list_canonical" | cut -f 2 | |
||||
tr '\n' '|' )" | |
||||
sort | uniq | |
||||
sed -re 's/(.*)\t(.*)/s| \1$| \1\t\2|g;/' | |
||||
denormalize_name |
||||
)" |
||||
else |
||||
github_adder_script='' |
||||
fi |
||||
|
||||
echo "$name_list" | denormalize_name |
||||
|
||||
echo |
||||
|
||||
echo "$git_data" | cut -f 1 | |
||||
sed -e "$cleaner_script" | |
||||
sort | uniq -c | sort -k1n | sed -re "$github_adder_script" | |
||||
sed -re 's/^ *([0-9]+) /\1\t/' |
@ -1,22 +0,0 @@ |
||||
<chapter xmlns="http://docbook.org/ns/docbook" |
||||
xmlns:xlink="http://www.w3.org/1999/xlink" |
||||
xmlns:xi="http://www.w3.org/2001/XInclude" |
||||
version="5.0" |
||||
xml:id="sec-release-14.10"> |
||||
|
||||
<title>Release 14.10 (“Caterpillar”, 2014/10/??)</title> |
||||
|
||||
<para>When upgrading from a previous release, please be aware of the |
||||
following incompatible changes: |
||||
|
||||
<itemizedlist> |
||||
|
||||
<listitem><para>The host side of a container virtual Ethernet pair |
||||
is now called <literal>ve-<replaceable>container-name</replaceable></literal> |
||||
rather than <literal>c-<replaceable>container-name</replaceable></literal>.</para></listitem> |
||||
|
||||
</itemizedlist> |
||||
|
||||
</para> |
||||
|
||||
</chapter> |
@ -0,0 +1,177 @@ |
||||
<chapter xmlns="http://docbook.org/ns/docbook" |
||||
xmlns:xlink="http://www.w3.org/1999/xlink" |
||||
xmlns:xi="http://www.w3.org/2001/XInclude" |
||||
version="5.0" |
||||
xml:id="sec-release-14.12"> |
||||
|
||||
<title>Release 14.12 (“Caterpillar”, 2014/12/30)</title> |
||||
|
||||
<para>In addition to numerous new and upgraded packages, this release has the following highlights: |
||||
|
||||
<itemizedlist> |
||||
|
||||
<listitem><para>Systemd has been updated to version 217, which has numerous |
||||
<link xlink:href="http://lists.freedesktop.org/archives/systemd-devel/2014-October/024662.html">improvements.</link></para></listitem> |
||||
|
||||
<listitem><para><link xlink:href="http://thread.gmane.org/gmane.linux.distributions.nixos/15165"> |
||||
Nix has been updated to 1.8.</link></para></listitem> |
||||
|
||||
<listitem><para>NixOS is now based on Glibc 2.20.</para></listitem> |
||||
|
||||
<listitem><para>KDE has been updated to 4.14.</para></listitem> |
||||
|
||||
<listitem><para>The default Linux kernel has been updated to 3.14.</para></listitem> |
||||
|
||||
<listitem><para>If <option>users.mutableUsers</option> is enabled (the |
||||
default), changes made to the declaration of a user or group will be |
||||
correctly realised when running <command>nixos-rebuild</command>. For |
||||
instance, removing a user specification from |
||||
<filename>configuration.nix</filename> will cause the actual user |
||||
account to be deleted. If <option>users.mutableUsers</option> is |
||||
disabled, it is no longer necessary to specify UIDs or GIDs; if |
||||
omitted, they are allocated dynamically.</para></listitem> |
||||
|
||||
</itemizedlist></para> |
||||
|
||||
<para>Following new services were added since the last release: |
||||
|
||||
<itemizedlist> |
||||
<listitem><para><literal>atftpd</literal></para></listitem> |
||||
<listitem><para><literal>bosun</literal></para></listitem> |
||||
<listitem><para><literal>bspwm</literal></para></listitem> |
||||
<listitem><para><literal>chronos</literal></para></listitem> |
||||
<listitem><para><literal>collectd</literal></para></listitem> |
||||
<listitem><para><literal>consul</literal></para></listitem> |
||||
<listitem><para><literal>cpuminer-cryptonight</literal></para></listitem> |
||||
<listitem><para><literal>crashplan</literal></para></listitem> |
||||
<listitem><para><literal>dnscrypt-proxy</literal></para></listitem> |
||||
<listitem><para><literal>docker-registry</literal></para></listitem> |
||||
<listitem><para><literal>docker</literal></para></listitem> |
||||
<listitem><para><literal>etcd</literal></para></listitem> |
||||
<listitem><para><literal>fail2ban</literal></para></listitem> |
||||
<listitem><para><literal>fcgiwrap</literal></para></listitem> |
||||
<listitem><para><literal>fleet</literal></para></listitem> |
||||
<listitem><para><literal>fluxbox</literal></para></listitem> |
||||
<listitem><para><literal>gdm</literal></para></listitem> |
||||
<listitem><para><literal>geoclue2</literal></para></listitem> |
||||
<listitem><para><literal>gitlab</literal></para></listitem> |
||||
<listitem><para><literal>gitolite</literal></para></listitem> |
||||
<listitem><para><literal>gnome3.gnome-documents</literal></para></listitem> |
||||
<listitem><para><literal>gnome3.gnome-online-miners</literal></para></listitem> |
||||
<listitem><para><literal>gnome3.gvfs</literal></para></listitem> |
||||
<listitem><para><literal>gnome3.seahorse</literal></para></listitem> |
||||
<listitem><para><literal>hbase</literal></para></listitem> |
||||
<listitem><para><literal>i2pd</literal></para></listitem> |
||||
<listitem><para><literal>influxdb</literal></para></listitem> |
||||
<listitem><para><literal>kubernetes</literal></para></listitem> |
||||
<listitem><para><literal>liquidsoap</literal></para></listitem> |
||||
<listitem><para><literal>lxc</literal></para></listitem> |
||||
<listitem><para><literal>mailpile</literal></para></listitem> |
||||
<listitem><para><literal>mesos</literal></para></listitem> |
||||
<listitem><para><literal>mlmmj</literal></para></listitem> |
||||
<listitem><para><literal>monetdb</literal></para></listitem> |
||||
<listitem><para><literal>mopidy</literal></para></listitem> |
||||
<listitem><para><literal>neo4j</literal></para></listitem> |
||||
<listitem><para><literal>nsd</literal></para></listitem> |
||||
<listitem><para><literal>openntpd</literal></para></listitem> |
||||
<listitem><para><literal>opentsdb</literal></para></listitem> |
||||
<listitem><para><literal>openvswitch</literal></para></listitem> |
||||
<listitem><para><literal>parallels-guest</literal></para></listitem> |
||||
<listitem><para><literal>peerflix</literal></para></listitem> |
||||
<listitem><para><literal>phd</literal></para></listitem> |
||||
<listitem><para><literal>polipo</literal></para></listitem> |
||||
<listitem><para><literal>prosody</literal></para></listitem> |
||||
<listitem><para><literal>radicale</literal></para></listitem> |
||||
<listitem><para><literal>redmine</literal></para></listitem> |
||||
<listitem><para><literal>riemann</literal></para></listitem> |
||||
<listitem><para><literal>scollector</literal></para></listitem> |
||||
<listitem><para><literal>seeks</literal></para></listitem> |
||||
<listitem><para><literal>siproxd</literal></para></listitem> |
||||
<listitem><para><literal>strongswan</literal></para></listitem> |
||||
<listitem><para><literal>tcsd</literal></para></listitem> |
||||
<listitem><para><literal>teamspeak3</literal></para></listitem> |
||||
<listitem><para><literal>thermald</literal></para></listitem> |
||||
<listitem><para><literal>torque/mrom</literal></para></listitem> |
||||
<listitem><para><literal>torque/server</literal></para></listitem> |
||||
<listitem><para><literal>uhub</literal></para></listitem> |
||||
<listitem><para><literal>unifi</literal></para></listitem> |
||||
<listitem><para><literal>znc</literal></para></listitem> |
||||
<listitem><para><literal>zookeeper</literal></para></listitem> |
||||
</itemizedlist> |
||||
</para> |
||||
|
||||
<para>When upgrading from a previous release, please be aware of the |
||||
following incompatible changes: |
||||
|
||||
<itemizedlist> |
||||
|
||||
<listitem><para>The default version of Apache httpd is now 2.4. If |
||||
you use the <option>extraConfig</option> option to pass literal |
||||
Apache configuration text, you may need to update it — see <link |
||||
xlink:href="http://httpd.apache.org/docs/2.4/upgrading.html">Apache’s |
||||
documentation</link> for details. If you wish to continue to use |
||||
httpd 2.2, add the following line to your NixOS configuration: |
||||
|
||||
<programlisting> |
||||
services.httpd.package = pkgs.apacheHttpd_2_2; |
||||
</programlisting> |
||||
|
||||
</para></listitem> |
||||
|
||||
<listitem><para>PHP 5.3 has been removed because it is no longer |
||||
supported by the PHP project. A <link |
||||
xlink:href="http://php.net/migration54">migration guide</link> is |
||||
available.</para></listitem> |
||||
|
||||
<listitem><para>The host side of a container virtual Ethernet pair |
||||
is now called <literal>ve-<replaceable>container-name</replaceable></literal> |
||||
rather than <literal>c-<replaceable>container-name</replaceable></literal>.</para></listitem> |
||||
|
||||
<listitem><para>GNOME 3.10 support has been dropped. The default GNOME version is now 3.12.</para></listitem> |
||||
|
||||
<listitem><para>VirtualBox has been upgraded to 4.3.20 release. Users |
||||
may be required to run <command>rm -rf /tmp/.vbox*</command>. The line |
||||
<literal>imports = [ <nixpkgs/nixos/modules/programs/virtualbox.nix> ]</literal> is |
||||
no longer necessary, use <literal>services.virtualboxHost.enable = |
||||
true</literal> instead. |
||||
</para> |
||||
<para>Also, hardening mode is now enabled by default, which means that unless you want to use |
||||
USB support, you no longer need to be a member of the <literal>vboxusers</literal> group. |
||||
</para></listitem> |
||||
|
||||
<listitem><para>Chromium has been updated to 39.0.2171.65. <option>enablePepperPDF</option> is now enabled by default. |
||||
<literal>chromium*Wrapper</literal> packages no longer exist, because upstream removed NSAPI support. |
||||
<literal>chromium-stable</literal> has been renamed to <literal>chromium</literal>. |
||||
</para></listitem> |
||||
|
||||
<listitem><para>Python packaging documentation is now part of nixpkgs manual. To override |
||||
the python packages available to a custom python you now use <literal>pkgs.pythonFull.buildEnv.override</literal> |
||||
instead of <literal>pkgs.pythonFull.override</literal>. |
||||
</para></listitem> |
||||
|
||||
<listitem><para><literal>boot.resumeDevice = "8:6"</literal> is no longer supported. Most users will |
||||
want to leave it undefined, which takes the swap partitions automatically. There is an evaluation |
||||
assertion to ensure that the string starts with a slash. |
||||
</para></listitem> |
||||
|
||||
<listitem><para>The system-wide default timezone for NixOS installations |
||||
changed from <literal>CET</literal> to <literal>UTC</literal>. To choose |
||||
a different timezone for your system, configure |
||||
<literal>time.timeZone</literal> in |
||||
<literal>configuration.nix</literal>. A fairly complete list of possible |
||||
values for that setting is available at <link |
||||
xlink:href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"/>.</para></listitem> |
||||
|
||||
<listitem><para>GNU screen has been updated to 4.2.1, which breaks |
||||
the ability to connect to sessions created by older versions of |
||||
screen.</para></listitem> |
||||
|
||||
<listitem><para>The Intel GPU driver was updated to the 3.x prerelease |
||||
version (used by most distributions) and supports DRI3 |
||||
now.</para></listitem> |
||||
|
||||
</itemizedlist> |
||||
|
||||
</para> |
||||
|
||||
</chapter> |
@ -0,0 +1,41 @@ |
||||
<chapter xmlns="http://docbook.org/ns/docbook" |
||||
xmlns:xlink="http://www.w3.org/1999/xlink" |
||||
xmlns:xi="http://www.w3.org/2001/XInclude" |
||||
version="5.0" |
||||
xml:id="sec-release-unstable"> |
||||
|
||||
<title>Unstable revision</title> |
||||
|
||||
<para>In addition to numerous new and upgraded packages, this release has the following highlights: |
||||
|
||||
<!--<itemizedlist> |
||||
|
||||
</itemizedlist>--> |
||||
</para> |
||||
|
||||
<para>Following new services were added since the last release: |
||||
|
||||
<!--<itemizedlist> |
||||
|
||||
</itemizedlist>--> |
||||
</para> |
||||
|
||||
<para>When upgrading from a previous release, please be aware of the |
||||
following incompatible changes: |
||||
|
||||
<itemizedlist> |
||||
|
||||
<listitem><para>Steam now doesn't need root rights to work. Instead of using |
||||
<literal>*-steam-chrootenv</literal>, you should now just run <literal>steam</literal>. |
||||
<literal>steamChrootEnv</literal> package was renamed to <literal>steam</literal>, |
||||
and old <literal>steam</literal> package -- to <literal>steamOriginal</literal>. |
||||
</para></listitem> |
||||
|
||||
<listitem><para>CMPlayer has been renamed to bomi upstream. Package <literal>cmplayer</literal> |
||||
was accordingly renamed to <literal>bomi</literal> |
||||
</para></listitem> |
||||
|
||||
</itemizedlist> |
||||
</para> |
||||
|
||||
</chapter> |
@ -1,16 +0,0 @@ |
||||
This file should become a nix expression. (see modules/installer/tools/tools.nix) |
||||
|
||||
you need to: |
||||
- 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 -Ai nixpkgs_sys.firefox40Pkgs.xulrunner |
||||
|
||||
- make sure nixos-option in your path |
||||
|
||||
- have /etc/nixos/nixpkgs |
||||
- have /etc/nixos/nixos |
||||
|
||||
run it: |
||||
- xulrunner /etc/nixos/nixos/gui/application.ini -jsconsole |
@ -1,36 +0,0 @@ |
||||
[App] |
||||
; |
||||
; This field specifies your organization's name. This field is recommended, |
||||
; but optional. |
||||
Vendor=NixOS |
||||
; |
||||
; This field specifies your application's name. This field is required. |
||||
Name=NixOS-gui |
||||
; |
||||
; This field specifies your application's version. This field is optional. |
||||
Version=0.1 |
||||
; |
||||
; This field specifies your application's build ID (timestamp). This field is |
||||
; required. |
||||
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 |
||||
; irc.mozilla.org and /msg botbot uuid. This field is optional. |
||||
;ID= |
||||
|
||||
[Gecko] |
||||
; |
||||
; This field is required. It specifies the minimum Gecko version that this |
||||
; application requires. |
||||
MinVersion=1.9a5 |
||||
; |
||||
; This field is optional. It specifies the maximum Gecko version that this |
||||
; application requires. It should be specified if your application uses |
||||
; unfrozen interfaces. |
||||
MaxVersion=2.* |
@ -1 +0,0 @@ |
||||
manifest chrome/chrome.manifest |
@ -1 +0,0 @@ |
||||
content nixos-gui content/ |
@ -1,137 +0,0 @@ |
||||
|
||||
function inspect(obj, maxLevels, level) |
||||
{ |
||||
var str = '', type, msg; |
||||
|
||||
// Start Input Validations
|
||||
// Don't touch, we start iterating at level zero
|
||||
if(level == null) level = 0; |
||||
|
||||
// At least you want to show the first level
|
||||
if(maxLevels == null) maxLevels = 1; |
||||
if(maxLevels < 1) |
||||
return '<font color="red">Error: Levels number must be > 0</font>'; |
||||
|
||||
// We start with a non null object
|
||||
if(obj == null) |
||||
return '<font color="red">Error: Object <b>NULL</b></font>'; |
||||
// End Input Validations
|
||||
|
||||
// Each Iteration must be indented
|
||||
str += '<ul>'; |
||||
|
||||
// Start iterations for all objects in obj
|
||||
for(property in obj) |
||||
{ |
||||
try |
||||
{ |
||||
// Show "property" and "type property"
|
||||
type = typeof(obj[property]); |
||||
str += '<li>(' + type + ') ' + property + |
||||
( (obj[property]==null)?(': <b>null</b>'):('')) + '</li>'; |
||||
|
||||
// We keep iterating if this property is an Object, non null
|
||||
// and we are inside the required number of levels
|
||||
if((type == 'object') && (obj[property] != null) && (level+1 < maxLevels)) |
||||
str += inspect(obj[property], maxLevels, level+1); |
||||
} |
||||
catch(err) |
||||
{ |
||||
// Is there some properties in obj we can't access? Print it red.
|
||||
if(typeof(err) == 'string') msg = err; |
||||
else if(err.message) msg = err.message; |
||||
else if(err.description) msg = err.description; |
||||
else msg = 'Unknown'; |
||||
|
||||
str += '<li><font color="red">(Error) ' + property + ': ' + msg +'</font></li>'; |
||||
} |
||||
} |
||||
|
||||
// Close indent
|
||||
str += '</ul>'; |
||||
|
||||
return str; |
||||
} |
||||
|
||||
// Run xulrunner application.ini -jsconsole -console, to see messages.
|
||||
function log(str) |
||||
{ |
||||
Components.classes['@mozilla.org/consoleservice;1'] |
||||
.getService(Components.interfaces.nsIConsoleService) |
||||
.logStringMessage(str); |
||||
} |
||||
|
||||
function makeTempFile(prefix) |
||||
{ |
||||
var file = Components.classes["@mozilla.org/file/directory_service;1"] |
||||
.getService(Components.interfaces.nsIProperties) |
||||
.get("TmpD", Components.interfaces.nsIFile); |
||||
file.append(prefix || "xulrunner"); |
||||
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0664); |
||||
return file; |
||||
} |
||||
|
||||
function writeToFile(file, data) |
||||
{ |
||||
// file is nsIFile, data is a string
|
||||
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"] |
||||
.createInstance(Components.interfaces.nsIFileOutputStream); |
||||
|
||||
// use 0x02 | 0x10 to open file for appending.
|
||||
foStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate
|
||||
foStream.write(data, data.length); |
||||
foStream.close(); |
||||
} |
||||
|
||||
function readFromFile(file) |
||||
{ |
||||
// |file| is nsIFile
|
||||
var data = ""; |
||||
var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"] |
||||
.createInstance(Components.interfaces.nsIFileInputStream); |
||||
var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"] |
||||
.createInstance(Components.interfaces.nsIScriptableInputStream); |
||||
fstream.init(file, -1, 0, 0); |
||||
sstream.init(fstream); |
||||
|
||||
var str = sstream.read(4096); |
||||
while (str.length > 0) { |
||||
data += str; |
||||
str = sstream.read(4096); |
||||
} |
||||
|
||||
sstream.close(); |
||||
fstream.close(); |
||||
|
||||
return data; |
||||
} |
||||
|
||||
function runProgram(commandLine) |
||||
{ |
||||
// create an nsILocalFile for the executable
|
||||
var file = Components.classes["@mozilla.org/file/local;1"] |
||||
.createInstance(Components.interfaces.nsILocalFile); |
||||
file.initWithPath("/bin/sh"); |
||||
|
||||
// create an nsIProcess
|
||||
var process = Components.classes["@mozilla.org/process/util;1"] |
||||
.createInstance(Components.interfaces.nsIProcess); |
||||
process.init(file); |
||||
|
||||
// Run the process.
|
||||
// If first param is true, calling thread will be blocked until
|
||||
// called process terminates.
|
||||
// Second and third params are used to pass command-line arguments
|
||||
// to the process.
|
||||
var args = ["-c", commandLine]; |
||||
process.run(true, args, args.length); |
||||
} |
||||
|
||||
// only for testing...
|
||||
function testIO() |
||||
{ |
||||
var f = makeTempFile(); |
||||
writeToFile(f, "essai\ntest"); |
||||
alert(readFromFile(f)); |
||||
runProgram("zenity --info"); |
||||
} |
@ -1,70 +0,0 @@ |
||||
// global variables.
|
||||
var gNixOS; |
||||
var gOptionView; |
||||
|
||||
/* |
||||
var gProgressBar; |
||||
function setProgress(current, max) |
||||
{ |
||||
if (gProgressBar) { |
||||
gProgressBar.value = 100 * current / max; |
||||
log("progress: " + gProgressBar.value + "%"); |
||||
} |
||||
else |
||||
log("unknow progress bar"); |
||||
} |
||||
*/ |
||||
|
||||
function updateTextbox(id, value) |
||||
{ |
||||
// setting the height cause an overflow which resize the textbox to its
|
||||
// content due to its onoverflow attribute.
|
||||
$(id).attr("value", value).attr("height", 1); |
||||
}; |
||||
|
||||
function updatePanel(options) |
||||
{ |
||||
log("updatePanel: " + options.length); |
||||
if (options.length == 0) |
||||
return; |
||||
// FIXME: ignore the rest of the selection for now.
|
||||
var o = options[0]; |
||||
$("#name").attr("label", o.path); |
||||
|
||||
if (o.typename != null) |
||||
$("#typename").attr("label", o.typename); |
||||
else |
||||
$("#typename").attr("label", ""); |
||||
|
||||
$("#desc").text(o.description); |
||||
|
||||
if (o.value != null) |
||||
updateTextbox("#val", o.value); |
||||
else |
||||
updateTextbox("#val", ""); |
||||
|
||||
if (o.defaultValue != null) |
||||
updateTextbox("#def", o.defaultValue); |
||||
else |
||||
updateTextbox("#def", ""); |
||||
|
||||
if (o.example != null) |
||||
updateTextbox("#exp", o.example); |
||||
else |
||||
updateTextbox("#exp", ""); |
||||
|
||||
updateTextbox("#decls", o.declarations.join("\n")); |
||||
updateTextbox("#defs", o.definitions.join("\n")); |
||||
} |
||||
|
||||
|
||||
function onload() |
||||
{ |
||||
var optionTree = document.getElementById("option-tree"); |
||||
// gProgressBar = document.getElementById("progress-bar");
|
||||
// setProgress(0, 1);
|
||||
|
||||
gNixOS = new NixOS(); |
||||
gOptionView = new OptionView(gNixOS.option, updatePanel); |
||||
optionTree.view = gOptionView; |
||||
} |
@ -1,63 +0,0 @@ |
||||
<?xml version="1.0"?> |
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> |
||||
|
||||
<!DOCTYPE window> |
||||
|
||||
<!-- To edit this file I recommend you to use: |
||||
http://xulfr.org/outils/xulediteur.xul |
||||
--> |
||||
|
||||
<window |
||||
id = "nixos-gui" |
||||
title = "NixOS gui" |
||||
width = "800" |
||||
height = "600" |
||||
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
||||
<script src="jquery-1.5.2.js"/> |
||||
<script src="io.js"/> |
||||
<script src="nixos.js"/> |
||||
<script src="optionView.js"/> |
||||
<script src="main.js"/> |
||||
<hbox flex="1"> |
||||
<vbox width="250"> |
||||
<tree flex="1" id="option-tree" persist="height" onselect="gOptionView.selectionChanged()"> |
||||
<treecols> |
||||
<treecol persist="hidden width" flex="9" id="opt-name" |
||||
label="Option" primary="true"/> |
||||
<!-- Uncomment the following column to see the number of option |
||||
printed below each options. --> |
||||
<!-- |
||||
<treecol persist="hidden width" flex="1" id="dbg-size" |
||||
label="sz"/> |
||||
--> |
||||
</treecols> |
||||
<treechildren id="first-child" flex="1"/> |
||||
</tree> |
||||
</vbox> |
||||
<vbox flex="3" style="overflow: auto"> |
||||
<caption id="name" label=""/> |
||||
<caption id="typename" label=""/> |
||||
<separator/> |
||||
<description id="desc" hidden="false"></description> |
||||
<separator/> |
||||
<caption label="Value:"/> |
||||
<textbox id="val" readonly="true" multiline="true" value="" |
||||
class="plain" hidden="false" onoverflow="this.height = |
||||
this.inputField.scrollHeight;" /> |
||||
<separator/> |
||||
<caption label="Default:"/> |
||||
<textbox id="def" readonly="true" multiline="true" value="" class="plain" hidden="false" onoverflow="this.height = this.inputField.scrollHeight;" /> |
||||
<separator/> |
||||
<caption label="Example:"/> |
||||
<textbox id="exp" readonly="true" multiline="true" value="" class="plain" hidden="false" onoverflow="this.height = this.inputField.scrollHeight;" /> |
||||
<separator/> |
||||
<caption label="Declarations:"/> |
||||
<textbox id="decls" readonly="true" multiline="true" value="" class="plain" hidden="false" onoverflow="this.height = this.inputField.scrollHeight;" /> |
||||
<separator/> |
||||
<caption label="Definitions:"/> |
||||
<textbox id="defs" readonly="true" multiline="true" value="" |
||||
class="plain" hidden="false" onoverflow="this.height = this.inputField.scrollHeight;" /> |
||||
</vbox> |
||||
</hbox> |
||||
<!-- <progressmeter id="progress-bar" value="0%"/> --> |
||||
</window> |
@ -1,255 +0,0 @@ |
||||
|
||||
function NixOS () { |
||||
var env = Components.classes["@mozilla.org/process/environment;1"]. |
||||
getService(Components.interfaces.nsIEnvironment); |
||||
|
||||
if (env.exists("NIXOS")) |
||||
this.nixos = env.get("NIXOS"); |
||||
if (env.exists("NIXOS_CONFIG")) |
||||
this.config = env.get("NIXOS_CONFIG"); |
||||
if (env.exists("NIXPKGS")) |
||||
this.nixpkgs = env.get("NIXPKGS"); |
||||
if (env.exists("mountPoint")) |
||||
this.root = env.get("mountPoint"); |
||||
if (env.exists("NIXOS_OPTION")) |
||||
this.optionBin = env.get("NIXOS_OPTION"); |
||||
this.option = new Option("options", this, null); |
||||
}; |
||||
|
||||
NixOS.prototype = { |
||||
root: "", |
||||
nixos: "/etc/nixos/nixos", |
||||
nixpkgs: "/etc/nixos/nixpkgs", |
||||
config: "/etc/nixos/configuration.nix", |
||||
instantiateBin: "/run/current-system/sw/bin/nix-instantiate", |
||||
optionBin: "/run/current-system/sw/bin/nixos-option", |
||||
tmpFile: "nixos-gui", |
||||
option: null |
||||
}; |
||||
|
||||
function Option (name, context, parent) { |
||||
this.name = name; |
||||
this.context_ = context; |
||||
if (parent == null) |
||||
this.path = ""; |
||||
else if (parent.path == "") |
||||
this.path = name; |
||||
else |
||||
this.path = parent.path + "." + name; |
||||
}; |
||||
|
||||
Option.prototype = { |
||||
load: function () { |
||||
var env = ""; |
||||
env += "'NIXOS=" + this.context_.root + this.context_.nixos + "' "; |
||||
env += "'NIXOS_PKGS=" + this.context_.root + this.context_.nixpkgs + "' "; |
||||
env += "'NIXOS_CONFIG=" + this.context_.config + "' "; |
||||
var out = makeTempFile(this.context_.tmpFile); |
||||
var prog = this.context_.optionBin + " 2>&1 >" + out.path + " "; |
||||
var args = " --xml " + this.path; |
||||
|
||||
runProgram(/*env + */ prog + args); |
||||
var xml = readFromFile(out); |
||||
out.remove(false); |
||||
|
||||
// jQuery does a stack overflow when converting a huge XML to a DOM.
|
||||
var dom = DOMParser().parseFromString(xml, "text/xml"); |
||||
var xmlAttrs = $("expr > attrs > attr", dom); |
||||
|
||||
this.isOption = xmlAttrs.first().attr("name") == "_isOption"; |
||||
|
||||
if (!this.isOption) |
||||
this.loadSubOptions(xmlAttrs); |
||||
else |
||||
this.loadOption(xmlAttrs); |
||||
this.isLoaded = true; |
||||
}, |
||||
|
||||
loadSubOptions: function (xmlAttrs) { |
||||
var cur = this; |
||||
var attrs = new Array(); |
||||
|
||||
xmlAttrs.each( |
||||
function (index) { |
||||
var name = $(this).attr("name"); |
||||
var attr = new Option(name, cur.context_, cur); |
||||
attrs.push(attr); |
||||
} |
||||
); |
||||
|
||||
this.subOptions = attrs; |
||||
}, |
||||
|
||||
optionAttributeMap: { |
||||
_isOption: function (cur, v) { }, |
||||
value: function (cur, v) { cur.value = xml2nix($(v).children().first()); }, |
||||
default: function (cur, v) { cur.defaultValue = xml2nix($(v).children().first()); }, |
||||
example: function (cur, v) { cur.example = xml2nix($(v).children().first()); }, |
||||
description: function (cur, v) { cur.description = this.string(v); }, |
||||
typename: function (cur, v) { cur.typename = this.string(v); }, |
||||
options: function (cur, v) { cur.loadSubOptions($("attrs", v).children()); }, |
||||
declarations: function (cur, v) { cur.declarations = this.pathList(v); }, |
||||
definitions: function (cur, v) { cur.definitions = this.pathList(v); }, |
||||
|
||||
string: function (v) { |
||||
return $(v).children("string").first().attr("value"); |
||||
}, |
||||
|
||||
pathList: function (v) { |
||||
var list = []; |
||||
$(v).children("list").first().children().each( |
||||
function (idx) { |
||||
list.push($(this).attr("value")); |
||||
} |
||||
); |
||||
return list; |
||||
} |
||||
}, |
||||
|
||||
|
||||
loadOption: function (attrs) { |
||||
var cur = this; |
||||
|
||||
attrs.each( |
||||
function (index) { |
||||
var name = $(this).attr("name"); |
||||
log("loadOption: " + name); |
||||
cur.optionAttributeMap[name](cur, this); |
||||
} |
||||
); |
||||
}, |
||||
|
||||
// keep the context under which this option has been used.
|
||||
context_: null, |
||||
// name of the option.
|
||||
name: "", |
||||
// result of nixos-option.
|
||||
value: null, |
||||
typename: null, |
||||
defaultValue: null, |
||||
example: null, |
||||
description: "", |
||||
declarations: [], |
||||
definitions: [], |
||||
// path to reach this option
|
||||
path: "", |
||||
|
||||
// list of options accessible from here.
|
||||
isLoaded: false, |
||||
isOption: false, |
||||
subOptions: [] |
||||
}; |
||||
|
||||
var xml2nix_pptable = { |
||||
attrs: function (node, depth, pp) { |
||||
var children = node.children().not( |
||||
function () { |
||||
var name = $(this).attr("name"); |
||||
return name.charAt(0) == "_"; |
||||
} |
||||
); |
||||
var c = 0; |
||||
var out = ""; |
||||
out += "{"; |
||||
depth += 1; |
||||
children.each( |
||||
function (idx) { |
||||
c += 1; |
||||
out += pp.indent(depth); |
||||
out += pp.dispatch($(this), depth, pp); |
||||
} |
||||
); |
||||
depth -= 1; |
||||
if (c > 0) |
||||
out += this.indent(depth); |
||||
else |
||||
out += " "; |
||||
out += "}"; |
||||
return out; |
||||
}, |
||||
list: function (node, depth, pp) { |
||||
var children = node.children(); |
||||
var c = 0; |
||||
var out = ""; |
||||
out += "["; |
||||
depth += 1; |
||||
children.each( |
||||
function (idx) { |
||||
c += 1; |
||||
out += pp.indent(depth); |
||||
out += pp.dispatch($(this), depth, pp); |
||||
} |
||||
); |
||||
depth -= 1; |
||||
if (c > 0) |
||||
out += this.indent(depth); |
||||
else |
||||
out += " "; |
||||
out += "]"; |
||||
return out; |
||||
}, |
||||
attr: function (node, depth, pp) { |
||||
var name = node.attr("name"); |
||||
var out = ""; |
||||
var val = ""; |
||||
out += name + " = "; |
||||
depth += 1; |
||||
val = pp.dispatch(node.children().first(), depth, pp); |
||||
out += val; |
||||
depth -= 1; |
||||
out += ";"; |
||||
return out; |
||||
}, |
||||
string: function (node, depth, pp) { |
||||
return "\"" + node.attr("value") + "\""; |
||||
}, |
||||
path: function (node, depth, pp) { |
||||
return node.attr("value"); |
||||
}, |
||||
bool: function (node, depth, pp) { |
||||
return node.attr("value"); |
||||
}, |
||||
"int": function (node, depth, pp) { |
||||
return node.attr("value"); |
||||
}, |
||||
null: function (node, depth, pp) { |
||||
return "null"; |
||||
}, |
||||
derivation: function (node, depth, pp) { |
||||
return "<derivation>"; |
||||
}, |
||||
function: function (node, depth, pp) { |
||||
return "<function>"; |
||||
}, |
||||
unevaluated: function (node, depth, pp) { |
||||
return "<unevaluated>"; |
||||
}, |
||||
|
||||
dispatch: function (node, depth, pp) { |
||||
for (var key in pp) |
||||
{ |
||||
if(node.is(key)) |
||||
{ |
||||
// log(this.indent(depth) + "dispatch: " + key);
|
||||
var out = pp[key](node, depth, pp); |
||||
// log(this.indent(depth) + "dispatch: => " + out);
|
||||
return out; |
||||
} |
||||
} |
||||
return "<dispatch-error>"; |
||||
}, |
||||
indent: function (depth) { |
||||
var ret = "\n"; |
||||
while (depth--) |
||||
ret += " "; |
||||
return ret; |
||||
} |
||||
}; |
||||
|
||||
function xml2nix(node) { |
||||
var depth = 0; |
||||
var pp = xml2nix_pptable; |
||||
var out = pp.dispatch(node, depth, pp); |
||||
// log("pretty:\n" + out);
|
||||
return out; |
||||
} |
@ -1,242 +0,0 @@ |
||||
// extend NixOS options to handle the Tree View. Should be better to keep a
|
||||
// separation of concern here.
|
||||
|
||||
Option.prototype.tv_opened = false; |
||||
Option.prototype.tv_size = 1; |
||||
|
||||
Option.prototype.tv_open = function () { |
||||
this.tv_opened = true; |
||||
this.tv_size = 1; |
||||
|
||||
// load an option if it is not loaded yet, and initialize them to be
|
||||
// read by the Option view.
|
||||
if (!this.isLoaded) |
||||
this.load(); |
||||
|
||||
// If this is not an option, then add it's lits of sub-options size.
|
||||
if (!this.isOption) |
||||
{ |
||||
for (var i = 0; i < this.subOptions.length; i++) |
||||
this.tv_size += this.subOptions[i].tv_size; |
||||
} |
||||
}; |
||||
|
||||
Option.prototype.tv_close = function () { |
||||
this.tv_opened = false; |
||||
this.tv_size = 1; |
||||
}; |
||||
|
||||
|
||||
|
||||
|
||||
function OptionView (root, selCallback) { |
||||
root.tv_open(); |
||||
this.rootOption = root; |
||||
this.selCallback = selCallback; |
||||
} |
||||
|
||||
OptionView.prototype = { |
||||
rootOption: null, |
||||
selCallback: null, |
||||
|
||||
// This function returns the path to option which is at the specified row.
|
||||
reach_cache: null, |
||||
reachRow: function (row) { |
||||
var o = this.rootOption; // Current option.
|
||||
var r = 0; // Number of rows traversed.
|
||||
var c = 0; // Child index.
|
||||
var path = [{ row: r, opt: o }]; // new Array();
|
||||
// hypothesis: this.rootOption.tv_size is always open and bigger than
|
||||
|
||||
// Use the previous returned value to avoid making to many checks and to
|
||||
// optimize for frequent access of near rows.
|
||||
if (this.reach_cache != null) |
||||
{ |
||||
for (var i = this.reach_cache.length - 2; i >= 0; i--) { |
||||
var p = this.reach_cache[i]; |
||||
// If we will have to go the same path.
|
||||
if (row >= p.row && row < p.row + p.opt.tv_size) |
||||
{ |
||||
path.unshift(p); |
||||
r = path[0].row; |
||||
o = path[0].opt; |
||||
} |
||||
else |
||||
break; |
||||
}; |
||||
} |
||||
|
||||
while (r != row) |
||||
{ |
||||
// Go deeper in the child which contains the requested row. The
|
||||
// tv_size contains the size of the tree starting from each option.
|
||||
c = 0; |
||||
while (c < o.subOptions.length && r + o.subOptions[c].tv_size < row) |
||||
{ |
||||
r += o.subOptions[c].tv_size; |
||||
c += 1; |
||||
} |
||||
if (c < o.subOptions.length && r + o.subOptions[c].tv_size >= row) |
||||
{ |
||||
// Count the current option as a row.
|
||||
o = o.subOptions[c]; |
||||
r += 1; |
||||
} |
||||
else |
||||
alert("WTF: " + o.name + " ask: " + row + " children: " + o.subOptions + " c: " + c); |
||||
path.unshift({ row: r, opt: o }); |
||||
} |
||||
|
||||
this.reach_cache = path; |
||||
return path; |
||||
}, |
||||
|
||||
// needs to return true if there is a /row/ at the same level /after/ a
|
||||
// given row.
|
||||
hasNextSibling: function(row, after) { |
||||
log("sibling " + row + " after " + after); |
||||
var path = reachRow(row); |
||||
if (path.length > 1) |
||||
{ |
||||
var last = path[1].row + path[1].opt.tv_size; |
||||
// Has a next sibling if the row is not over the size of the
|
||||
// parent and if the current one is not the last child.
|
||||
return after + 1 < last && path[0].row + path[0].opt.tv_size < last; |
||||
} |
||||
else |
||||
// The top-level option has no sibling.
|
||||
return false; |
||||
}, |
||||
|
||||
// Does the current row contain any sub-options?
|
||||
isContainer: function(row) { |
||||
return !this.reachRow(row)[0].opt.isOption; |
||||
}, |
||||
isContainerEmpty: function(row) { |
||||
return this.reachRow(row)[0].opt.subOptions.length == 0; |
||||
}, |
||||
isContainerOpen: function(row) { |
||||
return this.reachRow(row)[0].opt.tv_opened; |
||||
}, |
||||
|
||||
// Open or close an option.
|
||||
toggleOpenState: function (row) { |
||||
var path = this.reachRow(row); |
||||
var delta = -path[0].opt.tv_size; |
||||
if (path[0].opt.tv_opened) |
||||
path[0].opt.tv_close(); |
||||
else |
||||
path[0].opt.tv_open(); |
||||
delta += path[0].opt.tv_size; |
||||
|
||||
// Parents are alreay opened, but we need to update the tv_size
|
||||
// counters. Thus we have to invalidate the reach cache.
|
||||
this.reach_cache = null; |
||||
for (var i = 1; i < path.length; i++) |
||||
path[i].opt.tv_open(); |
||||
|
||||
this.tree.rowCountChanged(row + 1, delta); |
||||
}, |
||||
|
||||
// Return the identation level of the option at the line /row/. The
|
||||
// top-level level is 0.
|
||||
getLevel: function(row) { |
||||
return this.reachRow(row).length - 1; |
||||
}, |
||||
|
||||
// Obtain the index of a parent row. If there is no parent row,
|
||||
// returns -1.
|
||||
getParentIndex: function(row) { |
||||
var path = this.reachRow(row); |
||||
if (path.length > 1) |
||||
return path[1].row; |
||||
else |
||||
return -1; |
||||
}, |
||||
|
||||
|
||||
// Return the content of each row base on the column name.
|
||||
getCellText: function(row, column) { |
||||
if (column.id == "opt-name") |
||||
return this.reachRow(row)[0].opt.name; |
||||
if (column.id == "dbg-size") |
||||
return this.reachRow(row)[0].opt.tv_size; |
||||
return ""; |
||||
}, |
||||
|
||||
// We have no column with images.
|
||||
getCellValue: function(row, column) { }, |
||||
|
||||
|
||||
isSelectable: function(row, column) { return true; }, |
||||
|
||||
// Get the selection out of the tree and give options to the call back
|
||||
// function.
|
||||
selectionChanged: function() { |
||||
if (this.selCallback == null) |
||||
return; |
||||
var opts = []; |
||||
var start = new Object(); |
||||
var end = new Object(); |
||||
var numRanges = this.tree.view.selection.getRangeCount(); |
||||
|
||||
for (var t = 0; t < numRanges; t++) { |
||||
this.tree.view.selection.getRangeAt(t,start,end); |
||||
for (var v = start.value; v <= end.value; v++) { |
||||
var opt = this.reachRow(v)[0].opt; |
||||
if (!opt.isLoaded) |
||||
opt.load(); |
||||
if (opt.isOption) |
||||
opts.push(opt); |
||||
|
||||
// FIXME: no need to make things slowing down, because our current
|
||||
// callback do not handle multiple option display.
|
||||
if (!opts.empty) |
||||
break; |
||||
} |
||||
// FIXME: no need to make things slowing down, because our current
|
||||
// callback do not handle multiple option display.
|
||||
if (!opts.empty) |
||||
break; |
||||
} |
||||
|
||||
if (!opts.empty) |
||||
this.selCallback(opts); |
||||
}, |
||||
|
||||
set rowCount(c) { throw "rowCount is a readonly property"; }, |
||||
get rowCount() { return this.rootOption.tv_size; }, |
||||
|
||||
// refuse drag-n-drop of options.
|
||||
canDrop: function (index, orientation, dataTransfer) { return false; }, |
||||
drop: function (index, orientation, dataTransfer) { }, |
||||
|
||||
// ?
|
||||
getCellProperties: function(row, column, prop) { }, |
||||
getColumnProperties: function(column, prop) { }, |
||||
getRowProperties: function(row, prop) { }, |
||||
getImageSrc: function(row, column) { }, |
||||
|
||||
// No progress columns are used.
|
||||
getProgressMode: function(row, column) { }, |
||||
|
||||
// Do not add options yet.
|
||||
isEditable: function(row, column) { return false; }, |
||||
setCellValue: function(row, column, value) { }, |
||||
setCellText: function(row, column, value) { }, |
||||
|
||||
// ...
|
||||
isSeparator: function(index) { return false; }, |
||||
isSorted: function() { return false; }, |
||||
performAction: function(action) { }, |
||||
performActionOnCell: function(action, row, column) { }, |
||||
performActionOnRow: function(action, row) { }, // ??
|
||||
|
||||
// ??
|
||||
cycleCell: function (row, col) { }, |
||||
cycleHeader: function(col) { }, |
||||
|
||||
selection: null, |
||||
tree: null, |
||||
setTree: function(tree) { this.tree = tree; } |
||||
}; |
@ -1,154 +0,0 @@ |
||||
const nsIAppShellService = Components.interfaces.nsIAppShellService; |
||||
const nsISupports = Components.interfaces.nsISupports; |
||||
const nsICategoryManager = Components.interfaces.nsICategoryManager; |
||||
const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar; |
||||
const nsICommandLine = Components.interfaces.nsICommandLine; |
||||
const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler; |
||||
const nsIFactory = Components.interfaces.nsIFactory; |
||||
const nsIModule = Components.interfaces.nsIModule; |
||||
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher; |
||||
|
||||
// CHANGEME: to the chrome URI of your extension or application
|
||||
const CHROME_URI = "chrome://nixos-gui/content/myviewer.xul"; |
||||
|
||||
// CHANGEME: change the contract id, CID, and category to be unique
|
||||
// to your application.
|
||||
const clh_contractID = "@mozilla.org/commandlinehandler/general-startup;1?type=myapp"; |
||||
|
||||
// use uuidgen to generate a unique ID
|
||||
const clh_CID = Components.ID("{2991c315-b871-42cd-b33f-bfee4fcbf682}"); |
||||
|
||||
// category names are sorted alphabetically. Typical command-line handlers use a
|
||||
// category that begins with the letter "m".
|
||||
const clh_category = "m-myapp"; |
||||
|
||||
/** |
||||
* Utility functions |
||||
*/ |
||||
|
||||
/** |
||||
* Opens a chrome window. |
||||
* @param aChromeURISpec a string specifying the URI of the window to open. |
||||
* @param aArgument an argument to pass to the window (may be null) |
||||
*/ |
||||
function openWindow(aChromeURISpec, aArgument) |
||||
{ |
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]. |
||||
getService(Components.interfaces.nsIWindowWatcher); |
||||
ww.openWindow(null, aChromeURISpec, "_blank", |
||||
"chrome,menubar,toolbar,status,resizable,dialog=no", |
||||
aArgument); |
||||
} |
||||
|
||||
/** |
||||
* The XPCOM component that implements nsICommandLineHandler. |
||||
* It also implements nsIFactory to serve as its own singleton factory. |
||||
*/ |
||||
const myAppHandler = { |
||||
/* nsISupports */ |
||||
QueryInterface : function clh_QI(iid) |
||||
{ |
||||
if (iid.equals(nsICommandLineHandler) || |
||||
iid.equals(nsIFactory) || |
||||
iid.equals(nsISupports)) |
||||
return this; |
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE; |
||||
}, |
||||
|
||||
/* nsICommandLineHandler */ |
||||
|
||||
handle : function clh_handle(cmdLine) |
||||
{ |
||||
openWindow(CHROME_URI, cmdLine); |
||||
cmdLine.preventDefault = true; |
||||
}, |
||||
|
||||
// CHANGEME: change the help info as appropriate, but
|
||||
// follow the guidelines in nsICommandLineHandler.idl
|
||||
// specifically, flag descriptions should start at
|
||||
// character 24, and lines should be wrapped at
|
||||
// 72 characters with embedded newlines,
|
||||
// and finally, the string should end with a newline
|
||||
helpInfo : " <filename> Open the file in the viewer\n", |
||||
|
||||
/* nsIFactory */ |
||||
|
||||
createInstance : function clh_CI(outer, iid) |
||||
{ |
||||
if (outer != null) |
||||
throw Components.results.NS_ERROR_NO_AGGREGATION; |
||||
|
||||
return this.QueryInterface(iid); |
||||
}, |
||||
|
||||
lockFactory : function clh_lock(lock) |
||||
{ |
||||
/* no-op */ |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* The XPCOM glue that implements nsIModule |
||||
*/ |
||||
const myAppHandlerModule = { |
||||
/* nsISupports */ |
||||
QueryInterface : function mod_QI(iid) |
||||
{ |
||||
if (iid.equals(nsIModule) || |
||||
iid.equals(nsISupports)) |
||||
return this; |
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE; |
||||
}, |
||||
|
||||
/* nsIModule */ |
||||
getClassObject : function mod_gch(compMgr, cid, iid) |
||||
{ |
||||
if (cid.equals(clh_CID)) |
||||
return myAppHandler.QueryInterface(iid); |
||||
|
||||
throw Components.results.NS_ERROR_NOT_REGISTERED; |
||||
}, |
||||
|
||||
registerSelf : function mod_regself(compMgr, fileSpec, location, type) |
||||
{ |
||||
compMgr.QueryInterface(nsIComponentRegistrar); |
||||
|
||||
compMgr.registerFactoryLocation(clh_CID, |
||||
"myAppHandler", |
||||
clh_contractID, |
||||
fileSpec, |
||||
location, |
||||
type); |
||||
|
||||
var catMan = Components.classes["@mozilla.org/categorymanager;1"]. |
||||
getService(nsICategoryManager); |
||||
catMan.addCategoryEntry("command-line-handler", |
||||
clh_category, |
||||
clh_contractID, true, true); |
||||
}, |
||||
|
||||
unregisterSelf : function mod_unreg(compMgr, location, type) |
||||
{ |
||||
compMgr.QueryInterface(nsIComponentRegistrar); |
||||
compMgr.unregisterFactoryLocation(clh_CID, location); |
||||
|
||||
var catMan = Components.classes["@mozilla.org/categorymanager;1"]. |
||||
getService(nsICategoryManager); |
||||
catMan.deleteCategoryEntry("command-line-handler", clh_category); |
||||
}, |
||||
|
||||
canUnload : function (compMgr) |
||||
{ |
||||
return true; |
||||
} |
||||
}; |
||||
|
||||
/* The NSGetModule function is the magic entry point that XPCOM uses to find what XPCOM objects |
||||
* this component provides |
||||
*/ |
||||
function NSGetModule(comMgr, fileSpec) |
||||
{ |
||||
return myAppHandlerModule; |
||||
} |
@ -1,11 +0,0 @@ |
||||
pref("toolkit.defaultChromeURI", "chrome://nixos-gui/content/myviewer.xul"); |
||||
pref("general.useragent.extra.myviewer", "NixOS gui/0.0"); |
||||
|
||||
/* debugging prefs */ |
||||
pref("browser.dom.window.dump.enabled", true); // enable output to stderr
|
||||
pref("javascript.options.showInConsole", true); // show javascript errors from chrome: files in the jsconsole
|
||||
pref("javascript.options.strict", true); // show javascript strict warnings in the jsconsole
|
||||
|
||||
/* disable xul cache so that modifications to chrome: files apply without restarting xulrunner */ |
||||
pref("nglayout.debug.disable_xul_cache", true);
|
||||
pref("nglayout.debug.disable_xul_fastload", true); |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue