Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ jobs:
- name: Run tests
run: go test ./...

nix-build:
name: Nix Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v21

- name: Build flake package
run: nix build .

coverage:
name: Test and Coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ ec (easy-conflict) is a 3-way terminal native Git merge conflict resolver. Suppo
brew install chojs23/tap/ec
```

### Nix

Run without installing:

```bash
nix run github:chojs23/ec
```

Install into your profile:

```bash
nix profile add github:chojs23/ec
```

### Install script

You can run the installer through Make:
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

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

93 changes: 93 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
description = "ec: terminal Git mergetool with a 3-way TUI";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = { self, nixpkgs }:
let
lib = nixpkgs.lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = lib.genAttrs systems;
tagRef =
if self ? ref then
self.ref
else if self ? sourceInfo && self.sourceInfo ? ref then
self.sourceInfo.ref
else
null;
versionDate =
if self ? lastModifiedDate then
builtins.substring 0 8 self.lastModifiedDate
else
null;
dirtyRevision =
if self ? dirtyShortRev then
lib.removeSuffix "-dirty" self.dirtyShortRev
else
null;
tagVersion =
if !builtins.isNull tagRef && lib.hasPrefix "refs/tags/" tagRef then
lib.removePrefix "refs/tags/" tagRef
else if !builtins.isNull tagRef && builtins.match "v[0-9].*" tagRef != null then
tagRef
else
null;
version =
if !builtins.isNull tagVersion then
tagVersion
else if self ? rev && self ? shortRev && !builtins.isNull versionDate then
"${versionDate}-${self.shortRev}"
else if !builtins.isNull dirtyRevision && !builtins.isNull versionDate then
"dirty-${versionDate}-${dirtyRevision}"
else if self ? shortRev && !builtins.isNull versionDate then
"${versionDate}-${self.shortRev}"
else if !builtins.isNull versionDate then
"dirty-${versionDate}"
else
"dirty";
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
ec = pkgs.buildGoModule {
pname = "ec";
inherit version;
src = ./.;
vendorHash = "sha256-bV5y8zKculYULkFl9J95qebLOzdTT/LuYycqMmHKZ+g=";
subPackages = [ "cmd/ec" ];
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];

meta = {
description = "Terminal-native 3-way git mergetool vim-like workflow";
homepage = "https://github.com/chojs23/ec";
license = pkgs.lib.licenses.mit;
mainProgram = "ec";
platforms = pkgs.lib.platforms.unix;
};
};

default = ec;
}
);

apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/ec";
};
});
};
}