-
Notifications
You must be signed in to change notification settings - Fork 58
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
Integrate nix-config-parser #263
Conversation
.metadata() | ||
.map_err(|e| ActionError::GettingMetadata(this.path.clone(), e))?; | ||
|
||
if let Some(mode) = mode { |
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.
This is our third occurrence of this code so we should consider extracting it in a future PR....
We never used user or group, so drop the related complexity. Easy to resurrect if we ever need to.
It's basically recorded in the merged_nix_config anyways.
also rename the const to more accurately reflect that it's a `nix.conf` comment character, not a comment character for the Nix language (despite being true for both cases).
"If {} already exists, we will attempt to merge the current settings with our settings; \ | ||
otherwise, it will be created with only our settings", | ||
self.path.display() | ||
)], |
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.
Can this message mention which settings it will change? (I think we have them here anyways)
vec![ActionDescription::new( | ||
self.tracing_synopsis(), | ||
vec![format!( | ||
"If {} already exists, we will attempt to merge the current settings with our settings; \ |
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 not sure the wording/styling of using "our" here matches the current plan explanation format:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.13.2/nix-2.13.2-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create build users (UID 30000-30032) and group (GID 30000)
The Nix daemon requires system users (and a group they share) which it can act as in order to build
Create group `nixbld` (GID 30000)
Create user `nixbld0` (UID 30000) in group `nixbld` (GID 30000)
Create user `nixbld1` (UID 30001) in group `nixbld` (GID 30000)
Create user `nixbld2` (UID 30002) in group `nixbld` (GID 30000)
Create user `nixbld3` (UID 30003) in group `nixbld` (GID 30000)
Create user `nixbld4` (UID 30004) in group `nixbld` (GID 30000)
Create user `nixbld5` (UID 30005) in group `nixbld` (GID 30000)
Create user `nixbld6` (UID 30006) in group `nixbld` (GID 30000)
Create user `nixbld7` (UID 30007) in group `nixbld` (GID 30000)
Create user `nixbld8` (UID 30008) in group `nixbld` (GID 30000)
Create user `nixbld9` (UID 30009) in group `nixbld` (GID 30000)
Create user `nixbld10` (UID 30010) in group `nixbld` (GID 30000)
Create user `nixbld11` (UID 30011) in group `nixbld` (GID 30000)
Create user `nixbld12` (UID 30012) in group `nixbld` (GID 30000)
Create user `nixbld13` (UID 30013) in group `nixbld` (GID 30000)
Create user `nixbld14` (UID 30014) in group `nixbld` (GID 30000)
Create user `nixbld15` (UID 30015) in group `nixbld` (GID 30000)
Create user `nixbld16` (UID 30016) in group `nixbld` (GID 30000)
Create user `nixbld17` (UID 30017) in group `nixbld` (GID 30000)
Create user `nixbld18` (UID 30018) in group `nixbld` (GID 30000)
Create user `nixbld19` (UID 30019) in group `nixbld` (GID 30000)
Create user `nixbld20` (UID 30020) in group `nixbld` (GID 30000)
Create user `nixbld21` (UID 30021) in group `nixbld` (GID 30000)
Create user `nixbld22` (UID 30022) in group `nixbld` (GID 30000)
Create user `nixbld23` (UID 30023) in group `nixbld` (GID 30000)
Create user `nixbld24` (UID 30024) in group `nixbld` (GID 30000)
Create user `nixbld25` (UID 30025) in group `nixbld` (GID 30000)
Create user `nixbld26` (UID 30026) in group `nixbld` (GID 30000)
Create user `nixbld27` (UID 30027) in group `nixbld` (GID 30000)
Create user `nixbld28` (UID 30028) in group `nixbld` (GID 30000)
Create user `nixbld29` (UID 30029) in group `nixbld` (GID 30000)
Create user `nixbld30` (UID 30030) in group `nixbld` (GID 30000)
Create user `nixbld31` (UID 30031) in group `nixbld` (GID 30000)
Add user `nixbld0` (UID 30000) to group `nixbld` (GID 30000)
Add user `nixbld1` (UID 30001) to group `nixbld` (GID 30000)
Add user `nixbld2` (UID 30002) to group `nixbld` (GID 30000)
Add user `nixbld3` (UID 30003) to group `nixbld` (GID 30000)
Add user `nixbld4` (UID 30004) to group `nixbld` (GID 30000)
Add user `nixbld5` (UID 30005) to group `nixbld` (GID 30000)
Add user `nixbld6` (UID 30006) to group `nixbld` (GID 30000)
Add user `nixbld7` (UID 30007) to group `nixbld` (GID 30000)
Add user `nixbld8` (UID 30008) to group `nixbld` (GID 30000)
Add user `nixbld9` (UID 30009) to group `nixbld` (GID 30000)
Add user `nixbld10` (UID 30010) to group `nixbld` (GID 30000)
Add user `nixbld11` (UID 30011) to group `nixbld` (GID 30000)
Add user `nixbld12` (UID 30012) to group `nixbld` (GID 30000)
Add user `nixbld13` (UID 30013) to group `nixbld` (GID 30000)
Add user `nixbld14` (UID 30014) to group `nixbld` (GID 30000)
Add user `nixbld15` (UID 30015) to group `nixbld` (GID 30000)
Add user `nixbld16` (UID 30016) to group `nixbld` (GID 30000)
Add user `nixbld17` (UID 30017) to group `nixbld` (GID 30000)
Add user `nixbld18` (UID 30018) to group `nixbld` (GID 30000)
Add user `nixbld19` (UID 30019) to group `nixbld` (GID 30000)
Add user `nixbld20` (UID 30020) to group `nixbld` (GID 30000)
Add user `nixbld21` (UID 30021) to group `nixbld` (GID 30000)
Add user `nixbld22` (UID 30022) to group `nixbld` (GID 30000)
Add user `nixbld23` (UID 30023) to group `nixbld` (GID 30000)
Add user `nixbld24` (UID 30024) to group `nixbld` (GID 30000)
Add user `nixbld25` (UID 30025) to group `nixbld` (GID 30000)
Add user `nixbld26` (UID 30026) to group `nixbld` (GID 30000)
Add user `nixbld27` (UID 30027) to group `nixbld` (GID 30000)
Add user `nixbld28` (UID 30028) to group `nixbld` (GID 30000)
Add user `nixbld29` (UID 30029) to group `nixbld` (GID 30000)
Add user `nixbld30` (UID 30030) to group `nixbld` (GID 30000)
Add user `nixbld31` (UID 30031) to group `nixbld` (GID 30000)
* Create a directory tree in `/nix`
Create directory `/nix/var`
Create directory `/nix/var/log`
Create directory `/nix/var/log/nix`
Create directory `/nix/var/log/nix/drvs`
Create directory `/nix/var/nix`
Create directory `/nix/var/nix/db`
Create directory `/nix/var/nix/gcroots`
Create directory `/nix/var/nix/gcroots/per-user`
Create directory `/nix/var/nix/profiles`
Create directory `/nix/var/nix/profiles/per-user`
Create directory `/nix/var/nix/temproots`
Create directory `/nix/var/nix/userpool`
Create directory `/nix/var/nix/daemon-socket`
* Move the downloaded Nix into `/nix`
Nix is being downloaded to `/nix/temp-install-dir` and should be in `/nix`
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
This file is read by the Nix daemon to set its configuration options at runtime.
* Place channel configuration at `/root/.nix-channels`
* Configure the shell profiles
Update shell profiles to import Nix
* Configure Nix daemon related settings with systemd
Run `systemd-tempfiles --create --prefix=/nix/var/nix`
Run `systemctl link /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.service`
Run `systemctl link /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.socket`
Run `systemctl daemon-reload`
Run `systemctl enable --now /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.socket`
Perhaps like "Update the /etc/nix/nix.conf
settings $LIST_OF_SETTINGS`?"
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.
This looks good! As I mentioned in DMs with you I am slightly concerned about someone getting to the install prompt (when we have built the plan already) and having a terminal open editing their nix.conf
then executing the plan and us forgetting those changes.
We discussed how we should add a simple check, or do the same planning behavior at execute time as well (checking twice, basically), with plan-time being just a validation step.
Co-authored-by: Ana Hobden <[email protected]>
I'm sorry about the merge conflict! |
I'd like to move the stuff into |
This way we don't need to diff between plan time and exeucte time -- we just accept whatever exists at execute time is what we want to modify (if possible).
Description
Closes #174.
Progress towards #126.
Checklist
cargo fmt
nix build
nix flake check
Validating with
install.determinate.systems
If a maintainer has added the
upload to s3
label to this PR, it will become available for installation viainstall.determinate.systems
:TODO:
nix_configs
members (including in logging)Option<Path>
when parsing a string -- Make pathOption
al in parse_nix_config_string nix-config-parser#2