infra/nix/default.nix

37 lines
916 B
Nix
Raw Normal View History

2024-11-15 10:17:56 +01:00
{ versionsPath }:
let
2023-02-07 18:23:51 +01:00
channelVersions = import versionsPath;
2024-11-15 10:17:56 +01:00
mkChannelSource =
name:
let
channelVersion = builtins.getAttr name channelVersions;
in
2023-02-07 18:23:51 +01:00
builtins.fetchGit {
# Descriptive name to make the store path easier to identify
inherit name;
inherit (channelVersion) url ref rev;
2022-10-31 11:04:38 +01:00
};
2024-11-15 10:17:56 +01:00
nixPath = builtins.concatStringsSep ":" (
builtins.map (
elemName:
let
elem = builtins.getAttr elemName channelVersions;
elemPath = mkChannelSource elemName;
suffix = if builtins.hasAttr "suffix" elem then elem.suffix else "";
in
builtins.concatStringsSep "=" [
elemName
elemPath
]
+ suffix
) (builtins.attrNames channelVersions)
);
pkgs = import (mkChannelSource "nixpkgs") { };
in
{
inherit nixPath;
channelSources = pkgs.writeText "channels.rc" ''
export NIX_PATH=${nixPath}
'';
}