Skip to content

Commit

Permalink
Add flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm authored and bbcmgdm committed Oct 13, 2022
1 parent 103bb21 commit 739cd36
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
58 changes: 58 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
description = "like jq, but for HTML.";

inputs = {
nixpkgs.url = "nixpkgs"; # Resolves to github:NixOS/nixpkgs
# Helpers for system-specific outputs
flake-utils.url = "github:numtide/flake-utils";
crate2nix = {
url = "github:kolloch/crate2nix";
flake = false;
};
};

outputs = { self, nixpkgs, crate2nix, flake-utils }:
# Create system-specific outputs for the standard Nix systems
# https://github.com/numtide/flake-utils/blob/master/default.nix#L3-L9
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
crateName = "htmlq";

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

project = pkgs.callPackage (generatedCargoNix {
name = crateName;
src = ./.;
}) {
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 ];
};
});
}

0 comments on commit 739cd36

Please sign in to comment.