-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322512 from tweag/pinned-nixfmt
Development shell with a pinned nixfmt
- Loading branch information
Showing
7 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: "Check shell" | ||
|
||
on: | ||
pull_request_target: | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
x86_64-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
with: | ||
# pull_request_target checks out the base branch by default | ||
ref: refs/pull/${{ github.event.pull_request.number }}/merge | ||
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26 | ||
- name: Build shell | ||
run: nix-build shell.nix | ||
|
||
aarch64-darwin: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
with: | ||
# pull_request_target checks out the base branch by default | ||
ref: refs/pull/${{ github.event.pull_request.number }}/merge | ||
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26 | ||
- name: Build shell | ||
run: nix-build shell.nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# CI support files | ||
|
||
This directory contains files to support CI, such as [GitHub Actions](https://github.com/NixOS/nixpkgs/tree/master/.github/workflows) and [Ofborg](https://github.com/nixos/ofborg). | ||
This is in contrast with [`maintainers/scripts`](`../maintainers/scripts`) which is for human use instead. | ||
|
||
## Pinned Nixpkgs | ||
|
||
CI may need certain packages from Nixpkgs. | ||
In order to ensure that the needed packages are generally available without building, | ||
[`pinned-nixpkgs.json`](./pinned-nixpkgs.json) contains a pinned Nixpkgs version tested by Hydra. | ||
|
||
Run [`update-pinned-nixpkgs.sh`](./update-pinned-nixpkgs.sh) to update it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"rev": "cfb89a95f19bea461fc37228dc4d07b22fe617c2", | ||
"sha256": "1yhsacvry6j8r02lk70p9dphjpi8lpzgq2qay8hiy4nqlys0mrch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p jq | ||
|
||
set -euo pipefail | ||
|
||
# https://stackoverflow.com/a/246128 | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
repo=https://github.com/nixos/nixpkgs | ||
branch=nixpkgs-unstable | ||
file=$SCRIPT_DIR/pinned-nixpkgs.json | ||
|
||
rev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1) | ||
sha256=$(nix-prefetch-url --unpack "$repo/archive/$rev.tar.gz" --name source) | ||
|
||
jq -n --arg rev "$rev" --arg sha256 "$sha256" '$ARGS.named' | tee /dev/stderr > $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# A shell to get tooling for Nixpkgs development | ||
# | ||
# Note: We intentionally don't use Flakes here, | ||
# because every time you change any file and do another `nix develop`, | ||
# it would create another copy of the entire ~500MB tree in the store. | ||
# See https://github.com/NixOS/nix/pull/6530 for the future | ||
{ | ||
system ? builtins.currentSystem, | ||
}: | ||
let | ||
pinnedNixpkgs = builtins.fromJSON (builtins.readFile ci/pinned-nixpkgs.json); | ||
|
||
nixpkgs = fetchTarball { | ||
url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgs.rev}.tar.gz"; | ||
sha256 = pinnedNixpkgs.sha256; | ||
}; | ||
|
||
pkgs = import nixpkgs { | ||
inherit system; | ||
config = {}; | ||
overlays = []; | ||
}; | ||
in | ||
pkgs.mkShellNoCC { | ||
packages = [ | ||
# The default formatter for Nix code | ||
# https://github.com/NixOS/nixfmt | ||
pkgs.nixfmt-rfc-style | ||
]; | ||
} |