Skip to content

Commit

Permalink
Begins NixOS for a desktop option (#576)
Browse files Browse the repository at this point in the history
Setup Linux GUI is a hard thing 😩 

Some features are not yet completed. I might address them in following commits.
  • Loading branch information
kachick authored Jun 28, 2024
1 parent f03d7c2 commit aabac5c
Show file tree
Hide file tree
Showing 27 changed files with 1,443 additions and 116 deletions.
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

use flake

# To avoid absolute path for Nix and typos-lsp in vscode settings
TYPOS_LSP_PATH="$(command -v typos-lsp)"
export TYPOS_LSP_PATH
2 changes: 1 addition & 1 deletion .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
matrix:
os:
- ubuntu-24.04
- macos-14 # M1 - https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/
- macos-13 # Intel. Do not use macos-14 to prefer architecture - https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
- windows-latest
runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ci-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ on:

jobs:
home-manager:
if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft)
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- macos-14 # M1 - https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/
# Disabled macOS-13 because the runner is too slow.
# I have Intel Mac, but it have latest darwin. So only testing in ubuntu runner and macos-14 runner is enough.
# - macos-13 # Intel
- macos-13 # Intel. Do not use macos-14 to prefer architecture - https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811

runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ on:

jobs:
tasks:
if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft)
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- macos-14 # M1 - https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/
- macos-13 # Intel. Do not use macos-14 to prefer architecture - https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/update-flake-lock-and-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ on:

jobs:
update-nixpkgs:
if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft)
uses: kachick/selfup/.github/workflows/[email protected]
with:
app_id: ${{ vars.APP_ID }}
dry-run: ${{ github.event_name == 'pull_request' }}
pr-title: 'Bump flake.lock and related dependencies'
optional-run: |
nix run .#bump_completions
git add ./dependencies
# https://stackoverflow.com/q/34807971
git update-index -q --really-refresh
git diff-index --quiet HEAD || git commit -m 'Update dprint completions' ./dependencies/dprint
secrets:
APP_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ tmp/

.direnv

# NixOS
*hardware-configuration.nix
result

# macOS
Expand All @@ -19,3 +21,4 @@ result
winget-pkgs-*-raw.json

*.bak
*.backup
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
},
"gopls": {
"build.buildFlags": ["-tags=linux,windows,darwin"]
}
},
"stylua.searchBinaryInPATH": true
}
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Also known as [盆栽(bonsai)](https://en.wikipedia.org/wiki/Bonsai) 🌳

## For visitors

If you are using [Podman](https://podman.io/), you can test the pre-built [container-image](containers) as follows.
If you are using [Podman](https://podman.io/), you can test the pre-built [ubuntu container-image](containers) as follows.

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/kachick/dotfiles/main/containers/sandbox-with-ghcr.bash) latest
Expand All @@ -27,7 +27,22 @@ nix run 'github:kachick/dotfiles#walk'
nix run 'github:kachick/dotfiles#prs'
```

## Linux(Ubuntu)
## NixOS

This repository does not save the `hardware-configuration.nix` for each host,\
so you should activate with `--impure` to load `/etc/nixos/hardware-configuration.nix` in your local

```bash
sudo nixos-rebuild switch --impure --flake .#nixos-desktop
sudo reboot now
```

Some tools are not yet fully automated, read each docs.

- [WARP](./nixos/WARP.md)
- [OneDrive](./nixos/OneDrive.md)

## Ubuntu

1. Install [Nix](https://nixos.org/) package manager with [DeterminateSystems/nix-installer](https://github.com/DeterminateSystems/nix-installer) to enable [Flakes](https://nixos.wiki/wiki/Flakes) by default.
```bash
Expand All @@ -50,11 +65,7 @@ nix run 'github:kachick/dotfiles#prs'
- `user@linux` # Used in container
- `kachick@linux`

## NixOS

[Work in Progress](https://github.com/kachick/dotfiles/pull/576)

## macOS(Darwin)
## macOS

Activate `kachick@macbook` as Linux

Expand Down
2 changes: 2 additions & 0 deletions config/Firefox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## How to change finder in page position from bottom to top?

In Nix, we can define this step with https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/firefox.nix

1. `about:config`
1. Enable `toolkit.legacyUserProfileCustomizations.stylesheets`
1. Get profile folder path from `about:support`
Expand Down
2 changes: 2 additions & 0 deletions config/Firefox/userChrome.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* Making findbar to be top-left */
/* https://support.mozilla.org/lt/questions/1372399#answer-1492856 */
.browserContainer > findbar {
-moz-box-ordinal-group: 0 !important; /* for 112 and older */
order: -1 !important; /* for 113 and newer */
border-top: none !important;
border-bottom: 1px solid ThreeDShadow !important;
/* TODO: Realize top-right with adjusting the many checkboxes, can we make multiline? */
}
81 changes: 81 additions & 0 deletions config/fcitx5/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[Hotkey]
# Enumerate when press trigger key repeatedly
EnumerateWithTriggerKeys=True
# Enumerate Input Method Forward
EnumerateForwardKeys=
# Enumerate Input Method Backward
EnumerateBackwardKeys=
# Skip first input method while enumerating
EnumerateSkipFirst=False

[Hotkey/TriggerKeys]
0=Control+space
1=Zenkaku_Hankaku
2=Hangul

[Hotkey/AltTriggerKeys]
0=Shift_L

[Hotkey/EnumerateGroupForwardKeys]
0=Super+space

[Hotkey/EnumerateGroupBackwardKeys]
0=Shift+Super+space

[Hotkey/ActivateKeys]
0=Hangul_Hanja
1=Henkan

[Hotkey/DeactivateKeys]
0=Hangul_Romaja
1=Muhenkan

[Hotkey/PrevPage]
0=Up

[Hotkey/NextPage]
0=Down

[Hotkey/PrevCandidate]
0=Shift+Tab

[Hotkey/NextCandidate]
0=Tab

[Hotkey/TogglePreedit]
0=Control+Alt+P

[Behavior]
# Active By Default
ActiveByDefault=False
# Share Input State
ShareInputState=No
# Show preedit in application
PreeditEnabledByDefault=True
# Show Input Method Information when switch input method
ShowInputMethodInformation=True
# Show Input Method Information when changing focus
showInputMethodInformationWhenFocusIn=False
# Show compact input method information
CompactInputMethodInformation=True
# Show first input method information
ShowFirstInputMethodInformation=True
# Default page size
DefaultPageSize=5
# Override Xkb Option
OverrideXkbOption=False
# Custom Xkb Option
CustomXkbOption=
# Force Enabled Addons
EnabledAddons=
# Force Disabled Addons
DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True
# Allow input method in the password field
AllowInputMethodForPassword=False
# Show preedit text when typing password
ShowPreeditForPassword=False
# Interval of saving user data in minutes
AutoSavePeriod=30

23 changes: 23 additions & 0 deletions config/fcitx5/profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=mozc

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=mozc
# Layout
Layout=

[GroupOrder]
0=Default

3 changes: 2 additions & 1 deletion config/vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@
"editor.tabCompletion": "on",
"files.defaultLanguage": "powershell",
"editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?",
"workbench.colorTheme": "Iceberg"
"workbench.colorTheme": "Iceberg",
"stylua.searchBinaryInPATH": true
}
17 changes: 14 additions & 3 deletions config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ local config <const> = wezterm.config_builder()
local act <const> = wezterm.action
local launch_menu <const> = {}
local font_with_fallback <const> = wezterm.font_with_fallback({
{ family = "PlemolJP Console NF", harfbuzz_features = { "zero" }, weight = "Medium" },
{
family = "PlemolJP Console NF",
harfbuzz_features = { "zero" },
weight = "Medium",
assume_emoji_presentation = false,
},
{ family = "Beedii", assume_emoji_presentation = true },
"源ノ角ゴシック Code JP",
"Noto Color Emoji",
"Cascadia Code",
})

config.color_scheme = "iceberg-dark"
Expand All @@ -30,6 +34,13 @@ if string.find(wezterm.target_triple, "pc-windows", 1, true) then
})
end

-- Using in wayland requires non released versions
-- https://github.com/wez/wezterm/issues/5340
if string.find(wezterm.target_triple, "-linux", 1, true) then
config.enable_wayland = true
config.use_ime = true
end

config.keys = {
-- TODO: Consider to move into windows only combination
{ key = "v", mods = "CTRL", action = act.PasteFrom("Clipboard") },
Expand Down
Loading

0 comments on commit aabac5c

Please sign in to comment.