diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..db72d2a --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +use flake .nix +dotenv_if_exists + +if on_git_branch; then + echo + git status --short --branch + echo + git fetch +fi diff --git a/.nix/flake.lock b/.nix/flake.lock new file mode 100644 index 0000000..1058284 --- /dev/null +++ b/.nix/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1692190437, + "narHash": "sha256-yJUZzmzSmDYb9ONPnMQDru66RjZgGQZRvj3tQebkexk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b2aa98db6b10503666a50f4eb93b2fc0d57bde5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.nix/flake.nix b/.nix/flake.nix new file mode 100644 index 0000000..eb2c1fc --- /dev/null +++ b/.nix/flake.nix @@ -0,0 +1,29 @@ +{ + description = "A basic flake with a shell"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShell = pkgs.mkShell { + nativeBuildInputs = [ pkgs.bashInteractive ]; + buildInputs = with pkgs; [ + # pre-commit + pre-commit + commitizen + + # formatting + nodePackages.prettier # markdown formatting + ]; + + shellHook = '' + pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg + ''; + }; + } + ); +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1286932 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-yaml + + - repo: https://github.com/commitizen-tools/commitizen + rev: v2.37.0 + hooks: + - id: commitizen + stages: [commit-msg] + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.0-alpha.4 + hooks: + - id: prettier + types_or: + - markdown diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..f67e37a --- /dev/null +++ b/.releaserc @@ -0,0 +1,8 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/npm", + "@semantic-release/git" + ] +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fc5d700 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +FROM kopia/kopia diff --git a/build-and-push.sh b/build-and-push.sh new file mode 100755 index 0000000..dc606f2 --- /dev/null +++ b/build-and-push.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +SKIP=no-commit-to-branch,prettier CI=false npx semantic-release + +VERSION=`npx semantic-release --version` + +docker image build --tag git.molez.org/mandlm/kopia:${VERSION} --tag git.molez.org/mandlm/kopia:latest . +docker image push git.molez.org/mandlm/kopia:${VERSION} +docker image push git.molez.org/mandlm/kopia:latest