{ description = "tlater.net web server"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; dream2nix.url = "github:nix-community/dream2nix"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, dream2nix, fenix, } @ flake-inputs: let # At the moment, we only deploy to x86_64-linux. Update when we # care about another platform. system = "x86_64-linux"; flakeOutputs = nixpkgs.lib.callPackageWith flake-inputs (import ./nix/packages.nix) {inherit system;}; in { packages.${system} = { server = flakeOutputs.packages.${system}.tlaternet-webserver; templates = flakeOutputs.packages.${system}.tlaternet; }; apps.${system}.default = let inherit (self.packages.${system}) server templates; inherit (nixpkgs.legacyPackages.${system}) writeShellScript; in { type = "app"; program = builtins.toString (writeShellScript "tlaternet-webserver" '' ${server}/bin/tlaternet-webserver --template-directory ${templates} ''); }; nixosModules.default = import ./nix/module.nix {inherit self system;}; devShells.${system} = { templates = flakeOutputs.devShells.${system}.tlaternet.overrideAttrs (old: { buildInputs = with nixpkgs.legacyPackages.${system}; [ yj ] ++ old.buildInputs; }); server = nixpkgs.legacyPackages.${system}.mkShell { packages = [ (flakeOutputs.rust-toolchain.withComponents [ "rustc" "cargo" "rustfmt" "rust-std" "rust-docs" "clippy" "rust-src" "rust-analysis" ]) fenix.packages.${system}.rust-analyzer ]; }; }; checks.${system} = import ./nix/checks { inherit self system; pkgs = nixpkgs.legacyPackages.${system}; }; }; }