├── .envrc ├── .github ├── FUNDING.yml └── workflows │ ├── generate-flake.yml │ └── run-tests.yml ├── .gitignore ├── .gitmodules ├── .sops.yaml ├── LICENSE ├── README.md ├── assets └── preview.png ├── flake.lock ├── flake.nix ├── hosts ├── dtsf-laptop │ ├── boot.nix │ ├── default.nix │ ├── hardware-configuration.nix │ └── home │ │ ├── default.nix │ │ └── packages.nix └── dtsf-pc │ ├── boot.nix │ ├── default.nix │ ├── hardware-configuration.nix │ └── home │ ├── default.nix │ └── packages.nix ├── justfile ├── lib ├── color.nix ├── default.nix ├── file.nix ├── format.nix ├── nixosSystem.nix └── spec.nix ├── modules ├── base.nix ├── colorscheme │ ├── home.nix │ ├── integrations │ │ ├── alacritty.nix │ │ ├── astal.nix │ │ ├── cava.nix │ │ ├── dunst.nix │ │ ├── fish.nix │ │ ├── fuzzel.nix │ │ ├── fzf.nix │ │ ├── ghostty.nix │ │ ├── gtk.nix │ │ ├── i3.nix │ │ ├── i3lock.nix │ │ ├── neovim.nix │ │ ├── niri.nix │ │ ├── rio.nix │ │ ├── sway.nix │ │ ├── wezterm.nix │ │ └── zellij.nix │ └── themes │ │ ├── catppuccin.nix │ │ ├── default.nix │ │ ├── gruvbox.nix │ │ ├── kanagawa.nix │ │ ├── min.nix │ │ ├── solarized.nix │ │ └── vesper.nix ├── conf │ ├── home.nix │ └── integrations │ │ ├── cava.nix │ │ ├── dunst.nix │ │ ├── picom.nix │ │ └── zellij.nix ├── home │ ├── base │ │ ├── core │ │ │ ├── btop.nix │ │ │ ├── core.nix │ │ │ ├── default.nix │ │ │ ├── editors │ │ │ │ ├── default.nix │ │ │ │ └── neovim │ │ │ │ │ └── default.nix │ │ │ ├── git │ │ │ │ ├── conf │ │ │ │ │ └── protected-branchs-hook.sh │ │ │ │ └── default.nix │ │ │ ├── shells │ │ │ │ ├── default.nix │ │ │ │ ├── fish.nix │ │ │ │ └── shellAliases.nix │ │ │ └── zellij │ │ │ │ └── default.nix │ │ ├── gui │ │ │ ├── default.nix │ │ │ ├── media.nix │ │ │ ├── terminal │ │ │ │ ├── alacritty.nix │ │ │ │ ├── default.nix │ │ │ │ ├── ghostty.nix │ │ │ │ ├── rio.nix │ │ │ │ └── wezterm │ │ │ │ │ ├── conf │ │ │ │ │ └── wezterm.lua │ │ │ │ │ └── default.nix │ │ │ └── tools.nix │ │ ├── home.nix │ │ └── tui │ │ │ ├── default.nix │ │ │ ├── editors │ │ │ ├── conf │ │ │ │ └── lazy-lock.json │ │ │ ├── default.nix │ │ │ └── neovim.nix │ │ │ ├── shells │ │ │ ├── default.nix │ │ │ └── fish │ │ │ │ ├── conf │ │ │ │ ├── config.fish │ │ │ │ └── plugin.fish │ │ │ │ └── default.nix │ │ │ ├── ssh.nix │ │ │ ├── tools.nix │ │ │ └── zellij │ │ │ ├── conf │ │ │ ├── config.kdl │ │ │ └── layout.kdl │ │ │ └── default.nix │ └── linux │ │ ├── base │ │ ├── default.nix │ │ ├── scripts │ │ │ └── default.nix │ │ ├── shell.nix │ │ └── tools.nix │ │ ├── core.nix │ │ ├── gui.nix │ │ ├── gui │ │ ├── base │ │ │ ├── browser.nix │ │ │ ├── default.nix │ │ │ ├── games.nix │ │ │ ├── gtk.nix │ │ │ ├── media.nix │ │ │ ├── misc.nix │ │ │ ├── mpv │ │ │ │ ├── conf │ │ │ │ │ ├── autosave.lua │ │ │ │ │ └── notify-send.lua │ │ │ │ └── default.nix │ │ │ └── xdg.nix │ │ ├── default.nix │ │ ├── i3-x-sway │ │ │ ├── default.nix │ │ │ └── keymaps.nix │ │ ├── i3 │ │ │ ├── default.nix │ │ │ └── values │ │ │ │ ├── default.nix │ │ │ │ ├── i3.nix │ │ │ │ ├── packages.nix │ │ │ │ ├── picom.nix │ │ │ │ └── xinitrc │ │ │ │ ├── conf │ │ │ │ ├── mergex-conf.sh │ │ │ │ └── services.sh │ │ │ │ └── default.nix │ │ ├── misc.nix │ │ ├── niri │ │ │ ├── conf │ │ │ │ └── niri.kdl │ │ │ ├── default.nix │ │ │ └── packages.nix │ │ └── sway │ │ │ ├── default.nix │ │ │ └── values │ │ │ ├── default.nix │ │ │ ├── packages.nix │ │ │ └── sway.nix │ │ └── tui.nix ├── nixos │ ├── base │ │ ├── core.nix │ │ ├── default.nix │ │ ├── i18n.nix │ │ ├── nix.nix │ │ ├── packages.nix │ │ ├── ssh.nix │ │ ├── usergroup.nix │ │ └── zram.nix │ ├── desktop.nix │ └── desktop │ │ ├── bluetooth.nix │ │ ├── default.nix │ │ ├── fhs.nix │ │ ├── fonts.nix │ │ ├── games.nix │ │ ├── gc.nix │ │ ├── graphics.nix │ │ ├── misc.nix │ │ ├── nvidia.nix │ │ ├── ollama.nix │ │ ├── peripherals.nix │ │ ├── security.nix │ │ └── virtulization.nix ├── nupkgs │ ├── astal │ │ ├── conf │ │ │ ├── init.lua │ │ │ ├── styles.scss │ │ │ ├── utils.lua │ │ │ └── widget │ │ │ │ └── Bar.lua │ │ └── default.nix │ ├── default.nix │ ├── devtunnel-cli │ │ ├── conf │ │ │ ├── source.json │ │ │ └── update.sh │ │ └── default.nix │ ├── home.nix │ └── trxsh │ │ ├── conf │ │ ├── source.json │ │ └── update.sh │ │ └── default.nix ├── secrets │ ├── nixos.nix │ └── secrets.yaml ├── shared │ ├── default.nix │ └── monitors.nix ├── term.nix └── wallpaper │ └── nixos.nix ├── outputs ├── default.nix └── x86_64-linux │ ├── default.nix │ └── src │ ├── dtsf-laptop.nix │ └── dtsf-pc.nix ├── scripts ├── topretty.nix └── update-nupkgs.sh ├── templates └── flake.template.nix └── vars └── default.nix /.envrc: -------------------------------------------------------------------------------- 1 | if [ -f flake.nix ]; then 2 | use flake 3 | fi 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: datsfilipe 2 | -------------------------------------------------------------------------------- /.github/workflows/generate-flake.yml: -------------------------------------------------------------------------------- 1 | name: generate flake 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | test-flake-generation: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout Repository 15 | uses: actions/checkout@v4 16 | 17 | - name: Set Up Nix 18 | uses: cachix/install-nix-action@v22 19 | with: 20 | nix_version: latest 21 | extra_nix_config: | 22 | experimental-features = nix-command flakes 23 | 24 | - name: Test Flake Generation 25 | run: | 26 | if [ -f flake.nix ]; then 27 | if ! command -v trash-cli &> /dev/null; then 28 | rm flake.nix 29 | else 30 | trash-put flake.nix 31 | fi 32 | fi 33 | nix eval --raw -f templates/flake.template.nix flake > flake.nix 34 | 35 | - name: Verify Flake 36 | run: | 37 | if [ -f flake.nix ]; then 38 | echo "flake.nix successfully generated" 39 | else 40 | echo "flake.nix generation failed" && exit 1 41 | fi 42 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: run tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | run-tests: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout Repository 15 | uses: actions/checkout@v4 16 | 17 | - name: Set Up Nix 18 | uses: cachix/install-nix-action@v22 19 | with: 20 | nix_version: latest 21 | extra_nix_config: | 22 | experimental-features = nix-command flakes 23 | 24 | - name: Run Tests 25 | env: 26 | root_dir: ${{ github.workspace }} 27 | NIX_PATH: nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz 28 | run: | 29 | run_lib_tests() { 30 | pushd "$root_dir" 31 | nix-shell -p nix-unit --run "nix-unit ./lib/spec.nix --gc-roots-dir ./.result-test" 32 | popd || exit 1 33 | } 34 | run_lib_tests 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result* 2 | .direnv 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "modules/home/linux/base/scripts/conf"] 2 | path = modules/home/linux/base/scripts/conf 3 | url = git@github.com:datsfilipe/unix-scripts.git 4 | branch = main 5 | -------------------------------------------------------------------------------- /.sops.yaml: -------------------------------------------------------------------------------- 1 | keys: 2 | - &alt age1ccw0xsg0ghqaacphgg2fhm7evcx03ndrnh7t6mpgfjcztd8a7arsgkn60u 3 | creation_rules: 4 | - path_regex: modules/secrets/[^/]+\.(yaml|json|env|ini)$ 5 | key_groups: 6 | - age: 7 | - *alt 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Filipe Lima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # datsfilipe’s dotfiles 4 | 5 | GitHub Repo stars 6 | GitHub issues 7 | 8 |
9 |
10 | 11 | ![Preview](./assets/preview.png) 12 | 13 |
14 | 15 | ## Structure 16 | 17 | ``` 18 | . 19 | ├── assets 20 | ├── hosts 21 | │   └── dtsf-pc 22 | │       └── home 23 | ├── lib 24 | ├── modules 25 | │ ├── home 26 | │ │ ├── base 27 | │ │ │ ├── core 28 | │ │ │ ├── gui 29 | │ │ │ └── tui 30 | │ │ └── linux 31 | │ │ ├── base 32 | │ │ └── gui 33 | │ ├── colorscheme 34 | │ │ ├── integrations 35 | │ │ └── themes 36 | │ ├── conf 37 | │ │ └── integrations 38 | │ ├── nixos 39 | │ │ ├── base 40 | │ │ └── desktop 41 | │ ├── nupkgs 42 | │ │ ├── devtunnel-cli 43 | │ │ └── zellij-switch 44 | │ ├── secrets 45 | │ └── wallpaper 46 | ├── outputs 47 | │ └── x86_64-linux 48 | │ └── src 49 | ├── scripts 50 | └── vars 51 | ``` 52 | 53 | ### General directories 54 | 55 | - `assets`: images and other assets used in the readme. 56 | - `hosts`hosts definitions. 57 | - `lib`: utility functions. 58 | - `modules`: modules definitions. 59 | - `home`: home manager general configurations. 60 | - `colorscheme`: colorscheme configurations for most used applications. 61 | - `conf`: configurations for most used applications. 62 | - `devenvs`: development environments. 63 | - `nixos`: nixos general configurations. 64 | - `nupkgs`: "nix user packages" - using that instead of a nur repo. 65 | - `secrets`: secrets module, using sops for encryption. 66 | - `wallpaper`: wallpaper definition. 67 | - `outputs`: outputs of the config. 68 | - `scripts`: scripts used in the config. 69 | - `vars`: variables used in the config. 70 | 71 | ### General slices 72 | 73 | - `base`: base configurations. 74 | - `gui`: gui configurations. 75 | - `tui`: tui configurations. 76 | - `linux`: linux configurations. 77 | - `desktop`: desktop configurations. 78 | - `integrations`: module integrations. 79 | - `conf`: config files needed for a function, derivation, etc. 80 | - `spec`: test files. 81 | 82 | ### Usage 83 | 84 | - To add a new host, need to create host definition and output. Refer to existing hosts as an example. 85 | - `nixos-generate-config` can be used to generate a new host hardware configuration file. 86 | - This repository submodules use ssh url's, so you need to update it as needed. 87 | - `flake.nix` should never be edited manually, as it is generated by `just generate-flake` using `templates/flake.template.nix`. 88 | 89 | ## Star History 90 | 91 | 92 | 93 | 94 | 95 | Star History Chart 96 | 97 | 98 | -------------------------------------------------------------------------------- /assets/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datsfilipe/dotfiles/4f12597a6d8802621db0b89d771fab90825fd4f1/assets/preview.png -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "datsdots"; 3 | inputs = { 4 | ghostty.url = "github:ghostty-org/ghostty/main"; 5 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 6 | nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11"; 7 | nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 8 | astal = { 9 | inputs.nixpkgs.follows = "nixpkgs"; 10 | url = "github:aylur/astal/main"; 11 | }; 12 | datsnvim = { 13 | inputs = { 14 | home-manager.follows = "home-manager"; 15 | nixpkgs.follows = "nixpkgs"; 16 | }; 17 | url = "github:datsfilipe/datsnvim/main"; 18 | }; 19 | home-manager = { 20 | inputs.nixpkgs.follows = "nixpkgs"; 21 | url = "github:nix-community/home-manager/master"; 22 | }; 23 | linux-shimeji = { 24 | inputs.nixpkgs.follows = "nixpkgs"; 25 | url = "github:datsfilipe/linux-shimeji/main"; 26 | }; 27 | meow = { 28 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 29 | url = "github:datsfilipe/meow/main"; 30 | }; 31 | neovim-nightly = { 32 | inputs.nixpkgs.follows = "nixpkgs"; 33 | url = "github:nix-community/neovim-nightly-overlay/master"; 34 | }; 35 | sops-nix = { 36 | inputs.nixpkgs.follows = "nixpkgs"; 37 | url = "github:Mic92/sops-nix/master"; 38 | }; 39 | zellij-switch = { 40 | inputs.nixpkgs.follows = "nixpkgs"; 41 | url = "github:datsfilipe/zellij-switch/flake"; 42 | }; 43 | unix-scripts = { 44 | flake = false; 45 | url = "git+file:///home/dtsf/.dotfiles/modules/home/linux/base/scripts/conf?shallow=1"; 46 | }; 47 | }; 48 | outputs = inputs: import ./outputs inputs; 49 | } 50 | -------------------------------------------------------------------------------- /hosts/dtsf-laptop/boot.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | ... 5 | }: { 6 | boot.kernelPackages = pkgs.linuxPackages_latest; 7 | 8 | boot.loader = { 9 | systemd-boot.enable = false; 10 | 11 | efi.efiSysMountPoint = "/boot"; 12 | grub = { 13 | devices = ["nodev"]; 14 | efiSupport = true; 15 | enable = lib.mkDefault true; 16 | gfxmodeEfi = "1920x1080"; 17 | efiInstallAsRemovable = true; 18 | extraEntries = '' 19 | menuentry "Reboot" { 20 | reboot 21 | } 22 | menuentry "Poweroff" { 23 | halt 24 | } 25 | ''; 26 | }; 27 | }; 28 | 29 | time.hardwareClockInLocalTime = true; 30 | } 31 | -------------------------------------------------------------------------------- /hosts/dtsf-laptop/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | hostName = "dtsf-laptop"; 3 | in { 4 | imports = [ 5 | ./hardware-configuration.nix 6 | ./boot.nix 7 | ]; 8 | 9 | services.libinput.enable = true; 10 | 11 | networking = { 12 | inherit hostName; 13 | networkmanager.enable = true; 14 | }; 15 | 16 | system.stateVersion = "25.05"; 17 | } 18 | -------------------------------------------------------------------------------- /hosts/dtsf-laptop/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | modulesPath, 6 | ... 7 | }: { 8 | imports = [ 9 | (modulesPath + "/installer/scan/not-detected.nix") 10 | ]; 11 | 12 | hardware.graphics = { 13 | enable = true; 14 | enable32Bit = true; 15 | extraPackages = [pkgs.intel-media-driver]; 16 | }; 17 | 18 | boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_usb_sdmmc"]; 19 | boot.initrd.kernelModules = []; 20 | boot.kernelModules = ["kvm-intel"]; 21 | boot.extraModulePackages = []; 22 | 23 | fileSystems."/" = { 24 | device = "/dev/disk/by-uuid/65f5f547-fcf2-447b-b873-77564796b086"; 25 | fsType = "ext4"; 26 | }; 27 | 28 | fileSystems."/boot" = { 29 | device = "/dev/disk/by-uuid/46AE-402B"; 30 | fsType = "vfat"; 31 | options = ["fmask=0077" "dmask=0077"]; 32 | }; 33 | 34 | swapDevices = [ 35 | {device = "/dev/disk/by-uuid/76079bdd-85af-45aa-9d3d-9abbca4e4773";} 36 | ]; 37 | 38 | networking.useDHCP = lib.mkDefault true; 39 | 40 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 41 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 42 | } 43 | -------------------------------------------------------------------------------- /hosts/dtsf-laptop/home/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | imports = [./packages.nix]; 3 | 4 | programs.ssh = { 5 | enable = true; 6 | extraConfig = '' 7 | Host github.com 8 | IdentityFile ~/.ssh/main_key 9 | IdentitiesOnly yes 10 | AddKeysToAgent yes 11 | ''; 12 | }; 13 | 14 | modules.desktop.colorscheme.theme = "solarized"; 15 | } 16 | -------------------------------------------------------------------------------- /hosts/dtsf-laptop/home/packages.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | pkgs-unstable, 5 | mypkgs, 6 | lib, 7 | ... 8 | }: { 9 | home.packages = with pkgs; 10 | [ 11 | qbittorrent 12 | slack 13 | bitwarden 14 | pavucontrol 15 | brightnessctl 16 | networkmanagerapplet 17 | ] 18 | ++ [ 19 | pkgs-unstable.zoom-us 20 | ]; 21 | 22 | modules.desktop.nupkgs.packages = with mypkgs; [ 23 | devtunnel-cli 24 | trxsh 25 | meow 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /hosts/dtsf-pc/boot.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | ... 5 | }: { 6 | environment.systemPackages = with pkgs; [ 7 | efibootmgr 8 | ]; 9 | 10 | boot.kernelPackages = pkgs.linuxPackages_latest; 11 | 12 | boot.loader = { 13 | systemd-boot.enable = false; 14 | 15 | efi.efiSysMountPoint = "/boot"; 16 | grub = { 17 | devices = ["nodev"]; 18 | efiSupport = true; 19 | enable = lib.mkDefault true; 20 | gfxmodeEfi = "1920x1080"; 21 | efiInstallAsRemovable = true; 22 | extraEntries = '' 23 | menuentry "Windows" { 24 | insmod part_gpt 25 | insmod fat 26 | insmod search_fs_uuid 27 | insmod chain 28 | search --fs-uuid --set=root F8D5-8832 29 | chainloader /EFI/Microsoft/Boot/bootmgfw.efi 30 | } 31 | menuentry "Reboot" { 32 | reboot 33 | } 34 | menuentry "Poweroff" { 35 | halt 36 | } 37 | ''; 38 | }; 39 | }; 40 | 41 | time.hardwareClockInLocalTime = true; 42 | } 43 | -------------------------------------------------------------------------------- /hosts/dtsf-pc/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | hostName = "dtsf-pc"; 3 | in { 4 | imports = [ 5 | ./hardware-configuration.nix 6 | ./boot.nix 7 | ]; 8 | 9 | networking = { 10 | inherit hostName; 11 | networkmanager.enable = true; 12 | }; 13 | 14 | system.stateVersion = "25.05"; 15 | } 16 | -------------------------------------------------------------------------------- /hosts/dtsf-pc/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | modulesPath, 6 | ... 7 | }: { 8 | imports = [ 9 | (modulesPath + "/installer/scan/not-detected.nix") 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "thunderbolt" "usb_storage" "usbhid" "sd_mod"]; 13 | boot.initrd.kernelModules = []; 14 | boot.kernelModules = ["kvm-amd"]; 15 | boot.extraModulePackages = []; 16 | 17 | fileSystems."/" = { 18 | device = "/dev/disk/by-uuid/3098c813-f5cd-40e5-a6f1-e3b4cbfd4c22"; 19 | fsType = "ext4"; 20 | }; 21 | 22 | fileSystems."/boot" = { 23 | device = "/dev/disk/by-uuid/33F4-8FFB"; 24 | fsType = "vfat"; 25 | options = ["fmask=0077" "dmask=0077"]; 26 | }; 27 | 28 | swapDevices = [ 29 | {device = "/dev/disk/by-uuid/6e1abfe9-2fab-469f-8b7b-ce13f794c637";} 30 | ]; 31 | 32 | networking.useDHCP = lib.mkDefault true; 33 | 34 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 35 | hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 36 | } 37 | -------------------------------------------------------------------------------- /hosts/dtsf-pc/home/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | imports = [./packages.nix]; 3 | 4 | programs.ssh = { 5 | enable = true; 6 | extraConfig = '' 7 | Host github.com 8 | IdentityFile ~/.ssh/main_key 9 | IdentitiesOnly yes 10 | AddKeysToAgent yes 11 | ''; 12 | }; 13 | 14 | modules.desktop.colorscheme.theme = "vesper"; 15 | } 16 | -------------------------------------------------------------------------------- /hosts/dtsf-pc/home/packages.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | pkgs-unstable, 5 | mypkgs, 6 | lib, 7 | ... 8 | }: { 9 | home.packages = with pkgs; 10 | [ 11 | qbittorrent 12 | slack 13 | bitwarden 14 | pavucontrol 15 | ] 16 | ++ [ 17 | pkgs-unstable.zoom-us 18 | ]; 19 | 20 | modules.desktop.nupkgs.packages = with mypkgs; [ 21 | devtunnel-cli 22 | trxsh 23 | meow 24 | ]; 25 | } 26 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | default: 2 | @just --list 3 | 4 | history: 5 | nix profile history --profile /nix/var/nix/profiles/system 6 | 7 | wipe-history: 8 | sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d 9 | 10 | gc: 11 | sudo nix-collect-garbage --delete-older-than 7d 12 | nix-collect-garbage --delete-older-than 7d 13 | 14 | verify-store: 15 | nix store verify --all 16 | 17 | build target mode="default": 18 | nixos_build {{target}} {{mode}} 19 | 20 | update target mode="update": 21 | nixos_build {{target}} {{mode}} 22 | 23 | switch target mode="default": 24 | sudo nixos_switch {{target}} {{mode}} 25 | 26 | upgrade target mode="update": 27 | nixos_switch {{target}} {{mode}} 28 | 29 | generate-flake: 30 | generate_flake 31 | 32 | edit-secrets: 33 | nix-shell -p sops --run "sops modules/secrets/secrets.yaml" 34 | 35 | run-lib-tests: 36 | run_lib_tests 37 | -------------------------------------------------------------------------------- /lib/color.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | builtins, 4 | ... 5 | }: let 6 | hexToDec = c: let 7 | hexChars = { 8 | "0" = 0; 9 | "1" = 1; 10 | "2" = 2; 11 | "3" = 3; 12 | "4" = 4; 13 | "5" = 5; 14 | "6" = 6; 15 | "7" = 7; 16 | "8" = 8; 17 | "9" = 9; 18 | "a" = 10; 19 | "b" = 11; 20 | "c" = 12; 21 | "d" = 13; 22 | "e" = 14; 23 | "f" = 15; 24 | "A" = 10; 25 | "B" = 11; 26 | "C" = 12; 27 | "D" = 13; 28 | "E" = 14; 29 | "F" = 15; 30 | }; 31 | in 32 | hexChars.${c}; 33 | decToHex = n: 34 | if n < 10 35 | then toString n 36 | else 37 | { 38 | "10" = "a"; 39 | "11" = "b"; 40 | "12" = "c"; 41 | "13" = "d"; 42 | "14" = "e"; 43 | "15" = "f"; 44 | } 45 | .${toString n}; 46 | hexPairToDec = hex: hexToDec (builtins.substring 0 1 hex) * 16 + hexToDec (builtins.substring 1 1 hex); 47 | decToHexPair = n: decToHex (n / 16) + decToHex (n - (n / 16 * 16)); 48 | 49 | darkenHex = hex: factor: let 50 | cleanHex = builtins.replaceStrings ["#"] [""] (lib.toLower hex); 51 | r = hexPairToDec (builtins.substring 0 2 cleanHex); 52 | g = hexPairToDec (builtins.substring 2 2 cleanHex); 53 | b = hexPairToDec (builtins.substring 4 2 cleanHex); 54 | 55 | darkR = builtins.ceil (r * (1 - factor)); 56 | darkG = builtins.ceil (g * (1 - factor)); 57 | darkB = builtins.ceil (b * (1 - factor)); 58 | 59 | clamp = n: 60 | if n < 0 61 | then 0 62 | else if n > 255 63 | then 255 64 | else n; 65 | in 66 | "#" + decToHexPair (clamp darkR) + decToHexPair (clamp darkG) + decToHexPair (clamp darkB); 67 | in { 68 | hexToDec = hexToDec; 69 | decToHex = decToHex; 70 | hexPairToDec = hexPairToDec; 71 | decToHexPair = decToHexPair; 72 | darkenHex = darkenHex; 73 | } 74 | -------------------------------------------------------------------------------- /lib/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | builtins, 4 | ... 5 | }: 6 | with lib; let 7 | if_let = v: p: let 8 | intersected = attrsets.intersectAttrs p v; 9 | in 10 | if intersected == p 11 | then v 12 | else null; 13 | 14 | match = v: l: 15 | builtins.foldl' ( 16 | acc: x: 17 | if acc != null 18 | then acc 19 | else let 20 | candidate = builtins.elemAt x 0; 21 | in 22 | if (if_let v candidate) != null 23 | then builtins.elemAt x 1 24 | else acc 25 | ) 26 | null 27 | l; 28 | 29 | mapLookup = v: items: 30 | if builtins.hasAttr v.value items 31 | then items.${v.value} 32 | else null; 33 | 34 | removeSuffix = suffix: str: 35 | if lib.strings.hasSuffix suffix str 36 | then lib.strings.substring 0 (builtins.stringLength str - builtins.stringLength suffix) str 37 | else str; 38 | 39 | extractName = path: let 40 | parts = lib.splitString "/" path; 41 | lastPart = lib.last parts; 42 | in 43 | lib.replaceStrings [".nix"] [""] lastPart; 44 | in { 45 | if_let = if_let; 46 | match = match; 47 | mapLookup = mapLookup; 48 | removeHash = str: builtins.replaceStrings ["#"] [""] str; 49 | removeSuffix = removeSuffix; 50 | extractName = extractName; 51 | 52 | nixosSystem = import ./nixosSystem.nix; 53 | format = import ./format.nix {inherit lib builtins;}; 54 | file = import ./file.nix {inherit lib builtins;}; 55 | color = import ./color.nix {inherit lib builtins;}; 56 | } 57 | -------------------------------------------------------------------------------- /lib/file.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | builtins, 4 | ... 5 | }: let 6 | relativeToRoot = lib.path.append ../.; 7 | scanPaths = path: 8 | builtins.map 9 | (f: (path + "/${f}")) 10 | (builtins.attrNames 11 | (lib.attrsets.filterAttrs 12 | ( 13 | path: _type: 14 | (_type == "directory") 15 | || ( 16 | (path != "default.nix") 17 | && (lib.strings.hasSuffix ".nix" path) 18 | ) 19 | ) 20 | (builtins.readDir path))); 21 | in { 22 | scanPaths = scanPaths; 23 | relativeToRoot = relativeToRoot; 24 | } 25 | -------------------------------------------------------------------------------- /lib/format.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | builtins, 4 | ... 5 | }: let 6 | formatSections = categories: attrs: let 7 | escapeValue = value: 8 | if builtins.isList value 9 | then "[\n " + (lib.concatStringsSep ",\n " (map (x: builtins.toJSON x) value)) + ",\n]" 10 | else if builtins.isInt value || builtins.isFloat value 11 | then toString value 12 | else if value == true 13 | then "true" 14 | else if value == false 15 | then "false" 16 | else ''"${value}"''; 17 | 18 | toIniLine = key: value: "${key}=${escapeValue value}"; 19 | 20 | processAttributes = attributes: 21 | lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: toIniLine k v) attributes); 22 | 23 | effectiveCategories = 24 | if categories == null 25 | then lib.attrNames attrs 26 | else categories; 27 | in 28 | ( 29 | if effectiveCategories == [] 30 | then processAttributes attrs 31 | else 32 | lib.concatStringsSep "\n\n" ( 33 | map (category: '' 34 | [${category}] 35 | ${processAttributes (attrs.${category} or {})} 36 | '') 37 | effectiveCategories 38 | ) 39 | ) 40 | + "\n"; 41 | in { 42 | sections = formatSections; 43 | } 44 | -------------------------------------------------------------------------------- /lib/nixosSystem.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | lib, 4 | system, 5 | genSpecialArgs, 6 | nixos-modules, 7 | home-modules ? [], 8 | specialArgs ? (genSpecialArgs system), 9 | myvars, 10 | mylib, 11 | ... 12 | }: let 13 | inherit (inputs) nixpkgs home-manager; 14 | in 15 | nixpkgs.lib.nixosSystem { 16 | inherit system specialArgs; 17 | modules = 18 | nixos-modules 19 | ++ ( 20 | lib.optionals ((lib.lists.length home-modules) > 0) 21 | [ 22 | home-manager.nixosModules.home-manager 23 | { 24 | home-manager.useGlobalPkgs = true; 25 | home-manager.useUserPackages = true; 26 | home-manager.backupFileExtension = "hm.backup"; 27 | 28 | home-manager.extraSpecialArgs = specialArgs; 29 | home-manager.users."${myvars.username}".imports = home-modules; 30 | } 31 | ] 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /lib/spec.nix: -------------------------------------------------------------------------------- 1 | {pkgs ? import {}}: let 2 | inherit (pkgs) lib; 3 | mylib = import ./default.nix {inherit lib builtins;}; 4 | in { 5 | testRemoveHash = { 6 | expr = mylib.removeHash "#abcdef"; 7 | expected = "abcdef"; 8 | }; 9 | 10 | testScanPaths = { 11 | expr = mylib.file.scanPaths ../outputs; 12 | expected = [ 13 | ../outputs/x86_64-linux 14 | ]; 15 | }; 16 | 17 | testExtractName = { 18 | expr = mylib.extractName "../modules/nupkgs/devtunnel-cli/default.nix"; 19 | expected = "default"; 20 | }; 21 | 22 | testIfLet = { 23 | expr = 24 | mylib.if_let 25 | { 26 | a = 1; 27 | b = 2; 28 | } 29 | {a = 1;}; 30 | expected = { 31 | a = 1; 32 | b = 2; 33 | }; 34 | }; 35 | 36 | testIfLetNoMatch = { 37 | expr = 38 | mylib.if_let 39 | {a = 2;} 40 | {a = 1;}; 41 | expected = null; 42 | }; 43 | 44 | testMatch = { 45 | expr = 46 | mylib.match 47 | { 48 | type = "success"; 49 | value = 42; 50 | } 51 | [ 52 | [{type = "error";} "error"] 53 | [{type = "success";} "success"] 54 | ]; 55 | expected = "success"; 56 | }; 57 | 58 | testRemoveSuffix = { 59 | expr = mylib.removeSuffix ".nix" "test.nix"; 60 | expected = "test"; 61 | }; 62 | 63 | testRemoveSuffixNoMatch = { 64 | expr = mylib.removeSuffix ".txt" "test.nix"; 65 | expected = "test.nix"; 66 | }; 67 | 68 | testRelativeToRoot = { 69 | expr = mylib.file.relativeToRoot "modules"; 70 | expected = ../modules; 71 | }; 72 | 73 | testMapLookup = { 74 | expr = 75 | mylib.mapLookup 76 | {value = "min";} 77 | { 78 | min = { 79 | theme = { 80 | name = "test"; 81 | package = {}; 82 | }; 83 | iconTheme = { 84 | name = "test"; 85 | package = {}; 86 | }; 87 | }; 88 | gruvbox = { 89 | theme = { 90 | name = "test1"; 91 | package = {}; 92 | }; 93 | iconTheme = { 94 | name = "test1"; 95 | package = {}; 96 | }; 97 | }; 98 | }; 99 | expected = { 100 | theme = { 101 | name = "test"; 102 | package = {}; 103 | }; 104 | iconTheme = { 105 | name = "test"; 106 | package = {}; 107 | }; 108 | }; 109 | }; 110 | 111 | testFormatSections = { 112 | expr = 113 | mylib.format.sections 114 | ["a" "b"] 115 | { 116 | a = { 117 | a = "1"; 118 | b = "2"; 119 | }; 120 | b = { 121 | a = "3"; 122 | b = "4"; 123 | }; 124 | }; 125 | expected = '' 126 | [a] 127 | a="1" 128 | b="2" 129 | 130 | 131 | [b] 132 | a="3" 133 | b="4" 134 | 135 | ''; 136 | }; 137 | 138 | testFormatSectionsNoCategories = { 139 | expr = 140 | mylib.format.sections 141 | [] 142 | { 143 | a = "1"; 144 | b = [ 145 | "name = 'Notification'" 146 | "class_g ?= 'Notify-osd'" 147 | "class_g = 'Polybar'" 148 | "class_g = 'Rofi'" 149 | "window_type = 'tooltip'" 150 | ]; 151 | c = 3; 152 | d = "4"; 153 | e = ["5" "6"]; 154 | f = true; 155 | }; 156 | expected = '' 157 | a="1" 158 | b=[ 159 | "name = 'Notification'", 160 | "class_g ?= 'Notify-osd'", 161 | "class_g = 'Polybar'", 162 | "class_g = 'Rofi'", 163 | "window_type = 'tooltip'", 164 | ] 165 | c=3 166 | d="4" 167 | e=[ 168 | "5", 169 | "6", 170 | ] 171 | f=true 172 | ''; 173 | }; 174 | 175 | testDarkenHex = { 176 | expr = mylib.color.darkenHex "#C0C0C0" 0.5; 177 | expected = "#606060"; 178 | }; 179 | } 180 | -------------------------------------------------------------------------------- /modules/base.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | myvars, 5 | ... 6 | } @ args: { 7 | nix.package = pkgs.nixVersions.latest; 8 | 9 | environment.variables = { 10 | EDITOR = "nvim --clean -c 'set clipboard=unnamedplus' -c 'highlight Normal guibg=NONE ctermbg=NONE'"; 11 | MANPAGER = "nvim +Man!"; 12 | }; 13 | environment.systemPackages = with pkgs; [ 14 | fastfetch 15 | neovim 16 | just 17 | fish 18 | git 19 | zip 20 | unzip 21 | xz 22 | zstd 23 | p7zip 24 | gnugrep 25 | gawk 26 | jq 27 | dnsutils 28 | wget 29 | curl 30 | socat 31 | findutils 32 | which 33 | rsync 34 | ]; 35 | 36 | users.users.${myvars.username} = { 37 | description = myvars.userfullname; 38 | openssh.authorizedKeys.keys = myvars.sshAuthorizedKeys; 39 | }; 40 | 41 | nix.settings = { 42 | experimental-features = ["nix-command" "flakes"]; 43 | trusted-users = [myvars.username]; 44 | 45 | substituters = [ 46 | "https://cache.nixos.org?priority=10" 47 | "https://nix-community.cachix.org" 48 | ]; 49 | 50 | builders-use-substitutes = true; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /modules/colorscheme/home.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | mylib, 6 | ... 7 | }: { 8 | options.modules.desktop.colorscheme = { 9 | enable = lib.mkEnableOption "Colorscheme"; 10 | 11 | theme = lib.mkOption { 12 | type = lib.types.enum ["gruvbox" "kanagawa" "min" "solarized" "vesper" "catppuccin"]; 13 | default = "vesper"; 14 | description = "Colorscheme theme."; 15 | }; 16 | 17 | enableAlacrittyIntegration = lib.mkOption { 18 | type = lib.types.bool; 19 | default = false; 20 | }; 21 | enableDunstIntegration = lib.mkOption { 22 | type = lib.types.bool; 23 | default = false; 24 | }; 25 | enableCavaIntegration = lib.mkOption { 26 | type = lib.types.bool; 27 | default = false; 28 | }; 29 | enableNeovimIntegration = lib.mkOption { 30 | type = lib.types.bool; 31 | default = true; 32 | description = '' 33 | Enable Neovim integration. It will add a nix_colorscheme.lua 34 | file to the nvim lua directory with the colorscheme name only. 35 | ''; 36 | }; 37 | enableZellijIntegration = lib.mkOption { 38 | type = lib.types.bool; 39 | default = false; 40 | }; 41 | enableGTKIntegration = lib.mkOption { 42 | type = lib.types.bool; 43 | default = false; 44 | }; 45 | enableI3Integration = lib.mkOption { 46 | type = lib.types.bool; 47 | default = false; 48 | }; 49 | enableI3StatusIntegration = lib.mkOption { 50 | type = lib.types.bool; 51 | default = false; 52 | }; 53 | enableI3LockIntegration = lib.mkOption { 54 | type = lib.types.bool; 55 | default = false; 56 | description = '' 57 | Enable i3lock integration. It will add a script called i3lock-theme 58 | to the user ".local/bin" folder, which should be used instead of i3lock. 59 | ''; 60 | }; 61 | enableSwayIntegration = lib.mkOption { 62 | type = lib.types.bool; 63 | default = false; 64 | }; 65 | enableFishIntegration = lib.mkOption { 66 | type = lib.types.bool; 67 | default = false; 68 | }; 69 | enableGhosttyIntegration = lib.mkOption { 70 | type = lib.types.bool; 71 | default = false; 72 | }; 73 | enableAstalIntegration = lib.mkOption { 74 | type = lib.types.bool; 75 | default = false; 76 | }; 77 | enableWeztermIntegration = lib.mkOption { 78 | type = lib.types.bool; 79 | default = false; 80 | }; 81 | enableRioIntegration = lib.mkOption { 82 | type = lib.types.bool; 83 | default = false; 84 | }; 85 | enableFzfIntegration = lib.mkOption { 86 | type = lib.types.bool; 87 | default = false; 88 | }; 89 | enableNiriIntegration = lib.mkOption { 90 | type = lib.types.bool; 91 | default = false; 92 | }; 93 | enableFuzzelIntegration = lib.mkOption { 94 | type = lib.types.bool; 95 | default = false; 96 | }; 97 | }; 98 | 99 | config = let 100 | colorscheme = import ./themes/${config.modules.desktop.colorscheme.theme}.nix; 101 | in 102 | lib.mkMerge [ 103 | (lib.mkIf (config.modules.desktop.colorscheme.enable) (lib.mkMerge [ 104 | (lib.mkIf config.modules.desktop.colorscheme.enableNeovimIntegration { 105 | programs.datsnvim.settings.theme = import ./integrations/neovim.nix { 106 | inherit mylib pkgs; 107 | name = config.modules.desktop.colorscheme.theme; 108 | }; 109 | }) 110 | 111 | (lib.mkIf config.modules.desktop.colorscheme.enableGTKIntegration { 112 | gtk = import ./integrations/gtk.nix { 113 | inherit mylib pkgs; 114 | name = config.modules.desktop.colorscheme.theme; 115 | }; 116 | }) 117 | 118 | ( 119 | lib.mkIf config.modules.desktop.colorscheme.enableI3LockIntegration 120 | (import ./integrations/i3lock.nix { 121 | inherit pkgs; 122 | colorscheme = colorscheme; 123 | }) 124 | ) 125 | 126 | ( 127 | lib.mkIf config.modules.desktop.colorscheme.enableI3Integration 128 | (import ./integrations/i3.nix { 129 | inherit lib pkgs config; 130 | colorscheme = colorscheme; 131 | enableI3StatusIntegration = config.modules.desktop.colorscheme.enableI3StatusIntegration; 132 | }) 133 | ) 134 | 135 | ( 136 | lib.mkIf config.modules.desktop.colorscheme.enableSwayIntegration 137 | (import ./integrations/sway.nix { 138 | inherit lib pkgs; 139 | colorscheme = colorscheme; 140 | enableI3StatusIntegration = config.modules.desktop.colorscheme.enableI3StatusIntegration; 141 | enableAstalIntegration = config.modules.desktop.colorscheme.enableAstalIntegration; 142 | }) 143 | ) 144 | 145 | ( 146 | lib.mkIf config.modules.desktop.colorscheme.enableDunstIntegration 147 | (import ./integrations/dunst.nix { 148 | colorscheme = colorscheme; 149 | }) 150 | ) 151 | 152 | ( 153 | lib.mkIf config.modules.desktop.colorscheme.enableAlacrittyIntegration 154 | (import ./integrations/alacritty.nix { 155 | colorscheme = colorscheme; 156 | }) 157 | ) 158 | 159 | ( 160 | lib.mkIf config.modules.desktop.colorscheme.enableFishIntegration 161 | (import ./integrations/fish.nix { 162 | inherit config lib; 163 | colorscheme = colorscheme; 164 | }) 165 | ) 166 | 167 | ( 168 | lib.mkIf config.modules.desktop.colorscheme.enableCavaIntegration 169 | (import ./integrations/cava.nix { 170 | inherit config lib mylib; 171 | colorscheme = colorscheme; 172 | }) 173 | ) 174 | 175 | ( 176 | lib.mkIf config.modules.desktop.colorscheme.enableZellijIntegration 177 | (import ./integrations/zellij.nix { 178 | inherit config lib; 179 | colorscheme = colorscheme; 180 | }) 181 | ) 182 | 183 | ( 184 | lib.mkIf config.modules.desktop.colorscheme.enableGhosttyIntegration 185 | (import ./integrations/ghostty.nix { 186 | inherit config lib; 187 | colorscheme = colorscheme; 188 | }) 189 | ) 190 | 191 | ( 192 | lib.mkIf config.modules.desktop.colorscheme.enableAstalIntegration 193 | (import ./integrations/astal.nix { 194 | colorscheme = colorscheme; 195 | }) 196 | ) 197 | 198 | ( 199 | lib.mkIf config.modules.desktop.colorscheme.enableWeztermIntegration 200 | (import ./integrations/wezterm.nix { 201 | colorscheme = colorscheme; 202 | }) 203 | ) 204 | 205 | ( 206 | lib.mkIf config.modules.desktop.colorscheme.enableRioIntegration 207 | (import ./integrations/rio.nix { 208 | colorscheme = colorscheme; 209 | }) 210 | ) 211 | 212 | ( 213 | lib.mkIf config.modules.desktop.colorscheme.enableFzfIntegration 214 | (import ./integrations/fzf.nix { 215 | colorscheme = colorscheme; 216 | }) 217 | ) 218 | 219 | ( 220 | lib.mkIf config.modules.desktop.colorscheme.enableNiriIntegration 221 | (import ./integrations/niri.nix { 222 | colorscheme = colorscheme; 223 | }) 224 | ) 225 | 226 | ( 227 | lib.mkIf config.modules.desktop.colorscheme.enableFuzzelIntegration 228 | (import ./integrations/fuzzel.nix { 229 | inherit mylib; 230 | colorscheme = colorscheme; 231 | }) 232 | ) 233 | ])) 234 | ]; 235 | } 236 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/alacritty.nix: -------------------------------------------------------------------------------- 1 | { colorscheme, ...}: 2 | 3 | { 4 | programs.alacritty.settings = { 5 | colors = { 6 | bright = { 7 | black = colorscheme.colors.black; 8 | red = colorscheme.colors.red; 9 | green = colorscheme.colors.green; 10 | yellow = colorscheme.colors.yellow; 11 | blue = colorscheme.colors.blue; 12 | magenta = colorscheme.colors.magenta; 13 | cyan = colorscheme.colors.cyan; 14 | white = colorscheme.colors.white; 15 | }; 16 | normal = { 17 | black = colorscheme.colors.black; 18 | red = colorscheme.colors.red; 19 | green = colorscheme.colors.green; 20 | yellow = colorscheme.colors.yellow; 21 | blue = colorscheme.colors.blue; 22 | magenta = colorscheme.colors.magenta; 23 | cyan = colorscheme.colors.cyan; 24 | white = colorscheme.colors.white; 25 | }; 26 | primary = { 27 | background = colorscheme.colors.bg; 28 | foreground = colorscheme.colors.fg; 29 | }; 30 | }; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/astal.nix: -------------------------------------------------------------------------------- 1 | {colorscheme, ...}: { 2 | home.file.".local/share/astal/variables.scss".source = builtins.toFile "variables.scss" '' 3 | $primary: ${colorscheme.colors.primary}; 4 | $bg: ${colorscheme.colors.bg}; 5 | $altbg: ${colorscheme.colors.altbg}; 6 | $fg: ${colorscheme.colors.fg}; 7 | $black: ${colorscheme.colors.black}; 8 | $red: ${colorscheme.colors.red}; 9 | $green: ${colorscheme.colors.green}; 10 | $yellow: ${colorscheme.colors.yellow}; 11 | $blue: ${colorscheme.colors.blue}; 12 | $magenta: ${colorscheme.colors.magenta}; 13 | $cyan: ${colorscheme.colors.cyan}; 14 | $white: ${colorscheme.colors.white}; 15 | ''; 16 | } 17 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/cava.nix: -------------------------------------------------------------------------------- 1 | { 2 | colorscheme, 3 | config, 4 | lib, 5 | mylib, 6 | ... 7 | }: 8 | with mylib; { 9 | modules.desktop.conf.cava.settings = { 10 | color = { 11 | gradient = 1; 12 | gradient_color_1 = "${lib.toLower colorscheme.colors.primary}"; 13 | gradient_color_2 = "${color.darkenHex colorscheme.colors.primary 0.1}"; 14 | gradient_color_3 = "${color.darkenHex colorscheme.colors.primary 0.2}"; 15 | gradient_color_4 = "${color.darkenHex colorscheme.colors.primary 0.4}"; 16 | gradient_color_5 = "${color.darkenHex colorscheme.colors.primary 0.5}"; 17 | gradient_color_6 = "${color.darkenHex colorscheme.colors.primary 0.7}"; 18 | gradient_color_7 = "${color.darkenHex colorscheme.colors.primary 0.8}"; 19 | gradient_color_8 = "${color.darkenHex colorscheme.colors.primary 1.0}"; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/dunst.nix: -------------------------------------------------------------------------------- 1 | { colorscheme, ...}: 2 | 3 | { 4 | modules.desktop.conf.dunst.settings = { 5 | global = { 6 | frame_color = colorscheme.colors.altbg; 7 | separator_color = colorscheme.colors.altbg; 8 | }; 9 | 10 | urgency_low = { 11 | background = colorscheme.colors.bg; 12 | foreground = colorscheme.colors.primary; 13 | frame_color = colorscheme.colors.altbg; 14 | }; 15 | 16 | urgency_normal = { 17 | background = colorscheme.colors.bg; 18 | foreground = colorscheme.colors.primary; 19 | frame_color = colorscheme.colors.altbg; 20 | }; 21 | 22 | urgency_critical = { 23 | background = colorscheme.colors.red; 24 | foreground = colorscheme.colors.bg; 25 | frame_color = colorscheme.colors.red; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/fish.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | colorscheme, 5 | ... 6 | }: let 7 | hydroConfig = config.xdg.configFile."fish/conf.d/hydro.fish".text or null; 8 | in { 9 | xdg.configFile."fish/conf.d/colorscheme.fish".text = '' 10 | set -g fish_color_normal "${colorscheme.colors.blue}" 11 | set -g fish_color_command "${colorscheme.colors.yellow}" 12 | set -g fish_color_quote "${colorscheme.colors.blue}" 13 | set -g fish_color_redirection "${colorscheme.colors.magenta}" 14 | set -g fish_color_end "${colorscheme.colors.magenta}" 15 | set -g fish_color_error "${colorscheme.colors.red}" 16 | set -g fish_color_escape "${colorscheme.colors.red}" 17 | set -g fish_color_cwd "${colorscheme.colors.blue}" 18 | set -g fish_color_cwd_root "${colorscheme.colors.red}" 19 | set -g fish_color_match "${colorscheme.colors.red}" 20 | set -g fish_color_selection "${colorscheme.colors.black}" 21 | set -g fish_color_search_match "${colorscheme.colors.magenta}" 22 | set -g fish_color_operator "${colorscheme.colors.cyan}" 23 | set -g fish_color_param "${colorscheme.colors.fg}" 24 | set -g fish_color_comment "${colorscheme.colors.black}" 25 | set -g fish_color_history_current "${colorscheme.colors.blue}" 26 | set -g fish_color_host "${colorscheme.colors.blue}" 27 | set -g fish_color_autosuggestion "${colorscheme.colors.fg}" 28 | set -g fish_color_valid_path "${colorscheme.colors.green}" 29 | set -g fish_color_user "${colorscheme.colors.yellow}" 30 | 31 | set -g fish_pager_color_progress "${colorscheme.colors.blue}" 32 | set -g fish_pager_color_prefix "${colorscheme.colors.blue}" 33 | set -g fish_pager_color_description "${colorscheme.colors.blue}" 34 | set -g fish_pager_color_completion "${colorscheme.colors.blue}" 35 | 36 | ${lib.optionalString (hydroConfig != null) '' 37 | set -g hydro_color_prompt "${colorscheme.colors.primary}" 38 | set -g hydro_color_pwd "${colorscheme.colors.primary}" 39 | set -g hydro_color_git "${colorscheme.colors.magenta}" 40 | set -g hydro_color_error "${colorscheme.colors.red}" 41 | set -g hydro_color_duration "${colorscheme.colors.green}" 42 | ''} 43 | ''; 44 | } 45 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/fuzzel.nix: -------------------------------------------------------------------------------- 1 | { 2 | colorscheme, 3 | mylib, 4 | ... 5 | }: { 6 | xdg.configFile."fuzzel/fuzzel.ini".text = '' 7 | prompt="検索 " 8 | dpi-aware=yes 9 | font=JetBrainsMono Nerd Font:size=14,Inter:size=14 10 | icons-enabled=false 11 | match-mode=fzf 12 | use-bold=true 13 | inner-pad=6 14 | 15 | [colors] 16 | background=${mylib.removeHash colorscheme.colors.bg}dd 17 | text=${mylib.removeHash colorscheme.colors.fg}ff 18 | prompt=${mylib.removeHash colorscheme.colors.primary}ff 19 | placeholder=${mylib.removeHash colorscheme.colors.altbg}ff 20 | input=${mylib.removeHash colorscheme.colors.fg}ff 21 | match=${mylib.removeHash colorscheme.colors.red}ff 22 | selection=${mylib.removeHash colorscheme.colors.altbg}ff 23 | selection-text=${mylib.removeHash colorscheme.colors.fg}ff 24 | selection-match=${mylib.removeHash colorscheme.colors.red}ff 25 | counter=${mylib.removeHash colorscheme.colors.fg}ff 26 | border=${mylib.removeHash colorscheme.colors.primary}ff 27 | 28 | [border] 29 | width=4 30 | radius=6 31 | ''; 32 | } 33 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/fzf.nix: -------------------------------------------------------------------------------- 1 | {colorscheme, ...}: { 2 | # programs.fzf.colors = { 3 | # "bg+" = "-1"; 4 | # "bg" = "-1"; 5 | # "spinner" = "${colorscheme.colors.yellow}"; 6 | # "hl" = "${colorscheme.colors.primary}"; 7 | # "fg" = "${colorscheme.colors.fg}"; 8 | # "header" = "${colorscheme.colors.primary}"; 9 | # "info" = "${colorscheme.colors.magenta}"; 10 | # "pointer" = "${colorscheme.colors.yellow}"; 11 | # "marker" = "${colorscheme.colors.yellow}"; 12 | # "fg+" = "${colorscheme.colors.fg}"; 13 | # "prompt" = "${colorscheme.colors.magenta}"; 14 | # "hl+" = "${colorscheme.colors.primary}"; 15 | # }; 16 | 17 | # home.sessionVariables = { 18 | # FZF_DEFAULT_OPTS = "--color bg:-1,bg+:-1,fg:${colorscheme.colors.fg},fg+:${colorscheme.colors.fg},header:${colorscheme.colors.primary},hl:${colorscheme.colors.primary},hl+:${colorscheme.colors.primary},info:${colorscheme.colors.yellow},marker:${colorscheme.colors.green},pointer:${colorscheme.colors.yellow},prompt:${colorscheme.colors.green},spinner:${colorscheme.colors.green} 19 | # "; 20 | # }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/ghostty.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | colorscheme, 5 | ... 6 | }: { 7 | programs.ghostty = { 8 | settings.theme = "custom"; 9 | themes.custom = { 10 | background = colorscheme.colors.bg; 11 | cursor-color = colorscheme.colors.fg; 12 | foreground = colorscheme.colors.fg; 13 | palette = [ 14 | "0=${colorscheme.colors.black}" 15 | "1=${colorscheme.colors.red}" 16 | "2=${colorscheme.colors.green}" 17 | "3=${colorscheme.colors.yellow}" 18 | "4=${colorscheme.colors.blue}" 19 | "5=${colorscheme.colors.magenta}" 20 | "6=${colorscheme.colors.cyan}" 21 | "7=${colorscheme.colors.white}" 22 | "8=${colorscheme.colors.black}" 23 | "9=${colorscheme.colors.red}" 24 | "10=${colorscheme.colors.green}" 25 | "11=${colorscheme.colors.yellow}" 26 | "12=${colorscheme.colors.blue}" 27 | "13=${colorscheme.colors.magenta}" 28 | "14=${colorscheme.colors.cyan}" 29 | "15=${colorscheme.colors.fg}" 30 | ]; 31 | selection-background = colorscheme.colors.bg; 32 | selection-foreground = colorscheme.colors.bg; 33 | }; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/gtk.nix: -------------------------------------------------------------------------------- 1 | { 2 | mylib, 3 | name, 4 | pkgs, 5 | ... 6 | }: let 7 | themes = { 8 | gruvbox = { 9 | theme = { 10 | name = "Flat-Remix-GTK-Yellow-Darkest-Solid"; 11 | package = pkgs.flat-remix-gtk; 12 | }; 13 | iconTheme = { 14 | name = "Reversal-dark"; 15 | package = pkgs.reversal-icon-theme; 16 | }; 17 | }; 18 | min = { 19 | theme = { 20 | name = "Flat-Remix-GTK-Red-Darkest-Solid"; 21 | package = pkgs.flat-remix-gtk; 22 | }; 23 | iconTheme = { 24 | name = "Reversal-red-dark"; 25 | package = pkgs.reversal-icon-theme.override { 26 | colorVariants = ["-red"]; 27 | }; 28 | }; 29 | }; 30 | solarized = { 31 | theme = { 32 | name = "Flat-Remix-GTK-Cyan-Darkest-Solid"; 33 | package = pkgs.flat-remix-gtk; 34 | }; 35 | iconTheme = { 36 | name = "Reversal-cyan-dark"; 37 | package = pkgs.reversal-icon-theme.override { 38 | colorVariants = ["-cyan"]; 39 | }; 40 | }; 41 | }; 42 | vesper = { 43 | theme = { 44 | name = "Flat-Remix-GTK-Grey-Darkest-Solid"; 45 | package = pkgs.flat-remix-gtk; 46 | }; 47 | iconTheme = { 48 | name = "Reversal-black-dark"; 49 | package = pkgs.reversal-icon-theme.override { 50 | colorVariants = ["-black"]; 51 | }; 52 | }; 53 | }; 54 | catppuccin = { 55 | theme = { 56 | name = "Flat-Remix-GTK-Magenta-Darkest-Solid"; 57 | package = pkgs.flat-remix-gtk; 58 | }; 59 | iconTheme = { 60 | name = "Reversal-purple-dark"; 61 | package = pkgs.reversal-icon-theme.override { 62 | colorVariants = ["-purple"]; 63 | }; 64 | }; 65 | }; 66 | kanagawa = { 67 | theme = { 68 | name = "Flat-Remix-GTK-Orange-Darkest-Solid"; 69 | package = pkgs.flat-remix-gtk; 70 | }; 71 | iconTheme = { 72 | name = "Reversal-orange-dark"; 73 | package = pkgs.reversal-icon-theme.override { 74 | colorVariants = ["-orange"]; 75 | }; 76 | }; 77 | }; 78 | }; 79 | in 80 | mylib.mapLookup {value = name;} themes 81 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/i3.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | colorscheme, 6 | enableI3StatusIntegration, 7 | ... 8 | }: { 9 | xsession.windowManager.i3.config = { 10 | colors = { 11 | background = colorscheme.colors.bg; 12 | focused = { 13 | background = colorscheme.colors.altbg; 14 | border = colorscheme.colors.altbg; 15 | childBorder = colorscheme.colors.altbg; 16 | indicator = colorscheme.colors.altbg; 17 | text = colorscheme.colors.fg; 18 | }; 19 | focusedInactive = { 20 | background = colorscheme.colors.altbg; 21 | border = colorscheme.colors.bg; 22 | childBorder = colorscheme.colors.altbg; 23 | indicator = colorscheme.colors.altbg; 24 | text = colorscheme.colors.fg; 25 | }; 26 | unfocused = { 27 | background = colorscheme.colors.bg; 28 | border = colorscheme.colors.bg; 29 | childBorder = colorscheme.colors.bg; 30 | indicator = colorscheme.colors.bg; 31 | text = colorscheme.colors.fg; 32 | }; 33 | urgent = { 34 | background = colorscheme.colors.red; 35 | border = colorscheme.colors.red; 36 | childBorder = colorscheme.colors.red; 37 | indicator = colorscheme.colors.red; 38 | text = colorscheme.colors.fg; 39 | }; 40 | }; 41 | bars = 42 | lib.lists.imap0 (i: monitor: { 43 | id = "bar-${toString i}"; 44 | statusCommand = lib.mkIf (i == 0) "i3status"; 45 | colors = { 46 | focusedWorkspace = { 47 | background = "${colorscheme.colors.altbg}"; 48 | border = "${colorscheme.colors.altbg}cc"; 49 | text = "${colorscheme.colors.fg}"; 50 | }; 51 | }; 52 | extraConfig = '' 53 | output ${monitor.name} 54 | ''; 55 | }) 56 | config.modules.shared.multi-monitors.monitors; 57 | }; 58 | 59 | programs.i3status = lib.mkIf enableI3StatusIntegration { 60 | general = { 61 | color_good = colorscheme.colors.green; 62 | color_degraded = colorscheme.colors.yellow; 63 | color_bad = colorscheme.colors.red; 64 | color_separator = colorscheme.colors.bg; 65 | }; 66 | }; 67 | 68 | home.file.".local/bin/launcher".text = '' 69 | #!/usr/bin/env bash 70 | ${pkgs.dmenu}/bin/dmenu_run -nb "${colorscheme.colors.bg}" \ 71 | -nf "${colorscheme.colors.fg}" \ 72 | -sb "${colorscheme.colors.altbg}" \ 73 | -sf "${colorscheme.colors.fg}" 74 | ''; 75 | home.file.".local/bin/launcher".executable = true; 76 | } 77 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/i3lock.nix: -------------------------------------------------------------------------------- 1 | { 2 | colorscheme, 3 | pkgs, 4 | ... 5 | }: let 6 | callscript = pkgs.writeShellScript "i3lock-theme" '' 7 | BLANK='${colorscheme.colors.bg}00' 8 | CLEAR='${colorscheme.colors.altbg}22' 9 | DEFAULT='${colorscheme.colors.altbg}cc' 10 | TEXT='${colorscheme.colors.fg}ee' 11 | WRONG='${colorscheme.colors.red}bb' 12 | VERIFYING='${colorscheme.colors.yellow}bb' 13 | 14 | i3lock \ 15 | --insidever-color=$CLEAR \ 16 | --ringver-color=$VERIFYING \ 17 | \ 18 | --insidewrong-color=$CLEAR \ 19 | --ringwrong-color=$WRONG \ 20 | \ 21 | --inside-color=$BLANK \ 22 | --ring-color=$DEFAULT \ 23 | --line-color=$BLANK \ 24 | --separator-color=$DEFAULT \ 25 | \ 26 | --verif-color=$TEXT \ 27 | --wrong-color=$TEXT \ 28 | --time-color=$TEXT \ 29 | --date-color=$TEXT \ 30 | --layout-color=$TEXT \ 31 | --keyhl-color=$WRONG \ 32 | --bshl-color=$WRONG \ 33 | \ 34 | --screen 1 \ 35 | --blur 5 \ 36 | --clock \ 37 | --indicator \ 38 | --time-str="%H:%M:%S" \ 39 | --date-str="%A, %Y-%m-%d" \ 40 | --keylayout 1 \ 41 | ''; 42 | in { 43 | home.file.".local/bin/i3lock-theme".source = callscript; 44 | home.file.".local/bin/i3lock-theme".executable = true; 45 | } 46 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/neovim.nix: -------------------------------------------------------------------------------- 1 | { mylib, name, ...}: 2 | 3 | with mylib; match { colorscheme = name; } [ 4 | [{ colorscheme = "gruvbox"; } "gruvbox"] 5 | [{ colorscheme = "min"; } "min-theme"] 6 | [{ colorscheme = "solarized"; } "solarized-osaka"] 7 | [{ colorscheme = "vesper"; } "vesper"] 8 | [{ colorscheme = "catppuccin"; } "catppuccin"] 9 | [{ colorscheme = "kanagawa"; } "kanagawa"] 10 | ] 11 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/niri.nix: -------------------------------------------------------------------------------- 1 | {colorscheme, ...}: { 2 | modules.desktop.niri.rawConfigValues = [ 3 | '' 4 | window-rule { 5 | draw-border-with-background false 6 | } 7 | 8 | layout { 9 | gaps 12 10 | center-focused-column "never" 11 | preset-column-widths { 12 | proportion 0.33333 13 | proportion 0.5 14 | proportion 0.66667 15 | } 16 | 17 | default-column-width { proportion 0.5; } 18 | 19 | focus-ring { 20 | width 4 21 | active-color "${colorscheme.colors.primary}" 22 | inactive-color "${colorscheme.colors.altbg}" 23 | } 24 | 25 | border { 26 | off 27 | } 28 | 29 | shadow { 30 | softness 30 31 | spread 5 32 | offset x=0 y=5 33 | color "${colorscheme.colors.bg}77" 34 | } 35 | } 36 | '' 37 | ]; 38 | } 39 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/rio.nix: -------------------------------------------------------------------------------- 1 | {colorscheme, ...}: { 2 | programs.rio.settings = { 3 | colors.background = "${colorscheme.colors.bg}"; 4 | colors.black = "${colorscheme.colors.black}"; 5 | colors.blue = "${colorscheme.colors.blue}"; 6 | colors.cyan = "${colorscheme.colors.cyan}"; 7 | colors.foreground = "${colorscheme.colors.fg}"; 8 | colors.green = "${colorscheme.colors.green}"; 9 | colors.magenta = "${colorscheme.colors.magenta}"; 10 | colors.red = "${colorscheme.colors.red}"; 11 | colors.white = "${colorscheme.colors.white}"; 12 | colors.yellow = "${colorscheme.colors.yellow}"; 13 | 14 | colors.cursor = "${colorscheme.colors.primary}"; 15 | colors.vi-cursor = "${colorscheme.colors.fg}"; 16 | 17 | # Navigation 18 | colors.tabs = "${colorscheme.colors.bg}"; 19 | colors.tabs-foreground = "${colorscheme.colors.fg}"; 20 | colors.tabs-active = "${colorscheme.colors.bg}"; 21 | colors.tabs-active-highlight = "${colorscheme.colors.green}"; 22 | colors.tabs-active-foreground = "${colorscheme.colors.fg}"; 23 | colors.bar = "${colorscheme.colors.bg}"; 24 | 25 | colors.search-match-background = "${colorscheme.colors.fg}"; 26 | colors.search-match-foreground = "${colorscheme.colors.bg}"; 27 | colors.search-focused-match-background = "${colorscheme.colors.yellow}"; 28 | colors.search-focused-match-foreground = "${colorscheme.colors.bg}"; 29 | 30 | colors.selection-foreground = "${colorscheme.colors.bg}"; 31 | colors.selection-background = "${colorscheme.colors.primary}"; 32 | 33 | colors.dim-black = "${colorscheme.colors.black}"; 34 | colors.dim-blue = "${colorscheme.colors.blue}"; 35 | colors.dim-cyan = "${colorscheme.colors.cyan}"; 36 | colors.dim-foreground = "${colorscheme.colors.fg}"; 37 | colors.dim-green = "${colorscheme.colors.green}"; 38 | colors.dim-magenta = "${colorscheme.colors.magenta}"; 39 | colors.dim-red = "${colorscheme.colors.red}"; 40 | colors.dim-white = "${colorscheme.colors.white}"; 41 | colors.dim-yellow = "${colorscheme.colors.yellow}"; 42 | 43 | colors.light-black = "${colorscheme.colors.black}"; 44 | colors.light-blue = "${colorscheme.colors.blue}"; 45 | colors.light-cyan = "${colorscheme.colors.cyan}"; 46 | colors.light-foreground = "${colorscheme.colors.fg}"; 47 | colors.light-green = "${colorscheme.colors.green}"; 48 | colors.light-magenta = "${colorscheme.colors.magenta}"; 49 | colors.light-red = "${colorscheme.colors.red}"; 50 | colors.light-white = "${colorscheme.colors.white}"; 51 | colors.light-yellow = "${colorscheme.colors.yellow}"; 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/sway.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | colorscheme, 4 | pkgs, 5 | enableI3StatusIntegration, 6 | enableAstalIntegration, 7 | ... 8 | }: { 9 | wayland.windowManager.sway.config = { 10 | colors = { 11 | background = colorscheme.colors.bg; 12 | focused = { 13 | background = colorscheme.colors.altbg; 14 | border = colorscheme.colors.altbg; 15 | childBorder = colorscheme.colors.altbg; 16 | indicator = colorscheme.colors.altbg; 17 | text = colorscheme.colors.fg; 18 | }; 19 | focusedInactive = { 20 | background = colorscheme.colors.altbg; 21 | border = colorscheme.colors.bg; 22 | childBorder = colorscheme.colors.altbg; 23 | indicator = colorscheme.colors.altbg; 24 | text = colorscheme.colors.fg; 25 | }; 26 | unfocused = { 27 | background = colorscheme.colors.bg; 28 | border = colorscheme.colors.bg; 29 | childBorder = colorscheme.colors.bg; 30 | indicator = colorscheme.colors.bg; 31 | text = colorscheme.colors.fg; 32 | }; 33 | urgent = { 34 | background = colorscheme.colors.red; 35 | border = colorscheme.colors.red; 36 | childBorder = colorscheme.colors.red; 37 | indicator = colorscheme.colors.red; 38 | text = colorscheme.colors.fg; 39 | }; 40 | }; 41 | bars = 42 | if enableI3StatusIntegration 43 | then [ 44 | { 45 | id = "bar-0"; 46 | statusCommand = lib.mkIf enableI3StatusIntegration "i3status"; 47 | colors = { 48 | focusedWorkspace = { 49 | background = "${colorscheme.colors.altbg}"; 50 | border = "${colorscheme.colors.altbg}cc"; 51 | text = "${colorscheme.colors.fg}"; 52 | }; 53 | }; 54 | } 55 | ] 56 | else if enableAstalIntegration 57 | then [ 58 | { 59 | id = "bar-0"; 60 | command = "astal"; 61 | } 62 | ] 63 | else []; 64 | }; 65 | 66 | programs.i3status = lib.mkIf enableI3StatusIntegration { 67 | general = { 68 | color_good = colorscheme.colors.green; 69 | color_degraded = colorscheme.colors.yellow; 70 | color_bad = colorscheme.colors.red; 71 | color_separator = colorscheme.colors.bg; 72 | }; 73 | }; 74 | 75 | home.file.".local/bin/launcher".text = '' 76 | #!/usr/bin/env bash 77 | ${pkgs.wmenu}/bin/wmenu-run -p "" \ 78 | -M "${colorscheme.colors.bg}" \ 79 | -m "${colorscheme.colors.fg}" \ 80 | -N "${colorscheme.colors.bg}" \ 81 | -n "${colorscheme.colors.fg}" \ 82 | -S "${colorscheme.colors.bg}" \ 83 | -s "${colorscheme.colors.primary}" 84 | ''; 85 | home.file.".local/bin/launcher".executable = true; 86 | } 87 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/wezterm.nix: -------------------------------------------------------------------------------- 1 | {colorscheme, ...}: { 2 | xdg.configFile."wezterm/theme.lua".text = '' 3 | return { 4 | background = "${colorscheme.colors.bg}", 5 | foreground = "${colorscheme.colors.fg}", 6 | cursor_bg = "${colorscheme.colors.fg}", 7 | cursor_fg = "${colorscheme.colors.black}", 8 | cursor_border = "${colorscheme.colors.fg}", 9 | selection_fg = "${colorscheme.colors.black}", 10 | selection_bg = "${colorscheme.colors.fg}", 11 | scrollbar_thumb = "${colorscheme.colors.fg}", 12 | split = "${colorscheme.colors.white}", 13 | ansi = { 14 | "${colorscheme.colors.bg}", 15 | "${colorscheme.colors.red}", 16 | "${colorscheme.colors.green}", 17 | "${colorscheme.colors.yellow}", 18 | "${colorscheme.colors.blue}", 19 | "${colorscheme.colors.magenta}", 20 | "${colorscheme.colors.cyan}", 21 | "${colorscheme.colors.fg}", 22 | }, 23 | brights = { 24 | "${colorscheme.colors.white}", 25 | "${colorscheme.colors.red}", 26 | "${colorscheme.colors.green}", 27 | "${colorscheme.colors.yellow}", 28 | "${colorscheme.colors.blue}", 29 | "${colorscheme.colors.magenta}", 30 | "${colorscheme.colors.cyan}", 31 | "${colorscheme.colors.bg}", 32 | }, 33 | } 34 | ''; 35 | } 36 | -------------------------------------------------------------------------------- /modules/colorscheme/integrations/zellij.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | colorscheme, 5 | ... 6 | }: let 7 | zellijConf = config.xdg.configFile."zellij/zellij.toml".text or null; 8 | in { 9 | modules.desktop.conf.zellij = { 10 | theme = "custom"; 11 | themeConfig = { 12 | bg = colorscheme.colors.bg; 13 | black = colorscheme.colors.bg; 14 | blue = colorscheme.colors.blue; 15 | cyan = colorscheme.colors.cyan; 16 | fg = colorscheme.colors.fg; 17 | green = colorscheme.colors.black; 18 | magenta = colorscheme.colors.magenta; 19 | orange = colorscheme.colors.green; 20 | red = colorscheme.colors.red; 21 | white = colorscheme.colors.white; 22 | yellow = colorscheme.colors.yellow; 23 | }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/catppuccin.nix: -------------------------------------------------------------------------------- 1 | { 2 | colors = { 3 | primary = "#ab9df2"; 4 | bg = "#111111"; 5 | altbg = "#303446"; 6 | fg = "#e6e9ef"; 7 | black = "#626880"; 8 | red = "#e78284"; 9 | green = "#a6d189"; 10 | yellow = "#e5c890"; 11 | blue = "#8caaee"; 12 | magenta = "#ab9df2"; 13 | cyan = "#99d1db"; 14 | white = "#dce0e8"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/gruvbox.nix: -------------------------------------------------------------------------------- 1 | { 2 | colors = { 3 | primary = "#d79921"; 4 | bg = "#1d2021"; 5 | altbg = "#32302f"; 6 | fg = "#ebdbb2"; 7 | black = "#585858"; 8 | red = "#cc241d"; 9 | green = "#98971a"; 10 | yellow = "#d79921"; 11 | blue = "#458588"; 12 | magenta = "#b16286"; 13 | cyan = "#689d6a"; 14 | white = "#a89984"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/kanagawa.nix: -------------------------------------------------------------------------------- 1 | { 2 | colors = { 3 | primary = "#c4746e"; 4 | bg = "#181616"; 5 | altbg = "#363646"; 6 | fg = "#c5c9c5"; 7 | black = "#585858"; 8 | red = "#c4746e"; 9 | green = "#8a9a7b"; 10 | yellow = "#c4b28a"; 11 | blue = "#8ba4b0"; 12 | magenta = "#a292a3"; 13 | cyan = "#8ea4a2"; 14 | white = "#C8C093"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/min.nix: -------------------------------------------------------------------------------- 1 | { 2 | colors = { 3 | primary = "#ffab70"; 4 | bg = "#1a1a1a"; 5 | altbg = "#383838"; 6 | fg = "#c1c1c1"; 7 | black = "#585858"; 8 | red = "#ff7a84"; 9 | green = "#22863a"; 10 | yellow = "#ffab70"; 11 | blue = "#79b8ff"; 12 | magenta = "#b392f0"; 13 | cyan = "#9db1c5"; 14 | white = "#fafafa"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/solarized.nix: -------------------------------------------------------------------------------- 1 | { 2 | colors = { 3 | primary = "#2aa198"; 4 | bg = "#00181e"; 5 | altbg = "#002b36"; 6 | fg = "#839496"; 7 | black = "#073642"; 8 | red = "#dc322f"; 9 | green = "#859900"; 10 | yellow = "#b58900"; 11 | blue = "#268bd2"; 12 | magenta = "#d33682"; 13 | cyan = "#2aa198"; 14 | white = "#eee8d5"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/colorscheme/themes/vesper.nix: -------------------------------------------------------------------------------- 1 | { 2 | colors = { 3 | primary = "#A0A0A0"; 4 | bg = "#101010"; 5 | altbg = "#343434"; 6 | fg = "#CCCCCC"; 7 | black = "#505050"; 8 | red = "#FF8080"; 9 | green = "#82D9C2"; 10 | yellow = "#FFCFA8"; 11 | blue = "#8B8B8B"; 12 | magenta = "#FFCFA8"; 13 | cyan = "#FFCFA8"; 14 | white = "#FFFFFF"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/conf/home.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | mylib, 4 | pkgs, 5 | lib, 6 | ... 7 | } @ args: let 8 | integrations = builtins.listToAttrs ( 9 | map (path: { 10 | name = builtins.baseNameOf path; 11 | value = import path args; 12 | }) (mylib.file.scanPaths ./integrations) 13 | ); 14 | 15 | moduleOptions = { 16 | options.modules.desktop.conf = lib.foldr ( 17 | integration: acc: 18 | lib.recursiveUpdate acc 19 | (integration.configOptions.modules.desktop.conf or {}) 20 | ) {} (builtins.attrValues integrations); 21 | }; 22 | 23 | moduleConfig = { 24 | config = lib.mkIf true (lib.foldr ( 25 | integration: acc: 26 | lib.recursiveUpdate acc 27 | (integration.configContent or {}) 28 | ) {} (builtins.attrValues integrations)); 29 | }; 30 | in { 31 | imports = []; 32 | inherit (moduleOptions) options; 33 | inherit (moduleConfig) config; 34 | } 35 | -------------------------------------------------------------------------------- /modules/conf/integrations/cava.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | mylib, 5 | ... 6 | }: 7 | with lib; { 8 | configOptions.modules.desktop.conf = { 9 | enableCavaIntegration = mkEnableOption "Enable cava integration"; 10 | 11 | cava.settings = mkOption { 12 | type = types.attrs; 13 | default = {}; 14 | description = "Settings for cava"; 15 | }; 16 | }; 17 | 18 | configContent = mkIf config.modules.desktop.conf.enableCavaIntegration { 19 | xdg.configFile."cava/config".text = '' 20 | ${mylib.format.sections ["color"] config.modules.desktop.conf.cava.settings} 21 | ''; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /modules/conf/integrations/dunst.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | mylib, 6 | ... 7 | }: let 8 | defaultSettings = { 9 | global = { 10 | monitor = 0; 11 | follow = "mouse"; 12 | shrink = "no"; 13 | padding = 20; 14 | horizontal_padding = 20; 15 | width = 275; 16 | height = "(0, 100)"; 17 | offset = "(10, 50)"; 18 | origin = "bottom-right"; 19 | frame_width = 1; 20 | separator_height = 0; 21 | sort = "no"; 22 | font = "JetBrainsMono Nerd Font 10"; 23 | markup = "full"; 24 | format = "%s\\n%b"; 25 | alignment = "left"; 26 | show_age_threshold = 60; 27 | word_wrap = "yes"; 28 | ignore_newline = "no"; 29 | stack_duplicates = "true"; 30 | hide_duplicate_count = "no"; 31 | show_indicators = "yes"; 32 | icon_position = "left"; 33 | max_icon_size = 60; 34 | sticky_history = "no"; 35 | history_length = 6; 36 | title = "Dunst"; 37 | class = "Dunst"; 38 | corner_radius = 0; 39 | mouse_left_click = "close_current"; 40 | mouse_middle_click = "do_action"; 41 | mouse_right_click = "close_all"; 42 | }; 43 | 44 | urgency_low = { 45 | timeout = 5; 46 | }; 47 | 48 | urgency_normal = { 49 | timeout = 10; 50 | }; 51 | 52 | urgency_critical = { 53 | timeout = 0; 54 | }; 55 | }; 56 | evaluatedSettings = config.modules.desktop.conf.dunst.settings {}; 57 | mergedSettings = 58 | lib.recursiveUpdate 59 | defaultSettings 60 | evaluatedSettings; 61 | in { 62 | configOptions.modules.desktop.conf = { 63 | enableDunstIntegration = lib.mkEnableOption "Whether to enable dunst"; 64 | 65 | dunst.settings = lib.mkOption { 66 | type = lib.types.attrsOf lib.types.anything; 67 | default = defaultSettings; 68 | apply = lib.recursiveUpdate; 69 | }; 70 | }; 71 | 72 | configContent = lib.mkIf config.modules.desktop.conf.enableDunstIntegration { 73 | xdg.configFile."dunst/dunstrc".text = builtins.replaceStrings ["'"] ["\""] '' 74 | ${mylib.format.sections ["global" "urgency_low" "urgency_normal" "urgency_critical"] mergedSettings} 75 | ''; 76 | }; 77 | } 78 | -------------------------------------------------------------------------------- /modules/conf/integrations/picom.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | mylib, 4 | lib, 5 | ... 6 | }: 7 | with lib; { 8 | configOptions.modules.desktop.conf = { 9 | enablePicomIntegration = mkEnableOption "Enable picom integration"; 10 | 11 | picom.settings = mkOption { 12 | type = types.attrs; 13 | default = {}; 14 | description = "Settings for picom"; 15 | }; 16 | }; 17 | 18 | configContent = mkIf config.modules.desktop.conf.enablePicomIntegration { 19 | xdg.configFile."picom/picom.conf".text = 20 | mylib.format.sections [] config.modules.desktop.conf.picom.settings; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /modules/conf/integrations/zellij.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | mylib, 5 | pkgs, 6 | ... 7 | }: { 8 | configOptions.modules.desktop.conf = { 9 | enableZellijIntegration = lib.mkEnableOption "Zellij configuration."; 10 | 11 | zellij.content = lib.mkOption { 12 | type = lib.types.lines; 13 | default = "default"; 14 | description = "Zellij kdl configuration content."; 15 | }; 16 | 17 | zellij.theme = lib.mkOption { 18 | type = lib.types.str; 19 | default = ""; 20 | description = "Zellij theme."; 21 | }; 22 | 23 | zellij.themeConfig = lib.mkOption { 24 | type = lib.types.attrs; 25 | default = {}; 26 | description = "Zellij theme configuration."; 27 | }; 28 | 29 | zellij.layoutContent = lib.mkOption { 30 | type = lib.types.lines; 31 | default = ""; 32 | description = "Zellij layout content."; 33 | }; 34 | }; 35 | 36 | configContent = lib.mkIf config.modules.desktop.conf.enableZellijIntegration { 37 | xdg.configFile."zellij/config.kdl".text = '' 38 | ${config.modules.desktop.conf.zellij.content} 39 | 40 | ${lib.optionalString (config.modules.desktop.conf.zellij.theme != "") '' 41 | theme "${config.modules.desktop.conf.zellij.theme}" 42 | ''} 43 | 44 | ${lib.optionalString (config.modules.desktop.conf.zellij.theme != "") '' 45 | themes { 46 | ${config.modules.desktop.conf.zellij.theme} { 47 | ${lib.replaceStrings ["="] [" "] ( 48 | mylib.format.sections [] config.modules.desktop.conf.zellij.themeConfig 49 | )} 50 | } 51 | } 52 | ''} 53 | ''; 54 | 55 | xdg.configFile."zellij/layouts/default.kdl".text = config.modules.desktop.conf.zellij.layoutContent; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /modules/home/base/core/btop.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | nur-ryan4yin, 4 | ... 5 | }: { 6 | # xdg.configFile."btop/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-btop}/themes"; 7 | 8 | programs.btop = { 9 | enable = true; 10 | settings = { 11 | # color_theme = "catppuccin_mocha"; 12 | theme_background = false; 13 | }; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /modules/home/base/core/core.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = with pkgs; [ 3 | gnupg 4 | gnumake 5 | fd 6 | just 7 | hyperfine 8 | nix-index 9 | ]; 10 | 11 | programs = { 12 | fzf = { 13 | enable = true; 14 | enableBashIntegration = true; 15 | enableFishIntegration = true; 16 | }; 17 | 18 | eza = { 19 | enable = true; 20 | git = true; 21 | icons = "auto"; 22 | }; 23 | 24 | bat = { 25 | enable = false; 26 | config = { 27 | pager = "less -FR"; 28 | }; 29 | }; 30 | 31 | ripgrep = { 32 | enable = true; 33 | package = pkgs.ripgrep.override {withPCRE2 = true;}; 34 | arguments = [ 35 | "--smart-case" 36 | ]; 37 | }; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /modules/home/base/core/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/base/core/editors/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/base/core/editors/neovim/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim = { 3 | enable = true; 4 | vimAlias = true; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /modules/home/base/core/git/conf/protected-branchs-hook.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | restricted_branches=("main" "master" "production" "prod" "stag" "stage" "develop" "dev") 4 | 5 | is_restricted_branch() { 6 | local branch=$1 7 | for restricted in "${restricted_branches[@]}"; do 8 | if [[ "$branch" == "$restricted" ]]; then 9 | return 0 10 | fi 11 | done 12 | return 1 13 | } 14 | 15 | if [[ "$BYPASS_HOOKS" == "true" ]]; then 16 | exit 0 17 | fi 18 | 19 | while read local_ref local_commit remote_ref remote_commit; do 20 | branch_name=$(basename "$local_ref") 21 | 22 | if is_restricted_branch "$branch_name"; then 23 | echo "pushing to '$branch_name' is not allowed unless you pass BYPASS_HOOKS=true" 24 | exit 1 25 | fi 26 | done 27 | 28 | exit 0 29 | -------------------------------------------------------------------------------- /modules/home/base/core/git/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | myvars, 6 | ... 7 | }: { 8 | programs.git = { 9 | enable = true; 10 | lfs.enable = true; 11 | 12 | userName = myvars.userfullname; 13 | userEmail = myvars.useremail; 14 | 15 | includes = [ 16 | { 17 | path = "~/work/.gitconfig"; 18 | condition = "gitdir:~/work/"; 19 | } 20 | ]; 21 | 22 | extraConfig = { 23 | core.editor = "nvim"; 24 | init.defaultBranch = "main"; 25 | push.autoSetupRemote = true; 26 | push.default = "simple"; 27 | github.user = "datsfilipe"; 28 | diff.tool = "nvimdiff"; 29 | difftool.nvimdiff.cmd = "nvim -d $LOCAL $REMOTE"; 30 | merge.tool = "nvimdiff3"; 31 | mergetool.keepBackup = false; 32 | mergetool.nvimdiff.cmd = "nvim -d $LOCAL $REMOTE"; 33 | mergetool.nvimdiff.trustExitCode = true; 34 | ghq.root = "~/www/s"; 35 | ghq."ssh://git@github.com/d3-inc".root = "~/www/w"; 36 | 37 | url = { 38 | "ssh://git@github.com/datsfilipe" = { 39 | insteadOf = "https://github.com/datsfilipe"; 40 | }; 41 | }; 42 | }; 43 | 44 | aliases = { 45 | whoami = "!git config user.name"; 46 | br = "branch"; 47 | co = "checkout"; 48 | st = "status -sb"; 49 | sf = "show --name-only"; 50 | rc = "reset --soft HEAD~1"; 51 | r = "reset HEAD --"; 52 | u = "checkout --"; 53 | c = "commit -m"; 54 | ca = "commit -am"; 55 | ps = "push"; 56 | psu = "push -u"; 57 | pl = "pull"; 58 | mg = "mergetool"; 59 | df = "difftool"; 60 | psm = "!git push origin $(git rev-parse --abbrev-ref HEAD)"; 61 | plm = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"; 62 | lg = "log --graph --name-status --pretty=format:\"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset\" --date=relative"; 63 | chbase = "!f() { git rebase --onto=$1 $2 $(git symbolic-ref --short HEAD); }; f"; 64 | eu = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"; 65 | au = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"; 66 | incc = "!(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})"; 67 | outc = "!(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)"; 68 | 69 | sp = "submodule update --init --recursive"; 70 | sfor = "submodule foreach"; 71 | }; 72 | 73 | hooks = { 74 | pre-push = ./conf/protected-branchs-hook.sh; 75 | }; 76 | }; 77 | 78 | programs.gh = { 79 | enable = true; 80 | extensions = [ 81 | pkgs.gh-markdown-preview 82 | ]; 83 | settings.aliases = { 84 | "co" = "pr checkout"; 85 | "pv" = "pr view"; 86 | "md" = "markdown-preview"; 87 | }; 88 | }; 89 | 90 | home.packages = with pkgs; [ 91 | gitAndTools.ghq 92 | gitAndTools.git-lfs 93 | ]; 94 | 95 | home.shellAliases = { 96 | "g" = "git"; 97 | "ga" = "git add"; 98 | "gc" = "git commit"; 99 | "gca" = "git commit --amend"; 100 | "gr" = "reset HEAD --"; 101 | "gu" = "git checkout --"; 102 | "root" = "cd \"$(git rev-parse --show-toplevel)\""; 103 | "gg" = "BYPASS_HOOKS=true git"; 104 | }; 105 | } 106 | -------------------------------------------------------------------------------- /modules/home/base/core/shells/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | pkgs-unstable, 5 | ... 6 | }: let 7 | pkgs = pkgs-unstable; 8 | shellAliases = import ./shellAliases.nix; 9 | localbin = "${config.home.homeDirectory}/.local/bin"; 10 | gobin = "${config.home.homeDirectory}/go/bin"; 11 | rustbin = "${config.home.homeDirectory}/.cargo/bin"; 12 | path = "PATH=\"$PATH:${localbin}:${gobin}:${rustbin}\""; 13 | in { 14 | imports = [ 15 | (import ./fish.nix {inherit lib pkgs path;}) 16 | ]; 17 | 18 | home.shellAliases = shellAliases; 19 | programs.bash = { 20 | enable = true; 21 | enableCompletion = true; 22 | bashrcExtra = '' 23 | export ${path} 24 | ''; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /modules/home/base/core/shells/fish.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | path, 5 | ... 6 | }: 7 | with lib; { 8 | programs.fish = { 9 | enable = true; 10 | functions = { 11 | fish_user_key_bindings = '' 12 | bind --preset -M insert \cl 'clear; commandline -f repaint' 13 | bind --preset -M insert \a accept-autosuggestion 14 | ''; 15 | }; 16 | 17 | shellInit = '' 18 | export ${path} 19 | ''; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/home/base/core/shells/shellAliases.nix: -------------------------------------------------------------------------------- 1 | { 2 | "ll" = "eza --color always --icons -1glb -s name --git --sort date --group-directories-first"; 3 | "lla" = "eza --color always --icons -1galb -s name --git --sort date --group-directories-first"; 4 | "tree" = "eza --tree -D -L 3"; 5 | 6 | "del" = "trxsh"; 7 | "dels" = "trxsh --list"; 8 | "delu" = "trxsh --fzf"; 9 | "delr" = "trxsh --restore"; 10 | "delc" = "trxsh --cleanup"; 11 | 12 | "top" = "btop -p 1"; 13 | "topp" = "btop"; 14 | 15 | "rm" = "echo \"use trash instead of rm\""; 16 | "cat" = "meow"; 17 | "zp" = "zipper"; 18 | "ext" = "extract"; 19 | "zj" = "zellij"; 20 | "nsh" = "nix-set-shell"; 21 | "dt" = "devtunnel"; 22 | "dd" = "cd ~/.dotfiles"; 23 | "wconn" = "nmcli-wifi-connect"; 24 | 25 | "dc-list" = "docker-helpers names"; 26 | "dc-ips" = "docker-helpers ips"; 27 | "dc-exec" = "docker-helpers ex"; 28 | "dc-log" = "docker-helpers logs"; 29 | "dc-rm" = "docker-helpers srm"; 30 | "dc-rma" = "docker-helpers rall"; 31 | "dc-img-rm" = "docker-helpers riall"; 32 | "dc-stop" = "docker-helpers sall"; 33 | "ne" = "~/.local/bin/nix-env"; 34 | } 35 | -------------------------------------------------------------------------------- /modules/home/base/core/zellij/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | shellAliases = { 3 | "zj" = "zellij"; 4 | }; 5 | in { 6 | programs.zellij.enable = true; 7 | home.shellAliases = shellAliases; 8 | } 9 | -------------------------------------------------------------------------------- /modules/home/base/gui/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/base/gui/media.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | ... 5 | }: { 6 | home.packages = with pkgs; [ 7 | ffmpeg-full 8 | imagemagick 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /modules/home/base/gui/terminal/alacritty.nix: -------------------------------------------------------------------------------- 1 | {lib, ...}: 2 | with lib; { 3 | programs.alacritty = { 4 | settings = { 5 | terminal.shell.program = "fish"; 6 | 7 | font = { 8 | size = 14; 9 | bold = { 10 | family = "JetBrainsMono Nerd Font"; 11 | style = "Bold"; 12 | }; 13 | normal = { 14 | family = "JetBrainsMono Nerd Font"; 15 | style = "Regular"; 16 | }; 17 | italic = { 18 | family = "JetBrainsMono Nerd Font"; 19 | style = "Italic"; 20 | }; 21 | bold_italic = { 22 | family = "JetBrainsMono Nerd Font"; 23 | style = "Bold Italic"; 24 | }; 25 | }; 26 | 27 | cursor = { 28 | style = { 29 | shape = "Block"; 30 | blinking = "On"; 31 | }; 32 | blink_interval = 500; 33 | }; 34 | 35 | keyboard.bindings = [ 36 | { 37 | key = "X"; 38 | mods = "Control"; 39 | action = "ToggleViMode"; 40 | } 41 | ]; 42 | 43 | window = { 44 | opacity = 0.8; 45 | padding.x = 25; 46 | padding.y = 25; 47 | }; 48 | }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /modules/home/base/gui/terminal/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/base/gui/terminal/ghostty.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | mypkgs, 5 | ... 6 | }: 7 | with lib; { 8 | programs.ghostty = { 9 | package = mypkgs.ghostty; 10 | enableFishIntegration = true; 11 | settings = { 12 | command = "fish"; 13 | font-size = 14; 14 | font-family = "JetBrainsMono Nerd Font"; 15 | font-family-bold = "JetBrainsMono Nerd Font Bold"; 16 | font-family-italic = "JetBrainsMono Nerd Font Italic"; 17 | font-family-bold-italic = "JetBrainsMono Nerd Font Bold Italic"; 18 | window-decoration = false; 19 | bold-is-bright = true; 20 | auto-update = "off"; 21 | linux-cgroup = "never"; 22 | gtk-single-instance = true; 23 | window-vsync = false; 24 | adjust-cursor-thickness = 25; 25 | window-padding-x = 25; 26 | window-padding-y = 25; 27 | window-padding-balance = true; 28 | background-opacity = 0.8; 29 | background-blur-radius = 20; 30 | font-feature = "-calt,-liga,-dlig"; 31 | keybind = [ 32 | "ctrl+enter=unbind" 33 | "alt+one=unbind" 34 | "alt+two=unbind" 35 | "alt+three=unbind" 36 | "alt+four=unbind" 37 | "alt+five=unbind" 38 | "alt+six=unbind" 39 | "alt+seven=unbind" 40 | "alt+eight=unbind" 41 | "alt+nine=unbind" 42 | "alt+zero=unbind" 43 | ]; 44 | }; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /modules/home/base/gui/terminal/rio.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | mypkgs, 4 | ... 5 | }: { 6 | programs.rio = { 7 | package = mypkgs.rio; 8 | settings = { 9 | shell.program = "${pkgs.fish}/bin/fish"; 10 | platform.linux.program = "${pkgs.fish}/bin/fish"; 11 | fonts = { 12 | size = 18; 13 | hinting = false; 14 | family = "JetBrainsMono Nerd Font"; 15 | regular = { 16 | family = "JetBrainsMono Nerd Font"; 17 | style = "Normal"; 18 | width = "Normal"; 19 | weight = 400; 20 | }; 21 | bold = { 22 | family = "JetBrainsMono Nerd Font"; 23 | style = "Normal"; 24 | width = "Normal"; 25 | weight = 700; 26 | }; 27 | italic = { 28 | family = "JetBrainsMono Nerd Font"; 29 | style = "Italic"; 30 | width = "Normal"; 31 | weight = 400; 32 | }; 33 | italic-bold = { 34 | family = "JetBrainsMono Nerd Font"; 35 | style = "Italic"; 36 | width = "Normal"; 37 | weight = 700; 38 | }; 39 | }; 40 | window = { 41 | opacity = 0.8; 42 | blur = true; 43 | decorations = "Disabled"; 44 | }; 45 | navigation.mode = "Plain"; 46 | line-height = 1.1; 47 | use-split = false; 48 | padding-x = 25; 49 | padding-y = [25 25]; 50 | cursor = { 51 | shape = "block"; 52 | blinking = true; 53 | blinking-interval = 500; 54 | }; 55 | }; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /modules/home/base/gui/terminal/wezterm/conf/wezterm.lua: -------------------------------------------------------------------------------- 1 | local wezterm = require("wezterm") 2 | local config = {} 3 | 4 | if wezterm.config_builder then 5 | config = wezterm.config_builder() 6 | end 7 | 8 | config.color_schemes = { 9 | ["datstheme"] = require("theme"), 10 | } 11 | config.color_scheme = "datstheme" 12 | config.default_prog = { "fish" } 13 | config.window_close_confirmation = "NeverPrompt" 14 | config.hide_tab_bar_if_only_one_tab = true 15 | config.enable_wayland = false 16 | config.enable_tab_bar = false 17 | 18 | config.window_padding = { 19 | top = "1cell", 20 | right = "2cell", 21 | bottom = "1cell", 22 | left = "2cell", 23 | } 24 | 25 | config.inactive_pane_hsb = { 26 | saturation = 0.9, 27 | brightness = 0.8, 28 | } 29 | 30 | config.window_background_opacity = 0.75 31 | config.text_background_opacity = 1.0 32 | 33 | config.tab_bar_at_bottom = true 34 | config.use_fancy_tab_bar = false 35 | config.window_decorations = "RESIZE" 36 | 37 | config.font = wezterm.font("JetBrainsMono Nerd Font", { weight = "Regular" }) 38 | config.harfbuzz_features = { "calt=0", "clig=0", "liga=0" } 39 | config.font_size = 14.0 40 | 41 | config.prefer_egl = false 42 | config.animation_fps = 1 43 | config.audible_bell = "Disabled" 44 | config.keys = { 45 | { key = "x", mods = "CTRL", action = wezterm.action.ActivateCopyMode, replace_current = true }, 46 | } 47 | 48 | return config 49 | -------------------------------------------------------------------------------- /modules/home/base/gui/terminal/wezterm/default.nix: -------------------------------------------------------------------------------- 1 | {lib, ...}: 2 | with lib; { 3 | programs.wezterm = { 4 | extraConfig = '' 5 | ${fileContents ./conf/wezterm.lua} 6 | ''; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /modules/home/base/gui/tools.nix: -------------------------------------------------------------------------------- 1 | {pkgs-unstable, ...}: { 2 | home.packages = with pkgs-unstable; [ 3 | beekeeper-studio 4 | ]; 5 | } 6 | -------------------------------------------------------------------------------- /modules/home/base/home.nix: -------------------------------------------------------------------------------- 1 | {myvars, ...}: { 2 | home = { 3 | inherit (myvars) username; 4 | stateVersion = "25.05"; 5 | }; 6 | 7 | programs.home-manager.enable = true; 8 | } 9 | -------------------------------------------------------------------------------- /modules/home/base/tui/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/base/tui/editors/conf/lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "blink.cmp": { "branch": "main", "commit": "f2e4f6aae833c5c2866d203666910005363779d7" }, 3 | "conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" }, 4 | "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, 5 | "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, 6 | "indentmini.nvim": { "branch": "main", "commit": "59c2be5387e3a3308bb43f07e7e39fde0628bd4d" }, 7 | "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, 8 | "mini-git": { "branch": "main", "commit": "a0ddc6302f654523053c28109e8b6dbbf05c08f8" }, 9 | "mini.diff": { "branch": "main", "commit": "7e268d0241255abaa07b8aa0ddff028f7315fe21" }, 10 | "mini.pick": { "branch": "main", "commit": "417c273861971b451687e847383e61687463b06e" }, 11 | "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, 12 | "nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" }, 13 | "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, 14 | "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, 15 | "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, 16 | "vesper.nvim": { "branch": "main", "commit": "1717b1ad657c94bec3fc2bdebb0c55452d9fe46d" }, 17 | "vim-wakatime": { "branch": "master", "commit": "e46d7c4f98ee0f40782008dd60cb2a79c377fb1d" } 18 | } 19 | -------------------------------------------------------------------------------- /modules/home/base/tui/editors/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | imports = [./neovim.nix]; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/base/tui/editors/neovim.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | neovim-nightly, 6 | ... 7 | }: 8 | with lib; let 9 | lockfile = "${config.home.homeDirectory}/.dotfiles/modules/home/base/tui/editors/conf/lazy-lock.json"; 10 | in { 11 | programs.datsnvim = { 12 | enable = true; 13 | settings = { 14 | lazy.lock = lockfile; 15 | }; 16 | }; 17 | 18 | home.packages = with pkgs; [ 19 | tree-sitter 20 | fd 21 | ]; 22 | 23 | programs.neovim = { 24 | enable = true; 25 | package = neovim-nightly.packages.${pkgs.system}.default; 26 | vimAlias = true; 27 | extraWrapperArgs = [ 28 | "--suffix" 29 | "LIBRARY_PATH" 30 | ":" 31 | "${makeLibraryPath [pkgs.stdenv.cc.cc pkgs.zlib]}" 32 | "--suffix" 33 | "PKG_CONFIG_PATH" 34 | ":" 35 | "${makeSearchPathOutput "dev" "lib/pkgconfig" [pkgs.stdenv.cc.cc pkgs.zlib]}" 36 | ]; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /modules/home/base/tui/shells/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | mylib, 3 | lib, 4 | config, 5 | pkgs-unstable, 6 | ... 7 | }: let 8 | pkgs = pkgs-unstable; 9 | localbin = "${config.home.homeDirectory}/.local/bin"; 10 | gobin = "${config.home.homeDirectory}/go/bin"; 11 | rustbin = "${config.home.homeDirectory}/.cargo/bin"; 12 | path = "PATH=\"$PATH:${localbin}:${gobin}:${rustbin}\""; 13 | in { 14 | imports = map (module: import module {inherit lib pkgs path;}) (mylib.file.scanPaths ./.); 15 | } 16 | -------------------------------------------------------------------------------- /modules/home/base/tui/shells/fish/conf/config.fish: -------------------------------------------------------------------------------- 1 | set fish_greeting "" 2 | 3 | set -g fish_vi_force_cursor 1 4 | set fish_cursor_default block blink 5 | set fish_cursor_insert block blink 6 | set fish_cursor_replace_one block blink 7 | set fish_cursor_external block blink 8 | set fish_cursor_visual block blink 9 | 10 | function fish_mode_prompt; end 11 | set -x fish_key_bindings fish_vi_key_bindings 12 | set -g hydro_symbol_prompt "💀" 13 | 14 | set -gx ZF_DEFAULT_COMMAND "fd --type f --hidden --follow --exclude .git --color=always" 15 | set -gx ZF_CTRL_T_COMMAND $FZF_DEFAULT_COMMAND 16 | zoxide init fish | source 17 | set -gx zoxide_cmd z 18 | -------------------------------------------------------------------------------- /modules/home/base/tui/shells/fish/conf/plugin.fish: -------------------------------------------------------------------------------- 1 | if test -d $plugin_dir/vendor_functions.d 2 | set fish_function_path $fish_function_path[1] $plugin_dir/vendor_functions.d $fish_function_path[2..-1] 3 | end 4 | 5 | if test -d $plugin_dir/vendor_completions.d 6 | set fish_complete_path $fish_complete_path[1] $plugin_dir/vendor_completions.d $fish_complete_path[2..-1] 7 | end 8 | 9 | if test -d $plugin_dir/vendor_conf.d 10 | for f in $plugin_dir/vendor_conf.d/*.fish 11 | source $f 12 | end 13 | end 14 | 15 | if test -f $plugin_dir/key_bindings.fish 16 | source $plugin_dir/key_bindings.fish 17 | end 18 | 19 | if test -f $plugin_dir/init.fish 20 | source $plugin_dir/init.fish 21 | end 22 | -------------------------------------------------------------------------------- /modules/home/base/tui/shells/fish/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | path, 5 | ... 6 | }: 7 | with lib; let 8 | plugins = [ 9 | { 10 | name = "hydro"; 11 | pkg = pkgs.fishPlugins.hydro; 12 | } 13 | { 14 | name = "done"; 15 | pkg = pkgs.fishPlugins.done; 16 | } 17 | ]; 18 | in { 19 | programs.fish = { 20 | enable = true; 21 | functions = { 22 | dtc = '' 23 | devtunnel create $argv[1] 24 | devtunnel port create $argv[1] -p $argv[2] 25 | devtunnel access create $argv[1] -p $argv[2] --anonymous 26 | devtunnel host $argv[1] 27 | ''; 28 | }; 29 | 30 | shellInit = '' 31 | ${fileContents ./conf/config.fish} 32 | export ${path} 33 | 34 | 35 | if command -v get-gh-token >/dev/null 36 | set -gx GH_TOKEN (get-gh-token) 37 | end 38 | ''; 39 | }; 40 | 41 | home.packages = with pkgs; 42 | (map (p: p.pkg) plugins) ++ [zoxide]; 43 | 44 | xdg.configFile = 45 | lib.foldl' ( 46 | acc: plugin: 47 | acc 48 | // { 49 | "fish/conf.d/${plugin.name}.fish".text = '' 50 | set -l plugin_dir ${plugin.pkg}/share/fish 51 | ${fileContents ./conf/plugin.fish} 52 | ''; 53 | } 54 | ) {} 55 | plugins; 56 | } 57 | -------------------------------------------------------------------------------- /modules/home/base/tui/ssh.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.ssh = { 3 | enable = true; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /modules/home/base/tui/tools.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.direnv = { 3 | enable = true; 4 | nix-direnv.enable = true; 5 | enableBashIntegration = true; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /modules/home/base/tui/zellij/conf/config.kdl: -------------------------------------------------------------------------------- 1 | default_shell "fish" 2 | copy_on_select false 3 | default_layout "compact" 4 | pane_frames false 5 | session_serialization false 6 | simplified_ui true 7 | show_startup_tips false 8 | scrollback_editor "zellij-scrollback-editor" 9 | keybinds clear-defaults=true { 10 | shared_among "normal" "scroll" { 11 | bind "Ctrl x" { EditScrollback; } 12 | } 13 | shared { 14 | bind "Ctrl f" { 15 | Run "zellij-sessionizer" { 16 | close_on_exit true 17 | }; 18 | } 19 | bind "Alt Shift f" { ToggleFloatingPanes; } 20 | 21 | bind "Ctrl Enter" { NewTab; SwitchToMode "Normal"; } 22 | bind "Alt a" { GoToTab 1; SwitchToMode "Normal"; } 23 | bind "Alt s" { GoToTab 2; SwitchToMode "Normal"; } 24 | bind "Alt d" { GoToTab 3; SwitchToMode "Normal"; } 25 | bind "Alt f" { GoToTab 4; SwitchToMode "Normal"; } 26 | bind "Alt g" { GoToTab 5; SwitchToMode "Normal"; } 27 | bind "Alt h" { GoToTab 6; SwitchToMode "Normal"; } 28 | bind "Alt j" { GoToTab 7; SwitchToMode "Normal"; } 29 | bind "Alt k" { GoToTab 8; SwitchToMode "Normal"; } 30 | bind "Alt l" { GoToTab 9; SwitchToMode "Normal"; } 31 | bind "Alt ;" { GoToTab 10; SwitchToMode "Normal"; } 32 | 33 | bind "Alt 0" { 34 | Run "zellij-session-nav" "--headless" "0" { 35 | close_on_exit true 36 | }; 37 | } 38 | bind "Alt 1" { 39 | Run "zellij-session-nav" "--headless" "1" { 40 | close_on_exit true 41 | }; 42 | } 43 | bind "Alt 2" { 44 | Run "zellij-session-nav" "--headless" "2" { 45 | close_on_exit true 46 | }; 47 | } 48 | bind "Alt 3" { 49 | Run "zellij-session-nav" "--headless" "3" { 50 | close_on_exit true 51 | }; 52 | } 53 | bind "Alt 4" { 54 | Run "zellij-session-nav" "--headless" "4" { 55 | close_on_exit true 56 | }; 57 | } 58 | bind "Alt 5" { 59 | Run "zellij-session-nav" "--headless" "5" { 60 | close_on_exit true 61 | }; 62 | } 63 | bind "Alt 6" { 64 | Run "zellij-session-nav" "--headless" "6" { 65 | close_on_exit true 66 | }; 67 | } 68 | bind "Alt 7" { 69 | Run "zellij-session-nav" "--headless" "7" { 70 | close_on_exit true 71 | }; 72 | } 73 | bind "Alt 8" { 74 | Run "zellij-session-nav" "--headless" "8" { 75 | close_on_exit true 76 | }; 77 | } 78 | bind "Alt 9" { 79 | Run "zellij-session-nav" "--headless" "9" { 80 | close_on_exit true 81 | }; 82 | } 83 | } 84 | shared_except "normal" { 85 | bind "Ctrl c" { SwitchToMode "Normal"; } 86 | } 87 | shared_except "scroll" { 88 | bind "Alt u" { SwitchToMode "Scroll"; } 89 | } 90 | scroll { 91 | bind "Ctrl d" { HalfPageScrollDown; } 92 | bind "Ctrl u" { HalfPageScrollUp; } 93 | bind "j" { ScrollDown; } 94 | bind "k" { ScrollUp; } 95 | bind "/" { SwitchToMode "EnterSearch"; } 96 | } 97 | entersearch { 98 | bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; } 99 | bind "Enter" { SwitchToMode "Search"; } 100 | } 101 | search { 102 | bind "n" { Search "up"; } 103 | bind "N" { Search "down"; } 104 | bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; } 105 | bind "Enter" { SwitchToMode "Normal"; } 106 | } 107 | shared_except "tab" { 108 | bind "Alt t" { SwitchToMode "Tab"; } 109 | } 110 | shared_except "pane" { 111 | bind "Alt p" { SwitchToMode "Pane"; } 112 | } 113 | shared_except "resize" { 114 | bind "Alt r" { SwitchToMode "Resize"; } 115 | } 116 | tab { 117 | bind "J" { MoveTab "Left"; } 118 | bind "K" { MoveTab "Right"; } 119 | } 120 | pane { 121 | bind "h" { MoveFocus "Left"; } 122 | bind "j" { MoveFocus "Down"; } 123 | bind "k" { MoveFocus "Up"; } 124 | bind "l" { MoveFocus "Right"; } 125 | bind "H" { MovePane "Left"; } 126 | bind "J" { MovePane "Down"; } 127 | bind "K" { MovePane "Up"; } 128 | bind "L" { MovePane "Right"; } 129 | bind "f" { ToggleFocusFullscreen; } 130 | bind "r" { NewPane "Right"; SwitchToMode "Normal"; } 131 | bind "d" { NewPane "Down"; SwitchToMode "Normal"; } 132 | } 133 | resize { 134 | bind "h" { Resize "Left"; } 135 | bind "j" { Resize "Down"; } 136 | bind "k" { Resize "Up"; } 137 | bind "l" { Resize "Right"; } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /modules/home/base/tui/zellij/conf/layout.kdl: -------------------------------------------------------------------------------- 1 | layout { 2 | pane 3 | pane size=1 borderless=true { 4 | plugin location="zellij:compact-bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /modules/home/base/tui/zellij/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | mypkgs, 4 | zellij-switch, 5 | config, 6 | lib, 7 | ... 8 | }: let 9 | shellAliases = { 10 | "zj" = "zellij"; 11 | }; 12 | 13 | scriptpath = script: "${config.home.homeDirectory}/.local/bin/${script}"; 14 | pluginpath = "${mypkgs.zellij-switch}/bin/zellij-switch.wasm"; 15 | 16 | replacer = script: text: 17 | lib.replaceStrings ["Run \"${script}\""] [ 18 | "Run \"${scriptpath script}\" \"--plugin\" \"${pluginpath}\"" 19 | ] 20 | text; 21 | 22 | scrollback-editor = pkgs.writeShellScriptBin "zellij-scrollback-editor" '' 23 | #!/bin/bash 24 | nvim --clean -c "set clipboard=unnamedplus" -c "highlight Normal guibg=NONE ctermbg=NONE" "$@" 25 | ''; 26 | in { 27 | programs.zellij.enable = true; 28 | modules.desktop.conf.zellij = { 29 | content = 30 | replacer "zellij-session-nav" 31 | (replacer "zellij-sessionizer" 32 | (builtins.readFile ./conf/config.kdl)); 33 | layoutContent = builtins.readFile ./conf/layout.kdl; 34 | }; 35 | 36 | home.shellAliases = shellAliases; 37 | home.sessionVariables = { 38 | ZELLIJ_SWITCH_PATH = "${mypkgs.zellij-switch}/bin/zellij-switch.wasm"; 39 | FZF_DEFAULT_OPTS = "--color bg:-1,bg+:-1,fg:#CCCCCC,fg+:#CCCCCC,header:#A0A0A0,hl:#A0A0A0,hl+:#A0A0A0,info:#FFCFA8,marker:#FFCFA8,pointer:#FFCFA8,prompt:#FFCFA8,spinner:#FFCFA8 40 | "; 41 | }; 42 | 43 | home.packages = with pkgs; [ 44 | scrollback-editor 45 | ]; 46 | 47 | modules.desktop.nupkgs.packages = with mypkgs; [ 48 | zellij-switch 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /modules/home/linux/base/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/linux/base/scripts/default.nix: -------------------------------------------------------------------------------- 1 | {unix-scripts, ...}: { 2 | home.file.".local/bin" = { 3 | source = "${unix-scripts}"; 4 | recursive = true; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /modules/home/linux/base/shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | myvars, 4 | ... 5 | }: let 6 | d = config.xdg.dataHome; 7 | c = config.xdg.configHome; 8 | cache = config.xdg.cacheHome; 9 | in rec { 10 | home.homeDirectory = "/home/${myvars.username}"; 11 | 12 | home.sessionVariables = { 13 | LESSHISTFILE = cache + "/less/history"; 14 | LESSKEY = c + "/less/lesskey"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/home/linux/base/tools.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = with pkgs; [ 3 | udiskie 4 | libnotify 5 | inotify-tools 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /modules/home/linux/core.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ../base/core 4 | ../base/home.nix 5 | 6 | ./base 7 | ]; 8 | } 9 | -------------------------------------------------------------------------------- /modules/home/linux/gui.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ../base/core 4 | ../base/tui 5 | ../base/gui 6 | ../base/home.nix 7 | 8 | ./base 9 | ./gui 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/browser.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | vars, 5 | ... 6 | }: { 7 | programs.chromium = { 8 | enable = true; 9 | package = pkgs.brave; 10 | commandLineArgs = [ 11 | "--disable-features=WebRtcAllowInputVolumeAdjustment" 12 | "--enable-features=WebUIDarkMode" 13 | "--force-dark-mode" 14 | ]; 15 | dictionaries = [pkgs.hunspellDictsChromium.en_US]; 16 | extensions = [ 17 | {id = "ajopnjidmegmdimjlfnijceegpefgped";} # bttv 18 | {id = "ammjkodgmmoknidbanneddgankgfejfh";} # 7tv 19 | {id = "fmkadmapgofadopljbjfkapdkoienihi";} # react devtools 20 | {id = "pobhoodpcipjmedfenaigbeloiidbflp";} # twitter minimal 21 | {id = "liecbddmkiiihnedobmlmillhodjkdmb";} # loom 22 | {id = "nkbihfbeogaeaoehlefnkodbefgpgknn";} # metamask 23 | {id = "dpjamkmjmigaoobjbekmfgabipmfilij";} # new tab 24 | ]; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/games.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: { 7 | home.packages = with pkgs; [ 8 | prismlauncher 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/gtk.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | ... 5 | }: { 6 | home.pointerCursor = { 7 | gtk.enable = true; 8 | x11.enable = true; 9 | name = "Quintom_Snow"; 10 | package = pkgs.quintom-cursor-theme; 11 | size = 24; 12 | }; 13 | 14 | xresources.properties = { 15 | "Xft.dpi" = 96; 16 | "*.dpi" = 96; 17 | }; 18 | 19 | gtk = { 20 | enable = true; 21 | 22 | font = { 23 | name = "Inter"; 24 | package = pkgs.inter; 25 | size = 12; 26 | }; 27 | 28 | gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; 29 | gtk3.extraConfig = { 30 | gtk-application-prefer-dark-theme = true; 31 | gtk-decoration-layout = ""; 32 | }; 33 | gtk4.extraConfig = { 34 | gtk-application-prefer-dark-theme = true; 35 | gtk-decoration-layout = ""; 36 | }; 37 | }; 38 | 39 | home.sessionVariables = { 40 | GTK_THEME = "${config.gtk.theme.name}:dark"; 41 | }; 42 | 43 | dconf.settings."org/gnome/desktop/interface" = { 44 | color-scheme = "prefer-dark"; 45 | gtk-theme = config.gtk.theme.name; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/media.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | pkgs-unstable, 4 | ... 5 | }: { 6 | home.packages = with pkgs; [ 7 | pavucontrol 8 | playerctl 9 | pulsemixer 10 | nvtopPackages.full 11 | cava 12 | libva-utils 13 | vdpauinfo 14 | vulkan-tools 15 | glxinfo 16 | ]; 17 | 18 | services = { 19 | playerctld.enable = true; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/misc.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | pkgs-unstable, 5 | ... 6 | }: { 7 | home.packages = with pkgs; 8 | [ 9 | pcmanfm 10 | ] 11 | ++ pkgs.lib.optionals config.modules.desktop.sway.enable [ 12 | grim 13 | ] 14 | ++ pkgs.lib.optionals (config.modules.desktop.sway.enable) [ 15 | (flameshot.overrideAttrs (oldAttrs: { 16 | src = pkgs.fetchFromGitHub { 17 | owner = "flameshot-org"; 18 | repo = "flameshot"; 19 | rev = "3d21e4967b68e9ce80fb2238857aa1bf12c7b905"; 20 | sha256 = "sha256-OLRtF/yjHDN+sIbgilBZ6sBZ3FO6K533kFC1L2peugc="; 21 | }; 22 | cmakeFlags = [ 23 | "-DUSE_WAYLAND_CLIPBOARD=1" 24 | "-DUSE_WAYLAND_GRIM=1" 25 | ]; 26 | buildInputs = oldAttrs.buildInputs ++ [pkgs.libsForQt5.kguiaddons]; 27 | })) 28 | ] 29 | ++ pkgs.lib.optionals config.modules.desktop.i3.enable [ 30 | flameshot 31 | ]; 32 | 33 | fonts.fontconfig.enable = false; 34 | } 35 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/mpv/conf/autosave.lua: -------------------------------------------------------------------------------- 1 | -- autosave.lua script 2 | 3 | -- Fork from: https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef 4 | local options = require("mp.options") 5 | 6 | local o = { 7 | save_period = 60, 8 | } 9 | 10 | options.read_options(o) 11 | 12 | local mp = require("mp") 13 | 14 | local function save() 15 | local filename = mp.get_property("filename") 16 | 17 | -- Just save if there is a filename and it doesn't finish with .mp3 18 | if filename and not filename:match(".mp3$") then 19 | mp.commandv("set", "msg-level", "cplayer=warn") 20 | mp.command("write-watch-later-config") 21 | mp.commandv("set", "msg-level", "cplayer=status") 22 | end 23 | end 24 | 25 | local save_period_timer = mp.add_periodic_timer(o.save_period, save) 26 | 27 | local function pause(_, paused) 28 | save() 29 | if paused then 30 | save_period_timer:stop() 31 | else 32 | save_period_timer:resume() 33 | end 34 | end 35 | 36 | mp.observe_property("pause", "bool", pause) 37 | mp.register_event("file-loaded", save) 38 | 39 | local function end_file(data) 40 | if data.reason == "eof" or data.reason == "stop" then 41 | local playlist = mp.get_property_native("playlist") 42 | for _, entry in pairs(playlist) do 43 | if entry.id == data.playlist_entry_id then 44 | mp.commandv("delete-watch-later-config", entry.filename) 45 | return 46 | end 47 | end 48 | end 49 | end 50 | 51 | mp.register_event("end-file", end_file) 52 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/mpv/conf/notify-send.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | local utils = require("mp.utils") 3 | 4 | local cover_filenames = { 5 | "cover.png", 6 | "cover.jpg", 7 | "cover.jpeg", 8 | "folder.jpg", 9 | "folder.png", 10 | "folder.jpeg", 11 | "AlbumArtwork.png", 12 | "AlbumArtwork.jpg", 13 | "AlbumArtwork.jpeg", 14 | } 15 | 16 | local function notify(summary, body, options) 17 | local option_args = {} 18 | for key, value in pairs(options or {}) do 19 | table.insert(option_args, string.format("--%s=%s", key, value)) 20 | end 21 | return mp.command_native({ 22 | "run", 23 | "notify-send", 24 | ---@diagnostic disable-next-line: deprecated 25 | unpack(option_args), 26 | summary, 27 | body, 28 | }) 29 | end 30 | 31 | local function escape_pango_markup(str) 32 | return string.gsub(str, "([\"'<>&])", function(char) 33 | return string.format("&#%d;", string.byte(char)) 34 | end) 35 | end 36 | 37 | local function notify_media(title, origin, thumbnail) 38 | return notify(escape_pango_markup(title), origin, { 39 | -- For some inscrutable reason, GNOME 3.24.2 40 | -- nondeterministically fails to pick up the notification icon 41 | -- if either of these two parameters are present. 42 | -- 43 | -- urgency = "low", 44 | -- ["app-name"] = "mpv", 45 | 46 | -- ...and this one makes notifications nondeterministically 47 | -- fail to appear altogether. 48 | -- 49 | -- hint = "string:desktop-entry:mpv", 50 | 51 | icon = thumbnail or "mpv", 52 | }) 53 | end 54 | 55 | local function file_exists(path) 56 | local info, _ = utils.file_info(path) 57 | return info ~= nil 58 | end 59 | 60 | local function find_cover(dir) 61 | -- make dir an absolute path 62 | if dir[1] ~= "/" then 63 | dir = utils.join_path(utils.getcwd(), dir) 64 | end 65 | 66 | for _, file in ipairs(cover_filenames) do 67 | local path = utils.join_path(dir, file) 68 | if file_exists(path) then 69 | return path 70 | end 71 | end 72 | 73 | return nil 74 | end 75 | 76 | function notify_current_media() 77 | local path = mp.get_property_native("path") 78 | 79 | local dir, file = utils.split_path(path) 80 | 81 | -- TODO: handle embedded covers and videos? 82 | -- potential options: mpv's take_screenshot, ffprobe/ffmpeg, ... 83 | -- hooking off existing desktop thumbnails would be good too 84 | local thumbnail = find_cover(dir) 85 | 86 | local title = file 87 | local origin = dir 88 | 89 | local metadata = mp.get_property_native("metadata") 90 | if metadata then 91 | local function tag(name) 92 | return metadata[string.upper(name)] or metadata[name] 93 | end 94 | 95 | title = tag("title") or title 96 | origin = tag("artist_credit") or tag("artist") or "" 97 | 98 | local album = tag("album") 99 | if album then 100 | origin = string.format("%s — %s", origin, album) 101 | end 102 | 103 | local year = tag("original_year") or tag("year") 104 | if year then 105 | origin = string.format("%s (%s)", origin, year) 106 | end 107 | end 108 | 109 | return notify_media(title, origin, thumbnail) 110 | end 111 | 112 | mp.register_event("file-loaded", notify_current_media) 113 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/mpv/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs = { 3 | mpv = { 4 | enable = true; 5 | defaultProfiles = ["gpu-hq"]; 6 | scripts = map (path: 7 | pkgs.stdenv.mkDerivation { 8 | pname = "mpv-${builtins.baseNameOf path}"; 9 | version = "1.0"; 10 | src = ./conf; 11 | installPhase = '' 12 | mkdir -p $out/share/mpv/scripts 13 | cp ${builtins.baseNameOf path} $out/share/mpv/scripts/ 14 | ''; 15 | passthru.scriptName = builtins.baseNameOf path; 16 | }) [./conf/autosave.lua ./conf/notify-send.lua]; 17 | }; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /modules/home/linux/gui/base/xdg.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: { 6 | home.packages = with pkgs; [ 7 | xdg-utils 8 | xdg-user-dirs 9 | ]; 10 | 11 | xdg.configFile."mimeapps.list".force = true; 12 | xdg = { 13 | enable = true; 14 | 15 | cacheHome = "${config.home.homeDirectory}/.cache"; 16 | configHome = "${config.home.homeDirectory}/.config"; 17 | dataHome = "${config.home.homeDirectory}/.local/share"; 18 | stateHome = "${config.home.homeDirectory}/.local/state"; 19 | 20 | mimeApps = { 21 | enable = true; 22 | defaultApplications = let 23 | browser = ["chromium.desktop"]; 24 | editor = ["nvim.desktop"]; 25 | in { 26 | "application/json" = browser; 27 | "application/pdf" = browser; 28 | 29 | "text/html" = browser; 30 | "text/xml" = browser; 31 | "text/plain" = editor; 32 | "application/xml" = browser; 33 | "application/xhtml+xml" = browser; 34 | "application/xhtml_xml" = browser; 35 | "application/rdf+xml" = browser; 36 | "application/rss+xml" = browser; 37 | "application/x-extension-htm" = browser; 38 | "application/x-extension-html" = browser; 39 | "application/x-extension-shtml" = browser; 40 | "application/x-extension-xht" = browser; 41 | "application/x-extension-xhtml" = browser; 42 | "application/x-wine-extension-ini" = editor; 43 | 44 | "x-scheme-handler/about" = browser; 45 | "x-scheme-handler/ftp" = browser; 46 | "x-scheme-handler/http" = browser; 47 | "x-scheme-handler/https" = browser; 48 | 49 | "x-scheme-handler/tg" = ["org.telegram.desktop.desktop "]; 50 | 51 | "audio/*" = ["mpv.desktop"]; 52 | "video/*" = ["mpv.desktop"]; 53 | "image/*" = ["imv-dir.desktop"]; 54 | "image/gif" = ["imv-dir.desktop"]; 55 | "image/jpeg" = ["imv-dir.desktop"]; 56 | "image/png" = ["imv-dir.desktop"]; 57 | "image/webp" = ["imv-dir.desktop"]; 58 | }; 59 | 60 | associations.removed = {}; 61 | }; 62 | 63 | userDirs = { 64 | enable = true; 65 | createDirectories = true; 66 | download = "${config.home.homeDirectory}/downloads"; 67 | documents = "${config.home.homeDirectory}/documents"; 68 | desktop = "${config.home.homeDirectory}/system/desktop"; 69 | publicShare = "${config.home.homeDirectory}/system/public"; 70 | templates = "${config.home.homeDirectory}/system/templates"; 71 | music = "${config.home.homeDirectory}/media/music"; 72 | pictures = "${config.home.homeDirectory}/media/photos"; 73 | videos = "${config.home.homeDirectory}/media/videos"; 74 | extraConfig = { 75 | XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/screenshots"; 76 | }; 77 | }; 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /modules/home/linux/gui/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3-x-sway/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | mypkgs, 5 | lib, 6 | ... 7 | }: { 8 | options.dtsf-pc.i3-x-sway = { 9 | enable = lib.mkEnableOption "i3 and sway configuration"; 10 | }; 11 | 12 | config = lib.mkIf config.dtsf-pc.i3-x-sway.enable ( 13 | let 14 | generate = wm: let 15 | mod = "Mod4"; 16 | alt = "Mod1"; 17 | msgCmd = 18 | if wm == "sway" 19 | then "swaymsg" 20 | else "i3-msg"; 21 | keymaps = import ./keymaps.nix {inherit mod alt pkgs mypkgs lib config;}; 22 | 23 | buildMetaMode = monitors: 24 | lib.concatStringsSep ", " (map ( 25 | m: let 26 | name = m.name; 27 | mode = "${m.resolution}_${toString m.refreshRate}"; 28 | pos = "+${toString m.nvidiaSettings.coordinate.x}+${toString m.nvidiaSettings.coordinate.y}"; 29 | flags = [ 30 | ( 31 | if m.nvidiaSettings.rotation != null 32 | then "rotation=${m.nvidiaSettings.rotation}" 33 | else null 34 | ) 35 | ( 36 | if m.nvidiaSettings.forceFullCompositionPipeline 37 | then "ForceFullCompositionPipeline=On" 38 | else null 39 | ) 40 | ]; 41 | filteredFlags = builtins.filter (x: x != null) flags; 42 | flagString = 43 | if builtins.length filteredFlags > 0 44 | then " {${lib.concatStringsSep ", " filteredFlags}}" 45 | else ""; 46 | in "${name}: ${mode} ${pos}${flagString}" 47 | ) 48 | monitors); 49 | 50 | command = str: always: { 51 | command = str; 52 | always = always; 53 | }; 54 | in { 55 | settings = lib.mkMerge [ 56 | { 57 | modifier = mod; 58 | focus.followMouse = false; 59 | keybindings = keymaps.allBindings; 60 | 61 | startup = [ 62 | (lib.mkIf (config.modules.shared.multi-monitors.enableNvidiaSupport) ( 63 | command "nvidia-settings --assign CurrentMetaMode=\"${buildMetaMode config.modules.shared.multi-monitors.monitors}\"" false 64 | )) 65 | (command "udiskie --tray --notify" false) 66 | (command "${msgCmd} 'workspace 1'" false) 67 | (command "dunst -config ${config.home.homeDirectory}/.config/dunstrc" false) 68 | (command "flameshot & disown" false) 69 | (lib.mkIf (wm == "sway") (command "systemctl --user start wallpaper.service" false)) 70 | ]; 71 | 72 | modes = { 73 | resize = { 74 | h = "resize shrink width 10 px or 10 ppt"; 75 | j = "resize grow height 10 px or 10 ppt"; 76 | k = "resize shrink height 10 px or 10 ppt"; 77 | l = "resize grow width 10 px or 10 ppt"; 78 | 79 | Left = "resize shrink width 10 px or 10 ppt"; 80 | Down = "resize grow height 10 px or 10 ppt"; 81 | Up = "resize shrink height 10 px or 10 ppt"; 82 | Right = "resize grow width 10 px or 10 ppt"; 83 | 84 | Return = "mode default"; 85 | Escape = "mode default"; 86 | "${mod}+r" = "mode default"; 87 | }; 88 | }; 89 | 90 | workspaceOutputAssign = 91 | (map (i: { 92 | workspace = "${toString i}"; 93 | output = "DP-0"; 94 | }) (lib.range 1 7)) 95 | ++ (map (i: { 96 | workspace = "${toString i}"; 97 | output = "HDMI-0"; 98 | }) (lib.range 8 10)); 99 | 100 | fonts = { 101 | names = ["JetBrainsMono Nerd Font"]; 102 | style = "Regular"; 103 | size = 8.0; 104 | }; 105 | 106 | window.titlebar = true; 107 | window.commands = [ 108 | { 109 | command = "floating enable, sticky enable"; 110 | criteria = {title = "^win";}; 111 | } 112 | ]; 113 | } 114 | 115 | (lib.mkIf (wm == "sway") { 116 | input = { 117 | "1133:16500:Logitech_G305" = { 118 | accel_profile = "flat"; 119 | pointer_accel = "0"; 120 | }; 121 | 122 | "type:keyboard" = { 123 | xkb_layout = "us"; 124 | xkb_variant = "altgr-intl"; 125 | xkb_options = "compose:menu,level3:ralt_switch,grp:win_space_toggle"; 126 | }; 127 | }; 128 | }) 129 | ]; 130 | }; 131 | in { 132 | modules.desktop = { 133 | sway = generate "sway"; 134 | i3 = generate "i3"; 135 | }; 136 | 137 | modules.desktop.nupkgs.packages = with mypkgs; 138 | lib.mkIf (config.modules.desktop.sway.enable) [ 139 | astal 140 | ]; 141 | 142 | programs.i3status = lib.mkIf (config.modules.desktop.i3.enable) { 143 | enable = true; 144 | enableDefault = false; 145 | modules = { 146 | "volume master" = { 147 | position = 1; 148 | settings = { 149 | format = "%volume"; 150 | format_muted = "muted (%volume)"; 151 | mixer = "Master"; 152 | mixer_idx = 0; 153 | device = "default"; 154 | }; 155 | }; 156 | "disk /" = { 157 | position = 2; 158 | settings = { 159 | format = "/ %avail"; 160 | }; 161 | }; 162 | "ethernet _first_" = { 163 | position = 3; 164 | settings = { 165 | format_up = "E: %ip (%speed)"; 166 | format_down = "E: down"; 167 | }; 168 | }; 169 | "load" = { 170 | position = 4; 171 | settings = { 172 | format = "%1min"; 173 | }; 174 | }; 175 | "battery 0" = { 176 | position = 5; 177 | settings = { 178 | format = "%status %percentage"; 179 | format_down = "no batt."; 180 | status_chr = "+ --"; 181 | status_bat = "-"; 182 | status_unk = "unk"; 183 | status_full = "! --"; 184 | low_threshold = 10; 185 | threshold_type = "percentage"; 186 | last_full_capacity = false; 187 | hide_seconds = true; 188 | path = "/sys/class/power_supply/BAT1/uevent"; 189 | }; 190 | }; 191 | "time" = { 192 | position = 6; 193 | settings = { 194 | format = "%Y-%m-%d %H:%M:%S"; 195 | }; 196 | }; 197 | }; 198 | }; 199 | } 200 | ); 201 | } 202 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3-x-sway/keymaps.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | mod, 4 | alt, 5 | pkgs, 6 | mypkgs, 7 | lib, 8 | ... 9 | }: let 10 | mod = "Mod4"; 11 | alt = "Mod1"; 12 | print = "Print"; 13 | msgCmd = 14 | if config.modules.desktop.sway.enable 15 | then "swaymsg" 16 | else "i3-msg"; 17 | 18 | exit = "-B 'leave' 'exec ${msgCmd} exit && exec loginctl terminate-user $USER'"; 19 | turnoff = "-B 'shutdown' 'exec systemctl poweroff'"; 20 | reboot = "-B 'reboot' 'exec systemctl reboot'"; 21 | 22 | nag = 23 | if config.modules.desktop.sway.enable 24 | then "swaynag" 25 | else "i3-nagbar"; 26 | 27 | workspaceBindings = builtins.listToAttrs ( 28 | (map (i: { 29 | name = "${mod}+${toString i}"; 30 | value = "workspace ${toString i}"; 31 | }) (lib.range 1 9)) 32 | ++ (map (i: { 33 | name = "${mod}+Shift+${toString i}"; 34 | value = "move container to workspace ${toString i}"; 35 | }) (lib.range 1 9)) 36 | ++ [ 37 | { 38 | name = "${mod}+0"; 39 | value = "workspace 10"; 40 | } 41 | { 42 | name = "${mod}+Shift+0"; 43 | value = "move container to workspace 10"; 44 | } 45 | ] 46 | ); 47 | staticBindings = { 48 | "${mod}+q" = "kill"; 49 | "${mod}+t" = "exec ${mypkgs.ghostty}/bin/ghostty"; 50 | "${mod}+Return" = "exec ${mypkgs.ghostty}/bin/ghostty -e ${pkgs.zellij}/bin/zellij attach dtsf -c"; 51 | "${mod}+a" = "exec brave"; 52 | "${mod}+d" = "exec ${config.home.homeDirectory}/.local/bin/launcher"; 53 | "${mod}+Shift+m" = "exec shimeji"; 54 | 55 | "${alt}+k" = "exec ${config.home.homeDirectory}/.local/bin/switch-kb-variant"; 56 | "${alt}+i" = "exec ${config.home.homeDirectory}/.local/bin/switch-kb-variant intl"; 57 | 58 | "${print}" = "exec flameshot gui"; 59 | 60 | "${mod}+h" = "focus left"; 61 | "${mod}+j" = "focus down"; 62 | "${mod}+k" = "focus up"; 63 | "${mod}+l" = "focus right"; 64 | 65 | "${mod}+Shift+h" = "move left"; 66 | "${mod}+Shift+j" = "move down"; 67 | "${mod}+Shift+k" = "move up"; 68 | "${mod}+Shift+l" = "move right"; 69 | 70 | "${mod}+comma" = "focus parent"; 71 | "${mod}+period" = "focus child"; 72 | 73 | "${alt}+h" = "split h"; 74 | "${alt}+l" = "split v"; 75 | "${mod}+f" = "fullscreen toggle"; 76 | "${mod}+space" = "floating toggle"; 77 | "${mod}+s" = "layout stacking"; 78 | "${mod}+w" = "layout tabbed"; 79 | "${mod}+e" = "layout toggle split"; 80 | "${mod}+r" = "mode resize"; 81 | 82 | "${mod}+Shift+c" = "reload"; 83 | "${mod}+Shift+e" = "exec \"${nag} -t warning -m 'leave, shutdown or reboot?' ${turnoff} ${reboot} ${exit}\""; 84 | 85 | "XF86MonBrightnessUp" = "exec --no-startup-id brightnessctl set +5%"; 86 | "XF86MonBrightnessDown" = "exec --no-startup-id brightnessctl set 5%-"; 87 | }; 88 | in { 89 | allBindings = staticBindings // workspaceBindings; 90 | } 91 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | anyrun, 6 | ... 7 | } @ args: 8 | with lib; let 9 | cfg = config.modules.desktop.i3; 10 | in { 11 | options.modules.desktop.i3 = { 12 | enable = mkEnableOption "i3 wm"; 13 | settings = lib.mkOption { 14 | type = with lib.types; let 15 | valueType = 16 | nullOr (oneOf [ 17 | bool 18 | int 19 | float 20 | str 21 | path 22 | (attrsOf valueType) 23 | (listOf valueType) 24 | ]) 25 | // { 26 | description = "i3 configuration value"; 27 | }; 28 | in 29 | valueType; 30 | default = {}; 31 | }; 32 | }; 33 | 34 | config = mkIf cfg.enable ( 35 | mkMerge ([ 36 | { 37 | xsession.windowManager.i3.config = cfg.settings; 38 | } 39 | ] 40 | ++ (import ./values args)) 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...} @ args: 2 | map 3 | (path: import path args) 4 | (mylib.file.scanPaths ./.) 5 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/i3.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | ... 5 | }: 6 | with lib; let 7 | pkg = pkgs.i3; 8 | in { 9 | xsession.windowManager.i3 = { 10 | enable = true; 11 | package = pkg; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/packages.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = with pkgs; [ 3 | xorg.setxkbmap 4 | xorg.xinit 5 | xorg.xrandr 6 | autorandr 7 | xss-lock 8 | dex 9 | xclip 10 | i3lock-color 11 | networkmanagerapplet 12 | dmenu 13 | dunst 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/picom.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | mylib, 4 | pkgs, 5 | config, 6 | ... 7 | }: { 8 | modules.desktop.conf.picom.settings = { 9 | backend = "glx"; 10 | fade = true; 11 | fade-delta = 2; 12 | inactive-opacity = 1; 13 | opacity-rule = [ 14 | "100:class_g = 'chromium-browser' && name %= '*- YouTube*'" 15 | ]; 16 | shadow = true; 17 | shadow-offset-x = -9; 18 | shadow-offset-y = -9; 19 | shadow-opacity = 0.25; 20 | shadow-radius = 10; 21 | shadow-exclude = [ 22 | "name = 'Notification'" 23 | "class_g ?= 'Notify-osd'" 24 | "class_g ?= 'Polybar'" 25 | "class_g ?= 'Rofi'" 26 | "_GTK_FRAME_EXTENTS" 27 | "name = 'win'" 28 | ]; 29 | 30 | corner-radius = 0; 31 | round-borders = 0; 32 | rounded-corners-exclude = [ 33 | "name = 'Notification'" 34 | "class_g ?= 'Notify-osd'" 35 | "class_g = 'Polybar'" 36 | "class_g = 'Rofi'" 37 | "window_type = 'tooltip'" 38 | "name = 'win'" 39 | ]; 40 | blur-background-exclude = [ 41 | "name = 'win'" 42 | ]; 43 | focus-exclude = [ 44 | "name = 'win'" 45 | ]; 46 | }; 47 | 48 | xsession.windowManager.i3.config = { 49 | startup = [ 50 | { 51 | command = "DISPLAY=:0 ${pkgs.picom}/bin/picom -f --config ${config.home.homeDirectory}/.config/picom/picom.conf"; 52 | always = true; 53 | } 54 | ]; 55 | }; 56 | 57 | home.packages = with pkgs; [picom]; 58 | } 59 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/xinitrc/conf/mergex-conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | userresources=$HOME/.Xresources 4 | usermodmap=$HOME/.Xmodmap 5 | sysresources=/etc/X11/xinit/.Xresources 6 | sysmodmap=/etc/X11/xinit/.Xmodmap 7 | 8 | if [ -f $sysresources ]; then 9 | xrdb -merge $sysresources 10 | fi 11 | 12 | if [ -f $userresources ]; then 13 | xrdb -merge $userresources 14 | fi 15 | 16 | if [ -f $sysmodmap ]; then 17 | xmodmap $sysmodmap 18 | fi 19 | 20 | if [ -f $usermodmap ]; then 21 | xmodmap $usermodmap 22 | fi 23 | 24 | if [ -d /etc/X11/xinit/xinitrc.d ]; then 25 | for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do 26 | [ -x "$f" ] && . "$f" 27 | done 28 | unset f 29 | fi 30 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/xinitrc/conf/services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | restart_service_if_exited() { 4 | local service_name=$1 5 | if systemctl --user is-active --quiet "$service_name" && \ 6 | systemctl --user show "$service_name" -p SubState | grep -q "SubState=exited"; then 7 | echo "restarting $service_name..." 8 | systemctl --user restart "$service_name" 9 | else 10 | echo "$service_name is not in 'active (exited)' state, skipping restart." 11 | fi 12 | } 13 | 14 | ( 15 | restart_service_if_exited "wallpaper.service" 16 | restart_service_if_exited "link-wallpaper.service" 17 | ) & 18 | -------------------------------------------------------------------------------- /modules/home/linux/gui/i3/values/xinitrc/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | ... 5 | }: 6 | with lib; { 7 | home.file.".xinitrc".text = '' 8 | ${fileContents ./conf/mergex-conf.sh} 9 | 10 | ${fileContents ./conf/services.sh} 11 | 12 | systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS XDG_CURRENT_DESKTOP XDG_SESSION_TYPE WAYLAND_DISPLAY & 13 | exec ${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name left_ptr & 14 | exec ${pkgs.i3}/bin/i3 15 | ''; 16 | } 17 | -------------------------------------------------------------------------------- /modules/home/linux/gui/misc.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | services.easyeffects.enable = true; 3 | } 4 | -------------------------------------------------------------------------------- /modules/home/linux/gui/niri/conf/niri.kdl: -------------------------------------------------------------------------------- 1 | input { 2 | keyboard { 3 | xkb { 4 | layout "us,us" 5 | variant "altgr-intl,intl" 6 | options "compose:menu,level3:ralt_switch,grp:win_space_toggle" 7 | } 8 | 9 | track-layout "global" 10 | } 11 | 12 | touch { 13 | map-to-output "eDP-1" 14 | } 15 | 16 | touchpad { 17 | tap 18 | natural-scroll 19 | } 20 | 21 | mouse { 22 | accel-profile "flat" 23 | accel-speed 0.0 24 | } 25 | } 26 | 27 | hotkey-overlay { 28 | skip-at-startup 29 | } 30 | 31 | screenshot-path "~/media/photos/screenshots/screenshot from %Y-%m-%d %H-%M-%S.png" 32 | animations { 33 | slowdown 0.5 34 | 35 | workspace-switch { 36 | spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 37 | } 38 | 39 | window-open { 40 | duration-ms 150 41 | curve "ease-out-expo" 42 | } 43 | 44 | window-close { 45 | duration-ms 150 46 | curve "ease-out-quad" 47 | } 48 | 49 | horizontal-view-movement { 50 | spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 51 | } 52 | 53 | window-movement { 54 | spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 55 | } 56 | 57 | window-resize { 58 | spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 59 | } 60 | 61 | screenshot-ui-open { 62 | duration-ms 200 63 | curve "ease-out-quad" 64 | } 65 | } 66 | 67 | window-rule { 68 | geometry-corner-radius 6 69 | clip-to-geometry true 70 | } 71 | 72 | binds { 73 | Mod+D { spawn "fuzzel"; } 74 | Super+Alt+L { spawn "swaylock"; } 75 | 76 | XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; } 77 | XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; } 78 | XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } 79 | XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; } 80 | XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "-c" "backlight" "set" "30-"; } 81 | XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "-c" "backlight" "set" "+30"; } 82 | 83 | Mod+1 { focus-workspace 1; } 84 | Mod+2 { focus-workspace 2; } 85 | Mod+3 { focus-workspace 3; } 86 | Mod+4 { focus-workspace 4; } 87 | Mod+5 { focus-workspace 5; } 88 | Mod+6 { focus-workspace 6; } 89 | Mod+7 { focus-workspace 7; } 90 | Mod+8 { focus-workspace 8; } 91 | Mod+9 { focus-workspace 9; } 92 | Mod+Shift+1 { move-column-to-workspace 1; } 93 | Mod+Shift+2 { move-column-to-workspace 2; } 94 | Mod+Shift+3 { move-column-to-workspace 3; } 95 | Mod+Shift+4 { move-column-to-workspace 4; } 96 | Mod+Shift+5 { move-column-to-workspace 5; } 97 | Mod+Shift+6 { move-column-to-workspace 6; } 98 | Mod+Shift+7 { move-column-to-workspace 7; } 99 | Mod+Shift+8 { move-column-to-workspace 8; } 100 | Mod+Shift+9 { move-column-to-workspace 9; } 101 | 102 | Print { screenshot; } 103 | 104 | Mod+Shift+H { move-column-left; } 105 | Mod+Shift+J { consume-or-expel-window-left; } 106 | Mod+Shift+K { consume-or-expel-window-right; } 107 | Mod+Shift+L { move-column-right; } 108 | 109 | Mod+Shift+Comma { set-column-width "-10%"; } 110 | Mod+Shift+Period { set-column-width "+10%"; } 111 | Mod+Ctrl+Comma { set-window-height "-10%"; } 112 | Mod+Ctrl+Period { set-window-height "+10%"; } 113 | 114 | Mod+Left { focus-column-first; } 115 | Mod+Right { focus-column-last; } 116 | Mod+Shift+Left { move-column-to-first; } 117 | Mod+Shift+Right { move-column-to-last; } 118 | 119 | Mod+H { focus-column-left; } 120 | Mod+J { focus-window-down; } 121 | Mod+K { focus-window-up; } 122 | Mod+L { focus-column-right; } 123 | 124 | Mod+N { focus-monitor-right; } 125 | Mod+P { focus-monitor-left; } 126 | Mod+Shift+N { move-column-to-monitor-right; } 127 | Mod+Shift+P { move-column-to-monitor-left; } 128 | 129 | Mod+Shift+F { toggle-window-floating; } 130 | Mod+S { switch-focus-between-floating-and-tiling; } 131 | Mod+F { maximize-column; } 132 | Mod+E { center-column; } 133 | Mod+Q { close-window; } 134 | Mod+Shift+E repeat=false { spawn "sh" "-c" "~/.local/bin/powermenu-gtk"; } 135 | 136 | Alt+W { spawn "sh" "-c" "~/.local/bin/switch-kb-variant"; } 137 | Alt+Shift+W { spawn "sh" "-c" "~/.local/bin/switch-kb-variant intl"; } 138 | 139 | Mod+Return repeat=false { spawn "sh" "-c" "ghostty -e zellij attach dtsf -c"; } 140 | Mod+Shift+Return repeat=false { spawn "ghostty"; } 141 | Mod+A repeat=false { spawn "brave"; } 142 | Mod+Shift+M repeat=false { spawn "shimeji"; } 143 | } 144 | -------------------------------------------------------------------------------- /modules/home/linux/gui/niri/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | mypkgs, 4 | config, 5 | lib, 6 | ... 7 | } @ args: let 8 | generateConfig = config: 9 | builtins.concatStringsSep "\n" config.modules.desktop.niri.rawConfigValues; 10 | packages = import ./packages.nix args; 11 | in { 12 | imports = [ 13 | ./packages.nix 14 | ]; 15 | 16 | options.modules.desktop.niri = { 17 | enable = lib.mkEnableOption "Niri configuration"; 18 | 19 | rawConfigValues = lib.mkOption { 20 | type = lib.types.listOf lib.types.lines; 21 | default = []; 22 | description = "List of raw Niri configuration snippets"; 23 | }; 24 | }; 25 | 26 | config = lib.mkIf config.modules.desktop.niri.enable { 27 | modules.desktop.niri.rawConfigValues = [ 28 | ''spawn-at-startup "${mypkgs.astal}/bin/astal"'' 29 | ''spawn-at-startup "sh" "-c" "udiskie --tray --notify"'' 30 | ''spawn-at-startup "sh" "-c" "systemctl --user restart wallpaper.service"'' 31 | ''spawn-at-startup "sh" "-c" "${pkgs.dunst}/bin/dunst --config ${config.home.homeDirectory}/.config/dunstrc"'' 32 | ''spawn-at-startup "sh" "-c" "nm-applet"'' 33 | 34 | (lib.concatStringsSep "\n" (map (m: '' 35 | output "${m.name}" { 36 | mode "${m.resolution}@${toString m.refreshRate}" 37 | scale ${m.scale} 38 | ${( 39 | if m.focus 40 | then "focus-at-startup" 41 | else "" 42 | )} 43 | transform "${( 44 | if m.nvidiaSettings.rotation == "left" 45 | then "90" 46 | else m.nvidiaSettings.rotation 47 | )}" 48 | position x=${toString m.nvidiaSettings.coordinate.x} y=${toString m.nvidiaSettings.coordinate.y} 49 | } 50 | '') 51 | config.modules.shared.multi-monitors.monitors)) 52 | 53 | (lib.fileContents ./conf/niri.kdl) 54 | ]; 55 | 56 | xdg.configFile."niri/config.kdl".text = generateConfig config; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /modules/home/linux/gui/niri/packages.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | mypkgs, 4 | ... 5 | }: { 6 | home.packages = with pkgs; [ 7 | yad 8 | niri 9 | dunst 10 | fuzzel 11 | wl-clipboard 12 | ]; 13 | 14 | modules.desktop.nupkgs.packages = with mypkgs; [ 15 | astal 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /modules/home/linux/gui/sway/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | anyrun, 6 | ... 7 | } @ args: 8 | with lib; let 9 | cfg = config.modules.desktop.sway; 10 | in { 11 | options.modules.desktop.sway = { 12 | enable = mkEnableOption "sway wm"; 13 | settings = lib.mkOption { 14 | type = with lib.types; let 15 | valueType = 16 | nullOr (oneOf [ 17 | bool 18 | int 19 | float 20 | str 21 | path 22 | (attrsOf valueType) 23 | (listOf valueType) 24 | ]) 25 | // { 26 | description = "sway configuration value"; 27 | }; 28 | in 29 | valueType; 30 | default = {}; 31 | }; 32 | }; 33 | 34 | config = mkIf cfg.enable ( 35 | mkMerge ([ 36 | { 37 | wayland.windowManager.sway.config = cfg.settings; 38 | } 39 | ] 40 | ++ (import ./values args)) 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /modules/home/linux/gui/sway/values/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...} @ args: 2 | map 3 | (path: import path args) 4 | (mylib.file.scanPaths ./.) 5 | -------------------------------------------------------------------------------- /modules/home/linux/gui/sway/values/packages.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = with pkgs; [ 3 | dunst 4 | wl-clipboard 5 | libappindicator-gtk3 6 | networkmanagerapplet 7 | wmenu 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /modules/home/linux/gui/sway/values/sway.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs-unstable, 4 | ... 5 | }: 6 | with lib; let 7 | pkg = pkgs-unstable.sway; 8 | in { 9 | wayland.windowManager.sway = { 10 | enable = true; 11 | package = pkg; 12 | extraSessionCommands = '' 13 | export _JAVA_AWT_WM_NONREPARENTING=1 14 | ''; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/home/linux/tui.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ../base/core 4 | ../base/tui 5 | ../base/home.nix 6 | 7 | ./base 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /modules/nixos/base/core.nix: -------------------------------------------------------------------------------- 1 | {lib, ...}: { 2 | boot.loader.systemd-boot = { 3 | configurationLimit = lib.mkDefault 10; 4 | consoleMode = lib.mkDefault "max"; 5 | }; 6 | 7 | boot.loader.timeout = lib.mkDefault 8; 8 | 9 | services = { 10 | power-profiles-daemon = { 11 | enable = true; 12 | }; 13 | upower.enable = true; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /modules/nixos/base/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/nixos/base/i18n.nix: -------------------------------------------------------------------------------- 1 | { 2 | time.timeZone = "America/Belem"; 3 | 4 | i18n = { 5 | defaultLocale = "en_US.UTF-8"; 6 | extraLocaleSettings = { 7 | LC_TIME = "pt_BR.UTF-8"; 8 | LC_MONETARY = "pt_BR.UTF-8"; 9 | LC_MEASUREMENT = "pt_BR.UTF-8"; 10 | LC_PAPER = "pt_BR.UTF-8"; 11 | LC_NAME = "pt_BR.UTF-8"; 12 | LC_ADDRESS = "pt_BR.UTF-8"; 13 | LC_TELEPHONE = "pt_BR.UTF-8"; 14 | LC_NUMERIC = "pt_BR.UTF-8"; 15 | LC_IDENTIFICATION = "pt_BR.UTF-8"; 16 | }; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /modules/nixos/base/nix.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | nixpkgs, 4 | ... 5 | }: { 6 | nixpkgs.config.allowUnfree = lib.mkForce true; 7 | 8 | nix.gc = { 9 | automatic = lib.mkDefault true; 10 | dates = lib.mkDefault "weekly"; 11 | options = lib.mkDefault "--delete-older-than 7d"; 12 | }; 13 | 14 | nix.settings.auto-optimise-store = true; 15 | nix.channel.enable = false; 16 | 17 | programs.command-not-found.enable = false; 18 | } 19 | -------------------------------------------------------------------------------- /modules/nixos/base/packages.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | vars, 5 | ... 6 | }: { 7 | environment.systemPackages = with pkgs; [ 8 | gcc 9 | strace 10 | tcpdump 11 | lsof 12 | sysstat 13 | iotop 14 | iftop 15 | btop 16 | psmisc 17 | lm_sensors 18 | ethtool 19 | pciutils 20 | usbutils 21 | parted 22 | openvpn 23 | ]; 24 | } 25 | -------------------------------------------------------------------------------- /modules/nixos/base/ssh.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | myvars, 4 | ... 5 | }: { 6 | networking.firewall.enable = lib.mkDefault false; 7 | 8 | services.openssh = { 9 | enable = true; 10 | settings = { 11 | X11Forwarding = true; 12 | PermitRootLogin = "prohibit-password"; 13 | PasswordAuthentication = false; 14 | }; 15 | openFirewall = true; 16 | }; 17 | 18 | environment.enableAllTerminfo = true; 19 | } 20 | -------------------------------------------------------------------------------- /modules/nixos/base/usergroup.nix: -------------------------------------------------------------------------------- 1 | { 2 | myvars, 3 | config, 4 | ... 5 | }: { 6 | users.groups = { 7 | "${myvars.username}" = {}; 8 | docker = {}; 9 | uinput = {}; 10 | }; 11 | 12 | users.users."${myvars.username}" = { 13 | home = "/home/${myvars.username}"; 14 | isNormalUser = true; 15 | extraGroups = [ 16 | myvars.username 17 | "users" 18 | "networkmanager" 19 | "wheel" 20 | "docker" 21 | "libvirtd" 22 | "video" 23 | ]; 24 | linger = false; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /modules/nixos/base/zram.nix: -------------------------------------------------------------------------------- 1 | { 2 | zramSwap = { 3 | enable = true; 4 | algorithm = "zstd"; 5 | priority = 5; 6 | memoryPercent = 50; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /modules/nixos/desktop.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | myvars, 6 | ... 7 | }: 8 | with lib; let 9 | cfgWayland = config.modules.desktop.wayland; 10 | cfgXorg = config.modules.desktop.xorg; 11 | 12 | niriSession = pkgs.writeShellScriptBin "custom-niri-session" '' 13 | if systemctl --user -q is-active niri.service; then 14 | echo 'a niri session is already running.' 15 | exit 1 16 | fi 17 | 18 | systemctl --user reset-failed 19 | 20 | if hash dbus-update-activation-environment 2>/dev/null; then 21 | dbus-update-activation-environment --all 22 | fi 23 | 24 | systemctl --user --wait start niri.service 25 | systemctl --user start --job-mode=replace-irreversibly niri-shutdown.target 26 | systemctl --user unset-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP NIRI_SOCKET 27 | ''; 28 | in { 29 | imports = [ 30 | ./base 31 | ../base.nix 32 | 33 | ./desktop 34 | ]; 35 | 36 | options.modules.desktop = { 37 | wayland = { 38 | enable = mkEnableOption "wayland display server"; 39 | }; 40 | xorg = { 41 | enable = mkEnableOption "xorg display server"; 42 | }; 43 | }; 44 | 45 | config = mkMerge [ 46 | (mkIf cfgWayland.enable { 47 | xdg.portal = { 48 | enable = true; 49 | wlr.enable = true; 50 | extraPortals = with pkgs; [ 51 | xdg-desktop-portal-wlr 52 | ]; 53 | }; 54 | environment.sessionVariables.NIXOS_OZONE_WL = "1"; 55 | 56 | services = { 57 | xserver.enable = false; 58 | }; 59 | 60 | programs.sway.wrapperFeatures.gtk = true; 61 | 62 | environment = { 63 | pathsToLink = ["/libexec"]; 64 | loginShellInit = '' 65 | if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then 66 | exec ${niriSession}/bin/custom-niri-session 67 | fi 68 | ''; 69 | }; 70 | }) 71 | 72 | (mkIf cfgXorg.enable { 73 | services = { 74 | gvfs.enable = true; 75 | 76 | libinput = { 77 | enable = true; 78 | mouse = { 79 | accelProfile = "flat"; 80 | accelSpeed = "0"; 81 | }; 82 | }; 83 | 84 | displayManager.defaultSession = "hm-session"; 85 | xserver = { 86 | enable = true; 87 | xkb.layout = "us"; 88 | displayManager.startx.enable = true; 89 | 90 | desktopManager = { 91 | xterm.enable = false; 92 | session = [ 93 | { 94 | name = "hm-session"; 95 | manage = "window"; 96 | start = '' 97 | ${pkgs.runtimeShell} $HOME/.xsession & 98 | waitPID=$! 99 | ''; 100 | } 101 | ]; 102 | }; 103 | }; 104 | }; 105 | 106 | environment = { 107 | pathsToLink = ["/libexec"]; 108 | loginShellInit = '' 109 | if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then 110 | exec startx 111 | fi 112 | ''; 113 | }; 114 | }) 115 | ]; 116 | } 117 | -------------------------------------------------------------------------------- /modules/nixos/desktop/bluetooth.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | ... 6 | }: 7 | with lib; { 8 | options.modules.desktop.bluetooth = { 9 | enable = mkEnableOption "Bluetooth support"; 10 | }; 11 | 12 | config = mkIf config.modules.desktop.bluetooth.enable { 13 | hardware.bluetooth.enable = true; 14 | environment.systemPackages = with pkgs; [blueberry]; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/nixos/desktop/default.nix: -------------------------------------------------------------------------------- 1 | {mylib, ...}: { 2 | imports = mylib.file.scanPaths ./.; 3 | } 4 | -------------------------------------------------------------------------------- /modules/nixos/desktop/fhs.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | environment.systemPackages = [ 3 | ( 4 | let 5 | base = pkgs.appimageTools.defaultFhsEnvArgs; 6 | in 7 | pkgs.buildFHSEnv (base 8 | // { 9 | name = "fhs"; 10 | targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [pkgs.pkg-config]; 11 | profile = "export FHS=1"; 12 | runScript = "bash"; 13 | extraOutputsToInstall = ["dev"]; 14 | }) 15 | ) 16 | ]; 17 | 18 | programs.nix-ld = { 19 | enable = true; 20 | libraries = with pkgs; [ 21 | stdenv.cc.cc 22 | ]; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /modules/nixos/desktop/fonts.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | fonts = { 3 | enableDefaultPackages = false; 4 | fontDir.enable = true; 5 | 6 | packages = with pkgs; [ 7 | inter 8 | noto-fonts-cjk-sans 9 | noto-fonts-emoji 10 | nerd-fonts.jetbrains-mono 11 | ]; 12 | 13 | fontconfig.defaultFonts = { 14 | serif = ["Inter"]; 15 | sansSerif = ["Inter"]; 16 | monospace = ["JetBrainsMono Nerd Font" "Noto Color Emoji"]; 17 | emoji = ["Noto Color Emoji"]; 18 | }; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /modules/nixos/desktop/games.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.steam.enable = false; 3 | } 4 | -------------------------------------------------------------------------------- /modules/nixos/desktop/gc.nix: -------------------------------------------------------------------------------- 1 | { 2 | myvars, 3 | pkgs, 4 | lib, 5 | ... 6 | }: let 7 | homeDir = "/home/${myvars.username}"; 8 | configFile = "/etc/gc-paths.conf"; 9 | in { 10 | systemd.services.path-garbage-collector = { 11 | description = "Clean up old files from specified paths"; 12 | path = [pkgs.findutils pkgs.coreutils]; 13 | serviceConfig = { 14 | KillMode = "mixed"; 15 | Type = "oneshot"; 16 | ExecStart = pkgs.writeShellScript "cleanup-paths" '' 17 | while IFS=, read -r path age; do 18 | if [ -d "$path" ]; then 19 | find "$path" -type f -mtime +"''${age%d}" -delete 2>/dev/null 20 | fi 21 | done < ${configFile} 22 | 23 | find "${homeDir}" -type d \( -name ".trash" -o -name ".Trash" -o -name ".Trash-1000" -o -name "Trash" \) -prune -exec rm -rf {} + 2>/dev/null || true 24 | ''; 25 | }; 26 | }; 27 | 28 | systemd.timers.path-garbage-collector = { 29 | description = "Timer for path garbage collector"; 30 | wantedBy = ["timers.target"]; 31 | timerConfig = { 32 | OnCalendar = "daily"; 33 | Persistent = true; 34 | RandomizedDelaySec = "1h"; 35 | RuntimeMaxSec = 30; 36 | }; 37 | }; 38 | 39 | environment.etc."gc-paths.conf".text = '' 40 | ${homeDir}/.local/share/nvim/backup,7d 41 | ''; 42 | } 43 | -------------------------------------------------------------------------------- /modules/nixos/desktop/graphics.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | xdg.portal = { 3 | enable = true; 4 | 5 | config = { 6 | common = { 7 | default = [ 8 | "gtk" 9 | ]; 10 | }; 11 | }; 12 | 13 | xdgOpenUsePortal = true; 14 | extraPortals = with pkgs; [ 15 | xdg-desktop-portal-gtk 16 | ]; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /modules/nixos/desktop/misc.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | pkgs-unstable, 6 | myvars, 7 | ... 8 | }: { 9 | environment.shells = with pkgs; [ 10 | bashInteractive 11 | ]; 12 | 13 | users.defaultUserShell = pkgs.bashInteractive; 14 | security.sudo.keepTerminfo = true; 15 | 16 | environment.variables = { 17 | TZ = "${config.time.timeZone}"; 18 | }; 19 | 20 | environment.systemPackages = with pkgs; [ 21 | gnumake 22 | ]; 23 | 24 | services = { 25 | gvfs.enable = true; 26 | udisks2.enable = true; 27 | udev.extraRules = '' 28 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0660", TAG+="uaccess", TAG+="udev-acl", GROUP="${myvars.username}" 29 | ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="*", GROUP="video", MODE="0664" 30 | ''; 31 | }; 32 | 33 | programs = { 34 | ssh.startAgent = false; 35 | dconf.enable = true; 36 | }; 37 | 38 | gtk.iconCache.enable = true; 39 | 40 | systemd.services.NetworkManager-wait-online.enable = false; 41 | systemd.extraConfig = '' 42 | DefaultTimeoutStopSec=4s 43 | ''; 44 | systemd.user.extraConfig = '' 45 | DefaultTimeoutStopSec=4s 46 | ''; 47 | } 48 | -------------------------------------------------------------------------------- /modules/nixos/desktop/nvidia.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | ... 5 | }: 6 | with lib; { 7 | options.modules.desktop.nvidia = { 8 | enable = mkEnableOption "NVIDIA graphics drivers"; 9 | }; 10 | 11 | config = mkIf config.modules.desktop.nvidia.enable { 12 | environment.variables = mkIf config.modules.desktop.wayland.enable { 13 | LIBVA_DRIVER_NAME = "nvidia"; 14 | NVD_BACKEND = "direct"; 15 | NIXOS_OZONE_WL = "1"; 16 | ELECTRON_OZONE_PLATFORM_HINT = "auto"; 17 | __GLX_VENDOR_LIBRARY_NAME = "nvidia"; 18 | }; 19 | boot.extraModprobeConfig = "options nvidia-drm modeset=1"; 20 | boot.kernelParams = ["nvidia.NVreg_EnableGpuFirmware=0" "nvidia.NVreg_PreserveVideoMemoryAllocations=1" "module_blacklist=amdgpu"]; 21 | boot.initrd.kernelModules = 22 | config.boot.kernelModules 23 | ++ [ 24 | "nvidia" 25 | "nvidia_modeset" 26 | "nvidia_uvm" 27 | "nvidia_drm" 28 | ]; 29 | services.xserver.videoDrivers = ["nvidia"]; 30 | hardware.nvidia = { 31 | package = config.boot.kernelPackages.nvidiaPackages.beta; 32 | modesetting.enable = true; 33 | powerManagement.enable = true; 34 | forceFullCompositionPipeline = true; 35 | nvidiaSettings = true; 36 | open = false; 37 | }; 38 | 39 | hardware.graphics = { 40 | enable = true; 41 | enable32Bit = true; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /modules/nixos/desktop/ollama.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs-unstable, 4 | lib, 5 | ... 6 | }: 7 | with lib; { 8 | options.modules.desktop.ollama = { 9 | enable = mkEnableOption "Ollama"; 10 | }; 11 | 12 | config = mkIf config.modules.desktop.ollama.enable { 13 | services.ollama = { 14 | enable = true; 15 | package = pkgs-unstable.ollama; 16 | acceleration = lib.mkIf config.modules.desktop.nvidia.enable "cuda"; 17 | environmentVariables = { 18 | OLLAMA_LLM_LIBRARY = "cuda"; 19 | LD_LIBRARY_PATH = "run/opengl-driver/lib"; 20 | }; 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /modules/nixos/desktop/peripherals.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | environment.systemPackages = with pkgs; [ 3 | pavucontrol 4 | ]; 5 | 6 | services.pulseaudio.enable = false; 7 | services.pipewire = { 8 | enable = true; 9 | alsa.enable = true; 10 | alsa.support32Bit = true; 11 | pulse.enable = true; 12 | jack.enable = true; 13 | wireplumber.enable = true; 14 | }; 15 | 16 | security.rtkit.enable = true; 17 | } 18 | -------------------------------------------------------------------------------- /modules/nixos/desktop/security.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: { 6 | security.polkit.enable = true; 7 | programs.gnupg.agent = { 8 | enable = true; 9 | pinentryPackage = pkgs.pinentry-gtk2; 10 | enableSSHSupport = false; 11 | settings.default-cache-ttl = 4 * 60 * 60; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /modules/nixos/desktop/virtulization.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | boot.kernelModules = ["vfio-pci"]; 3 | 4 | virtualisation = { 5 | docker = { 6 | enable = true; 7 | daemon.settings = { 8 | "features" = {"containerd-snapshotter" = true;}; 9 | }; 10 | 11 | enableOnBoot = true; 12 | }; 13 | }; 14 | 15 | environment.systemPackages = with pkgs; [docker docker-compose]; 16 | } 17 | -------------------------------------------------------------------------------- /modules/nupkgs/astal/conf/init.lua: -------------------------------------------------------------------------------- 1 | local astal = require("astal") 2 | local App = require("astal.gtk3.app") 3 | local Bar = require("widget.Bar") 4 | local utils = require("utils") 5 | 6 | local scss = "/tmp/modified_styles.scss" 7 | local css = "/tmp/style.css" 8 | 9 | local styles = utils.get_src("styles.scss") 10 | local replacement_file = os.getenv("HOME") .. "/.local/share/astal/variables.scss" 11 | 12 | local input = io.open(styles, "r") 13 | local output = io.open(scss, "w") 14 | 15 | if utils.file_exists(replacement_file) then 16 | local replacement = io.open(replacement_file, "r") 17 | if not replacement or not output then 18 | error("Could not open " .. replacement_file .. " or " .. scss) 19 | end 20 | 21 | local replacement_content = replacement:read("*a") 22 | replacement:close() 23 | output:write(replacement_content) 24 | 25 | local line_count = 0 26 | if not input then 27 | error("Could not open " .. styles) 28 | end 29 | 30 | for line in input:lines() do 31 | line_count = line_count + 1 32 | if line_count > 12 then 33 | output:write(line .. "\n") 34 | end 35 | end 36 | else 37 | if not output or not input then 38 | error("Could not open " .. scss .. " or " .. styles) 39 | end 40 | 41 | for line in input:lines() do 42 | output:write(line .. "\n") 43 | end 44 | end 45 | 46 | input:close() 47 | output:close() 48 | 49 | astal.exec("sass " .. scss .. " " .. css) 50 | 51 | App:start({ 52 | instance_name = "lua", 53 | css = css, 54 | main = function() 55 | Bar(0) 56 | end, 57 | }) 58 | -------------------------------------------------------------------------------- /modules/nupkgs/astal/conf/styles.scss: -------------------------------------------------------------------------------- 1 | $primary: #a3be8c; 2 | $bg: #282c34; 3 | $altbg: #3e4451; 4 | $fg: #abb2bf; 5 | $black: #282c34; 6 | $red: #bf616a; 7 | $green: #a3be8c; 8 | $yellow: #ebcb8b; 9 | $blue: #81a1c1; 10 | $magenta: #b48ead; 11 | $cyan: #88c0d0; 12 | $white: #e5e9f0; 13 | 14 | * { 15 | all: unset; 16 | } 17 | 18 | label { 19 | font-weight: 500; 20 | } 21 | 22 | progress, highlight { 23 | background: $primary; 24 | min-height: 7px; 25 | border-radius: 4px; 26 | } 27 | 28 | slider { 29 | box-shadow: none; 30 | background-color: $primary; 31 | outline: 1px solid $altbg; 32 | border-radius: 6px; 33 | min-height: 7px; 34 | } 35 | 36 | menu { 37 | background: $bg; 38 | padding: 8px; 39 | 40 | separator { 41 | background: transparent; 42 | } 43 | 44 | menuitem { 45 | padding: 4px 2px; 46 | border: 1px solid transparent; 47 | margin: 4px 0; 48 | &:first-child { margin-top: 0; } 49 | &:last-child { margin-bottom: 0; } 50 | 51 | &:hover { 52 | background: $altbg; 53 | border: 1px solid $black; 54 | } 55 | } 56 | } 57 | 58 | .bar { 59 | color: $fg; 60 | font-size: 14px; 61 | background: transparent; 62 | } 63 | 64 | .body { 65 | background: $bg; 66 | padding: 6px 4px; 67 | font-family: JetBrainsMono Nerd Font, Inter; 68 | } 69 | 70 | .tray { 71 | margin-right: 12px; 72 | } 73 | 74 | .tray button { 75 | background: transparent; 76 | border: none; 77 | margin-left: 12px; 78 | } 79 | 80 | .workspaces button { 81 | background: transparent; 82 | margin: 0 4px; 83 | padding: 1px 5px; 84 | border-radius: 20%; 85 | min-height: 0; 86 | } 87 | 88 | .workspaces button.focused { 89 | background: $primary; 90 | color: $bg; 91 | } 92 | 93 | .workspaces button.occupied { 94 | background: $altbg; 95 | } 96 | 97 | .client-title { 98 | margin-left: 1em; 99 | color: $fg; 100 | } 101 | 102 | .volume { 103 | min-width: 90px; 104 | margin-right: 12px; 105 | } 106 | 107 | .battery-percentage { 108 | margin-left: 6px; 109 | } 110 | 111 | .battery { 112 | margin-right: 12px; 113 | } 114 | 115 | .volume button { 116 | border: 1px solid transparent; 117 | outline: none; 118 | background: transparent; 119 | margin-right: 12px; 120 | } 121 | 122 | .clock { 123 | margin-right: 6px; 124 | } 125 | 126 | .tray { 127 | margin-right: 12px; 128 | } 129 | -------------------------------------------------------------------------------- /modules/nupkgs/astal/conf/utils.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.TIMEOUT = 200 4 | 5 | function M.map(arr, fn) 6 | result = {} 7 | for i, v in ipairs(arr) do 8 | table.insert(result, fn(v, i)) 9 | end 10 | return result 11 | end 12 | 13 | function M.execute_niri_command(cmd) 14 | os.execute(string.format("niri msg %s", cmd)) 15 | end 16 | 17 | function M.get_src(path) 18 | local str = debug.getinfo(2, "S").source:sub(2) 19 | local src = str:match("(.*/)") or str:match("(.*\\)") or "./" 20 | return src .. path 21 | end 22 | 23 | function M.file_exists(path) 24 | local file = io.open(path, "r") 25 | if file then 26 | file:close() 27 | return true 28 | end 29 | return false 30 | end 31 | 32 | function M.contains_value(tbl, value) 33 | for _, v in ipairs(tbl) do 34 | if v == value then 35 | return true 36 | end 37 | end 38 | return false 39 | end 40 | 41 | return M 42 | -------------------------------------------------------------------------------- /modules/nupkgs/astal/conf/widget/Bar.lua: -------------------------------------------------------------------------------- 1 | local astal = require("astal") 2 | local Widget = require("astal.gtk3.widget") 3 | local Variable = astal.Variable 4 | local bind = astal.bind 5 | local GLib = astal.require("GLib") 6 | local Wp = astal.require("AstalWp") 7 | local Tray = astal.require("AstalTray") 8 | local Battery = require("lgi").require("AstalBattery") 9 | local utils = require("utils") 10 | 11 | local function VolumeSlider(type) 12 | local audio = Wp.get_default().audio 13 | local device = type == "speaker" and audio.default_speaker or audio.default_source 14 | 15 | return Widget.Slider({ 16 | hexpand = true, 17 | draw_value = false, 18 | on_value_changed = function(self) 19 | device.volume = self.value 20 | end, 21 | value = bind(device, "volume"), 22 | }) 23 | end 24 | 25 | local function VolumeIndicator(type) 26 | local audio = Wp.get_default().audio 27 | local device = type == "speaker" and audio.default_speaker or audio.default_source 28 | 29 | if not device then 30 | return Widget.Box({}) 31 | end 32 | 33 | return Widget.Button({ 34 | Widget.Icon({ 35 | icon = bind(device, "volume-icon"):as(function(_) 36 | return type == "speaker" and "audio-speakers-symbolic" or "audio-headphones-symbolic" 37 | end), 38 | }), 39 | }) 40 | end 41 | 42 | local function Volume() 43 | return Widget.Box({ 44 | class_name = "volume", 45 | VolumeIndicator("speaker"), 46 | VolumeSlider("speaker"), 47 | }) 48 | end 49 | 50 | local function BatteryIndicator() 51 | local battery = Battery.get_default() 52 | 53 | if not battery then 54 | return Widget.Box({}) 55 | end 56 | 57 | return Widget.Box({ 58 | class_name = "battery", 59 | Widget.Icon({ 60 | icon = bind(battery, "battery-icon-name"), 61 | }), 62 | Widget.Label({ 63 | class_name = "battery-percentage", 64 | label = bind(battery, "percentage"):as(function(percentage) 65 | return string.format("%d%%", math.floor(percentage * 100 + 0.5)) 66 | end), 67 | }), 68 | }) 69 | end 70 | 71 | local function Workspaces() 72 | local outputs_data = Variable({}) 73 | 74 | local function update_workspaces() 75 | local handle = io.popen("niri msg workspaces") 76 | if handle then 77 | local result = handle:read("*a") 78 | handle:close() 79 | 80 | local parsed_outputs = {} 81 | local output_order = {} 82 | local current_output = nil 83 | 84 | for line in result:gmatch("[^\r\n]+") do 85 | local output_match = line:match('Output "([^"]+)":') 86 | if output_match then 87 | current_output = output_match 88 | if not parsed_outputs[current_output] then 89 | table.insert(output_order, current_output) 90 | parsed_outputs[current_output] = { workspaces = {}, active = nil } 91 | end 92 | elseif current_output then 93 | local is_active = line:match("^%s*%*") 94 | local ws_num = line:match("%d+") 95 | 96 | if ws_num then 97 | ws_num = tonumber(ws_num) 98 | table.insert(parsed_outputs[current_output].workspaces, ws_num) 99 | 100 | if is_active then 101 | parsed_outputs[current_output].active = ws_num 102 | end 103 | end 104 | end 105 | end 106 | 107 | outputs_data:set({data = parsed_outputs, order = output_order}) 108 | end 109 | end 110 | 111 | GLib.timeout_add(GLib.PRIORITY_DEFAULT, utils.TIMEOUT, function() 112 | update_workspaces() 113 | return true 114 | end) 115 | 116 | update_workspaces() 117 | 118 | return Widget.Box({ 119 | class_name = "all-workspaces", 120 | spacing = 15, 121 | bind(outputs_data):as(function(outputs) 122 | local widgets = {} 123 | 124 | for _, output_name in ipairs(outputs.order) do 125 | local output_data = outputs.data[output_name] 126 | local output_widget = Widget.Box({ 127 | class_name = "output-workspaces", 128 | spacing = 5, 129 | Widget.Label({ 130 | label = outputs.order[1] == output_name and 131 | "メイン" --[[meine]] or "サブ" --[[sabu]], 132 | class_name = "output-label" 133 | }), 134 | Widget.Box({ 135 | class_name = "workspaces", 136 | spacing = 2, 137 | utils.map(output_data.workspaces, function(ws) 138 | return Widget.Button({ 139 | -- on_clicked = function() 140 | -- utils.execute_niri_command(string.format("action focus-workspace %d", ws)) 141 | -- end, 142 | label = " ", 143 | class_name = output_data.active == ws and "focused" or "occupied", 144 | }) 145 | end) 146 | }) 147 | }) 148 | 149 | table.insert(widgets, output_widget) 150 | end 151 | 152 | return widgets 153 | end) 154 | }) 155 | end 156 | 157 | local function Clock() 158 | local time = Variable(""):poll(1000, function() 159 | return GLib.DateTime.new_now_local():format("%a. %b %e - %H:%M:%S") 160 | end) 161 | 162 | return Widget.Label({ 163 | class_name = "clock", 164 | on_destroy = function() 165 | time:drop() 166 | end, 167 | label = time(), 168 | }) 169 | end 170 | 171 | local function SysTray() 172 | local tray = Tray.get_default() 173 | 174 | return Widget.Box({ 175 | class_name = "tray", 176 | bind(tray, "items"):as(function(items) 177 | return utils.map(items, function(item) 178 | return Widget.MenuButton({ 179 | tooltip_markup = bind(item, "tooltip_markup"), 180 | use_popover = false, 181 | menu_model = bind(item, "menu-model"), 182 | action_group = bind(item, "action-group"):as(function(ag) 183 | return { "dbusmenu", ag } 184 | end), 185 | Widget.Icon({ 186 | gicon = bind(item, "gicon"), 187 | }), 188 | }) 189 | end) 190 | end), 191 | }) 192 | end 193 | 194 | local function ClientTitle() 195 | local title = Variable("") 196 | 197 | local function update_title() 198 | local handle = io.popen("niri msg focused-window | grep -oP 'Title: \"\\K[^\"]+' 2>/dev/null || echo ''") 199 | if handle then 200 | local result = handle:read("*a") 201 | handle:close() 202 | local value = result:gsub("^%s*(.-)%s*$", "%1") 203 | if value ~= "" then 204 | title:set(value) 205 | else 206 | title:set("") 207 | end 208 | end 209 | end 210 | 211 | GLib.timeout_add(GLib.PRIORITY_DEFAULT, utils.TIMEOUT, function() 212 | update_title() 213 | return true 214 | end) 215 | 216 | return Widget.Label({ 217 | class_name = "client-title", 218 | ellipsize = "END", 219 | max_width_chars = 56, 220 | label = title(), 221 | }) 222 | end 223 | 224 | local function Left() 225 | return Widget.Box({ 226 | Workspaces(), 227 | }) 228 | end 229 | 230 | local function Center() 231 | return Widget.Box({ 232 | ClientTitle(), 233 | }) 234 | end 235 | 236 | local function Right() 237 | return Widget.Box({ 238 | halign = "END", 239 | SysTray(), 240 | Volume(), 241 | BatteryIndicator(), 242 | Clock(), 243 | }) 244 | end 245 | 246 | return function(monitor) 247 | local WindowAnchor = astal.require("Astal", "3.0").WindowAnchor 248 | 249 | return Widget.Window({ 250 | name = "bar-" .. monitor, 251 | class_name = "bar", 252 | monitor = monitor, 253 | anchor = WindowAnchor.TOP + WindowAnchor.LEFT + WindowAnchor.RIGHT, 254 | exclusivity = "EXCLUSIVE", 255 | Widget.CenterBox({ 256 | class_name = "body", 257 | start_widget = Left(), 258 | center_widget = Center(), 259 | end_widget = Right(), 260 | }), 261 | }) 262 | end 263 | -------------------------------------------------------------------------------- /modules/nupkgs/astal/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | astal, 4 | stdenv, 5 | dart-sass, 6 | stdenvNoCC, 7 | wrapGAppsHook, 8 | gobject-introspection, 9 | lua, 10 | ... 11 | }: let 12 | platform = 13 | if stdenv.hostPlatform.system == "x86_64-linux" 14 | then stdenv.hostPlatform.system 15 | else throw "Unsupported system"; 16 | in 17 | astal.lib.mkLuaPackage { 18 | pkgs = 19 | { 20 | inherit lib stdenvNoCC wrapGAppsHook gobject-introspection lua; 21 | } 22 | // {system = platform;}; 23 | name = "astal"; 24 | src = ./conf; 25 | 26 | extraPackages = [ 27 | astal.packages.${platform}.battery 28 | astal.packages.${platform}.wireplumber 29 | astal.packages.${platform}.tray 30 | dart-sass 31 | ]; 32 | } 33 | -------------------------------------------------------------------------------- /modules/nupkgs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | mylib, 5 | astal, 6 | meow, 7 | zellij-switch, 8 | linux-shimeji, 9 | ghostty, 10 | ... 11 | }: let 12 | packageFiles = 13 | lib.filter 14 | (path: !lib.strings.hasPrefix (toString ./overlays) (toString path)) 15 | (mylib.file.scanPaths ./.); 16 | 17 | pkgsWithOverlays = pkgs.extend zellij-switch.overlays.default; 18 | 19 | packages = 20 | builtins.listToAttrs ( 21 | map 22 | (file: let 23 | name = lib.strings.removeSuffix ".nix" (baseNameOf file); 24 | in { 25 | name = name; 26 | value = pkgsWithOverlays.callPackage file ( 27 | if name == "astal" 28 | then { 29 | inherit astal; 30 | } 31 | else {} 32 | ); 33 | }) 34 | packageFiles 35 | ) 36 | // { 37 | inherit (pkgsWithOverlays) zellij-switch; 38 | linux-shimeji = linux-shimeji.packages.${pkgs.system}.little-ghost-polite; 39 | ghostty = ghostty.packages.${pkgs.system}.ghostty-releasefast; 40 | meow = meow.packages.${pkgs.system}.default; 41 | }; 42 | in 43 | packages 44 | -------------------------------------------------------------------------------- /modules/nupkgs/devtunnel-cli/conf/source.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha256": "kL5ScpQFUgk5BQ9WsUum9wMN8j3liy4+5/Xzjhsj0s0=", 3 | "version": "latest" 4 | } 5 | -------------------------------------------------------------------------------- /modules/nupkgs/devtunnel-cli/conf/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 5 | 6 | NEW_HASH=$(nix hash convert --hash-algo sha256 --to base64 $(nix-prefetch-url https://aka.ms/TunnelsCliDownload/linux-x64)) 7 | 8 | cat > "$SCRIPT_DIR/source.json" << EOF 9 | { 10 | "sha256": "${NEW_HASH}", 11 | "version": "latest" 12 | } 13 | EOF 14 | 15 | echo "updated source.json with new hash: ${NEW_HASH}" 16 | -------------------------------------------------------------------------------- /modules/nupkgs/devtunnel-cli/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | lib, 4 | fetchurl, 5 | curl, 6 | autoPatchelfHook, 7 | zlib, 8 | icu, 9 | libgcc, 10 | openssl_1_1, 11 | }: let 12 | platform = 13 | if stdenv.hostPlatform.system == "x86_64-linux" 14 | then stdenv.hostPlatform.system 15 | else throw "Unsupported system"; 16 | source = builtins.fromJSON (builtins.readFile ./conf/source.json); 17 | in 18 | stdenv.mkDerivation rec { 19 | pname = "devtunnel"; 20 | name = "devtunnel-cli"; 21 | version = source.version; 22 | 23 | src = fetchurl { 24 | url = "https://aka.ms/TunnelsCliDownload/linux-x64"; 25 | sha256 = source.sha256; 26 | }; 27 | 28 | meta = with lib; { 29 | description = "DevTunnel is a tool that allows you to expose your local development server to the internet"; 30 | license = licenses.mit; 31 | maintainers = with maintainers; []; 32 | platforms = [platform]; 33 | }; 34 | 35 | buildInputs = [autoPatchelfHook zlib stdenv.cc.cc.lib]; 36 | runtimeDependencies = [icu openssl_1_1.out]; 37 | 38 | installPhase = '' 39 | runHook preInstall 40 | 41 | mkdir -p $out/bin 42 | cp $src $out/bin/devtunnel 43 | chmod +x $out/bin/devtunnel 44 | 45 | runHook postInstall 46 | ''; 47 | 48 | unpackPhase = ":"; 49 | dontStrip = true; 50 | } 51 | -------------------------------------------------------------------------------- /modules/nupkgs/home.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | mylib, 6 | ... 7 | }: { 8 | options.modules.desktop.nupkgs = { 9 | enable = lib.mkEnableOption "NIX User Packages"; 10 | 11 | packages = lib.mkOption { 12 | type = lib.types.listOf lib.types.package; 13 | default = []; 14 | description = "List of user packages managed via NIX User Packages."; 15 | }; 16 | }; 17 | 18 | config = lib.mkIf config.modules.desktop.nupkgs.enable { 19 | home.packages = config.modules.desktop.nupkgs.packages; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/nupkgs/trxsh/conf/source.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha256": "quTt7xxqoajrXYBwjy+0+1hufrl1zAaO4qifGajsEZ8=", 3 | "version": "v1.0.4" 4 | } 5 | -------------------------------------------------------------------------------- /modules/nupkgs/trxsh/conf/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 4 | LATEST_RELEASE=$(curl -s https://api.github.com/repos/datsfilipe/trxsh/releases/latest) 5 | VERSION=$(echo "$LATEST_RELEASE" | jq -r .tag_name) 6 | URL="https://github.com/datsfilipe/trxsh/releases/download/${VERSION}/trxsh-${VERSION}-linux-amd64.tar.gz" 7 | HASH=$(nix-prefetch-url "$URL") 8 | NEW_HASH=$(nix hash convert --hash-algo sha256 --to base64 "$HASH") 9 | cat > "$SCRIPT_DIR/source.json" < /dev/null; then 109 | rm flake.nix 110 | else 111 | trash flake.nix 112 | fi 113 | fi 114 | nix eval --raw -f templates/flake.template.nix flake > flake.nix 115 | alejandra flake.nix 116 | } 117 | 118 | main "$@" 119 | '') 120 | 121 | (mkScript pkgs "run_lib_tests" '' 122 | main() { 123 | pushd "$DOTFILES_ROOT" || exit 1 124 | nix-shell -p nix-unit --run "nix-unit ./lib/spec.nix --gc-roots-dir ./.result-test" 125 | popd || exit 1 126 | } 127 | 128 | main "$@" 129 | '') 130 | ]; 131 | in { 132 | nixosConfigurations = 133 | lib.attrsets.mergeAttrsList (map (it: it.nixosConfigurations or {}) nixosSystemValues); 134 | 135 | packages = forAllSystems ( 136 | system: nixosSystems.${system}.packages or {} 137 | ); 138 | 139 | devShells = forAllSystems ( 140 | system: let 141 | pkgs = nixpkgs.legacyPackages.${system}; 142 | in { 143 | default = pkgs.mkShell { 144 | name = "dots"; 145 | nativeBuildInputs = [] ++ (generateScritps pkgs); 146 | packages = with pkgs; [ 147 | bashInteractive 148 | gcc 149 | alejandra 150 | just 151 | ]; 152 | shellHook = '' 153 | export DOTFILES_ROOT=$(git rev-parse --show-toplevel) 154 | ''; 155 | }; 156 | } 157 | ); 158 | 159 | formatter = forAllSystems ( 160 | system: nixpkgs.legacyPackages.${system}.alejandra 161 | ); 162 | } 163 | -------------------------------------------------------------------------------- /outputs/x86_64-linux/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | mylib, 4 | inputs, 5 | system, 6 | ... 7 | } @ args: let 8 | srcFiles = builtins.attrNames (builtins.readDir ./src); 9 | 10 | data = 11 | lib.foldl' ( 12 | acc: fileName: let 13 | attrName = mylib.removeSuffix ".nix" fileName; 14 | in 15 | acc 16 | // { 17 | "${attrName}" = import ./src/${fileName} args; 18 | } 19 | ) {} 20 | srcFiles; 21 | 22 | outputs = { 23 | nixosConfigurations = lib.attrsets.mergeAttrsList (map (it: it.nixosConfigurations or {}) (builtins.attrValues data)); 24 | }; 25 | in 26 | outputs 27 | // { 28 | inherit data; 29 | } 30 | -------------------------------------------------------------------------------- /outputs/x86_64-linux/src/dtsf-laptop.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | myvars, 4 | mylib, 5 | system, 6 | inputs, 7 | genSpecialArgs, 8 | ... 9 | } @ args: let 10 | name = "dtsf-laptop"; 11 | monitorsConfig = { 12 | enable = true; 13 | enableNvidiaSupport = false; 14 | monitors = [ 15 | { 16 | name = "eDP-1"; 17 | resolution = "1920x1080"; 18 | refreshRate = "59.997"; 19 | scale = "1.5"; 20 | nvidiaSettings = { 21 | coordinate = { 22 | x = 0; 23 | y = 0; 24 | }; 25 | forceFullCompositionPipeline = true; 26 | rotation = "normal"; 27 | }; 28 | } 29 | ]; 30 | }; 31 | base-modules = { 32 | nixos-modules = 33 | map mylib.file.relativeToRoot [ 34 | "modules/secrets/nixos.nix" 35 | "modules/wallpaper/nixos.nix" 36 | "modules/nixos/desktop.nix" 37 | "modules/shared" 38 | "hosts/${name}" 39 | ] 40 | ++ [ 41 | inputs.sops-nix.nixosModules.sops 42 | ]; 43 | home-modules = 44 | map mylib.file.relativeToRoot [ 45 | "hosts/${name}/home" 46 | "modules/home/linux/gui.nix" 47 | "modules/nupkgs/home.nix" 48 | "modules/colorscheme/home.nix" 49 | "modules/conf/home.nix" 50 | "modules/term.nix" 51 | "modules/shared" 52 | ] 53 | ++ [ 54 | inputs.datsnvim.homeManagerModules.${system}.default 55 | ]; 56 | }; 57 | 58 | pc-modules = { 59 | nixos-modules = 60 | [ 61 | { 62 | modules.shared.multi-monitors = monitorsConfig; 63 | modules.desktop.wallpaper = { 64 | enable = true; 65 | file = "/home/${myvars.username}/media/photos/37.png"; 66 | }; 67 | modules.ssh-key-manager.enable = true; 68 | modules.desktop.ollama.enable = false; 69 | modules.desktop.nvidia.enable = false; 70 | modules.desktop.wayland.enable = true; 71 | } 72 | ] 73 | ++ base-modules.nixos-modules; 74 | home-modules = 75 | [ 76 | { 77 | modules.shared.multi-monitors = monitorsConfig; 78 | modules.core.term.default = "ghostty"; 79 | modules.desktop.niri.enable = true; 80 | modules.desktop.nupkgs.enable = true; 81 | modules.desktop.conf = { 82 | enableDunstIntegration = true; 83 | enableCavaIntegration = true; 84 | enableZellijIntegration = true; 85 | }; 86 | modules.desktop.colorscheme = { 87 | enable = true; 88 | enableDunstIntegration = true; 89 | enableNeovimIntegration = true; 90 | enableGTKIntegration = true; 91 | enableFishIntegration = true; 92 | enableCavaIntegration = true; 93 | enableZellijIntegration = true; 94 | enableAstalIntegration = true; 95 | enableGhosttyIntegration = true; 96 | enableFzfIntegration = true; 97 | enableNiriIntegration = true; 98 | enableFuzzelIntegration = true; 99 | }; 100 | } 101 | ] 102 | ++ base-modules.home-modules; 103 | }; 104 | in { 105 | nixosConfigurations = { 106 | "${name}" = mylib.nixosSystem (pc-modules // args); 107 | }; 108 | } 109 | -------------------------------------------------------------------------------- /outputs/x86_64-linux/src/dtsf-pc.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | myvars, 4 | mylib, 5 | system, 6 | inputs, 7 | genSpecialArgs, 8 | ... 9 | } @ args: let 10 | name = "dtsf-pc"; 11 | monitorsConfig = { 12 | enable = true; 13 | enableNvidiaSupport = true; 14 | monitors = [ 15 | { 16 | name = "DP-2"; 17 | focus = true; 18 | resolution = "1920x1080"; 19 | refreshRate = "179.998"; 20 | nvidiaSettings = { 21 | coordinate = { 22 | x = 0; 23 | y = 420; 24 | }; 25 | forceFullCompositionPipeline = true; 26 | rotation = "normal"; 27 | }; 28 | } 29 | { 30 | name = "HDMI-A-1"; 31 | resolution = "1920x1080"; 32 | refreshRate = "74.973"; 33 | nvidiaSettings = { 34 | coordinate = { 35 | x = 1920; 36 | y = 0; 37 | }; 38 | forceFullCompositionPipeline = true; 39 | rotation = "left"; 40 | }; 41 | } 42 | ]; 43 | }; 44 | base-modules = { 45 | nixos-modules = 46 | map mylib.file.relativeToRoot [ 47 | "modules/secrets/nixos.nix" 48 | "modules/wallpaper/nixos.nix" 49 | "modules/nixos/desktop.nix" 50 | "modules/shared" 51 | "hosts/${name}" 52 | ] 53 | ++ [ 54 | inputs.sops-nix.nixosModules.sops 55 | ]; 56 | home-modules = 57 | map mylib.file.relativeToRoot [ 58 | "hosts/${name}/home" 59 | "modules/home/linux/gui.nix" 60 | "modules/nupkgs/home.nix" 61 | "modules/colorscheme/home.nix" 62 | "modules/conf/home.nix" 63 | "modules/term.nix" 64 | "modules/shared" 65 | ] 66 | ++ [ 67 | inputs.datsnvim.homeManagerModules.${system}.default 68 | ]; 69 | }; 70 | 71 | pc-modules = { 72 | nixos-modules = 73 | [ 74 | { 75 | modules.shared.multi-monitors = monitorsConfig; 76 | modules.desktop.wallpaper = { 77 | enable = true; 78 | file = "/run/media/dtsf/datsgames/walls/41.png"; 79 | }; 80 | modules.ssh-key-manager.enable = true; 81 | modules.desktop.ollama.enable = true; 82 | modules.desktop.nvidia.enable = true; 83 | modules.desktop.wayland.enable = true; 84 | } 85 | ] 86 | ++ base-modules.nixos-modules; 87 | home-modules = 88 | [ 89 | { 90 | modules.shared.multi-monitors = monitorsConfig; 91 | modules.core.term.default = "ghostty"; 92 | modules.desktop.niri.enable = true; 93 | modules.desktop.nupkgs.enable = true; 94 | modules.desktop.conf = { 95 | enableDunstIntegration = true; 96 | enableCavaIntegration = true; 97 | enableZellijIntegration = true; 98 | }; 99 | modules.desktop.colorscheme = { 100 | enable = true; 101 | enableDunstIntegration = true; 102 | enableNeovimIntegration = true; 103 | enableGTKIntegration = true; 104 | enableFishIntegration = true; 105 | enableCavaIntegration = true; 106 | enableZellijIntegration = true; 107 | enableAstalIntegration = true; 108 | enableGhosttyIntegration = true; 109 | enableFzfIntegration = true; 110 | enableNiriIntegration = true; 111 | enableFuzzelIntegration = true; 112 | }; 113 | } 114 | ] 115 | ++ base-modules.home-modules; 116 | }; 117 | in { 118 | nixosConfigurations = { 119 | "${name}" = mylib.nixosSystem (pc-modules // args); 120 | }; 121 | } 122 | -------------------------------------------------------------------------------- /scripts/topretty.nix: -------------------------------------------------------------------------------- 1 | with builtins; let 2 | printChild = prefix: x: let 3 | names = attrNames x; 4 | in 5 | if isAttrs x && length names == 1 6 | then "." + head names + printChild prefix x.${head names} 7 | else " = " + print prefix x; 8 | 9 | hasPrefix = prefix: str: 10 | substring 0 (stringLength prefix) str == prefix; 11 | 12 | getSortPriority = name: value: 13 | if !isAttrs value || !(value ? url) 14 | then 3 15 | else if value ? url && length (attrNames value) == 1 16 | then 1 17 | else if hasPrefix "git+file" value.url 18 | then 4 19 | else 2; 20 | 21 | compareAttrs = a: b: let 22 | prioA = getSortPriority (head (attrNames a)) (a.${head (attrNames a)}); 23 | prioB = getSortPriority (head (attrNames b)) (b.${head (attrNames b)}); 24 | in 25 | if prioA == prioB 26 | then head (attrNames a) < head (attrNames b) 27 | else prioA < prioB; 28 | 29 | mapAttrsToList = f: attrs: let 30 | pairs = attrValues (mapAttrs (name: value: {${name} = value;}) attrs); 31 | in 32 | sort compareAttrs pairs; 33 | 34 | mapAttrsToLines = f: attrs: 35 | concatStringsSep "\n" 36 | (map (pair: let 37 | name = head (attrNames pair); 38 | value = pair.${name}; 39 | in 40 | f name value) 41 | (mapAttrsToList f attrs)); 42 | 43 | print = prefix: x: 44 | if isString x 45 | then "\"${x}\"" 46 | else if x == null 47 | then "null" 48 | else if x == false 49 | then "false" 50 | else if ! isAttrs x 51 | then toString x 52 | else let 53 | prefix' = prefix + " "; 54 | in '' 55 | { 56 | ${mapAttrsToLines (n: v: prefix' + n + printChild prefix' v + ";") x} 57 | ${prefix}}''; 58 | in 59 | print 60 | -------------------------------------------------------------------------------- /scripts/update-nupkgs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | if [ $# -ne 1 ]; then 5 | echo "usage: $0 " 6 | exit 1 7 | fi 8 | 9 | BASE_PATH=$(realpath "$1") 10 | 11 | process_updates() { 12 | local total_found=0 13 | local total_run=0 14 | local total_failed=0 15 | local failed_scripts=() 16 | 17 | while IFS= read -r script || [ -n "$script" ]; do 18 | total_found=$((total_found + 1)) 19 | echo "running update script: $script" 20 | 21 | dir_name=$(basename "$(dirname "$script")") 22 | 23 | if [ "$dir_name" = "conf" ]; then 24 | script=$(realpath "$script") 25 | if bash "$script"; then 26 | echo "successfully ran $script" 27 | total_run=$((total_run + 1)) 28 | else 29 | echo "failed to run $script" 30 | total_failed=$((total_failed + 1)) 31 | failed_scripts+=("$script") 32 | fi 33 | else 34 | echo "skipping $script as it's not in a 'conf' directory" 35 | fi 36 | done < <(find "$BASE_PATH" -mindepth 3 -maxdepth 3 -name "update.sh" -type f) 37 | 38 | echo 39 | echo "update Summary:" 40 | echo "---------------" 41 | echo "total update scripts found: $total_found" 42 | echo "total scripts run: $total_run" 43 | echo "total scripts failed: $total_failed" 44 | 45 | if [ ${#failed_scripts[@]} -gt 0 ]; then 46 | echo 47 | echo "failed scripts:" 48 | printf '%s\n' "${failed_scripts[@]}" 49 | return 1 50 | fi 51 | 52 | return 0 53 | } 54 | 55 | if [ ! -d "$BASE_PATH" ]; then 56 | echo "error: provided path '$BASE_PATH' is not a directory" 57 | exit 1 58 | fi 59 | 60 | echo "scanning for update scripts in: $BASE_PATH" 61 | process_updates 62 | -------------------------------------------------------------------------------- /templates/flake.template.nix: -------------------------------------------------------------------------------- 1 | with builtins; let 2 | topretty = import ../scripts/topretty.nix; 3 | genFlake = thisFile: attrs: let 4 | standardizedAttrs = 5 | attrs 6 | // { 7 | outputs = ""; 8 | }; 9 | flakeContent = topretty "" standardizedAttrs; 10 | in 11 | attrs 12 | // { 13 | flake = 14 | replaceStrings 15 | ["\"\""] 16 | [attrs.outputs] 17 | flakeContent; 18 | }; 19 | in 20 | genFlake ./flake.template.nix 21 | { 22 | description = "datsdots"; 23 | inputs = let 24 | ext = url: with-nixpkgs: 25 | { 26 | inherit url; 27 | } 28 | // ( 29 | if with-nixpkgs 30 | then { 31 | inputs.nixpkgs.follows = "nixpkgs"; 32 | } 33 | else {} 34 | ); 35 | 36 | ext-unstable = url: let 37 | base = {inherit url;}; 38 | in 39 | base // {inputs = {nixpkgs.follows = "nixpkgs-unstable";};}; 40 | 41 | ext-hm = url: { 42 | inherit url; 43 | inputs.nixpkgs.follows = "nixpkgs"; 44 | inputs.home-manager.follows = "home-manager"; 45 | }; 46 | 47 | local = path: { 48 | url = "git+file://${toString path}?shallow=1"; 49 | flake = false; 50 | }; 51 | in { 52 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 53 | nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 54 | nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11"; 55 | ghostty = ext "github:ghostty-org/ghostty/main" false; 56 | linux-shimeji = ext "github:datsfilipe/linux-shimeji/main" true; 57 | zellij-switch = ext "github:datsfilipe/zellij-switch/flake" true; 58 | home-manager = ext "github:nix-community/home-manager/master" true; 59 | sops-nix = ext "github:Mic92/sops-nix/master" true; 60 | neovim-nightly = ext "github:nix-community/neovim-nightly-overlay/master" true; 61 | astal = ext "github:aylur/astal/main" true; 62 | meow = ext-unstable "github:datsfilipe/meow/main"; 63 | datsnvim = ext-hm "github:datsfilipe/datsnvim/main"; 64 | unix-scripts = local ../modules/home/linux/base/scripts/conf; 65 | }; 66 | outputs = "inputs: import ./outputs inputs"; 67 | } 68 | -------------------------------------------------------------------------------- /vars/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | username = "dtsf"; 3 | in { 4 | username = username; 5 | userfullname = "Filipe Lima"; 6 | useremail = "datsfilipe.foss@proton.me"; 7 | sshAuthorizedKeys = [ 8 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINaF8YTdblaxjJATw1segJGHw69ooLnVY25Vz8hAo9kk datsfilipe.foss@proton.me" 9 | ]; 10 | } 11 | --------------------------------------------------------------------------------