forked from Fediversity/simple-nixos-fediverse
106 lines
2.5 KiB
Nix
106 lines
2.5 KiB
Nix
{ inputs ? import ./npins
|
|
, system ? builtins.currentSystem
|
|
, pkgs ? import inputs.nixpkgs { config = { }; overlays = [ ]; inherit system; }
|
|
, lib ? import "${inputs.nixpkgs}/lib"
|
|
// {
|
|
nixosSystem = args:
|
|
import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"
|
|
(
|
|
{
|
|
inherit lib;
|
|
# Allow system to be set modularly in nixpkgs.system.
|
|
# We set it to null, to remove the "legacy" entrypoint's
|
|
# non-hermetic default.
|
|
system = null;
|
|
|
|
modules = args.modules;
|
|
}
|
|
// builtins.removeAttrs args [ "modules" ]
|
|
);
|
|
}
|
|
,
|
|
}:
|
|
rec {
|
|
nixosModules = {
|
|
disko = "${inputs.disko}/module.nix";
|
|
disk-layout = import ./vm/disk-layout.nix;
|
|
interactive-vm = import ./vm/interactive-vm.nix;
|
|
mastodon-vm = import ./vm/mastodon-vm.nix;
|
|
peertube-vm = import ./vm/peertube-vm.nix;
|
|
pixelfed-vm = import ./vm/pixelfed-vm.nix;
|
|
};
|
|
|
|
# test with
|
|
# nix-build -A nixosConfigurations.<config>.installTest
|
|
nixosConfigurations = {
|
|
mastodon = lib.nixosSystem {
|
|
inherit system;
|
|
modules = with nixosModules; [
|
|
disko
|
|
disk-layout
|
|
interactive-vm
|
|
mastodon-vm
|
|
];
|
|
};
|
|
|
|
peertube = lib.nixosSystem {
|
|
inherit system;
|
|
modules = with nixosModules; [
|
|
disko
|
|
disk-layout
|
|
interactive-vm
|
|
peertube-vm
|
|
];
|
|
};
|
|
|
|
pixelfed = lib.nixosSystem {
|
|
inherit system;
|
|
modules = with nixosModules; [
|
|
disko
|
|
disk-layout
|
|
interactive-vm
|
|
pixelfed-vm
|
|
];
|
|
};
|
|
|
|
all = lib.nixosSystem {
|
|
inherit system;
|
|
modules = with nixosModules; [
|
|
interactive-vm
|
|
disko
|
|
disk-layout
|
|
peertube-vm
|
|
pixelfed-vm
|
|
mastodon-vm
|
|
];
|
|
};
|
|
};
|
|
|
|
# build with
|
|
# nix-build -A installers.<config>
|
|
installers =
|
|
let
|
|
installer = (import ./installer.nix) { inherit lib; outPath = inputs.nixpkgs; };
|
|
in
|
|
lib.mapAttrs (_: config: installer config) nixosConfigurations;
|
|
|
|
# run with
|
|
# $(nix-build -A deploy.<machine> --no-out-link)/bin/deploy
|
|
deploy =
|
|
let
|
|
deployCommand = (pkgs.callPackage ./deploy.nix { });
|
|
in
|
|
lib.mapAttrs (name: config: deployCommand name config) nixosConfigurations;
|
|
|
|
tests = {
|
|
mastodon-garage = import ./tests/mastodon-garage.nix { inherit pkgs; };
|
|
pixelfed-garage = import ./tests/pixelfed-garage.nix { inherit pkgs; };
|
|
};
|
|
|
|
shell = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
nil
|
|
];
|
|
};
|
|
}
|