diff --git a/flake.lock b/flake.lock index d82ab3e..2d52b10 100644 --- a/flake.lock +++ b/flake.lock @@ -15,7 +15,39 @@ "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1629707199, + "narHash": "sha256-sGxlmfp5eXL5sAMNqHSb04Zq6gPl+JeltIZ226OYN0w=", + "owner": "nix-community", + "repo": "naersk", + "rev": "df71f5e4babda41cd919a8684b72218e2e809fa9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1629843882, + "narHash": "sha256-pNaVImPmlXzOENlEqKla2CCh/nqdHRuFhBdgiNAnSkE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4b8708cad7da691c7ceb67a1fce79b13bd90e57f", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1629835430, "narHash": "sha256-7ajWHlmckQ1GO3bdVP6JYjE0tvrtTHlolra+Z310bdM=", @@ -34,7 +66,8 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "naersk": "naersk", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index bb098aa..6a0a5ec 100644 --- a/flake.nix +++ b/flake.nix @@ -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`