diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d3d120b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,27 @@ +name: "Nix CI" +on: [push] +jobs: + + nix-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v24 + - id: set-matrix + name: Generate Nix Matrix + run: | + set -Eeu + matrix="$(nix eval --json '.#githubActions.matrix')" + echo "matrix=$matrix" >> "$GITHUB_OUTPUT" + + nix-build: + needs: nix-matrix + runs-on: ${{ matrix.os }} + strategy: + matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}} + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v24 + - run: nix build -Lv ".#${{ matrix.attr }}" \ No newline at end of file diff --git a/README.md b/README.md index 9849861..0f71edc 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ I've been thinking about a clustered `systemctl` for a while now, and when I started digging into it recently I eventually ended up looking closely at [DBus](https://www.freedesktop.org/wiki/Software/dbus/). -What I *want to achieve* is remotely monitor and manage multiple machines. +What I _want to achieve_ is remotely monitor and manage multiple machines. I think DBus provides the underlying mechanism for this in the form of: @@ -141,7 +141,7 @@ Signature: s ```terminal ❯ nats --context TestAdmin sub "dbus.signals.>" -12:14:06 Subscribing on dbus.signals.> +12:14:06 Subscribing on dbus.signals.> [#1] Received on "dbus.signals.UBQUIKYGFC7CH5XMF52P2NN4ESI4XTXGAKT3WTG3XGU3352DMHGZQAX7._1_1.org.freedesktop.systemd1.unit.nscd_2eservice" Interface: org.freedesktop.DBus.Properties Member: PropertiesChanged diff --git a/flake.lock b/flake.lock index f9b111b..fe2375c 100644 --- a/flake.lock +++ b/flake.lock @@ -94,55 +94,48 @@ "type": "github" } }, - "gomod2nix": { + "github-actions": { "inputs": { - "flake-utils": [ - "devshell", - "flake-utils" - ], "nixpkgs": [ - "srvos", "nixpkgs" ] }, "locked": { - "lastModified": 1710154385, - "narHash": "sha256-4c3zQ2YY4BZOufaBJB4v9VBBeN2dH7iVdoJw8SDNCfI=", + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", "owner": "nix-community", - "repo": "gomod2nix", - "rev": "872b63ddd28f318489c929d25f1f0a3c6039c971", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", "type": "github" }, "original": { "owner": "nix-community", - "repo": "gomod2nix", + "repo": "nix-github-actions", "type": "github" } }, - "harmonia": { + "gomod2nix": { "inputs": { - "flake-parts": [ - "flake-parts" + "flake-utils": [ + "devshell", + "flake-utils" ], "nixpkgs": [ "srvos", "nixpkgs" - ], - "treefmt-nix": [ - "treefmt-nix" ] }, "locked": { - "lastModified": 1712193684, - "narHash": "sha256-HBksyUBZZO1eAlimgmlkVl/8L41DZalgUlHahPvSGdg=", + "lastModified": 1710154385, + "narHash": "sha256-4c3zQ2YY4BZOufaBJB4v9VBBeN2dH7iVdoJw8SDNCfI=", "owner": "nix-community", - "repo": "harmonia", - "rev": "18e9c08c7ef1692220da6a339b015dbfb4d61fe6", + "repo": "gomod2nix", + "rev": "872b63ddd28f318489c929d25f1f0a3c6039c971", "type": "github" }, "original": { "owner": "nix-community", - "repo": "harmonia", + "repo": "gomod2nix", "type": "github" } }, @@ -263,8 +256,8 @@ "nix-lib", "flake-root" ], + "github-actions": "github-actions", "gomod2nix": "gomod2nix", - "harmonia": "harmonia", "nix-filter": "nix-filter", "nix-lib": "nix-lib", "nixpkgs": [ diff --git a/flake.nix b/flake.nix index bee326c..f471d72 100644 --- a/flake.nix +++ b/flake.nix @@ -28,14 +28,6 @@ inputs.nixpkgs.follows = "srvos/nixpkgs"; }; process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; - harmonia = { - url = "github:nix-community/harmonia"; - inputs = { - nixpkgs.follows = "srvos/nixpkgs"; - flake-parts.follows = "flake-parts"; - treefmt-nix.follows = "treefmt-nix"; - }; - }; gomod2nix = { url = "github:nix-community/gomod2nix"; inputs = { @@ -56,6 +48,10 @@ }; }; nix-filter.url = "github:numtide/nix-filter"; + github-actions = { + url = "github:nix-community/nix-github-actions"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs @ { diff --git a/nix/checks.nix b/nix/checks.nix index 8216515..208e293 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -1,4 +1,19 @@ -{lib, ...}: { +{ + lib, + self, + inputs, + ... +}: { + flake.githubActions = let + platforms = { + "x86_64-linux" = ["ubuntu-latest"]; + }; + in + inputs.github-actions.lib.mkGithubMatrix { + inherit platforms; + checks = lib.getAttrs ["x86_64-linux"] self.checks; + }; + perSystem = {self', ...}: { checks = with lib; mapAttrs' (n: nameValuePair "package-${n}") self'.packages; };