~zethra/kitty-img

6edfd9fe5064bbc6fe8a0ac6fa596943b2597523 — Sashanoraa 8 months ago 1a5e786
Add nix flake
3 files changed, 105 insertions(+), 0 deletions(-)

M .gitignore
A flake.lock
A flake.nix
M .gitignore => .gitignore +1 -0
@@ 1,1 1,2 @@
/target
/result

A flake.lock => flake.lock +59 -0
@@ 0,0 1,59 @@
{
  "nodes": {
    "crate2nix": {
      "flake": false,
      "locked": {
        "lastModified": 1678256065,
        "narHash": "sha256-gZK7UPeL5276Zbjamo8zWDPDxYi6S81sumCKeZr69Vo=",
        "owner": "kolloch",
        "repo": "crate2nix",
        "rev": "a00ef13cd769496bf937b16f16acad01fd004e1f",
        "type": "github"
      },
      "original": {
        "owner": "kolloch",
        "repo": "crate2nix",
        "type": "github"
      }
    },
    "flake-utils": {
      "locked": {
        "lastModified": 1676283394,
        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1678306555,
        "narHash": "sha256-3C/ivszxgGeItTKkU2Mcn9LrBKLpO3BK0LUPPXKUJtw=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "3d57138bd9abe31bae25704cebaab7527010cc5e",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "crate2nix": "crate2nix",
        "flake-utils": "flake-utils",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

A flake.nix => flake.nix +45 -0
@@ 0,0 1,45 @@
# SPDX-FileCopyrightText: 2021 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: CC0-1.0

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
    crate2nix = {
      url = "github:kolloch/crate2nix";
      flake = false;
    };
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, crate2nix, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        crateName = "kitty-img";

        inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
          generatedCargoNix;

        project = import (generatedCargoNix {
          name = crateName;
          src = ./.;
        }) {
          inherit pkgs;
          defaultCrateOverrides = pkgs.defaultCrateOverrides // {
            # Crate dependency overrides go here
          };
        };

      in {
        packages.${crateName} = project.rootCrate.build;

        defaultPackage = self.packages.${system}.${crateName};

        devShell = pkgs.mkShell {
          inputsFrom = builtins.attrValues self.packages.${system};
          buildInputs = [ pkgs.cargo pkgs.rust-analyzer pkgs.clippy ];
        };
      });
}