convert to a flake

flake-overlay-tweak
Brian Hicks 2021-07-08 15:54:18 -05:00
parent 2c94132c73
commit 87ff983fce
3 changed files with 96 additions and 15 deletions

View File

@ -1,15 +0,0 @@
{ pkgs ? import <nixpkgs> { }, ... }:
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
'';
}

60
flake.lock Normal file
View File

@ -0,0 +1,60 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1623875721,
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"flake": false,
"locked": {
"lastModified": 1611672876,
"narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=",
"owner": "hercules-ci",
"repo": "gitignore",
"rev": "211907489e9f198594c0eb0ca9256a1949c9d412",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1625766998,
"narHash": "sha256-icJ9QwkvdyhJI1vHizOGrshkrzf1K39Zr34Zm3z0vsE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "605634580515f6093d56c69165f67b5c6ad37be9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-21.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

36
flake.nix Normal file
View File

@ -0,0 +1,36 @@
{
description = "sort lines by their similarity to a candidate string";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=release-21.05";
gitignore = {
url = "github:hercules-ci/gitignore";
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
gitignore = pkgs.callPackage inputs.gitignore { };
in rec {
packages.similar-sort = pkgs.stdenv.mkDerivation {
name = "similar-sort";
buildInputs = [ pkgs.go ];
src = gitignore.gitignoreSource ./.;
buildPhase = ''
env HOME=$(pwd) GOPATH=$(pwd) go build similar-sort.go
'';
installPhase = ''
mkdir -p $out/bin
cp similar-sort $out/bin
'';
};
defaultPackage = packages.similar-sort;
});
}