Skip to content
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

[Techstack-beta] Dev environment doesn't work with default NixOS configuration #1285

Closed
samueldr opened this issue Mar 3, 2024 · 0 comments · Fixed by #1297
Closed

[Techstack-beta] Dev environment doesn't work with default NixOS configuration #1285

samueldr opened this issue Mar 3, 2024 · 0 comments · Fixed by #1297
Assignees
Labels
new-techstack-beta This tag marks issues with the new tech stack during preview phase

Comments

@samueldr
Copy link
Member

samueldr commented Mar 3, 2024

The npm scripts rely on the experimental CLI, and experimental features.

~/.../NixOS/nixos-homepage $ nix-shell 

  To bootstrap developing environment run:
      npm install

  To start developing run:
      npm run dev

  and go to the following URL in your browser:
      http://localhost:4321

  It will rebuild the website on each change.

[nix-shell:~/.../NixOS/nixos-homepage]$ npm run dev

> next@0.0.1 dev
> npm run prebuild && astro dev


> next@0.0.1 prebuild
> npm run prebuild:manuals && npm run prebuild:pills && npm run prebuild:demos


> next@0.0.1 prebuild:manuals
> nix build .#manuals -o ./result-manuals && mkdir -p ./public/manual && cp --no-preserve=mode,ownership -RL ./result-manuals/* ./public/manual/

error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

Adding the missing experimental arguments

diff --git a/package.json b/package.json
index 12eb8799c..f0ede457c 100644
--- a/package.json
+++ b/package.json
@@ -5,9 +5,9 @@
   "scripts": {
     "dev": "npm run prebuild && astro dev",
     "start": "npm run prebuild && astro dev",
-    "prebuild:manuals": "nix build .#manuals -o ./result-manuals && mkdir -p ./public/manual && cp --no-preserve=mode,ownership -RL ./result-manuals/* ./public/manual/",
-    "prebuild:pills": "nix build .#pills -o ./result-pills && mkdir -p ./public/guides/nix-pills && cp --no-preserve=mode,ownership -RL ./result-pills/* ./public/guides/nix-pills/",
-    "prebuild:demos": "nix build .#demos -o ./result-demos && mkdir -p ./public/demos && cp --no-preserve=mode,ownership -RL ./result-demos/* ./public/demos/",
+    "prebuild:manuals": "nix --extra-experimental-features flakes --extra-experimental-features nix-command build .#manuals -o ./result-manuals && mkdir -p ./public/manual && cp --no-preserve=mode,ownership -RL ./result-manuals/* ./public/manual/",
+    "prebuild:pills": "nix --extra-experimental-features flakes --extra-experimental-features nix-command build .#pills -o ./result-pills && mkdir -p ./public/guides/nix-pills && cp --no-preserve=mode,ownership -RL ./result-pills/* ./public/guides/nix-pills/",
+    "prebuild:demos": "nix --extra-experimental-features flakes --extra-experimental-features nix-command build .#demos -o ./result-demos && mkdir -p ./public/demos && cp --no-preserve=mode,ownership -RL ./result-demos/* ./public/demos/",
     "prebuild": "npm run prebuild:manuals && npm run prebuild:pills && npm run prebuild:demos",
     "build": "npm run prebuild && astro build",
     "preview": "astro preview",

I am unexpectedly interrupted with Nix interactive questions

[nix-shell:~/.../NixOS/nixos-homepage]$ npm run dev

> next@0.0.1 dev
> npm run prebuild && astro dev


> next@0.0.1 prebuild
> npm run prebuild:manuals && npm run prebuild:pills && npm run prebuild:demos


> next@0.0.1 prebuild:manuals
> nix --extra-experimental-features flakes --extra-experimental-features nix-command build .#manuals -o ./result-manuals && mkdir -p ./public/manual && cp --no-preserve=mode,ownership -RL ./result-manuals/* ./public/manual/

warning: Git tree '/Users/samuel/Projects/NixOS/nixos-homepage' is dirty
do you want to allow configuration setting 'extra-substituters' to be set to 'https://nixos-homepage.cachix.org https://nixos-nix-install-tests.cachix.org' (y/N)? 

I expect that when running a dev command (npm run dev here) that it won't be interrupted by a couple interactive questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-techstack-beta This tag marks issues with the new tech stack during preview phase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants