From aafef4720c6354f59d1a528dbd1c240dca7d98cc Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sat, 19 Mar 2022 19:08:01 -0700 Subject: [PATCH 01/16] Add GitHub action --- .github/workflows/nix.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/nix.yml diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000..d0c07fc --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,12 @@ +name: "Nix" +on: + pull_request: + push: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.4.0 + - uses: cachix/install-nix-action@v15 + - run: nix build + - run: nix flake check From 37d7fc97063955a12e51712f3e62a750f4048e86 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sat, 19 Mar 2022 19:12:20 -0700 Subject: [PATCH 02/16] Try running on macos to work around hash mismatch --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index d0c07fc..ee82842 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -4,7 +4,7 @@ on: push: jobs: tests: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2.4.0 - uses: cachix/install-nix-action@v15 From 54f9f5edd99d1d6267d9bd4cc4ecf974215545e9 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sat, 19 Mar 2022 19:25:53 -0700 Subject: [PATCH 03/16] Update the SHA since it seems to work locally --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 10f27ef..606a01b 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ rust = (mozilla.rustChannelOf { channel = "stable"; version = "1.54.0"; - sha256 = "NL+YHnOj1++1O7CAaQLijwAxKJW9SnHg8qsiOJ1m0Kk="; + sha256 = "4IUZZWXHBBxcwRuQm9ekOwzc0oNqH/9NkI1ejW7KajU="; # sha256 = pkgs.lib.fakeSha256; }).rust.override { extensions = [ From 226fcfff1f77a3884f9d23d82b26d6a077f450a5 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sat, 19 Mar 2022 19:26:50 -0700 Subject: [PATCH 04/16] Add build matrix --- .github/workflows/nix.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index ee82842..be6cf30 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -3,8 +3,12 @@ on: pull_request: push: jobs: - tests: - runs-on: macos-latest + nix: + name: Nix on ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 - uses: cachix/install-nix-action@v15 From 5d598c864167a199eed34f66fdda5434bc2e0039 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sat, 19 Mar 2022 19:30:00 -0700 Subject: [PATCH 05/16] Change the order of the operating systems To see if the macOS build will succeed. --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index be6cf30..6ba1fe6 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -7,7 +7,7 @@ jobs: name: Nix on ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [macos-latest, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 From b04042be23c3d18243deff1e9553d1f6812141e8 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sat, 19 Mar 2022 19:32:32 -0700 Subject: [PATCH 06/16] Try only building on macOS for now --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 6ba1fe6..2eb3be6 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -7,7 +7,7 @@ jobs: name: Nix on ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest] + os: [macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 From 50615624dc9c46e695337da5d8e7b92f457b685c Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 12:03:21 -0700 Subject: [PATCH 07/16] Fix rustChannelOf usage --- flake.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 606a01b..5f4d9ed 100644 --- a/flake.nix +++ b/flake.nix @@ -33,9 +33,8 @@ # Get a specific rust version mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {}; rust = (mozilla.rustChannelOf { - channel = "stable"; - version = "1.54.0"; - sha256 = "4IUZZWXHBBxcwRuQm9ekOwzc0oNqH/9NkI1ejW7KajU="; + channel = "1.55.0"; + sha256 = "HNIlEerJvk6sBfd8zugzwSgSiHcQH8ZbqWQn9BGfmpo="; # sha256 = pkgs.lib.fakeSha256; }).rust.override { extensions = [ From cd23362742c27190903a1df64f69f2081af71695 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 12:03:43 -0700 Subject: [PATCH 08/16] Add ubuntu back to build matrix --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 2eb3be6..be6cf30 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -7,7 +7,7 @@ jobs: name: Nix on ${{ matrix.os }} strategy: matrix: - os: [macos-latest] + os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 From 87acdade3797903516c636f0922b7d47bac8e96d Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 17:40:55 -0700 Subject: [PATCH 09/16] Use nixpkgs-mozilla flake --- flake.lock | 35 +++++++++++++++++------------------ flake.nix | 9 +++------ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index 525a1f7..fab2922 100644 --- a/flake.lock +++ b/flake.lock @@ -31,22 +31,6 @@ "type": "github" } }, - "mozillapkgs": { - "flake": false, - "locked": { - "lastModified": 1638887313, - "narHash": "sha256-FMYV6rVtvSIfthgC1sK1xugh3y7muoQcvduMdriz4ag=", - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "7c1e8b1dd6ed0043fb4ee0b12b815256b0b9de6f", - "type": "github" - }, - "original": { - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "type": "github" - } - }, "naersk": { "inputs": { "nixpkgs": "nixpkgs" @@ -79,6 +63,21 @@ "type": "indirect" } }, + "nixpkgs-mozilla": { + "locked": { + "lastModified": 1645464064, + "narHash": "sha256-YeN4bpPvHkVOpQzb8APTAfE7/R+MFMwJUMkqmfvytSk=", + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "rev": "15b7a05f20aab51c4ffbefddb1b448e862dccb7d", + "type": "github" + }, + "original": { + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1638239011, @@ -99,9 +98,9 @@ "inputs": { "dfinity-sdk": "dfinity-sdk", "flake-utils": "flake-utils", - "mozillapkgs": "mozillapkgs", "naersk": "naersk", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "nixpkgs-mozilla": "nixpkgs-mozilla" } } }, diff --git a/flake.nix b/flake.nix index 5f4d9ed..848c813 100644 --- a/flake.nix +++ b/flake.nix @@ -5,12 +5,9 @@ flake = false; }; flake-utils.url = "github:numtide/flake-utils"; - mozillapkgs = { - url = "github:mozilla/nixpkgs-mozilla"; - flake = false; - }; naersk.url = "github:nix-community/naersk"; nixpkgs.url = "github:nixos/nixpkgs/21.11"; + nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla"; }; outputs = { @@ -18,8 +15,8 @@ nixpkgs, dfinity-sdk, flake-utils, - mozillapkgs, naersk, + nixpkgs-mozilla, }: flake-utils.lib.eachDefaultSystem ( system: let @@ -31,7 +28,7 @@ }; # Get a specific rust version - mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {}; + mozilla = pkgs.callPackage (nixpkgs-mozilla + "/package-set.nix") {}; rust = (mozilla.rustChannelOf { channel = "1.55.0"; sha256 = "HNIlEerJvk6sBfd8zugzwSgSiHcQH8ZbqWQn9BGfmpo="; From ebde4e16967bc8c627a1b8886891790ab2b35732 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 17:42:24 -0700 Subject: [PATCH 10/16] Add --show-trace to nix build --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index be6cf30..d8fd108 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -12,5 +12,5 @@ jobs: steps: - uses: actions/checkout@v2.4.0 - uses: cachix/install-nix-action@v15 - - run: nix build + - run: nix build --show-trace - run: nix flake check From 0efc3b263748ee55673b64f2f44a423485e2b527 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 17:47:12 -0700 Subject: [PATCH 11/16] Add ref to fix issue with fetchGit assuming master https://github.com/NixOS/nix/issues/1923 --- examples/fat/src/fat/Cargo.toml | 2 +- src/icfs/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/fat/src/fat/Cargo.toml b/examples/fat/src/fat/Cargo.toml index 56c464e..3e743a7 100644 --- a/examples/fat/src/fat/Cargo.toml +++ b/examples/fat/src/fat/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib"] [dependencies] fatfs = { git = "https://github.com/rafalh/rust-fatfs" } fscommon = "0.1" -ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } +ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", ref = "main", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } ic-cdk-macros = "0.3" icfs = { path = "../../../../src/icfs" } time = "0.3" \ No newline at end of file diff --git a/src/icfs/Cargo.toml b/src/icfs/Cargo.toml index 8bdd8ba..5b5f923 100644 --- a/src/icfs/Cargo.toml +++ b/src/icfs/Cargo.toml @@ -12,4 +12,4 @@ path = "lib.rs" crate-type = ["cdylib", "rlib"] [dependencies] -ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } \ No newline at end of file +ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", ref = "main", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } \ No newline at end of file From 47864ac40c925a9bc0e1a7bd497585db1398ae22 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 18:00:39 -0700 Subject: [PATCH 12/16] Revert "Add ref to fix issue with fetchGit assuming master" This reverts commit 0efc3b263748ee55673b64f2f44a423485e2b527. --- examples/fat/src/fat/Cargo.toml | 2 +- src/icfs/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/fat/src/fat/Cargo.toml b/examples/fat/src/fat/Cargo.toml index 3e743a7..56c464e 100644 --- a/examples/fat/src/fat/Cargo.toml +++ b/examples/fat/src/fat/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib"] [dependencies] fatfs = { git = "https://github.com/rafalh/rust-fatfs" } fscommon = "0.1" -ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", ref = "main", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } +ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } ic-cdk-macros = "0.3" icfs = { path = "../../../../src/icfs" } time = "0.3" \ No newline at end of file diff --git a/src/icfs/Cargo.toml b/src/icfs/Cargo.toml index 5b5f923..8bdd8ba 100644 --- a/src/icfs/Cargo.toml +++ b/src/icfs/Cargo.toml @@ -12,4 +12,4 @@ path = "lib.rs" crate-type = ["cdylib", "rlib"] [dependencies] -ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", ref = "main", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } \ No newline at end of file +ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } \ No newline at end of file From 73db90a38984286307e76810c76110da7eda4d5d Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 18:05:37 -0700 Subject: [PATCH 13/16] Use a fork of naersk no address fetchGit issue --- flake.lock | 11 ++++++----- flake.nix | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index fab2922..a06779d 100644 --- a/flake.lock +++ b/flake.lock @@ -36,16 +36,17 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1639947939, - "narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=", - "owner": "nix-community", + "lastModified": 1641890987, + "narHash": "sha256-CJOAOlk7mZlBVvUiv9q8SYkK0rjY0UmkWedMI0eajWE=", + "owner": "mhuesch", "repo": "naersk", - "rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653", + "rev": "193e049d6e4c841faf800e302551d2e0a48eee88", "type": "github" }, "original": { - "owner": "nix-community", + "owner": "mhuesch", "repo": "naersk", + "rev": "193e049d6e4c841faf800e302551d2e0a48eee88", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 848c813..60f3341 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,11 @@ flake = false; }; flake-utils.url = "github:numtide/flake-utils"; - naersk.url = "github:nix-community/naersk"; + + # https://github.com/nix-community/naersk/pull/211 + naersk.url = "github:mhuesch/naersk?rev=193e049d6e4c841faf800e302551d2e0a48eee88"; + # naersk.url = "github:nix-community/naersk"; + nixpkgs.url = "github:nixos/nixpkgs/21.11"; nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla"; }; From 6b06f179367f4ca0d0fcd51f90a3a17a7d0d8dcf Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 18:15:00 -0700 Subject: [PATCH 14/16] Add rev in attempt to address CI failure --- Cargo.lock | 2 +- examples/fat/src/fat/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9578c1..474d8b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -278,7 +278,7 @@ dependencies = [ [[package]] name = "fatfs" version = "0.4.0" -source = "git+https://github.com/rafalh/rust-fatfs#87fc1ed5074a32b4e0344fcdde77359ef9e75432" +source = "git+https://github.com/rafalh/rust-fatfs?rev=87fc1ed5074a32b4e0344fcdde77359ef9e75432#87fc1ed5074a32b4e0344fcdde77359ef9e75432" dependencies = [ "bitflags", "chrono", diff --git a/examples/fat/src/fat/Cargo.toml b/examples/fat/src/fat/Cargo.toml index 56c464e..b08e075 100644 --- a/examples/fat/src/fat/Cargo.toml +++ b/examples/fat/src/fat/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" crate-type = ["cdylib"] [dependencies] -fatfs = { git = "https://github.com/rafalh/rust-fatfs" } +fatfs = { git = "https://github.com/rafalh/rust-fatfs", rev = "87fc1ed5074a32b4e0344fcdde77359ef9e75432" } fscommon = "0.1" ic-cdk = { git = "https://github.com/dfinity/cdk-rs.git", rev = "a253119adb08929b6304d007ee0a6a37960656ed" } ic-cdk-macros = "0.3" From 7a95bc0ede8b3f79eb6f12e55fd506b556a51218 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 18:28:46 -0700 Subject: [PATCH 15/16] Remove ubuntu from the build matrix for now https://github.com/paulyoung/nixpkgs-dfinity-sdk/issues/1 --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index d8fd108..fa185c6 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -7,7 +7,7 @@ jobs: name: Nix on ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 From 89c48cf38ae20d4afab4a786bb6079c42051358e Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Sun, 20 Mar 2022 18:36:56 -0700 Subject: [PATCH 16/16] Add ubuntu back to matrix, remove nix flake check Need to consider which systems to support instead of using `flake-utils.lib.eachDefaultSystem` since the DFINITY SDK and `nixpkgs-dfinity-sdk` doesn't support everything. https://github.com/paulyoung/nixpkgs-dfinity-sdk/issues/1 --- .github/workflows/nix.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index fa185c6..79460d5 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -7,10 +7,9 @@ jobs: name: Nix on ${{ matrix.os }} strategy: matrix: - os: [macos-latest] + os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 - uses: cachix/install-nix-action@v15 - run: nix build --show-trace - - run: nix flake check