Slide 1

Slide 1 text

dot fi les ʹ͍ͭͯ࿩͍ͨ͠ ͯ͢ʹΌΜ (id:stefafafan / @stefafafan) 2024/08/24 ভ.ͳΜ͔ #1

Slide 2

Slide 2 text

͸͡Ί·ͯ͠ • ͯ͢ʹΌΜͱݴ͍·͢ • 2024/4 ~ גࣜձࣾΧέϋγͰιϑτ΢ΣΞΤϯδχΞ΍ͬͯ·͢ @stefafafan

Slide 3

Slide 3 text

ভ.ͳΜ͔

Slide 4

Slide 4 text

.ͳΜ͔

Slide 5

Slide 5 text

dotnanka

Slide 6

Slide 6 text

dotnanka ͬͯ dot fi les ͱࣅͯͶ?

Slide 7

Slide 7 text

dot fi les ͷ࿩Λ͠·͢ʂ

Slide 8

Slide 8 text

͓͞Β͍ - dot fi les ͱ͸Կ͔ • .gitcon fi g ͱ͔ .bashrc ͱ͔ .vimrc ͱ͔ɺʮdotʯͰ࢝·ΔઃఆϑΝΠ ϧ܈ͷ͜ͱΛ·ͱΊͯʮdot fi lesʯͱݺͿ • ࣗ෼ͷखݩ؀ڥͷηοτΞοϓ΍ɺ։ൃνʔϜͷ։ൃ؀ڥηοτΞο ϓͳͲͷͨΊʹ͜͏͍͏ઃఆϑΝΠϧΛ؅ཧɾڞ༗͢Δͱศར

Slide 9

Slide 9 text

ࢲͷ৔߹ • ͜Ε·Ͱ·ͱ΋ʹ dot fi les Λӡ༻ͯ͜͠ͳ͔ͬͨ • ʮ৽͍͠MacΛηοτΞοϓ͢ΔͨͼʹλʔϛφϧͷηοτΞοϓɺ Α͘࢖͏ΞϓϦέʔγϣϯͷΠϯετʔϧɺࡉʑͨ͠ઃఆͷௐ੔͕໘ ౗ͩͳʯͱ΍ͬͱʂࢥ͍࢝Ίͨ • →ॏ͍ࠊΛ্͛ͯ؅ཧΛ։࢝

Slide 10

Slide 10 text

GitHub ʹ stefafafan/dot fi les Λ࡞੒ • https://github.com/stefafafan/dot fi les • Ҏલ·Ͱ gitcon fi g ͔͠ஔ͍ͯͳ͔͚ͬͨͲɺ΍ͬͱ৭ʑى͖࢝Ί ͨͷ͕͜͜Ұिؒ • dot fi lesୡਓͷΈͳ͞Μ͔Β஌ݟΛಘ͍ͨʂ • ʮ͜Ε͕ࢲͷdot fi lesͰ͢ʯͱXʹϙετ͍ͯͩ͘͠͞

Slide 11

Slide 11 text

dot fi lesͰԿΛ؅ཧ͢Δͷ͔

Slide 12

Slide 12 text

dot fi lesͰԿΛ؅ཧ͢Δͷ͔ • ڀۃతʹ͸GitHubͷϦϙδτϦͷREADMEʹैͬͨΒηοτΞοϓ ͕׬શʹऴΘΔঢ়ଶʹ͍ͨ͠ • Ͱ͸ԿΛ؅ཧ͢Δͷ͔ʁશ෦ʁ • બఆج४͸Կʁ • →ۓٸΞϯέʔτ͠·͢

Slide 13

Slide 13 text

dot fi les؅ཧ͍ͯ͠Δਓʁ • ؅ཧ͍ͯ͠Δ • ؅ཧ͍ͯ͠ͳ͍ • (ଠจࣈ͸ࢲͷબ୒Ͱ͢)

Slide 14

Slide 14 text

ର৅OS͸Կʁ • Linux • Mac • Windows • ͦͷ΄͔ • ෳ਺OSʹରԠ͍ͯ͠Δ

Slide 15

Slide 15 text

ύοέʔδͷ؅ཧ • Homebrew • Nugetͱ͔ • yum, apt, pacman ͳͲ

Slide 16

Slide 16 text

λʔϛφϧΤϛϡϨʔλʔ (Macલఏ) • Terminal.app • iTerm2 • Warp • Alacritty • WezTerm • Hyper

Slide 17

Slide 17 text

γΣϧ • bash • zsh • fi sh • ksh • nushell • ͦͷ΄͔

Slide 18

Slide 18 text

ΩϦ͕ͳ͍……ʂ • ଞʹ΋ΤσΟλͷઃఆɺλʔϛφϧϚϧνϓϨΫαͷઃఆɺγΣϧͷ ϓϥάΠϯͷઃఆɺλʔϛφϧͷϓϩϯϓτͳͲͷઃఆɺศརγΣϧ εΫϦϓτ΍πʔϧ܈ͳͲஔ͚Δ • Ԟ͕ਂ͍..

Slide 19

Slide 19 text

dot fi lesͷ؅ཧํ๏

Slide 20

Slide 20 text

ͦ͏͍͑͹dot fi lesͷ؅ཧํ๏͸Ͳ͏͢Ε͹ • ࢲ͸ https://www.chezmoi.io/ Λ࢖͍࢝Ίͨ • ಡΈํ͸ shay-moi • Go੡ɺγϯάϧόΠφϦͷπʔϧ • dot fi les͸γϯϘϦοΫϦϯΫͰ͸ͳ͘ϑΝΠϧͱͯ͠؅ཧ

Slide 21

Slide 21 text

chezmoi ͷ࢖͍ํ - ηοτΞοϓ • chezmoi init • chezmoi add ~/.bashrc • chezmoi cd && git add . && git commit -m “foobar” && git push • →खݩͷ ~/.bashrc ΛpushͰ͖ͨ

Slide 22

Slide 22 text

chezmoi ͷ࢖͍ํ - ଞϚγϯ΁ͷద༻ • sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply $GITHUB_USERNAME • chezmoi ΠϯετʔϧࡁΈͷ৔߹ • chezmoi init —apply $GITHUB_USERNAME • ݸਓతʹ͸ηοτΞοϓ࣌ʹ get.chezmoi.io ͷΑ͏ͳυϝΠϯΛ࢖͏ ͷ͕Ͳ͜·Ͱ৴༻Ͱ͖Δͷ͔एׯෆ҆ͳؾ΋͢Δ

Slide 23

Slide 23 text

Homebrewύοέʔδͷ؅ཧ • Brew fi le Λ༻ҙ͢Ε͹ϚγϯΛލ͍Ͱ͍͍ײ͡ʹ؅ཧ͠΍͍͢ • ࢀߟ: Brew fi le Ͱ Homebrew ͷϥΠϒϥϦΛ؅ཧ͠Α͏ʂ https:// kakakakakku.hatenablog.com/entry/2020/09/17/124653

Slide 24

Slide 24 text

Brew fi le ͷ࢖͍ํ • brew bundle dump • → Brew fi le͕Ͱ͖ΔͷͰத਎Λద౰ʹௐ੔ͯ͠ίϛοτ • ଞϚγϯͰ brew bundle • Brew fi leʹ͋Δύοέʔδ͕Πϯετʔϧ͞ΕΔ • https://github.com/stefafafan/dot fi les/blob/main/Brew fi le

Slide 25

Slide 25 text

ػີ৘ใͷ؅ཧ͕ؾʹͳΔ

Slide 26

Slide 26 text

ػີ৘ใ͸Ͳ͏͢Δʁ • dot fi lesͰ؅ཧ͠ͳ͍? • “ͳΜ͔͍͍ײ͡ʹ͢Δ”? • →Ͳ͏͍͏͜ͱʁ

Slide 27

Slide 27 text

ػີ৘ใ͸Ͳ͏͢Δʁ - chezmoiฤ • chezmoi͸͞·͟·ͳPassword managerͱͷ࿈ܞʹରԠ͍ͯ͠Δ • https://www.chezmoi.io/user-guide/password-managers/ • ྫ͑͹ 1Password ͷ CLI ͔Β伴ͷ஋Λऔಘ͢ΔɺΈ͍ͨͳ͜ͱ͕Ͱ͖Δ • ࢀߟ: https://zenn.dev/ryo_kawamata/articles/introduce- chezmoi#1passwordΛར༻ͨ͠ηΩϡΞͳ؅ཧ • AWS Secrets Manager, MacOSͷKeychainͳͲʹ΋ରԠ͍ͯ͠·͢

Slide 28

Slide 28 text

·ͱΊ • dot fi lesΛ؅ཧ͢Δͱ৽͍͠ϚγϯͷηοτΞοϓ΍νʔϜͱڞ௨ͷ ઃఆΛڞ༗͢Δ͜ͱ͕Ͱ͖ͯศར • chezmoiΛ࢖͏ͱ؆୯ʹ؅ཧͰ͖Δ͠ɺػີ৘ใ΋্ख͘࿈ܞͰ͖Δ • Έͳ͞Μͷdot fi les஌ݟΛڭ͍͑ͯͩ͘͞ • Xʹ౤ߘͯ͠΋Β͑ͨΒΈʹߦ͖·͢