Skip to content

Commit

Permalink
make the flake build the new Rust app
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Aug 24, 2021
1 parent bd20d0b commit 3bd0bde
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
35 changes: 34 additions & 1 deletion flake.lock

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

24 changes: 7 additions & 17 deletions flake.nix
Expand Up @@ -2,29 +2,19 @@
description = "sort lines by their similarity to a candidate string";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-21.05";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/release-21.05";
};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, naersk }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
let
pkgs = nixpkgs.legacyPackages.${system};
naersk-lib = naersk.lib.${system};
in rec {
# `nix build`
packages.similar-sort = pkgs.stdenv.mkDerivation {
name = "similar-sort";
buildInputs = [ pkgs.go ];
src = ./.;

buildPhase = ''
env HOME=$(pwd) GOPATH=$(pwd) go build similar-sort.go
'';

installPhase = ''
mkdir -p $out/bin
cp similar-sort $out/bin
'';
};
packages.similar-sort = naersk-lib.buildPackage ./.;
defaultPackage = packages.similar-sort;

# `nix run`
Expand Down

0 comments on commit 3bd0bde

Please sign in to comment.