diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4d59308..e389e78 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -3,5 +3,7 @@ name: Check Rust on: [push] jobs: - check: + check-rust: uses: mikojs/actions/.github/workflows/check-rust.yml@main + check-nix: + uses: mikojs/actions/.github/workflows/check-nix.yml@main diff --git a/README.md b/README.md index 7287801..e73c9eb 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,35 @@ This tool is useful when you need to sync code with a remote server that doesn't ## Installation +### Cargo + ```bash cargo install --path . ``` +### Nix + +```nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + coder.url = "github:mikojs/coder"; + }; + + outputs = { nixpkgs, coder, ... }: { + nixosConfigurations.myhost = nixpkgs.lib.nixosSystem { + ... + modules = [ + ({ pkgs, ... }: { + nixpkgs.overlays = [ coder.overlays.default ]; + environment.systemPackages = [ pkgs.coder ]; + }) + ]; + }; + }; +} +``` + ## Usage ### Sync diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..35a8d99 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1772822230, + "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1772328832, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fd4b27a --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "A CLI tool for syncing git repositories via bundles over SSH"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = + inputs@{ + self, + nixpkgs, + flake-parts, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + + perSystem = + { pkgs, self', ... }: + { + packages = { + coder = pkgs.rustPlatform.buildRustPackage { + pname = "coder"; + version = "0.1.0"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + }; + + default = self'.packages.coder; + }; + }; + + flake.overlays.default = final: prev: { + coder = self.packages.${final.system}.coder; + }; + }; +}