-
Notifications
You must be signed in to change notification settings - Fork 0
Enable git signing commits and ssh-agent service #264
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
Changes from 27 commits
5817fe7
302039d
9e88958
355c8cb
66bfec7
c694ee9
de766dd
3cd9350
59d1a79
f7d83aa
d80ca8b
1e2fab1
2a0ee52
c65d753
e77c8b2
88b70dc
a86c6ae
0a9b27f
fd259b3
b1f640b
e966da7
366e9fa
12a0962
4732d2d
48faafb
e477796
53b4432
9183192
589c238
9cba602
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "log" | ||
| "os" | ||
| "strings" | ||
|
|
||
| "golang.org/x/sys/unix" | ||
| ) | ||
|
|
||
| // Exists for remember https://github.com/kachick/dotfiles/pull/264#discussion_r1289600371 | ||
|
|
||
| // This script requires sudo execution | ||
|
|
||
| func main() { | ||
| // wsl.exe returns non English even in called on the VM https://github.com/microsoft/WSL/issues/9242 | ||
| // And always having non ASCII, annoy to depend with the output :< | ||
| uname := unix.Utsname{} | ||
| err := unix.Uname(&uname) | ||
| if err != nil { | ||
| log.Fatalf("cannot get uname: %+v\n", err) | ||
| } | ||
| unameStr := "" | ||
| // So here, using uname, as I understand it is same as `uname -r` | ||
| for _, i8 := range uname.Release { | ||
| unameStr += string(rune(int(i8))) | ||
| } | ||
| if !strings.Contains(unameStr, "microsoft-standard-WSL2") { | ||
| log.Fatalf("Looks executed on non WSL systems: %s", unameStr) | ||
| } | ||
|
|
||
| const path = "/etc/wsl.conf" | ||
|
|
||
| const systemdEnablingEntry = `[boot] | ||
| systemd=true` | ||
|
|
||
| wslConfigBytes, err := os.ReadFile(path) | ||
| if err != nil && !os.IsNotExist(err) { | ||
| log.Fatalf("%v\n", err) | ||
| } | ||
|
|
||
| wslConfig := "" | ||
|
|
||
| if wslConfigBytes != nil { | ||
| wslConfig = string(wslConfigBytes) + "\n" | ||
| } | ||
|
|
||
| if strings.Contains(wslConfig, "systemd") { | ||
| log.Fatalf("Looks areleady exists the systemd config") | ||
| } | ||
|
|
||
| dirty := strings.Clone(wslConfig) | ||
|
|
||
| dirty += fmt.Sprintln(systemdEnablingEntry) | ||
|
|
||
| if dirty != wslConfig { | ||
| err = os.WriteFile(path, []byte(dirty), os.ModePerm) | ||
| if err != nil { | ||
| log.Fatalf("failed - could you correctly run this with sudo? - %v\n", err) | ||
| } | ||
|
|
||
| fmt.Printf(`Done! Restart wsl.exe as follows in your Windows PowerShell | ||
|
|
||
| wsl.exe --shutdown | ||
|
|
||
| See https://learn.microsoft.com/ja-jp/windows/wsl/systemd for further detail | ||
| `) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI= | ||
| golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= | ||
| golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= | ||
| golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,9 @@ let | |
| # - id_*.pub: I CAN register them for different services. | ||
| in | ||
| { | ||
| # https://github.com/nix-community/home-manager/blob/master/modules/services/ssh-agent.nix | ||
| services.ssh-agent.enable = if pkgs.stdenv.isLinux then true else false; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://unix.stackexchange.com/a/390631 Already exists 🤔
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After it |
||
|
|
||
| # These hosts are taken from the public resources of each provider. | ||
| # - https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints | ||
| # - https://docs.gitlab.com/ee/user/gitlab_com/#ssh-known_hosts-entries | ||
|
|
@@ -70,16 +73,19 @@ in | |
| matchBlocks = { | ||
| "github.com" = { | ||
| identityFile = "${sshDir}/id_ed25519"; | ||
| identitiesOnly = true; | ||
| user = "git"; | ||
| }; | ||
|
|
||
| "gitlab.com" = { | ||
| identityFile = "${sshDir}/id_ed25519"; | ||
| identitiesOnly = true; | ||
| user = "git"; | ||
| }; | ||
|
|
||
| "bitbucket.org" = { | ||
| identityFile = "${sshDir}/id_ed25519"; | ||
| identitiesOnly = true; | ||
| user = "git"; | ||
| }; | ||
| }; | ||
|
|
||
This file was deleted.
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 makes following error after several changes, I know nothing about them 🤷♂️