-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added nix flake #10934
feat: added nix flake #10934
Changes from all commits
d51e328
a2f8b12
20b0058
f3a6420
0e77328
5d46321
f369373
02567bc
2b13ebc
ff19937
ea4cbef
a33cd79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Nix Flake Check | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- 'release-*' | ||
- 'dev-*' | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
flake-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v9 | ||
|
||
- name: Enable flakes | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
- name: Check Nix flake inputs | ||
run: nix flake check | ||
|
||
- name: Show flake metadata | ||
if: always() # Run even if previous step fails | ||
run: nix flake metadata | ||
|
||
- name: Validate flake outputs | ||
if: always() # Run even if previous step fails | ||
run: nix flake show | ||
JeancarloBarrios marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Check build in Nix dev shell | ||
run: | | ||
# Enter nix develop and run build commands | ||
nix develop --command bash -c ' | ||
# Install dependencies | ||
yarn install | ||
|
||
# Build the project | ||
yarn build | ||
|
||
# Build cosmic-swingset | ||
cd packages/cosmic-swingset && make | ||
' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this flake depend on configuration from your system wide flake? Because when I try to build it I get the following error.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm it should not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it should not, how did you installed nix? make sure flakes are enable to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh oh, actually here you only need to run nix develop not nix build, I have only define a devshell I have not define a build shell yet There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember how i installed nix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in your nix config file generally: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @toliaqat lmk if it worked for you, remember to just run |
||
description = "Agoric SDK Development Environment"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
# Custom Node.js 20.9.0 package | ||
custom_node_20_9 = pkgs.stdenv.mkDerivation { | ||
JeancarloBarrios marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pname = "nodejs"; | ||
version = "20.9.0"; | ||
|
||
src = pkgs.fetchurl { | ||
url = "https://nodejs.org/dist/v20.9.0/node-v20.9.0-${if pkgs.stdenv.isDarwin then "darwin" else "linux"}-${if pkgs.stdenv.isAarch64 then "arm64" else "x64"}.tar.gz"; | ||
sha256 = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then | ||
"0snfsz2mmjdavi38nglayw5yia74q9h1xzz2ahpri8yqx1md9lii" # darwin-arm64 | ||
else if pkgs.stdenv.isDarwin then | ||
"1j6cw6i3hjqv8zk1nbsqg560k7rgcmyl9cfd4vlvn5wclzr76nzw" # darwin-x64 | ||
else if pkgs.stdenv.isAarch64 then | ||
"0skah3bal5irvramnfn86vgi0c375ywsyb4xaxmx3gvlnbpdp9yj" # linux-arm64 | ||
else if (pkgs.stdenv.isLinux && !pkgs.stdenv.isAarch64) then | ||
"0q3gy4z5b8dd0w37ya5wlkbv4xhyqa1s0zwh71258x5z5w4rz4gh" # linux-x64 | ||
else | ||
throw "Unsupported system: This derivation only supports Linux (x64/arm64) and Darwin (x64/arm64) systems"; | ||
}; | ||
|
||
installPhase = '' | ||
echo "installing nodejs" | ||
mkdir -p $out | ||
cp -r ./ $out/ | ||
''; | ||
|
||
|
||
# Meta information for the package | ||
meta = with pkgs.lib; { | ||
description = "Node.js 20.9.0 JavaScript runtime"; | ||
homepage = "https://nodejs.org"; | ||
license = licenses.mit; | ||
platforms = platforms.unix; | ||
}; | ||
}; | ||
in | ||
{ | ||
devShells.default = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
custom_node_20_9 | ||
(yarn.override { nodejs = custom_node_20_9; }) | ||
(python3.withPackages (ps: [ ps.distutils ])) | ||
pkg-config | ||
go_1_23 | ||
gopls | ||
delve | ||
gcc | ||
gnumake | ||
protobuf | ||
buf | ||
git | ||
]; | ||
|
||
shellHook = '' | ||
export PATH=$PATH:$HOME/go/bin | ||
|
||
echo "Node.js $(node --version)" | ||
echo "NPM $(npm --version)" | ||
echo "Yarn using Node.js $(yarn node -v)" | ||
''; | ||
}; | ||
} | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad there's CI for this feature! That should prevent accidental breakage.