Open8

nix導入

kawarimidollkawarimidoll

bashrcがミスってて変なエラーが出ていたが最初のページのnix-shellのお試しは問題なくできた
ちなみに完了後にnix-collect-garbageを行ったところ2182 store paths deleted, 1175.63 MiB freedだったので相当ストレージを消費する まあお試しとはいえgitもnvimもpythonも新しく入れたわけだから当然か

kawarimidollkawarimidoll

再びやっていこう

https://zenn.dev/asa1984/books/nix-introduction

https://qiita.com/junjihashimoto@github/items/54f8e25071b2800ee2ee

https://zenn.dev/asa1984/articles/nixos-is-the-best

https://zero-to-nix.com/

導入

curl -L https://nixos.org/nix/install | sh

削除

~/.profileやshellのrcなどから . "$HOME/.nix-profile/etc/profile.d/nix.sh"を削除

rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs} sudo
rm -rf /nix
インストールログ
❯ curl -L https://nixos.org/nix/install | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4267  100  4267    0     0   4941      0 --:--:-- --:--:-- --:--:--  4941
downloading Nix 2.23.3 binary tarball for aarch64-darwin from 'https://releases.nixos.org/nix/nix-2.23.3/nix-2.23.3-aarch64-darwin.tar.xz' to '/var/folders/m8/1733z37n46q8nzndldgx6hpm0000gn/T/nix-binary-tarball-unpack.UKRHmAz6P7'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.1M  100 12.1M    0     0  5278k      0  0:00:02  0:00:02 --:--:-- 5280k
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package
manager. This will happen in a few stages:

1. Make sure your computer doesn't already have Nix. If it does, I
   will show you instructions on how to clean up your old install.

2. Show you what I am going to install and where. Then I will ask
   if you are ready to continue.

3. Create the system users (uids [301..332]) and groups (gid 30000)
   that the Nix daemon uses to run builds. To create system users
   in a different range, exit and run this tool again with
   NIX_FIRST_BUILD_UID set.

4. Perform the basic installation of the Nix files daemon.

5. Configure your shell to import special Nix Profile files, so you
   can use Nix.

6. Start the Nix daemon.

Would you like to see a more detailed list of what I will do?
No TTY, assuming you would say yes :)

I will:

 - make sure your computer doesn't already have Nix files
   (if it does, I will tell you how to clean them up.)
 - create local users (see the list above for the users I'll make)
 - create a local group (nixbld)
 - install Nix in to /nix
 - create a configuration file in /etc/nix
 - set up the "default profile" by creating some Nix-related files in
   /var/root
 - back up /etc/bashrc to /etc/bashrc.backup-before-nix
 - update /etc/bashrc to include some Nix configuration
 - back up /etc/zshrc to /etc/zshrc.backup-before-nix
 - update /etc/zshrc to include some Nix configuration
 - create a Nix volume and a LaunchDaemon to mount it
 - create a LaunchDaemon (at /Library/LaunchDaemons/org.nixos.nix-daemon.plist) for nix-daemon

Ready to continue?
No TTY, assuming you would say yes :)

---- let's talk about sudo -----------------------------------------------------
This script is going to call sudo a lot. Normally, it would show you
exactly what commands it is running and why. However, the script is
run in a headless fashion, like this:

  $ curl -L https://nixos.org/nix/install | sh

or maybe in a CI pipeline. Because of that, I'm going to skip the
verbose output in the interest of brevity.

If you would like to
see the output, try like this:

  $ curl -L -o install-nix https://nixos.org/nix/install
  $ sh ./install-nix


~~> Fixing any leftover Nix volume state
Before I try to install, I'll check for any existing Nix volume config
and ask for your permission to remove it (so that the installer can
start fresh). I'll also ask for permission to fix any issues I spot.

~~> Checking for artifacts of previous installs
Before I try to install, I'll check for signs Nix already is or has
been installed on this system.

---- Nix config report ---------------------------------------------------------
        Temp Dir:       /var/folders/m8/1733z37n46q8nzndldgx6hpm0000gn/T/tmp.Gi8NSVEvkX
        Nix Root:       /nix
     Build Users:       32
  Build Group ID:       30000
Build Group Name:       nixbld

build users:
    Username:   UID
     _nixbld1:  301
     _nixbld2:  302
     _nixbld3:  303
     _nixbld4:  304
     _nixbld5:  305
     _nixbld6:  306
     _nixbld7:  307
     _nixbld8:  308
     _nixbld9:  309
     _nixbld10: 310
     _nixbld11: 311
     _nixbld12: 312
     _nixbld13: 313
     _nixbld14: 314
     _nixbld15: 315
     _nixbld16: 316
     _nixbld17: 317
     _nixbld18: 318
     _nixbld19: 319
     _nixbld20: 320
     _nixbld21: 321
     _nixbld22: 322
     _nixbld23: 323
     _nixbld24: 324
     _nixbld25: 325
     _nixbld26: 326
     _nixbld27: 327
     _nixbld28: 328
     _nixbld29: 329
     _nixbld30: 330
     _nixbld31: 331
     _nixbld32: 332

Ready to continue?
No TTY, assuming you would say yes :)

---- Preparing a Nix volume ----------------------------------------------------
    Nix traditionally stores its data in the root directory /nix, but
    macOS now (starting in 10.15 Catalina) has a read-only root directory.
    To support Nix, I will create a volume and configure macOS to mount it
    at /nix.

~~> Configuring /etc/synthetic.conf to make a mount-point at /nix
Password:

~~> Creating a Nix volume
disk3s7 was already unmounted

~~> Configuring /etc/fstab to specify volume mount options

~~> Encrypt the Nix volume
Volume Nix Store on Nix Store mounted
Encrypting with the new "Disk" crypto user on disk3s7
The new "Disk" user will be the only one who has initial access to disk3s7
The new APFS crypto user UUID will be 3759231F-FC18-430B-9EDA-31C54F84CFB3
Encryption has likely completed due to AES hardware; see "diskutil apfs list"
Volume Nix Store on disk3s7 force-unmounted

~~> Configuring LaunchDaemon to mount 'Nix Store'

~~> Setting up the build group nixbld
            Created:    Yes

~~> Setting up the build user _nixbld1
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 1
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld2
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 2
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld3
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 3
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld4
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 4
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld5
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 5
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld6
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 6
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld7
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 7
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld8
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 8
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld9
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 9
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld10
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 10
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld11
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 11
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld12
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 12
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld13
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 13
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld14
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 14
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld15
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 15
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld16
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 16
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld17
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 17
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld18
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 18
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld19
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 19
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld20
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 20
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld21
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 21
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld22
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 22
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld23
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 23
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld24
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 24
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld25
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 25
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld26
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 26
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld27
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 27
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld28
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 28
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld29
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 29
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld30
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 30
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld31
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 31
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the build user _nixbld32
           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty
              Note:     Nix build user 32
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

~~> Setting up the basic directory structure
chown: /nix/.Trashes: Operation not permitted
chown: /nix/.Trashes: Operation not permitted
install: creating directory '/nix/var'
install: creating directory '/nix/var/log'
install: creating directory '/nix/var/log/nix'
install: creating directory '/nix/var/log/nix/drvs'
install: creating directory '/nix/var/nix'
install: creating directory '/nix/var/nix/db'
install: creating directory '/nix/var/nix/gcroots'
install: creating directory '/nix/var/nix/profiles'
install: creating directory '/nix/var/nix/temproots'
install: creating directory '/nix/var/nix/userpool'
install: creating directory '/nix/var/nix/daemon-socket'
install: creating directory '/nix/var/nix/gcroots/per-user'
install: creating directory '/nix/var/nix/profiles/per-user'
install: creating directory '/nix/store'
install: creating directory '/etc/nix'

~~> Installing Nix
      Alright! We have our first nix at /nix/store/kcjwh67xvb3kkjp16p8nn0krzvanp3rl-nix-2.23.3
      Just finished getting the nix database ready.

~~> Setting up shell profiles: /etc/bashrc /etc/profile.d/nix.sh /etc/zshrc /etc/bash.bashrc /etc/zsh/zshrc

# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix


# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix


# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix


~~> Setting up shell profiles for Fish with conf.d/nix.fish inside /etc/fish /usr/local/etc/fish /opt/homebrew/etc/fish /opt/local/etc/fish

~~> Setting up the default profile
installing 'nix-2.23.3'
building '/nix/store/61y0qhzpcqngfgd4znppcc1z5sfd2534-user-environment.drv'...
installing 'nss-cacert-3.95'
building '/nix/store/r5yx343mvjgfva90kk7i5di4iqi4rrm6-user-environment.drv'...
unpacking 1 channels...

~~> Setting up the nix-daemon LaunchDaemon
Alright! We're done!
Try it! Open a new terminal, and type:

  $ nix-shell -p nix-info --run "nix-info -m"

Thank you for using this installer. If you have any feedback or need
help, don't hesitate:

You can open an issue at
https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md

Or get in touch with the community: https://nixos.org/community

---- Reminders -----------------------------------------------------------------
[ 1 ]
Nix won't work in active shell sessions until you restart them.

指示通りshellセッションを立ち上げ直し nix --versionが通ることを確認

kawarimidollkawarimidoll

https://github.com/kawarimidoll/flask-practicefh initしてみた

flask-practice
❯ nix run "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz#fh" -- init

Let's build a Nix flake!
> An optional description for your flake: my flask practice
> Which systems would you like to support? You selected 1 system: aarch64-darwin
> Which Nixpkgs version would you like to include? latest stable (currently 23.11)
> This seems to be a Python project. Would you like to initialize your flake with some standard dependencies for Python? Yes
> Select a version of Python 3.11
> You can add any of these Python tools to your environment if you wish pip
> Add any of these standard utilities to your environment if you wish curl, git
> Would you like to add our recommended Nix formatter (nixpkgs-fmt) to your environment? Yes
> Would you like to add doc comments to your flake that explain the meaning of different aspects of the flake? Yes
> Would you like to add any environment variables? Yes
> Variable name:
> Would you like to add a shell hook that runs every time you enter your Nix development environment? No
> Would you like to support legacy Nix commands like `nix-build` and `nix-shell`? Yes
> Would you like to add your new Nix files to Git? Yes
> Would you like to add a .envrc file so that you can use direnv in this project? Yes
> You'll need to run `direnv allow` to activate direnv in this project. Would you like to do that now? No
Your flake is ready to go! Run `nix flake show` to see which outputs it provides.

このへんのファイルが追加

❯  g status --short
?? .envrc
?? default.nix
?? flake.lock
?? flake.nix
?? shell.nix

↑ これ一回ぜんぶunstageしてしまったんだけどnixはgit管理下のファイルじゃないと認識できないことに注意

kawarimidollkawarimidoll

一度アンインストールプロセスを行った ↑の記事だとバージョンが古い?ので以下を追加でやる必要があった

diskutil apfs deleteVolume "Nix Store"
sudo launchctl bootout system/org.nixos.darwin-store

あっていうか公式のアンインストールプロセスがあったじゃん…これを見るべきだった

https://github.com/NixOS/nix/blob/master/doc/manual/src/installation/uninstall.md#macos

nix-installerを使って入れ直す

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
インストールログ

❯ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

info: downloading installer https://install.determinate.systems/nix/tag/v0.20.1/nix-installer-aarch64-darwin
nix-installer needs to run as root, attempting to escalate now via sudo...
Nix install plan (v0.20.1)
Planner: macos (with default settings)

Planned actions:

  • Create an encrypted APFS volume Nix Store for Nix on disk3 and add it to /etc/fstab mounting on /nix
  • Extract the bundled Nix (originally from /nix/store/8jlzxrnl7zfk04r0q1hczr3fpylkwah5-nix-binary-tarball-2.23.3/nix-2.23.3-aarch64-darwin.tar.xz)
  • Create a directory tree in /nix
  • Move the downloaded Nix into /nix
  • Create build users (UID 301-332) and group (GID 30000)
  • Configure Time Machine exclusions
  • Setup the default Nix profile
  • Place the Nix configuration in /etc/nix/nix.conf
  • Configure the shell profiles
  • Configuring zsh to support using Nix in non-interactive shells
  • Create a launchctl plist to put Nix into your PATH
  • Configure Nix daemon related settings with launchctl
  • Remove directory /nix/temp-install-dir

Proceed? ([Y]es/[n]o/[e]xplain): e
Nix install plan (v0.20.1)
Planner: macos

Configured settings:

  • case_sensitive: false
  • diagnostic_endpoint: "https://install.determinate.systems/nix/diagnostic"
  • enterprise_edition: false
  • extra_conf: []
  • force: false
  • modify_profile: true
  • nix_build_group_id: 30000
  • nix_build_group_name: "nixbld"
  • nix_build_user_count: 32
  • nix_build_user_id_base: 300
  • nix_build_user_prefix: "_nixbld"
  • nix_package_url: null
  • proxy: null
  • root_disk: "disk3"
  • ssl_cert_file: null
  • volume_encrypt: null
  • volume_label: "Nix Store"

Planned actions:

  • Create an encrypted APFS volume Nix Store for Nix on disk3 and add it to /etc/fstab mounting on /nix
    Create or insert file /etc/synthetic.conf
    Create objects defined in /etc/synthetic.conf
    Unmount the Nix Store APFS volume
    Create an APFS volume on disk3 named Nix Store
    Update existing entry for the APFS volume Nix Store to /etc/fstab
    Encrypt volume Nix Store on disk disk3
    Create a launchctl plist to mount the APFS volume /Library/LaunchDaemons/org.nixos.darwin-store.plist
    Bootstrap the org.nixos.darwin-store service via launchctl bootstrap system /Library/LaunchDaemons/org.nixos.darwin-store.plist
    Enable ownership on /nix
  • Extract the bundled Nix (originally from /nix/store/8jlzxrnl7zfk04r0q1hczr3fpylkwah5-nix-binary-tarball-2.23.3/nix-2.23.3-aarch64-darwin.tar.xz)
  • 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
  • Create build users (UID 301-332) 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 _nixbld1 (UID 301) in group nixbld (GID 30000)
    Create user _nixbld2 (UID 302) in group nixbld (GID 30000)
    Create user _nixbld3 (UID 303) in group nixbld (GID 30000)
    Create user _nixbld4 (UID 304) in group nixbld (GID 30000)
    Create user _nixbld5 (UID 305) in group nixbld (GID 30000)
    Create user _nixbld6 (UID 306) in group nixbld (GID 30000)
    Create user _nixbld7 (UID 307) in group nixbld (GID 30000)
    Create user _nixbld8 (UID 308) in group nixbld (GID 30000)
    Create user _nixbld9 (UID 309) in group nixbld (GID 30000)
    Create user _nixbld10 (UID 310) in group nixbld (GID 30000)
    Create user _nixbld11 (UID 311) in group nixbld (GID 30000)
    Create user _nixbld12 (UID 312) in group nixbld (GID 30000)
    Create user _nixbld13 (UID 313) in group nixbld (GID 30000)
    Create user _nixbld14 (UID 314) in group nixbld (GID 30000)
    Create user _nixbld15 (UID 315) in group nixbld (GID 30000)
    Create user _nixbld16 (UID 316) in group nixbld (GID 30000)
    Create user _nixbld17 (UID 317) in group nixbld (GID 30000)
    Create user _nixbld18 (UID 318) in group nixbld (GID 30000)
    Create user _nixbld19 (UID 319) in group nixbld (GID 30000)
    Create user _nixbld20 (UID 320) in group nixbld (GID 30000)
    Create user _nixbld21 (UID 321) in group nixbld (GID 30000)
    Create user _nixbld22 (UID 322) in group nixbld (GID 30000)
    Create user _nixbld23 (UID 323) in group nixbld (GID 30000)
    Create user _nixbld24 (UID 324) in group nixbld (GID 30000)
    Create user _nixbld25 (UID 325) in group nixbld (GID 30000)
    Create user _nixbld26 (UID 326) in group nixbld (GID 30000)
    Create user _nixbld27 (UID 327) in group nixbld (GID 30000)
    Create user _nixbld28 (UID 328) in group nixbld (GID 30000)
    Create user _nixbld29 (UID 329) in group nixbld (GID 30000)
    Create user _nixbld30 (UID 330) in group nixbld (GID 30000)
    Create user _nixbld31 (UID 331) in group nixbld (GID 30000)
    Create user _nixbld32 (UID 332) in group nixbld (GID 30000)
    Add user _nixbld1 (UID 301) to group nixbld (GID 30000)
    Add user _nixbld2 (UID 302) to group nixbld (GID 30000)
    Add user _nixbld3 (UID 303) to group nixbld (GID 30000)
    Add user _nixbld4 (UID 304) to group nixbld (GID 30000)
    Add user _nixbld5 (UID 305) to group nixbld (GID 30000)
    Add user _nixbld6 (UID 306) to group nixbld (GID 30000)
    Add user _nixbld7 (UID 307) to group nixbld (GID 30000)
    Add user _nixbld8 (UID 308) to group nixbld (GID 30000)
    Add user _nixbld9 (UID 309) to group nixbld (GID 30000)
    Add user _nixbld10 (UID 310) to group nixbld (GID 30000)
    Add user _nixbld11 (UID 311) to group nixbld (GID 30000)
    Add user _nixbld12 (UID 312) to group nixbld (GID 30000)
    Add user _nixbld13 (UID 313) to group nixbld (GID 30000)
    Add user _nixbld14 (UID 314) to group nixbld (GID 30000)
    Add user _nixbld15 (UID 315) to group nixbld (GID 30000)
    Add user _nixbld16 (UID 316) to group nixbld (GID 30000)
    Add user _nixbld17 (UID 317) to group nixbld (GID 30000)
    Add user _nixbld18 (UID 318) to group nixbld (GID 30000)
    Add user _nixbld19 (UID 319) to group nixbld (GID 30000)
    Add user _nixbld20 (UID 320) to group nixbld (GID 30000)
    Add user _nixbld21 (UID 321) to group nixbld (GID 30000)
    Add user _nixbld22 (UID 322) to group nixbld (GID 30000)
    Add user _nixbld23 (UID 323) to group nixbld (GID 30000)
    Add user _nixbld24 (UID 324) to group nixbld (GID 30000)
    Add user _nixbld25 (UID 325) to group nixbld (GID 30000)
    Add user _nixbld26 (UID 326) to group nixbld (GID 30000)
    Add user _nixbld27 (UID 327) to group nixbld (GID 30000)
    Add user _nixbld28 (UID 328) to group nixbld (GID 30000)
    Add user _nixbld29 (UID 329) to group nixbld (GID 30000)
    Add user _nixbld30 (UID 330) to group nixbld (GID 30000)
    Add user _nixbld31 (UID 331) to group nixbld (GID 30000)
    Add user _nixbld32 (UID 332) to group nixbld (GID 30000)
  • Configure Time Machine exclusions
    Configure Time Machine exclusion on /nix/store
    Configure Time Machine exclusion on /nix/var
  • 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.
    Create directory /etc/nix
    Merge or create nix.conf file /etc/nix/nix.conf
  • Configure the shell profiles
    Update shell profiles to import Nix
  • Configuring zsh to support using Nix in non-interactive shells
    Update /etc/zshenv to import Nix
  • Create a launchctl plist to put Nix into your PATH
  • Configure Nix daemon related settings with launchctl
    Copy /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist to /Library/LaunchDaemons/org.nixos.nix-daemon.plist
    Run launchctl bootstrap /Library/LaunchDaemons/org.nixos.nix-daemon.plist
  • Remove directory /nix/temp-install-dir

Proceed? ([Y]es/[n]o): y
INFO Step: Create an encrypted APFS volume Nix Store for Nix on disk3 and add it to /etc/fstab mounting on /nix
INFO Step: Provision Nix
INFO Step: Create build users (UID 301-332) and group (GID 30000)
INFO Step: Configure Time Machine exclusions
INFO Step: Configure Nix
INFO Step: Configuring zsh to support using Nix in non-interactive shells
INFO Step: Create a launchctl plist to put Nix into your PATH
INFO Step: Configure Nix daemon related settings with launchctl
INFO Step: Remove directory /nix/temp-install-dir
Nix was installed successfully!
To get started using Nix, open a new shell or run . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh

kawarimidollkawarimidoll

生nixをhomebrewの代わりにするのはなんとなくできた

https://sandstorm.de/de/blog/post/my-first-steps-with-nix-on-mac-osx-as-homebrew-replacement.html
https://blog.ymgyt.io/entry/declarative-environment-management-with-nix/

https://zenn.dev/kawarimidoll/articles/0a4ec8bab8a8ba

次はhome-managerする

https://nix-community.github.io/home-manager/#sec-install-nix-darwin-module

nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
kawarimidollkawarimidoll

homebrewから移せなかった(nixで提供されていなかった)CLIたち

  • 結局使ってないので消したもの

    • clog
    • gitbatch
    • github-markdown-toc
    • jpeg
    • keith/formulae/reminders-cli
  • nix-darwinに移したもの

    • pinentry-mac
  • 保留

    • sleepwatcher
      • 移したいのだがserviceの扱いがわからないのでどうしたらいいのやら
    • mas
      • app storeのアプリ自体をnix-darwinで管理できるみたいなのでそちらに移行したら削除できる
    • gaze
      • これ自体はnixpkgsに無いがほかのwatchコマンドでもいいよな…
      • watchexecとかにしようかな
  • git-now

    • 別に使ってないんだけど便利そうなのでなにかに使いたい
  • logdy

    • 別に使ってないんだけど便利そうなのでなにかに使いたい