forked from the-distro/ofborg
Build a proper release.nix
This commit is contained in:
parent
38d9bb3392
commit
3313356522
1 changed files with 53 additions and 5 deletions
58
release.nix
58
release.nix
|
@ -1,11 +1,59 @@
|
||||||
{ nixpkgs ? ./nix
|
{ nixpkgs ? ./nix
|
||||||
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
|
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {};
|
pkgs = import nixpkgs {};
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
ofborgpkgs = lib.genAttrs supportedSystems (system:
|
# An attrset of borgpkgs per supportedSystem:
|
||||||
(import ./default.nix { pkgs = import nixpkgs { inherit system; }; })
|
#
|
||||||
);
|
# {
|
||||||
in ofborgpkgs
|
# "x86_64-linux" = ...
|
||||||
|
# "x86_64-darwin" = ...
|
||||||
|
# }
|
||||||
|
borgpkgs-per-arch = builtins.foldl'
|
||||||
|
(collector: system:
|
||||||
|
collector // {
|
||||||
|
"${system}" = import ./. {
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{} supportedSystems;
|
||||||
|
|
||||||
|
attrForSystem = system: attrpath:
|
||||||
|
if borgpkgs-per-arch ? "${system}"
|
||||||
|
then (
|
||||||
|
let
|
||||||
|
borgpkgs = borgpkgs-per-arch."${system}";
|
||||||
|
in if lib.hasAttrByPath attrpath borgpkgs
|
||||||
|
then lib.setAttrByPath
|
||||||
|
(attrpath ++ [system])
|
||||||
|
(lib.attrByPath attrpath "bogus" borgpkgs)
|
||||||
|
else throw "Failed to find ${toString attrpath} for ${system} in borgpkgs"
|
||||||
|
)
|
||||||
|
else throw "No such system ${system}";
|
||||||
|
|
||||||
|
attrsForAllSystems = path:
|
||||||
|
builtins.foldl'
|
||||||
|
(collector: system:
|
||||||
|
lib.recursiveUpdate collector (attrForSystem system path)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
supportedSystems;
|
||||||
|
|
||||||
|
merge = attrsets:
|
||||||
|
builtins.foldl'
|
||||||
|
(collector: set: lib.recursiveUpdate set collector)
|
||||||
|
{}
|
||||||
|
attrsets;
|
||||||
|
|
||||||
|
x8664LinuxOnly = path:
|
||||||
|
(attrForSystem "x86_64-linux" path);
|
||||||
|
|
||||||
|
in merge [
|
||||||
|
(attrsForAllSystems [ "ofborg" "rs" ])
|
||||||
|
|
||||||
|
(x8664LinuxOnly [ "ofborg" "php" ])
|
||||||
|
(x8664LinuxOnly [ "ircbot" ])
|
||||||
|
]
|
||||||
|
|
Loading…
Reference in a new issue