~zethra/fre

1db81e357d17d6816adbf1d378c4ac0480eea740 — Sashanoraa 8 months ago 4b8b020 master
Add nix flake
2 files changed, 105 insertions(+), 0 deletions(-)

A flake.lock
A flake.nix
A flake.lock => flake.lock +59 -0
@@ 0,0 1,59 @@
{
  "nodes": {
    "crate2nix": {
      "flake": false,
      "locked": {
        "lastModified": 1679273607,
        "narHash": "sha256-AOgve6BL92bSNLRAO+H3XA9D8Af9+/mi8eoOXgbF+2A=",
        "owner": "kolloch",
        "repo": "crate2nix",
        "rev": "4bda7d14a22a585123a3fbdb6cee046248b515d5",
        "type": "github"
      },
      "original": {
        "owner": "kolloch",
        "repo": "crate2nix",
        "type": "github"
      }
    },
    "flake-utils": {
      "locked": {
        "lastModified": 1678901627,
        "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1679518611,
        "narHash": "sha256-9oN8btOgY1re8IexMaFBJvvoVZoxv1ToiHXyJJr3wxY=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "0bc15605ceb122f6975116015e2fbd153102c7a0",
        "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 +46 -0
@@ 0,0 1,46 @@
# 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};

        # DON'T FORGET TO PUT YOUR PACKAGE NAME HERE, REMOVING `throw`
        crateName = "fre";

        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 ];
        };
      });
}