diff --git a/.gitignore b/.gitignore index 8ddc10e..aca1950 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +result + # Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos,vim,goland+all,go,direnv # Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos,vim,goland+all,go,direnv diff --git a/README.md b/README.md index 91d24bc..c7fd935 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,14 @@ chaos music control inspired by [relaxx player][relaxx] - add music from other sources like youtube (`youtube-dl`) - add playlists from internet radios (`*.m3u`) +## development + +Build nix flake: + +```shell +nix build +``` + --- Made with ❤️ and 🐍. diff --git a/flake.lock b/flake.lock index fdf2e45..8edcf61 100644 --- a/flake.lock +++ b/flake.lock @@ -18,13 +18,36 @@ "type": "github" } }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694616124, + "narHash": "sha256-c49BVhQKw3XDRgt+y+uPAbArtgUlMXCET6VxEBmzHXE=", + "owner": "tweag", + "repo": "gomod2nix", + "rev": "f95720e89af6165c8c0aa77f180461fe786f3c21", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "gomod2nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1697379843, - "narHash": "sha256-RcnGuJgC2K/UpTy+d32piEoBXq2M+nVFzM3ah/ZdJzg=", + "lastModified": 1697915759, + "narHash": "sha256-WyMj5jGcecD+KC8gEs+wFth1J1wjisZf8kVZH13f1Zo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "12bdeb01ff9e2d3917e6a44037ed7df6e6c3df9d", + "rev": "51d906d2341c9e866e48c2efcaac0f2d70bfd43e", "type": "github" }, "original": { @@ -37,6 +60,7 @@ "root": { "inputs": { "flake-utils": "flake-utils", + "gomod2nix": "gomod2nix", "nixpkgs": "nixpkgs" } }, diff --git a/flake.nix b/flake.nix index 2a4d9b8..e9c2495 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,33 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + gomod2nix = { + url = "github:tweag/gomod2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; }; - outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: + outputs = { self, nixpkgs, flake-utils, gomod2nix }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import nixpkgs { + inherit system; + overlays = [ gomod2nix.overlays.default ]; + }; + sanic = pkgs.buildGoApplication { + pname = "sanic"; + version = "0.0.1"; + src = ./.; + modules = ./gomod2nix.toml; + }; in { + defaultPackage = sanic; devShells.default = pkgs.mkShell { - packages = with pkgs; [ + buildInputs = with pkgs; [ go + gomod2nix.packages.${system}.default + sanic + ]; + packages = with pkgs; [ mpd mpc-cli ]; @@ -18,4 +37,3 @@ } ); } - diff --git a/gomod2nix.toml b/gomod2nix.toml new file mode 100644 index 0000000..c71e6ea --- /dev/null +++ b/gomod2nix.toml @@ -0,0 +1,33 @@ +schema = 3 + +[mod] + [mod."github.com/labstack/echo/v4"] + version = "v4.11.2" + hash = "sha256-OECk2lBNKKBpzJ58XMhpp8KI/tqE0TnyddWyhI+nHPs=" + [mod."github.com/labstack/gommon"] + version = "v0.4.0" + hash = "sha256-xISAIJEu2xh0hoWsORbgjnz3rDK3ft3hrvmxt0wfHVw=" + [mod."github.com/mattn/go-colorable"] + version = "v0.1.13" + hash = "sha256-qb3Qbo0CELGRIzvw7NVM1g/aayaz4Tguppk9MD2/OI8=" + [mod."github.com/mattn/go-isatty"] + version = "v0.0.19" + hash = "sha256-wYQqGxeqV3Elkmn26Md8mKZ/viw598R4Ych3vtt72YE=" + [mod."github.com/valyala/bytebufferpool"] + version = "v1.0.0" + hash = "sha256-I9FPZ3kCNRB+o0dpMwBnwZ35Fj9+ThvITn8a3Jr8mAY=" + [mod."github.com/valyala/fasttemplate"] + version = "v1.2.2" + hash = "sha256-gp+lNXE8zjO+qJDM/YbS6V43HFsYP6PKn4ux1qa5lZ0=" + [mod."golang.org/x/crypto"] + version = "v0.14.0" + hash = "sha256-UUSt3X/i34r1K0mU+Y5IzljX5HYy07JcHh39Pm1MU+o=" + [mod."golang.org/x/net"] + version = "v0.17.0" + hash = "sha256-qRawHWLSsJ06QNbLhUWPXGVSO1eaioeC9xZlUEWN8J8=" + [mod."golang.org/x/sys"] + version = "v0.13.0" + hash = "sha256-/+RDZ0a0oEfJ0k304VqpJpdrl2ZXa3yFlOxy4mjW7w0=" + [mod."golang.org/x/text"] + version = "v0.13.0" + hash = "sha256-J34dbc8UNVIdRJUZP7jPt11oxuwG8VvrOOylxE7V3oA="