Cross-platform dotfiles using chezmoi.
nix is a highly reproducible package manager that declaratively specifies dependencies and build procedures.
While it offers high reproducibility, it also has some drawbacks, such as being incompatible with Windows and requiring more disk space due to treating packages with different dependency versions as distinct entities.
Additionally, installing nix requires administrator privileges to create the /nix/store directory, making it difficult to use in restricted environments like company-provided PCs or HPCs.
However, in restricted environments, there is often no need for system-wide administration; it is sufficient to build a minimal development environment within the user environment. In other words, it is sufficient to manage only the dotfiles.
chezmoi is a dotfile manager with the following features:
- Supports multiple platforms, including Windows
- Absorbs differences between machines using Go templates
- Imports secrets using various password managers
- Imports from archive files
- Encrypts files using GPG or age
- Executes custom scripts for additional processing
In particular, script execution enables flexible operations such as declarative package installation and privileged operations in system space.
By combining it with non-privileged package managers (unix=mise, windows=scoop), it is possible to set up the same development environment even in a restricted environments.
chezmoi can change settings for each environment using .chezmoidata.$FORMAT
This repository has settings for each OS, host machine, and user under .chezmoidata.
See each files in .chezmoidata.
chezmoi support user script when you run chezmoi apply.
By writing <os>.hosts.<hostname>.owner = true in .chezmoidata/hosts/*, you can execute scripts that require administrator privileges (.chezmoiscripts/**/*_admin_*).
<os>.hosts.<hostname>.owner = trueとすることで、.chezmoiscripts以下の管理者権限を必要とするスクリプト(*_admin_*)を実行可能です。
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
$env:PATH = "$env:USERPROFILE\scoop\apps\git\current\mingw64\bin;$env:PATH"
iex "&{$(irm 'https://get.chezmoi.io/ps1')} -b '~/.local/bin' -- init --apply misumisumi/nixos-desktop-config"Support declarative package installation using following package managers. See .chezmoidata/users/sumi.toml for detail.
| pkg manager | admin |
|---|---|
| winget | yes (partially no) |
| chocolatey | yes (partially no) |
| scoop | no |
- If you sign in with an Microsoft account during the initial setup, a user account will be created based on that account name.
- To create a custom user account, you'll need to install using a local account.
- However, Windows 11 requires an internet connection and Microsoft account sign-in by default. To bypass this,
- During installation, press
ctrl+shift+F10to open a command prompt, run the following command, and then disconnect from the network after the automatic restart to proceed with a local account:
oobe\bypassnro- How to do something similar in ISOs with bypassnro removed
- Shift+F10 -> regedit
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\OOBEHideOnlineAccountScreens-> 1
- Copy
$env:USERPROFILE/.local/share/startup/kvm_storage_boot.ps1to\Windows\System32\GroupPolicy\Machine\Scripts\Startup. - Open the Group Policy Editor by typing
gpedit.mscinto thewin+rdialog. - Navigate to
computer > administrative > windows components > windows > scripts > startup > powershell scripts. - Set the script name to
kvm_storage_boot.ps1and the options tostorahci vioscsi stornvme viostor iaStorAVC iaStorV nvstor storflt storvsc.
- Please check executes
git
# install homebrew (if need)
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# install chezmoi and apply dotfiles
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "misumisumi/nixos-desktop-config"Support declarative package installation using mise and homebrew. You can also use the distribution standard package manager. See .chezmoidata/users/sumi.toml for detail.
| pkg manager | admin |
|---|---|
| mise | no |
| homebrew | no (required for installation) |
| apt, pacman, yum ... | yes |
build-essentialgitnasm# for ffmpegncurses-dev bison# for tmux- ruby wiki#suggested-build-environment # for ruby