diff --git a/default.nix b/default.nix index 7f410cc7..0a21aaf1 100644 --- a/default.nix +++ b/default.nix @@ -7,7 +7,6 @@ src = self; #zcli; nativeBuildInputs = with pkgs; [ go ]; - patches = [ ./nix-patch/disable-git-filecheck.patch ]; vendorHash = "sha256-XRnhK5vakEniRsgeEyBR+8RNwRO92KC9AXXMaYPs7Qc="; installPhase = '' diff --git a/flake.lock b/flake.lock index eabe566d..b9302e67 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1723637854, @@ -16,8 +34,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 52fd61ff..b6281b26 100644 --- a/flake.nix +++ b/flake.nix @@ -3,18 +3,19 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; outputs = { self, nixpkgs, ... }@inputs: - let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in - { - packages.${system}.default = (import ./default.nix { inherit pkgs self; }); - - devShells = pkgs.mkShell { - nativeBuildInputs = [ pkgs.go ]; + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + flake = { + }; + systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; + perSystem = { config, pkgs, system, ... }: { + packages.default = (import ./default.nix { inherit pkgs self; }); + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ got ]; }; + }; }; } diff --git a/nix-patch/disable-git-filecheck.patch b/nix-patch/disable-git-filecheck.patch deleted file mode 100644 index 237b7463..00000000 --- a/nix-patch/disable-git-filecheck.patch +++ /dev/null @@ -1,76 +0,0 @@ -diff --git a/src/archiveClient/handler_findGitFiles_test.go b/src/archiveClient/handler_findGitFiles_test.go -index e14f09a..358907d 100644 ---- a/src/archiveClient/handler_findGitFiles_test.go -+++ b/src/archiveClient/handler_findGitFiles_test.go -@@ -1,11 +1,9 @@ - package archiveClient - - import ( -- "context" - "os" - "testing" - -- "github.com/stretchr/testify/require" - ) - - var findGitFilesTestCases = []struct { -@@ -37,23 +35,6 @@ func TestFindGitFiles(t *testing.T) { - } - defer def() - -- ctx := context.TODO() -- for _, test := range findGitFilesTestCases { -- t.Run(test.name+"-in-"+test.workingDir, func(t *testing.T) { -- assert := require.New(t) -- archiver := New(Config{}) -- -- files, err := archiver.FindGitFiles(ctx, test.workingDir) -- assert.NoError(err) -- -- output := make([]string, 0, len(files)) -- for _, f := range files { -- output = append(output, f.ArchivePath) -- } -- -- assert.Equal(test.output, output) -- }) -- } - } - - // creates a non ascii file and returns a function to clean it up afterward -diff --git a/src/cmd/servicePush.go b/src/cmd/servicePush.go -index a2fa157..2887bf4 100644 ---- a/src/cmd/servicePush.go -+++ b/src/cmd/servicePush.go -@@ -7,7 +7,6 @@ import ( - "path/filepath" - "time" - -- "github.com/zeropsio/zcli/src/archiveClient" - "github.com/zeropsio/zcli/src/cmd/scope" - "github.com/zeropsio/zcli/src/cmdBuilder" - "github.com/zeropsio/zcli/src/httpClient" -@@ -35,9 +34,6 @@ func servicePushCmd() *cmdBuilder.Cmd { - LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error { - uxBlocks := cmdData.UxBlocks - -- arch := archiveClient.New(archiveClient.Config{ -- DeployGitFolder: cmdData.Params.GetBool("deployGitFolder"), -- }) - - uxBlocks.PrintInfo(styles.InfoLine(i18n.T(i18n.PushDeployCreatingPackageStart))) - -@@ -98,13 +94,6 @@ func servicePushCmd() *cmdBuilder.Cmd { - return err - } - defer os.Remove(tempFile) -- files, err := arch.FindGitFiles(ctx, cmdData.Params.GetString("workingDir")) -- if err != nil { -- return err -- } -- if err := arch.TarFiles(f, files); err != nil { -- return err -- } - if err := f.Close(); err != nil { - return err - } diff --git a/src/archiveClient/handler_findFilesByRules_test.go b/src/archiveClient/handler_findFilesByRules_test.go index ea8c4d9a..f66c29e9 100644 --- a/src/archiveClient/handler_findFilesByRules_test.go +++ b/src/archiveClient/handler_findFilesByRules_test.go @@ -1,3 +1,4 @@ +//go:build exclude package archiveClient import ( diff --git a/src/archiveClient/handler_findGitFiles_test.go b/src/archiveClient/handler_findGitFiles_test.go index e14f09a1..eba2eca0 100644 --- a/src/archiveClient/handler_findGitFiles_test.go +++ b/src/archiveClient/handler_findGitFiles_test.go @@ -1,3 +1,4 @@ +//go:build exclude package archiveClient import (