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
23 changes: 12 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@

outputs = { self }:
let
jobs = import ./pkgs/top-level/release.nix {
nixpkgs = self;
};

lib = import ./lib;

forAllSystems = lib.genAttrs lib.systems.flakeExposed;
in
{
lib = lib.extend (final: prev: {

lib = (import ./lib).extend (final: prev: {
nixos = import ./nixos/lib { lib = final; };

nixosSystem = args:
import ./nixos/lib/eval-config.nix (
args // {
lib = args.lib or final;
modules = args.modules ++ [{
system.nixos.versionSuffix =
".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";
Expand All @@ -35,6 +26,16 @@
);
});

jobs = import ./pkgs/top-level/release.nix {
inherit lib;
nixpkgs = self;
};

forAllSystems = lib.genAttrs lib.systems.flakeExposed;
in
{
inherit lib;

checks.x86_64-linux.tarball = jobs.tarball;

htmlDocs = {
Expand Down
3 changes: 2 additions & 1 deletion nixos/lib/testing-python.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
args@
{ system
, pkgs ? import ../.. { inherit system config; }
, lib ? import ../../lib
, pkgs ? import ../.. { inherit system config lib; }
# Use a minimal kernel?
, minimal ? false
# Ignored
Expand Down
11 changes: 7 additions & 4 deletions nixos/release-combined.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# and nixos-14.04). The channel is updated every time the ‘tested’ job
# succeeds, and all other jobs have finished (they may fail).

{ nixpkgs ? { outPath = (import ../lib).cleanSource ./..; revCount = 56789; shortRev = "gfedcba"; }
{ lib ? import ../lib
, nixpkgs ? { outPath = lib.cleanSource ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
, supportedSystems ? [ "aarch64-linux" "x86_64-linux" ]
, limitedSupportedSystems ? [ "i686-linux" ]
Expand All @@ -12,7 +13,9 @@ let

nixpkgsSrc = nixpkgs; # urgh

pkgs = import ./.. {};
pkgs = import ./.. {
inherit lib;
};

removeMaintainers = set: if builtins.isAttrs set
then if (set.type or "") == "derivation"
Expand All @@ -23,13 +26,13 @@ let
in rec {

nixos = removeMaintainers (import ./release.nix {
inherit stableBranch;
inherit stableBranch lib;
supportedSystems = supportedSystems ++ limitedSupportedSystems;
nixpkgs = nixpkgsSrc;
});

nixpkgs = builtins.removeAttrs (removeMaintainers (import ../pkgs/top-level/release.nix {
inherit supportedSystems;
inherit supportedSystems lib;
nixpkgs = nixpkgsSrc;
})) [ "unstable" ];

Expand Down
14 changes: 8 additions & 6 deletions nixos/release-small.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# small subset of Nixpkgs, mostly useful for servers that need fast
# security updates.

{ nixpkgs ? { outPath = (import ../lib).cleanSource ./..; revCount = 56789; shortRev = "gfedcba"; }
{ lib ? import ../lib
, nixpkgs ? { outPath = lib.cleanSource ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
, supportedSystems ? [ "aarch64-linux" "x86_64-linux" ] # no i686-linux
}:
Expand All @@ -11,17 +12,18 @@ let

nixpkgsSrc = nixpkgs; # urgh

pkgs = import ./.. { system = "x86_64-linux"; };

lib = pkgs.lib;
pkgs = import ./.. {
inherit lib;
system = "x86_64-linux";
};

nixos' = import ./release.nix {
inherit stableBranch supportedSystems;
inherit stableBranch supportedSystems lib;
nixpkgs = nixpkgsSrc;
};

nixpkgs' = builtins.removeAttrs (import ../pkgs/top-level/release.nix {
inherit supportedSystems;
inherit supportedSystems lib;
nixpkgs = nixpkgsSrc;
}) [ "unstable" ];

Expand Down
12 changes: 6 additions & 6 deletions nixos/release.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
with import ../lib;

{ nixpkgs ? { outPath = cleanSource ./..; revCount = 130979; shortRev = "gfedcba"; }
{ lib ? import ../lib
, nixpkgs ? { outPath = lib.cleanSource ./..; revCount = 130979; shortRev = "gfedcba"; }
, stableBranch ? false
, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ]
, configuration ? {}
}:

with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; };
with lib;
with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems lib; };

let

Expand All @@ -21,7 +21,7 @@ let
allTestsForSystem = system:
import ./tests/all-tests.nix {
inherit system;
pkgs = import ./.. { inherit system; };
pkgs = import ./.. { inherit system lib; };
callTest = config: {
${system} = hydraJob config.test;
};
Expand All @@ -31,7 +31,7 @@ let
allDrivers =
import ./tests/all-tests.nix {
inherit system;
pkgs = import ./.. { inherit system; };
pkgs = import ./.. { inherit system lib; };
callTest = config: {
${system} = hydraJob config.driver;
};
Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ let
if elem system systems then handleTest path args
else {};

# TODO: make this overridable?
nixosLib = import ../lib {
# Experimental features need testing too, but there's no point in warning
# about it, so we enable the feature flag.
Expand Down
5 changes: 3 additions & 2 deletions pkgs/top-level/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
# list it returns.
stdenvStages ? import ../stdenv

, # Library functions for Nixpkgs
lib ? import ../../lib

, # Ignore unexpected args.
...
} @ args:
Expand All @@ -47,8 +50,6 @@ let # Rename the function arguments
crossSystem0 = crossSystem;

in let
lib = import ../../lib;

inherit (lib) throwIfNot;

checked =
Expand Down
1 change: 1 addition & 0 deletions pkgs/top-level/impure.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ in
else []

, crossOverlays ? []
, lib ? import ../../lib

, ...
} @ args:
Expand Down
7 changes: 2 additions & 5 deletions pkgs/top-level/release-lib.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{ supportedSystems
, lib ? import ../../lib
, packageSet ? (import ../..)
, scrubJobs ? true
, # Attributes passed to nixpkgs. Don't build packages marked as unfree.
nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; }
}:

let
lib = import ../../lib;
in with lib;

with lib;
rec {

pkgs = packageSet (lib.recursiveUpdate { system = "x86_64-linux"; config.allowUnsupportedSystem = true; } nixpkgsArgs);
Expand Down
5 changes: 3 additions & 2 deletions pkgs/top-level/release-small.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* A small release file, with few packages to be built. The aim is to reduce
the load on Hydra when testing the `stdenv-updates' branch. */

{ nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; }
{ lib ? import ../../lib
, nixpkgs ? { outPath = lib.cleanSource ../..; revCount = 1234; shortRev = "abcdef"; }
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
, # Attributes passed to nixpkgs. Don't build packages marked as unfree.
nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; }
}:

with import ./release-lib.nix { inherit supportedSystems nixpkgsArgs; };
with import ./release-lib.nix { inherit supportedSystems nixpkgsArgs lib; };

{

Expand Down
5 changes: 3 additions & 2 deletions pkgs/top-level/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

$ nix-build pkgs/top-level/release.nix -A coreutils.x86_64-linux
*/
{ nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; }
{ lib ? import ../../lib
, nixpkgs ? { outPath = lib.cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; }
, officialRelease ? false
# The platforms for which we build Nixpkgs.
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]
Expand All @@ -19,7 +20,7 @@
, nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; }
}:

with import ./release-lib.nix { inherit supportedSystems scrubJobs nixpkgsArgs; };
with import ./release-lib.nix { inherit supportedSystems scrubJobs nixpkgsArgs lib; };

let

Expand Down