Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions pkgs/top-level/options.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{lib, hostPlatform}:

with lib;

# Define some user flags. Each one will be passed as an argument to
# callPackage and can be used directly by packages to configure
# themselves. Note that none of these should be mutually exclusive.
# For instance enabling X11 should not imply that Wayland is disabled.

{

lang = mkOption {
default = "en";
type = types.string;
description = ''

The target language to compile packages with support for.

'';
};

withX11 = mkOption {
default = hostPlatform.isLinux; # also BSDs?
type = types.bool;
description = ''

Whether to compile packages with support for the X Window System.

'';
};

withWayland = mkOption {
default = hostPlatform.isLinux; # also BSDs?
type = types.bool;
description = ''

Whether to compile packages with support for the Wayland window system.

'';
};

withAlsa = mkOption {
default = hostPlatform.isLinux;
type = types.bool;
description = ''

Whether to compile packages with support for the ALSA sound system.

'';
};

withPulseAudio = mkOption {
default = hostPlatform.isLinux;
type = types.bool;
description = ''

Whether to compile packages with support for the PulseAudio sound system.

'';
};

withJack = mkOption {
default = false;
type = types.bool;
description = ''

Whether to compile packages with support for the JACK sound system

'';
};

withQt = mkOption {
default = true;
type = types.bool;
description = ''

Whether to compile packages with support for the Qt graphical toolkit

'';
};

withGtk = mkOption {
default = false;
type = types.bool;
description = ''

Whether to compile packages with support for the GTK graphical toolkit

'';
};

withApple = mkOption {
default = hostPlatform.isDarwin;
type = types.bool;
description = ''

Whether to compile packages with Apple's proprietary frameworks.

Note that this only supports macOS currently.

'';
};

withSystemd = mkOption {
default = hostPlatform.isLinux;
type = types.bool;
description = ''

Whether to compile packages with support for the Systemd init system.

Note that this specifically means compiling packages with the
/Systemd/ libraries. Unit files should always be included in
packages.

'';
};

allowUnfree = mkOption {
default = false;
type = types.bool;
description = ''

Whether to support unfree software. This includes everything not
considered free software by the Free Software Foundation.

'';
};

enableShared = mkOption {
default = true;
type = types.bool;
description = ''

Whether to build packages with shared linking. This has
historically been the default everywhere in Nixpkgs.

'';
};

enableStatic = mkOption {
default = targetPlatform.isiOS;
type = types.bool;
description = ''

Whether to build packages with static linking if available. Note
that not all packages support this.

Packages using this option may or may not also build shared
libraries. Set enableShare to disable those.

'';
};

}
45 changes: 45 additions & 0 deletions pkgs/top-level/release-options.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ pkgs ? import ../..
, lib ? import ../../lib }:

lib.mapAttrs (n: v: pkgs v) {
headlessLinux = {
config = {
withGtk = false;
withQt = false;
withPulseAudio = false;
withJack = false;
withAlsa = false;
withWayland = false;
withX11 = false;
};
localSystem = { system = "x86_64-linux"; };
};
freeDarwin = {
config = {
withApple = false;
allowUnfree = false;
};
localSystem = { system = "x86_64-darwin"; };
};
slnosLinux = {
config = {
withSystemd = false;
withPulseAudio = false;
};
localSystem = { system = "x86_64-linux"; };
};
staticLinux = {
config = {
enableStatic = true;
enableShared = false;
};
localSystem = { system = "x86_64-linux"; };
};
staticDarwin = {
config = {
enableStatic = true;
enableShared = false;
};
localSystem = { system = "x86_64-darwin"; };
};
}
8 changes: 7 additions & 1 deletion pkgs/top-level/splice.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ let
# whether `nativeDrv` or `crossDrv` is the default in `defaultScope`.
pkgsWithoutFetchers = lib.filterAttrs (n: _: !lib.hasPrefix "fetch" n) pkgs;
targetPkgsWithoutFetchers = lib.filterAttrs (n: _: !lib.hasPrefix "fetch" n) pkgs.targetPackages;
defaultHostTargetScope = pkgsWithoutFetchers // pkgs.xorg;

# Allow users to specify global use flags that are applied in all
# packages.
options = lib.mapAttrs (name: option: pkgs.config.${name} or option.default)
(import ./options.nix { inherit lib; inherit (pkgs) hostPlatform; });

defaultHostTargetScope = pkgsWithoutFetchers // pkgs.xorg // options;
defaultTargetTargetScope = targetPkgsWithoutFetchers // targetPkgsWithoutFetchers.xorg or {};

splicer = pkgsBuildBuild: pkgsBuildHost: pkgsBuildTarget:
Expand Down