diff --git a/flake.nix b/flake.nix index 150e232..369dbf9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "A very basic flake"; + description = "sops-tui — a TUI for managing SOPS-encrypted secrets"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; @@ -45,28 +45,23 @@ } ); src = craneLib.cleanCargoSource ./.; + commonArgs = { inherit src; strictDeps = true; }; - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - individualCrateArgs = commonArgs // { - inherit cargoArtifacts; - inherit (craneLib.crateNameFromCargoToml { inherit src; }) version; - }; - fileSetForCrate = - crate: - lib.fileset.toSource { - root = ./.; - fileset = lib.fileset.unions [ - ./Cargo.toml - ./Cargo.lock - ]; - }; - server = craneLib.buildPackage ( - individualCrateArgs + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + + sops-tui = craneLib.buildPackage ( + commonArgs // { + inherit cargoArtifacts; + meta = { + description = "TUI for managing SOPS-encrypted secrets in NixOS/sops-nix workflows"; + mainProgram = "sops-tui"; + platforms = lib.platforms.unix; + }; } ); in @@ -75,15 +70,27 @@ inherit system; overlays = [ inputs.rust-overlay.overlays.default ]; }; + + packages = { + default = sops-tui; + inherit sops-tui; + }; + + checks = { + inherit sops-tui; + sops-tui-clippy = craneLib.cargoClippy ( + commonArgs + // { + inherit cargoArtifacts; + cargoClippyExtraArgs = "--all-targets"; + } + ); + sops-tui-fmt = craneLib.cargoFmt { inherit src; }; + }; + devShells.default = craneLib.devShell { - packages = with pkgs; [ - mold - llvmPackages.clang - llvmPackages.lld - sea-orm-cli - watchexec - pnpm - ]; + inputsFrom = [ sops-tui ]; + packages = with pkgs; [ sops ]; }; }; };