nix: set NIX_PATH per device versions at buildtime
Previously all devices would have NIX_PATH set on the common verion file defindd in *nix/variables/versions.nix*. Now NIX_PATH is populated with the versions of the respective device.
This commit is contained in:
parent
3bcf7b0397
commit
522d7279bd
10 changed files with 77 additions and 48 deletions
|
@ -1,31 +1,34 @@
|
|||
{ versionsPath }:
|
||||
|
||||
{
|
||||
channelSources =
|
||||
let
|
||||
channelVersions = (import versionsPath);
|
||||
mkChannelSource = channel:
|
||||
let
|
||||
channelVersions = (import versionsPath);
|
||||
mkChannelSource = channel:
|
||||
let
|
||||
channelVersion = builtins.getAttr channel channelVersions;
|
||||
in builtins.fetchGit {
|
||||
# Descriptive name to make the store path easier to identify
|
||||
name = "nixpkgs-channels-${channel}";
|
||||
url = if builtins.hasAttr "url" channelVersion
|
||||
then channelVersion."url"
|
||||
else "https://github.com/NixOS/nixpkgs-channels/"
|
||||
;
|
||||
ref = (builtins.getAttr channel channelVersions)."ref";
|
||||
rev = (builtins.getAttr channel channelVersions)."rev";
|
||||
};
|
||||
nix_path = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [
|
||||
[ "nixpkgs" (mkChannelSource "channelsNixosStable") ]
|
||||
[ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ]
|
||||
[ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ]
|
||||
[ "channels-nixos-unstable" (mkChannelSource "channelsNixosUnstable") ]
|
||||
[ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ]
|
||||
[ "home-manager-module" (mkChannelSource "homeManagerModule") ]
|
||||
];
|
||||
in (import (mkChannelSource "channelsNixosStable") {}).writeText "channels.rc" ''
|
||||
export NIX_PATH=${nix_path}
|
||||
'';
|
||||
}
|
||||
channelVersion = builtins.getAttr channel channelVersions;
|
||||
in builtins.fetchGit {
|
||||
# Descriptive name to make the store path easier to identify
|
||||
name = "nixpkgs-channels-${channel}";
|
||||
url = if builtins.hasAttr "url" channelVersion
|
||||
then channelVersion."url"
|
||||
else "https://github.com/NixOS/nixpkgs-channels/"
|
||||
;
|
||||
ref = (builtins.getAttr channel channelVersions)."ref";
|
||||
rev = (builtins.getAttr channel channelVersions)."rev";
|
||||
};
|
||||
nixPath = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [
|
||||
[ "nixpkgs" (mkChannelSource "channelsNixosStable") ]
|
||||
[ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ]
|
||||
[ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ]
|
||||
[ "channels-nixos-unstable" (mkChannelSource "channelsNixosUnstable") ]
|
||||
[ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ]
|
||||
[ "home-manager-module" (mkChannelSource "homeManagerModule") ]
|
||||
];
|
||||
pkgs = import (mkChannelSource "channelsNixosStable") {};
|
||||
in
|
||||
|
||||
{
|
||||
inherit nixPath;
|
||||
channelSources = pkgs.writeText "channels.rc" ''
|
||||
export NIX_PATH=${nixPath}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue