Add release code for building channel (drop nixpkgs submodule)
Decided it would be best if hydra just provided the latest stable nixpkgs for us to use. This way there is no need for an udpate script that polutes our logs with update submodule commits.
This commit is contained in:
68
default.nix
68
default.nix
@@ -13,21 +13,21 @@ let
|
||||
# at a given level (the leading number) the search is stopped and they are used. If multiple overlays are found
|
||||
# at a given level then an error is generated.
|
||||
#
|
||||
# 1: <nixpkgs-overlays> (i.e., nixpkgs-overlays.nix or nixpkgs-overlays/default.nix in NIX_PATH)
|
||||
# 2: ~/.config/nixpkgs/overlays.nix
|
||||
# 2: ~/.config/nixpkgs/overlays
|
||||
# 1. <nixpkgs-overlays> (i.e., nixpkgs-overlays.nix or nixpkgs-overlays/default.nix in NIX_PATH)
|
||||
# 2. ~/.config/nixpkgs/overlays.nix
|
||||
# 2. ~/.config/nixpkgs/overlays
|
||||
#
|
||||
# This code is lifted directly from nixpkgs/pkgs/top-level/impure.nix to ensure consistency.
|
||||
#
|
||||
overlaysDefault =
|
||||
let
|
||||
|
||||
# isDir path - Is path a directory (requires access).
|
||||
isDir = path: pathExists (path + "/.");
|
||||
|
||||
# try expression default - Replace expression with default on exception.
|
||||
try = x: def: let res = tryEval x; in if res.success then res.value else def;
|
||||
|
||||
# isDir path - Is path a directory (requires access).
|
||||
isDir = path: pathExists (path + "/.");
|
||||
|
||||
# overlaysRetrieve path - Retrieve a list of the overlay functions from path.
|
||||
# path is file - import the file itself (should give a list of overlay functions)
|
||||
# path is directory - list of imports of all the *.nix files in the directory (each should give an overlay function)
|
||||
@@ -53,6 +53,7 @@ let
|
||||
homeOverlaysDir = homeDir + "/.config/nixpkgs/overlays";
|
||||
|
||||
in
|
||||
|
||||
if pathOverlays != "" && pathExists pathOverlays then overlaysRetrieve pathOverlays
|
||||
else if pathExists homeOverlaysFile && pathExists homeOverlaysDir then
|
||||
throw ''
|
||||
@@ -82,7 +83,7 @@ let
|
||||
let
|
||||
# knot - Feed final and up to and over us overlay results into overlay
|
||||
#
|
||||
# This matche what is done in nixpkgs (see pkgs/top-level/stage.nix).
|
||||
# This matches what is done in nixpkgs (see pkgs/top-level/stage.nix).
|
||||
#
|
||||
knot = path: self: super:
|
||||
let res = import path res self; in res;
|
||||
@@ -92,8 +93,57 @@ let
|
||||
./pkgs/all-packages.nix
|
||||
];
|
||||
|
||||
# nixpkgs - The underlying nixpkg to use.
|
||||
#
|
||||
# Get a usable nixpkgs, that is, one with a version that matches ours, or die.
|
||||
#
|
||||
nixpkgs =
|
||||
let
|
||||
|
||||
# first check list - Return first element of list that passes check list otherwise aborts.
|
||||
#
|
||||
first = check: list:
|
||||
if list == []
|
||||
then builtins.throw ''
|
||||
Unable to locate a suitable nixpkgs directory.
|
||||
Most likely you want to git clone one into the top of the repo as 'upstream'.
|
||||
''
|
||||
else if check ( builtins.head list )
|
||||
then builtins.head list
|
||||
else first check ( builtins.tail list );
|
||||
|
||||
# okay path - Check if path exist and match our version number and otherwise print a warning.
|
||||
#
|
||||
# Version numbers are taken from ./version files.
|
||||
#
|
||||
okay =
|
||||
let
|
||||
version = builtins.readFile ./.version;
|
||||
in
|
||||
path:
|
||||
( builtins.pathExists (path + /.version)
|
||||
&& ( builtins.readFile (path + /.version) == version
|
||||
|| builtins.trace ''
|
||||
Skipping ${path} as not version ${version}.
|
||||
'' false ) );
|
||||
|
||||
# paths - Paths to search for nixpkgs.
|
||||
#
|
||||
paths = [
|
||||
./upstream # 1. build channel or git cloned one directly associated with us takes priority
|
||||
<nixpkgs/upstream> # 2. if the channel is a version of ourselves the real one will be in a subdirectory
|
||||
<nixpkgs> # 3. otherwise maybe the channel is a nixpkgs proper
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
first okay paths;
|
||||
|
||||
in
|
||||
|
||||
{ overlays ? overlaysDefault
|
||||
, ... } @ args:
|
||||
import ./nixpkgs (args // { overlays = overlaysAlways ++ overlays; })
|
||||
, upstream ? nixpkgs
|
||||
, ... } @ args:
|
||||
|
||||
import upstream ( builtins.removeAttrs args [ "upstream" ]
|
||||
// { overlays = overlaysAlways ++ overlays; } )
|
||||
|
||||
Reference in New Issue
Block a user