NixOS-Speak/release.nix

60 lines
2.2 KiB
Nix

# This file is heavily inspired by <nixpkgs/nixos/release.nix>
{ nixpkgs ? <nixpkgs> # builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-20.03.tar.gz
, targetSystem ? builtins.currentSystem
, speak ? ./. #builtins.fetchGit ./.
, configuration ? ./extra/exampleConfig.nix #{ imports = [ (speak + builtins.toPath "/options/espeak.nix") ]; config.speak.enable = true; config.sound.enable = true; }
}:
with builtins;
with import (nixpkgs + (toPath "/lib"));
let
pkgs = import nixpkgs { system = targetSystem; };
tarball = pkgs.releaseTools.sourceTarball {
name = "speak-tarball";
src = speak;
};
modulePath = (nixpkgs + (toPath "/nixos/modules"));
makeTarget = target:
with import nixpkgs { system = targetSystem; };
((import (nixpkgs + (toPath "/nixos/lib/eval-config.nix")) {
system = targetSystem;
modules = target.modules ++ [ configuration ];
}).config.system.build);
makeSubTargets = target: {
isoImage = hydraJob (makeTarget (mergeAttrsConcatenateValues target {
modules = [
{ isoImage.isoBaseName = "nixos-${target.name}"; }
];
})).isoImage;
tarball = hydraJob (makeTarget (mergeAttrsConcatenateValues target {
modules = [ (modulePath + toPath "/installer/cd-dvd/system-tarball.nix") ];
})).tarball;
vm = (makeTarget (mergeAttrsConcatenateValues target {
modules = [ (modulePath + toPath "/virtualisation/qemu-vm.nix") { config.virtualisation.qemu.options = [ "-soundhw hda" ]; } ];
})).vm;
};
targets = rec {
minimal = {
name = "minimal";
modules = [
(modulePath + (toPath "/installer/cd-dvd/installation-cd-minimal.nix"))
(modulePath + (toPath "/installer/cd-dvd/channel.nix"))
];
};
mate = {
name = "mate";
modules = [
(modulePath + (toPath "/installer/cd-dvd/installation-cd-graphical-base.nix"))
./modules/mate.nix
(modulePath + (toPath "/installer/cd-dvd/channel.nix"))
];
};
};
allTargets = mapAttrs (name: value: (makeSubTargets value)) targets;
in {
inherit tarball;
image = allTargets;
pkgs.espeakup = hydraJob (pkgs.callPackage ./pkgs/espeakup.nix {});
}