summary refs log tree commit diff
diff options
context:
space:
mode:
authorvolth <volth@volth.com>2018-07-20 17:56:59 +0000
committervolth <volth@volth.com>2018-07-20 18:48:37 +0000
commit87f5930c3fb2c852f5243278b7a9da8e117d95e4 (patch)
treed76aa79bc394e820305c4eebbd250c89f6992eb9
parenta7e5927b4739c6e6427fc993f077cd3eb5433db7 (diff)
downloadnixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.tar
nixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.tar.gz
nixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.tar.bz2
nixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.tar.lz
nixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.tar.xz
nixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.tar.zst
nixpkgs-87f5930c3fb2c852f5243278b7a9da8e117d95e4.zip
[bot]: remove unreferenced code
-rw-r--r--doc/default.nix2
-rw-r--r--lib/generators.nix2
-rw-r--r--lib/lists.nix1
-rw-r--r--lib/modules.nix1
-rw-r--r--lib/tests/misc.nix4
-rw-r--r--lib/types.nix1
-rw-r--r--nixos/modules/config/fonts/fontconfig-ultimate.nix4
-rw-r--r--nixos/modules/installer/tools/tools.nix2
-rw-r--r--nixos/modules/profiles/clone-config.nix1
-rw-r--r--nixos/modules/programs/nylas-mail.nix1
-rw-r--r--nixos/modules/programs/shell.nix6
-rw-r--r--nixos/modules/programs/ssh.nix1
-rw-r--r--nixos/modules/programs/xonsh.nix2
-rw-r--r--nixos/modules/security/acme.nix1
-rw-r--r--nixos/modules/services/backup/bacula.nix11
-rw-r--r--nixos/modules/services/backup/crashplan-small-business.nix1
-rw-r--r--nixos/modules/services/backup/crashplan.nix1
-rw-r--r--nixos/modules/services/backup/restic.nix1
-rw-r--r--nixos/modules/services/backup/znapzend.nix7
-rw-r--r--nixos/modules/services/cluster/hadoop/default.nix5
-rw-r--r--nixos/modules/services/cluster/kubernetes/default.nix3
-rw-r--r--nixos/modules/services/mail/dovecot.nix2
-rw-r--r--nixos/modules/services/misc/disnix.nix10
-rw-r--r--nixos/modules/services/misc/docker-registry.nix37
-rw-r--r--nixos/modules/services/misc/dysnomia.nix3
-rw-r--r--nixos/modules/services/misc/emby.nix1
-rw-r--r--nixos/modules/services/misc/exhibitor.nix1
-rw-r--r--nixos/modules/services/misc/mediatomb.nix1
-rw-r--r--nixos/modules/services/misc/nzbget.nix2
-rw-r--r--nixos/modules/services/misc/plex.nix1
-rw-r--r--nixos/modules/services/misc/taskserver/default.nix10
-rw-r--r--nixos/modules/services/networking/gdomap.nix3
-rw-r--r--nixos/modules/services/networking/i2pd.nix4
-rw-r--r--nixos/modules/services/networking/morty.nix2
-rw-r--r--nixos/modules/services/networking/znc.nix1
-rw-r--r--nixos/modules/services/system/saslauthd.nix1
-rw-r--r--nixos/modules/services/torrent/transmission.nix6
-rw-r--r--nixos/modules/services/web-apps/frab.nix1
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/default.nix5
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/owncloud.nix11
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/trac.nix2
-rw-r--r--nixos/modules/services/web-servers/uwsgi.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/gnome3.nix1
-rw-r--r--nixos/modules/system/boot/stage-1.nix1
-rw-r--r--nixos/modules/system/boot/stage-2.nix3
-rw-r--r--nixos/modules/system/boot/systemd-nspawn.nix3
-rw-r--r--nixos/modules/system/boot/systemd.nix2
-rw-r--r--nixos/modules/tasks/encrypted-devices.nix1
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix1
-rw-r--r--nixos/modules/tasks/network-interfaces-scripted.nix1
-rw-r--r--nixos/modules/testing/test-instrumentation.nix4
-rw-r--r--nixos/modules/virtualisation/openvswitch.nix3
-rw-r--r--nixos/tests/cjdns.nix10
-rw-r--r--nixos/tests/containers-reloadable.nix1
-rw-r--r--nixos/tests/installer.nix3
-rw-r--r--nixos/tests/pam-oath-login.nix2
-rw-r--r--pkgs/applications/altcoins/mist.nix4
-rw-r--r--pkgs/applications/audio/clementine/default.nix3
-rw-r--r--pkgs/applications/editors/emacs-modes/org-packages.nix6
-rw-r--r--pkgs/applications/editors/textadept/default.nix1
-rw-r--r--pkgs/applications/misc/bitcoinarmory/default.nix1
-rw-r--r--pkgs/applications/misc/llpp/default.nix3
-rw-r--r--pkgs/applications/misc/tqsl/default.nix7
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix4
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix6
-rw-r--r--pkgs/applications/office/mendeley/default.nix1
-rw-r--r--pkgs/applications/science/electronics/bitscope/common.nix4
-rw-r--r--pkgs/applications/science/electronics/bitscope/packages.nix4
-rw-r--r--pkgs/applications/science/math/mathematica/default.nix6
-rw-r--r--pkgs/applications/science/misc/golly/beta.nix10
-rw-r--r--pkgs/applications/virtualization/xen/4.10.nix5
-rw-r--r--pkgs/applications/virtualization/xen/4.8.nix5
-rw-r--r--pkgs/applications/window-managers/way-cooler/way-cooler.nix7
-rw-r--r--pkgs/applications/window-managers/way-cooler/wc-bg.nix7
-rw-r--r--pkgs/applications/window-managers/way-cooler/wc-grab.nix7
-rw-r--r--pkgs/applications/window-managers/way-cooler/wc-lock.nix7
-rw-r--r--pkgs/build-support/dotnetenv/build-solution.nix3
-rw-r--r--pkgs/build-support/fetchdocker/generic-fetcher.nix2
-rw-r--r--pkgs/build-support/rust/build-rust-crate.nix11
-rw-r--r--pkgs/build-support/rust/carnix.nix6
-rw-r--r--pkgs/build-support/rust/default.nix2
-rw-r--r--pkgs/build-support/vm/windows/default.nix5
-rw-r--r--pkgs/development/compilers/chicken/eggDerivation.nix1
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/8/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/snapshot/default.nix3
-rw-r--r--pkgs/development/compilers/ocaml/ber-metaocaml-104.nix1
-rw-r--r--pkgs/development/haskell-modules/hoogle.nix4
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix5
-rw-r--r--pkgs/development/interpreters/python/cpython/3.4/default.nix1
-rw-r--r--pkgs/development/interpreters/python/cpython/3.5/default.nix1
-rw-r--r--pkgs/development/interpreters/python/cpython/3.6/default.nix1
-rw-r--r--pkgs/development/interpreters/python/cpython/3.7/default.nix1
-rw-r--r--pkgs/development/interpreters/ruby/default.nix2
-rw-r--r--pkgs/development/libraries/wiredtiger/default.nix1
-rw-r--r--pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix1
-rw-r--r--pkgs/development/mobile/androidenv/androidndk.nix3
-rw-r--r--pkgs/development/mobile/androidenv/build-app.nix4
-rw-r--r--pkgs/development/ocaml-modules/pycaml/default.nix7
-rw-r--r--pkgs/development/python-modules/gurobipy/linux.nix7
-rw-r--r--pkgs/development/ruby-modules/testing/stubs.nix3
-rw-r--r--pkgs/development/tools/misc/dialog/default.nix3
-rw-r--r--pkgs/development/tools/phantomjs2/default.nix18
-rw-r--r--pkgs/development/tools/selenium/server/default.nix3
-rw-r--r--pkgs/games/dwarf-fortress/wrapper/default.nix2
-rw-r--r--pkgs/games/simutrans/default.nix1
-rw-r--r--pkgs/misc/cups/drivers/canon/default.nix1
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix12
-rw-r--r--pkgs/tools/X11/bumblebee/default.nix5
-rw-r--r--pkgs/tools/admin/ansible/default.nix13
-rw-r--r--pkgs/tools/filesystems/ceph/generic.nix5
-rw-r--r--pkgs/tools/package-management/cargo-edit/cargo-edit.nix7
-rw-r--r--pkgs/top-level/haxe-packages.nix1
-rw-r--r--pkgs/top-level/lua-packages.nix1
118 files changed, 16 insertions, 449 deletions
diff --git a/doc/default.nix b/doc/default.nix
index f99aaff5f8a..9ad1b3da69c 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -1,8 +1,6 @@
 let
   pkgs = import ./.. { };
   lib = pkgs.lib;
-  sources = lib.sourceFilesBySuffices ./. [".xml"];
-  sources-langs = ./languages-frameworks;
 in
 pkgs.stdenv.mkDerivation {
   name = "nixpkgs-manual";
diff --git a/lib/generators.nix b/lib/generators.nix
index aa675908703..f5faf700786 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -19,8 +19,6 @@ let
   libStr = lib.strings;
   libAttr = lib.attrsets;
 
-  flipMapAttrs = flip libAttr.mapAttrs;
-
   inherit (lib) isFunction;
 in
 
diff --git a/lib/lists.nix b/lib/lists.nix
index 231c2317c0c..288882924ff 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -64,7 +64,6 @@ rec {
   */
   foldl = op: nul: list:
     let
-      len = length list;
       foldl' = n:
         if n == -1
         then nul
diff --git a/lib/modules.nix b/lib/modules.nix
index 20207b31d35..a443d5ec5d1 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -670,7 +670,6 @@ rec {
     { config, options, ... }:
     let
       fromOpt = getAttrFromPath from options;
-      toOpt = getAttrFromPath to options;
       toOf = attrByPath to
         (abort "Renaming error: option `${showOption to}' does not exist.");
     in
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index eab20d0f14d..3f2d742e788 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -380,10 +380,6 @@ runTests {
 
           resRem7 = res6.replace (a: removeAttrs a ["a"]);
 
-          resReplace6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = builtins.add; }; };
-                            x2 = x.merge { a = 20; }; # now we have 27
-                        in (x2.replace) { a = 10; }; # and override the value by 10
-
           # fixed tests (delayed args): (when using them add some comments, please)
           resFixed1 =
                 let x = defaultOverridableDelayableArgs id ( x: { a = 7; c = x.fixed.b; });
diff --git a/lib/types.nix b/lib/types.nix
index cf6f2aa46e4..98eff2ac6ff 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -309,7 +309,6 @@ rec {
               }
           else
             def;
-        listOnly = listOf elemType;
         attrOnly = attrsOf elemType;
       in mkOptionType rec {
         name = "loaOf";
diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix
index c7654ca78c3..7549dc6c065 100644
--- a/nixos/modules/config/fonts/fontconfig-ultimate.nix
+++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix
@@ -2,9 +2,7 @@
 
 with lib;
 
-let fcBool = x: if x then "<bool>true</bool>" else "<bool>false</bool>";
-
-    cfg = config.fonts.fontconfig.ultimate;
+let cfg = config.fonts.fontconfig.ultimate;
 
     latestVersion  = pkgs.fontconfig.configVersion;
 
diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix
index 42b00b2025d..05029628672 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -6,8 +6,6 @@
 with lib;
 
 let
-  cfg = config.installer;
-
   makeProg = args: pkgs.substituteAll (args // {
     dir = "bin";
     isExecutable = true;
diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix
index 5b4e68beb6a..99d4774584f 100644
--- a/nixos/modules/profiles/clone-config.nix
+++ b/nixos/modules/profiles/clone-config.nix
@@ -31,7 +31,6 @@ let
     let
       relocateNixOS = path:
         "<nixpkgs/nixos" + removePrefix nixosPath (toString path) + ">";
-      relocateOthers = null;
     in
       { nixos = map relocateNixOS partitionedModuleFiles.nixos;
         others = []; # TODO: copy the modules to the install-device repository.
diff --git a/nixos/modules/programs/nylas-mail.nix b/nixos/modules/programs/nylas-mail.nix
index 9a6cf755f2a..08a6cd0a604 100644
--- a/nixos/modules/programs/nylas-mail.nix
+++ b/nixos/modules/programs/nylas-mail.nix
@@ -4,7 +4,6 @@ with lib;
 
 let
   cfg = config.services.nylas-mail;
-  defaultUser = "nylas-mail";
 in {
   ###### interface
   options = {
diff --git a/nixos/modules/programs/shell.nix b/nixos/modules/programs/shell.nix
index 56fe347528b..26ef1875992 100644
--- a/nixos/modules/programs/shell.nix
+++ b/nixos/modules/programs/shell.nix
@@ -4,12 +4,6 @@
 
 with lib;
 
-let
-
-  cfg = config.environment;
-
-in
-
 {
 
   config = {
diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix
index 36289080a82..b4184041d18 100644
--- a/nixos/modules/programs/ssh.nix
+++ b/nixos/modules/programs/ssh.nix
@@ -7,7 +7,6 @@ with lib;
 let
 
   cfg  = config.programs.ssh;
-  cfgd = config.services.openssh;
 
   askPassword = cfg.askPassword;
 
diff --git a/nixos/modules/programs/xonsh.nix b/nixos/modules/programs/xonsh.nix
index 49cc4906e03..f967ca82ac8 100644
--- a/nixos/modules/programs/xonsh.nix
+++ b/nixos/modules/programs/xonsh.nix
@@ -6,8 +6,6 @@ with lib;
 
 let
 
-  cfge = config.environment;
-
   cfg = config.programs.xonsh;
 
 in
diff --git a/nixos/modules/security/acme.nix b/nixos/modules/security/acme.nix
index 9e5d636241e..946da92d80e 100644
--- a/nixos/modules/security/acme.nix
+++ b/nixos/modules/security/acme.nix
@@ -209,7 +209,6 @@ in
           servicesLists = mapAttrsToList certToServices cfg.certs;
           certToServices = cert: data:
               let
-                domain = if data.domain != null then data.domain else cert;
                 cpath = lpath + optionalString (data.activationDelay != null) ".staging";
                 lpath = "${cfg.directory}/${cert}";
                 rights = if data.allowKeysForGroup then "750" else "700";
diff --git a/nixos/modules/services/backup/bacula.nix b/nixos/modules/services/backup/bacula.nix
index e2806a69539..be02ba56795 100644
--- a/nixos/modules/services/backup/bacula.nix
+++ b/nixos/modules/services/backup/bacula.nix
@@ -97,17 +97,6 @@ let
     ${dir_cfg.extraConfig}
     '';
 
-  # TODO: by default use this config
-  bconsole_conf = pkgs.writeText "bconsole.conf"
-    ''
-    Director {
-      Name = ${dir_cfg.name};
-      Address = "localhost";
-      DirPort = ${toString dir_cfg.port};
-      Password = "${dir_cfg.password}";
-    }
-    '';
-
   directorOptions = {name, config, ...}:
   {
     options = {
diff --git a/nixos/modules/services/backup/crashplan-small-business.nix b/nixos/modules/services/backup/crashplan-small-business.nix
index 9497d8c18bb..790dafefe66 100644
--- a/nixos/modules/services/backup/crashplan-small-business.nix
+++ b/nixos/modules/services/backup/crashplan-small-business.nix
@@ -3,7 +3,6 @@
 let
   cfg = config.services.crashplansb;
   crashplansb = pkgs.crashplansb.override { maxRam = cfg.maxRam; };
-  varDir = "/var/lib/crashplan";
 in
 
 with lib;
diff --git a/nixos/modules/services/backup/crashplan.nix b/nixos/modules/services/backup/crashplan.nix
index d0af2e416b6..c540cc6e2ae 100644
--- a/nixos/modules/services/backup/crashplan.nix
+++ b/nixos/modules/services/backup/crashplan.nix
@@ -3,7 +3,6 @@
 let
   cfg = config.services.crashplan;
   crashplan = pkgs.crashplan;
-  varDir = "/var/lib/crashplan";
 in
 
 with lib;
diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix
index 2d14762e868..409c05221d0 100644
--- a/nixos/modules/services/backup/restic.nix
+++ b/nixos/modules/services/backup/restic.nix
@@ -127,7 +127,6 @@ with lib;
       mapAttrs' (name: backup:
         let
           extraOptions = concatMapStrings (arg: " -o ${arg}") backup.extraOptions;
-          connectTo = elemAt (splitString ":" backup.repository) 1;
           resticCmd = "${pkgs.restic}/bin/restic${extraOptions}";
         in nameValuePair "restic-backups-${name}" ({
           environment = {
diff --git a/nixos/modules/services/backup/znapzend.nix b/nixos/modules/services/backup/znapzend.nix
index 3d133f82d20..fc8a424190f 100644
--- a/nixos/modules/services/backup/znapzend.nix
+++ b/nixos/modules/services/backup/znapzend.nix
@@ -5,13 +5,6 @@ with types;
 
 let
 
-  # Converts a plan like
-  #   { "1d" = "1h"; "1w" = "1d"; }
-  # into
-  #   "1d=>1h,1w=>1d"
-  attrToPlan = attrs: concatStringsSep "," (builtins.attrValues (
-    mapAttrs (n: v: "${n}=>${v}") attrs));
-
   planDescription = ''
       The znapzend backup plan to use for the source.
     </para>
diff --git a/nixos/modules/services/cluster/hadoop/default.nix b/nixos/modules/services/cluster/hadoop/default.nix
index 240938f0d62..f0f5a6ecbfc 100644
--- a/nixos/modules/services/cluster/hadoop/default.nix
+++ b/nixos/modules/services/cluster/hadoop/default.nix
@@ -1,8 +1,5 @@
 { config, lib, pkgs, ...}:
-let 
-  cfg = config.services.hadoop;
-  hadoopConf = import ./conf.nix { hadoop = cfg; pkgs = pkgs; };
-in
+
 with lib;
 {
   imports = [ ./yarn.nix ./hdfs.nix ];
diff --git a/nixos/modules/services/cluster/kubernetes/default.nix b/nixos/modules/services/cluster/kubernetes/default.nix
index e5aba210b01..f56a529afdf 100644
--- a/nixos/modules/services/cluster/kubernetes/default.nix
+++ b/nixos/modules/services/cluster/kubernetes/default.nix
@@ -36,9 +36,6 @@ let
     })}
   '';
 
-  skipAttrs = attrs: map (filterAttrs (k: v: k != "enable"))
-    (filter (v: !(hasAttr "enable" v) || v.enable) attrs);
-
   infraContainer = pkgs.dockerTools.buildImage {
     name = "pause";
     tag = "latest";
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index a3eb1653df5..04df97fdbbe 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -9,8 +9,6 @@ let
   baseDir = "/run/dovecot2";
   stateDir = "/var/lib/dovecot";
 
-  canCreateMailUserGroup = cfg.mailUser != null && cfg.mailGroup != null;
-
   dovecotConf = concatStrings [
     ''
       base_dir = ${baseDir}
diff --git a/nixos/modules/services/misc/disnix.nix b/nixos/modules/services/misc/disnix.nix
index b28995a0911..bb3ac1ecf07 100644
--- a/nixos/modules/services/misc/disnix.nix
+++ b/nixos/modules/services/misc/disnix.nix
@@ -7,16 +7,6 @@ let
 
   cfg = config.services.disnix;
 
-  dysnomia = pkgs.dysnomia.override (origArgs: {
-    enableApacheWebApplication = config.services.httpd.enable;
-    enableAxis2WebService = config.services.tomcat.axis2.enable;
-    enableEjabberdDump = config.services.ejabberd.enable;
-    enableMySQLDatabase = config.services.mysql.enable;
-    enablePostgreSQLDatabase = config.services.postgresql.enable;
-    enableSubversionRepository = config.services.svnserve.enable;
-    enableTomcatWebApplication = config.services.tomcat.enable;
-    enableMongoDatabase = config.services.mongodb.enable;
-  });
 in
 
 {
diff --git a/nixos/modules/services/misc/docker-registry.nix b/nixos/modules/services/misc/docker-registry.nix
index 9a3966ab30a..08031d33c13 100644
--- a/nixos/modules/services/misc/docker-registry.nix
+++ b/nixos/modules/services/misc/docker-registry.nix
@@ -5,43 +5,6 @@ with lib;
 let
   cfg = config.services.dockerRegistry;
 
-  blobCache = if cfg.enableRedisCache
-    then "redis"
-    else "inmemory";
-
-  registryConfig = {
-    version =  "0.1";
-    log.fields.service = "registry";
-    storage = {
-      cache.blobdescriptor = blobCache;
-      filesystem.rootdirectory = cfg.storagePath;
-      delete.enabled = cfg.enableDelete;
-    };
-    http = {
-      addr = ":${builtins.toString cfg.port}";
-      headers.X-Content-Type-Options = ["nosniff"];
-    };
-    health.storagedriver = {
-      enabled = true;
-      interval = "10s";
-      threshold = 3;
-    };
-  };
-
-  registryConfig.redis = mkIf cfg.enableRedisCache {
-    addr = "${cfg.redisUrl}";
-    password = "${cfg.redisPassword}";
-    db = 0;
-    dialtimeout = "10ms";
-    readtimeout = "10ms";
-    writetimeout = "10ms";
-    pool = {
-      maxidle = 16;
-      maxactive = 64;
-      idletimeout = "300s";
-    };
-  };
-
   configFile = pkgs.writeText "docker-registry-config.yml" (builtins.toJSON (recursiveUpdate registryConfig cfg.extraConfig));
 
 in {
diff --git a/nixos/modules/services/misc/dysnomia.nix b/nixos/modules/services/misc/dysnomia.nix
index 9e66e0811ab..ba74b18b697 100644
--- a/nixos/modules/services/misc/dysnomia.nix
+++ b/nixos/modules/services/misc/dysnomia.nix
@@ -62,9 +62,6 @@ let
       cd $out
 
       ${concatMapStrings (containerName:
-        let
-          components = cfg.components."${containerName}";
-        in
         linkMutableComponents { inherit containerName; }
       ) (builtins.attrNames cfg.components)}
     '';
diff --git a/nixos/modules/services/misc/emby.nix b/nixos/modules/services/misc/emby.nix
index b1968784af0..92a68b60251 100644
--- a/nixos/modules/services/misc/emby.nix
+++ b/nixos/modules/services/misc/emby.nix
@@ -4,7 +4,6 @@ with lib;
 
 let
   cfg = config.services.emby;
-  emby = pkgs.emby;
 in
 {
   options = {
diff --git a/nixos/modules/services/misc/exhibitor.nix b/nixos/modules/services/misc/exhibitor.nix
index 685e652c0ba..a90c7f402e7 100644
--- a/nixos/modules/services/misc/exhibitor.nix
+++ b/nixos/modules/services/misc/exhibitor.nix
@@ -4,7 +4,6 @@ with lib;
 
 let
   cfg = config.services.exhibitor;
-  exhibitor = cfg.package;
   exhibitorConfig = ''
     zookeeper-install-directory=${cfg.baseDir}/zookeeper
     zookeeper-data-directory=${cfg.zkDataDir}
diff --git a/nixos/modules/services/misc/mediatomb.nix b/nixos/modules/services/misc/mediatomb.nix
index 5c1977d28de..e8e9c0946d7 100644
--- a/nixos/modules/services/misc/mediatomb.nix
+++ b/nixos/modules/services/misc/mediatomb.nix
@@ -4,7 +4,6 @@ with lib;
 
 let
 
-  uid = config.ids.uids.mediatomb;
   gid = config.ids.gids.mediatomb;
   cfg = config.services.mediatomb;
 
diff --git a/nixos/modules/services/misc/nzbget.nix b/nixos/modules/services/misc/nzbget.nix
index f79a04a1d74..a472b6c7157 100644
--- a/nixos/modules/services/misc/nzbget.nix
+++ b/nixos/modules/services/misc/nzbget.nix
@@ -4,7 +4,7 @@ with lib;
 
 let
   cfg = config.services.nzbget;
-  nzbget = pkgs.nzbget; in {
+in {
   options = {
     services.nzbget = {
       enable = mkEnableOption "NZBGet";
diff --git a/nixos/modules/services/misc/plex.nix b/nixos/modules/services/misc/plex.nix
index 85f1d4a8556..8fe5879c276 100644
--- a/nixos/modules/services/misc/plex.nix
+++ b/nixos/modules/services/misc/plex.nix
@@ -4,7 +4,6 @@ with lib;
 
 let
   cfg = config.services.plex;
-  plex = pkgs.plex;
 in
 {
   options = {
diff --git a/nixos/modules/services/misc/taskserver/default.nix b/nixos/modules/services/misc/taskserver/default.nix
index ba9f52f1904..7daf12f9171 100644
--- a/nixos/modules/services/misc/taskserver/default.nix
+++ b/nixos/modules/services/misc/taskserver/default.nix
@@ -7,16 +7,6 @@ let
 
   taskd = "${pkgs.taskserver}/bin/taskd";
 
-  mkVal = val:
-    if val == true then "true"
-    else if val == false then "false"
-    else if isList val then concatStringsSep ", " val
-    else toString val;
-
-  mkConfLine = key: val: let
-    result = "${key} = ${mkVal val}";
-  in optionalString (val != null && val != []) result;
-
   mkManualPkiOption = desc: mkOption {
     type = types.nullOr types.path;
     default = null;
diff --git a/nixos/modules/services/networking/gdomap.nix b/nixos/modules/services/networking/gdomap.nix
index b3fd91d037f..3d829cb6913 100644
--- a/nixos/modules/services/networking/gdomap.nix
+++ b/nixos/modules/services/networking/gdomap.nix
@@ -2,9 +2,6 @@
 
 with lib;
 
-let
-  cfg = config.services.gdomap;
-in
 {
   #
   # interface
diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix
index 8875309143f..4f219fe56b4 100644
--- a/nixos/modules/services/networking/i2pd.nix
+++ b/nixos/modules/services/networking/i2pd.nix
@@ -103,7 +103,7 @@ let
 
     ${flip concatMapStrings
       (collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
-      (proto: let portStr = toString proto.port; in ''
+      (proto: ''
         [${proto.name}]
         enabled = ${boolToString proto.enable}
         address = ${proto.address}
@@ -122,7 +122,7 @@ let
     # DO NOT EDIT -- this file has been generated automatically.
     ${flip concatMapStrings
       (collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
-      (tun: let portStr = toString tun.port; in ''
+      (tun: ''
         [${tun.name}]
         type = client
         destination = ${tun.destination}
diff --git a/nixos/modules/services/networking/morty.nix b/nixos/modules/services/networking/morty.nix
index f24562f1181..cc81e27e939 100644
--- a/nixos/modules/services/networking/morty.nix
+++ b/nixos/modules/services/networking/morty.nix
@@ -6,8 +6,6 @@ let
 
   cfg = config.services.morty;
 
-  configFile = cfg.configFile;
-
 in
 
 {
diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix
index 6f477e3b146..f817db2ad00 100644
--- a/nixos/modules/services/networking/znc.nix
+++ b/nixos/modules/services/networking/znc.nix
@@ -26,7 +26,6 @@ let
   };
 
   # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
-  notNull = a: ! isNull a;
   mkZncConf = confOpts: ''
     Version = 1.6.3
     ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.modules}
diff --git a/nixos/modules/services/system/saslauthd.nix b/nixos/modules/services/system/saslauthd.nix
index 281716cf186..c8ddca9a0db 100644
--- a/nixos/modules/services/system/saslauthd.nix
+++ b/nixos/modules/services/system/saslauthd.nix
@@ -4,7 +4,6 @@ with lib;
 
 let
 
-  nssModulesPath = config.system.nssModules.path;
   cfg = config.services.saslauthd;
 
 in
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index bf4fb76d0c0..96413d2dd56 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -13,12 +13,6 @@ let
   settingsDir = "${homeDir}/.config/transmission-daemon";
   settingsFile = pkgs.writeText "settings.json" (builtins.toJSON fullSettings);
 
-  # Strings must be quoted, ints and bools must not (for settings.json).
-  toOption = x:
-    if isBool x then boolToString x
-    else if isInt x then toString x
-    else toString ''"${x}"'';
-
   # for users in group "transmission" to have access to torrents
   fullSettings = { umask = 2; download-dir = downloadDir; incomplete-dir = incompleteDir; } // cfg.settings;
 
diff --git a/nixos/modules/services/web-apps/frab.nix b/nixos/modules/services/web-apps/frab.nix
index d411727a1a5..fb95e024817 100644
--- a/nixos/modules/services/web-apps/frab.nix
+++ b/nixos/modules/services/web-apps/frab.nix
@@ -6,7 +6,6 @@ let
   cfg = config.services.frab;
 
   package = pkgs.frab;
-  ruby = package.ruby;
 
   databaseConfig = builtins.toJSON { production = cfg.database; };
 
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index eb8ee9b5cf4..73607c6f9a3 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -98,11 +98,6 @@ let
   allSubservices = mainSubservices ++ concatMap subservicesFor mainCfg.virtualHosts;
 
 
-  # !!! should be in lib
-  writeTextInDir = name: text:
-    pkgs.runCommand name {inherit text;} "mkdir -p $out; echo -n \"$text\" > $out/$name";
-
-
   enableSSL = any (vhost: vhost.enableSSL) allHosts;
 
 
diff --git a/nixos/modules/services/web-servers/apache-httpd/owncloud.nix b/nixos/modules/services/web-servers/apache-httpd/owncloud.nix
index 82b8bf3e30d..6345a9a5693 100644
--- a/nixos/modules/services/web-servers/apache-httpd/owncloud.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/owncloud.nix
@@ -4,17 +4,6 @@ with lib;
 
 let
 
-  httpd = serverInfo.serverConfig.package;
-
-  version24 = !versionOlder httpd.version "2.4";
-
-  allGranted = if version24 then ''
-    Require all granted
-  '' else ''
-    Order allow,deny
-    Allow from all
-  '';
-
   owncloudConfig = pkgs.writeText "config.php"
     ''
       <?php
diff --git a/nixos/modules/services/web-servers/apache-httpd/trac.nix b/nixos/modules/services/web-servers/apache-httpd/trac.nix
index 35b9ab56087..28b411a64b6 100644
--- a/nixos/modules/services/web-servers/apache-httpd/trac.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/trac.nix
@@ -12,8 +12,6 @@ let
     apacheHttpd = httpd;
   };
 
-  pythonLib = p: "${p}/";
-
   httpd = serverInfo.serverConfig.package;
 
   versionPre24 = versionOlder httpd.version "2.4";
diff --git a/nixos/modules/services/web-servers/uwsgi.nix b/nixos/modules/services/web-servers/uwsgi.nix
index 3ef78ea77cb..3f858d90fa4 100644
--- a/nixos/modules/services/web-servers/uwsgi.nix
+++ b/nixos/modules/services/web-servers/uwsgi.nix
@@ -27,10 +27,6 @@ let
         else if hasPython3 then uwsgi.python3
         else null;
 
-      pythonPackages = pkgs.pythonPackages.override {
-        inherit python;
-      };
-
       pythonEnv = python.withPackages (c.pythonPackages or (self: []));
 
       uwsgiCfg = {
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
index 27b62df7097..9fb8f44b242 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome3.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -10,7 +10,6 @@ let
     let
       pkgName = drv: (builtins.parseDrvName drv.name).name;
       ysNames = map pkgName ys;
-      res = (filter (x: !(builtins.elem (pkgName x) ysNames)) xs);
     in
       filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
 
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index b6a7081b896..71b806a0b4e 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -11,7 +11,6 @@ let
 
   udev = config.systemd.package;
 
-  kernelPackages = config.boot.kernelPackages;
   modulesTree = config.system.modulesTree;
   firmware = config.hardware.firmware;
 
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix
index 78afbd8dbc1..9fd89b6319d 100644
--- a/nixos/modules/system/boot/stage-2.nix
+++ b/nixos/modules/system/boot/stage-2.nix
@@ -4,9 +4,6 @@ with lib;
 
 let
 
-  kernel = config.boot.kernelPackages.kernel;
-  activateConfiguration = config.system.activationScripts.script;
-
   bootStage2 = pkgs.substituteAll {
     src = ./stage-2-init.sh;
     shellDebug = "${pkgs.bashInteractive}/bin/bash";
diff --git a/nixos/modules/system/boot/systemd-nspawn.nix b/nixos/modules/system/boot/systemd-nspawn.nix
index 64b3b8b584e..83fef835436 100644
--- a/nixos/modules/system/boot/systemd-nspawn.nix
+++ b/nixos/modules/system/boot/systemd-nspawn.nix
@@ -6,9 +6,6 @@ with import ./systemd-lib.nix { inherit config lib pkgs; };
 
 let
   cfg = config.systemd.nspawn;
-  assertions = [
-    # boot = true -> processtwo != true
-  ];
 
   checkExec = checkUnitConfig "Exec" [
     (assertOnlyFields [
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 6f5b15372d7..500c2d40661 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -188,8 +188,6 @@ let
       "timers.target"
     ];
 
-  boolToString = value: if value then "yes" else "no";
-
   makeJobScript = name: text:
     let mkScriptName =  s: (replaceChars [ "\\" ] [ "-" ] (shellEscape s) );
         x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${mkScriptName name}"; inherit text; };
diff --git a/nixos/modules/tasks/encrypted-devices.nix b/nixos/modules/tasks/encrypted-devices.nix
index da0c9408d89..11ed5d7e4d0 100644
--- a/nixos/modules/tasks/encrypted-devices.nix
+++ b/nixos/modules/tasks/encrypted-devices.nix
@@ -7,7 +7,6 @@ let
   encDevs = filter (dev: dev.encrypted.enable) fileSystems;
   keyedEncDevs = filter (dev: dev.encrypted.keyFile != null) encDevs;
   keylessEncDevs = filter (dev: dev.encrypted.keyFile == null) encDevs;
-  isIn = needle: haystack: filter (p: p == needle) haystack != [];
   anyEncrypted =
     fold (j: v: v || j.encrypted.enable) false encDevs;
 
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 39f51c36367..7120856387e 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -9,7 +9,6 @@ with lib;
 
 let
 
-  cfgSpl = config.boot.spl;
   cfgZfs = config.boot.zfs;
   cfgSnapshots = config.services.zfs.autoSnapshot;
   cfgSnapFlags = cfgSnapshots.flags;
diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix
index c4a2bd1f75f..f3f6a19318a 100644
--- a/nixos/modules/tasks/network-interfaces-scripted.nix
+++ b/nixos/modules/tasks/network-interfaces-scripted.nix
@@ -7,7 +7,6 @@ let
 
   cfg = config.networking;
   interfaces = attrValues cfg.interfaces;
-  hasVirtuals = any (i: i.virtual) interfaces;
 
   slaves = concatMap (i: i.interfaces) (attrValues cfg.bonds)
     ++ concatMap (i: i.interfaces) (attrValues cfg.bridges)
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix
index 7a7fcbecd64..114e0ca39fa 100644
--- a/nixos/modules/testing/test-instrumentation.nix
+++ b/nixos/modules/testing/test-instrumentation.nix
@@ -6,10 +6,6 @@
 with lib;
 with import ../../lib/qemu-flags.nix { inherit pkgs; };
 
-let
-  kernel = config.boot.kernelPackages.kernel;
-in
-
 {
 
   # This option is a dummy that if used in conjunction with
diff --git a/nixos/modules/virtualisation/openvswitch.nix b/nixos/modules/virtualisation/openvswitch.nix
index 38b138e0632..bb8b9172f23 100644
--- a/nixos/modules/virtualisation/openvswitch.nix
+++ b/nixos/modules/virtualisation/openvswitch.nix
@@ -51,9 +51,6 @@ in {
     # Where the communication sockets live
     runDir = "/var/run/openvswitch";
 
-    # Where the config database live (can't be in nix-store)
-    stateDir = "/var/db/openvswitch";
-
     # The path to the an initialized version of the database
     db = pkgs.stdenv.mkDerivation {
       name = "vswitch.db";
diff --git a/nixos/tests/cjdns.nix b/nixos/tests/cjdns.nix
index 4d3b58abc6e..db89c496944 100644
--- a/nixos/tests/cjdns.nix
+++ b/nixos/tests/cjdns.nix
@@ -2,7 +2,6 @@ let
   carolKey = "2d2a338b46f8e4a8c462f0c385b481292a05f678e19a2b82755258cf0f0af7e2";
   carolPubKey = "n932l3pjvmhtxxcdrqq2qpw5zc58f01vvjx01h4dtd1bb0nnu2h0.k";
   carolPassword = "678287829ce4c67bc8b227e56d94422ee1b85fa11618157b2f591de6c6322b52";
-  carolIp4 = "192.168.0.9";
 
   basicConfig =
     { config, pkgs, ... }:
@@ -44,9 +43,7 @@ import ./make-test.nix ({ pkgs, ...} : {
       bob =
         { config, lib, nodes, ... }:
 
-        let carolIp4 = lib.mkForce nodes.carol.config.networking.interfaces.eth1; in
-
-          { imports = [ basicConfig ];
+        { imports = [ basicConfig ];
 
           networking.interfaces.eth1.ipv4.addresses = [
             { address = "192.168.0.2"; prefixLength = 24; }
@@ -67,10 +64,7 @@ import ./make-test.nix ({ pkgs, ...} : {
       # but knows neither Alice or Bob.
       carol =
         { config, lib, nodes, ... }:
-          let
-            carolIp4 = (lib.mkForce nodes.carol.config.networking.interfaces.eth1);
-          in
-          { imports = [ basicConfig ];
+        { imports = [ basicConfig ];
 
           environment.etc."cjdns.keys".text = ''
             CJDNS_PRIVATE_KEY=${carolKey}
diff --git a/nixos/tests/containers-reloadable.nix b/nixos/tests/containers-reloadable.nix
index 5fb42f2272b..15862ac64c1 100644
--- a/nixos/tests/containers-reloadable.nix
+++ b/nixos/tests/containers-reloadable.nix
@@ -45,7 +45,6 @@ in {
   };
 
   testScript = {nodes, ...}: let
-    originalSystem = nodes.client.config.system.build.toplevel;
     c1System = nodes.client_c1.config.system.build.toplevel;
     c2System = nodes.client_c2.config.system.build.toplevel;
   in ''
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 8ce9bc21ff7..59226484bd8 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -58,9 +58,6 @@ let
     '';
 
 
-  channelContents = [ pkgs.rlwrap ];
-
-
   # The test script boots a NixOS VM, installs NixOS on an empty hard
   # disk, and then reboot from the hard disk.  It's parameterized with
   # a test script fragment `createPartitions', which must create
diff --git a/nixos/tests/pam-oath-login.nix b/nixos/tests/pam-oath-login.nix
index eb5966d9213..9f40ecfe865 100644
--- a/nixos/tests/pam-oath-login.nix
+++ b/nixos/tests/pam-oath-login.nix
@@ -12,8 +12,6 @@ let
   # and picking a the first 4:
   oathSnakeOilPassword1 = "143349";
   oathSnakeOilPassword2 = "801753";
-  oathSnakeOilPassword3 = "019933";
-  oathSnakeOilPassword4 = "403895";
 
   alicePassword = "foobar";
   # Generated via: mkpasswd -m sha-512 and passing in "foobar"
diff --git a/pkgs/applications/altcoins/mist.nix b/pkgs/applications/altcoins/mist.nix
index c38e613fdd4..cb8d01467a2 100644
--- a/pkgs/applications/altcoins/mist.nix
+++ b/pkgs/applications/altcoins/mist.nix
@@ -26,7 +26,7 @@ let
   };
 
   mist = stdenv.lib.appendToName "unwrapped" (stdenv.mkDerivation {
-    inherit name version;
+    inherit name version meta;
 
     src = {
       i686-linux = fetchurl {
@@ -56,7 +56,7 @@ let
   });
 in
 buildFHSUserEnv {
-  inherit name;
+  inherit name meta;
 
   targetPkgs = pkgs: with pkgs; [
      mist
diff --git a/pkgs/applications/audio/clementine/default.nix b/pkgs/applications/audio/clementine/default.nix
index 6379975e951..b8044972576 100644
--- a/pkgs/applications/audio/clementine/default.nix
+++ b/pkgs/applications/audio/clementine/default.nix
@@ -4,7 +4,6 @@
 , qca2, pkgconfig, sparsehash, config, makeWrapper, runCommand, gst_plugins }:
 
 let
-  withSpotify = config.clementine.spotify or false;
   withIpod = config.clementine.ipod or false;
   withMTP = config.clementine.mtp or true;
   withCD = config.clementine.cd or true;
@@ -12,8 +11,6 @@ let
 
   version = "1.3.1";
 
-  exeName = "clementine";
-
   src = fetchurl {
     url = https://github.com/clementine-player/Clementine/archive/1.3.1.tar.gz;
     sha256 = "0z7k73wyz54c3020lb6x2dgw0vz4ri7wcl3vs03qdj5pk8d971gq";
diff --git a/pkgs/applications/editors/emacs-modes/org-packages.nix b/pkgs/applications/editors/emacs-modes/org-packages.nix
index b8543841a7f..8df45ffb61e 100644
--- a/pkgs/applications/editors/emacs-modes/org-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/org-packages.nix
@@ -23,12 +23,6 @@ self:
 
     super = imported;
 
-    markBroken = pkg: pkg.override {
-      elpaBuild = args: self.elpaBuild (args // {
-        meta = (args.meta or {}) // { broken = true; };
-      });
-    };
-
     overrides = {
     };
 
diff --git a/pkgs/applications/editors/textadept/default.nix b/pkgs/applications/editors/textadept/default.nix
index 4f1a29278be..818183b9852 100644
--- a/pkgs/applications/editors/textadept/default.nix
+++ b/pkgs/applications/editors/textadept/default.nix
@@ -56,7 +56,6 @@ let
   gtdialog_zip   = "gtdialog_1.3.zip";
   cdk_tgz        = "cdk-5.0-20150928.tgz";
   termkey_tgz    = "libtermkey-0.17.tar.gz";
-  bombay_zip     = "bombay.zip";
 
   scinterm_url   = "http://foicica.com/scinterm/download/" + scinterm_zip;
   tre_url        = "https://github.com/laurikari/tre/archive/" + tre_zip;
diff --git a/pkgs/applications/misc/bitcoinarmory/default.nix b/pkgs/applications/misc/bitcoinarmory/default.nix
index a9d32d4b252..3245a56e9de 100644
--- a/pkgs/applications/misc/bitcoinarmory/default.nix
+++ b/pkgs/applications/misc/bitcoinarmory/default.nix
@@ -6,7 +6,6 @@
 let
 
   version = "0.96.1";
-  sitePackages = pythonPackages.python.sitePackages;
   inherit (pythonPackages) buildPythonApplication pyqt4 psutil twisted;
 
 in buildPythonApplication {
diff --git a/pkgs/applications/misc/llpp/default.nix b/pkgs/applications/misc/llpp/default.nix
index 959ed6b11ba..25067e3bba5 100644
--- a/pkgs/applications/misc/llpp/default.nix
+++ b/pkgs/applications/misc/llpp/default.nix
@@ -3,8 +3,7 @@
 
 assert lib.versionAtLeast (lib.getVersion ocaml) "4.02";
 
-let ocamlVersion = (builtins.parseDrvName (ocaml.name)).version;
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "llpp-${version}";
   version = "2018-03-02";
 
diff --git a/pkgs/applications/misc/tqsl/default.nix b/pkgs/applications/misc/tqsl/default.nix
index b41f5c9a0a7..f001cbcaab9 100644
--- a/pkgs/applications/misc/tqsl/default.nix
+++ b/pkgs/applications/misc/tqsl/default.nix
@@ -1,12 +1,5 @@
 { stdenv, fetchurl, makeWrapper, cmake, expat, openssl, zlib, db, curl, wxGTK }:
 
-let
-  lib_suffix =
-  if stdenv.system == "x86_64-linux" then
-    "64"
-  else
-    "";
-in
 stdenv.mkDerivation rec {
   name = "tqsl-${version}";
   version = "2.3.1";
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index 021c048669f..196e2eb79bd 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -43,10 +43,6 @@ let
   # source tree.
   extraAttrs = buildFun base;
 
-  gentooPatch = name: sha256: fetchpatch {
-    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/files/${name}";
-    inherit sha256;
-  };
   githubPatch = commit: sha256: fetchpatch {
     url = "https://github.com/chromium/chromium/commit/${commit}.patch";
     inherit sha256;
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
index dbf0bbbd4d5..8420dbdaaa8 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
@@ -47,12 +47,6 @@
 , debug ? false
 }:
 
-let
-  arch =
-    if stdenv.system == "x86_64-linux" then
-      "x86_64"
-    else throw "Flash Player is not supported on this platform";
-in
 stdenv.mkDerivation rec {
   name = "flashplayer-standalone-${version}";
   version = "30.0.0.134";
diff --git a/pkgs/applications/office/mendeley/default.nix b/pkgs/applications/office/mendeley/default.nix
index cf40392c6dd..693fa63661b 100644
--- a/pkgs/applications/office/mendeley/default.nix
+++ b/pkgs/applications/office/mendeley/default.nix
@@ -36,7 +36,6 @@
 
 let
   arch32 = "i686-linux";
-  arch64 = "x86_64-linux";
 
   arch = if stdenv.system == arch32
     then "i386"
diff --git a/pkgs/applications/science/electronics/bitscope/common.nix b/pkgs/applications/science/electronics/bitscope/common.nix
index e1db7131a65..ba2d5221cc5 100644
--- a/pkgs/applications/science/electronics/bitscope/common.nix
+++ b/pkgs/applications/science/electronics/bitscope/common.nix
@@ -60,10 +60,6 @@ let
       ${(wrapBinary libs) attrs.toolName}
     '';
   });
-  fhs = target: buildFHSUserEnv {
-    inherit (pkg) name;
-    runScript = target;
-  };
 in buildFHSUserEnv {
   name = "${attrs.toolName}-${attrs.version}";
   runScript = "${pkg.outPath}/bin/${attrs.toolName}";
diff --git a/pkgs/applications/science/electronics/bitscope/packages.nix b/pkgs/applications/science/electronics/bitscope/packages.nix
index c10e9de851a..dc333f3d3b7 100644
--- a/pkgs/applications/science/electronics/bitscope/packages.nix
+++ b/pkgs/applications/science/electronics/bitscope/packages.nix
@@ -6,10 +6,6 @@
 }:
 
 let
-  wrapBinary = libPaths: binaryName: ''
-    wrapProgram "$out/bin/${binaryName}" \
-      --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath libPaths}"
-  '';
   mkBitscope = callPackage (import ./common.nix) { };
 in {
   chart = let
diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix
index 97781a69ce6..d2a518e9db0 100644
--- a/pkgs/applications/science/math/mathematica/default.nix
+++ b/pkgs/applications/science/math/mathematica/default.nix
@@ -24,12 +24,6 @@
 }:
 
 let
-  platform =
-    if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then
-      "Linux"
-    else
-      throw "Mathematica requires i686-linux or x86_64 linux";
-
   l10n =
     with stdenv.lib;
     with callPackage ./l10ns.nix {};
diff --git a/pkgs/applications/science/misc/golly/beta.nix b/pkgs/applications/science/misc/golly/beta.nix
index 5b210fa4bf6..f423adbe786 100644
--- a/pkgs/applications/science/misc/golly/beta.nix
+++ b/pkgs/applications/science/misc/golly/beta.nix
@@ -2,15 +2,7 @@
 , wxGTK, perl, python2, zlib, libGLU_combined, libX11
 , automake, autoconf
 }:
-let
-  s = # Generated upstream information
-  rec {
-    baseName="golly";
-    version="2.8";
-    name="${baseName}-${version}";
-    hash="0a4vn2hm7h4b47v2iwip1z3n9y8isf79v08aipl2iqms2m3p5204";
-  };
-in
+
 stdenv.mkDerivation rec {
   name = "golly-${version}";
   version = "2.8.99.2.20161122";
diff --git a/pkgs/applications/virtualization/xen/4.10.nix b/pkgs/applications/virtualization/xen/4.10.nix
index dab90a1ed78..5e21f7ee608 100644
--- a/pkgs/applications/virtualization/xen/4.10.nix
+++ b/pkgs/applications/virtualization/xen/4.10.nix
@@ -22,11 +22,6 @@ with stdenv.lib;
 # and try applying all the ones we don't have yet.
 
 let
-  xsaPatch = { name , sha256 }: (fetchpatch {
-    url = "https://xenbits.xen.org/xsa/xsa${name}.patch";
-    inherit sha256;
-  });
-
   xsa = import ./xsa-patches.nix { inherit fetchpatch; };
 
   qemuMemfdBuildFix = fetchpatch {
diff --git a/pkgs/applications/virtualization/xen/4.8.nix b/pkgs/applications/virtualization/xen/4.8.nix
index 79be1be1190..f99cdb69d2a 100644
--- a/pkgs/applications/virtualization/xen/4.8.nix
+++ b/pkgs/applications/virtualization/xen/4.8.nix
@@ -22,11 +22,6 @@ with stdenv.lib;
 # and try applying all the ones we don't have yet.
 
 let
-  xsaPatch = { name , sha256 }: (fetchpatch {
-    url = "https://xenbits.xen.org/xsa/xsa${name}.patch";
-    inherit sha256;
-  });
-
   xsa = import ./xsa-patches.nix { inherit fetchpatch; };
 
   xenlockprofpatch = (fetchpatch {
diff --git a/pkgs/applications/window-managers/way-cooler/way-cooler.nix b/pkgs/applications/window-managers/way-cooler/way-cooler.nix
index 9ba6db36772..8a740b15500 100644
--- a/pkgs/applications/window-managers/way-cooler/way-cooler.nix
+++ b/pkgs/applications/window-managers/way-cooler/way-cooler.nix
@@ -1,13 +1,6 @@
 # Generated by carnix 0.6.5: carnix -o way-cooler.nix Cargo.lock
 { lib, buildPlatform, buildRustCrate, fetchgit }:
 let kernel = buildPlatform.parsed.kernel.name;
-    abi = buildPlatform.parsed.abi.name;
-    include = includedFiles: src: builtins.filterSource (path: type:
-      lib.lists.any (f:
-        let p = toString (src + ("/" + f)); in
-        (path == p) || (type == "directory" && lib.strings.hasPrefix path p)
-      ) includedFiles
-    ) src;
     updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions);
     mapFeatures = features: map (fun: fun { features = features; });
     mkFeatures = feat: lib.lists.foldl (features: featureName:
diff --git a/pkgs/applications/window-managers/way-cooler/wc-bg.nix b/pkgs/applications/window-managers/way-cooler/wc-bg.nix
index d1c0993982a..c63123db7cc 100644
--- a/pkgs/applications/window-managers/way-cooler/wc-bg.nix
+++ b/pkgs/applications/window-managers/way-cooler/wc-bg.nix
@@ -1,13 +1,6 @@
 # Generated by carnix 0.6.5: carnix -o wc-bg.nix Cargo.lock
 { lib, buildPlatform, buildRustCrate, fetchgit }:
 let kernel = buildPlatform.parsed.kernel.name;
-    abi = buildPlatform.parsed.abi.name;
-    include = includedFiles: src: builtins.filterSource (path: type:
-      lib.lists.any (f:
-        let p = toString (src + ("/" + f)); in
-        (path == p) || (type == "directory" && lib.strings.hasPrefix path p)
-      ) includedFiles
-    ) src;
     updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions);
     mapFeatures = features: map (fun: fun { features = features; });
     mkFeatures = feat: lib.lists.foldl (features: featureName:
diff --git a/pkgs/applications/window-managers/way-cooler/wc-grab.nix b/pkgs/applications/window-managers/way-cooler/wc-grab.nix
index 253281b6a9a..947a9653e56 100644
--- a/pkgs/applications/window-managers/way-cooler/wc-grab.nix
+++ b/pkgs/applications/window-managers/way-cooler/wc-grab.nix
@@ -1,13 +1,6 @@
 # Generated by carnix 0.6.5: carnix -o wc-grab.nix Cargo.lock
 { lib, buildPlatform, buildRustCrate, fetchgit }:
 let kernel = buildPlatform.parsed.kernel.name;
-    abi = buildPlatform.parsed.abi.name;
-    include = includedFiles: src: builtins.filterSource (path: type:
-      lib.lists.any (f:
-        let p = toString (src + ("/" + f)); in
-        (path == p) || (type == "directory" && lib.strings.hasPrefix path p)
-      ) includedFiles
-    ) src;
     updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions);
     mapFeatures = features: map (fun: fun { features = features; });
     mkFeatures = feat: lib.lists.foldl (features: featureName:
diff --git a/pkgs/applications/window-managers/way-cooler/wc-lock.nix b/pkgs/applications/window-managers/way-cooler/wc-lock.nix
index 80775112abc..008df5479ce 100644
--- a/pkgs/applications/window-managers/way-cooler/wc-lock.nix
+++ b/pkgs/applications/window-managers/way-cooler/wc-lock.nix
@@ -1,13 +1,6 @@
 # Generated by carnix 0.6.5: carnix -o wc-lock.nix Cargo.lock
 { lib, buildPlatform, buildRustCrate, fetchgit }:
 let kernel = buildPlatform.parsed.kernel.name;
-    abi = buildPlatform.parsed.abi.name;
-    include = includedFiles: src: builtins.filterSource (path: type:
-      lib.lists.any (f:
-        let p = toString (src + ("/" + f)); in
-        (path == p) || (type == "directory" && lib.strings.hasPrefix path p)
-      ) includedFiles
-    ) src;
     updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions);
     mapFeatures = features: map (fun: fun { features = features; });
     mkFeatures = feat: lib.lists.foldl (features: featureName:
diff --git a/pkgs/build-support/dotnetenv/build-solution.nix b/pkgs/build-support/dotnetenv/build-solution.nix
index b1853bf7364..62370d361cd 100644
--- a/pkgs/build-support/dotnetenv/build-solution.nix
+++ b/pkgs/build-support/dotnetenv/build-solution.nix
@@ -14,9 +14,6 @@
 
 assert modifyPublicMain -> mainClassFile != null;
 
-let
-  wrapperCS = ./Wrapper.cs.in;  
-in
 stdenv.mkDerivation {
   inherit name src;
   
diff --git a/pkgs/build-support/fetchdocker/generic-fetcher.nix b/pkgs/build-support/fetchdocker/generic-fetcher.nix
index e051cee0843..3b0c3377046 100644
--- a/pkgs/build-support/fetchdocker/generic-fetcher.nix
+++ b/pkgs/build-support/fetchdocker/generic-fetcher.nix
@@ -2,8 +2,6 @@
 let
   awk                   = "${gawk}/bin/awk";
   dockerCredentialsFile = import ./credentials.nix;
-  stripScheme           =
-    builtins.replaceStrings [ "https://" "http://" ] [ "" "" ];
 in
 { fetcher
 , name
diff --git a/pkgs/build-support/rust/build-rust-crate.nix b/pkgs/build-support/rust/build-rust-crate.nix
index be76c283bab..7f21b66ce12 100644
--- a/pkgs/build-support/rust/build-rust-crate.nix
+++ b/pkgs/build-support/rust/build-rust-crate.nix
@@ -187,20 +187,12 @@ let makeDeps = dependencies:
                    crateType, metadata, crateBin, finalBins,
                    extraRustcOpts, verbose, colors }:
 
-      let depsDir = lib.concatStringsSep " " dependencies;
-          completeDepsDir = lib.concatStringsSep " " completeDeps;
-          completeBuildDepsDir = lib.concatStringsSep " " completeBuildDeps;
-          deps = makeDeps dependencies;
-          optLevel = if release then 3 else 0;
+      let deps = makeDeps dependencies;
           rustcOpts =
             lib.lists.foldl' (opts: opt: opts + " " + opt)
               (if release then "-C opt-level=3" else "-C debuginfo=2")
               (["-C codegen-units=1"] ++ extraRustcOpts);
           rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}";
-          version_ = lib.splitString "-" crateVersion;
-          versionPre = if lib.tail version_ == [] then "" else builtins.elemAt version_ 1;
-          version = lib.splitString "." (lib.head version_);
-          authors = lib.concatStringsSep ":" crateAuthors;
       in ''
       runHook preBuild
       norm=""
@@ -348,7 +340,6 @@ crate_: lib.makeOverridable ({ rust, release, verbose, features, buildInputs, cr
   preConfigure, postConfigure, preBuild, postBuild, preInstall, postInstall }:
 
 let crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: {}) crateOverrides crate_);
-    release_ = release;
     dependencies_ = dependencies;
     buildDependencies_ = buildDependencies;
     processedAttrs = [
diff --git a/pkgs/build-support/rust/carnix.nix b/pkgs/build-support/rust/carnix.nix
index 5b79d607f9d..22d3fcd0c1f 100644
--- a/pkgs/build-support/rust/carnix.nix
+++ b/pkgs/build-support/rust/carnix.nix
@@ -2,12 +2,6 @@
 { lib, buildPlatform, buildRustCrate, fetchgit }:
 let kernel = buildPlatform.parsed.kernel.name;
     abi = buildPlatform.parsed.abi.name;
-    include = includedFiles: src: builtins.filterSource (path: type:
-      lib.lists.any (f:
-        let p = toString (src + ("/" + f)); in
-        (path == p) || (type == "directory" && lib.strings.hasPrefix path p)
-      ) includedFiles
-    ) src;
     updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions);
     mapFeatures = features: map (fun: fun { features = features; });
     mkFeatures = feat: lib.lists.foldl (features: featureName:
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index d7d03aae33e..59e8c3e7f7e 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -20,8 +20,6 @@ in
 assert cargoVendorDir == null -> cargoSha256 != "unset";
 
 let
-  lib = stdenv.lib;
-
   cargoDeps = if cargoVendorDir == null
     then fetchcargo {
         inherit name src srcs sourceRoot cargoUpdateHook;
diff --git a/pkgs/build-support/vm/windows/default.nix b/pkgs/build-support/vm/windows/default.nix
index f1575219982..e5ff13f0da9 100644
--- a/pkgs/build-support/vm/windows/default.nix
+++ b/pkgs/build-support/vm/windows/default.nix
@@ -21,11 +21,6 @@ let
 
 in {
   runInWindowsVM = drv: let
-    newDrv = drv.override {
-      stdenv = drv.stdenv.override {
-        shell = "/bin/sh";
-      };
-    };
   in pkgs.lib.overrideDerivation drv (attrs: let
     bootstrap = bootstrapper attrs.windowsImage;
   in {
diff --git a/pkgs/development/compilers/chicken/eggDerivation.nix b/pkgs/development/compilers/chicken/eggDerivation.nix
index 58247e5aeb5..bcb7a763fb6 100644
--- a/pkgs/development/compilers/chicken/eggDerivation.nix
+++ b/pkgs/development/compilers/chicken/eggDerivation.nix
@@ -8,7 +8,6 @@
 let
   libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
   overrides = import ./overrides.nix;
-  lib = stdenv.lib;
   baseName = (builtins.parseDrvName name).name;
   override = if builtins.hasAttr baseName overrides
    then
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 75259ed3983..15071fd2ba5 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -54,9 +54,6 @@ with builtins;
 
 let version = "4.8.5";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches = [ ]
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 27164176b53..006cbdf40dc 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -54,9 +54,6 @@ with builtins;
 
 let version = "4.9.4";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches =
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index eeeabe301d1..f360ed135d7 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -53,9 +53,6 @@ with builtins;
 let version = "5.5.0";
     sha256 = "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches =
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index e5c77568a0e..02a00350162 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -52,9 +52,6 @@ with builtins;
 
 let version = "6.4.0";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches =
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index d671743ee62..84323cca823 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -41,9 +41,6 @@ with builtins;
 
 let version = "7.3.0";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches =
diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix
index e8c03c38230..85c03bc440f 100644
--- a/pkgs/development/compilers/gcc/8/default.nix
+++ b/pkgs/development/compilers/gcc/8/default.nix
@@ -41,9 +41,6 @@ with builtins;
 
 let version = "8.1.0";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches =
diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix
index 4e69d7e0408..b00f180bbc7 100644
--- a/pkgs/development/compilers/gcc/snapshot/default.nix
+++ b/pkgs/development/compilers/gcc/snapshot/default.nix
@@ -42,9 +42,6 @@ with builtins;
 
 let version = "7-20170409";
 
-    # Whether building a cross-compiler for GNU/Hurd.
-    crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
-
     enableParallelBuilding = true;
 
     patches =
diff --git a/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix b/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix
index 16d7e2580b3..e084a2dcf94 100644
--- a/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix
+++ b/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix
@@ -2,7 +2,6 @@
 
 let
    useX11 = stdenv.isi686 || stdenv.isx86_64;
-   useNativeCompilers = stdenv.isi686 || stdenv.isx86_64 || stdenv.isMips;
    inherit (stdenv.lib) optionals optionalString;
 in
 
diff --git a/pkgs/development/haskell-modules/hoogle.nix b/pkgs/development/haskell-modules/hoogle.nix
index 38e8dfd24c4..7b3fe8fba02 100644
--- a/pkgs/development/haskell-modules/hoogle.nix
+++ b/pkgs/development/haskell-modules/hoogle.nix
@@ -36,10 +36,6 @@ let
     if !isGhcjs
     then "haddock"
     else "haddock-ghcjs";
-  ghcName =
-    if !isGhcjs
-    then "ghc"
-    else "ghcjs";
   ghcDocLibDir =
     if !isGhcjs
     then ghc.doc + ''/share/doc/ghc*/html/libraries''
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index cd1a0fc6e18..d37f59250d5 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -33,7 +33,6 @@ let
   majorVersion = "2.7";
   minorVersion = "15";
   minorVersionSuffix = "";
-  pythonVersion = majorVersion;
   version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
   libPrefix = "python${majorVersion}";
   sitePackages = "lib/${libPrefix}/site-packages";
@@ -161,10 +160,6 @@ let
     # don't rely on detecting glibc-isms.
   ++ optional hostPlatform.isLinux "ac_cv_func_lchmod=no";
 
-  postConfigure = if hostPlatform.isCygwin then ''
-    sed -i Makefile -e 's,PYTHONPATH="$(srcdir),PYTHONPATH="$(abs_srcdir),'
-  '' else null;
-
   buildInputs =
     optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
     [ bzip2 openssl zlib ]
diff --git a/pkgs/development/interpreters/python/cpython/3.4/default.nix b/pkgs/development/interpreters/python/cpython/3.4/default.nix
index 7da2cfdd152..a8b6ffd1da9 100644
--- a/pkgs/development/interpreters/python/cpython/3.4/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.4/default.nix
@@ -29,7 +29,6 @@ let
   majorVersion = "3.4";
   minorVersion = "8";
   minorVersionSuffix = "";
-  pythonVersion = majorVersion;
   version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
   libPrefix = "python${majorVersion}";
   sitePackages = "lib/${libPrefix}/site-packages";
diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix
index 434c2338270..2bbdb8bdd84 100644
--- a/pkgs/development/interpreters/python/cpython/3.5/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix
@@ -29,7 +29,6 @@ let
   majorVersion = "3.5";
   minorVersion = "5";
   minorVersionSuffix = "";
-  pythonVersion = majorVersion;
   version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
   libPrefix = "python${majorVersion}";
   sitePackages = "lib/${libPrefix}/site-packages";
diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix
index 9ea0876b1ce..f8628186d79 100644
--- a/pkgs/development/interpreters/python/cpython/3.6/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix
@@ -29,7 +29,6 @@ let
   majorVersion = "3.6";
   minorVersion = "6";
   minorVersionSuffix = "";
-  pythonVersion = majorVersion;
   version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
   libPrefix = "python${majorVersion}";
   sitePackages = "lib/${libPrefix}/site-packages";
diff --git a/pkgs/development/interpreters/python/cpython/3.7/default.nix b/pkgs/development/interpreters/python/cpython/3.7/default.nix
index ad88895fa67..e0cc198c096 100644
--- a/pkgs/development/interpreters/python/cpython/3.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.7/default.nix
@@ -29,7 +29,6 @@ let
   majorVersion = "3.7";
   minorVersion = "0";
   minorVersionSuffix = "";
-  pythonVersion = majorVersion;
   version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
   libPrefix = "python${majorVersion}";
   sitePackages = "lib/${libPrefix}/site-packages";
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 89d394c8756..bb6f2758f4c 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -32,8 +32,6 @@ let
   generic = { version, sha256 }: let
     ver = version;
     tag = ver.gitTag;
-    isRuby20 = ver.majMin == "2.0";
-    isRuby21 = ver.majMin == "2.1";
     isRuby25 = ver.majMin == "2.5";
     baseruby = self.override { useRailsExpress = false; };
     self = lib.makeOverridable (
diff --git a/pkgs/development/libraries/wiredtiger/default.nix b/pkgs/development/libraries/wiredtiger/default.nix
index c905c40cf96..c4d94af850d 100644
--- a/pkgs/development/libraries/wiredtiger/default.nix
+++ b/pkgs/development/libraries/wiredtiger/default.nix
@@ -13,7 +13,6 @@ let
     + optionalString (val != null && cond != false) "=${val}";
   mkEnable = mkFlag "enable-" "disable-";
   mkWith = mkFlag "with-" "without-";
-  mkOther = mkFlag "" "" true;
 
   shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;
 
diff --git a/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix b/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
index 111d9952749..1dc2488f55a 100644
--- a/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
+++ b/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
@@ -1,6 +1,5 @@
 {pkgs, buildLispPackage, clwrapper, quicklisp-to-nix-packages}:
 let
-  addDeps = newdeps: x: {deps = x.deps ++ newdeps;};
   addNativeLibs = libs: x: { propagatedBuildInputs = libs; };
   skipBuildPhase = x: {
     overrides = y: ((x.overrides y) // { buildPhase = "true"; });
diff --git a/pkgs/development/mobile/androidenv/androidndk.nix b/pkgs/development/mobile/androidenv/androidndk.nix
index 1e8ea65c73d..fd8651e89cf 100644
--- a/pkgs/development/mobile/androidenv/androidndk.nix
+++ b/pkgs/development/mobile/androidenv/androidndk.nix
@@ -25,9 +25,6 @@ stdenv.mkDerivation rec {
     sed_script_1 =
       "'s|^PROGDIR=`dirname $0`" +
       "|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
-    sed_script_2 =
-      "'s|^MYNDKDIR=`dirname $0`" +
-      "|MYNDKDIR=`dirname $(readlink -f $(which $0))`|'";
     runtime_paths = (lib.makeBinPath [
       coreutils file findutils
       gawk gnugrep gnused
diff --git a/pkgs/development/mobile/androidenv/build-app.nix b/pkgs/development/mobile/androidenv/build-app.nix
index 390c5eb7a20..20b3ff3b8f5 100644
--- a/pkgs/development/mobile/androidenv/build-app.nix
+++ b/pkgs/development/mobile/androidenv/build-app.nix
@@ -7,10 +7,6 @@ args@{ name, src, platformVersions ? [ "8" ], useGoogleAPIs ? false, antFlags ?
 assert release -> keyStore != null && keyAlias != null && keyStorePassword != null && keyAliasPassword != null;
 
 let
-  platformName = if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then "linux"
-    else if stdenv.system == "x86_64-darwin" then "macosx"
-    else throw "Platform: ${stdenv.system} is not supported!";
-
   androidsdkComposition = androidsdk {
     inherit platformVersions useGoogleAPIs;
     abiVersions = [];
diff --git a/pkgs/development/ocaml-modules/pycaml/default.nix b/pkgs/development/ocaml-modules/pycaml/default.nix
index 7421e2fa0b1..46453f30d3b 100644
--- a/pkgs/development/ocaml-modules/pycaml/default.nix
+++ b/pkgs/development/ocaml-modules/pycaml/default.nix
@@ -2,12 +2,7 @@
 
 # This is the original pycaml version with patches from debian.
 
-let debian = fetchurl {
-      url = "mirror://debian/pool/main/p/pycaml/pycaml_0.82-14.debian.tar.gz";
-      sha256 = "a763088ec1fa76c769bf586ed6692e7ac035b0a2bfd48a90a8e7a9539ec0c2f1";
-    };
-
-in stdenv.mkDerivation {
+stdenv.mkDerivation {
   name = "pycaml-0.82-14";
 
   srcs = [
diff --git a/pkgs/development/python-modules/gurobipy/linux.nix b/pkgs/development/python-modules/gurobipy/linux.nix
index 8afe6379dc7..d572b10fd62 100644
--- a/pkgs/development/python-modules/gurobipy/linux.nix
+++ b/pkgs/development/python-modules/gurobipy/linux.nix
@@ -1,10 +1,7 @@
 { fetchurl, python }:
 assert python.pkgs.isPy27;
-let utf =
-  if python.ucsEncoding == 2 then "16"
-  else if python.ucsEncoding == 4 then "32"
-  else throw "Unsupported python UCS encoding UCS${toString python.ucsEncoding}";
-in python.pkgs.buildPythonPackage
+
+python.pkgs.buildPythonPackage
   { pname = "gurobipy";
     version = "7.5.2";
     src = fetchurl
diff --git a/pkgs/development/ruby-modules/testing/stubs.nix b/pkgs/development/ruby-modules/testing/stubs.nix
index 3585681478c..7e6d1102f66 100644
--- a/pkgs/development/ruby-modules/testing/stubs.nix
+++ b/pkgs/development/ruby-modules/testing/stubs.nix
@@ -1,8 +1,5 @@
 { stdenv, lib, ruby, callPackage, ... }:
 let
-  real = {
-    inherit (stdenv) mkDerivation;
-  };
   mkDerivation = {name, ...}@argSet:
   derivation {
     inherit name;
diff --git a/pkgs/development/tools/misc/dialog/default.nix b/pkgs/development/tools/misc/dialog/default.nix
index 82b224b37f4..09d1276ed42 100644
--- a/pkgs/development/tools/misc/dialog/default.nix
+++ b/pkgs/development/tools/misc/dialog/default.nix
@@ -3,8 +3,7 @@
 , unicodeSupport ? true
 }:
 
-let optional = stdenv.lib.optional;
-    optStr = stdenv.lib.optionalString;
+let optStr = stdenv.lib.optionalString;
     buildShared = !stdenv.isDarwin;
 in
 
diff --git a/pkgs/development/tools/phantomjs2/default.nix b/pkgs/development/tools/phantomjs2/default.nix
index 3c062dbe1ab..949d798f7e8 100644
--- a/pkgs/development/tools/phantomjs2/default.nix
+++ b/pkgs/development/tools/phantomjs2/default.nix
@@ -5,24 +5,6 @@
 }:
 
 let
-  fakeXcrun = writeScriptBin "xcrun" ''
-    #!${stdenv.shell}
-    echo >&2 "Fake xcrun: ''$@"
-    args=()
-    while (("$#")); do
-      case "$1" in
-        -sdk*) shift;;
-        -find*) shift;;
-        *) args+=("$1");;
-      esac
-      shift
-    done
-
-    if [ "''${#args[@]}" -gt "0" ]; then
-      echo >&2 "Fake xcrun: ''${args[@]}"
-      exec "''${args[@]}"
-    fi
-  '';
   fakeClang = writeScriptBin "clang" ''
     #!${stdenv.shell}
     if [[ "$@" == *.c ]]; then
diff --git a/pkgs/development/tools/selenium/server/default.nix b/pkgs/development/tools/selenium/server/default.nix
index 3b1e8c2c8a7..c3d71e2b2a3 100644
--- a/pkgs/development/tools/selenium/server/default.nix
+++ b/pkgs/development/tools/selenium/server/default.nix
@@ -6,9 +6,6 @@ with stdenv.lib;
 let
   minorVersion = "3.6";
   patchVersion = "0";
-  arch = if stdenv.system == "x86_64-linux" then "amd64"
-         else if stdenv.system == "i686-linux" then "i386"
-         else "";
 
 in stdenv.mkDerivation rec {
   name = "selenium-server-standalone-${version}";
diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix
index 5eebbf77d2b..6efe004fa9e 100644
--- a/pkgs/games/dwarf-fortress/wrapper/default.nix
+++ b/pkgs/games/dwarf-fortress/wrapper/default.nix
@@ -22,8 +22,6 @@ let
     then builtins.getAttr theme themes
     else theme;
 
-  twbtOnlyWithDFHack = assert (enableDFHack || !enableTWBT); true;
-
   unBool = b: if b then "YES" else "NO";
 
   # These are in inverse order for first packages to override the next ones.
diff --git a/pkgs/games/simutrans/default.nix b/pkgs/games/simutrans/default.nix
index ada2520a097..ccece066cdc 100644
--- a/pkgs/games/simutrans/default.nix
+++ b/pkgs/games/simutrans/default.nix
@@ -16,7 +16,6 @@ let
   ver3 = "2";
   version =   "${ver1}.${ver2}.${ver3}";
   ver_dash =  "${ver1}-${ver2}-${ver3}";
-  ver2_dash = "${ver1}-${ver2}";
 
   binary_src = fetchurl {
     url = "mirror://sourceforge/simutrans/simutrans/${ver_dash}/simutrans-src-${ver_dash}.zip";
diff --git a/pkgs/misc/cups/drivers/canon/default.nix b/pkgs/misc/cups/drivers/canon/default.nix
index 1c0b8e13ab0..9c5ef1d0283 100644
--- a/pkgs/misc/cups/drivers/canon/default.nix
+++ b/pkgs/misc/cups/drivers/canon/default.nix
@@ -4,7 +4,6 @@ let
 
   i686_NIX_GCC = pkgsi686Linux.callPackage ({gcc}: gcc) {};
   i686_libxml2 = pkgsi686Linux.callPackage ({libxml2}: libxml2) {};
-  i686_glibc = pkgsi686Linux.callPackage ({glibc}: glibc) {};
 
   src_canon = fetchurl {
     url = "https://files.canon-europe.com/files/soft45378/software/o147jen_linuxufrII_0290.zip";
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index f45ee7500ed..2438c49d9cb 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -8,18 +8,6 @@ let
   malloc0ReturnsNullCrossFlag = stdenv.lib.optional
     (stdenv.hostPlatform != stdenv.buildPlatform)
     "--enable-malloc0returnsnull";
-
-  gitRelease = { libName, version, rev, sha256 } : attrs : attrs // {
-    name = libName + "-" + version;
-    src = args.fetchgit {
-      url = git://anongit.freedesktop.org/xorg/lib/ + libName;
-      inherit rev sha256;
-    };
-    buildInputs = attrs.buildInputs ++ [ xorg.utilmacros  ];
-    preConfigure = (attrs.preConfigure or "") + "\n./autogen.sh";
-  };
-
-  compose = f: g: x: f (g x);
 in
 {
   bdftopcf = attrs: attrs // {
diff --git a/pkgs/tools/X11/bumblebee/default.nix b/pkgs/tools/X11/bumblebee/default.nix
index 14fe769db6b..7345528dad2 100644
--- a/pkgs/tools/X11/bumblebee/default.nix
+++ b/pkgs/tools/X11/bumblebee/default.nix
@@ -36,11 +36,6 @@
 let
   version = "3.2.1";
 
-  primus = if useNvidia then primusLib else primusLib.override { nvidia_x11 = null; };
-  primus_i686 = if useNvidia then primusLib_i686 else primusLib_i686.override { nvidia_x11 = null; };
-
-  primusLibs = lib.makeLibraryPath ([ primus ] ++ lib.optional (primusLib_i686 != null) primus_i686);
-
   nvidia_x11s = [ nvidia_x11 ]
                 ++ lib.optional nvidia_x11.useGLVND libglvnd
                 ++ lib.optionals (nvidia_x11_i686 != null)
diff --git a/pkgs/tools/admin/ansible/default.nix b/pkgs/tools/admin/ansible/default.nix
index 363214129b2..b942ae6a006 100644
--- a/pkgs/tools/admin/ansible/default.nix
+++ b/pkgs/tools/admin/ansible/default.nix
@@ -3,19 +3,6 @@
 }:
 
 let
-  oldJinja = python2.override {
-    packageOverrides = self: super: {
-      jinja2 = super.jinja2.overridePythonAttrs (oldAttrs: rec {
-        version = "2.8.1";
-        src = oldAttrs.src.override {
-          inherit version;
-          sha256 = "14aqmhkc9rw5w0v311jhixdm6ym8vsm29dhyxyrjfqxljwx1yd1m";
-        };
-        doCheck = false;
-      });
-    };
-  };
-
   generic = { version, sha256, py ? python2 }: py.pkgs.buildPythonPackage rec {
     pname = "ansible";
     inherit version;
diff --git a/pkgs/tools/filesystems/ceph/generic.nix b/pkgs/tools/filesystems/ceph/generic.nix
index 4325a935536..784ca7ec4f6 100644
--- a/pkgs/tools/filesystems/ceph/generic.nix
+++ b/pkgs/tools/filesystems/ceph/generic.nix
@@ -44,8 +44,6 @@ let
   optExpat = shouldUsePkg expat;
   optCurl = shouldUsePkg curl;
   optFuse = shouldUsePkg fuse;
-  optLibibverbs = shouldUsePkg libibverbs;
-  optLibrdmacm = shouldUsePkg librdmacm;
   optLibedit = shouldUsePkg libedit;
   optLibatomic_ops = shouldUsePkg libatomic_ops;
   optKinetic-cpp-client = shouldUsePkg kinetic-cpp-client;
@@ -62,9 +60,6 @@ let
   optLibxfs = shouldUsePkg libxfs;
   optZfs = shouldUsePkg zfs;
 
-  hasMon = true;
-  hasMds = true;
-  hasOsd = true;
   hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
 
 
diff --git a/pkgs/tools/package-management/cargo-edit/cargo-edit.nix b/pkgs/tools/package-management/cargo-edit/cargo-edit.nix
index 042c999be0d..67aa52f4789 100644
--- a/pkgs/tools/package-management/cargo-edit/cargo-edit.nix
+++ b/pkgs/tools/package-management/cargo-edit/cargo-edit.nix
@@ -3,13 +3,6 @@
 
 with pkgs;
 let kernel = buildPlatform.parsed.kernel.name;
-    abi = buildPlatform.parsed.abi.name;
-    include = includedFiles: src: builtins.filterSource (path: type:
-      lib.lists.any (f:
-        let p = toString (src + ("/" + f)); in
-        (path == p) || (type == "directory" && lib.strings.hasPrefix path p)
-      ) includedFiles
-    ) src;
     updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions);
     mapFeatures = features: map (fun: fun { features = features; });
     mkFeatures = feat: lib.lists.foldl (features: featureName:
diff --git a/pkgs/top-level/haxe-packages.nix b/pkgs/top-level/haxe-packages.nix
index 5a85dc3433b..3ac8d5f164d 100644
--- a/pkgs/top-level/haxe-packages.nix
+++ b/pkgs/top-level/haxe-packages.nix
@@ -2,7 +2,6 @@
 
 let
   self = haxePackages;
-  callPackage = newScope self;
   haxePackages = with self; {
 
     withCommas = stdenv.lib.replaceChars ["."] [","];
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
index 017b9fca3f9..520db16d366 100644
--- a/pkgs/top-level/lua-packages.nix
+++ b/pkgs/top-level/lua-packages.nix
@@ -13,7 +13,6 @@
 }:
 
 let
-  isLua51 = lua.luaversion == "5.1";
   isLua52 = lua.luaversion == "5.2";
   isLuaJIT = (builtins.parseDrvName lua.name).name == "luajit";