diff --git a/README.md b/README.md index 204d78181a..1cbf7e60ef 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,15 @@ npm install npm run doc ``` +# Using Nix shell +```shell +git clone https://github.com/waku-org/js-waku.git +cd js-waku +nix develop +npm install +npm run doc +``` + ## Bugs, Questions & Features If you encounter any bug or would like to propose new features, feel free to [open an issue](https://github.com/waku-org/js-waku/issues/new/). diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 84740abd09..0b09d74ab0 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -1,5 +1,13 @@ pipeline { - agent { label 'linux' } + agent { + docker { + label 'linuxcontainer' + image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0' + args '--volume=/nix:/nix ' + + '--volume=/etc/nix:/etc/nix ' + + '--user jenkins' + } + } options { disableConcurrentBuilds() @@ -21,19 +29,25 @@ pipeline { stages { stage('Deps') { steps { - sh 'npm install' + script { + nix.develop('npm install', pure: true) + } } } stage('Packages') { steps { - sh 'npm run build' + script { + nix.develop('npm run build', pure: true) + } } } stage('Build') { steps { - sh 'npm run doc' + script { + nix.develop('npm run doc', pure: true) + } } } @@ -41,7 +55,9 @@ pipeline { when { expression { GIT_BRANCH.endsWith('master') } } steps { sshagent(credentials: ['status-im-auto-ssh']) { - sh 'npm run deploy' + script { + nix.develop('npm run deploy', pure: true) + } } } } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..03dff37982 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1761016216, + "narHash": "sha256-G/iC4t/9j/52i/nm+0/4ybBmAF4hzR8CNHC75qEhjHo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "481cf557888e05d3128a76f14c76397b7d7cc869", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-25.05", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..4b4f6e8633 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "Nix flake development shell."; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-25.05"; + }; + + outputs = + { self, nixpkgs }: + let + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs supportedSystems; + pkgsFor = forEachSystem (system: import nixpkgs { inherit system; }); + in + rec { + formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt); + + devShells = forEachSystem (system: { + default = pkgsFor.${system}.mkShellNoCC { + packages = with pkgsFor.${system}.buildPackages; [ + git # 2.44.1 + openssh # 9.7p1 + nodejs_20 # v20.15.1 + ]; + }; + }); + }; +}