{ description = "Cli to post to Bluesky."; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.poetry2nix.url = "github:nix-community/poetry2nix"; outputs = { self, nixpkgs, poetry2nix, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; # Create mkPoetryApplication for packaging Python application. inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication; skeet = mkPoetryApplication { projectDir = ./.; preferWheels = true; # Maturin dependency }; in { # Package application to be used as a command-line utility. packages.${system}.default = skeet; # Expose search application as a NixOS module. nixosModules.default = { config, pkgs, lib, ... }: let cfg = config.programs.skeet; in { options.programs.skeet = { enable = lib.mkOption { type = lib.types.bool; default = false; description = "Enable the `skeet` cli tool and automatically pre-supply its username and password"; }; handle = lib.mkOption { type = lib.types.str; default = ""; description = "Your handle, usually {username}.bsky.social ."; }; password = lib.mkOption { type = lib.types.str; default = ""; description = "Your password."; }; }; # Define the configuration. config = lib.mkIf cfg.enable { environment.systemPackages = [ (pkgs.writeShellScriptBin "skeet" '' ${skeet}/bin/skeet '${cfg.handle}' '${cfg.password}' "$@" '') ]; }; }; }; }