Commit graph

290 commits

Author SHA1 Message Date
Ana Hobden 965185dcab
fsync after writing Nix config to attempt to fix the flaky preserves_comment test (#448) 2023-05-05 12:12:05 -07:00
Graham Christensen 5a58cf20be
Nix 2.13.3 -> 2.15.0 (#428)
* Nix 2.13.3 -> 2.15.0

* Use new path for profile path addition

---------

Co-authored-by: Ana Hobden <operator@hoverbear.org>
2023-05-01 10:15:21 -07:00
Ana Hobden b3c47227ff
Fixup a cure case where a store path already exists so we never make a symlink (#414) 2023-04-12 06:25:24 -07:00
Ana Hobden 4fc7a0db18
Check user group commands exist during plan (#411)
* Check user/group related commands exist prior to execution/revert

* Fixup

* Don't check for executables on mac

* fmt
2023-04-11 07:44:49 -07:00
Ana Hobden 9549d793cc
Avoid globbing issues by using symlinks and readlink (#413) 2023-04-11 07:44:20 -07:00
Ana Hobden 75627bcd91
Provide users a better error message if systemd is not active (#412)
* Provide users a better error message if systemd is not active

* Fixups

* Fix mac

* Fixup
2023-04-10 16:16:46 -07:00
Ana Hobden cb48a7261b
Handle the APFS volume not existing but the Service and Fstab being present (#405)
* Handle the APFS volume not existing but the Service and Fstab being present

* Add handling if we need to bootout the service

* Spelling

* Rename enum
2023-04-10 20:13:25 +00:00
Ana Hobden 16ddada7a3
Only stop the nix daemon if it's actually active, not just enabled (#410)
* Only stop the nix daemon if it's actually active, not just enabled

* Add vm-tests
2023-04-10 12:47:34 -07:00
Ana Hobden 1718e0c428
Trim fdesetup output, remove accidently committed SSL related settings (#403)
* Trim fdesetup output, remove accidently committed SSL related settings

* More complete revert of accidental code

* Fix a bad
2023-04-05 11:13:24 -07:00
Ana Hobden 8bb37f1bcf
Uninstall shouldn't fail fast (#382)
* Uninstall shouldn't fail fast

* wip

* wip

* No longer fails fast

* Tidy up error handling

* Touchup post merge

* Refactor nix tests

* Some minor fixes

* Uninstall fail tests

* Fiddle with messaging

* nixfmt

* Tweak display a bit

* fix docs

* Fix Mac

* Revert setting I was testing

* Reflect feedback about a log level
2023-04-05 15:12:38 +00:00
Ana Hobden 5ec1d0e9b9
Fixup create_volume_service action tag (#398) 2023-04-03 16:19:28 +00:00
Ana Hobden 5b9cb16c94
Add a bit of issue metadata (#386)
* Add a bit of issue metadata

* Immediately install
2023-03-29 17:24:34 +00:00
Ana Hobden c0e9e7015e
Revert default_missing_value to default_value (#380)
We don't need to do this anymore. It was some change I was testing that
didn't work, and I forgot to remove it.
2023-03-28 16:58:57 +00:00
Ana Hobden 607b5271c1
Use retry strategy after diskutil create (#376) 2023-03-28 09:47:12 -07:00
Ana Hobden 4856cff7b6
Make shell profile locations chosen by planner (#375)
* Make shell profile locations chosen by planner

* Fix mac

* Fix fixture
2023-03-27 21:36:54 +00:00
Ana Hobden a74c6da41e
Improve Mac Volume Curing (#362)
* Improve Mac Volume Curing

* Add test

* Improve error

* Speeling

* Remove comment

* Fix escaping issue

* Reflect comments
2023-03-27 13:28:47 -07:00
Ana Hobden 709e81565c
Fixup diagnostic_endpoint setting to be more flexible (#374)
* Fixup diagnostic_endpoint setting to be more flexible

* Fixup doctests
2023-03-27 11:56:44 -07:00
Ana Hobden b7839953dc
Do not try to reload the systemd daemon when we are using --no-start-daemon (#365) 2023-03-23 18:25:34 +00:00
Ana Hobden 11834a3aab
Detect fdesetup properly (#361) 2023-03-22 10:59:04 -07:00
Ana Hobden 9ab29d5e36
Add Rosetta check for Mac (#355)
* Add Rosetta check for Mac

* Use a different, better method

* Setup sysctl error
2023-03-22 10:58:46 -07:00
Ana Hobden f73f8fef38
Be less grumpy about existing file permissions. (#359)
* Don't set permissions on shell profiles

* Alter CreateOrInsertFile permissions behavior.

* Fixup tests
2023-03-22 09:26:34 -07:00
Ana Hobden 8afb8e457d
Use nixpkgs-unstable (#351) 2023-03-20 09:38:44 -07:00
Ana Hobden 371f94ba51
Set NIX_SSL_CERT_FILE in the daemon (#347)
* Set NIX_SSL_CERT_FILE in the daemon

* Fixups
2023-03-20 09:38:15 -07:00
Ana Hobden 3347ccb9d5
Update zshrc, not zshenv (#339)
* Update both zshenv and zshrc

* Update only zshrc

* Add troubleshooting section

* Correct diagnostics note in readme

* Quirks!

* Remove a period

* Improve wording

* Tidy readme a bit

* Unforget a period
2023-03-16 09:39:49 -07:00
Ana Hobden c128700130
Add ssl-cert-file option (#341)
* Add ssl-cert-file option

* Add reqwest support for ssl cert

* Fix build

* Include in install differences

* Handle weird paths, include ENV setting in instructions
2023-03-16 16:32:14 +00:00
Ana Hobden c55a59b10e
Groom plan synopsis (#338)
* Groom plan synopsis

* Review nits
2023-03-16 08:56:03 -07:00
Ana Hobden 89094e0d40
Proxy envs need to get elevated (#342) 2023-03-16 07:43:07 -07:00
Ana Hobden c13b08987b
Explicit proxy support (#337)
* Add proxy support

* Improve clap definition and check

* Include missing protocol

* Improve error
2023-03-14 07:56:57 -07:00
Ana Hobden a977370e74
Add fish vendor_conf.d support (#335)
* Add fish vendor_conf.d support

* Unmess naming
2023-03-13 15:01:00 -07:00
Cole Helbling 96d8870902
Default to systemd, refer to documentation if systemd is not available (#336) 2023-03-13 14:12:33 -07:00
Ana Hobden 8e27adcf98
Be more positive in help output about our software working and not failing (#334) 2023-03-13 14:09:20 -07:00
Cole Helbling 1861d48d59
Only list changed plan settings in summary (#333)
* Only list changed plan settings in summary

* List all settings when `--explain`ing

* Sort the settings output
2023-03-13 13:30:04 -07:00
Ana Hobden c6abf95f02
Add install script cure tests (#322)
* Add install script cure tests

* Add missing stuff from commit

* Fix installer-test-fedora-v36-install-script-multi-broken-daemon-disabled

* Do some renaming

* Speeling

* Tweak permissions since Mac apparently has no root group
2023-03-13 12:09:44 -07:00
Cole Helbling b96e6b2513
Make nix-installer plan invalid-plan fail (#331)
* Make `nix-installer plan invalid-plan` fail

Prior to this change, the `invalid-plan` would unexpectedly be
interpreted as the output path. Now there is a flag to specify where the
plan should be written to.

* use `out-file` and `NIX_INSTALLER_PLAN_OUT_FILE`
2023-03-13 17:41:52 +00:00
Cole Helbling 88eca9eb9c
Include user index in the user comment (#330)
* Include user index in the user comment

If they're all called "Nix build user", anywhere that shows up without
the uid / username would make it difficult to diagnose any issues that
may occur.

* Create users 1-32 instead of 0-31

The official install scripts start at 1 as well.

* Update fixtures

Yes, I hand-edited the macos json, sue me.

* fixup: accept a comment, not the index

* fixup: comment, not index
2023-03-13 10:16:02 -07:00
Ana Hobden e0080d1262
Repair /nix removal test (#320)
* Repair /nix removal test

* Iron out the logic better

* Repair nix flake check

* Remove extra sandbox=false flag

* Add ubuntu 16.04 test
2023-03-10 23:28:04 +00:00
Cole Helbling 32dca2e846
Support busybox user/group modification, more informational errors (#319) 2023-03-10 14:00:20 -08:00
Ana Hobden 7c2f1b03a5
Tweak the logging levels in CI and in some instrumentation (#318) 2023-03-10 11:50:08 -08:00
Ana Hobden 385283173b
Only symlink if the link doesn't already exist in configure_init_service.rs (#317) 2023-03-08 13:50:18 -08:00
Ana Hobden 07a48fe3bd
Cure APFS/Fstabs on Mac (#246)
* wip

* Do main editing portion

* Some more curing on fstab entries

* Overwrite fstab instead of append

* Add newline

* Improve --explain output for CreateNixVolume

* Tweak some permissions

* Fixup a few more permissions spots

* Improve encrypted volume handling

* Handle APFS volumes existing already to some degree

* Correct speeling

* More tweaking preparing for bootstrap/kickstart work

* Most of volume curing works

* Make kickstart use domain/service too

* Fixup nits

* Fix a missing format!
2023-03-08 12:49:13 -08:00
Ana Hobden 4a3deef2a0
Fixup a couple differences with the official installer scripts (#311)
* Fixup a couple differences with the official installer scripts

* Fixup broken tests
2023-03-08 12:44:11 -08:00
Cole Helbling f9ab680840
Cure existing systemd units (#313)
* Cure existing systemd units

* ActionError::Exists -> ActionError::DifferentContent

To more accurately reflect its associated error message.

* create_directory: use PathWasNotDir error instead

* check if the service files and an override dir exists in plan and execute

* fixup: target_os guarding

* fixup: check if existing file is a symlink and see if they link to the same place

* abstract systemd unit checking to function

* fixup: logic error

if the link_dest and unit_src were the same, we'd still error that the
file exists
2023-03-08 12:39:37 -08:00
Ana Hobden 85abfc3cb5
Curing existing /nix (#310)
* Curing existing /nix

* Fixup macs

* Suggest an uninstall command if the binary is not present

* Fixup some nits

* Skip a not great suggestion

* Suggest a nice url
2023-03-08 18:43:57 +00:00
Ana Hobden 5fe7dd9828
Remove nix channel placement (#304)
* Remove place_channel_configuration.rs

* Remove channels option

* Add fixture updates
2023-03-08 09:24:41 -08:00
Ana Hobden 6219b2c48d
Make CreateUser idempotent (#306) 2023-03-07 09:53:12 -08:00
Cole Helbling 2594316750
Integrate nix-config-parser (#263)
Co-authored-by: Ana Hobden <operator@hoverbear.org>
2023-03-06 17:29:44 +00:00
Ana Hobden 903258942c
Add more failure context / Improve error structure (#296)
* wip: add more context to errors

* Add a bunch fo context

* Repair source handling

* Add remaining contexts

* Add some context, but some of it is not right...

* Tidy up contexts properly

* Get command errors working how I want

* Remove some debug statements

* Repair mac build

* Move typetag to Action

* newtypes!

* Fix doctest
2023-03-03 14:20:17 -08:00
Cole Helbling 49154b9863
Make errors non-exhaustive (#299) 2023-03-03 20:03:51 +00:00
Cole Helbling d7c14d6695
Detect WSL1 and error (#297)
* Detect WSL1 and error

WSL1 is not supported because some things Nix relies on to work are not
available.

* Update linux.rs

* Add link to MS docs on WSL1 -> WSL2 upgrade
2023-03-03 09:49:46 -08:00
Cole Helbling 3be93c54f6
Use launchctl load -w on macOS (#298) 2023-03-03 09:28:55 -08:00
Cole Helbling 9c8284cd06
Add newline to end of plan json output (#283)
* Add newline to end of `plan` json output

This causes some shells (like sh) to continue their prompt right after
the closing brace, which is kinda meh.

* Add newline to end of `receipt.json`

`cat /nix/receipt.json` has the same issue as the previous commit, in
that it will bleed into the prompt for some shells that don't insert an
implicit newline.

* Add newline to end of fixture json documents
2023-02-28 08:38:42 -08:00
Cole Helbling d49e12cd7d
Update default nix_package_url to Nix 2.13.3 (#279) 2023-02-28 08:38:14 -08:00
Cole Helbling f941e13140
Use 0o644 for files, not 0o664 (#278)
(.nix-channels was the last remaining user of the 0o664 typo)
2023-02-28 08:36:09 -08:00
Graham Christensen d20c0b9746
Describe Diagnostics (#276)
Co-authored-by: Cole Helbling <cole.helbling@determinate.systems>
2023-02-27 15:49:40 +00:00
Ana Hobden f9f927840d
Release v0.4.0 (#273) 2023-02-24 22:29:52 +00:00
Ana Hobden 3fc5857db2
Repair is_ci handling, sudo was erasing the variables (#274) 2023-02-24 22:09:26 +00:00
Ana Hobden db329ea65f
Prelease tidy and add is_ci to Diagnostics (#271)
* Some pre-release tidy and add is_ci to diagnostics

* Bump locks

* Fixup cargo-audit raised issues

* Remove a spare 'I' which we were saving for later

* rename a field

* failure_variant, not error_variant
2023-02-24 13:07:11 -08:00
Ana Hobden 59abd1bef0
Use extra-nix-path to resolve nix-shell -p not working (#270) 2023-02-24 12:28:16 -08:00
Ana Hobden 19dd7a13d4
Add diagnostics reporting (#264)
* Add diagnostics reporting

* Some tidying

* Remove injected failure

* Update URL

* Fixups

* Fix tests

* Use triples instead of architecture
2023-02-24 10:11:12 -08:00
Cole Helbling b04b1eec70
Improve permissions checking when dealing with existing files (#267)
* create_file: check if path is file, improve permissions checking

* create_or_insert_into_file: check if path is file, improve permissions checking

* fixup: 100xxx -> xxx modes

* fixup: suggest legal mode for chmod
2023-02-23 19:32:09 +00:00
Ana Hobden 689cf84bbf
Enable deleting users and groups on Mac (#253)
* Enable deleting users and groups on Mac

* Scaffold user change

* Add a warning if it doesn't work in situations we expect it to not work

* Scaffold out doing group member ship -- maybe we need an AddGroup action

* AddUserToGroup action

* Update plans

* Improve messaging

* Nit in error message

* Repair some review nits
2023-02-22 07:46:52 -08:00
Ana Hobden 7e951a5b6a
Set the correct permissions on the zshenv (#257)
* Set the correct permissions on the zshenv

* Update error to suggest chmod instead of delete

* Missed a formatting option

* 644, not 755

* Get a bit more specific

* Mac specific permissions
2023-02-21 07:28:14 -08:00
Ana Hobden a89e05b850
Don't parallize user creation (#260) 2023-02-18 16:56:25 -08:00
Ana Hobden 5e7cb50c50
Don't specify chmod on synthetic.conf (#259) 2023-02-17 14:10:00 -08:00
Ana Hobden f20b2a4b63
Improve error message guidance (#258)
* Improve error message guidance

* Fix octal
2023-02-17 20:41:01 +00:00
Ana Hobden c150d603ea
Remove some bad merge code (#252) 2023-02-15 13:20:58 -08:00
Ana Hobden 1b3d441051
Clarify stability (#244)
* Clarify stability a bit

* Further stability clarification in CONTRIBUTING.md

* Improve some wording
2023-02-13 14:07:35 -08:00
Ana Hobden e3d06c24e7
Offer users better error if fstab entries exist (#241)
* Offer users better error if fstab entries exist

* Split up errors

* Remove a naughty bracket

* last nits
2023-02-10 22:44:39 +00:00
Ana Hobden fc13c1d250
Make systemd unit start detect already running unit (#240)
* Make systemd unit start detect already running unit

* Prod CI

* Fixup messaging

* Reflect comments
2023-02-10 20:43:46 +00:00
Ana Hobden ab4c528595
Rename some of the planners (#243)
* Rename some of the planners

* Fixup Mac

* Also move actions

* Also update CI
2023-02-10 20:35:00 +00:00
Ana Hobden e35278a121
It's the Determinate Nix Installer (#242)
* We like the phrasing the Determinate Nix Installer for now

* Cajoled

* Fixups
2023-02-10 19:48:44 +00:00
Ana Hobden 20b054b50c
Better support existing files with CreateFile and CreateorInsertIntoFile (#239)
* Better support existing files with CreateFile and CreateorInsertIntoFile

* Skip instead of complete if found

* Fixup some permissions

* Fixup nix version used

* Use unix module instead of linux one

* Use unix module instead of linux one in other spot

* Also cover CreateDirectory

* Add some more tests

* Fixup messaging

* Corect some logic inversions
2023-02-10 10:56:22 -08:00
Ana Hobden ce28eedf2a
Better support users/groups existing before install (#238)
* Better support users/groups existing before install

* Skip instead of complete if found

* Prod CI

* Add debuging messages

* Mark completed instead of skipped
2023-02-09 10:34:34 -08:00
Ana Hobden 28db9f2953
Attempt to minimize steam deck display manager restart risk (#237)
* Attempt to minimize steam deck display manager restart risk

* Fiddle a bit more

* Prod CI

* Be much more specific with services we restart
2023-02-08 11:58:48 -08:00
Ana Hobden 4884588339
Bump Nix to 2.13.2 (#236)
* Bump Nix to 2.13.2

* Use nix 2.13.2 in flake

* Prod CI
2023-02-08 11:41:36 -08:00
Ana Hobden 2c91bea9eb
Add 32 bit support (#229)
* Add 32 bit support

* Add buildkite job for i686

* Use x86 for system on i686

* Adapt nix-installer.sh script to support i686
2023-02-06 07:50:23 -08:00
Ana Hobden d69f335703
init-less install (#188)
* wip

* Add dockerfile

* Add readme bits

* Fix logic inversion

* Relax init detection error

* Tidying heuristics

* Fix doc tests

* Mac supports start-daemon false

* Get VM tests working

* Add instructions

* Some target_os flagging

* More target flagging

* Fix lints

* Fixup more mac-only stuff

* cfg flag examples too

* Fix planner wording

* More os specific lint fixing

* More refinement on mac and the README

* Add new CI jobs to test no-daemon

* Use nix-installer-pr to point at branch

* Tests with no-init

* init/no-daemon are linux only

* nix tests support a per-distro all attribute

* Add working podman test

* Expand docker tests

* Add contributing notes

* format

* Support both podman and docker

* Update contributing

* Add Windows WSL test script for Ubuntu

* format nix tests

* More ignores to check-spelling

* Add systemd based wsl test

* We don't have root-only darwin

* Reflect review nits

* Reenable tests

* Restore mac plan

* Flag off os specific tests

* Better cfg flagging

* Remove dead comments

* Rework readme to look better with new sections

* Correct codeblock language

* Remove some warnings
2023-02-01 12:35:52 -08:00
Ana Hobden 4d2e2c3911
Use 30k range not 3k range for UIDs on Linux and 30k for a GID on all (#222) 2023-02-01 10:41:10 -08:00
Ana Hobden 8042ac5131
Add plist use to the CreateFstabEntry action (#221) 2023-02-01 10:40:56 -08:00
Ana Hobden fd149eef47
Verify the apfs volume doesn't already exist before trying to create it (#217)
* Verify the apfs volume doesn't already exist before trying to create it

* Use plist instead of raw parsing

* Remove an unwrap
2023-02-01 10:40:42 -08:00
Ana Hobden 23c453f371
Use a UUID instead of volume name for fstab on Mac (#215)
* Use a UUID instead of volume name for fstab on Mac

* reflect review

* Don't quote the UUID in fstab
2023-01-31 08:49:22 -08:00
Ana Hobden 9dbbc9b7be
Correct --no-modify-profile (#206)
* Correct --no-modify-profile

* Correct env
2023-01-20 20:08:34 +00:00
Ana Hobden e81456673b
Improve Mac explain output (#205) 2023-01-20 19:53:55 +00:00
Ana Hobden fb168f4457
Pass SHELL through self-escalation (#195) 2023-01-18 10:14:06 -08:00
Graham Christensen b3b168e32c
Add (nix:$name) as a prefix to the bash prompt (#191)
* Add `(nix)` as a prefix to the bash prompt

Make it clearer when you're in the terminal vs. not.

* bash prompt prefix: put the project's name in the terminal

* Blame our installer for the nix.conf

* fixup: adding the version to the nix.conf

* force a space after the prefix
2023-01-18 07:11:05 -08:00
Ana Hobden 10c6cfac7e
Trim irrelevant mac warning (#186) 2023-01-13 21:03:48 +00:00
Ana Hobden f1df7ed432
Allow users to answer e at prompts (#183)
* Allow users to answer e at prompts

* Rename to currently_explaining

* Speeling

* Show options fully in prompt

* Better coloring
2023-01-12 19:29:13 +00:00
Ana Hobden 80c0f344c7
BUGFIX: CreateOrInsertIntoFile was not reverting (#180)
* BUGFIX: CreateOrInsertIntoFile was not reverting

* ci prod

* Fixup file naming

* Fix tempdir naming

* fixup

* In a module

* truncate
2023-01-11 22:09:12 +00:00
Ana Hobden 11e4d64c76
BUGFIX: CreateDirectory now properly prunes when it should (#181)
* BUGFIX: CreateDirectory now properly prunes when it should

* in a module
2023-01-11 21:56:29 +00:00
Ana Hobden 7ce0ae5391
Add some tests to CreateFile (#182)
* Add some tests to CreateFile

* in a module
2023-01-11 21:52:55 +00:00
Ana Hobden 6f50f8ad65
Rename daemon-user-count and make an alias (#159)
* Update actions too

* Fix nix_user_count to nix_build_user_count
2023-01-09 18:31:37 +00:00
Ana Hobden 232789ed1c
Fixup fdesetup isactive outputting when it should not (#163) 2023-01-09 09:24:24 -08:00
Linus Heckemann f2606d3127
Linus/ds 576 nix store should be in path directly (#148)
* CreateOrAppendFile: setuid safety

* Apply a sensible default mode if the file didn't already exist

* remove some incorrect docs

* Implement CreateOrInsertFile and use it instead of Append for shell rcs

Ubuntu's bashrc has the following lines in it:

  # If not running interactively, don't do anything
  [ -z "$PS1" ] && return

This means that anything appended to the file will only take effect in
interactive sessions. However, we want noninteractive shells to have
Nix on PATH too, e.g. for remote builds. Therefore, we need to add our
snippet to the beginning of the file, not the end.

* Adjust test fixtures to match new behaviour

* interaction: indicate default for confirm correctly

* CreateOrInsertFile: use randomised temporary filename

* Fix temp file creation

* Apply permissions to temp file, not final file

The final file may not exist, and the temporary file is the one whose
permissions will actually be preserved.

* Use the right ActionError for renaming

* Test the SSH behaviour properly

* cargo fmt

* [DS-574] Write to zshenv instead of zshrc

* CreateOrInsertFile -> CreateOrInsertIntoFile

Also move appending behaviour in here.

* Update Linux fixtures

* update darwin-multi fixture

* fix fixture

* fmt
2023-01-09 08:30:28 -08:00
Ana Hobden 844faa0d20
installplan should not copy self binary (#161)
* Make binary copy self, not library

* lints
2023-01-09 08:26:08 -08:00
Ana Hobden b60c4c84d0
Be more friendly to light terminals (#149)
* Be more friendly to light terminals

* Remove all white()

* Fix botched merge

* fmt

Co-authored-by: Linus Heckemann <git@sphalerite.org>
2023-01-05 08:55:25 -08:00
Ana Hobden cefc927ff5
Fix use of UID where username should be on Github actions (#157)
* Fix use of UID where username should be on Github actions

* Add check to ensure that nix profile add works

* It's nix profile install, ana
2023-01-05 07:56:09 -08:00
Ana Hobden ab00af7924
Show revert instead of step while reverting (#158) 2023-01-05 13:44:18 +01:00
Ana Hobden 14cb35b3e4
Un-whoops success message (#153) 2023-01-04 10:09:16 -08:00
Ana Hobden e27d01f221
Correctly expected error in default planner if nix installed (#151)
* Correctly expected error in default planner if nix installed

* fixup
2023-01-04 09:32:45 -08:00
Ana Hobden d510fa812f
Resolve a system unit ordering bug after update (#144) 2023-01-03 10:31:17 -08:00