diff --git a/nix/flake.lock b/nix/flake.lock new file mode 100644 index 0000000..3f835b2 --- /dev/null +++ b/nix/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1673362319, + "narHash": "sha256-Pjp45Vnj7S/b3BRpZEVfdu8sqqA6nvVjvYu59okhOyI=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "82c16f1682cf50c01cb0280b38a1eed202b3fe9f", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1673606088, + "narHash": "sha256-wdYD41UwNwPhTdMaG0AIe7fE1bAdyHe6bB4HLUqUvck=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "37b97ae3dd714de9a17923d004a2c5b5543dfa6d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1672350804, + "narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/flake.nix b/nix/flake.nix new file mode 100644 index 0000000..8f04928 --- /dev/null +++ b/nix/flake.nix @@ -0,0 +1,44 @@ +{ + description = "Small python script to load bitwarden-store ssh keys into ssh-agent"; + + outputs = inputs@{ nixpkgs, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.flake-parts.flakeModules.easyOverlay + ]; + systems = [ "x86_64-linux" "aarch64-darwin" ]; + perSystem = { config, self', inputs', pkgs, system, ... }: + let + package = pkgs.python3Packages.buildPythonPackage { + pname = "bitwarden-ssh-agent"; + version = "0.1.0"; + src = ./.. ; + propagatedBuildInputs = [ pkgs.python3Packages.setuptools pkgs.bitwarden-cli ]; + format = "other"; + installPhase = '' + mkdir -p $out/bin/ + mv bw_add_sshkeys.py $out/bin/bitwarden-ssh-agent + chmod +x $out/bin/bitwarden-ssh-agent + ''; + meta = with pkgs.lib; { + description = "Small python script to load bitwarden-store ssh keys into ssh-agent"; + homepage = "https://github.com/joaojacome/bitwarden-ssh-agent"; + license = licenses.mit; + }; + }; + in { + overlayAttrs = { + bitwarden-ssh-agent = package; + }; + packages.default = package; + devShells.default = pkgs.mkShell { + packages = [ + pkgs.bitwarden-cli + (pkgs.python3.withPackages(pkgs: [ + pkgs.setuptools + ])) + ]; + }; + }; + }; +}