aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-31 03:45:09 +0000
committerFuwn <[email protected]>2026-01-31 03:45:09 +0000
commit1d3e526809a1fede56683086f94d71494efc5c27 (patch)
treeb571b24ea7b795368d2f1b766cb0fcad11ab134d
parentfeat: Initial commit (diff)
downloadiku-1d3e526809a1fede56683086f94d71494efc5c27.tar.xz
iku-1d3e526809a1fede56683086f94d71494efc5c27.zip
feat: Add Nix flake support
-rw-r--r--.gitignore1
-rw-r--r--README.md6
-rw-r--r--flake.lock58
-rw-r--r--flake.nix35
-rw-r--r--go.mod2
-rw-r--r--main.go2
6 files changed, 102 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 034047c..076eff8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
iku
+result
diff --git a/README.md b/README.md
index 53da068..84f3f45 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,12 @@ Iku runs `go fmt` first, then applies its grammar-based blank-line rules on top
go install github.com/Fuwn/iku@latest
```
+Or run with Nix:
+
+```bash
+nix run github:Fuwn/iku
+```
+
## Usage
```bash
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..683a0b9
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,58 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1769740369,
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "6308c3b21396534d8aaeac46179c14c439a89b8a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..1e7f318
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,35 @@
+{
+ description = "Grammar-Aware Go Formatter";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ version = self.shortRev or "dirty";
+ in {
+ packages.default = pkgs.buildGo125Module {
+ inherit version;
+
+ pname = "iku";
+ src = pkgs.lib.cleanSource ./.;
+ vendorHash = null;
+ ldflags = [ "-s" "-w" "-X main.version=${version}" ];
+
+ meta = with pkgs.lib; {
+ description = "Grammar-Aware Go Formatter";
+ homepage = "https://github.com/Fuwn/iku";
+ license = licenses.gpl3Only;
+ platforms = platforms.unix;
+ };
+ };
+
+ devShells.default = pkgs.mkShell {
+ buildInputs = [ pkgs.go_1_25 ];
+ };
+ });
+}
diff --git a/go.mod b/go.mod
index 24a6519..084f6e5 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
module github.com/Fuwn/iku
-go 1.25.6
+go 1.25
diff --git a/main.go b/main.go
index daa54d8..2e6c7a0 100644
--- a/main.go
+++ b/main.go
@@ -31,7 +31,7 @@ func main() {
flag.Parse()
if *versionFlag {
- fmt.Println("iku", version)
+ fmt.Printf("%s (%s)\n", version, runtime.Version())
os.Exit(0)
}