autosway 0.4.1

Automation program
Documentation
{
  description = "autosway Nix flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    flake-utils = {url = "github:numtide/flake-utils";};
  };

  outputs = {
    self,
    nixpkgs,
    ...
  } @ inputs:
    inputs.flake-utils.lib.eachSystem [
      "x86_64-linux"
      "aarch64-linux"
      "x86_64-darwin"
      "aarch64-darwin"
    ] (system: let
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      packages.autosway = let
        manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
      in
        pkgs.rustPlatform.buildRustPackage {
          pname = manifest.name;
          version = manifest.version;
          cargoLock.lockFile = ./Cargo.lock;
          src = pkgs.lib.cleanSource ./.;

          nativeBuildInputs = with pkgs; [
            pkg-config
            rustfmt
            clippy
            rust-analyzer
          ];

          buildInputs = with pkgs;
            []
            ++ lib.optionals (lib.strings.hasSuffix "linux" system) [
              alsa-oss
              alsa-lib
              openssl
            ];
        };

      packages.default = self.packages.${system}.autosway;
    })
    // {
      homeManagerModules.autosway = {pkgs, ...} @ args: {
        imports = [
          (import ./nix/homeManagerModules/autosway.nix inputs {
            inherit (self.packages.${pkgs.system}) autosway;
          })
        ];
      };
    };
}