{ description = "viv configs"; # inspo: https://gitlab.com/rprospero/dotfiles/-/blob/master/flake.nix inputs = { # update a single input; nix flake lock --update-input nixpkgs nixpkgs = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; nixpkgs-mastodon.url = "github:vivlim/nixpkgs/mastodon-configure-sidekiq-processes"; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; nixpkgs_overrides.url = "github:vivlim/nixpkgs_overrides"; #nixpkgs_overrides.url = "path:/home/vivlim/git/nixpkgs_overrides"; nixos-generators = { #url = "github:nix-community/nixos-generators"; url = "path:/home/vivlim/git/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = inputs@{ self, nixpkgs, nixpkgs-mastodon, sops-nix, nixpkgs_overrides, nixos-generators, ... }: let # Module that provides an overlay containing an overridden mastodon package. overlayModule = ({ config, pkgs, ... }: { nixpkgs = { config = { }; overlays = [ (new: prev: # The overlay providing an overridden mastodon package let # Get mastodon sources from the location described in source.nix. src = pkgs.callPackage ./mastodon/source.nix { }; srcStaging = pkgs.callPackage ./mastodon-staging/source.nix { }; in { mastodonFork = (nixpkgs-mastodon.legacyPackages.${prev.system}.pkgs.mastodon.override { pname = "mastodonFork"; srcOverride = src; dependenciesDir = ./mastodon; version = import ./mastodon/version.nix; }).overrideAttrs (oldAttrs: rec { yarnOfflineCache = pkgs.fetchYarnDeps { yarnLock = "${src}/yarn.lock"; sha256 = import ./mastodon/yarn-sha256.nix; }; mastodonModules = oldAttrs.mastodonModules.overrideAttrs (oldModuleAttrs: { inherit yarnOfflineCache; }); }); mastodonStagingFork = (nixpkgs-mastodon.legacyPackages.${prev.system}.pkgs.mastodon.override { pname = "mastodonStagingFork"; srcOverride = srcStaging; dependenciesDir = ./mastodon-staging; version = import ./mastodon-staging/version.nix; }).overrideAttrs (oldAttrs: rec { yarnOfflineCache = pkgs.fetchYarnDeps { yarnLock = "${srcStaging}/yarn.lock"; sha256 = import ./mastodon-staging/yarn-sha256.nix; }; mastodonModules = oldAttrs.mastodonModules.overrideAttrs (oldModuleAttrs: { inherit yarnOfflineCache; }); }); }) ]; }; }); nestedContainerExtras = { # additional module imports to use in the nested container. imports = [ # the module that contains the overridden mastodon package overlayModule # use the mastodon configuration module from my nixpkgs fork. "${nixpkgs-mastodon}/nixos/modules/services/web-apps/mastodon.nix" # add configuration module for oauth2-proxy-with-mastodon nixpkgs_overrides.nixosModules."x86_64-linux".oauth2-proxy-with-mastodon ]; disabledModules = [ # don't use the mastodon configuration module that's in nixpkgs. "services/web-apps/mastodon.nix" ]; }; in { colmena = { meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; specialArgs = { inherit inputs; # extra stuff we need when defining nested container config inherit nestedContainerExtras; }; }; frontend = { name, nodes, pkgs, ... }: { deployment.targetHost = "snoot.tube"; deployment.targetPort = 6922; deployment.targetUser = "root"; imports = [ ./configs/common.nix ./configs/frontend.nix nixos-generators.nixosModules.azure # azure base machine config. ./modules/prometheus_exporters.nix ]; }; backend = { name, nodes, pkgs, ... }: { deployment.targetHost = "192.168.1.39"; deployment.targetUser = "root"; imports = [ overlayModule sops-nix.nixosModules.sops ./configs/common.nix ./configs/backend.nix nixos-generators.nixosModules.proxmox # proxmox base machine config. ./modules/prometheus_exporters.nix ]; }; }; }; }