{ description = "Nixos server config"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11-small"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small"; library.url = "git+https://git.vhack.eu/vhack.eu/nix-library?ref=prime"; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; deploy-rs = { url = "github:serokell/deploy-rs"; inputs = { flake-compat.follows = "flake-compat"; nixpkgs.follows = "nixpkgs"; utils.follows = "flake-utils"; }; }; # inputs for following systems = { url = "github:nix-systems/x86_64-linux"; # only evaluate for this system }; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; crane = { url = "github:ipetkov/crane"; inputs = {}; }; flake-utils = { url = "github:numtide/flake-utils"; inputs = { systems.follows = "systems"; }; }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; # modules disko = { url = "github:nix-community/disko"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; agenix = { url = "github:ryantm/agenix"; inputs = { nixpkgs.follows = "nixpkgs"; systems.follows = "systems"; }; }; impermanence = { url = "github:nix-community/impermanence"; inputs = {}; }; simple-nixos-mailserver = { url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master"; inputs = { flake-compat.follows = "flake-compat"; nixpkgs.follows = "nixpkgs"; }; }; # bins ragenix = { url = "github:yaxitech/ragenix"; inputs = { nixpkgs.follows = "nixpkgs"; agenix.follows = "agenix"; flake-utils.follows = "flake-utils"; rust-overlay.follows = "rust-overlay"; crane.follows = "crane"; }; }; }; outputs = { self, nixpkgs, nixpkgs-unstable, library, treefmt-nix, deploy-rs, # modules simple-nixos-mailserver, impermanence, disko, agenix, # bins ragenix, ... } @ attrs: let system = "x86_64-linux"; nixos-lib = import (nixpkgs + "/nixos/lib") {}; pkgs = nixpkgs.legacyPackages.${system}; pkgsUnstable = nixpkgs-unstable.legacyPackages.${system}; deployPackage = (import nixpkgs { inherit system; overlays = [ deploy-rs.overlays.default (self: super: { deploy-rs = { inherit (pkgs) deploy-rs; inherit (super.deploy-rs) lib; }; }) ]; }) .deploy-rs; specialArgs = attrs // { inherit pkgsUnstable vhackPackages nixpkgs-unstable nixos-lib extraModules nixLib; }; extraModules = [ simple-nixos-mailserver.nixosModule disko.nixosModules.default impermanence.nixosModules.impermanence agenix.nixosModules.default ]; tests = import ./tests {inherit pkgs specialArgs nixLib;}; vhackPackages = import ./pkgs {inherit pkgs nixLib;}; hosts = import ./hosts {inherit pkgs nixLib nixpkgs specialArgs extraModules deployPackage;}; inherit (library) nixLib; treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; in { checks."${system}" = nixLib.warnMerge (nixLib.warnMerge tests { formatting = treefmtEval.config.build.check self; } "the flake checks and formatting") (deployPackage.lib.deployChecks self.deploy) "the flake checks and deploy-rs"; packages."${system}" = vhackPackages; formatter."${system}" = treefmtEval.config.build.wrapper; devShells."${system}" = { default = pkgs.mkShell { packages = with pkgs; [ # used for certificate generation in the taskserver setup gnutls pkgs.deploy-rs git-bug cocogitto ragenix.packages."${system}".default ]; }; }; inherit (hosts) nixosConfigurations deploy; }; }