{"id":19784594,"url":"https://github.com/wochap/nix-config","last_synced_at":"2025-04-07T09:18:55.879Z","repository":{"id":44020104,"uuid":"328216947","full_name":"wochap/nix-config","owner":"wochap","description":"Personal NixOS configuration","archived":false,"fork":false,"pushed_at":"2024-10-30T00:18:02.000Z","size":11629,"stargazers_count":93,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T02:49:41.623Z","etag":null,"topics":["ags","catppuccin-mocha","dwl","flakes","home-manager","kitty","nix","nixos","nvim","rice","wayland"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wochap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-09T18:09:35.000Z","updated_at":"2024-10-30T00:18:06.000Z","dependencies_parsed_at":"2023-12-08T03:21:28.911Z","dependency_job_id":"8e5e8dbd-c728-4170-8a8f-952ae420d018","html_url":"https://github.com/wochap/nix-config","commit_stats":{"total_commits":2533,"total_committers":3,"mean_commits":844.3333333333334,"dds":"0.0051322542439794505","last_synced_commit":"7008ac373cbd4a58fc0cea34cdc006e4cfd0b654"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wochap%2Fnix-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wochap%2Fnix-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wochap%2Fnix-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wochap%2Fnix-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wochap","download_url":"https://codeload.github.com/wochap/nix-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247622983,"owners_count":20968575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ags","catppuccin-mocha","dwl","flakes","home-manager","kitty","nix","nixos","nvim","rice","wayland"],"created_at":"2024-11-12T06:11:58.602Z","updated_at":"2025-04-07T09:18:55.846Z","avatar_url":"https://github.com/wochap.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Personal NixOS configuration\n\n[NixOS](https://nixos.org/) and [home-manager](https://github.com/nix-community/home-manager) config files are merged.\n\n## DWL\n\n![](https://i.imgur.com/TmgUC5J.jpg)\n![](https://i.imgur.com/jBtseU6.jpg)\n\n## Installaion\n\n### Install NixOS\n\n1. Follow the [manual](https://nixos.org/manual/nixos/stable/) and install NixOS with any desktop environment and reboot.\n\n1. Update the generated nixos configuration in `/etc/nixos/configuration.nix`.\n\n   The new configuration must have: user configuration, `flakes` enabled, `cachix` (optional), `git`, `git-crypt`, internet setup, `firewall` disabled\n\n   Check the [configuration.nix](configuration-example.nix) example\n\n### Install host config\n\nReboot into NixOS, login with the user you created\n\n1. Connect to internet\n\n   ```\n   # The following commands will work if you enabled `networking.networkmanager.enable = true;`\n   $ nmtui\n   $ ping google.com\n   ```\n\n   If `ping google.com` doesn't work, try updating your DNS\n\n   ```\n   $ vim /etc/resolv.conf\n   # add `nameserver 8.8.8.8` to `/etc/resolv.conf`\n   ```\n\n1. Use local cachix, if you have 2 machines using the same nix config/channels (optional)\n\n   ```\n   # Run on another machine, with nixos installed\n   $ nix-serve -p 8080\n\n   # On current/new machine, test\n   $ curl http://192.168.x.x:8080/nix-cache-info\n   ```\n\n   On the current/new machine, update `nix.settings.substituters` config, add `http://192.168.x.x:8080`, then restart\n\n1. Clone this repository into `/home/\u003cusername\u003e/.config/nix-config`\n\n   ```\n   $ git clone https://github.com/wochap/nix-config.git ~/.config/nix-config\n   ```\n\n1. Rebuild nixos with the host's specific config, for example, heres's a rebuild for my `gdesktop`\n\n   **WARNING:** First `nixos-rebuild` with device config can take several hours, maybe you want to disable some modules\n\n   ```\n   # Go to nix-config folder\n   $ cd /home/\u003cusername\u003e/.config/nix-config\n   $ nixos-rebuild boot --flake .#gdesktop\n   # or if you want to switch to a specialisation\n   # $ nixos-rebuild switch --flake .#gdesktop --specialisation hyprland-specialisation\n   ```\n\n   Reboot so changes take effect\n\n   **NOTE:** If you encounter an error related to `home-manager`, it is likely due to a file collision, and you will need to remove a file. You can identify which files are in conflict with the following command: `systemctl status home-manager-\u003cusername\u003e.service`. After resolving all the collisions, you can restart the `home-manager-\u003cusername\u003e.service`.\n\n1. Set password for new user `\u003cusername\u003e` if you haven't\n   ```\n   # for example\n   $ passwd gean\n   ```\n\n### Post install\n\n1. Install ssh keys\n\n   Copy `.ssh` backup folder to `/home/\u003cusername\u003e/.ssh`\n\n   ```\n   $ chmod 600 ~/.ssh/*\n   $ ssh-add \u003cPATH_TO_PRIVATE_KEY\u003e\n   ```\n\n   https://www.freecodecamp.org/news/how-to-manage-multiple-ssh-keys/\n\n1. Unlock secrets folder\n\n   Copy `git-crypt-key` backup\n\n   ```\n   $ cd /home/\u003cusername\u003e/.config/nix-config\n   $ git-crypt unlock /path/to/git-crypt-key\n   ```\n\n1. Install gpg keys\n\n   ```\n   $ gpg --import private.key\n   ```\n\n1. Enable autologin (optional)\n\n   ```sh\n   $ sudo touch /etc/security/autologin.conf\n   ```\n\n1. Setup Syncthing (http://localhost:8384)\n1. Setup desktop wallpaper (optional)\n   ```\n   $ swww img ~/Pictures/backgrounds/\u003cIMAGE_NAME\u003e\n   ```\n1. Setup [Neovim](https://github.com/wochap/nvim) configuration\n1. Setup qt look and feel\n   Open `Qt5 Settings` and update theme and icons\n   - icon theme: Tela-catppuccin_mocha-dark\n   - color scheme: Catppuccin-Mocha-Mauve\n   - style: Lightly\n   - change font size to 10\n1. Setup betterdiscord (optional)\n   ```\n   $ betterdiscordctl install\n   ```\n   enable theme from discord \u003e betterdiscordctl settings\n1. Enable WebRTC PipeWire support in chrome (wayland only)\n\n   Go to chrome://flags/ and enable `WebRTC PipeWire support`\n\n1. Sync `vscode`, `firefox`, `chrome` (optional)\n\n1. Setup mail\n\n   Generate [App passwords](https://support.google.com/accounts/answer/185833?hl=en) in [Google Account settings](https://myaccount.google.com/u/1/apppasswords)\n   Copy App password (16 digits) to secrets/mail/\u003cEMAIL\u003e\n\n1. Setup calendar\n\n   A browser should open automatically asking for google credentials, otherwise run:\n\n   ```sh\n   $ vdirsyncer discover\n   $ touch ~/.config/remind/remind.rem\n   ```\n\n1. [Waydroid](https://nixos.wiki/wiki/WayDroid) (optional)\n1. [Flatpak](https://nixos.wiki/wiki/Flatpak) (optional)\n\n1. Setup steam (optional)\n\n   Run steam, login, setup proton.\n\n## Upgrating NixOS\n\nUpdate inputs on `flake.nix`, then:\n\n```sh\n$ cd /home/\u003cusername\u003e/.config/nix-config\n$ nix flake update --recreate-lock-file\n$ sudo nixos-rebuild boot --flake .#gdesktop\n```\n\n## Development Workflow\n\n- Setup a project with [nix-direnv](https://github.com/nix-community/nix-direnv)\n\n  ```\n  $ nix flake new -t github:nix-community/nix-direnv ./\n  $ direnv allow\n  # update flake.nix\n  ```\n\n## Troubleshooting\n\n- Some keybindings doesn't work\n\n  ```sh\n  $ uwsm finalize XDG_CURRENT_DESKTOP XDG_SESSION_TYPE XDG_SESSION_DESKTOP\n  ```\n\n- Ruby `warning: It seems your ruby installation is missing ...`\n\n  ```\n  $ rm -rf ~/.gem/ruby/\u003cYOUR_PREVIOUS_RUBY_VERSION\u003e\n  ```\n\n- Galaxy Buds\n\n  - Connecting\n    - Disconnect the Galaxy Buds case from the power source\n    - Close the Galaxy Buds case\n    - Open the Galaxy Buds case\n    - Pair the Galaxy Buds (only required for the first time)\n    - Repeat the process until the Galaxy Buds connect via Bluetooth\n    - Once connected via Bluetooth, open the Galaxy Buds Client\n  - Best audio profiles\n    - Best audio output: High Fidelity Playback (A2DP Sink, codec AAC)\n    - Worst output but allows input: Headset Head Unit (HSP/HFP, codec mSBC)\n\n- Chrome like apps with blank screen or vanishing text on scroll\n\n  Clear `GPUCache`, in `~/.config/google-chrome/ShaderCache`\n\n  source: https://github.com/electron/electron/issues/40366\n  source: https://discussion.fedoraproject.org/t/chromium-based-browsers-display-garbled-web-pages-after-mesa-is-updated/83438\n\n- Slow zsh startup\n\n  ```\n  # print all zsh scripts that are being loaded\n  $ exec -l zsh --sourcetrace\n  ```\n\n- Fix Virtual Machine Manager `network default is not active` error\n\n  ```\n  $ sudo virsh net-start default\n  $ sudo virsh net-autostart default\n  ```\n\n- Fix [bootloader](https://nixos.wiki/wiki/Bootloader)\n\n- Read and write NTFS partitions\n\n  disable fast startup in windows\n\n- [Search a package version in nixpkgs](https://lazamar.co.uk/nix-versions/)\n\n- Generate Nix fetcher calls from repository URLs\n\n  ```sh\n  $ nurl https://github.com/nix-community/patsh v0.2.0 2\u003e/dev/null\n  ```\n\n- Inspect systemctl services\n\n  ```sh\n  $ systemctl cat --user swayidle.service\n  ```\n\n- Reload .desktop files\n\n  ```sh\n  $ nix shell nixpkgs#desktop-file-utils -c update-desktop-database -v ~/.local/share/applications\n  ```\n\n- No wifi device at startup\n\n  ```\n  $ nmcli r wifi on\n  ```\n\n- Sync Bluetooth for dualboot Linux and Windows\n\n  ```\n  # on windows, turn off `fast startup``\n  # mount your disk with windows, then:\n  $ sudo bt-dualboot --sync-all --backup\n  ```\n\n- No bluetooth device at startup\n\n  ```\n  $ sudo rfkill unblock bluetooth\n  ```\n\n- [Bluetooth sound glitches](https://wiki.archlinux.org/title/bluetooth_headset#Connecting_works,_but_there_are_sound_glitches_all_the_time)\n\n- Clear /nix/store\n\n  ```\n  $ nix-collect-garbage -d\n  $ sudo nix-collect-garbage -d\n  ```\n\n- [Delete nixos system profile](https://www.reddit.com/r/NixOS/comments/ekryty/help_deleting_old_profiles/)\n\n  ```\n  # delete everything on\n  $ /nix/var/nix/profiles/system-profiles/*\n\n  # Clear store and rebuild\n  ```\n\n- [Check packages size](https://nixos.wiki/wiki/Nix_command/path-info)\n\n  ```\n  $ nix path-info -rSh /run/current-system | sort -nk2\n  ```\n\n- Firefox doesnt load some websites\n\n  Enable DNS over HTTPS\n\n- [Wifi keeps connecting and disconnecting](https://unix.stackexchange.com/questions/588333/networkmanager-keeps-connecting-and-disconnecting-how-can-i-fix-this)\n\n  Disable ipv6 connection.\n\n  ```sh\n  # run the following to disable ipv6\n  $ sudo sysctl net.ipv6.conf.all.disable_ipv6=1\n  ```\n\n- Copy installed icons unicode\n\n  `E8E4` is the unicode.\n\n  ```\n  $ echo -ne \"\\uE8E4\" | xclip -selection clipboard\n  $ echo -ne \"\\ue92a\" | wl-copy\n  ```\n\n- Transform svg icons to png\n\n  ```\n  $ for file in *.svg; do inkscape $file -o ${file%svg}png -h 128; done\n  ```\n\n  ```\n  #!/usr/bin/env bash\n\n  symlinks=$(find ./ -lname \"*.svg\");\n\n  for file in $symlinks; do\n    linkpath=$(readlink $file);\n    newlinkcontent=${linkpath/svg/png};\n    newlinkpath=${file/svg/png};\n    ln -sf $newlinkcontent $newlinkpath;\n  done\n  ```\n\n- Get key terminal code\n\n  ```sh\n  $ kitten show_key -m kitty\n  $ kitty +kitten show_key\n  $ showkey -a\n  ```\n\n- Get key actual name\n\n  ```\n  $ xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf \"%-3s %s\\n\", $5, $8 }'\n  ```\n\n- [Cannot add google account in gnome \u003e online accounts](https://github.com/NixOS/nixpkgs/issues/32580)\n\n  In gmail settings, enable IMAP\n\n- Create udev rule\n\n  ```sh\n  # monitor uevent\n  $ udevadm monitor --property\n\n  # print devices ids (vendor, product, etc)\n  $ lsusb\n\n  # get env values\n  $ udevadm info -q all -n /dev/input/eventX\n\n  # get attr values\n  $ udevadm info -n /dev/input/eventX --attribute-walk\n  ```\n\n## Resources\n\n### Inspiration\n\n- https://github.com/phenax/nixos-dotfiles\n- https://gitlab.com/dwt1/dotfiles\n- https://github.com/JorelAli/nixos\n- https://github.com/nrdxp/nixflk/tree/template\n- https://github.com/kampka/nix-packages\n- https://github.com/sgraf812/.nixpkgs\n- https://www.reddit.com/r/NixOS/comments/k7e9sg/newbie_desktop_nixos_setup_for_developer/\n\n### To learn\n\n- https://www.secjuice.com/wayland-vs-xorg/\n- https://discourse.nixos.org/t/how-to-set-the-xdg-mime-default/3560\n- https://awesomeopensource.com/projects/nixos\n\n### Rice resources\n\n- https://bennymeg.github.io/ngx-fluent-ui/\n- https://fontawesome.com/cheatsheet\n- https://fontdrop.info/\n- https://coderwall.com/p/dedqca/argb-colors-in-android\n- https://github.com/zodd18/Horizon\n- https://www.iconfinder.com/search/?q=F028\n- https://www.online-toolz.com/tools/text-unicode-entities-convertor.php\n- https://www.reddit.com/r/firefox/comments/786dr7/how_do_i_identify_firefox_ui_elements/\n\n### Others\n\n- [Learn nix](https://nixcloud.io/tour/?id=3)\n- https://nixos.wiki/wiki/Home_Manager\n- https://superuser.com/questions/603528/how-to-get-the-current-monitor-resolution-or-monitor-name-lvds-vga1-etc\n- https://nixos.org/manual/nix/stable/#use-as-a-interpreter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwochap%2Fnix-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwochap%2Fnix-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwochap%2Fnix-config/lists"}