All checks were successful
Check Flake / check-flake (push) Successful in 1h32m23s
Flake lock file updates: • Updated input 'agenix': 'github:ryantm/agenix/c2fc0762bbe8feb06a2e59a364fa81b3a57671c9' (2024-05-24) → 'github:ryantm/agenix/f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41' (2024-08-10) • Updated input 'deploy-rs': 'github:serokell/deploy-rs/3867348fa92bc892eba5d9ddb2d7a97b9e127a8a' (2024-06-12) → 'github:serokell/deploy-rs/aa07eb05537d4cd025e2310397a6adcedfe72c76' (2024-09-27) • Updated input 'flake-utils': 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11) → 'github:numtide/flake-utils/c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a' (2024-09-17) • Updated input 'nix-index-database': 'github:Mic92/nix-index-database/ff80cb4a11bb87f3ce8459be6f16a25ac86eb2ac' (2024-05-27) → 'github:Mic92/nix-index-database/5fce10c871bab6d7d5ac9e5e7efbb3a2783f5259' (2024-10-07) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/7b49d3967613d9aacac5b340ef158d493906ba79' (2024-06-01) → 'github:NixOS/nixos-hardware/b7ca02c7565fbf6d27ff20dd6dbd49c5b82eef28' (2024-10-04) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/805a384895c696f802a9bf5bf4720f37385df547' (2024-05-31) → 'github:NixOS/nixpkgs/ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6' (2024-10-06) • Updated input 'simple-nixos-mailserver': 'gitlab:simple-nixos-mailserver/nixos-mailserver/29916981e7b3b5782dc5085ad18490113f8ff63b' (2024-06-11) → 'gitlab:simple-nixos-mailserver/nixos-mailserver/af7d3bf5daeba3fc28089b015c0dd43f06b176f2' (2024-08-05) • Removed input 'simple-nixos-mailserver/utils'
187 lines
5.7 KiB
Nix
187 lines
5.7 KiB
Nix
{
|
|
inputs = {
|
|
# nixpkgs
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
nixpkgs-frigate.url = "github:NixOS/nixpkgs/5cfafa12d57374f48bcc36fda3274ada276cf69e";
|
|
|
|
# Common Utils Among flake inputs
|
|
systems.url = "github:nix-systems/default";
|
|
flake-utils = {
|
|
url = "github:numtide/flake-utils";
|
|
inputs.systems.follows = "systems";
|
|
};
|
|
flake-compat = {
|
|
url = "github:edolstra/flake-compat";
|
|
flake = false;
|
|
};
|
|
|
|
# NixOS hardware
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
|
|
|
# Mail Server
|
|
simple-nixos-mailserver = {
|
|
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
nixpkgs-24_05.follows = "nixpkgs";
|
|
flake-compat.follows = "flake-compat";
|
|
};
|
|
};
|
|
|
|
# Agenix
|
|
agenix = {
|
|
url = "github:ryantm/agenix";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
systems.follows = "systems";
|
|
};
|
|
};
|
|
|
|
# Radio
|
|
radio = {
|
|
url = "git+https://git.neet.dev/zuckerberg/radio.git?ref=main&rev=5bf607fed977d41a269942a7d1e92f3e6d4f2473";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
flake-utils.follows = "flake-utils";
|
|
};
|
|
};
|
|
radio-web = {
|
|
url = "git+https://git.neet.dev/zuckerberg/radio-web.git";
|
|
flake = false;
|
|
};
|
|
|
|
# Dailybot
|
|
dailybuild_modules = {
|
|
url = "git+https://git.neet.dev/zuckerberg/dailybot.git";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
flake-utils.follows = "flake-utils";
|
|
};
|
|
};
|
|
|
|
# NixOS deployment
|
|
deploy-rs = {
|
|
url = "github:serokell/deploy-rs";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
flake-compat.follows = "flake-compat";
|
|
utils.follows = "flake-utils";
|
|
};
|
|
};
|
|
|
|
# Prebuilt nix-index database
|
|
nix-index-database = {
|
|
url = "github:Mic92/nix-index-database";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, ... }@inputs:
|
|
let
|
|
machines = (import ./common/machine-info/moduleless.nix
|
|
{
|
|
inherit nixpkgs;
|
|
assertionsModule = "${nixpkgs}/nixos/modules/misc/assertions.nix";
|
|
}).machines.hosts;
|
|
in
|
|
{
|
|
nixosConfigurations =
|
|
let
|
|
modules = system: hostname: with inputs; [
|
|
./common
|
|
simple-nixos-mailserver.nixosModule
|
|
agenix.nixosModules.default
|
|
dailybuild_modules.nixosModule
|
|
nix-index-database.nixosModules.nix-index
|
|
self.nixosModules.kernel-modules
|
|
({ lib, ... }: {
|
|
config = {
|
|
nixpkgs.overlays = [ self.overlays.default ];
|
|
|
|
environment.systemPackages = [
|
|
agenix.packages.${system}.agenix
|
|
];
|
|
|
|
networking.hostName = hostname;
|
|
};
|
|
|
|
# because nixos specialArgs doesn't work for containers... need to pass in inputs a different way
|
|
options.inputs = lib.mkOption { default = inputs; };
|
|
options.currentSystem = lib.mkOption { default = system; };
|
|
})
|
|
];
|
|
|
|
mkSystem = system: nixpkgs: path: hostname:
|
|
let
|
|
allModules = modules system hostname;
|
|
|
|
# allow patching nixpkgs, remove this hack once this is solved: https://github.com/NixOS/nix/issues/3920
|
|
patchedNixpkgsSrc = nixpkgs.legacyPackages.${system}.applyPatches {
|
|
name = "nixpkgs-patched";
|
|
src = nixpkgs;
|
|
patches = [
|
|
./patches/gamepadui.patch
|
|
];
|
|
};
|
|
patchedNixpkgs = nixpkgs.lib.fix (self: (import "${patchedNixpkgsSrc}/flake.nix").outputs { self = nixpkgs; });
|
|
|
|
in
|
|
patchedNixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = allModules ++ [ path ];
|
|
|
|
specialArgs = {
|
|
inherit allModules;
|
|
lib = self.lib;
|
|
nixos-hardware = inputs.nixos-hardware;
|
|
};
|
|
};
|
|
in
|
|
nixpkgs.lib.mapAttrs
|
|
(hostname: cfg:
|
|
mkSystem cfg.arch nixpkgs cfg.configurationPath hostname)
|
|
machines;
|
|
|
|
packages =
|
|
let
|
|
mkKexec = system:
|
|
(nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [ ./machines/ephemeral/kexec.nix ];
|
|
}).config.system.build.kexec_tarball;
|
|
mkIso = system:
|
|
(nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [ ./machines/ephemeral/iso.nix ];
|
|
}).config.system.build.isoImage;
|
|
in
|
|
{
|
|
"x86_64-linux"."kexec" = mkKexec "x86_64-linux";
|
|
"x86_64-linux"."iso" = mkIso "x86_64-linux";
|
|
"aarch64-linux"."kexec" = mkKexec "aarch64-linux";
|
|
"aarch64-linux"."iso" = mkIso "aarch64-linux";
|
|
};
|
|
|
|
overlays.default = import ./overlays { inherit inputs; };
|
|
nixosModules.kernel-modules = import ./overlays/kernel-modules;
|
|
|
|
deploy.nodes =
|
|
let
|
|
mkDeploy = configName: arch: hostname: {
|
|
inherit hostname;
|
|
magicRollback = false;
|
|
sshUser = "root";
|
|
profiles.system.path = inputs.deploy-rs.lib.${arch}.activate.nixos self.nixosConfigurations.${configName};
|
|
};
|
|
in
|
|
nixpkgs.lib.mapAttrs
|
|
(hostname: cfg:
|
|
mkDeploy hostname cfg.arch (builtins.head cfg.hostNames))
|
|
machines;
|
|
|
|
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
|
|
|
|
lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = nixpkgs.lib; });
|
|
};
|
|
}
|