Merge pull request #5782 from roc-lang/nix-devtools-update

Nix devtools update + test
This commit is contained in:
Anton-4 2023-09-07 02:02:29 +02:00 committed by GitHub
commit e010e7239f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 19 deletions

57
.github/workflows/devtools_test.yml vendored Normal file
View file

@ -0,0 +1,57 @@
on:
pull_request:
name: Test the devtools nix files
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
devtools-test:
name: devtools-test
runs-on: [ubuntu-20.04]
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
- name: Only run all steps if flake.lock changed
id: checklock
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep 'flake.lock'; then
echo "Flake.lock was changed. Testing devtools nix files..."
echo "::set-output name=changed::true"
else
echo "Flake.lock was not changed. No need to run tests."
echo "::set-output name=changed::false"
fi
- uses: cachix/install-nix-action@v23
if: steps.checklock.outputs.changed == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: test devtools/flake.nix
if: steps.checklock.outputs.changed == 'true'
id: devtools_test_step
run: |
sed -i "s|/home/username/gitrepos/roc|$(realpath .)|g" devtools/flake.nix
cat devtools/flake.nix
mkdir -p ../temp
cp devtools/flake.nix ../temp
cp devtools/flake.lock ../temp
cd ../temp
git init
git add flake.nix flake.lock
nix develop
- name: Print tip on fail
if: steps.devtools_test_step.outcome == 'failure'
run: |
echo "The devtools test failed, this can likely be fixed by"
echo "locally deleting devtools/flake.lock and following the"
echo "instructions in devtools/README.md. This will create a"
echo "new flake.lock you should use to replace the old devtools/flake.lock"

6
devtools/README.md Normal file → Executable file
View file

@ -7,10 +7,10 @@ The flake in this folder is meant for vscode, feel free to create a PR if you'li
Further steps:
1. Copy the flake.nix and flake.lock file to a new folder outside of the roc repo folder.
1. Copy the flake.nix and flake.lock file from the devtools folder to a new folder outside of the roc repo folder.
1. Run `git init` in the new folder.
1. Execute `git add flake.nix`, nix will error if you don't do this.
1. Change `roc.url = "path:/home/username/gitrepos/roc9/roc";` to the location of the roc folder on your machine.
1. Execute `git add flake.nix flake.lock`, nix will error if you don't do this.
1. Change `roc.url = "path:/home/username/gitrepos/roc";` to the location of the roc folder on your machine.
1. Follow instructions about vscode extensions [here](#extensions).
1. add other dev tools you like in the `devInputs` list. You can search for those [here](https://search.nixos.org/packages).
1. Run `nix develop`.

28
devtools/flake.lock generated Normal file → Executable file
View file

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"type": "github"
},
"original": {
@ -93,17 +93,17 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1674860021,
"narHash": "sha256-ES4XUf/AlPp8RetKR6WlWgYEZ7bLWI7k6reHp2q9rqY=",
"lastModified": 1690279121,
"narHash": "sha256-XoPGhV1UJQPue6RiehAu7lQwKss3J1B/K0QtVOMD83A=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9f4346eac544cc0db5eb7d889e71eac0f9c8b9eb",
"rev": "821c72743ceae44bdd09718d47cab98fd5fd90af",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9f4346eac544cc0db5eb7d889e71eac0f9c8b9eb",
"rev": "821c72743ceae44bdd09718d47cab98fd5fd90af",
"type": "github"
}
},
@ -115,13 +115,13 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1682784625,
"narHash": "sha256-QUncKiwgpmHajo601NNHOjeUG2/vrGp1oMgxnPhq900=",
"path": "/home/username/gitrepos/roc9/roc",
"lastModified": 1694000770,
"narHash": "sha256-92bAbPmwXxD6rwaAViG5O9r91ZBh9bqaZhM3egPCjuw=",
"path": "/home/anton/gitrepos/roc",
"type": "path"
},
"original": {
"path": "/home/username/gitrepos/roc9/roc",
"path": "/home/anton/gitrepos/roc",
"type": "path"
}
},
@ -140,11 +140,11 @@
]
},
"locked": {
"lastModified": 1682389182,
"narHash": "sha256-8t2nmFnH+8V48+IJsf8AK51ebXNlVbOSVYOpiqJKvJE=",
"lastModified": 1690252178,
"narHash": "sha256-9oEz822bvbHobfCUjJLDor2BqW3I5tycIauzDlzOALY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "74f1a64dd28faeeb85ef081f32cad2989850322c",
"rev": "8d64353ca827002fb8459e44d49116c78d868eba",
"type": "github"
},
"original": {

4
devtools/flake.nix Normal file → Executable file
View file

@ -3,7 +3,7 @@
inputs = {
# change this path to the path of your roc folder
roc.url = "path:/home/username/gitrepos/roc9/roc";
roc.url = "path:/home/username/gitrepos/roc";
# to easily make configs for multiple architectures
flake-utils.url = "github:numtide/flake-utils";
};
@ -35,7 +35,7 @@
publisher = "benjamin-thomas";
version = "0.0.4";
# keep this sha for the first run, nix will tell you the correct one to change it to
sha256 = "sha256-mabNegZ+XPQ6EIHFk6jz2mAPLHAU6Pm3w0SiFB7IE+s=";
sha256 = "sha256-USZiXdvYa8hxj62cy6hdiS5c2tIDIQxSyux684lyAEY=";
}
]
;