{ description = "Declarative NixOS HomeLab"; inputs = { # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs"; # You can access packages and modules from different nixpkgs revs # at the same time. Here's an working example: nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # systems.url = "github:nix-systems/default"; sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; simple-nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs"; # home-manager = { # url = "home-manager"; # inputs.nixpkgs.follows = "nixpkgs"; # }; colmena.url = "github:zhaofengli/colmena"; }; outputs = { self, nixpkgs, # systems, colmena, sops-nix, # home-manager, simple-nixos-mailserver, ... } @ inputs: let inherit (self) outputs; lib = nixpkgs.lib; # Supported systems for your flake packages, shell, etc. systems = [ "x86_64-linux" ]; # This is a function that generates an attribute by calling a function you # pass to it, with each system as an argument forAllSystems = lib.genAttrs systems; in { # Custom packages # Accessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); # Custom packages and modifications, exported as overlays overlays = import ./overlays {inherit inputs;}; # Reusable nixos modules nixosModules = import ./modules/nixos; colmenaHive = colmena.lib.makeHive self.outputs.colmena; colmena = import ./colmena.nix {inherit inputs outputs;}; # Development shells devShells = forAllSystems ( system: let pkgs = nixpkgs.legacyPackages.${system}; in { default = pkgs.mkShell { packages = with pkgs; [ self.packages.${system}.homelab-docs colmena.packages.${system}.colmena sops age nix-output-monitor jq ssh-to-age # For converting SSH keys to age keys ]; shellHook = '' echo "🏠 Homelab Development Environment" echo "Available commands:" echo " colmena apply - Deploy all hosts" echo " colmena apply --on @tag - Deploy specific tagged hosts" echo " sops secrets/secrets.yaml - Edit secrets" echo "" ''; }; } ); }; }