Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dezgeg committed Dec 26, 2017
2 parents 696f3e7 + 4271a21 commit 47c782f
Show file tree
Hide file tree
Showing 122 changed files with 2,822 additions and 1,416 deletions.
4 changes: 2 additions & 2 deletions doc/languages-frameworks/haskell.md
Expand Up @@ -581,8 +581,8 @@ nix-shell "<nixpkgs>" -A haskellPackages.bar.env
Every Haskell package set takes a function called `overrides` that you can use
to manipulate the package as much as you please. One useful application of this
feature is to replace the default `mkDerivation` function with one that enables
library profiling for all packages. To accomplish that, add configure the
following snippet in your `~/.config/nixpkgs/config.nix` file:
library profiling for all packages. To accomplish that add the following
snippet to your `~/.config/nixpkgs/config.nix` file:
```nix
{
packageOverrides = super: let self = super.pkgs; in
Expand Down
4 changes: 2 additions & 2 deletions doc/shell.md
@@ -1,10 +1,10 @@
---
title: stdenv.mkShell
title: pkgs.mkShell
author: zimbatm
date: 2017-10-30
---

stdenv.mkShell is a special kind of derivation that is only useful when using
pkgs.mkShell is a special kind of derivation that is only useful when using
it combined with nix-shell. It will in fact fail to instantiate when invoked
with nix-build.

Expand Down
2 changes: 2 additions & 0 deletions nixos/modules/module-list.nix
Expand Up @@ -71,6 +71,7 @@
./programs/bcc.nix
./programs/blcr.nix
./programs/browserpass.nix
./programs/ccache.nix
./programs/cdemu.nix
./programs/chromium.nix
./programs/command-not-found/command-not-found.nix
Expand All @@ -91,6 +92,7 @@
./programs/npm.nix
./programs/oblogout.nix
./programs/qt5ct.nix
./programs/rootston.nix
./programs/screen.nix
./programs/slock.nix
./programs/shadow.nix
Expand Down
83 changes: 83 additions & 0 deletions nixos/modules/programs/ccache.nix
@@ -0,0 +1,83 @@
{ config, pkgs, lib, ... }:

with lib;
let
cfg = config.programs.ccache;
in {
options.programs.ccache = {
# host configuration
enable = mkEnableOption "CCache";
cacheDir = mkOption {
type = types.path;
description = "CCache directory";
default = "/var/cache/ccache";
};
# target configuration
packageNames = mkOption {
type = types.listOf types.str;
description = "Nix top-level packages to be compiled using CCache";
default = [];
example = [ "wxGTK30" "qt48" "ffmpeg_3_3" "libav_all" ];
};
};

config = mkMerge [
# host configuration
(mkIf cfg.enable {
systemd.tmpfiles.rules = [ "d ${cfg.cacheDir} 0770 root nixbld -" ];

# "nix-ccache --show-stats" and "nix-ccache --clear"
security.wrappers.nix-ccache = {
group = "nixbld";
setgid = true;
source = pkgs.writeScript "nix-ccache.pl" ''
#!${pkgs.perl}/bin/perl
%ENV=( CCACHE_DIR => '${cfg.cacheDir}' );
sub untaint {
my $v = shift;
return '-C' if $v eq '-C' || $v eq '--clear';
return '-V' if $v eq '-V' || $v eq '--version';
return '-s' if $v eq '-s' || $v eq '--show-stats';
return '-z' if $v eq '-z' || $v eq '--zero-stats';
exec('${pkgs.ccache}/bin/ccache', '-h');
}
exec('${pkgs.ccache}/bin/ccache', map { untaint $_ } @ARGV);
'';
};
})

# target configuration
(mkIf (cfg.packageNames != []) {
nixpkgs.overlays = [
(self: super: genAttrs cfg.packageNames (pn: super.${pn}.override { stdenv = builtins.trace "with ccache: ${pn}" self.ccacheStdenv; }))

(self: super: {
ccacheWrapper = super.ccacheWrapper.override {
extraConfig = ''
export CCACHE_COMPRESS=1
export CCACHE_DIR="${cfg.cacheDir}"
export CCACHE_UMASK=007
if [ ! -d "$CCACHE_DIR" ]; then
echo "====="
echo "Directory '$CCACHE_DIR' does not exist"
echo "Please create it with:"
echo " sudo mkdir -m0770 '$CCACHE_DIR'"
echo " sudo chown root:nixbld '$CCACHE_DIR'"
echo "====="
exit 1
fi
if [ ! -w "$CCACHE_DIR" ]; then
echo "====="
echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)"
echo "Please verify its access permissions"
echo "====="
exit 1
fi
'';
};
})
];
})
];
}
88 changes: 88 additions & 0 deletions nixos/modules/programs/rootston.nix
@@ -0,0 +1,88 @@
{ config, pkgs, lib, ... }:

with lib;

let
cfg = config.programs.rootston;

rootstonWrapped = pkgs.writeScriptBin "rootston" ''
#! ${pkgs.stdenv.shell}
if [[ "$#" -ge 1 ]]; then
exec ${pkgs.rootston}/bin/rootston "$@"
else
exec ${pkgs.rootston}/bin/rootston -C ${cfg.configFile}
fi
'';
in {
options.programs.rootston = {
enable = mkEnableOption ''
rootston, the reference compositor for wlroots. The purpose of rootston
is to test and demonstrate the features of wlroots (if you want a real
Wayland compositor you should e.g. use Sway instead). You can manually
start the compositor by running "rootston" from a terminal'';

extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
xwayland rxvt_unicode dmenu
];
defaultText = literalExample ''
with pkgs; [
xwayland dmenu rxvt_unicode
]
'';
example = literalExample "[ ]";
description = ''
Extra packages to be installed system wide.
'';
};

config = mkOption {
type = types.str;
default = ''
[keyboard]
meta-key = Logo
# Sway/i3 like Keybindings
# Maps key combinations with commands to execute
# Commands include:
# - "exit" to stop the compositor
# - "exec" to execute a shell command
# - "close" to close the current view
# - "next_window" to cycle through windows
[bindings]
Logo+Shift+e = exit
Logo+q = close
Logo+m = maximize
Alt+Tab = next_window
Logo+Return = exec urxvt
# Note: Dmenu will only work properly while e.g. urxvt is running.
Logo+d = exec dmenu_run
'';
description = ''
Default configuration for rootston (used when called without any
parameters).
'';
};

configFile = mkOption {
type = types.path;
default = "/etc/rootston.ini";
example = literalExample "${pkgs.rootston}/etc/rootston.ini";
description = ''
Path to the default rootston configuration file (the "config" option
will have no effect if you change the path).
'';
};
};

config = mkIf cfg.enable {
environment.etc."rootston.ini".text = cfg.config;
environment.systemPackages = [ rootstonWrapped ] ++ cfg.extraPackages;

hardware.opengl.enable = mkDefault true;
fonts.enableDefaultFonts = mkDefault true;
};

meta.maintainers = with lib.maintainers; [ primeos ];
}
50 changes: 31 additions & 19 deletions nixos/modules/programs/sway.nix
Expand Up @@ -4,35 +4,42 @@ with lib;

let
cfg = config.programs.sway;
sway = pkgs.sway;
swayPackage = pkgs.sway;

swayWrapped = pkgs.writeShellScriptBin "sway" ''
if [ "$1" != "" ]; then
sway-setcap "$@"
exit
if [[ "$#" -ge 1 ]]; then
exec sway-setcap "$@"
else
${cfg.extraSessionCommands}
exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap
fi
${cfg.extraSessionCommands}
exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap
'';
swayJoined = pkgs.symlinkJoin {
name = "sway-wrapped";
paths = [ swayWrapped sway ];
name = "sway-joined";
paths = [ swayWrapped swayPackage ];
};
in
{
in {
options.programs.sway = {
enable = mkEnableOption "sway";
enable = mkEnableOption ''
the tiling Wayland compositor Sway. After adding yourself to the "sway"
group you can manually launch Sway by executing "sway" from a terminal.
If you call "sway" with any parameters the extraSessionCommands won't be
executed and Sway won't be launched with dbus-launch'';

extraSessionCommands = mkOption {
default = "";
type = types.lines;
type = types.lines;
default = "";
example = ''
export XKB_DEFAULT_LAYOUT=us,de
export XKB_DEFAULT_VARIANT=,nodeadkeys
export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,
# Define a keymap (US QWERTY is the default)
export XKB_DEFAULT_LAYOUT=de,us
export XKB_DEFAULT_VARIANT=nodeadkeys
export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,caps:escape
# Change the Keyboard repeat delay and rate
export WLC_REPEAT_DELAY=660
export WLC_REPEAT_RATE=25
'';
description = ''
Shell commands executed just before sway is started.
Shell commands executed just before Sway is started.
'';
};

Expand All @@ -41,9 +48,12 @@ in
default = with pkgs; [
i3status xwayland rxvt_unicode dmenu
];
defaultText = literalExample ''
with pkgs; [ i3status xwayland rxvt_unicode dmenu ];
'';
example = literalExample ''
with pkgs; [
i3status xwayland rxvt_unicode dmenu
i3lock light termite
]
'';
description = ''
Expand All @@ -56,7 +66,7 @@ in
environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages;
security.wrappers.sway = {
program = "sway-setcap";
source = "${sway}/bin/sway";
source = "${swayPackage}/bin/sway";
capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip";
owner = "root";
group = "sway";
Expand All @@ -70,4 +80,6 @@ in
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
};

meta.maintainers = with lib.maintainers; [ gnidorah primeos ];
}
2 changes: 1 addition & 1 deletion nixos/modules/services/hardware/thinkfan.nix
Expand Up @@ -55,7 +55,7 @@ in {
enable = mkOption {
default = false;
description = ''
Whether to enable thinkfan, fan controller for ibm/lenovo thinkpads.
Whether to enable thinkfan, fan controller for IBM/Lenovo ThinkPads.
'';
};

Expand Down
7 changes: 0 additions & 7 deletions nixos/modules/services/misc/gitlab.nix
Expand Up @@ -248,7 +248,6 @@ in {

databasePassword = mkOption {
type = types.str;
default = "";
description = "Gitlab database user password.";
};

Expand Down Expand Up @@ -440,12 +439,6 @@ in {

environment.systemPackages = [ pkgs.git gitlab-rake cfg.packages.gitlab-shell ];

assertions = [
{ assertion = cfg.databasePassword != "";
message = "databasePassword must be set";
}
];

# Redis is required for the sidekiq queue runner.
services.redis.enable = mkDefault true;
# We use postgres as the main data store.
Expand Down
5 changes: 1 addition & 4 deletions nixos/modules/services/networking/ssh/sshd.nix
Expand Up @@ -248,13 +248,10 @@ in
let
service =
{ description = "SSH Daemon";

wantedBy = optional (!cfg.startWhenNeeded) "multi-user.target";

after = [ "network.target" ];
stopIfChanged = false;

path = [ cfgc.package pkgs.gawk ];

environment.LD_LIBRARY_PATH = nssModulesPath;

preStart =
Expand Down
Expand Up @@ -47,7 +47,7 @@ in
export GTK_DATA_PREFIX=${config.system.path}
# find theme engines
export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
export XDG_MENU_PREFIX=enlightenment
export XDG_MENU_PREFIX=e-
export GST_PLUGIN_PATH="${GST_PLUGIN_PATH}"
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/gnome3.nix
Expand Up @@ -136,7 +136,7 @@ in {
# find theme engines
export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
export XDG_MENU_PREFIX=gnome
export XDG_MENU_PREFIX=gnome-
${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/mate.nix
Expand Up @@ -47,7 +47,7 @@ in
# Find theme engines
export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
export XDG_MENU_PREFIX=mate
export XDG_MENU_PREFIX=mate-
# Find the mouse
export XCURSOR_PATH=~/.icons:${config.system.path}/share/icons
Expand Down
3 changes: 0 additions & 3 deletions nixos/tests/virtualbox.nix
Expand Up @@ -109,9 +109,6 @@ let
} ''
${pkgs.parted}/sbin/parted --script /dev/vda mklabel msdos
${pkgs.parted}/sbin/parted --script /dev/vda -- mkpart primary ext2 1M -1s
. /sys/class/block/vda1/uevent
mknod /dev/vda1 b $MAJOR $MINOR
${pkgs.e2fsprogs}/sbin/mkfs.ext4 /dev/vda1
${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
mkdir /mnt
Expand Down

0 comments on commit 47c782f

Please sign in to comment.