forgejo-ci-runners/flake.nix

119 lines
4 KiB
Nix
Raw Normal View History

2024-05-14 12:03:36 -05:00
{
description = "Forgejo CI Runners";
inputs = {
2024-05-26 10:57:51 -05:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
2024-05-14 12:03:36 -05:00
srvos.url = "github:numtide/srvos";
disko.url = "github:nix-community/disko";
2024-06-18 23:46:58 -05:00
cachix-deploy-flake.url = "github:cachix/cachix-deploy-flake";
2024-06-19 00:48:47 -05:00
cachix-flake = {
url = "github:cachix/cachix";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-05-14 12:03:36 -05:00
# sops-nix - secrets with mozilla sops
# https://github.com/Mic92/sops-nix
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-06-19 00:48:47 -05:00
outputs = { self, sops-nix, nixpkgs, srvos, disko, cachix-flake, cachix-deploy-flake, ... }@inputs:
let
lib = nixpkgs.lib;
common = system: rec {
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
cachix = cachix-flake.packages.${system}.default;
})
];
};
cachix-deploy-lib = cachix-deploy-flake.lib pkgs;
};
aarch64-linux-modules = [
sops-nix.nixosModules.sops
2024-06-19 00:48:47 -05:00
srvos.nixosModules.hardware-hetzner-cloud
srvos.nixosModules.server
srvos.nixosModules.mixins-systemd-boot
disko.nixosModules.disko
./agents/fj-hetzner-aarch64.nix
(import ./disko-hetzner-cloud.nix { disks = [ "/dev/sda" ]; })
{
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "fj-hetzner-aarch64-01";
users.users.root.openssh.authorizedKeys.keys =
[
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w jahanson@legiondary"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyA/yMPPo+scxBaDFUk7WeEyMAMhXUro5vi4feOKsJT jahanson@durincore"
];
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "without-password";
}
];
x86_64-linux-modules = [
sops-nix.nixosModules.sops
./hardware/shadowfax-kubevirt.nix
srvos.nixosModules.server
srvos.nixosModules.mixins-systemd-boot
disko.nixosModules.disko
./agents/fj-shadowfax-x86_64.nix
(import ./disko-shadowfax-kubevirt.nix { disks = [ "/dev/sda" ]; })
{
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "fj-shadowfax-01";
users.users.root.openssh.authorizedKeys.keys =
[
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w jahanson@legiondary"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyA/yMPPo+scxBaDFUk7WeEyMAMhXUro5vi4feOKsJT jahanson@durincore"
];
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "without-password";
}
];
in
{
nixosConfigurations =
{
"fj-hetzner-aarch64-01" = lib.nixosSystem {
system = "aarch64-linux";
specialArgs = {inherit inputs; };
modules = [ aarch64-linux-modules ];
};
"fj-shadowfax-01" = lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs; };
modules = [ x86_64-linux-modules ];
};
};
packages.aarch64-linux.default =
let
inherit (common "aarch64-linux") cachix-deploy-lib pkgs;
in
cachix-deploy-lib.nixos {
# system = "aarch64-linux";
imports = aarch64-linux-modules;
2024-05-14 12:03:36 -05:00
};
2024-06-19 00:48:47 -05:00
packages.x86_64-linux.default =
let
inherit (common "x86_64-linux") cachix-deploy-lib pkgs;
in
cachix-deploy-lib.nixos {
imports = x86_64-linux-modules;
2024-06-19 00:48:47 -05:00
};
2024-05-26 19:38:35 -05:00
# Convenience output that aggregates the outputs for home, nixos.
# Also used in ci to build targets generally.
top =
let
nixtop = nixpkgs.lib.genAttrs
(builtins.attrNames inputs.self.nixosConfigurations)
(attr: inputs.self.nixosConfigurations.${attr}.config.system.build.toplevel);
in
nixtop;
};
2024-05-14 12:03:36 -05:00
}