Comments (9)
BTW, I was able to follow https://nixcademy.com/2024/01/15/nix-on-macos/ and run
nix run nix-darwin -- switch --flake path.to.initial.flake
without obvious error, but could not find nix-darwin
or darwin-rebuild
after the command. I then run nix-store --gc
and run the command again and found out it was much slower, not sure why. Maybe because the first time it downloaded stuff from https://mirror.sjtu.edu.cn/nix-channels/store
configured in /etc/nix/nix.conf
and the second time I saw it downloaded from https://cache.nixos.org
.
The following is the content of my current /etc/nix/nix.conf
:
experimental-features = nix-command flakes
# trusted-substituters = https://mirror.iscas.ac.cn/nix-channels/store https://cache.nixos.org/
substituters = https://mirror.sjtu.edu.cn/nix-channels/store https://cache.nixos.org
build-users-group = nixbld
trusted-users = my.current.username
I can see it's now a symlink to a file in /nix/store/
macOS.CLI> ls -l /etc/nix/nix.conf
lrwxr-xr-x 1 root wheel 24B 6 29 17:46 /etc/nix/nix.conf -> /etc/static/nix/nix.conf
macOS.CLI> ls -l /etc/static/nix/nix.conf
lrwxr-xr-x 1 root wheel 52B 1 1 1970 /etc/static/nix/nix.conf -> /nix/store/kbxh2adn9rpc03ls888z5485v3fq7rkb-nix.conf
Previously, I would occasionally hand edit /etc/nix/nix.conf
, but now that it's a symbolic link to a file in /nix/store/
I should not hand edit the file any more. Am I right?
How do I reverse the effects/changes applied by nix run nix-darwin -- switch --flake ...
?
from nix-darwin.
without obvious error, but could not find nix-darwin or darwin-rebuild after the command.
Did you restart your shell?
from nix-darwin.
I believe
nix-info
reported wrong macOS version, it should bemacOS 11.7.8 (20G1351)
.
For some time after switching away from the 10.x numbering scheme, some system APIs would still return OS versions in that format for compatibility reasons, so that's not an issue.
Previously, I would occasionally hand edit
/etc/nix/nix.conf
, but now that it's a symbolic link to a file in/nix/store/
I should not hand edit the file any more. Am I right?
This is correct. Instead of editing it by hand, you would configure it with the nix
options in your nix-darwin system configuration. For example, I have this in my system configuration:
nix.settings = {
auto-optimise-store = true;
experimental-features =
[ "ca-derivations" "flakes" "nix-command" "repl-flake" ];
keep-derivations = true;
keep-outputs = true;
substituters = [ "https://cache.garnix.io" ];
trusted-public-keys =
[ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
which translates into this /etc/nix/nix.conf
:
# WARNING: this file is generated from the nix.* options in
# your nix-darwin configuration. Do not edit it!
allowed-users = *
auto-optimise-store = true
build-users-group = nixbld
cores = 0
experimental-features = ca-derivations flakes nix-command repl-flake
extra-sandbox-paths =
keep-derivations = true
keep-outputs = true
max-jobs = auto
require-sigs = true
sandbox = false
sandbox-fallback = false
substituters = https://cache.garnix.io https://cache.nixos.org/
trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
trusted-substituters =
trusted-users = root
from nix-darwin.
Did you restart your shell?
No. I realized I should have tried opening a new shell. I saw the following in the store:
macOS.CLI> ls -l /nix/store | rg 'nix-darwin'
dr-xr-xr-x 16 root nixbld 512B 1 1 1970 6ir80yhfd7lhiqp78i43kq8hr947wcyg-nix-darwin/
macOS.CLI> ls -l /nix/store | rg --count 'darwin'
190
macOS.CLI> ls -l /nix/store | rg 'darwin-rebuild'
-r--r--r-- 1 root nixbld 2.7K 1 1 1970 310pjmvk23w2m7cr0kkx5hia7w5cgaq1-darwin-rebuild.drv
-r--r--r-- 1 root nixbld 0.7K 1 1 1970 bv7zmylsbdlzipw606ynsc51s424gb0y-darwin-rebuild.zsh-completions
dr-xr-xr-x 4 root wheel 128B 1 1 1970 g3274z1798yh881a9n7f1sy3mkl8ifkh-darwin-rebuild/
-r--r--r-- 1 root nixbld 6.7K 1 1 1970 izq9m1f78vnrp908rkmrbh59765wdjpv-darwin-rebuild.sh
dr-xr-xr-x 4 root wheel 128B 1 1 1970 rrbn6iyqkxriaa34x8v2l94iq81mchhi-darwin-rebuild/
-r--r--r-- 1 root nixbld 2.8K 1 1 1970 w5q0pckls3i3qf9jcj9w83r8nndhngqh-darwin-rebuild.drv
from nix-darwin.
This is correct. Instead of editing it by hand, you would configure it with the
nix
options in your nix-darwin system configuration. For example, I have this in my system configuration:
Thank you for the confirmation and the reference configuration.
from nix-darwin.
Is there anything else we can help with here? I’d like the documentation to be approachable and address anything confusing in it. Unfortunately we’re probably not equipped to explain the flakes feature from scratch, but maybe we could introduce them a little, link to a general tutorial (although we’d need to decide which), and more clearly separate out the choice of flake vs. non‐flake configuration? It’d be useful to know what would have helped point you in the right direction as a beginner.
from nix-darwin.
run the command again and found out it was much slower, not sure why
I figured this out by running the following:
nix --option substituters "https://mirror.iscas.ac.cn/nix-channels/store" \
--option trusted-substituters "https://mirror.iscas.ac.cn/nix-channels/store" \
--option trusted-users "$USER" run nix-darwin -- switch --flake ~/.config/nix
and it finished a lot quicker.
from nix-darwin.
what is the relationship between
configuration.nix
andflake.nix
At least explain this a bit. I thought "are they referring to the same file there?".
With
mkdir -p ~/.config/nix-darwin
cd ~/.config/nix-darwin
in that section, I assumed ~/.config/nix-darwin
is empty from scratch. Then in Migrating from an existing configuration.nix section the document says
Add the following to
flake.nix
in the same folder asconfiguration.nix
Is this second flake.nix
referring to the same flake.nix
in Getting started from scratch section?
It's like referring to flake.nix
or nix run nix-darwin -- switch --flake .
without the cd ~/.config/nix-darwin
.
Maybe provide a basic/working /path/to/configutration.nix
example there.
from nix-darwin.
I appreciate the feedback, thank you! I’ll try and take a look at how we can make the documentation more clear here soon if someone else doesn’t beat me to it.
from nix-darwin.
Related Issues (20)
- Unable to install on top of a fresh Lix install HOT 2
- feature: dock.nix: add modifier options for hot corners HOT 5
- Installing flake breaks nix on MacOS Sonoma completely HOT 1
- Builder for hatch (needed for system-applications, thus for darwin-system-24.05) failure HOT 9
- Failure to build manual for 24.05 on x86 HOT 3
- configuring <data> fields in plists/defaults ( hex values )
- feature: Add option for disabling pointer acceleration HOT 3
- Manage Spotlight indexing exclusions
- FR: nixpkgs.flake.{source,setNixPath,setFlakeRegistry} settings
- Is it possible to use sketchybar lua? HOT 2
- How to disable Nix channels? HOT 3
- Option to add `vscode` entries in Brewfile
- Make `nushell` default shell (`programs.nushell.enable`)?
- Build failure: python312Packages.pyuv HOT 2
- Google Chrome Canary cask installed via Nix will not auto-update
- `homebrew.onActivation.cleanup`: option to fail activation as part of checks
- ```darwin-rebuild switch --flake ~/.config/nix``` is trying to create a system link in the store
- hash mismatch after flake update HOT 5
- Option to configure /etc/hosts file HOT 1
- finder option to enable search in only in current folder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix-darwin.