├── .git-crypt ├── .gitattributes └── keys │ └── default │ └── 0 │ ├── 5CFF43EABA5F369FB98454FF19AD3F6B1A5BF3BF.gpg │ └── 7FC898F31F83BEB3A863CA36BF2ADAA2A98F45E7.gpg ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── ci.yml │ └── update-flake.yml ├── .gitignore ├── .terraform.lock.hcl ├── adguard.tf ├── devshell.nix ├── flake.lock ├── flake.nix ├── garnix.yaml ├── hosts ├── asche │ ├── configuration.nix │ ├── default.nix │ ├── hardware-configuration.nix │ └── readme.org ├── default.nix ├── mist.nix ├── wk01174.nix └── yuan-mac.nix ├── justfile ├── modules ├── .gitattributes ├── .xmobarrc ├── adguard.nix ├── adguradhome-with-user.nix ├── agenix.nix ├── ai.nix ├── aws.nix ├── brew.nix ├── browsers │ ├── firefox.nix │ └── readme.org ├── catppuccin.nix ├── common.nix ├── default.nix ├── dev │ ├── agda.nix │ ├── ask.nix │ ├── dart.nix │ ├── haskell.nix │ ├── haxe.nix │ ├── idris2.nix │ ├── java.nix │ ├── julia.nix │ ├── kotlin.nix │ ├── node.nix │ ├── python.nix │ ├── racket.nix │ ├── scheme.nix │ └── zig.nix ├── editor │ └── emacs │ │ ├── default.nix │ │ ├── emacs-init-defaults.nix │ │ ├── emacs-init.nix │ │ ├── emacs-macos.nix │ │ ├── packages │ │ ├── aider.nix │ │ ├── ask-mode │ │ │ ├── ask-mode.patch │ │ │ └── default.nix │ │ ├── consult-omni │ │ │ └── default.nix │ │ ├── copilot-emacs │ │ │ └── default.nix │ │ ├── emacs-reveal.nix │ │ ├── hurl-mode.nix │ │ ├── lsp-bridge │ │ │ ├── default.nix │ │ │ └── hardcode-dependencies.patch │ │ ├── lspce.nix │ │ ├── ob-racket.nix │ │ ├── org-extra.el │ │ ├── prot-common.el │ │ ├── prot-modeline.el │ │ ├── transient-showcase.nix │ │ └── wm.el │ │ ├── patches │ │ └── round-undecorated-frame.patch │ │ ├── readme.org │ │ └── snippets │ │ ├── java-mode │ │ ├── @param │ │ ├── @return │ │ ├── apr_assert │ │ ├── assertj │ │ ├── class │ │ ├── constructor │ │ ├── doc │ │ ├── equals │ │ ├── file_class │ │ ├── for │ │ ├── foreach │ │ ├── if │ │ ├── ife │ │ ├── import │ │ ├── import-assertj │ │ ├── interface │ │ ├── iterator │ │ ├── javadoc │ │ ├── lombok-log │ │ ├── main │ │ ├── method │ │ ├── method@ │ │ ├── new │ │ ├── paintComponent │ │ ├── printf │ │ ├── println │ │ ├── private │ │ ├── protected │ │ ├── public │ │ ├── return │ │ ├── test │ │ ├── testClass │ │ ├── this │ │ ├── toString │ │ ├── try │ │ ├── var │ │ ├── var= │ │ ├── void │ │ └── while │ │ ├── kotlin-mode │ │ └── file_class │ │ └── zig-mode │ │ └── main ├── health.nix ├── helix.nix ├── hledger.nix ├── home.nix ├── hosts.nix ├── linux_packages.nix ├── macintosh.nix ├── macos_packages.nix ├── moonlander.nix ├── nixos_system.nix ├── packages.nix ├── private │ ├── jellyfin-darwin.nix │ └── work.nix ├── qmk.nix ├── rofi │ └── default.nix ├── settings.nix ├── terminal-multiplexer │ ├── ta │ ├── tat │ ├── tkill │ ├── tmux.nix │ ├── zellij-session.sh │ ├── zellij-wrapper.sh │ └── zellij.nix ├── terminal │ ├── default.nix │ ├── readme.org │ ├── ta │ ├── tat │ └── tkill ├── theme.rafi ├── typing │ ├── all-words.txt │ ├── default.nix │ ├── hello-world.hs │ ├── level1.txt │ ├── level2.txt │ ├── level3.txt │ ├── level4.txt │ ├── level5.txt │ ├── readme.org │ └── wordWeights.txt ├── wireguard.nix └── wm │ ├── amethyst.nix │ ├── default.nix │ ├── eww │ ├── eww.scss │ ├── eww.yuck │ ├── readme.org │ └── wallpaper │ ├── readme.org │ ├── sketchybar │ ├── colors.sh │ ├── icons.sh │ ├── items │ │ ├── apple.sh │ │ ├── battery.sh │ │ ├── brew.sh │ │ ├── calendar.sh │ │ ├── cpu.sh │ │ ├── front_app.sh │ │ ├── github.sh │ │ ├── ical.sh │ │ ├── mail.sh │ │ ├── mic.sh │ │ ├── spaces.sh │ │ ├── volume.sh │ │ └── yabai.sh │ ├── janky-borders.nix │ ├── plugins │ │ ├── battery.sh │ │ ├── brew.sh │ │ ├── calendar.sh │ │ ├── github.sh │ │ ├── ical.sh │ │ ├── icon_map.sh │ │ ├── mail.sh │ │ ├── mic.sh │ │ ├── mic_click.sh │ │ ├── space.sh │ │ ├── volume.sh │ │ ├── volume_click.sh │ │ ├── yabai.sh │ │ └── zen.sh │ ├── readme.org │ └── sketchybarrc │ ├── skhdrc │ ├── xmonad.nix │ └── yabai.nix ├── packages ├── 30-apps.nix ├── alerter │ ├── alerter │ └── default.nix ├── ask │ └── release.nix ├── cabal.project ├── choose-mac.nix ├── dart.nix ├── default.nix ├── doc-server │ ├── CHANGELOG.md │ ├── LICENSE │ ├── app │ │ └── Main.hs │ └── doc-server.cabal ├── emojify.nix ├── font-hack-nerd-font.nix ├── gotta-go-fast.nix ├── hi-chew │ ├── .gitignore │ ├── CHANGELOG.md │ ├── app │ │ └── Main.hs │ ├── hi-chew.cabal │ └── release.nix ├── hosts.nix ├── ical-buddy.nix ├── pragmata-pro-font.nix ├── resource-id │ ├── ChangeLog.md │ ├── LICENSE │ ├── README.md │ ├── Setup.hs │ ├── app │ │ └── Main.hs │ ├── img │ │ └── demo.gif │ ├── release.nix │ ├── resource-id.cabal │ ├── src │ │ └── Lib.hs │ └── test │ │ └── Spec.hs ├── reveal-js.nix ├── sf_symbols.nix ├── sketchybar-app-font.nix ├── sketchybar-cpu-helper │ ├── default.nix │ └── helper │ │ ├── cpu.h │ │ ├── helper.c │ │ ├── makefile │ │ └── sketchybar.h ├── ws-access-token │ ├── app │ │ └── Main.hs │ ├── readme.org │ ├── release.nix │ ├── src │ │ └── WsAccessToken.hs │ ├── test │ │ └── Main.hs │ └── ws-access-token.cabal ├── xmonad │ ├── .gitignore │ ├── package.yaml │ ├── readme.org │ ├── xmobar.hs │ └── xmonad.hs └── yabai.nix ├── pictures ├── haskell-red-noise.png ├── meditate.png ├── mountains-clouds-landscape-4k-d6-3840x2400.jpg ├── nix-wallpaper-dracula.png ├── reiryoku.pdf └── reiryoku.svg ├── readme.org ├── screenshots └── macos.png ├── secrets ├── adguard-encryption-certificate.age ├── adguard-encryption-key.age ├── adguard.age ├── secret1.age ├── secrets.nix └── wireguard-server-private.age ├── treefmt.nix └── update /.git-crypt/.gitattributes: -------------------------------------------------------------------------------- 1 | # Do not edit this file. To specify the files to encrypt, create your own 2 | # .gitattributes file in the directory where your files are. 3 | * !filter !diff 4 | *.gpg binary 5 | -------------------------------------------------------------------------------- /.git-crypt/keys/default/0/5CFF43EABA5F369FB98454FF19AD3F6B1A5BF3BF.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/.git-crypt/keys/default/0/5CFF43EABA5F369FB98454FF19AD3F6B1A5BF3BF.gpg -------------------------------------------------------------------------------- /.git-crypt/keys/default/0/7FC898F31F83BEB3A863CA36BF2ADAA2A98F45E7.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/.git-crypt/keys/default/0/7FC898F31F83BEB3A863CA36BF2ADAA2A98F45E7.gpg -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | private/** filter=git-crypt diff=git-crypt 2 | .gitattributes !filter !diff 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: github-actions 5 | directory: "/" 6 | schedule: 7 | interval: daily 8 | time: '00:00' 9 | timezone: UTC 10 | open-pull-requests-limit: 10 11 | commit-message: 12 | prefix: "chore" 13 | include: "scope" 14 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: "build" 2 | on: 3 | pull_request: 4 | push: 5 | jobs: 6 | mac: 7 | runs-on: macos-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Install Nix 11 | uses: DeterminateSystems/nix-installer-action@main 12 | - uses: cachix/cachix-action@v16 13 | with: 14 | name: yuanwang-wf 15 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 16 | #https://github.com/github/roadmap/issues/528 17 | - run: nix develop 18 | -------------------------------------------------------------------------------- /.github/workflows/update-flake.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Update flake 3 | 4 | on: 5 | schedule: 6 | # every sunday at 8am UTC 7 | - cron: '0 0 * * FRI' 8 | 9 | jobs: 10 | update-dependencies: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: cachix/install-nix-action@v31 15 | with: 16 | extra_nix_config: | 17 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 18 | - uses: cachix/cachix-action@v16 19 | with: 20 | name: yuanw-nix-home-macos 21 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 22 | # Only needed for private caches 23 | #authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 24 | - name: Update flake.lock 25 | uses: DeterminateSystems/update-flake-lock@v25 26 | with: 27 | pr-title: "Update flake.lock" # Title of PR to be created 28 | pr-labels: | # Labels to be set on the PR 29 | automated - run: GITHUB_PATH= nix flake update 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.log 4 | tmp/ 5 | result 6 | .nix-script-cache/ 7 | .envrc 8 | 9 | nohup.out 10 | search.json.mozlz4 11 | search.json.mozlz4.backup 12 | id_ed25519 13 | # Local .terraform directories 14 | **/.terraform/* 15 | 16 | # .tfstate files 17 | *.tfstate 18 | *.tfstate.* 19 | 20 | # Exclude all .tfvars files, which are likely to contain sensitive data, such as 21 | # password, private keys, and other secrets. These should not be part of version 22 | # control as they are data points which are potentially sensitive and subject 23 | # to change depending on the environment. 24 | *.tfvars 25 | *.tfvars.json 26 | 27 | # Ignore override files as they are usually used to override resources locally and so 28 | # are not checked in 29 | override.tf 30 | override.tf.json 31 | *_override.tf 32 | *_override.tf.json 33 | 34 | # Include override files you do wish to add to version control using negated pattern 35 | # !example_override.tf 36 | 37 | # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan 38 | # example: *tfplan* 39 | 40 | # Ignore CLI configuration files 41 | .terraformrc 42 | terraform.rc 43 | .lego/ 44 | wireguard-keys 45 | AdGuardHome.yaml 46 | /.pre-commit-config.yaml 47 | 48 | ssh_host_ed25519_key.pub 49 | diff.json 50 | .aider* 51 | .env 52 | -------------------------------------------------------------------------------- /devshell.nix: -------------------------------------------------------------------------------- 1 | { 2 | perSystem = 3 | { config, pkgs, ... }: 4 | { 5 | devShells.default = pkgs.mkShell { 6 | buildInputs = with pkgs; [ 7 | nix-diff 8 | nix-tree 9 | treefmt 10 | #awscli 11 | #lego 12 | #terraform 13 | ]; 14 | # See https://haskell.flake.page/devshell#composing-devshells 15 | inputsFrom = [ 16 | config.treefmt.build.devShell 17 | config.pre-commit.devShell 18 | # config.haskellProjects.default.outputs.devShell 19 | 20 | ]; 21 | }; 22 | # devShells.haskell = pkgs.mkShell { 23 | # inputsFrom = [ 24 | # config.treefmt.build.devShell 25 | # config.pre-commit.devShell 26 | # config.haskellProjects.default.outputs.devShell 27 | # ]; 28 | # }; 29 | 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Yuan Nix-darwin/NixOS Home"; 3 | 4 | inputs = { 5 | nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; 6 | nixpkgs-master.url = "github:nixos/nixpkgs/master"; 7 | nixpkgs.url = "nixpkgs/nixos-unstable"; 8 | nixos-hardware.url = "github:NixOS/nixos-hardware/master"; 9 | nix-darwin = { 10 | url = "github:nix-darwin/nix-darwin/master"; 11 | inputs.nixpkgs.follows = "nixpkgs"; 12 | }; 13 | catppuccin.url = "github:catppuccin/nix"; 14 | devenv.url = "github:cachix/devenv"; 15 | flake-parts = { 16 | url = "github:hercules-ci/flake-parts"; 17 | inputs.nixpkgs-lib.follows = "nixpkgs"; 18 | }; 19 | hosts.url = "github:StevenBlack/hosts"; 20 | home-manager = { 21 | url = "github:nix-community/home-manager"; 22 | inputs.nixpkgs.follows = "nixpkgs"; 23 | }; 24 | haskell-flake.url = "github:srid/haskell-flake"; 25 | nur.url = "github:nix-community/NUR"; 26 | emacs = { 27 | url = "github:nix-community/emacs-overlay"; 28 | inputs.nixpkgs.follows = "nixpkgs"; 29 | }; 30 | emacs-plus = { 31 | url = "github:d12frosted/homebrew-emacs-plus"; 32 | flake = false; 33 | }; 34 | agenix = { 35 | url = "github:ryantm/agenix"; 36 | inputs.darwin.follows = "nix-darwin"; 37 | inputs.nixpkgs.follows = "nixpkgs"; 38 | }; 39 | treefmt-nix = { 40 | url = "github:numtide/treefmt-nix/?rev=9e09d30a644c57257715902efbb3adc56c79cf28"; 41 | inputs.nixpkgs.follows = "nixpkgs"; 42 | }; 43 | pre-commit = { 44 | url = "github:cachix/pre-commit-hooks.nix"; 45 | inputs.nixpkgs.follows = "nixpkgs"; 46 | }; 47 | mono-stretchly-darwin = { 48 | url = "github:yuanw/mono-stretchly"; 49 | }; 50 | shy-fox = { 51 | url = "github:Naezr/ShyFox"; 52 | flake = false; 53 | }; 54 | }; 55 | 56 | outputs = 57 | inputs@{ flake-parts, ... }: 58 | flake-parts.lib.mkFlake { inherit inputs; } { 59 | systems = [ 60 | "aarch64-darwin" 61 | "aarch64-linux" 62 | "x86_64-darwin" 63 | "x86_64-linux" 64 | ]; 65 | imports = [ 66 | ./devshell.nix 67 | ./hosts 68 | ./modules 69 | inputs.pre-commit.flakeModule 70 | inputs.treefmt-nix.flakeModule 71 | inputs.haskell-flake.flakeModule 72 | ]; 73 | perSystem = 74 | { system, ... }: 75 | { 76 | _module.args.pkgs = import inputs.nixpkgs { 77 | inherit system; 78 | config = { 79 | allowUnfree = true; 80 | }; 81 | }; 82 | haskellProjects.default = { 83 | projectRoot = ./packages; 84 | settings = { }; 85 | # overrides = self: super: { }; 86 | autoWire = [ 87 | "packages" 88 | "apps" 89 | ]; # Wire all but the devShell 90 | devShell = { 91 | hlsCheck.enable = false; 92 | }; 93 | }; 94 | 95 | treefmt.imports = [ ./treefmt.nix ]; 96 | # https://github.com/cachix/pre-commit-hooks.nix/blame/30d1c34bdbfe3dd0b8fbdde3962180c56cf16f12/flake-module.nix 97 | pre-commit.settings.hooks.treefmt.enable = true; 98 | 99 | }; 100 | }; 101 | } 102 | -------------------------------------------------------------------------------- /garnix.yaml: -------------------------------------------------------------------------------- 1 | builds: 2 | exclude: 3 | - 'packages.aarch64-darwin.asche' 4 | - 'packages.x86_64-linux.yuanw' 5 | - 'packages.x86_64-linux.ci' 6 | - 'packages.x86_64-linux.mist' 7 | - 'packages.aarch64-darwin.wk01174' 8 | - 'packages.aarch64-darwin.yuanw' 9 | - 'packages.aarch64-darwin.mist' 10 | - 'packages.x86_64-linux.wk01174' 11 | include: 12 | - '*.x86_64-linux.*' 13 | - defaultPackage.x86_64-linux 14 | - devShell.x86_64-linux 15 | - homeConfigurations.* 16 | - nixosConfigurations.* 17 | - packages.aarch64-darwin.* 18 | -------------------------------------------------------------------------------- /hosts/asche/configuration.nix: -------------------------------------------------------------------------------- 1 | # Edit this configuration file to define what should be installed on 2 | # your system. Help is available in the configuration.nix(5) man page 3 | # and in the NixOS manual (accessible by running ‘nixos-help’). 4 | 5 | { ... }: 6 | 7 | { 8 | imports = [ 9 | # Include the results of the hardware scan. 10 | ./hardware-configuration.nix 11 | ]; 12 | 13 | # nix = { 14 | # package = pkgs.nixUnstable; 15 | # extraOptions = '' 16 | # experimental-features = nix-command flakes 17 | # ''; 18 | # }; 19 | # Use the systemd-boot EFI boot loader. 20 | boot.loader.systemd-boot.configurationLimit = 5; 21 | boot.loader.systemd-boot.enable = true; 22 | boot.loader.efi.canTouchEfiVariables = true; 23 | 24 | networking.hostName = "asche"; # Define your hostname. 25 | # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. 26 | 27 | # The global useDHCP flag is deprecated, therefore explicitly set to false here. 28 | # Per-interface useDHCP will be mandatory in the future, so this generated config 29 | # replicates the default behaviour. 30 | networking.useDHCP = false; 31 | networking.interfaces.wlp0s20f3.useDHCP = true; 32 | 33 | # Configure network proxy if necessary 34 | # networking.proxy.default = "http://user:password@proxy:port/"; 35 | # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; 36 | 37 | # Select internationalisation properties. 38 | # i18n.defaultLocale = "en_US.UTF-8"; 39 | # console = { 40 | # font = "Lat2-Terminus16"; 41 | # keyMap = "us"; 42 | # }; 43 | 44 | # Enable the X11 windowing system. 45 | services.xserver.enable = true; 46 | 47 | # Enable the GNOME Desktop Environment. 48 | 49 | # services.xserver.displayManager.gdm = { 50 | # enable = true; 51 | 52 | # wayland = false; 53 | # }; 54 | # services.xserver.desktopManager.gnome.enable = true; 55 | 56 | # Configure keymap in X11 57 | # services.xserver.layout = "us"; 58 | # services.xserver.xkbOptions = "eurosign:e"; 59 | 60 | # Enable CUPS to print documents. 61 | # services.printing.enable = true; 62 | 63 | # Enable sound. 64 | # sound.enable = true; 65 | # hardware.pulseaudio.enable = true; 66 | 67 | # Enable touchpad support (enabled default in most desktopManager). 68 | # services.xserver.libinput.enable = true; 69 | 70 | # Define a user account. Don't forget to set a password with ‘passwd’. 71 | # users.users.yuanw = { 72 | # isNormalUser = true; 73 | # uid = 1000; 74 | # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 75 | # }; 76 | 77 | # List packages installed in system profile. To search, run: 78 | # $ nix search wget 79 | # environment.systemPackages = with pkgs; [ 80 | # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. 81 | # wget 82 | # firefox 83 | # emacs 84 | # git 85 | # ]; 86 | 87 | # Some programs need SUID wrappers, can be configured further or are 88 | # started in user sessions. 89 | # programs.mtr.enable = true; 90 | # programs.gnupg.agent = { 91 | # enable = true; 92 | # enableSSHSupport = true; 93 | # }; 94 | 95 | # List services that you want to enable: 96 | 97 | # Enable the OpenSSH daemon. 98 | # services.openssh.enable = true; 99 | 100 | # Open ports in the firewall. 101 | # networking.firewall.allowedTCPPorts = [ ... ]; 102 | # networking.firewall.allowedUDPPorts = [ ... ]; 103 | # Or disable the firewall altogether. 104 | # networking.firewall.enable = false; 105 | 106 | # This value determines the NixOS release from which the default 107 | # settings for stateful data, like file locations and database versions 108 | # on your system were taken. It‘s perfectly fine and recommended to leave 109 | # this value at the release version of the first install of this system. 110 | # Before changing this value read the documentation for this option 111 | # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). 112 | # system.stateVersion = "21.11"; # Did you read the comment? 113 | 114 | } 115 | -------------------------------------------------------------------------------- /hosts/asche/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | inputs, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | { 9 | imports = [ 10 | inputs.self.nixosModules.common 11 | inputs.self.nixosModules.linux 12 | inputs.nixos-hardware.nixosModules.dell-xps-13-9300 13 | ./configuration.nix 14 | ]; 15 | 16 | my = { 17 | username = "yuanw"; 18 | name = "Yuan Wang"; 19 | email = "me@yuanwang.ca"; 20 | hostname = "asche"; 21 | gpgKey = "BF2ADAA2A98F45E7"; 22 | homeDirectory = "/home/yuanw"; 23 | }; 24 | home-manager.users.${config.my.username} = { 25 | home.file = { 26 | ".config/pass-git-helper/git-pass-mapping.ini".text = '' 27 | [github.com*] 28 | target=github 29 | ''; 30 | }; 31 | programs = { 32 | password-store = { 33 | enable = true; 34 | }; 35 | rofi = { 36 | enable = true; 37 | terminal = "${pkgs.alacritty}/bin/alaritty"; 38 | theme = ../../modules/theme.rafi; 39 | }; 40 | git.extraConfig = { 41 | github.user = "yuanw"; 42 | credential.helper = "${pkgs.gitAndTools.pass-git-helper}/bin/pass-git-helper"; 43 | }; 44 | }; 45 | }; 46 | services.openssh.enable = true; 47 | services.autorandr = { 48 | enable = true; 49 | defaultTarget = "home"; 50 | profiles = { 51 | home = { 52 | fingerprint = { 53 | DP-3 = "00ffffffffffff001e6d0777aba10400091d0104b53c22789e3e31ae5047ac270c50542108007140818081c0a9c0d1c08100010101014dd000a0f0703e803020650c58542100001a286800a0f0703e800890650c58542100001a000000fd00383d1e8738000a202020202020000000fc004c472048445220344b0a20202001160203197144900403012309070783010000e305c000e3060501023a801871382d40582c450058542100001e565e00a0a0a029503020350058542100001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029"; 54 | eDP-1 = "00ffffffffffff004d10cc14000000002d1d0104b51d12780e6e60a95249a1260d50540000000101010101010101010101010101010172e700a0f06045903020360020b41000001828b900a0f06045903020360020b410000018000000fe004b384a3057804c513133345231000000000002410332011200000b010a2020014202030f00e3058000e606050160602800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa"; 55 | }; 56 | config = { 57 | eDP-1 = { 58 | enable = true; 59 | crtc = 0; 60 | position = "0x0"; 61 | mode = "3840x2400"; 62 | rate = "59.99"; 63 | }; 64 | DP-3 = { 65 | enable = true; 66 | crtc = 1; 67 | primary = true; 68 | mode = "3840x2160"; 69 | position = "3840x0"; 70 | rate = "60.00"; 71 | }; 72 | }; 73 | }; 74 | }; 75 | }; 76 | modules = { 77 | secrets.agenix = { 78 | enable = true; 79 | }; 80 | dev = { 81 | agda.enable = true; 82 | racket.enable = true; 83 | haskell.enable = false; 84 | python.enable = true; 85 | }; 86 | editors.emacs = { 87 | enable = true; 88 | #pkg = pkgs.emacs-unstable; 89 | }; 90 | qmk.enable = true; 91 | tmux.enable = true; 92 | terminal.enable = true; 93 | typing.enable = true; 94 | wm.xmonad.enable = true; 95 | browsers.firefox.enable = true; 96 | }; 97 | } 98 | -------------------------------------------------------------------------------- /hosts/asche/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { 5 | config, 6 | lib, 7 | modulesPath, 8 | ... 9 | }: 10 | 11 | { 12 | imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 13 | 14 | boot.initrd.availableKernelModules = [ 15 | "xhci_pci" 16 | "nvme" 17 | "usb_storage" 18 | "sd_mod" 19 | "rtsx_pci_sdmmc" 20 | ]; 21 | boot.initrd.kernelModules = [ ]; 22 | boot.kernelModules = [ "kvm-intel" ]; 23 | boot.extraModulePackages = [ ]; 24 | 25 | fileSystems."/" = { 26 | device = "/dev/disk/by-uuid/de4cbbbc-edff-4544-a7d9-3e14ca3ab8f9"; 27 | fsType = "ext4"; 28 | }; 29 | 30 | fileSystems."/boot" = { 31 | device = "/dev/disk/by-uuid/4303-BE37"; 32 | fsType = "vfat"; 33 | }; 34 | 35 | swapDevices = [ { device = "/dev/disk/by-uuid/40123da3-1a40-4150-a19e-93b8da6ee549"; } ]; 36 | 37 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 38 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 39 | # high-resolution display 40 | # hardware.video.hidpi.enable = lib.mkDefault true; 41 | } 42 | -------------------------------------------------------------------------------- /hosts/mist.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | pkgs, 5 | ... 6 | }: 7 | let 8 | nixCustomConf = pkgs.writeText "nix.custom.conf" '' 9 | lazy-trees = true 10 | substituters = https://cache.nixos.org https://nix-community.cachix.org https://yuanw-nix-home-macos.cachix.org https://cachix.org/api/v1/cache/yuanwang-wf https://cachix.org/api/v1/cache/devenv https://cache.garnix.io https://cache.iog.io https://cache.zw3rk.com https://cache.nixos.org/ 11 | trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= yuanwang-wf.cachix.org-1:P/RZ5Iuuuv2MYCNCnAsLfPGmgKMKeTwPaJclkrcwx80= devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= yuanw-nix-home-macos.cachix.org-1:6sDjrV0jQY6kRgXjXe0feuDtsxnoGDnkgvXuKma5JcQ= cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= 12 | trusted-substituters = https://cache.nixos.org https://nix-community.cachix.org https://yuanw-nix-home-macos.cachix.org https://cache.garnix.io https://cache.iog.io 13 | ''; 14 | in 15 | { 16 | 17 | imports = [ 18 | inputs.self.nixosModules.common 19 | inputs.self.nixosModules.darwin 20 | ../modules/private/jellyfin-darwin.nix 21 | 22 | ]; 23 | # determinate system 24 | nix.enable = false; 25 | my = { 26 | username = "yuanw"; 27 | name = "Yuan Wang"; 28 | hostname = "mist"; 29 | homeDirectory = "/Users/yuanw"; 30 | }; 31 | 32 | environment.etc."nix/nix.custom.conf".source = nixCustomConf; 33 | environment.systemPath = [ 34 | "/opt/homebrew/bin" 35 | "/opt/homebrew/sbin" 36 | ]; 37 | home-manager.users.${config.my.username}.programs = { 38 | go = { 39 | enable = true; 40 | goPath = "go"; 41 | }; 42 | git = { 43 | extraConfig = { 44 | github.user = "yuanw"; 45 | }; 46 | }; 47 | }; 48 | modules = { 49 | # common = { 50 | # enable = true; 51 | # supportLocalVirtualBuilder = true; 52 | # }; 53 | ai.enable = true; 54 | secrets.agenix = { 55 | enable = true; 56 | }; 57 | brew = { 58 | enable = true; 59 | casks = [ 60 | "1password" 61 | "betterdisplay" 62 | "racket" 63 | "protonvpn" 64 | ]; 65 | masApps = { 66 | "Fresh Eyes" = 6480411697; 67 | }; 68 | # taps = [ "homebrew/core" "homebrew/cask" ]; 69 | }; 70 | browsers.firefox = { 71 | enable = true; 72 | }; 73 | editors.emacs = { 74 | enable = true; 75 | enableLatex = false; 76 | enableService = true; 77 | # enableAider = true; 78 | # enableCopilot = true; 79 | lspStyle = "lsp-bridge"; 80 | }; 81 | # health.enable = true; 82 | typing.enable = true; 83 | jellyfin.enable = true; 84 | dev = { 85 | agda.enable = true; 86 | ask.enable = true; 87 | scheme.enable = true; 88 | #racket.enable = false; 89 | haskell.enable = false; 90 | idris2.enable = true; 91 | python.enable = true; 92 | zig.enable = false; 93 | }; 94 | 95 | tmux = { 96 | enable = true; 97 | mainWorkspaceDir = "$HOME/workspaces"; 98 | }; 99 | terminal = { 100 | enable = true; 101 | }; 102 | wm = { 103 | yabai.enable = true; 104 | yabai.enableJankyborders = true; 105 | }; 106 | }; 107 | } 108 | -------------------------------------------------------------------------------- /hosts/wk01174.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | ... 5 | }: 6 | { 7 | 8 | imports = [ 9 | inputs.self.nixosModules.common 10 | inputs.self.nixosModules.darwin 11 | ../modules/private/work.nix 12 | ]; 13 | 14 | my = { 15 | username = "yuanwang"; 16 | name = "Yuan Wang"; 17 | email = "yuan.wang@workiva.com"; 18 | hostname = "WK01174"; 19 | gpgKey = "19AD3F6B1A5BF3BF"; 20 | homeDirectory = "/Users/yuanwang"; 21 | }; 22 | #curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- repair sequoia --move-existing-users 23 | ids.uids.nixbld = 350; 24 | ids.gids.nixbld = 30000; 25 | environment.systemPath = [ 26 | "/opt/homebrew/bin" 27 | "/opt/homebrew/sbin" 28 | ]; 29 | home-manager.users.${config.my.username}.programs = { 30 | go = { 31 | enable = true; 32 | goPath = "go"; 33 | }; 34 | git = { 35 | extraConfig = { 36 | github.user = "yuanwang-wf"; 37 | # url."git@github.com:".insteadOf = "https://github.com"; 38 | }; 39 | }; 40 | }; 41 | modules = { 42 | # common = { 43 | # enable = true; 44 | # supportLocalVirtualBuilder = true; 45 | # }; 46 | ai.enable = true; 47 | secrets.agenix = { 48 | enable = true; 49 | }; 50 | brew = { 51 | enable = true; 52 | # taps = [ "homebrew/core" "homebrew/cask" ]; 53 | casks = [ 54 | "racket" 55 | "docker" 56 | "google-chrome" 57 | "slack" 58 | "sloth" 59 | "mysql-shell" 60 | "viscosity" 61 | "brave-browser" 62 | # "zoom" 63 | ]; 64 | brews = [ 65 | "redis" 66 | # Compose is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json: 67 | # "cliPluginsExtraDirs": [ 68 | # "$HOMEBREW_PREFIX/lib/docker/cli-plugins" 69 | # ] 70 | # ln -sfn $HOMEBREW_PREFIX/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose 71 | "docker-compose" 72 | ]; 73 | }; 74 | browsers.firefox = { 75 | enable = true; 76 | # pkg = pkgs.runCommand "firefox-0.0.0" { } "mkdir $out"; 77 | }; 78 | editors.emacs = { 79 | enable = true; 80 | enableService = true; 81 | enableLatex = true; 82 | 83 | #enableAider = true; 84 | # enableCopilot = true; 85 | #lspStyle = "lsp-bridge"; 86 | }; 87 | # health.enable = true; 88 | typing.enable = true; 89 | dev = { 90 | agda.enable = true; 91 | ask.enable = true; 92 | dart.enable = true; 93 | java.enable = true; 94 | scheme.enable = true; 95 | haskell.enable = true; 96 | idris2.enable = false; 97 | python.enable = true; 98 | zig.enable = false; 99 | racket.enable = false; 100 | kotlin.enable = true; 101 | }; 102 | tmux = { 103 | enable = true; 104 | mainWorkspaceDir = "$HOME/workspaces"; 105 | }; 106 | terminal = { 107 | enable = true; 108 | }; 109 | wm = { 110 | yabai.enable = true; 111 | yabai.enableJankyborders = true; 112 | }; 113 | 114 | work.enable = true; 115 | }; 116 | } 117 | -------------------------------------------------------------------------------- /hosts/yuan-mac.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | inputs, 5 | ... 6 | }: 7 | { 8 | imports = [ 9 | inputs.self.nixosModules.common 10 | inputs.self.nixosModules.darwin 11 | 12 | ]; 13 | 14 | home-manager.users.${config.my.username} = { 15 | programs.git = { 16 | extraConfig = { 17 | github.user = "yuanw"; 18 | }; 19 | }; 20 | home.packages = [ pkgs.qbittorrent ]; 21 | }; 22 | # determinate system 23 | nix.enable = false; 24 | my = { 25 | username = "yuanw"; 26 | name = "Yuan Wang"; 27 | email = "me@yuanwang.ca"; 28 | hostname = "yuanw"; 29 | gpgKey = "BF2ADAA2A98F45E7"; 30 | homeDirectory = "/Users/yuanw"; 31 | }; 32 | 33 | modules = { 34 | browsers.firefox = { 35 | enable = true; 36 | pkg = pkgs.firefox; 37 | }; 38 | editors.emacs = { 39 | enable = true; 40 | enableService = true; 41 | # TODO fix this 42 | enableAider = false; 43 | enableLatex = false; 44 | }; 45 | 46 | terminal.enable = true; 47 | wm.yabai.enable = true; 48 | brew = { 49 | enable = true; 50 | # taps = [ 51 | # "homebrew/core" 52 | # "homebrew/cask" 53 | # ]; 54 | casks = [ 55 | 56 | "1password" 57 | ]; 58 | }; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | host := `hostname -s` 2 | 3 | # build os 4 | build: 5 | nix build .#wk01174 6 | 7 | update-all: nix flake update 8 | 9 | update INPUT: 10 | nix flake update lock --update-input {{INPUT}} 11 | -------------------------------------------------------------------------------- /modules/.gitattributes: -------------------------------------------------------------------------------- 1 | private/** filter=git-crypt diff=git-crypt -------------------------------------------------------------------------------- /modules/.xmobarrc: -------------------------------------------------------------------------------- 1 | Config { font = "xft:PragmataPro:size=18:bold" 2 | , borderColor = "black" 3 | , border = TopB 4 | , bgColor = "black" 5 | , fgColor = "grey" 6 | , allDesktops = True 7 | , position = TopW L 100 8 | , commands = [ Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10 9 | -- Cpu usage in percent 10 | , Run Cpu ["-t", "\xf108 cpu: (%)","-H","50","--high","red"] 20 11 | -- Ram used number and percent 12 | , Run Memory ["-t", "\xf233 mem: M (%)"] 20 13 | -- Disk space free 14 | , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 15 | , Run Swap [] 10 16 | , Run Wireless "wlp0s20f3" [ ] 20 17 | , Run DynNetwork [] 10 18 | , Run Com "uname" ["-s","-r"] "" 36000 19 | , Run Date "\xf133 %a %b %_d %Y %H:%M:%S" "date" 10 20 | , Run Battery ["-t", ": % - ", 21 | "--",--"-c", "charge_full" 22 | "-O", "AC", 23 | "-o", "Bat", 24 | "-h", "green", 25 | "-l", "red"] 10 26 | ] 27 | , sepChar = "%" 28 | , alignSep = "}{" 29 | , template = " %battery% | %cpu% | %memory% * %swap% | %disku% | %date% | %uname% | %wlp0s20f3wi% %dynnetwork% " 30 | } 31 | -------------------------------------------------------------------------------- /modules/agenix.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | options, 5 | pkgs, 6 | ... 7 | }: 8 | let 9 | 10 | cfg = config.modules.secrets.agenix; 11 | # settings = { 12 | # block_auth_min = 10; 13 | # debug_pprof = true; 14 | # dns = { 15 | # bind_hosts = [ "0.0.0.0" ]; 16 | # # query logging 17 | # querylog_enabled = true; 18 | # querylog_file_enabled = true; 19 | # querylog_interval = "24h"; 20 | # querylog_size_memory = 1000; # entries 21 | # anonymize_client_ip = false; # for now 22 | 23 | # # adguard 24 | # protection_enabled = true; 25 | # blocking_mode = "default"; # NXDOMAIN 26 | # filtering_enabled = true; 27 | 28 | # # upstream DNS 29 | # upstream_dns = [ 30 | # "8.8.8.8" # google 31 | # "8.8.8.4" # google 32 | # ]; 33 | # # if upstream has any hostnames 34 | # bootstrap_dns = [ "192.168.1.1" ]; # ask the gateway 35 | # # caching 36 | # cache_size = 536870912; # 512 MB 37 | # cache_ttl_min = 1800; # 30 min 38 | # cache_optimistic = true; # return stale and then refresh 39 | 40 | in 41 | # }; 42 | # }; 43 | # user = "test"; 44 | # configFile = pkgs.writeTextFile { 45 | # name = "AdGuardHome.yaml"; 46 | # text = builtins.toJSON settings; 47 | # }; 48 | with lib; 49 | with builtins; 50 | { 51 | 52 | options = { 53 | modules.secrets.agenix = { 54 | enable = mkEnableOption "agenix"; 55 | }; 56 | }; 57 | config = mkIf cfg.enable (mkMerge [ 58 | { 59 | environment.systemPackages = with pkgs; [ 60 | agenix 61 | rage 62 | ]; 63 | } 64 | 65 | ( 66 | if (builtins.hasAttr "launchd" options) then 67 | { 68 | launchd.daemons.activate-agenix.serviceConfig = { 69 | StandardOutPath = "/tmp/agenix.log"; 70 | StandardErrorPath = "/tmp/agenix.log"; 71 | }; 72 | } 73 | else 74 | { 75 | # systemd 76 | } 77 | ) 78 | 79 | { 80 | age = { 81 | # secrets.secret1 = { 82 | # file = ../secrets/secret1.age; 83 | # # mode = "770"; 84 | # # owner = "yuanwang"; 85 | # # group = "admin"; 86 | # }; 87 | # secrets.adguard = { 88 | # file = ../secrets/adguard.age; 89 | # mode = "770"; 90 | # owner = "adguardhome-with-user"; 91 | # group = "admin"; 92 | }; 93 | # does not work well with ec-2 instance 94 | # identityPaths = options.age.identityPaths.default 95 | # ++ (filter pathExists [ 96 | # "${config.my.homeDirectory}/.ssh/id_ed25519" 97 | # "${config.my.homeDirectory}/.ssh/id_rsa" 98 | # ]); 99 | 100 | } 101 | ]); 102 | } 103 | -------------------------------------------------------------------------------- /modules/ai.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.ai; 11 | in 12 | { 13 | options.modules.ai = { 14 | enable = mkEnableOption "ai"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | # (pkgs.python3.withPackages (ps: 21 | # with ps; [ 22 | # huggingface-hub 23 | # ])) 24 | pkgs.ollama 25 | ]; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /modules/aws.nix: -------------------------------------------------------------------------------- 1 | { modulesPath, ... }: 2 | 3 | { 4 | 5 | imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ]; 6 | documentation.enable = false; 7 | nix = { 8 | settings = { 9 | trusted-users = [ "root" ]; 10 | substituters = [ 11 | "https://cache.nixos.org" 12 | "https://nix-community.cachix.org" 13 | "https://yuanw-nix-home-macos.cachix.org" 14 | "https://cachix.org/api/v1/cache/yuanwang-wf" 15 | "https://cachix.org/api/v1/cache/devenv" 16 | ]; 17 | trusted-substituters = [ 18 | "https://cache.nixos.org" 19 | "https://nix-community.cachix.org" 20 | "https://yuanw-nix-home-macos.cachix.org" 21 | ]; 22 | trusted-public-keys = [ 23 | "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" 24 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 25 | "yuanwang-wf.cachix.org-1:P/RZ5Iuuuv2MYCNCnAsLfPGmgKMKeTwPaJclkrcwx80=" 26 | "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" 27 | "yuanw-nix-home-macos.cachix.org-1:6sDjrV0jQY6kRgXjXe0feuDtsxnoGDnkgvXuKma5JcQ=" 28 | ]; 29 | 30 | }; 31 | # auto-optimise-store = true; 32 | gc = { 33 | automatic = true; 34 | dates = "weekly"; 35 | options = "--delete-older-than 10d"; 36 | }; 37 | }; 38 | 39 | system.stateVersion = "22.11"; 40 | services.fail2ban.enable = true; 41 | } 42 | -------------------------------------------------------------------------------- /modules/brew.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | ############ 3 | # Homebrew # 4 | ############ 5 | with lib; 6 | let 7 | cfg = config.modules.brew; 8 | in 9 | { 10 | options.modules.brew = { 11 | enable = mkEnableOption "brew"; 12 | # taps = mkOption { 13 | # type = types.listOf types.str; 14 | # default = [ "homebrew/core" "homebrew/cask" ]; 15 | # }; 16 | brews = mkOption { 17 | type = types.listOf types.str; 18 | default = [ ]; 19 | }; 20 | casks = mkOption { 21 | type = types.listOf types.str; 22 | default = [ ]; 23 | }; 24 | masApps = mkOption { 25 | type = with types; attrsOf ints.positive; 26 | default = { }; 27 | }; 28 | extraConfig = mkOption { 29 | type = types.lines; 30 | default = '' 31 | cask "firefox", args: { language: "en-CA" } 32 | ''; 33 | }; 34 | }; 35 | 36 | config = mkIf cfg.enable { 37 | homebrew.enable = true; 38 | homebrew.onActivation.autoUpdate = true; 39 | homebrew.onActivation.upgrade = true; 40 | homebrew.onActivation.cleanup = "zap"; 41 | homebrew.global.brewfile = true; 42 | homebrew.global.autoUpdate = true; 43 | homebrew.global.lockfiles = true; 44 | # homebrew.taps = cfg.taps; 45 | homebrew.brews = cfg.brews; 46 | homebrew.casks = cfg.casks; 47 | homebrew.masApps = cfg.masApps; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /modules/catppuccin.nix: -------------------------------------------------------------------------------- 1 | # https://git.sr.ht/~rycee/configurations/tree/master/item/user/catppuccin.nix 2 | { ... }: 3 | 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /modules/common.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | inputs', 4 | config, 5 | ... 6 | }: 7 | { 8 | nix = { 9 | # configureBuildUsers = true; 10 | settings = { 11 | trusted-users = [ 12 | "root" 13 | config.my.username 14 | ]; 15 | substituters = [ 16 | "https://cache.nixos.org" 17 | "https://nix-community.cachix.org" 18 | "https://yuanw-nix-home-macos.cachix.org" 19 | "https://cachix.org/api/v1/cache/yuanwang-wf" 20 | "https://cachix.org/api/v1/cache/devenv" 21 | "https://cache.garnix.io" 22 | "https://cache.iog.io" 23 | "https://cache.zw3rk.com" 24 | ]; 25 | trusted-substituters = [ 26 | "https://cache.nixos.org" 27 | "https://nix-community.cachix.org" 28 | "https://yuanw-nix-home-macos.cachix.org" 29 | "https://cache.garnix.io" 30 | "https://cache.iog.io" 31 | ]; 32 | trusted-public-keys = [ 33 | "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" 34 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 35 | "yuanwang-wf.cachix.org-1:P/RZ5Iuuuv2MYCNCnAsLfPGmgKMKeTwPaJclkrcwx80=" 36 | "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" 37 | "yuanw-nix-home-macos.cachix.org-1:6sDjrV0jQY6kRgXjXe0feuDtsxnoGDnkgvXuKma5JcQ=" 38 | "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" 39 | "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" 40 | "loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=" 41 | ]; 42 | # https://github.com/NixOS/nix/issues/7273 43 | # auto-optimise-store = true; 44 | max-jobs = 12; 45 | }; 46 | # Avoid unwanted garbage collection when using nix-direnv 47 | extraOptions = '' 48 | gc-keep-derivations = true 49 | gc-keep-outputs = true 50 | min-free = 17179870000 51 | max-free = 17179870000 52 | log-lines = 128 53 | 54 | experimental-features = nix-command flakes auto-allocate-uids 55 | keep-outputs = true 56 | keep-derivations = true 57 | fallback = true 58 | extra-trusted-users = ${config.my.username} 59 | ''; 60 | # trustedBinaryCaches = config.nix.binaryCaches; 61 | gc = { 62 | # automatic = true; 63 | # interval = { Hour = 24 * 7; }; 64 | }; 65 | }; 66 | nixpkgs = { 67 | config = { 68 | allowUnfree = true; 69 | allowBroken = false; 70 | allowUnsupportedSystem = true; 71 | }; 72 | overlays = [ 73 | inputs.emacs.overlay 74 | inputs.nur.overlays.default 75 | inputs.agenix.overlays.default 76 | (_final: _prev: { 77 | stable = inputs'.nixpkgs-stable.legacyPackages; 78 | 79 | # https://nixpk.gs/pr-tracker.html?pr=263500 80 | # https://gitlab.freedesktop.org/mesa/mesa/-/issues/8634 81 | # mesa = if _prev.stdenv.isDarwin then inputs.nixpkgs-stable.legacyPackages.${_prev.system}.mesa else 82 | # # reiryoku-firmware = inputs.reiryoku.packages.${prev.system}.firmware; 83 | # # devenv = inputs.devenv.packages.${prev.system}.devenv; 84 | 85 | # use this variant if unfree packages are needed: 86 | # unstable = import nixpkgs-unstable { 87 | # inherit system; 88 | # config.allowUnfree = true; 89 | # }; 90 | 91 | }) 92 | (import ../packages) 93 | ]; 94 | 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /modules/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | flake.nixosModules = { 4 | common.imports = [ 5 | ./agenix.nix 6 | ./ai.nix 7 | ./catppuccin.nix 8 | ./common.nix 9 | ./browsers/firefox.nix 10 | ./dev/agda.nix 11 | ./dev/ask.nix 12 | ./dev/dart.nix 13 | ./dev/haskell.nix 14 | ./dev/haxe.nix 15 | ./dev/idris2.nix 16 | ./dev/java.nix 17 | ./dev/julia.nix 18 | ./dev/kotlin.nix 19 | ./dev/node.nix 20 | ./dev/python.nix 21 | ./dev/racket.nix 22 | ./dev/zig.nix 23 | ./dev/scheme.nix 24 | ./helix.nix 25 | ./terminal-multiplexer/zellij.nix 26 | ./terminal-multiplexer/tmux.nix 27 | ./editor/emacs 28 | ./settings.nix 29 | ./terminal 30 | ./typing 31 | ]; 32 | 33 | linux.imports = [ 34 | ./qmk.nix 35 | ./nixos_system.nix 36 | ./wm/xmonad.nix 37 | ]; 38 | darwin.imports = [ 39 | ./brew.nix 40 | ./health.nix 41 | ./editor/emacs/emacs-macos.nix 42 | ./wm/yabai.nix 43 | ./macintosh.nix 44 | ]; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /modules/dev/agda.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.agda; 11 | in 12 | { 13 | options.modules.dev.agda = { 14 | enable = mkEnableOption "agda"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | # nixpkgs = { 19 | # overlays = [ 20 | # inputs.agda.overlay 21 | # ]; 22 | # }; 23 | home-manager.users.${config.my.username} = { 24 | # https://agda.readthedocs.io/en/v2.6.4/tools/package-system.html 25 | home.file = { 26 | "agda/defaults".text = "standard-library"; 27 | }; 28 | home.packages = [ 29 | (pkgs.agda.withPackages (p: [ 30 | p.standard-library 31 | ])) 32 | ]; 33 | programs = { 34 | zsh = { 35 | sessionVariables = { 36 | AGDA_DIR = "$XDG_CONFIG_HOME/agda"; 37 | }; 38 | }; 39 | }; 40 | # agda does not use xdg 41 | xdg.configFile = { 42 | "agda/defaults".text = "standard-library"; 43 | }; 44 | }; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /modules/dev/ask.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; 8 | let 9 | cfg = config.modules.dev.ask; 10 | in 11 | { 12 | 13 | options.modules.dev.ask = { 14 | enable = mkEnableOption "ask"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | 20 | home.packages = [ 21 | pkgs.haskellPackages.ask 22 | 23 | ]; 24 | }; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /modules/dev/dart.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.dart; 11 | in 12 | { 13 | options.modules.dev.dart = { 14 | enable = mkEnableOption "dart"; 15 | package = mkOption { 16 | type = types.package; 17 | default = pkgs.dart; 18 | defaultText = literalExpression "pkgs.dart"; 19 | description = '' 20 | dart package to install. 21 | ''; 22 | }; 23 | 24 | enableZshIntegration = mkOption { 25 | default = true; 26 | type = types.bool; 27 | description = '' 28 | Whether to enable Zsh integration. 29 | ''; 30 | }; 31 | 32 | }; 33 | 34 | config = mkIf cfg.enable { 35 | home-manager.users.${config.my.username} = { 36 | home.packages = [ cfg.package ]; 37 | home.sessionPath = [ 38 | "${config.my.homeDirectory}/.local/bin" 39 | "${config.my.homeDirectory}/.pub-cache/bin" 40 | ]; 41 | programs.zsh = mkIf cfg.enableZshIntegration { 42 | sessionVariables = { 43 | DART_SDK = "${cfg.package}"; 44 | }; 45 | shellAliases = { 46 | ddev = "pub run dart_dev"; 47 | pubcleanlock = ''git ls-files pubspec.lock --error-unmatch &>/dev/null && echo "Not removing pubspec.lock - it is tracked" || (rm pubspec.lock && echo "Removed pubspec.lock")''; 48 | pubclean = ''rm -r .pub .dart_tool/pub && echo "Removed .pub/"; find . -name packages | xargs rm -rf && echo "Removed packages/"; rm .packages && echo "Removed .packages"; pubcleanlock''; 49 | repub = "pubclean; pub get"; 50 | }; 51 | initContent = '' 52 | 53 | function dartUpgrade() { 54 | pub cache repair 55 | pub global activate dart_language_server 56 | pub global activate webdev_proxy 57 | pub global activate webdev 58 | } 59 | ''; 60 | }; 61 | }; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /modules/dev/haskell.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.haskell; 11 | in 12 | { 13 | options.modules.dev.haskell = { 14 | enable = mkEnableOption "haskell"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | pkgs.cabal-install 21 | pkgs.cabal2nix 22 | (pkgs.ghc.withPackages (p: [ 23 | p.attoparsec 24 | ])) 25 | ]; 26 | home.file = { 27 | ".ghci".text = '' 28 | :set prompt "λ> " 29 | :set prompt-cont "| " 30 | :def hoogle \x -> pure $ ":!hoogle search \"" ++ x ++ "\"" 31 | :set +t 32 | :set -XArrows 33 | :set -XBangPatterns 34 | :set -XBinaryLiterals 35 | :set -XBlockArguments 36 | :set -XConstraintKinds 37 | :set -XDataKinds 38 | :set -XDeriveTraversable 39 | :set -XDerivingVia 40 | :set -XEmptyCase 41 | :set -XEmptyDataDecls 42 | :set -XFlexibleContexts 43 | :set -XFlexibleInstances 44 | :set -XGADTs 45 | :set -XGeneralisedNewtypeDeriving 46 | :set -XImportQualifiedPost 47 | :set -XLambdaCase 48 | :set -XLiberalTypeSynonyms 49 | :set -XMonadComprehensions 50 | :set -XMultiWayIf 51 | :set -XNamedFieldPuns 52 | :set -XNumericUnderscores 53 | :set -XOverloadedStrings 54 | :set -XPatternSynonyms 55 | :set -XPolyKinds 56 | :set -XRankNTypes 57 | :set -XRecordWildCards 58 | :set -XRecursiveDo 59 | :set -XScopedTypeVariables 60 | :set -XStandaloneDeriving 61 | :set -XTupleSections 62 | :set -XTypeApplications 63 | :set -XTypeOperators 64 | :set -XUnicodeSyntax 65 | :set -XViewPatterns 66 | import Control.Applicative 67 | import Control.Arrow 68 | import Control.Lens 69 | import Control.Monad 70 | import Data.Bifunctor 71 | import Data.Bits 72 | import Data.Char 73 | import Data.Complex 74 | import Data.Either 75 | import Data.Foldable 76 | import Data.Function 77 | import Data.Functor 78 | import Data.Functor.Identity 79 | import Data.Ix 80 | import Data.List 81 | import Data.Map (Map) 82 | import Data.Map qualified as Map 83 | import Data.Maybe 84 | import Data.Monoid 85 | import Data.Ord 86 | import Data.Ratio 87 | import Data.Semigroup 88 | import Data.Set (Set) 89 | import Data.Set qualified as Set 90 | import Data.String 91 | import Data.Traversable 92 | import Data.Tuple 93 | import Data.Void 94 | import System.Environment 95 | import System.Exit 96 | import System.IO 97 | import System.Random 98 | import Text.Read 99 | ''; 100 | }; 101 | }; 102 | }; 103 | } 104 | -------------------------------------------------------------------------------- /modules/dev/haxe.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; 8 | let 9 | cfg = config.modules.dev.haxe; 10 | in 11 | { 12 | 13 | options.modules.dev.haxe = { 14 | enable = mkEnableOption "haxe"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ pkgs.haxe ]; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /modules/dev/idris2.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.idris2; 11 | in 12 | { 13 | options.modules.dev.idris2 = { 14 | enable = mkEnableOption "idris2"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | pkgs.idris2 21 | ]; 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /modules/dev/java.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.java; 11 | in 12 | { 13 | options.modules.dev.java = { 14 | enable = mkEnableOption "java"; 15 | pkg = mkOption { 16 | type = types.package; 17 | default = pkgs.jdk17; 18 | }; 19 | }; 20 | 21 | config = mkIf cfg.enable { 22 | home-manager.users.${config.my.username} = { 23 | home.packages = with pkgs; [ 24 | # (pkgs.gradle.override { java = cfg.pkg; }) 25 | # maven 26 | lombok 27 | google-java-format 28 | jdt-language-server 29 | # (pkgs.jdt-language-server.overrideAttrs ( 30 | # _finalAttrs: _previousAttrs: { 31 | # postPatch = '' 32 | # # We store the plugins, config, and features folder in different locations 33 | # # than in the original package. In addition, hard-code the path to the jdk 34 | # # in the wrapper, instead of searching for it in PATH at runtime. 35 | # substituteInPlace bin/jdtls.py \ 36 | # --replace "jdtls_base_path = Path(__file__).parent.parent" "jdtls_base_path = Path(\"$out/share/java/jdtls/\")" 37 | # ''; 38 | # } 39 | # )) 40 | 41 | ]; 42 | programs = { 43 | java = { 44 | package = cfg.pkg; 45 | enable = false; 46 | }; 47 | # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/libraries/java/lombok/default.nix#L26 48 | zsh = { 49 | sessionVariables = { 50 | LOMBOK_DIR = "${pkgs.lombok}/share/java"; 51 | }; 52 | }; 53 | }; 54 | }; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /modules/dev/julia.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.julia; 11 | in 12 | { 13 | options.modules.dev.julia = { 14 | enable = mkEnableOption "Julia"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ pkgs.juliaMac ]; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /modules/dev/kotlin.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.kotlin; 11 | in 12 | { 13 | options.modules.dev.kotlin = { 14 | enable = mkEnableOption "kotlin"; 15 | 16 | }; 17 | 18 | config = mkIf cfg.enable { 19 | home-manager.users.${config.my.username} = { 20 | home.packages = with pkgs; [ 21 | kotlin 22 | kotlin-language-server 23 | ktlint 24 | ]; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /modules/dev/node.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.node; 11 | in 12 | { 13 | options.modules.dev.node = { 14 | enable = mkEnableOption "node"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | pkgs.nodejs 21 | pkgs.yarn 22 | ] ++ (with pkgs.nodePackages; [ prettier ]); 23 | }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /modules/dev/python.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.dev.python; 11 | in 12 | { 13 | options.modules.dev.python = { 14 | enable = mkEnableOption "python"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username}.home.packages = [ 19 | pkgs.micromamba 20 | (pkgs.python3.withPackages ( 21 | ps: with ps; [ 22 | pip 23 | #ipython 24 | black 25 | pandas 26 | numpy 27 | isort 28 | #jupyter 29 | sortedcontainers 30 | setuptools 31 | pylint 32 | matplotlib 33 | # poetry 34 | pytest 35 | pyflakes 36 | # pylsp-mypy 37 | virtualenv 38 | virtualenvwrapper 39 | opentype-feature-freezer 40 | #litellm 41 | #tokenizers 42 | ] 43 | )) 44 | ]; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /modules/dev/racket.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; 8 | let 9 | cfg = config.modules.dev.racket; 10 | in 11 | { 12 | 13 | options.modules.dev.racket = { 14 | enable = mkEnableOption "racket"; 15 | }; 16 | # https://wingolog.org/archives/2013/01/07/an-opinionated-guide-to-scheme-implementations 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | # http://wiki.call-cc.org/man/5/Using%20the%20interpreter 20 | home.packages = [ pkgs.racket-minimal ]; 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /modules/dev/scheme.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; 8 | let 9 | cfg = config.modules.dev.scheme; 10 | in 11 | { 12 | 13 | options.modules.dev.scheme = { 14 | enable = mkEnableOption "scheme"; 15 | }; 16 | # https://wingolog.org/archives/2013/01/07/an-opinionated-guide-to-scheme-implementations 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | # http://wiki.call-cc.org/man/5/Using%20the%20interpreter 20 | home.packages = [ 21 | pkgs.chicken 22 | pkgs.guile 23 | ]; 24 | }; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /modules/dev/zig.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; 8 | let 9 | cfg = config.modules.dev.zig; 10 | in 11 | { 12 | 13 | options.modules.dev.zig = { 14 | enable = mkEnableOption "zig"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | pkgs.zig 21 | pkgs.zls 22 | ]; 23 | }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /modules/editor/emacs/emacs-macos.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | let 3 | emacsPackage = config.home-manager.users.${config.my.username}.programs.emacs.finalPackage; 4 | in 5 | with lib; 6 | { 7 | config = mkIf config.modules.editors.emacs.enableService { 8 | launchd.user.agents.emacs.path = [ 9 | config.environment.systemPath 10 | "${config.my.homeDirectory}/.nix-profile/bin" 11 | ]; 12 | 13 | launchd.user.agents.emacs.serviceConfig = { 14 | KeepAlive = true; 15 | ProgramArguments = [ 16 | "/bin/zsh" 17 | "-c" 18 | "{ osascript -e 'display notification \"Attempting to start Emacs...\" with title \"Emacs Launch\"'; /bin/wait4path ${emacsPackage}/bin/emacs && { ${emacsPackage}/bin/emacs --fg-daemon; if [ $? -eq 0 ]; then osascript -e 'display notification \"Emacs has started.\" with title \"Emacs Launch\"'; else osascript -e 'display notification \"Failed to start Emacs.\" with title \"Emacs Launch\"' >&2; fi; } } &> /tmp/emacs.log" 19 | ]; 20 | StandardErrorPath = "/tmp/emacs.log"; 21 | StandardOutPath = "/tmp/emacs.log"; 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/aider.nix: -------------------------------------------------------------------------------- 1 | { 2 | melpaBuild, 3 | fetchFromGitHub, 4 | writeText, 5 | unstableGitUpdater, 6 | # Elisp dependencies 7 | 8 | # Native dependencies 9 | ... 10 | }: 11 | 12 | let 13 | pname = "aider"; 14 | version = "0.0.1"; 15 | in 16 | melpaBuild { 17 | inherit pname version; 18 | src = fetchFromGitHub { 19 | owner = "tninja"; 20 | repo = "aider.el"; 21 | rev = "515f5cbb505e614f400c21f99bdbebd47609c659"; 22 | #sha256 = lib.fakeSha256; 23 | sha256 = "sha256-NTkpiG0w/Bmo2CjlCLIA/6+feWcDQ/+IGPNy3Ml/AbA="; 24 | }; 25 | 26 | dontConfigure = true; 27 | dontBuild = true; 28 | passthru.updateScript = unstableGitUpdater { }; 29 | 30 | installPhase = '' 31 | mkdir -p $out/share/emacs/site-lisp/elpa/$pname-$version 32 | cp -rv * $out/share/emacs/site-lisp/elpa/$pname-$version/ 33 | ''; 34 | 35 | recipe = writeText "recipe" '' 36 | (aider 37 | :repo "tninja/aider.el" 38 | :files ("*.el") 39 | :fetcher github) 40 | ''; 41 | 42 | packageRequires = [ 43 | 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/ask-mode/ask-mode.patch: -------------------------------------------------------------------------------- 1 | From cf2770cdae7f73c651cd907c36fb7fbff760d9f6 Mon Sep 17 00:00:00 2001 2 | From: yuanw 3 | Date: Sat, 1 Mar 2025 18:07:55 -0600 4 | Subject: [PATCH] rename ask-mode 5 | 6 | --- 7 | emacs/{ask.el => ask-mode.el} | 1 + 8 | 1 file changed, 1 insertion(+) 9 | rename emacs/{ask.el => ask-mode.el} (98%) 10 | 11 | diff --git a/emacs/ask.el b/emacs/ask-mode.el 12 | similarity index 98% 13 | rename from emacs/ask.el 14 | rename to emacs/ask-mode.el 15 | index 72e5506..df0ec16 100755 16 | --- a/emacs/ask.el 17 | +++ b/emacs/ask-mode.el 18 | @@ -1,3 +1,4 @@ 19 | +;;; ask-mode.el --- Major mode for Ask 20 | ;;(require 'compile) 21 | 22 | ;; based on: http://ergoemacs.org/emacs/elisp_syntax_coloring.html 23 | -- 24 | 2.48.1 25 | 26 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/ask-mode/default.nix: -------------------------------------------------------------------------------- 1 | { melpaBuild, haskellPackages }: 2 | let 3 | Ask = haskellPackages.ask; 4 | in 5 | melpaBuild { 6 | pname = "ask-mode"; 7 | inherit (Ask) src version; 8 | patches = [ ./ask-mode.patch ]; 9 | 10 | files = ''("emacs/*.el")''; 11 | 12 | meta = { 13 | inherit (Ask.meta) homepage license; 14 | description = "Ask-mode for Emacs extracted from Ask package"; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/consult-omni/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | melpaBuild, 3 | fetchFromGitHub, 4 | writeText, 5 | unstableGitUpdater, 6 | # Elisp dependencies 7 | 8 | consult, 9 | elfeed, 10 | embark, 11 | browser-hist, 12 | consult-notes, 13 | yequake, 14 | ... 15 | 16 | }: 17 | 18 | let 19 | pname = "consult-omni"; 20 | version = "0.0.1"; 21 | 22 | in 23 | melpaBuild { 24 | 25 | inherit pname version; 26 | src = fetchFromGitHub { 27 | owner = "armindarvish"; 28 | repo = "consult-omni"; 29 | rev = "6e214cb29cf98a23230bf3633a07d46a328d0245"; 30 | # sha256 = lib.fakeSha256; 31 | sha256 = "sha256-vAis6/U70PWuyl4NNg6uC5RfOFZYVy1g+nlvmi2f1jo="; 32 | }; 33 | 34 | dontConfigure = true; 35 | dontBuild = true; 36 | passthru.updateScript = unstableGitUpdater { }; 37 | 38 | installPhase = '' 39 | mkdir -p $out/share/emacs/site-lisp/elpa/$pname-$version 40 | cp -rv * $out/share/emacs/site-lisp/elpa/$pname-$version/ 41 | ''; 42 | 43 | recipe = writeText "recipe" '' 44 | (consult-omni 45 | :repo "armindarvish/consult-omni" 46 | :files ("*.el" "sources" ) 47 | :fetcher github 48 | ''; 49 | propagatedUserEnvPkgs = [ 50 | yequake 51 | ]; 52 | buildInputs = [ yequake ]; 53 | packageRequires = [ 54 | consult 55 | consult-notes 56 | elfeed 57 | embark 58 | browser-hist 59 | yequake 60 | ]; 61 | } 62 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/copilot-emacs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | fetchFromGitHub, 3 | # Elisp dependencies 4 | dash, 5 | editorconfig, 6 | s, 7 | f, 8 | jsonrpc, 9 | # Native dependencies 10 | nodejs, 11 | trivialBuild, 12 | }: 13 | trivialBuild { 14 | pname = "copilot"; 15 | version = "unstable-2024-04-05"; 16 | src = fetchFromGitHub { 17 | owner = "copilot-emacs"; 18 | repo = "copilot.el"; 19 | rev = "5f30a2b667df03c120ba31ce3af933255c8a558b"; 20 | sha256 = "sha256-28pTCggQyVIn5pA260VokYjH5kaypBrG3FDphfzXJcU="; 21 | }; 22 | # TODO wrap nodejs with copilot dependencies, just like in lsp-brigt 23 | packageRequires = [ 24 | dash 25 | editorconfig 26 | nodejs 27 | s 28 | f 29 | jsonrpc 30 | ]; 31 | 32 | meta = { 33 | description = "An unofficial copilot plugin for Emacs"; 34 | homepage = "https://github.com/zerolfx/copilot.el"; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/emacs-reveal.nix: -------------------------------------------------------------------------------- 1 | { 2 | trivialBuild, 3 | fetchFromGitLab, 4 | lib, 5 | 6 | }: 7 | trivialBuild rec { 8 | pname = "auto-save"; 9 | version = "9.37.4"; 10 | src = fetchFromGitLab { 11 | fetchSubmodules = true; 12 | owner = "oer"; 13 | repo = "emacs-reveal"; 14 | rev = "a201482cd7244cd736e614dd14a394e733509142"; 15 | sha256 = lib.fakeSha256; 16 | # sha256 = "sha256-MCa28kGMBKLA/WqcDgJVtbul//R80nwWuI757wc12KI="; 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/hurl-mode.nix: -------------------------------------------------------------------------------- 1 | { 2 | melpaBuild, 3 | fetchFromGitHub, 4 | writeText, 5 | unstableGitUpdater, 6 | # Elisp dependencies 7 | 8 | # Native dependencies 9 | ... 10 | }: 11 | 12 | let 13 | pname = "hurl-mode"; 14 | version = "0-unstable-2025-02"; 15 | in 16 | melpaBuild { 17 | inherit pname version; 18 | src = fetchFromGitHub { 19 | owner = "JasZhe"; 20 | repo = "hurl-mode"; 21 | rev = "df03471e48fb1ca39050d23d61c79ae901e8d68f"; 22 | # sha256 = lib.fakeSha256; 23 | sha256 = "sha256-EauCBuqIFhvY5e0lPn9sFFo4K918Rc6Xx9myZTaAXxc="; 24 | }; 25 | 26 | dontConfigure = true; 27 | dontBuild = true; 28 | passthru.updateScript = unstableGitUpdater { }; 29 | 30 | installPhase = '' 31 | mkdir -p $out/share/emacs/site-lisp/elpa/$pname-$version 32 | cp -rv * $out/share/emacs/site-lisp/elpa/$pname-$version/ 33 | ''; 34 | 35 | recipe = writeText "recipe" '' 36 | (hurl-mode 37 | :repo "jaszhe/hurl-mode" 38 | :files ("*.el") 39 | :fetcher github) 40 | ''; 41 | 42 | packageRequires = [ 43 | 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/lsp-bridge/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | melpaBuild, 3 | fetchFromGitHub, 4 | writeText, 5 | replaceVars, 6 | unstableGitUpdater, 7 | # Elisp dependencies 8 | 9 | markdown-mode, 10 | yasnippet, 11 | 12 | # Native dependencies 13 | python3, 14 | 15 | }: 16 | 17 | let 18 | # epc orjson sexpdata six setuptools paramiko rapidfuzz 19 | 20 | pythonEnv = ( 21 | (python3.withPackages (ps: [ 22 | ps.epc 23 | ps.orjson 24 | ps.paramiko 25 | ps.rapidfuzz 26 | ps.sexpdata 27 | 28 | ])).override 29 | { ignoreCollisions = true; } 30 | ); 31 | 32 | pname = "lsp-bridge"; 33 | version = "20240416.0"; 34 | 35 | in 36 | melpaBuild { 37 | 38 | inherit pname version; 39 | src = fetchFromGitHub { 40 | owner = "manateelazycat"; 41 | repo = "lsp-bridge"; 42 | rev = "0345cc6534c9ada91dbd93d58ea965ff542b1369"; 43 | # sha256 = lib.fakeSha256; 44 | sha256 = "sha256-ZG3ZhhqDtL7M7x5XRr8Qb6mFlFndMWq5QPbtYLblXcs="; 45 | }; 46 | 47 | dontConfigure = true; 48 | dontBuild = true; 49 | passthru.updateScript = unstableGitUpdater { }; 50 | 51 | patches = [ 52 | # Hardcode the python dependencies needed for lsp-bridge, so users 53 | # don't have to modify their global environment 54 | (replaceVars ./hardcode-dependencies.patch { 55 | python = pythonEnv.interpreter; 56 | }) 57 | ]; 58 | 59 | installPhase = '' 60 | rm -r test 61 | mkdir -p $out/share/emacs/site-lisp/elpa/$pname-$version 62 | cp -rv * $out/share/emacs/site-lisp/elpa/$pname-$version/ 63 | ''; 64 | 65 | recipe = writeText "recipe" '' 66 | (lsp-bridge 67 | :repo "manateelazycat/lsp-bridge" 68 | :files ("*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources") 69 | :fetcher github) 70 | ''; 71 | 72 | packageRequires = [ 73 | markdown-mode 74 | yasnippet 75 | 76 | ]; 77 | } 78 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/lsp-bridge/hardcode-dependencies.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lsp-bridge.el b/lsp-bridge.el 2 | index 278c27e..f0c67c2 100644 3 | --- a/lsp-bridge.el 4 | +++ b/lsp-bridge.el 5 | @@ -340,19 +340,7 @@ Setting this to nil or 0 will turn off the indicator." 6 | "Name of LSP-Bridge buffer." 7 | :type 'string) 8 | 9 | -(defcustom lsp-bridge-python-command (cond ((memq system-type '(cygwin windows-nt ms-dos)) 10 | - (cond ((executable-find "pypy3.exe") 11 | - "pypy3.exe") 12 | - ((executable-find "python3.exe") 13 | - "python3.exe") 14 | - ((executable-find "python.exe") 15 | - "python.exe"))) 16 | - (t (cond ((executable-find "pypy3") 17 | - "pypy3") 18 | - ((executable-find "python3") 19 | - "python3") 20 | - ((executable-find "python") 21 | - "python")))) 22 | +(defcustom lsp-bridge-python-command "@python@" 23 | "The Python interpreter used to run lsp_bridge.py." 24 | :type 'string) 25 | 26 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/lspce.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | f, 4 | fetchFromGitHub, 5 | markdown-mode, 6 | rustPlatform, 7 | trivialBuild, 8 | yasnippet, 9 | }: 10 | 11 | let 12 | version = "unstable-2024-04-27"; 13 | 14 | src = fetchFromGitHub { 15 | owner = "zbelial"; 16 | repo = "lspce"; 17 | 18 | rev = "a5e27ba7e9add9ad09804572d04810ba6568c666"; 19 | hash = "sha256-m353lvhxgE3zbgPKXD9x5lmCq+9GGxuAn4lOi5fUAcc="; 20 | }; 21 | 22 | meta = { 23 | homepage = "https://github.com/zbelial/lspce"; 24 | description = "LSP Client for Emacs implemented as a module using rust"; 25 | license = lib.licenses.gpl3Only; 26 | maintainers = [ ]; 27 | }; 28 | 29 | lspce-module = rustPlatform.buildRustPackage { 30 | inherit version src meta; 31 | pname = "lspce-module"; 32 | cargoHash = "sha256-3Ch2PFYf5fwTuHQIvy9frbZ5NNJJfNzxqqHjMXGFuqk="; 33 | checkFlags = [ 34 | # flaky test 35 | "--skip=msg::tests::serialize_request_with_null_params" 36 | ]; 37 | 38 | postInstall = '' 39 | mkdir -p $out/share/emacs/site-lisp 40 | for f in $out/lib/*; do 41 | mv $f $out/share/emacs/site-lisp/lspce-module.''${f##*.} 42 | done 43 | rmdir $out/lib 44 | ''; 45 | }; 46 | in 47 | trivialBuild rec { 48 | inherit version src meta; 49 | pname = "lspce"; 50 | 51 | buildInputs = propagatedUserEnvPkgs; 52 | 53 | propagatedUserEnvPkgs = [ 54 | f 55 | markdown-mode 56 | yasnippet 57 | lspce-module 58 | ]; 59 | 60 | passthru = { 61 | inherit lspce-module; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/ob-racket.nix: -------------------------------------------------------------------------------- 1 | { 2 | melpaBuild, 3 | fetchFromGitHub, 4 | writeText, 5 | unstableGitUpdater, 6 | # Elisp dependencies 7 | 8 | # Native dependencies 9 | ... 10 | }: 11 | 12 | let 13 | pname = "ob-racket"; 14 | version = "1.3.1"; 15 | in 16 | melpaBuild { 17 | inherit pname version; 18 | src = fetchFromGitHub { 19 | owner = "hasu"; 20 | repo = "emacs-ob-racket"; 21 | rev = "c7b7eee58fcde2ad515b72288742e555e7ec7915"; 22 | #sha256 = lib.fakeSha256; 23 | sha256 = "sha256-yv+PP1JyEvMxEToNbgDbgWih/GHdauwfYLzPaEPsEC8="; 24 | }; 25 | 26 | dontConfigure = true; 27 | dontBuild = true; 28 | passthru.updateScript = unstableGitUpdater { }; 29 | 30 | installPhase = '' 31 | mkdir -p $out/share/emacs/site-lisp/elpa/$pname-$version 32 | cp -rv * $out/share/emacs/site-lisp/elpa/$pname-$version/ 33 | ''; 34 | 35 | recipe = writeText "recipe" '' 36 | (ob-racket 37 | :repo "hasu/emacs-ob-racket" 38 | :files ("*.el" "*.rkt") 39 | :fetcher github) 40 | ''; 41 | 42 | packageRequires = [ 43 | 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/transient-showcase.nix: -------------------------------------------------------------------------------- 1 | { 2 | trivialBuild, 3 | fetchFromGitHub, 4 | transient, 5 | }: 6 | trivialBuild rec { 7 | pname = "transient-showcase"; 8 | version = "0.0.1"; 9 | src = fetchFromGitHub { 10 | owner = "positron-solutions"; 11 | repo = "transient-showcase"; 12 | rev = "814b85eab2bbfffd827502ce830f72ff82fd3ae9"; 13 | sha256 = "sha256-YH3qlezGsi9FtF4OocwF/K4MG+GVrv4tw53E6gjwtok="; 14 | }; 15 | # elisp dependencies 16 | propagatedUserEnvPkgs = [ 17 | transient 18 | ]; 19 | buildInputs = propagatedUserEnvPkgs; 20 | } 21 | -------------------------------------------------------------------------------- /modules/editor/emacs/packages/wm.el: -------------------------------------------------------------------------------- 1 | (require 'hydra) 2 | (require 'ace-window) 3 | (require 'winner) 4 | 5 | (defhydra my-window-movement () 6 | "window movement" 7 | ("o" other-window "next") 8 | ("*" enlarge-window "h+" ) 9 | ("@" shrink-window "h-" ) 10 | ("$" enlarge-window-horizontally "w+" ) 11 | ("^" shrink-window-horizontally "w-" ) 12 | ("f" find-file-other-window "other file") 13 | 14 | ("d" delete-other-windows :color blue) 15 | ("j" ace-window "ace-window") 16 | ("v" (lambda () 17 | (interactive) 18 | (split-window-right) 19 | (windmove-right)) "split right") 20 | ("s" (lambda () 21 | (interactive) 22 | (split-window-below) 23 | (windmove-down)) "below") 24 | ("k" delete-window "delete") 25 | ("r" winner-redo "redo") 26 | ("u" winner-undo "undo") 27 | ("D" ace-delete-window "ace delete") ;; TODO not working 28 | ("m" ace-maximize-window "maximize" :color blue) ;; TODO not working 29 | ("q" nil "cancel")) 30 | 31 | (winner-mode 1) 32 | (global-set-key (kbd "C-c w") 'my-window-movement/body) 33 | (provide 'wm) 34 | -------------------------------------------------------------------------------- /modules/editor/emacs/readme.org: -------------------------------------------------------------------------------- 1 | * Emacs 2 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/@param: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: param 3 | # key: @param 4 | # uuid: @param 5 | # condition: (sp-point-in-comment) 6 | # -- 7 | @param ${1:paramater} $0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/@return: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: return 3 | # key: @return 4 | # uuid: @return 5 | # condition: (sp-point-in-comment) 6 | # -- 7 | @return ${1:description} -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/apr_assert: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: apr_assert 3 | # key: apr_assert 4 | # uuid: apr_assert 5 | # -- 6 | if (Globals.useAssertions) { 7 | ${1:assert ..}; 8 | } 9 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/assertj: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: assertj assertThat 3 | # -- 4 | Assertions.assertThat( -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: class 3 | # key: class 4 | # uuid: class 5 | # -- 6 | public class ${1:`(file-name-base 7 | (or (buffer-file-name) 8 | (buffer-name)))`} { 9 | $0 10 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/constructor: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: constructor 3 | # key: __init__ 4 | # uuid: __init__ 5 | # -- 6 | public ${1:`(f-base buffer-file-name)`}($2) { 7 | $0 8 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/doc: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: doc 3 | # key: /* 4 | # uuid: /* 5 | # condition: (not (use-region-p)) 6 | # -- 7 | /** 8 | * $0 9 | */ -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/equals: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: equals 3 | # key: eq 4 | # uuid: eq 5 | # -- 6 | public boolean equals(${1:Class} other) { 7 | $0 8 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/file_class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: file_class 3 | # key: file 4 | # uuid: file 5 | # -- 6 | public class ${1:`(file-name-base 7 | (or (buffer-file-name) 8 | (buffer-name)))`} { 9 | $0 10 | } 11 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: for 3 | # key: for 4 | # uuid: for 5 | # -- 6 | for (${1:int i = 0}; ${2:i < N}; ${3:i++}) { 7 | `%`$0 8 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/foreach: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: foreach 3 | # key: fore 4 | # uuid: fore 5 | # -- 6 | for (${1:Object} ${2:var} : ${3:iterator}) { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: if 3 | # key: if 4 | # uuid: if 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | if (${1:true}) { 8 | $0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/ife: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ife 3 | # key: ife 4 | # uuid: ife 5 | # -- 6 | if (${1:true}) { 7 | `%`$2 8 | } else { 9 | $0 10 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/import: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: import 3 | # -- 4 | import ${1:System.}; 5 | $0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/import-assertj: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: import assertj 3 | # -- 4 | import org.assertj.core.api.Assertions; 5 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/interface: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: interface 3 | # key: interface 4 | # uuid: interface 5 | # -- 6 | public interface ${1:`(file-name-base (or (buffer-file-name) 7 | (buffer-name)))`} { 8 | $0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/iterator: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: iterator 3 | # key: iterator 4 | # uuid: iterator 5 | # -- 6 | public Iterator<${1:type}> iterator() { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/javadoc: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: javadoc 3 | # key: doc 4 | # uuid: doc 5 | # -- 6 | /** 7 | * $0 8 | * 9 | */ -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/lombok-log: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: lombok log 3 | # -- 4 | 5 | import lombok.extern.slf4j.Slf4j; 6 | @Slf4j 7 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/main: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: main 3 | # key: main 4 | # uuid: main 5 | # -- 6 | public static void main(String[] args) { 7 | $0 8 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/method: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: method 3 | # key: method 4 | # uuid: method 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | ${1:void} ${2:name}($3) { 8 | $0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/method@: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: @Override method 3 | # key: method@ 4 | # uuid: method@ 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | @Override ${1:public} ${2:void} ${3:methodName}($4) { 8 | $0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/new: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: new 3 | # key: new 4 | # uuid: new 5 | # -- 6 | ${1:Type} ${2:obj} = new ${3:$1}($4);$0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/paintComponent: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: paintComponent (Swing) 3 | # key: paintComponent 4 | # uuid: paintComponent 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | @Override public void paintComponent(Graphics g) { 8 | `%`$0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/printf: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: printf 3 | # key: printf 4 | # uuid: printf 5 | # -- 6 | System.out.printf("`%`$0%n"); -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/println: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: println 3 | # key: println 4 | # uuid: println 5 | # -- 6 | System.out.println("`%`$0"); -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/private: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: private 3 | # key: pri 4 | # uuid: pri 5 | # -- 6 | private $0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/protected: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: protected 3 | # key: pr 4 | # uuid: pr 5 | # -- 6 | protected $0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/public: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: public 3 | # key: p 4 | # uuid: p 5 | # -- 6 | public $0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/return: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: return 3 | # key: ret 4 | # uuid: ret 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | return `%`$0; -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/test: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: test 3 | # key: test 4 | # uuid: test 5 | # -- 6 | @Test 7 | public void test_${1:Case}() { 8 | $0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/testClass: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: testClass 3 | # key: tc 4 | # uuid: tc 5 | # -- 6 | import junit.framework.*; 7 | import junit.textui.*; 8 | 9 | public class Test${1:Class} extends TestCase { 10 | protected void setUp() { 11 | $0 12 | } 13 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/this: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: this 3 | # key: . 4 | # uuid: . 5 | # -- 6 | this.$0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/toString: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: toString 3 | # key: toStr 4 | # uuid: toStr 5 | # -- 6 | public String toString() { 7 | $0 8 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/try: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: try 3 | # key: try 4 | # uuid: try 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | try { 8 | `%`$0 9 | } catch (${1:Throwable} e) { 10 | ${2:System.out.println("Error " + e.getMessage()); 11 | e.printStackTrace();} 12 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/var: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: variable declaration 3 | # key: var 4 | # uuid: var 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | ${1:int} ${2:variable} -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/var=: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: variable declaration & assignment 3 | # key: var= 4 | # uuid: var= 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | ${1:int} ${2:variable} = `%`$0; -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/void: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: void 3 | # key: v 4 | # uuid: v 5 | # -- 6 | void $0 -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/java-mode/while: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: while loop 3 | # key: while 4 | # uuid: while 5 | # condition: (not (sp-point-in-string-or-comment)) 6 | # -- 7 | while (${1:true}) { 8 | $0 9 | } -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/kotlin-mode/file_class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: file_class 3 | # key: file 4 | # uuid: file 5 | # -- 6 | class ${1:`(file-name-base 7 | (or (buffer-file-name) 8 | (buffer-name)))`} { 9 | $0 10 | } 11 | -------------------------------------------------------------------------------- /modules/editor/emacs/snippets/zig-mode/main: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: main 3 | # -- 4 | 5 | const std = @import("std"); 6 | pub fn main() void { 7 | 8 | } -------------------------------------------------------------------------------- /modules/health.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | inputs', 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.health; 11 | in 12 | { 13 | options.modules.health = { 14 | enable = mkEnableOption "health"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | launchd.user.agents.stretchly = { 19 | path = [ inputs'.mono-stretchly-darwin.packages.default ]; 20 | serviceConfig = { 21 | StandardOutPath = "/tmp/strecthly.log"; 22 | StandardErrorPath = "/tmp/strecthly.log"; 23 | ProgramArguments = [ 24 | "${inputs'.mono-stretchly-darwin.packages.default}/bin/mono-stretchly" 25 | ]; 26 | RunAtLoad = true; 27 | # in secs 28 | StartInterval = 900; 29 | }; 30 | # serviceConfig.UserName = config.my.username; 31 | }; 32 | home-manager.users.${config.my.username} = { 33 | home.packages = [ 34 | inputs'.mono-stretchly-darwin.packages.default 35 | ]; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /modules/helix.nix: -------------------------------------------------------------------------------- 1 | # https://github.com/maaslalani/_/blob/main/modules/helix.nix 2 | { config, ... }: 3 | { 4 | 5 | home-manager.users.${config.my.username} = { 6 | 7 | programs.helix = { 8 | enable = true; 9 | settings = { 10 | editor = { 11 | gutters = [ 12 | "diff" 13 | "line-numbers" 14 | "spacer" 15 | "diagnostics" 16 | ]; 17 | cursorline = true; 18 | cursor-shape.insert = "bar"; 19 | true-color = true; 20 | lsp.display-messages = true; 21 | }; 22 | theme = "charm"; 23 | keys.insert.esc = [ 24 | "collapse_selection" 25 | "normal_mode" 26 | ]; 27 | keys.normal.esc = [ 28 | "collapse_selection" 29 | "normal_mode" 30 | ]; 31 | keys.select.esc = [ 32 | "collapse_selection" 33 | "keep_primary_selection" 34 | "normal_mode" 35 | ]; 36 | keys.normal = { 37 | X = "extend_line_above"; 38 | a = [ 39 | "append_mode" 40 | "collapse_selection" 41 | ]; 42 | g.q = ":reflow"; 43 | i = [ 44 | "insert_mode" 45 | "collapse_selection" 46 | ]; 47 | ret = [ 48 | "move_line_down" 49 | "goto_line_start" 50 | ]; 51 | space = { 52 | w = ":write"; 53 | q = ":quit"; 54 | }; 55 | }; 56 | }; 57 | languages = { 58 | nix = { 59 | name = "nix"; 60 | auto-format = true; 61 | formatter = { 62 | command = "alejandra"; 63 | }; 64 | language-server = { 65 | command = "nil"; 66 | }; 67 | }; 68 | 69 | }; 70 | }; 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /modules/hledger.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.programs.hledger; 11 | in 12 | { 13 | options.programs.hledger = { 14 | enable = mkEnableOption "hledger"; 15 | enableZshIntegration = mkOption { 16 | default = true; 17 | type = types.bool; 18 | description = '' 19 | Whether to enable Zsh integration. 20 | ''; 21 | }; 22 | }; 23 | 24 | config = mkIf cfg.enable { 25 | home-manager.users.${config.my.username} = { 26 | home.packages = with pkgs; [ 27 | hledge 28 | hledge-ui 29 | hledger-web 30 | ]; 31 | programs.zsh = mkIf cfg.enableZshIntegration { 32 | sessionVariables = { 33 | LEDGER_FILE = ""; 34 | }; 35 | }; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /modules/hosts.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.programs.stevenBlackHosts; 11 | in 12 | { 13 | options.programs.stevenBlackHosts = { 14 | enable = mkEnableOption "stevenBlackHosts"; 15 | # possible values 16 | # https://github.com/StevenBlack/hosts/tree/master/alternates 17 | category = mkOption { 18 | type = types.enum [ 19 | "plain" 20 | "fakenews-gambling-porn-social" 21 | "fakenews-gambling-porn" 22 | "fakenews-gambling-social" 23 | "fakenews-gambling" 24 | "fakenews-porn-social" 25 | "fakenews-porn" 26 | "fakenews-social" 27 | "fakenews" 28 | "gambling-porn-social" 29 | "gambling-porn" 30 | "gambling-social" 31 | "gambling" 32 | "porn-social" 33 | "porn" 34 | "social" 35 | ]; 36 | default = "fakenews-gambling-porn"; 37 | }; 38 | }; 39 | 40 | config = mkIf cfg.enable { 41 | environment.etc.hosts.enable = true; 42 | environment.etc.hosts.source = "${pkgs.hosts}/share/hosts/hosts"; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /modules/linux_packages.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | with pkgs; 4 | [ 5 | gnumake 6 | _1password-gui 7 | protonvpn-cli_2 8 | pinentry 9 | stalonetray 10 | killall 11 | gxmessage 12 | autorandr 13 | dzen2 14 | pavucontrol 15 | scrot 16 | xdotool 17 | xorg.xwininfo 18 | wifish 19 | mpv-unwrapped 20 | brightnessctl 21 | ] 22 | -------------------------------------------------------------------------------- /modules/macintosh.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | lib, 5 | pkgs, 6 | ... 7 | }: 8 | 9 | with pkgs.stdenv; 10 | with lib; 11 | { 12 | imports = [ 13 | inputs.agenix.darwinModules.age 14 | inputs.home-manager.darwinModules.home-manager 15 | ]; 16 | networking.hostName = config.my.hostname; 17 | # https://nixos.wiki/wiki/Enterprise 18 | nix = { 19 | extraOptions = '' 20 | netrc-file = /etc/nix/netrc 21 | ''; 22 | daemonProcessType = "Adaptive"; 23 | # package = pkgs.nixVersions.git; 24 | # sysctl -n hw.ncpu 25 | settings.cores = 12; 26 | # extra-trusted-users = [ config.my.username ]; 27 | gc = { 28 | #automatic = true; 29 | options = "--delete-older-than 3d"; 30 | }; 31 | }; 32 | 33 | system.stateVersion = 5; 34 | system.activationScripts.postActivation.text = '' 35 | printf "disabling spotlight indexing... " 36 | mdutil -i off -d / &> /dev/null 37 | mdutil -E / &> /dev/null 38 | echo "ok" 39 | ''; 40 | services.nix-daemon = { 41 | logFile = "/var/log/nix-daemon.log"; 42 | }; 43 | system.defaults = { 44 | dock = { 45 | autohide = true; 46 | mru-spaces = false; 47 | orientation = "left"; 48 | mineffect = "scale"; 49 | showhidden = true; 50 | launchanim = false; 51 | show-recents = false; 52 | minimize-to-application = true; 53 | show-process-indicators = true; 54 | #mouse-over-hilite-stack = false; 55 | }; 56 | 57 | screencapture.location = "/tmp"; 58 | 59 | finder = { 60 | AppleShowAllExtensions = true; 61 | _FXShowPosixPathInTitle = true; 62 | FXEnableExtensionChangeWarning = false; 63 | }; 64 | 65 | #trackpad = { 66 | # Clicking = true; 67 | # TrackpadThreeFingerDrag = true; 68 | #}; 69 | 70 | NSGlobalDomain._HIHideMenuBar = true; 71 | #NSGlobalDomain."com.apple.mouse.tapBehavior" = null; 72 | }; 73 | system.keyboard = { 74 | enableKeyMapping = true; 75 | # remapCapsLockToControl = true; 76 | }; 77 | 78 | environment.shells = [ pkgs.zsh ]; 79 | environment.systemPackages = [ 80 | pkgs.zsh 81 | pkgs.gcc 82 | ]; 83 | programs.bash.enable = false; 84 | programs.zsh = { 85 | enableCompletion = true; 86 | enable = true; 87 | }; 88 | programs.gnupg.agent = { 89 | enable = true; 90 | enableSSHSupport = true; 91 | }; 92 | time.timeZone = "America/Regina"; 93 | system.primaryUser = config.my.username; 94 | users.users.${config.my.username} = { 95 | shell = pkgs.zsh; 96 | home = config.my.homeDirectory; 97 | }; 98 | home-manager.backupFileExtension = "backup"; 99 | home-manager.useGlobalPkgs = true; 100 | home-manager.useUserPackages = false; 101 | home-manager.users.${config.my.username} = import ./home.nix { 102 | inherit 103 | inputs 104 | pkgs 105 | lib 106 | config 107 | ; 108 | }; 109 | 110 | fonts.packages = with pkgs; [ 111 | fira-code 112 | font-awesome 113 | #iosevka 114 | roboto 115 | roboto-mono 116 | ]; 117 | } 118 | -------------------------------------------------------------------------------- /modules/macos_packages.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | with pkgs; 4 | [ 5 | # alerter 6 | pinentry_mac 7 | yt-dlp 8 | ffmpeg 9 | duti 10 | #ghostty-mac 11 | #calibre_mac 12 | ] 13 | -------------------------------------------------------------------------------- /modules/moonlander.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.moonlander; 11 | in 12 | { 13 | options.modules.moonlander = { 14 | enable = mkEnableOption "moonlander"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | pkgs.wally-cli 21 | pkgs.libusb1 22 | pkgs.hid-listen 23 | ]; 24 | # Usage of wally-cli: [flags] 25 | # wally-cli .build/moonlander_yuanw.bin 26 | # Press the reset button of your keyboard.2022/09/11 12:07:42 handle_events: error: libusb: interrupted [code -10] 27 | # 73660 / 73660 [=======================================================================================================================================] 100.00% 17s 28 | # Your keyboard was successfully flashed and rebooted. Enjoy the new firmware! 29 | 30 | }; 31 | # https://github.com/zsa/wally/wiki/Linux-install#2-create-a-udev-rule-file 32 | # https://discourse.nixos.org/t/creating-a-custom-udev-rule/14569 33 | services.udev.extraRules = '' 34 | # Rules for Oryx web flashing and live training 35 | KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev" 36 | KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev" 37 | 38 | # Legacy rules for live training over webusb (Not needed for firmware v21+) 39 | # Rule for all ZSA keyboards 40 | SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev" 41 | # Rule for the Moonlander 42 | SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev" 43 | # Rule for the Ergodox EZ 44 | SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev" 45 | # Rule for the Planck EZ 46 | SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev" 47 | 48 | # Wally Flashing rules for the Ergodox EZ 49 | ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" 50 | ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" 51 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" 52 | KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" 53 | 54 | # Wally Flashing rules for the Moonlander and Planck EZ 55 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", \ 56 | MODE:="0666", \ 57 | SYMLINK+="stm32_dfu" 58 | ''; 59 | 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /modules/nixos_system.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | lib, 5 | pkgs, 6 | ... 7 | }: 8 | 9 | with pkgs.stdenv; 10 | with lib; 11 | { 12 | imports = [ 13 | inputs.agenix.nixosModules.age 14 | inputs.home-manager.nixosModules.home-manager 15 | ]; 16 | 17 | networking.hostName = config.my.hostname; 18 | 19 | # The global useDHCP flag is deprecated, therefore explicitly set to false here. 20 | # Per-interface useDHCP will be mandatory in the future, so this generated config 21 | # replicates the default behaviour. 22 | 23 | # Configure network proxy if necessary 24 | # networking.proxy.default = "http://user:password@proxy:port/"; 25 | # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; 26 | 27 | # Select internationalisation properties. 28 | i18n.defaultLocale = "en_US.UTF-8"; 29 | # console = { 30 | # font = "Lat2-Terminus16"; 31 | # keyMap = "us"; 32 | # }; 33 | 34 | services.xserver.enable = true; 35 | services.xserver.autorun = true; 36 | services.xserver.autoRepeatDelay = 200; 37 | services.xserver.autoRepeatInterval = 25; 38 | # enable jackd seems mess up headphone jack 39 | # services.jack.jackd.enable = true; 40 | # sound.enable = true; 41 | # hardware.pulseaudio.enable = true; 42 | # hardware.pulseaudio.package = pkgs.pulseaudioFull; 43 | nix = { 44 | # auto-optimise-store = true; 45 | # package = pkgs.nixVersions.git; 46 | gc = { 47 | automatic = true; 48 | dates = "weekly"; 49 | options = "--delete-older-than 10d"; 50 | }; 51 | settings = { 52 | allowed-users = [ 53 | "root" 54 | config.my.username 55 | ]; 56 | trusted-users = [ 57 | "root" 58 | config.my.username 59 | ]; 60 | }; 61 | }; 62 | 63 | system.stateVersion = "22.05"; 64 | users.users.${config.my.username} = { 65 | isNormalUser = true; 66 | uid = 1000; 67 | home = config.my.homeDirectory; 68 | extraGroups = [ 69 | "audio" 70 | "jackaudio" 71 | "wheel" 72 | "docker" 73 | ]; # Enable ‘sudo’ for the user. 74 | shell = pkgs.zsh; 75 | }; 76 | 77 | # List packages installed in system profile. To search, run: 78 | # $ nix search wget 79 | environment = { 80 | systemPackages = with pkgs; [ 81 | wget 82 | vim 83 | git 84 | firefox 85 | ]; 86 | shells = [ pkgs.zsh ]; 87 | }; 88 | programs.zsh.enable = true; 89 | programs.gnupg.agent.enable = true; 90 | time.timeZone = "America/Regina"; 91 | virtualisation.docker.enable = true; 92 | home-manager.backupFileExtension = "backup"; 93 | home-manager.useGlobalPkgs = true; 94 | home-manager.useUserPackages = false; 95 | home-manager.users.${config.my.username} = import ./home.nix { 96 | inherit 97 | inputs 98 | pkgs 99 | lib 100 | config 101 | ; 102 | }; 103 | 104 | fonts.fontDir.enable = true; 105 | fonts.packages = with pkgs; [ 106 | fira-code 107 | font-awesome 108 | iosevka 109 | roboto 110 | roboto-mono 111 | ]; 112 | } 113 | -------------------------------------------------------------------------------- /modules/packages.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | #cacert 6 | clang 7 | coreutils-prefixed 8 | moreutils 9 | 10 | #ffmpeg 11 | less 12 | gifsicle 13 | graphviz 14 | htop 15 | nix-prefetch-git 16 | cachix 17 | # sass 18 | tree 19 | # broot 20 | wget 21 | #unrar 22 | unzip 23 | graphviz 24 | plantuml-c4 25 | xclip 26 | pass 27 | zlib 28 | pigz 29 | shellcheck 30 | entr 31 | 32 | gitAndTools.pre-commit 33 | gitAndTools.pass-git-helper 34 | gitAndTools.gh 35 | git-crypt 36 | 37 | #hledger 38 | #ranger 39 | du-dust 40 | nixpkgs-fmt 41 | nix-tree 42 | nix-diff 43 | # nix-du 44 | lazygit 45 | gron 46 | keychain 47 | 48 | # devenv 49 | # eukleides 50 | #mu 51 | #offlineimap 52 | #notmuch 53 | google-cloud-sdk 54 | # qutebrowser 55 | # productivity 56 | pandoc 57 | 58 | # difftastic 59 | autojump 60 | # gap 61 | #shellcheck 62 | fontconfig 63 | #kubectl 64 | # vhs 65 | # csvkit 66 | # dmenu 67 | #gum 68 | 69 | # TODO move to a modules 70 | # inkscape-with-extensions 71 | # ghostscript 72 | # djvu2pdf 73 | dig 74 | just 75 | pkg-config 76 | protobuf 77 | # racket 78 | # open-interpreter 79 | # reiryoku-firmware 80 | # reiryoku-flash 81 | ] 82 | -------------------------------------------------------------------------------- /modules/private/jellyfin-darwin.nix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/modules/private/jellyfin-darwin.nix -------------------------------------------------------------------------------- /modules/private/work.nix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/modules/private/work.nix -------------------------------------------------------------------------------- /modules/qmk.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.qmk; 11 | in 12 | { 13 | options.modules.qmk = { 14 | enable = mkEnableOption "qmk"; 15 | }; 16 | 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | pkgs.qmk 21 | pkgs.libusb1 22 | pkgs.hid-listen 23 | ]; 24 | }; 25 | services.udev.packages = [ pkgs.qmk-udev-rules ]; 26 | 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /modules/rofi/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | } 5 | -------------------------------------------------------------------------------- /modules/settings.nix: -------------------------------------------------------------------------------- 1 | { lib, options, ... }: 2 | 3 | with lib; 4 | 5 | let 6 | mkOpt' = 7 | type: default: description: 8 | mkOption { inherit type default description; }; 9 | mkOptStr = 10 | value: 11 | mkOption { 12 | type = with types; uniq str; 13 | default = value; 14 | }; 15 | 16 | # copied from https://github.com/cmacrae/config 17 | mailAddr = name: domain: "${name}@${domain}"; 18 | in 19 | { 20 | # https://github.com/ahmedelgabri/dotfiles/blob/16bc31166025ed450654ae5be08e840525d4c02f/nix/modules/shared/settings.nix#L38 21 | # https://github.com/hlissner/dotfiles/blob/089f1a9da9018df9e5fc200c2d7bef70f4546026/modules/options.nix#L39 22 | # https://codeberg.org/adamcstephens/profile-parts/src/branch/main/parts/nixos.nix 23 | # Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions. 24 | options = with types; { 25 | my = { 26 | system = lib.mkOption { 27 | type = lib.types.enum [ 28 | "aarch64-darwin" 29 | "aarch64-linux" 30 | "x86_64-darwin" 31 | "x86_64-linux" 32 | ]; 33 | description = "The system used when defining the host"; 34 | default = "aarch64-darwin"; 35 | }; 36 | 37 | username = mkOptStr "yuanwang"; 38 | name = mkOptStr "Yuan Wang"; 39 | email = mkOptStr (mailAddr "me" "yuanwang.ca"); 40 | hostname = mkOptStr "yuan-mac"; 41 | gpgKey = mkOptStr "BF2ADAA2A98F45E7"; 42 | homeDirectory = mkOptStr "/Users/yuanwang"; 43 | packages = mkOption { 44 | type = types.listOf types.package; 45 | default = [ ]; 46 | description = "The set of packages to appear in the user environment."; 47 | }; 48 | monoFont = mkOptStr "PragmataPro VF Mono Liga"; 49 | font = mkOptStr "PragmataPro VF Liga"; 50 | hm = { 51 | file = mkOpt' attrs { } "Files to place directly in $HOME"; 52 | cacheHome = mkOpt' path "${home}/.cache" "Absolute path to directory holding application caches."; 53 | configFile = mkOpt' attrs { } "Files to place in $XDG_CONFIG_HOME"; 54 | configHome = 55 | mkOpt' path "${home}/.config" 56 | "Absolute path to directory holding application configurations."; 57 | dataFile = mkOpt' attrs { } "Files to place in $XDG_DATA_HOME"; 58 | dataHome = 59 | mkOpt' path "${home}/.local/share" 60 | "Absolute path to directory holding application data."; 61 | stateHome = 62 | mkOpt' path "${home}/.local/state" 63 | "Absolute path to directory holding application states."; 64 | }; 65 | }; 66 | }; 67 | # config = { 68 | # my = { 69 | # username = "yuanwang"; 70 | # name = "Yuan Wang"; 71 | # email = "yuan.wang@workiva.com"; 72 | # hostname = "wf17084"; 73 | # gpgKey = "19AD3F6B1A5BF3BF"; 74 | # homeDirectory = "/Users/yuanwang"; 75 | # }; 76 | # }; 77 | } 78 | -------------------------------------------------------------------------------- /modules/terminal-multiplexer/ta: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Attach or create tmux session named the same as current directory. 4 | # https://github.com/WaylonWalker/devtainer/blob/main/bin/.local/bin/ta 5 | # 6 | 7 | not_in_tmux() { 8 | [ -z "$TMUX" ] 9 | } 10 | 11 | DIR=$1 12 | 13 | # If no arguments are passed in try to immediately attach or start without further input 14 | echo "$DIR" 15 | if [ -z "$DIR" ]; then 16 | if not_in_tmux; then 17 | tmux attach && exit 1 || DIR="--start" 18 | else 19 | exit 1 20 | fi 21 | fi 22 | 23 | # If --start was passed in immediately start a new session based on the current directory 24 | if [ "$DIR" == "--start" ]; then 25 | echo "starting" 26 | path_name="$(basename "$PWD" | tr . -)" 27 | session_name=${path_name//./_} 28 | else 29 | # ask the user which directory to start in 30 | _session_name=$(cd $DIR && ls -d */ | sed "s|/||g" | fzf --reverse --header="Select project from $(basename $DIR) >") 31 | session_name=${_session_name//./_} 32 | path_name=$DIR/$session_name 33 | fi 34 | 35 | echo session name is \"$session_name\" 36 | echo path name is $path_name 37 | 38 | if [ -z "$session_name" ]; then 39 | # operation cancelled by user 40 | exit 1 41 | fi 42 | 43 | session_exists() { 44 | # checks if the $session_name exists 45 | tmux has-session -t "=$session_name" 46 | } 47 | 48 | create_detached_session() { 49 | if [ "$DIR" == "--start" ]; then 50 | (TMUX='' 51 | tmux new-session -Ad -s "$session_name" -c $path_name 52 | ) 53 | else 54 | (TMUX='' 55 | tmux new-session -Ad -s "$session_name" -c $path_name; 56 | ) 57 | fi 58 | } 59 | 60 | create_if_needed_and_attach() { 61 | if not_in_tmux; then 62 | tmux new-session -As "$session_name" -c $path_name 63 | else 64 | if ! session_exists; then 65 | create_detached_session 66 | fi 67 | tmux switch-client -t "$session_name" 68 | fi 69 | } 70 | 71 | attatch_to_first_session() { 72 | tmux attach -t $(tmux list-sessions -F "${session_name}" | head -n 1) 73 | tmux choose-tree -Za 74 | } 75 | 76 | create_if_needed_and_attach || attatch_to_first_session 77 | -------------------------------------------------------------------------------- /modules/terminal-multiplexer/tat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Attach or create tmux session named the same as current directory. 4 | # https://github.com/thoughtbot/dotfiles/blob/master/bin/tat 5 | 6 | path_name="$(basename "$PWD" | tr . -)" 7 | session_name=${1-$path_name} 8 | 9 | not_in_tmux() { 10 | [ -z "$TMUX" ] 11 | } 12 | 13 | session_exists() { 14 | tmux has-session -t "=$session_name" 15 | } 16 | 17 | create_detached_session() { 18 | (TMUX='' tmux new-session -Ad -s "$session_name") 19 | } 20 | 21 | create_if_needed_and_attach() { 22 | if not_in_tmux; then 23 | tmux new-session -As "$session_name" 24 | else 25 | if ! session_exists; then 26 | create_detached_session 27 | fi 28 | tmux switch-client -t "$session_name" 29 | fi 30 | } 31 | 32 | create_if_needed_and_attach 33 | -------------------------------------------------------------------------------- /modules/terminal-multiplexer/tkill: -------------------------------------------------------------------------------- 1 | tmux list-sessions -F '#{?session_attached,,#{session_name}}' | sed '/^$/d' | fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' | xargs tmux kill-session -t 2 | -------------------------------------------------------------------------------- /modules/terminal-multiplexer/zellij-session.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | paths=$* 4 | 5 | if [ -z "$paths" ]; then 6 | echo "No paths were specified, usage: ./zellij-sessionizer path1 path2 etc.." 7 | exit 0 8 | fi 9 | 10 | # Check whether the machine has fd available 11 | if [ -x "$(command -v fd)" ]; then 12 | selected_path=$(fd . "$paths" --min-depth 1 --max-depth 1 --type d | fzf) 13 | else 14 | # defer to find if not 15 | selected_path=$(find "$paths" -mindepth 1 -maxdepth 2 -type d | fzf) 16 | fi 17 | 18 | # If nothing was picked, silently exit 19 | if [ -z "$selected_path" ]; then 20 | exit 0 21 | fi 22 | 23 | # If no directory was selected, exit the script 24 | if [ -z "$selected_path" ]; then 25 | exit 0 26 | fi 27 | 28 | # Get the name of the selected directory, replacing "." with "_" 29 | session_name=$(basename "$selected_path" | tr . _) 30 | 31 | # We're outside of zellij, so lets create a new session or attach to a new one. 32 | if [ -z "$ZELLIJ" ]; then 33 | cd "$selected_path" || return 34 | 35 | # -c will make zellij to either create a new session or to attach into an existing one 36 | zellij attach "$session_name" -c 37 | exit 0 38 | fi 39 | 40 | # We're inside zellij so we'll open a new pane and move into the selected directory 41 | zellij action new-pane 42 | 43 | # Hopefully they'll someday support specifying a directory and this won't be as laggy 44 | # thanks to @msirringhaus for getting this from the community some time ago! 45 | zellij action write-chars "cd $selected_path" && zellij action write 10 46 | -------------------------------------------------------------------------------- /modules/terminal-multiplexer/zellij-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This script is a wrapper for zellij, show a friendly tui interface to deal 3 | # with zellij sessions 4 | 5 | # define colors 6 | RED="$(echo -en '\033[0;31m')" 7 | GREEN="$(echo -en '\033[0;32m')" 8 | YELLOW="$(echo -en '\033[0;33m')" 9 | BLUE="$(echo -en '\033[0;34m')" 10 | PURPLE="$(echo -en '\033[0;35m')" 11 | NC="$(echo -en '\033[0m')" 12 | 13 | # make sure that dependencies are installed 14 | for package in zellij fzf; do 15 | command -v "$package" &>/dev/null && continue 16 | echo -e "${RED}ERROR: $package is not installed!${NC}" 17 | exit 1 18 | done 19 | 20 | # define FZF dracula theme 21 | export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' 22 | --color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9 23 | --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 24 | --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 25 | --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4 --ansi --cycle' 26 | 27 | # zellij functions # 28 | 29 | function attach_session { 30 | local session_name 31 | 32 | session_name="$(zellij ls | 33 | fzf --header "Select session to attach" --prompt "Session: " | 34 | awk '{print $1}')" 35 | 36 | zellij a "$session_name" 37 | exit 0 38 | } 39 | 40 | function create_session { 41 | read -p "${BLUE}Session name ${RED}(Leave empty to abort)${BLUE}: ${YELLOW}" -r session_name 42 | echo -en "${NC}" 43 | [ -z "$session_name" ] && return 1 44 | zellij -s "$session_name" 45 | exit 0 46 | } 47 | 48 | function delete_session { 49 | zellij ls | fzf -m --header "Select sessions to delete" | 50 | awk '{print $1}' | xargs -I {} zellij delete-session {} 51 | exit 0 52 | } 53 | 54 | function list_sessions { 55 | zellij ls | less -SR 56 | } 57 | 58 | function main_script { 59 | clear 60 | echo -e "${GREEN}Welcome to zellij runner!${NC}\n\n" 61 | 62 | options=('attach' 'create' 'list' 'delete') 63 | PS3="${PURPLE}Please enter your choice: ${BLUE}" 64 | echo -en "${BLUE}" 65 | select choice in "${options[@]}"; do 66 | echo -e "${NC}" 67 | 68 | case "$choice" in 69 | 'attach') attach_session ;; 70 | 'create') create_session ;; 71 | 'list') list_sessions ;; 72 | 'delete') delete_session ;; 73 | esac 74 | done 75 | } 76 | 77 | # Main Script # 78 | 79 | action="$1" 80 | if [ -z "$action" ]; then main_script && exit 0; fi 81 | 82 | case "$action" in 83 | 'attach' | 'a') attach_session ;; 84 | 'create' | 'new') create_session ;; 85 | 'list' | 'ls') list_sessions ;; 86 | 'delete' | 'rm') delete_session ;; 87 | *) 88 | echo -e "${RED}Invalid action: ${YELLOW}$action${NC}" 89 | echo -e "${BLUE}Valid actions: ${GREEN}attach|a, create|new, list|ls, delete|rm${NC}" 90 | exit 1 91 | ;; 92 | esac 93 | -------------------------------------------------------------------------------- /modules/terminal-multiplexer/zellij.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.zellij; 11 | zellijCmd = getExe pkgs.zellij; 12 | in 13 | { 14 | options.modules.zellij = { 15 | enable = mkEnableOption "zellij"; 16 | }; 17 | config = mkIf cfg.enable { 18 | home-manager.users.${config.my.username} = { 19 | home.packages = [ 20 | (pkgs.writeShellScriptBin "zellij-session" (builtins.readFile ./zellij-session.sh)) 21 | (pkgs.writeShellScriptBin "zellij-wrapper" (builtins.readFile ./zellij-wrapper.sh)) 22 | ]; 23 | programs = { 24 | zellij = { 25 | enable = true; 26 | enableZshIntegration = true; 27 | settings = { 28 | themes = "catppuccin-mocha"; 29 | }; 30 | }; 31 | 32 | # https://github.om/zellij-org/zellij/issues/1933 33 | zsh.initContent = mkOrder 199 '' 34 | eval "$(${zellijCmd} setup --generate-completion zsh | grep "^function")" 35 | ''; 36 | 37 | }; 38 | }; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /modules/terminal/readme.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Terminal Setting 2 | 3 | Current Choices 4 | - Alacritty 5 | - starship 6 | - tmux 7 | 8 | 9 | * Bigger picture 10 | 11 | Tiling Window Manager + tmux + Emacs 12 | 13 | most of yabai commands start with ~Alt~ 14 | most of tmux commands start with ~Ctr+Space~ 15 | 16 | * Goals 17 | - tmux window navigation and doom emacs window navigation should have the similar combination 18 | 19 | * Moonlander keyboard Layout 20 | 21 | https://configure.zsa.io/moonlander/layouts/dOezg/latest/0 22 | 23 | * References 24 | https://stackoverflow.com/questions/12003726/give-a-hint-when-press-prefix-key-in-tmux 25 | https://leanpub.com/the-tao-of-tmux/read#zoom-pane 26 | https://man7.org/linux/man-pages/man1/tmux.1.html 27 | -------------------------------------------------------------------------------- /modules/terminal/ta: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Attach or create tmux session named the same as current directory. 4 | # https://github.com/WaylonWalker/devtainer/blob/main/bin/.local/bin/ta 5 | # 6 | 7 | not_in_tmux() { 8 | [ -z "$TMUX" ] 9 | } 10 | 11 | DIR=$1 12 | 13 | # If no arguments are passed in try to immediately attach or start without further input 14 | echo "$DIR" 15 | if [ -z "$DIR" ]; then 16 | if not_in_tmux; then 17 | tmux attach && exit 1 || DIR="--start" 18 | else 19 | exit 1 20 | fi 21 | fi 22 | 23 | # If --start was passed in immediately start a new session based on the current directory 24 | if [ "$DIR" == "--start" ]; then 25 | echo "starting" 26 | path_name="$(basename "$PWD" | tr . -)" 27 | session_name=${path_name//./_} 28 | else 29 | # ask the user which directory to start in 30 | _session_name=$(cd $DIR && ls -d */ | sed "s|/||g" | fzf --reverse --header="Select project from $(basename $DIR) >") 31 | session_name=${_session_name//./_} 32 | path_name=$DIR/$session_name 33 | fi 34 | 35 | echo session name is \"$session_name\" 36 | echo path name is $path_name 37 | 38 | if [ -z "$session_name" ]; then 39 | # operation cancelled by user 40 | exit 1 41 | fi 42 | 43 | session_exists() { 44 | # checks if the $session_name exists 45 | tmux has-session -t "=$session_name" 46 | } 47 | 48 | create_detached_session() { 49 | if [ "$DIR" == "--start" ]; then 50 | (TMUX='' 51 | tmux new-session -Ad -s "$session_name" -c $path_name 52 | ) 53 | else 54 | (TMUX='' 55 | tmux new-session -Ad -s "$session_name" -c $path_name; 56 | ) 57 | fi 58 | } 59 | 60 | create_if_needed_and_attach() { 61 | if not_in_tmux; then 62 | tmux new-session -As "$session_name" -c $path_name 63 | else 64 | if ! session_exists; then 65 | create_detached_session 66 | fi 67 | tmux switch-client -t "$session_name" 68 | fi 69 | } 70 | 71 | attatch_to_first_session() { 72 | tmux attach -t $(tmux list-sessions -F "${session_name}" | head -n 1) 73 | tmux choose-tree -Za 74 | } 75 | 76 | create_if_needed_and_attach || attatch_to_first_session 77 | -------------------------------------------------------------------------------- /modules/terminal/tat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Attach or create tmux session named the same as current directory. 4 | # https://github.com/thoughtbot/dotfiles/blob/master/bin/tat 5 | 6 | path_name="$(basename "$PWD" | tr . -)" 7 | session_name=${1-$path_name} 8 | 9 | not_in_tmux() { 10 | [ -z "$TMUX" ] 11 | } 12 | 13 | session_exists() { 14 | tmux has-session -t "=$session_name" 15 | } 16 | 17 | create_detached_session() { 18 | (TMUX='' tmux new-session -Ad -s "$session_name") 19 | } 20 | 21 | create_if_needed_and_attach() { 22 | if not_in_tmux; then 23 | tmux new-session -As "$session_name" 24 | else 25 | if ! session_exists; then 26 | create_detached_session 27 | fi 28 | tmux switch-client -t "$session_name" 29 | fi 30 | } 31 | 32 | create_if_needed_and_attach 33 | -------------------------------------------------------------------------------- /modules/terminal/tkill: -------------------------------------------------------------------------------- 1 | tmux list-sessions -F '#{?session_attached,,#{session_name}}' | sed '/^$/d' | fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' | xargs tmux kill-session -t 2 | -------------------------------------------------------------------------------- /modules/typing/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | with lib; 9 | let 10 | cfg = config.modules.typing; 11 | adept = pkgs.writeShellScriptBin "adept" '' 12 | case "$1" in 13 | "l1" | "level1" | "1" ) ttyper --language-file $XDG_CONFIG_HOME/ttyper/level1;; 14 | "l2" | "level2" | "2" ) ttyper --language-file $XDG_CONFIG_HOME/ttyper/level2;; 15 | "l3" | "level3" | "3" ) ttyper --language-file $XDG_CONFIG_HOME/ttyper/level3;; 16 | "l4" | "level4" | "4" ) ttyper --language-file $XDG_CONFIG_HOME/ttyper/level4;; 17 | "l5" | "level5" | "5" ) ttyper --language-file $XDG_CONFIG_HOME/ttyper/level5;; 18 | *) ttyper;; 19 | esac 20 | ''; 21 | in 22 | { 23 | options.modules.typing = { 24 | enable = mkEnableOption "typing"; 25 | }; 26 | 27 | config = mkIf cfg.enable { 28 | home-manager.users.${config.my.username} = { 29 | home.packages = [ 30 | # pkgs.haskellPackages.gotta-go-fast 31 | adept 32 | pkgs.ttyper 33 | ]; 34 | programs = { 35 | zsh = { 36 | sessionVariables = { 37 | TTYPER_CONFIG_DIR = "$XDG_CONFIG_HOME/ttyper"; 38 | }; 39 | }; 40 | }; 41 | xdg.configFile = { 42 | # "keymap.svg" = pkgs.reiryoku-firmware/share/reiryoku.svg; 43 | "ttyper/level1".source = ./level1.txt; 44 | "ttyper/level2".source = ./level2.txt; 45 | "ttyper/level3".source = ./level3.txt; 46 | "ttyper/level4".source = ./level4.txt; 47 | "ttyper/level5".source = ./level5.txt; 48 | }; 49 | }; 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /modules/typing/hello-world.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | 3 | -- optional 4 | module Main where 5 | 6 | import qualified Data.ByteString as B 7 | import Data.Text (Text) 8 | import qualified Data.Text as T 9 | import qualified Data.Text.Encoding as E 10 | import qualified Data.Text.IO as TIO 11 | 12 | level1 :: Text 13 | level1 = "arstneio" 14 | 15 | level2 :: Text 16 | level2 = "arstgmneio" 17 | 18 | level3 :: Text 19 | level3 = "pbjlarstgmneio" 20 | 21 | level4 :: Text 22 | level4 = "pbjlarstgmneiocdvk" 23 | 24 | level5 :: Text 25 | level5 = "wfpbjluyarstgmneiocdvk" 26 | 27 | main :: IO () 28 | main = do 29 | a <- map (head . T.words) . T.lines . E.decodeUtf8 <$> B.readFile "./wordWeights.txt" 30 | TIO.writeFile "./level1.txt" (T.intercalate "\n" . filter (T.all (`T.elem` level1)) $ a) 31 | TIO.writeFile "./level2.txt" (T.intercalate "\n" . filter (T.all (`T.elem` level2)) $ a) 32 | TIO.writeFile "./level3.txt" (T.intercalate "\n" . filter (T.all (`T.elem` level3)) $ a) 33 | TIO.writeFile "./level4.txt" (T.intercalate "\n" . filter (T.all (`T.elem` level4)) $ a) 34 | TIO.writeFile "./level5.txt" (T.intercalate "\n" . filter (T.all (`T.elem` level5)) $ a) 35 | -------------------------------------------------------------------------------- /modules/typing/level1.txt: -------------------------------------------------------------------------------- 1 | to 2 | a 3 | it 4 | is 5 | in 6 | no 7 | not 8 | on 9 | so 10 | are 11 | at 12 | one 13 | see 14 | as 15 | or 16 | an 17 | too 18 | into 19 | son 20 | sir 21 | start 22 | seen 23 | soon 24 | reason 25 | sit 26 | rest 27 | sister 28 | set 29 | eat 30 | sort 31 | sense 32 | ten 33 | ass 34 | none 35 | test 36 | sent 37 | its 38 | air 39 | entire 40 | street 41 | ran 42 | state 43 | ones 44 | attention 45 | near 46 | station 47 | store 48 | seat 49 | nine 50 | er 51 | nose 52 | sooner 53 | tea 54 | arrest 55 | star 56 | easier 57 | treat 58 | note 59 | tree 60 | interest 61 | art 62 | taste 63 | raise 64 | reasons 65 | area 66 | sees 67 | insane 68 | starts 69 | tests 70 | train 71 | re 72 | tie 73 | onto 74 | sea 75 | states 76 | toast 77 | stories 78 | stars 79 | sisters 80 | rent 81 | rain 82 | stone 83 | assistant 84 | ear 85 | tear 86 | ears 87 | santos 88 | annie 89 | noise 90 | sat 91 | stress 92 | ate 93 | notes 94 | non 95 | east 96 | stairs 97 | rate 98 | inn 99 | streets 100 | rat 101 | artist 102 | season 103 | senior 104 | rise 105 | senator 106 | seats 107 | nor 108 | insist 109 | tries 110 | estate 111 | tears 112 | rare 113 | site 114 | nonsense 115 | internet 116 | session 117 | trees 118 | intention 119 | enter 120 | intense 121 | sons 122 | tennis 123 | tense 124 | series 125 | torn 126 | interests 127 | ease 128 | eaten 129 | tone 130 | toss 131 | saint 132 | rotten 133 | ta 134 | resist 135 | net 136 | tension 137 | neat 138 | anti 139 | sin 140 | senses 141 | toes 142 | rats 143 | roses 144 | toe 145 | aitoro 146 | sis 147 | iron 148 | tent 149 | noon 150 | sets 151 | instant 152 | ton 153 | tons 154 | inner 155 | earn 156 | root 157 | stare 158 | tattoo 159 | sore 160 | eats 161 | tore 162 | stores 163 | sorts 164 | tastes 165 | intentions 166 | nation 167 | stones 168 | tire 169 | nest 170 | sits 171 | roast 172 | riot 173 | resort 174 | sorta 175 | starters 176 | arts 177 | erase 178 | ooo 179 | sins 180 | error 181 | nineteen 182 | ties 183 | arson 184 | tits 185 | resent 186 | asses 187 | stat 188 | treats 189 | stir 190 | rear 191 | teen 192 | sane 193 | en 194 | assets 195 | tan 196 | sitter 197 | satan 198 | nearest 199 | rot 200 | se 201 | terror 202 | stations 203 | roots 204 | nooo 205 | intent 206 | strain 207 | na 208 | noises 209 | eastern 210 | senor 211 | intern 212 | restore 213 | artists 214 | terrorists 215 | senate 216 | assist 217 | tease 218 | toto 219 | notion 220 | retire 221 | et 222 | terrorist 223 | sessions 224 | nana 225 | areas 226 | retreat 227 | tin 228 | tee 229 | steer 230 | traitor 231 | te 232 | era 233 | stain 234 | iris 235 | es 236 | entertain 237 | tires 238 | transition 239 | easiest 240 | nations 241 | oo 242 | titan 243 | ins 244 | sittin 245 | assassin 246 | interior 247 | ant 248 | onion 249 | noses 250 | assassination 251 | rio 252 | ni 253 | enters 254 | ants 255 | stereo 256 | insists 257 | trainer 258 | neo 259 | err 260 | noooo 261 | einstein 262 | stein 263 | restraint 264 | asset 265 | ee 266 | asia 267 | orientation 268 | onions 269 | tattoos 270 | stern 271 | noo 272 | reset 273 | rates 274 | ra 275 | roar 276 | eatin 277 | arena 278 | stains 279 | sooo 280 | sire 281 | tis 282 | trains 283 | tart 284 | saints 285 | raises -------------------------------------------------------------------------------- /modules/typing/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme 2 | -------------------------------------------------------------------------------- /modules/wireguard.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | } 5 | -------------------------------------------------------------------------------- /modules/wm/amethyst.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | with lib; 4 | let 5 | cfg = config.modules.wm.amethyst; 6 | in 7 | { 8 | 9 | options.modules.wm.amethyst = { 10 | enable = mkEnableOption "amethyst"; 11 | }; 12 | config = mkIf cfg.enable { 13 | assertions = [ 14 | { 15 | assertion = config.homebrew.enable; 16 | message = ""; 17 | } 18 | { 19 | assertion = !(config.modules.wm.yabai.enable); 20 | message = "We cannot enable both yabai and amethyst"; 21 | 22 | } 23 | ]; 24 | homebrew = { 25 | casks = [ "amethyst" ]; 26 | }; 27 | 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /modules/wm/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | { 9 | config = lib.mkMerge [ 10 | (lib.mkIf pkgs.stdenv.isDarwin { imports = [ ./yabai.nix ]; }) 11 | 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /modules/wm/eww/eww.scss: -------------------------------------------------------------------------------- 1 | $surface-darkgrey: #20252b; 2 | $surface-fg: #949494; 3 | $surface-lightgrey: #3d464e; 4 | $surface-grey: #2b3238; 5 | $surface-red: #f87070; 6 | 7 | * { all: unset; } 8 | 9 | .layout-box { 10 | font-family: Phosphor, Koulen; 11 | background-repeat: no-repeat; 12 | background-size: contain; 13 | padding: 5em; 14 | color: rgba($surface-fg, 0.8); 15 | } 16 | 17 | .net-box, 18 | .bat-box, 19 | .tm-box { 20 | label { 21 | font-size: 2em; 22 | } 23 | } 24 | 25 | .close-btn { 26 | font-size: 2em; 27 | &:hover { 28 | color: $surface-red; 29 | } 30 | } 31 | 32 | .btns-box { 33 | font-size: 2.5em; 34 | 35 | button { 36 | padding: 0.4em; 37 | border-radius: 0.1em; 38 | background-color: rgba($surface-darkgrey, 0.3); 39 | 40 | &:hover { 41 | transition: 200ms linear background-color, border-radius; 42 | background-color: rgba($surface-lightgrey, 0.6); 43 | } 44 | 45 | &:first-child { 46 | color: rgba($surface-red, 0.8); 47 | } 48 | } 49 | } 50 | 51 | .sep { 52 | font-size: 1em; 53 | padding-top: 0.15em; 54 | padding-left: 0.2em; 55 | padding-right: 0.2em; 56 | font-family: Iosevka; 57 | font-weight: 400; 58 | } 59 | 60 | .sundial-lbl { 61 | font-size: 1.5em; 62 | font-weight: bold; 63 | border-radius: 0.2em; 64 | padding: 0.4em; 65 | padding-bottom: 0.5em; 66 | font-family: "Poiret One"; 67 | } 68 | 69 | // vim:ft=scss 70 | -------------------------------------------------------------------------------- /modules/wm/eww/eww.yuck: -------------------------------------------------------------------------------- 1 | (defwindow powermenu 2 | :stacking "fg" 3 | :windowtype "normal" 4 | :wm-ignore true 5 | :geometry (geometry :width "100%" :height "100%") 6 | (powermenu_layout)) 7 | 8 | (defpoll time :interval "5s" 9 | :initial `date +'{"hour":"%H","min":"%M"}'` 10 | `date +'{"hour":"%H","min":"%M"}'`) 11 | (defpoll net :interval "100s" 12 | :initial `N/A` 13 | `nmcli -t -f SIGNAL,ACTIVE device wifi \ 14 | | awk -F':' '{if($2=="yes")print$1}'`) 15 | 16 | (defwidget powermenu_layout [] 17 | (box :class "layout-box" :space-evenly false :orientation "vertical" 18 | :style "background-image: url('./wallpaper')" 19 | (box :valign "start" :space-evenly false :spacing 25 20 | (_sundial) 21 | (_battery :status {EWW_BATTERY.BAT0.status} 22 | :battery {EWW_BATTERY.BAT0.capacity} 23 | :charge "" :one "" :two "" :three "" :four "" 24 | :five "" :six "" :seven "") 25 | (_network :strength net :offline "" :excellent "" :good "" 26 | :okay "" :slow "") 27 | (label :text "|" :class "sep") 28 | (button :onclick "eww close powermenu" :class "close-btn" "")) 29 | (box :space-evenly false :hexpand true :vexpand true 30 | (box :spacing 15 :class "tm-box" :space-evenly false 31 | :valign "end" :halign "start" 32 | (label :text "") 33 | (label :text "${time.hour} ${time.min}")) 34 | (_buttons :shutdown "poweroff" :reboot "reboot" 35 | :logout "loginctl kill-session self" 36 | :shutdown_icon "" :reboot_icon "" 37 | :logout_icon "")))) 38 | 39 | (defwidget _battery [battery status one two three 40 | four five six seven charge] 41 | (box :class "bat-box" :space-evenly false :spacing 8 42 | (label :text {status == 'Charging' ? charge : 43 | battery < 15 ? seven : 44 | battery < 30 ? six : 45 | battery < 45 ? five : 46 | battery < 60 ? four : 47 | battery < 75 ? three : 48 | battery < 95 ? two : one}))) 49 | 50 | (defwidget _network [strength offline excellent 51 | good okay slow] 52 | (box :class "net-box" 53 | :space-evenly false 54 | :spacing 8 55 | (label :text {strength == "" ? offline : 56 | strength < 26 ? slow : 57 | strength < 51 ? okay : 58 | strength < 76 ? good : excellent}))) 59 | 60 | (defwidget _buttons [shutdown shutdown_icon reboot 61 | reboot_icon logout logout_icon] 62 | (box :class "btns-box" :spacing 5 63 | :vexpand true :hexpand true 64 | :valign "end" :halign "end" 65 | :space-evenly false 66 | (button :onclick shutdown shutdown_icon) 67 | (button :onclick reboot reboot_icon) 68 | (button :onclick logout logout_icon))) 69 | 70 | (defwidget _sundial [] 71 | (label :class "sundial-lbl" :halign "end" :hexpand true 72 | :text {time.hour >= 2 && time.hour <= 4 ? "Early Morning" : 73 | time.hour <= 5 ? "Dawn" : 74 | time.hour >= 6 75 | && (time.hour <= 8 && time.min <= 59) 76 | ? "Morning" : 77 | time.hour >= 9 78 | && (time.hour <= 11 && time.min <= 59) 79 | ? "Late Morning" : 80 | time.hour == 12 && time.min <= 29 81 | ? "Midday" : 82 | time.hour >= 12 && time.hour <= 16 83 | ? "Afternoon" : 84 | time.hour > 16 && time.hour <= 17 85 | ? "Late Afternoon" : 86 | (time.hour >= 17 && time.min <= 1) 87 | || (time.hour <= 18 && time.min <= 20) 88 | ? "Early Evening" : 89 | time.hour >= 18 && time.hour <= 19 90 | ? "Dusk" : 91 | time.hour > 19 && time.hour <= 21 92 | ? "Late Evening" : 93 | time.hour > 21 ? "Night" : "Midnight"})) 94 | -------------------------------------------------------------------------------- /modules/wm/eww/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme 2 | https://dharmx.is-a.dev/eww-powermenu/ 3 | -------------------------------------------------------------------------------- /modules/wm/eww/wallpaper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/modules/wm/eww/wallpaper -------------------------------------------------------------------------------- /modules/wm/readme.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Tailing Window Manager and bars 2 | * MacOS 3 | ** bar 4 | gh requires ~gh auth login~ 5 | ** Hotkey 6 | *** lock screen shortcut 7 | ~Meh + L~ 8 | ~pmset displaysleepnow~ 9 | 10 | require a password immediately after sleep 11 | System Preference -> Lock Screen -> 12 | ** Hide Window 13 | ~Command + H~ default MacOS shortcut 14 | ~Command + Shift + .~ show hidden files 15 | 16 | 17 | ** Commands screen capture 18 | ~screencapture -i -c /tmp/$(date +%s).png~ 19 | ** Resources 20 | - https://github.com/stephen-huan/macos-dotfiles 21 | - https://github.com/cmacrae/config/blob/master/conf.d/skhd.conf 22 | - https://github.com/koekeishiya/skhd 23 | - https://github.com/koekeishiya/yabai/blob/7641afd7fdf95101de6675a8e1b9bfafdc3b4c63/examples/skhdrc#L36 24 | - https://github.com/koekeishiya/yabai/wiki/Commands#space-commands 25 | - https://github.com/peel/dotfiles/blob/master/setup/darwin/wm.nix 26 | - https://github.com/ericlovesmath/dotfiles 27 | - https://github.com/shaunsingh/nix-darwin-dotfiles 28 | - https://github.com/julian-heng/yabai-config 29 | - https://github.com/peel/dotfiles/blob/master/setup/darwin/wm.nix 30 | * NixOS 31 | xmonad + xmobar 32 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/colors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Color Palette 4 | export BLACK=0xff181926 5 | export WHITE=0xffcad3f5 6 | export RED=0xffed8796 7 | export GREEN=0xffa6da95 8 | export BLUE=0xff8aadf4 9 | export YELLOW=0xffeed49f 10 | export ORANGE=0xfff5a97f 11 | export MAGENTA=0xffc6a0f6 12 | export GREY=0xff939ab7 13 | export TRANSPARENT=0x00000000 14 | 15 | # General bar colors 16 | export BAR_COLOR=0xff1e1e2e 17 | export BAR_BORDER_COLOR=0xff494d64 #0xa024273a 18 | export ICON_COLOR=$WHITE # Color of all icons 19 | export LABEL_COLOR=$WHITE # Color of all labels 20 | export BACKGROUND_1=0x603c3e4f 21 | export BACKGROUND_2=0x60494d64 22 | 23 | export POPUP_BACKGROUND_COLOR=0xff1e1e2e 24 | export POPUP_BORDER_COLOR=$WHITE 25 | 26 | export SHADOW_COLOR=$BLACK 27 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/icons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # General Icons 4 | LOADING=􀖇 5 | APPLE=􀣺 6 | PREFERENCES=􀺽 7 | ACTIVITY=􀒓 8 | LOCK=􀒳 9 | BELL=􀋚 10 | BELL_DOT=􀝗 11 | export -n LOADING 12 | export -n APPLE 13 | export -n PREFERENCES 14 | export -n ACTIVITY 15 | export -n LOCK 16 | export -n BELL 17 | export -n BELL_DOT 18 | MAIL=􀍕 19 | 20 | export -n MAIL 21 | # Git Icons 22 | GIT_ISSUE=􀍷 23 | GIT_DISCUSSION=􀒤 24 | GIT_PULL_REQUEST=􀙡 25 | GIT_COMMIT=􀡚 26 | GIT_INDICATOR=􀂓 27 | 28 | export -n GIT_ISSUE 29 | export -n GIT_DISCUSSION 30 | export -n GIT_PULL_REQUEST 31 | export -n GIT_COMMIT 32 | export -n GIT_INDICATOR 33 | 34 | # Yabai Icons 35 | YABAI_BSP=􀻤 36 | YABAI_STACK=􀏭 37 | YABAI_FULLSCREEN_ZOOM=􀏜 38 | YABAI_PARENT_ZOOM=􀥃 39 | YABAI_FLOAT=􀢌 40 | YABAI_GRID=􀧍 41 | 42 | export -n YABAI_BSP 43 | export -n YABAI_STACK 44 | export -n YABAI_FULLSCREEN_ZOOM 45 | export -n YABAI_PARENT_ZOOM 46 | export -n YABAI_FLOAT 47 | export -n YABAI_GRID 48 | # Battery Icons 49 | BATTERY_100=􀛨 50 | BATTERY_75=􀺸 51 | BATTERY_50=􀺶 52 | BATTERY_25=􀛩 53 | BATTERY_0=􀛪 54 | BATTERY_CHARGING=􀢋 55 | 56 | export -n BATTERY_100 57 | export -n BATTERY_75 58 | export -n BATTERY_50 59 | export -n BATTERY_25 60 | export -n BATTERY_0 61 | export -n BATTERY_CHARGING 62 | 63 | # Volume Icons 64 | VOLUME_100=􀊩 65 | VOLUME_66=􀊧 66 | VOLUME_33=􀊥 67 | VOLUME_10=􀊡 68 | VOLUME_0=􀊣 69 | 70 | export -n VOLUME_100 71 | export -n VOLUME_66 72 | export -n VOLUME_33 73 | export -n VOLUME_10 74 | export -n VOLUME_0 75 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/apple.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | POPUP_OFF='sketchybar --set apple.logo popup.drawing=off' 4 | POPUP_CLICK_SCRIPT="sketchybar --set $NAME popup.drawing=toggle" 5 | 6 | apple_logo=( 7 | icon="$APPLE" 8 | icon.font="$FONT:Black:16.0" 9 | icon.color="$GREEN" 10 | padding_right=15 11 | label.drawing=off 12 | click_script="$POPUP_CLICK_SCRIPT" 13 | popup.height=35 14 | ) 15 | 16 | apple_prefs=( 17 | icon="$PREFERENCES" 18 | label="Preferences" 19 | click_script="open -a 'System Preferences'; $POPUP_OFF" 20 | ) 21 | 22 | apple_activity=( 23 | icon="$ACTIVITY" 24 | label="Activity" 25 | click_script="open -a 'Activity Monitor'; $POPUP_OFF" 26 | ) 27 | 28 | apple_lock=( 29 | icon="$LOCK" 30 | label="Lock Screen" 31 | click_script="pmset displaysleepnow; $POPUP_OFF" 32 | ) 33 | 34 | sketchybar --add item apple.logo left \ 35 | --set apple.logo "${apple_logo[@]}" \ 36 | \ 37 | --add item apple.prefs popup.apple.logo \ 38 | --set apple.prefs "${apple_prefs[@]}" \ 39 | \ 40 | --add item apple.activity popup.apple.logo \ 41 | --set apple.activity "${apple_activity[@]}" \ 42 | \ 43 | --add item apple.lock popup.apple.logo \ 44 | --set apple.lock "${apple_lock[@]}" 45 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/battery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | battery=( 4 | script="$PLUGIN_DIR/battery.sh" 5 | icon.font="$FONT:Regular:19.0" 6 | padding_right=5 7 | padding_left=0 8 | label.drawing=off 9 | update_freq=120 10 | updates=on 11 | ) 12 | 13 | sketchybar --add item battery right \ 14 | --set battery "${battery[@]}" \ 15 | --subscribe battery power_source_change system_woke 16 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/brew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Trigger the brew_udpate event when brew update or upgrade is run from cmdline 4 | # e.g. via function in .zshrc 5 | # shellcheck disable=SC1091 6 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 7 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 8 | 9 | brew=( 10 | icon=􀐛 11 | label=? 12 | padding_right=10 13 | script="$PLUGIN_DIR/brew.sh" 14 | ) 15 | 16 | sketchybar --add event brew_update \ 17 | --add item brew right \ 18 | --set brew "${brew[@]}" \ 19 | --subscribe brew brew_update 20 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/calendar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | calendar=( 4 | icon=cal 5 | icon.font="$FONT:Black:12.0" 6 | icon.padding_right=0 7 | label.width=45 8 | label.align=right 9 | padding_left=15 10 | update_freq=30 11 | script="$PLUGIN_DIR/calendar.sh" 12 | click_script="$PLUGIN_DIR/zen.sh" 13 | ) 14 | 15 | sketchybar --add item calendar right \ 16 | --set calendar "${calendar[@]}" \ 17 | --subscribe calendar system_woke 18 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/cpu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cpu_top=( 4 | label.font="$FONT:Semibold:7" 5 | label=CPU 6 | icon.drawing=off 7 | width=0 8 | padding_right=15 9 | y_offset=6 10 | ) 11 | 12 | cpu_percent=( 13 | label.font="$FONT:Heavy:12" 14 | label=CPU 15 | y_offset=-4 16 | padding_right=15 17 | width=55 18 | icon.drawing=off 19 | update_freq=4 20 | mach_helper="$HELPER" 21 | ) 22 | 23 | cpu_sys=( 24 | width=0 25 | graph.color="$RED" 26 | graph.fill_color="$RED" 27 | label.drawing=off 28 | icon.drawing=off 29 | background.height=30 30 | background.drawing=on 31 | background.color="$TRANSPARENT" 32 | ) 33 | 34 | cpu_user=( 35 | graph.color="$BLUE" 36 | label.drawing=off 37 | icon.drawing=off 38 | background.height=30 39 | background.drawing=on 40 | background.color="$TRANSPARENT" 41 | ) 42 | 43 | sketchybar --add item cpu.top right \ 44 | --set cpu.top "${cpu_top[@]}" \ 45 | \ 46 | --add item cpu.percent right \ 47 | --set cpu.percent "${cpu_percent[@]}" \ 48 | \ 49 | --add graph cpu.sys right 75 \ 50 | --set cpu.sys "${cpu_sys[@]}" \ 51 | \ 52 | --add graph cpu.user right 75 \ 53 | --set cpu.user "${cpu_user[@]}" 54 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/front_app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FRONT_APP_SCRIPT="sketchybar --set $NAME label=$INFO" 4 | 5 | front_app=( 6 | icon.drawing=off 7 | label.font="$FONT:Black:12.0" 8 | associated_display=active 9 | script="$FRONT_APP_SCRIPT" 10 | ) 11 | 12 | sketchybar --add item front_app left \ 13 | --set front_app "${front_app[@]}" \ 14 | --subscribe front_app front_app_switched 15 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/github.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # shellcheck disable=SC1091 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | POPUP_CLICK_SCRIPT="sketchybar --set $NAME popup.drawing=toggle" 7 | 8 | github_bell=( 9 | update_freq=30 10 | icon="$BELL" 11 | icon.font="$FONT:Bold:15.0" 12 | icon.color="$BLUE" 13 | label="$LOADING" 14 | label.highlight_color="$BLUE" 15 | popup.align=right 16 | script="$PLUGIN_DIR/github.sh" 17 | click_script="$POPUP_CLICK_SCRIPT" 18 | ) 19 | 20 | github_template=( 21 | drawing=off 22 | background.corner_radius=12 23 | padding_left=7 24 | padding_right=7 25 | icon.background.height=2 26 | icon.background.y_offset=-12 27 | ) 28 | 29 | sketchybar --add item github.bell right \ 30 | --set github.bell "${github_bell[@]}" \ 31 | --subscribe github.bell mouse.entered \ 32 | mouse.exited \ 33 | mouse.exited.global \ 34 | \ 35 | --add item github.template popup.github.bell \ 36 | --set github.template "${github_template[@]}" 37 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/ical.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | POPUP_CLICK_SCRIPT="sketchybar --set ical popup.drawing=toggle" 3 | 4 | sketchybar --add item ical right \ 5 | --set ical update_freq=180 \ 6 | icon=􀉉 \ 7 | icon.color="${YELLOW}" \ 8 | label.color="${YELLOW}" \ 9 | popup.align=right \ 10 | script="$PLUGIN_DIR/ical.sh" \ 11 | click_script="$POPUP_CLICK_SCRIPT" \ 12 | --subscribe ical mouse.clicked \ 13 | mouse.entered \ 14 | mouse.exited \ 15 | mouse.exited.global \ 16 | \ 17 | --add item ical.template popup.ical \ 18 | --set ical.template drawing=off \ 19 | background.corner_radius=12 \ 20 | padding_left=7 \ 21 | padding_right=7 \ 22 | icon.background.height=2 \ 23 | icon.background.y_offset=-12 24 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/mail.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # shellcheck disable=SC1091 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | sketchybar --add item mail left \ 7 | --subscribe mail system_woke \ 8 | --set mail update_freq=60 \ 9 | updates=on \ 10 | script="$PLUGIN_DIR/mail.sh" \ 11 | click_script="$PLUGIN_DIR/mail.sh" \ 12 | icon.padding_left=22 \ 13 | icon.font="$ICON_FONT:Solid:16.0" \ 14 | icon="$MAIL" \ 15 | icon.color="$BLUE" \ 16 | label=! 17 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/mic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sketchybar --add item mic right \ 3 | sketchybar --set mic update_freq=3 \ 4 | --set mic script="$PLUGIN_DIR/mic.sh" \ 5 | --set mic click_script="$PLUGIN_DIR/mic_click.sh" 6 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/spaces.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SPACE_ICONS=("敬" "天" "爱" "人" "向" "死" "而" "生9" "10" "11" "12" "13" "14" "15") 4 | 5 | # Destroy space on right click, focus space on left click. 6 | # New space by left clicking separator (>) 7 | 8 | sid=0 9 | for i in "${!SPACE_ICONS[@]}"; do 10 | sid=$((i + 1)) 11 | 12 | space=( 13 | associated_space="$sid" 14 | icon="${SPACE_ICONS[i]}" 15 | icon.padding_left=10 16 | icon.padding_right=10 17 | padding_left=2 18 | padding_right=2 19 | label.padding_right=20 20 | icon.highlight_color="$RED" 21 | label.color="$GREY" 22 | label.highlight_color="$WHITE" 23 | label.font="sketchybar-app-font:Regular:16.0" 24 | label.y_offset=-1 25 | background.color="$BACKGROUND_1" 26 | background.border_color="$BACKGROUND_2" 27 | background.drawing=off 28 | label.drawing=off 29 | script="$PLUGIN_DIR/space.sh" 30 | ) 31 | 32 | sketchybar --add space space.$sid left \ 33 | --set space.$sid "${space[@]}" \ 34 | --subscribe space.$sid mouse.clicked 35 | done 36 | 37 | spaces_bracket=( 38 | background.color="$BACKGROUND_1" 39 | background.border_color="$BACKGROUND_2" 40 | ) 41 | 42 | separator=( 43 | icon=􀆊 44 | icon.font="$FONT:Heavy:16.0" 45 | padding_left=10 46 | padding_right=8 47 | label.drawing=off 48 | associated_display=active 49 | click_script='yabai -m space --create && sketchybar --trigger space_change' 50 | icon.color="$WHITE" 51 | ) 52 | 53 | sketchybar --add bracket spaces_bracket '/space\..*/' \ 54 | --set spaces_bracket "${spaces_bracket[@]}" \ 55 | \ 56 | --add item separator left \ 57 | --set separator "${separator[@]}" 58 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/volume.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | volume_slider=( 4 | script="$PLUGIN_DIR/volume.sh" 5 | updates=on 6 | label.drawing=off 7 | icon.drawing=off 8 | slider.highlight_color="$BLUE" 9 | slider.background.height=5 10 | slider.background.corner_radius=3 11 | slider.background.color="$BACKGROUND_2" 12 | slider.knob=􀀁 13 | slider.knob.drawing=off 14 | ) 15 | 16 | volume_icon=( 17 | click_script="$PLUGIN_DIR/volume_click.sh" 18 | padding_left=10 19 | icon="$VOLUME_100" 20 | icon.width=0 21 | icon.align=left 22 | icon.color="$GREY" 23 | icon.font="$FONT:Regular:14.0" 24 | label.width=25 25 | label.align=left 26 | label.font="$FONT:Regular:14.0" 27 | ) 28 | 29 | status_bracket=( 30 | background.color="$BACKGROUND_1" 31 | background.border_color="$BACKGROUND_2" 32 | ) 33 | 34 | sketchybar --add slider volume right \ 35 | --set volume "${volume_slider[@]}" \ 36 | --subscribe volume volume_change \ 37 | mouse.clicked \ 38 | mouse.entered \ 39 | mouse.exited \ 40 | \ 41 | --add item volume_icon right \ 42 | --set volume_icon "${volume_icon[@]}" 43 | 44 | sketchybar --add bracket status brew github.bell volume_icon \ 45 | --set status "${status_bracket[@]}" 46 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/items/yabai.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yabai=( 4 | icon.width=0 5 | label.width=0 6 | script="$PLUGIN_DIR/yabai.sh" 7 | icon.font="$FONT:Bold:16.0" 8 | associated_display=active 9 | ) 10 | 11 | sketchybar --add event window_focus \ 12 | --add event windows_on_spaces \ 13 | --add item yabai left \ 14 | --set yabai "${yabai[@]}" \ 15 | --subscribe yabai window_focus \ 16 | space_change \ 17 | windows_on_spaces \ 18 | mouse.clicked 19 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/janky-borders.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | mkEnableOption 11 | mkIf 12 | mkPackageOptionMD 13 | mkOption 14 | types 15 | ; 16 | 17 | cfg = config.services.janky-borders; 18 | in 19 | 20 | { 21 | 22 | options.services.sketchybar = { 23 | enable = mkEnableOption ("jankyBorders"); 24 | 25 | package = mkPackageOptionMD pkgs "jankyBorders" { }; 26 | 27 | config = mkOption { 28 | type = types.lines; 29 | default = ""; 30 | example = '' 31 | #!/bin/bash 32 | 33 | options=( 34 | style=round 35 | width=6.0 36 | hidpi=off 37 | active_color=0xc0e2e2e3 38 | inactive_color=0xc02c2e34 39 | background_color=0x302c2e34 40 | ) 41 | ''; 42 | description = '' 43 | Contents of sketchybar's configuration file. If empty (the default), the configuration file won't be managed. 44 | 45 | See [documentation](https://felixkratz.github.io/SketchyBar/) 46 | and [example](https://github.com/FelixKratz/SketchyBar/blob/master/sketchybarrc). 47 | ''; 48 | }; 49 | }; 50 | # https://github.com/FelixKratz/homebrew-formulae/blob/master/borders.rb#L35 51 | config = mkIf cfg.enable { 52 | environment.systemPackages = [ cfg.package ]; 53 | 54 | launchd.user.agents.borders = { 55 | path = [ cfg.package ] ++ [ config.environment.systemPath ]; 56 | serviceConfig.ProgramArguments = [ "${cfg.package}/bin/borders" ]; 57 | serviceConfig.KeepAlive = true; 58 | serviceConfig.RunAtLoad = true; 59 | }; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/battery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BATTERY_INFO="$(pmset -g batt)" 4 | PERCENTAGE=$(echo "$BATTERY_INFO" | rg -o "\d+%" | cut -d% -f1) 5 | CHARGING=$(echo "$BATTERY_INFO" | grep 'AC Power') 6 | 7 | if [ "$PERCENTAGE" = "" ]; then 8 | exit 0 9 | fi 10 | 11 | DRAWING=on 12 | COLOR=$WHITE 13 | case ${PERCENTAGE} in 14 | 9[0-9] | 100) 15 | ICON=$BATTERY_100 16 | DRAWING=off 17 | ;; 18 | [6-8][0-9]) 19 | ICON=$BATTERY_75 20 | DRAWING=off 21 | ;; 22 | [3-5][0-9]) 23 | ICON=$BATTERY_50 24 | ;; 25 | [1-2][0-9]) 26 | ICON=$BATTERY_25 27 | COLOR=$ORANGE 28 | ;; 29 | *) 30 | ICON=$BATTERY_0 31 | COLOR=$RED 32 | ;; 33 | esac 34 | 35 | if [[ $CHARGING != "" ]]; then 36 | ICON=$BATTERY_CHARGING 37 | DRAWING=off 38 | fi 39 | 40 | sketchybar --set "$NAME" drawing=$DRAWING icon="$ICON" icon.color="$COLOR" 41 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/brew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # shellcheck disable=SC1091 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | COUNT=$(brew outdated | wc -l | tr -d ' ') 7 | 8 | COLOR=$RED 9 | 10 | case "$COUNT" in 11 | [3-5][0-9]) 12 | COLOR=$ORANGE 13 | ;; 14 | [1-2][0-9]) 15 | COLOR=$YELLOW 16 | ;; 17 | [1-9]) 18 | COLOR=$WHITE 19 | ;; 20 | 0) 21 | COLOR=$GREEN 22 | COUNT=􀆅 23 | ;; 24 | esac 25 | 26 | sketchybar --set "$NAME" label="$COUNT" icon.color="$COLOR" 27 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/calendar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sketchybar --set "$NAME" icon="$(date '+%a %d. %b')" label="$(date '+%H:%M')" 4 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/github.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # shellcheck disable=SC1091 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | update() { 7 | NOTIFICATIONS="$(gh api notifications)" 8 | COUNT="$(echo "$NOTIFICATIONS" | jq 'length')" 9 | args=() 10 | if [ "$NOTIFICATIONS" = "[]" ]; then 11 | args+=(--set "$NAME" icon="$BELL" label="0") 12 | else 13 | args+=(--set "$NAME" icon="$BELL_DOT" label="$COUNT") 14 | fi 15 | 16 | PREV_COUNT=$(sketchybar --query github.bell | jq -r .label.value) 17 | # For sound to play around with: 18 | # afplay /System/Library/Sounds/Morse.aiff 19 | 20 | args+=(--remove '/github.notification\.*/') 21 | 22 | COUNTER=0 23 | COLOR=$BLUE 24 | args+=(--set github.bell icon.color="$COLOR") 25 | 26 | while read -r repo url type title; do 27 | COUNTER=$((COUNTER + 1)) 28 | IMPORTANT="$(echo "$title" | grep -iE "(deprecat|break|broke)")" 29 | COLOR=$BLUE 30 | PADDING=0 31 | 32 | if [ "${repo}" = "" ] && [ "${title}" = "" ]; then 33 | repo="Note" 34 | title="No new notifications" 35 | fi 36 | case "${type}" in 37 | "'Issue'") 38 | COLOR=$GREEN 39 | ICON=$GIT_ISSUE 40 | URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)" 41 | ;; 42 | "'Discussion'") 43 | COLOR=$WHITE 44 | ICON=$GIT_DISCUSSION 45 | URL="https://www.github.com/notifications" 46 | ;; 47 | "'PullRequest'") 48 | COLOR=$MAGENTA 49 | ICON=$GIT_PULL_REQUEST 50 | URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)" 51 | ;; 52 | "'Commit'") 53 | COLOR=$WHITE 54 | ICON=$GIT_COMMIT 55 | URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)" 56 | ;; 57 | esac 58 | 59 | if [ "$IMPORTANT" != "" ]; then 60 | COLOR=$RED 61 | ICON=􀁞 62 | args+=(--set github.bell icon.color="$COLOR") 63 | fi 64 | 65 | notification=( 66 | label="$(echo "$title" | sed -e "s/^'//" -e "s/'$//")" 67 | icon="$ICON $(echo "$repo" | sed -e "s/^'//" -e "s/'$//"):" 68 | icon.padding_left="$PADDING" 69 | label.padding_right="$PADDING" 70 | icon.color="$COLOR" 71 | position=popup.github.bell 72 | icon.background.color="$COLOR" 73 | drawing=on 74 | click_script="open $URL; sketchybar --set github.bell popup.drawing=off" 75 | ) 76 | 77 | args+=(--clone github.notification."$COUNTER" github.template 78 | --set github.notification."$COUNTER" "${notification[@]}") 79 | done <<<"$(echo "$NOTIFICATIONS" | jq -r '.[] | [.repository.name, .subject.latest_comment_url, .subject.type, .subject.title] | @sh')" 80 | 81 | sketchybar -m "${args[@]}" >/dev/null 82 | 83 | if [ "$COUNT" -gt "$PREV_COUNT" ] 2>/dev/null || [ "$SENDER" = "forced" ]; then 84 | sketchybar --animate tanh 15 --set github.bell label.y_offset=5 label.y_offset=0 85 | fi 86 | } 87 | 88 | popup() { 89 | sketchybar --set "$NAME" popup.drawing="$1" 90 | } 91 | 92 | case "$SENDER" in 93 | "routine" | "forced") 94 | update 95 | ;; 96 | "mouse.entered") 97 | popup on 98 | ;; 99 | "mouse.exited" | "mouse.exited.global") 100 | popup off 101 | ;; 102 | "mouse.clicked") 103 | popup toggle 104 | ;; 105 | esac 106 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/ical.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # shellcheck disable=SC1091 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | SEP="%" 7 | # This function takes an integer as argument which represents a day. 8 | # 0 is today, 1 is tomorrow, 2 the day after tomorrow etc... 9 | list_events() { 10 | local -n args=$2 11 | EVENT_COUNT=0 12 | DAY_COUNT=$1 13 | args+=(--remove '/ical.day\.*/') 14 | args+=(--remove '/ical.event\.*/') 15 | 16 | # Displays the day in the first row of the list 17 | DATE=$(date -v+"${DAY_COUNT}"d +"%d.%b") 18 | args+=(--clone ical.day."$DAY_COUNT" ical.template 19 | --set ical.day."$DAY_COUNT" icon="$(date -v+"${DAY_COUNT}"d +"%a %d.%b")" 20 | icon.color="$GREEN" 21 | click_script="sketchybar --set $NAME popup.drawing=off" 22 | position=popup.ical 23 | drawing=on) 24 | if [ "${DAY_COUNT}" == "0" ]; then 25 | args+=(--set ical.day."$DAY_COUNT" drawing=off) 26 | EVENTS="$(icalBuddy -eed -n -nc -nrd -npn -ea -df "" -tf "%H.%S" -iep datetime,title -b '' -ps "|$SEP|" eventsFrom:"$DATE" to:"$DATE")" 27 | else 28 | args+=(--set ical.day."$DAY_COUNT" drawing=on) 29 | EVENTS="$(icalBuddy -eed -nc -nrd -npn -ea -df "" -tf "%H.%S" -iep datetime,title -b '' -ps "|$SEP|" eventsFrom:"$DATE" to:"$DATE")" 30 | fi 31 | 32 | # Displays the events of the day (time and title) 33 | while read -r line; do 34 | ((EVENT_COUNT++)) 35 | if [ "${line}" != "" ]; then 36 | IFS="${SEP}" read -ra event_parts <<<"$line" 37 | time="${event_parts[1]}" 38 | title="${event_parts[0]}" 39 | else 40 | time="No events" 41 | title=":)" 42 | fi 43 | args+=(--clone ical.event."$EVENT_COUNT" ical.template 44 | --set ical.event."$EVENT_COUNT" label="$title" 45 | icon="$time" 46 | icon.color="$YELLOW" 47 | click_script="sketchybar --set $NAME popup.drawing=off" 48 | position=popup.ical 49 | drawing=on) 50 | done <<<"$EVENTS" 51 | } 52 | 53 | mouse_clicked() { 54 | local args=() 55 | DAY_COUNT=$(sketchybar --query ical | jq -r '.popup.items[] | select(startswith("ical.day.")) | split(".")[-1]') 56 | if [ "$BUTTON" = "left" ]; then 57 | ((DAY_COUNT++)) 58 | else 59 | if [ "$DAY_COUNT" -gt 0 ]; then 60 | ((DAY_COUNT--)) 61 | else 62 | return 63 | fi 64 | fi 65 | list_events $DAY_COUNT args 66 | sketchybar -m "${args[@]}" >/dev/null 67 | } 68 | 69 | update() { 70 | local args=() 71 | list_events 0 args 72 | EVENTS="$(icalBuddy -eed -n -nc -nrd -npn -ea -df "" -tf "%H.%S" -iep datetime -b '' -ps "|$SEP|" eventsToday)" 73 | # Comment this if-section out if you don't want the time of the next event next to the icon 74 | if [ "${EVENTS}" != "" ]; then 75 | args+=(--set "$NAME" label="$(echo "${EVENTS}" | head -n1)") 76 | else 77 | args+=(--set "$NAME" label="") 78 | fi 79 | 80 | sketchybar -m "${args[@]}" >/dev/null 81 | if [ "$SENDER" = "forced" ]; then 82 | sketchybar --animate tanh 15 --set "$NAME" label.y_offset=5 label.y_offset=0 83 | fi 84 | } 85 | 86 | popup() { 87 | sketchybar --set "$NAME" popup.drawing="$1" 88 | } 89 | 90 | case "$SENDER" in 91 | "routine" | "forced") 92 | update 93 | ;; 94 | "mouse.entered") 95 | popup on 96 | ;; 97 | "mouse.exited.global") 98 | popup off 99 | update 100 | ;; 101 | "mouse.clicked") 102 | mouse_clicked 103 | ;; 104 | esac 105 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/mail.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # shellcheck disable=SC1091 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | RUNNING=$(osascript -e 'if application "Mail" is running then return 0') 7 | COUNT=0 8 | 9 | if [ "$RUNNING" = "0" ]; then 10 | COUNT=$(osascript -e 'tell application "Mail" to return the unread count of inbox') 11 | if [ "$COUNT" -gt "0" ]; then 12 | sketchybar --set "$NAME" label="$COUNT" icon="$MAIL" drawing=on 13 | else 14 | sketchybar --set "$NAME" drawing=off 15 | fi 16 | else 17 | sketchybar --set "$NAME" label="!" icon="$MAIL" drawing=on 18 | fi 19 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/mic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MIC_VOLUME=$(osascript -e 'input volume of (get volume settings)') 4 | 5 | if [[ $MIC_VOLUME -eq 0 ]]; then 6 | sketchybar -m --set mic icon=􀊲 7 | elif [[ $MIC_VOLUME -gt 0 ]]; then 8 | sketchybar -m --set mic icon=􀊰 9 | fi 10 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/mic_click.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MIC_VOLUME=$(osascript -e 'input volume of (get volume settings)') 4 | 5 | if [[ $MIC_VOLUME -eq 0 ]]; then 6 | osascript -e 'set volume input volume 50' 7 | sketchybar -m --set mic icon=􀊰 8 | elif [[ $MIC_VOLUME -gt 0 ]]; then 9 | osascript -e 'set volume input volume 0' 10 | sketchybar -m --set mic icon=􀊲 11 | fi 12 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/space.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | update() { 4 | COLOR=$BACKGROUND_2 5 | if [ "$SELECTED" = "true" ]; then 6 | COLOR=$GREY 7 | fi 8 | sketchybar --set "$NAME" icon.highlight="$SELECTED" \ 9 | label.highlight="$SELECTED" \ 10 | background.border_color="$COLOR" 11 | } 12 | 13 | mouse_clicked() { 14 | if [ "$BUTTON" = "right" ]; then 15 | yabai -m space --destroy "$SID" 16 | sketchybar --trigger windows_on_spaces --trigger space_change 17 | else 18 | yabai -m space --focus "$SID" 2>/dev/null 19 | fi 20 | } 21 | 22 | case "$SENDER" in 23 | "mouse.clicked") 24 | mouse_clicked 25 | ;; 26 | *) 27 | update 28 | ;; 29 | esac 30 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/volume.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WIDTH=100 4 | 5 | volume_change() { 6 | case $INFO in 7 | [6-9][0-9] | 100) 8 | ICON=$VOLUME_100 9 | ;; 10 | [3-5][0-9]) 11 | ICON=$VOLUME_66 12 | ;; 13 | [1-2][0-9]) 14 | ICON=$VOLUME_33 15 | ;; 16 | [1-9]) 17 | ICON=$VOLUME_10 18 | ;; 19 | 0) 20 | ICON=$VOLUME_0 21 | ;; 22 | *) ICON=$VOLUME_100 ;; 23 | esac 24 | 25 | sketchybar --set volume_icon label="$ICON" 26 | 27 | sketchybar --set "$NAME" slider.percentage="$INFO" \ 28 | --animate tanh 30 --set "$NAME" slider.width=$WIDTH 29 | 30 | sleep 2 31 | 32 | # Check wether the volume was changed another time while sleeping 33 | FINAL_PERCENTAGE=$(sketchybar --query "$NAME" | jq -r ".slider.percentage") 34 | if [ "$FINAL_PERCENTAGE" -eq "$INFO" ]; then 35 | sketchybar --animate tanh 30 --set "$NAME" slider.width=0 36 | fi 37 | } 38 | 39 | mouse_clicked() { 40 | osascript -e "set volume output volume $PERCENTAGE" 41 | } 42 | 43 | mouse_entered() { 44 | sketchybar --set "$NAME" slider.knob.drawing=on 45 | } 46 | 47 | mouse_exited() { 48 | sketchybar --set "$NAME" slider.knob.drawing=off 49 | } 50 | 51 | case "$SENDER" in 52 | "volume_change") 53 | volume_change 54 | ;; 55 | "mouse.clicked") 56 | mouse_clicked 57 | ;; 58 | "mouse.entered") 59 | mouse_entered 60 | ;; 61 | "mouse.exited") 62 | mouse_exited 63 | ;; 64 | esac 65 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/volume_click.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WIDTH=100 4 | 5 | detail_on() { 6 | sketchybar --animate tanh 30 --set volume slider.width=$WIDTH 7 | } 8 | 9 | detail_off() { 10 | sketchybar --animate tanh 30 --set volume slider.width=0 11 | } 12 | 13 | toggle_detail() { 14 | INITIAL_WIDTH=$(sketchybar --query volume | jq -r ".slider.width") 15 | if [ "$INITIAL_WIDTH" -eq "0" ]; then 16 | detail_on 17 | else 18 | detail_off 19 | fi 20 | } 21 | 22 | toggle_devices() { 23 | which SwitchAudioSource >/dev/null || exit 0 24 | # source "$CONFIG_DIR/colors.sh" 25 | 26 | args=(--remove '/volume.device\.*/' --set "$NAME" popup.drawing=toggle) 27 | COUNTER=0 28 | CURRENT="$(SwitchAudioSource -t output -c)" 29 | while IFS= read -r device; do 30 | COLOR=$GREY 31 | if [ "${device}" = "$CURRENT" ]; then 32 | COLOR=$WHITE 33 | fi 34 | args+=(--add item volume.device."$COUNTER" popup."$NAME" 35 | --set volume.device."$COUNTER" label="${device}" 36 | label.color="$COLOR" 37 | click_script="SwitchAudioSource -s \"${device}\" && sketchybar --set /volume.device\.*/ label.color=$GREY --set \$NAME label.color=$WHITE --set $NAME popup.drawing=off") 38 | COUNTER=$((COUNTER + 1)) 39 | done <<<"$(SwitchAudioSource -a -t output)" 40 | 41 | sketchybar -m "${args[@]}" >/dev/null 42 | } 43 | 44 | if [ "$BUTTON" = "right" ] || [ "$MODIFIER" = "shift" ]; then 45 | toggle_devices 46 | else 47 | toggle_detail 48 | fi 49 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/yabai.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LAYOUT=$(yabai -m query --spaces --space | jq -r .type) 3 | 4 | window_state() { 5 | # shellcheck disable=SC1091 6 | source "$CONFIG_DIR/colors.sh" 7 | # shellcheck disable=SC1091 8 | source "$CONFIG_DIR/icons.sh" 9 | 10 | WINDOW=$(yabai -m query --windows --window) 11 | STACK_INDEX=$(echo "$WINDOW" | jq '.["stack-index"]') 12 | 13 | COLOR=$BAR_BORDER_COLOR 14 | ICON="" 15 | 16 | if [ "$(echo "$WINDOW" | jq '.["is-floating"]')" = "true" ]; then 17 | ICON+=$YABAI_FLOAT 18 | COLOR=$MAGENTA 19 | elif [ "$(echo "$WINDOW" | jq '.["has-fullscreen-zoom"]')" = "true" ]; then 20 | ICON+=$YABAI_FULLSCREEN_ZOOM 21 | COLOR=$GREEN 22 | elif [ "$(echo "$WINDOW" | jq '.["has-parent-zoom"]')" = "true" ]; then 23 | ICON+=$YABAI_PARENT_ZOOM 24 | COLOR=$BLUE 25 | elif [[ $STACK_INDEX -gt 0 ]]; then 26 | LAST_STACK_INDEX=$(yabai -m query --windows --window stack.last | jq '.["stack-index"]') 27 | ICON+=$YABAI_STACK 28 | LABEL="$(printf "[%s/%s]" "$STACK_INDEX" "$LAST_STACK_INDEX")" 29 | COLOR=$RED 30 | elif [[ $LAYOUT == "bsp" ]]; then 31 | ICON+=$YABAI_BSP 32 | fi 33 | 34 | args=(--animate sin 10 --bar border_color="$COLOR" 35 | --set "$NAME" icon.color="$COLOR") 36 | 37 | [ -z "$LABEL" ] && args+=(label.width=0) || 38 | args+=(label="$LABEL" label.width=40) 39 | 40 | [ -z "$ICON" ] && args+=(icon.width=0) || 41 | args+=(icon="$ICON" icon.width=30) 42 | 43 | sketchybar -m "${args[@]}" 44 | } 45 | 46 | windows_on_spaces() { 47 | CURRENT_SPACES="$(yabai -m query --displays | jq -r '.[].spaces | @sh')" 48 | 49 | args=(--set spaces_bracket drawing=off 50 | --set '/space\..*/' background.drawing=on 51 | --animate sin 10) 52 | 53 | while read -r line; do 54 | for space in $line; do 55 | icon_strip=" " 56 | apps=$(yabai -m query --windows --space "$space" | jq -r ".[].app") 57 | if [ "$apps" != "" ]; then 58 | while IFS= read -r app; do 59 | icon_strip+=" $("$CONFIG_DIR"/plugins/icon_map.sh "$app")" 60 | done <<<"$apps" 61 | fi 62 | args+=(--set "space.$space" label="$icon_strip" label.drawing=on) 63 | done 64 | done <<<"$CURRENT_SPACES" 65 | 66 | sketchybar -m "${args[@]}" 67 | } 68 | 69 | mouse_clicked() { 70 | case "$LAYOUT" in 71 | bsp) 72 | yabai -m space --layout stack 73 | ;; 74 | stack) 75 | yabai -m space --layout bsp 76 | ;; 77 | float) 78 | yabai -m space --layout bsp 79 | ;; 80 | esac 81 | window_state 82 | } 83 | 84 | case "$SENDER" in 85 | "mouse.clicked") 86 | mouse_clicked 87 | ;; 88 | "forced") 89 | exit 0 90 | ;; 91 | "window_focus") 92 | window_state 93 | ;; 94 | "windows_on_spaces" | "space_change") 95 | windows_on_spaces 96 | ;; 97 | esac 98 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/plugins/zen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | zen_on() { 4 | sketchybar --set github.bell drawing=off \ 5 | --set apple.logo drawing=off \ 6 | --set '/cpu.*/' drawing=off \ 7 | --set calendar icon.drawing=off \ 8 | --set separator drawing=off \ 9 | --set front_app drawing=off \ 10 | --set volume_icon drawing=off \ 11 | --set spotify.anchor drawing=off \ 12 | --set spotify.play updates=off \ 13 | --set brew drawing=off 14 | } 15 | 16 | zen_off() { 17 | sketchybar --set github.bell drawing=on \ 18 | --set apple.logo drawing=on \ 19 | --set '/cpu.*/' drawing=on \ 20 | --set calendar icon.drawing=on \ 21 | --set separator drawing=on \ 22 | --set front_app drawing=on \ 23 | --set volume_icon drawing=on \ 24 | --set spotify.play updates=on \ 25 | --set brew drawing=on 26 | } 27 | 28 | if [ "$1" = "on" ]; then 29 | zen_on 30 | elif [ "$1" = "off" ]; then 31 | zen_off 32 | else 33 | if [ "$(sketchybar --query apple.logo | jq -r ".geometry.drawing")" = "on" ]; then 34 | zen_on 35 | else 36 | zen_off 37 | fi 38 | fi 39 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/readme.org: -------------------------------------------------------------------------------- 1 | #+title: sketchbar config 2 | 3 | * gh 4 | to get notifications working, one needs to configure the subcriptios to notify on github 5 | https://github.com/settings/notifications 6 | 7 | * ical 8 | will ask for permission 9 | -------------------------------------------------------------------------------- /modules/wm/sketchybar/sketchybarrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . "$CONFIG_DIR/colors.sh" # Loads all defined colors 4 | . "$CONFIG_DIR/icons.sh" # Loads all defined icons 5 | 6 | ITEM_DIR="$CONFIG_DIR/items" # Directory where the items are configured 7 | PLUGIN_DIR="$CONFIG_DIR/plugins" # Directory where all the plugin scripts are stored 8 | 9 | FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants 10 | PADDINGS=3 # All paddings use this value (icon, label, background) 11 | 12 | # Setting up and starting the helper process 13 | HELPER=git.felix.helper 14 | killall sketchybar-cpu-helper 15 | 16 | # (cd $CONFIG_DIR/helper && make) 17 | # $CONFIG_DIR/helper/helper $HELPER > /dev/null 2>&1 & 18 | 19 | sketchybar-cpu-helper $HELPER > /dev/null 2>&1 & 20 | # Unload the macOS on screen indicator overlay for volume change 21 | launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 & 22 | 23 | # Setting up the general bar appearance of the bar 24 | bar=( 25 | height=45 26 | color="$BAR_COLOR" 27 | border_width=2 28 | border_color="$BAR_BORDER_COLOR" 29 | shadow=off 30 | position=top 31 | sticky=on 32 | padding_right=10 33 | padding_left=10 34 | y_offset=-5 35 | margin=-2 36 | ) 37 | 38 | sketchybar --bar "${bar[@]}" 39 | 40 | # Setting up default values 41 | defaults=( 42 | updates=when_shown 43 | icon.font="$FONT:Bold:14.0" 44 | icon.color="$ICON_COLOR" 45 | icon.padding_left="$PADDINGS" 46 | icon.padding_right="$PADDINGS" 47 | label.font="$FONT:Semibold:13.0" 48 | label.color="$LABEL_COLOR" 49 | label.padding_left="$PADDINGS" 50 | label.padding_right="$PADDINGS" 51 | padding_right="$PADDINGS" 52 | padding_left="$PADDINGS" 53 | background.height=26 54 | background.corner_radius=9 55 | background.border_width=2 56 | popup.background.border_width=2 57 | popup.background.corner_radius=9 58 | popup.background.border_color="$POPUP_BORDER_COLOR" 59 | popup.background.color="$POPUP_BACKGROUND_COLOR" 60 | popup.blur_radius=20 61 | popup.background.shadow.drawing=on 62 | ) 63 | 64 | sketchybar --default "${defaults[@]}" 65 | 66 | # Left 67 | source "$ITEM_DIR/apple.sh" 68 | source "$ITEM_DIR/spaces.sh" 69 | source "$ITEM_DIR/yabai.sh" 70 | source "$ITEM_DIR/front_app.sh" 71 | # Center 72 | 73 | 74 | # Right 75 | source "$ITEM_DIR/calendar.sh" 76 | source "$ITEM_DIR/brew.sh" 77 | source "$ITEM_DIR/github.sh" 78 | source "$ITEM_DIR/volume.sh" 79 | source "$ITEM_DIR/cpu.sh" 80 | source "$ITEM_DIR/battery.sh" 81 | source "$ITEM_DIR/mic.sh" 82 | 83 | 84 | # Forcing all item scripts to run (never do this outside of sketchybarrc) 85 | sketchybar --update 86 | 87 | echo "sketchybar configuation loaded.." 88 | t 89 | -------------------------------------------------------------------------------- /packages/30-apps.nix: -------------------------------------------------------------------------------- 1 | _self: super: { 2 | 3 | installApplication = 4 | { 5 | name, 6 | appname ? name, 7 | version, 8 | src, 9 | description, 10 | homepage, 11 | postInstall ? "", 12 | sourceRoot ? ".", 13 | ... 14 | }: 15 | 16 | with super; 17 | stdenv.mkDerivation { 18 | name = "${name}-${version}"; 19 | version = "${version}"; 20 | inherit src; 21 | buildInputs = [ 22 | undmg 23 | unzip 24 | ]; 25 | inherit sourceRoot; 26 | phases = [ 27 | "unpackPhase" 28 | "installPhase" 29 | ]; 30 | installPhase = 31 | '' 32 | mkdir -p "$out/Applications/${appname}.app" 33 | cp -pR * "$out/Applications/${appname}.app" 34 | '' 35 | + postInstall; 36 | meta = with stdenv.lib; { 37 | inherit description; 38 | inherit homepage; 39 | maintainers = [ ]; 40 | platforms = platforms.darwin; 41 | }; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /packages/alerter/alerter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/packages/alerter/alerter -------------------------------------------------------------------------------- /packages/alerter/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib }: 2 | stdenv.mkDerivation rec { 3 | 4 | pname = "alerter"; 5 | # big sur version 6 | version = "1.0.1"; 7 | 8 | # nativeBuildInputs = [ unzip ]; 9 | 10 | # src = fetchurl { 11 | # url = "https://github.com/vjeantet/alerter/releases/download/1.0.1/alerter_v1.0.1_darwin_amd64.zip"; 12 | # # "https://github.com/vjeantet/alerter/releases/download/${version}/alerter_v${version}_darwin_amd64.zip"; 13 | # sha256 = "sha256-gWHzn1CBcpKrGRD1pi3M/kOEuQShXvBnavBlgg3KLVo="; 14 | # }; 15 | # # Work around the "unpacker appears to have produced no directories" 16 | # # case that happens when the archive doesn't have a subdirectory. 17 | # # setSourceRoot = "sourceRoot=`pwd`"; 18 | 19 | # buildPhase = '' 20 | # unzip $src 21 | # ''; 22 | 23 | installPhase = '' 24 | mkdir -p $out 25 | cp ${./alerter} $out/alerter-bin 26 | ''; 27 | 28 | meta = { 29 | homepage = "https://github.com/vjeantet/alerter"; 30 | description = "alerter"; 31 | longDescription = '' 32 | alerter is a command-line tool to send Mac OS X User Alerts (Notifications), 33 | which are available in Mac OS X 10.8 and higher. (even catalina) the program ends when the alerter is activated or closed, 34 | writing a the activated value to output (stdout), or a json object to describe the alert event. 35 | ''; 36 | license = lib.licenses.mit; 37 | platforms = [ 38 | "x86_64-darwin" 39 | "aarch64-darwin" 40 | ]; 41 | }; 42 | 43 | dontUnpack = true; 44 | } 45 | -------------------------------------------------------------------------------- /packages/ask/release.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkDerivation, 3 | base, 4 | containers, 5 | mtl, 6 | fetchFromGitHub, 7 | }: 8 | mkDerivation { 9 | pname = "ask"; 10 | version = "0.1.0.0"; 11 | src = fetchFromGitHub { 12 | owner = "msp-strath"; 13 | repo = "ask"; 14 | rev = "51ee4b6b377685e6ec4bb7bd4b90d3c54b58598f"; 15 | # sha256 = lib.fakeSha256; 16 | sha256 = "sha256-ydr/AKbaiphSl19oLsWt7QL9T0jBOdCnaX+aL3MkU/A="; 17 | 18 | }; 19 | isLibrary = true; 20 | isExecutable = true; 21 | libraryHaskellDepends = [ 22 | base 23 | containers 24 | mtl 25 | ]; 26 | executableHaskellDepends = [ base ]; 27 | testHaskellDepends = [ base ]; 28 | license = "unknown"; 29 | mainProgram = "ask"; 30 | } 31 | -------------------------------------------------------------------------------- /packages/cabal.project: -------------------------------------------------------------------------------- 1 | packages: 2 | ./resource-id 3 | ./doc-server 4 | -------------------------------------------------------------------------------- /packages/choose-mac.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | lib, 4 | fetchurl, 5 | }: 6 | 7 | stdenv.mkDerivation rec { 8 | pname = "choose-mac"; 9 | 10 | version = "1.3.1"; 11 | src = fetchurl { 12 | url = "https://github.com/chipsenkbeil/choose/releases/download/${version}/choose"; 13 | sha256 = "1d0efb2e2a2c1d6a39830726ab7433da64cc22ca2eed19efd6678090cbb9e325"; 14 | }; 15 | 16 | dontBuild = true; 17 | dontUnpack = true; 18 | 19 | installPhase = '' 20 | runHook preInstall 21 | 22 | mkdir -p $out/bin 23 | cp $src $out/bin/choose 24 | chmod +x $out/bin/choose 25 | 26 | runHook postInstall 27 | ''; 28 | 29 | meta = with lib; { 30 | maintainers = with maintainers; [ ]; 31 | homepage = "https://github.com/chipsenkbeil/choose"; 32 | license = licenses.mit; 33 | platforms = platforms.darwin; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /packages/dart.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | fetchurl, 4 | unzip, 5 | lib, 6 | }: 7 | stdenv.mkDerivation rec { 8 | 9 | pname = "dart"; 10 | version = "2.19.6"; 11 | nativeBuildInputs = [ unzip ]; 12 | 13 | src = fetchurl { 14 | # https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.6/sdk/dartsdk-macos-arm64-release.zip 15 | # https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.6/sdk/dartsdk-macos-x64-release.zip 16 | url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-arm64-release.zip"; 17 | sha256 = "PGtUtvRLyji9x4WOpFc08peVHrpfsQyPp7hrSj9D7bY="; 18 | # sha256 = lib.fakeSha256; 19 | }; 20 | 21 | installPhase = '' 22 | mkdir -p $out 23 | cp -R * $out/ 24 | 25 | # create wrappers with correct env 26 | #for program in dart dart2js dart2native dartanalyzer dartaotruntime dartdevc dartdoc dartfmt pub; do 27 | # programPath="$out/dart/bin/$program" 28 | # binaryPath="$out/bin/$program" 29 | # mkdir -p $out/bin 30 | # ln -s $programPath $binaryPath 31 | #done 32 | ''; 33 | 34 | libPath = lib.makeLibraryPath [ stdenv.cc.cc ]; 35 | 36 | dontStrip = true; 37 | 38 | meta = { 39 | homepage = "https://www.dartlang.org/"; 40 | description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps"; 41 | longDescription = '' 42 | Dart is a class-based, single inheritance, object-oriented language 43 | with C-style syntax. It offers compilation to JavaScript, interfaces, 44 | mixins, abstract classes, reified generics, and optional typing. 45 | ''; 46 | license = lib.licenses.bsd3; 47 | platforms = [ "aarch64-darwin" ]; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /packages/doc-server/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Revision history for doc-server 2 | 3 | ## 0.1.0.0 -- YYYY-mm-dd 4 | 5 | * First version. Released on an unsuspecting world. 6 | -------------------------------------------------------------------------------- /packages/doc-server/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 yuanwang 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /packages/doc-server/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import qualified Data.Foldable as F 4 | import qualified Data.Traversable as T 5 | -- Deprecated: "Use record 'dirTree'" 6 | import System.Directory.Tree 7 | 8 | main :: IO () 9 | main = do 10 | d <- readDirectoryWithL readFile "." 11 | mapM_ (putStrLn . name) $ contents $ dirTree d 12 | -------------------------------------------------------------------------------- /packages/doc-server/doc-server.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | 3 | -- The cabal-version field refers to the version of the .cabal specification, 4 | -- and can be different from the cabal-install (the tool) version and the 5 | -- Cabal (the library) version you are using. As such, the Cabal (the library) 6 | -- version used must be equal or greater than the version stated in this field. 7 | -- Starting from the specification version 2.2, the cabal-version field must be 8 | -- the first thing in the cabal file. 9 | 10 | -- Initial package description 'doc-server' generated by 11 | -- 'cabal init'. For further documentation, see: 12 | -- http://haskell.org/cabal/users-guide/ 13 | -- 14 | -- The name of the package. 15 | name: doc-server 16 | 17 | -- The package version. 18 | -- See the Haskell package versioning policy (PVP) for standards 19 | -- guiding when and how versions should be incremented. 20 | -- https://pvp.haskell.org 21 | -- PVP summary: +-+------- breaking API changes 22 | -- | | +----- non-breaking API additions 23 | -- | | | +--- code changes with no API change 24 | version: 0.1.0.0 25 | 26 | -- A short (one-line) description of the package. 27 | -- synopsis: 28 | 29 | -- A longer description of the package. 30 | -- description: 31 | 32 | -- The license under which the package is released. 33 | license: MIT 34 | 35 | -- The file containing the license text. 36 | license-file: LICENSE 37 | 38 | -- The package author(s). 39 | author: yuanwang 40 | 41 | -- An email address to which users can send suggestions, bug reports, and patches. 42 | maintainer: me@yuanwang.ca 43 | 44 | -- A copyright notice. 45 | -- copyright: 46 | build-type: Simple 47 | 48 | -- Extra doc files to be distributed with the package, such as a CHANGELOG or a README. 49 | extra-doc-files: CHANGELOG.md 50 | 51 | -- Extra source files to be distributed with the package, such as examples, or a tutorial module. 52 | -- extra-source-files: 53 | 54 | common warnings 55 | ghc-options: -Wall 56 | 57 | executable doc-server 58 | -- Import common warning flags. 59 | import: warnings 60 | 61 | -- .hs or .lhs file containing the Main module. 62 | main-is: Main.hs 63 | 64 | -- Modules included in this executable, other than Main. 65 | -- other-modules: 66 | 67 | -- LANGUAGE extensions used by modules in this package. 68 | -- other-extensions: 69 | 70 | -- Other library packages from which modules are imported. 71 | build-depends: 72 | , base 73 | , directory-tree 74 | 75 | -- Directories containing source files. 76 | hs-source-dirs: app 77 | 78 | -- Base language which the package is written in. 79 | default-language: Haskell2010 80 | -------------------------------------------------------------------------------- /packages/emojify.nix: -------------------------------------------------------------------------------- 1 | _: super: { 2 | 3 | emojify = 4 | with super; 5 | stdenv.mkDerivation rec { 6 | 7 | pname = "emojify"; 8 | version = "2.1.0"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "mrowa44"; 12 | repo = "emojify"; 13 | # The git tag to fetch 14 | rev = "${version}"; 15 | # Hashes must be specified so that the build is purely functional 16 | sha256 = "0l53fm1j72hcaais2k8499gcgqndxy93nkbw4r5mkpm6hn2qa9xw"; 17 | }; 18 | 19 | # We override the install phase, as the emojify project doesn't use make 20 | installPhase = '' 21 | # Make the output directory 22 | mkdir -p $out/bin 23 | 24 | # Copy the script there and make it executable 25 | cp emojify $out/bin/ 26 | chmod +x $out/bin/emojify 27 | ''; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /packages/font-hack-nerd-font.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | unzip, 4 | fetchurl, 5 | lib, 6 | }: 7 | 8 | stdenv.mkDerivation rec { 9 | pname = "font-hack-nerd-font"; 10 | version = "3.1.1"; 11 | 12 | src = fetchurl { 13 | url = "https://github.com//ryanoasis/nerd-fonts/releases/download/v${version}/Hack.zip"; 14 | hash = "sha256-XP+52rWuunKUyrizKo1QyCY/Y9YIOzhBHkAD0TQkBo4="; 15 | # hash = lib.fakeHash; 16 | }; 17 | 18 | buildInputs = [ unzip ]; 19 | sourceRoot = "."; 20 | 21 | installPhase = '' 22 | install_path=$out/share/fonts/truetype 23 | mkdir -p $install_path 24 | find -name "*.ttf" -exec cp {} $install_path \; 25 | ''; 26 | 27 | meta = with lib; { 28 | description = '' 29 | eveloper targeted fonts with a high number of glyphs 30 | ''; 31 | homepage = "https://github.com/ryanoasis/nerd-fonts"; 32 | platforms = platforms.darwin; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /packages/gotta-go-fast.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | mkDerivation, 4 | base, 5 | brick, 6 | cmdargs, 7 | directory, 8 | file-embed, 9 | random, 10 | split, 11 | text, 12 | time, 13 | vty, 14 | word-wrap, 15 | }: 16 | mkDerivation { 17 | pname = "gotta-go-fast"; 18 | version = "0.3.0.8"; 19 | sha256 = "0b056xnhq64knpvwjnkqicgny4g8pa1nbq811miwmkgv9w1g76kc"; 20 | isLibrary = false; 21 | isExecutable = true; 22 | executableHaskellDepends = [ 23 | base 24 | brick 25 | cmdargs 26 | directory 27 | file-embed 28 | random 29 | split 30 | text 31 | time 32 | vty 33 | word-wrap 34 | ]; 35 | description = "A command line utility for practicing typing"; 36 | license = lib.licenses.bsd3; 37 | hydraPlatforms = lib.platforms.none; 38 | mainProgram = "gotta-go-fast"; 39 | } 40 | -------------------------------------------------------------------------------- /packages/hi-chew/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.log 4 | tmp/ 5 | 6 | dist 7 | dist-* 8 | cabal-dev 9 | *.o 10 | *.hi 11 | *.hie 12 | *.chi 13 | *.chs.h 14 | *.dyn_o 15 | *.dyn_hi 16 | .hpc 17 | .hsenv 18 | .cabal-sandbox/ 19 | cabal.sandbox.config 20 | *.prof 21 | *.aux 22 | *.hp 23 | *.eventlog 24 | .stack-work/ 25 | cabal.project.local 26 | cabal.project.local~ 27 | .HTF/ 28 | .ghc.environment.* 29 | -------------------------------------------------------------------------------- /packages/hi-chew/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Revision history for hi-chew 2 | 3 | ## 0.1.0.0 -- YYYY-mm-dd 4 | 5 | * First version. Released on an unsuspecting world. 6 | -------------------------------------------------------------------------------- /packages/hi-chew/app/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DeriveGeneric #-} 2 | {-# LANGUAGE OverloadedStrings #-} 3 | 4 | module Main where 5 | 6 | import Control.Monad 7 | import Data.Map qualified as Map 8 | import Data.Maybe (fromJust, isJust) 9 | import Data.Text qualified as T 10 | import Data.Vector qualified as V 11 | import Dhall 12 | ( FromDhall, 13 | Generic, 14 | Text, 15 | Vector, 16 | auto, 17 | input, 18 | ) 19 | import System.Environment (getArgs, lookupEnv) 20 | import Turtle hiding (input) 21 | 22 | data Project = Project 23 | { name :: Text, 24 | repoUrl :: Text, 25 | checkoutCommand :: Maybe Text, 26 | devLog :: Text, 27 | prodLog :: Text 28 | } 29 | deriving (Generic, Show) 30 | 31 | instance FromDhall Project 32 | 33 | toMap :: Vector Project -> Map.Map Text Project 34 | toMap = Map.fromList . map (\p -> (name p, p)) . V.toList 35 | 36 | actions :: Project -> Text 37 | actions project = "gum choose repo log" <> if (isJust . checkoutCommand) project then " checkout" else "" 38 | 39 | openLink :: Text -> Shell (Either Line Line) 40 | openLink = (`inshellWithErr` empty) . format ("open -a firefox -g " % s) 41 | 42 | pasteCmd :: Text -> Shell (Either Line Line) 43 | pasteCmd = (`inshellWithErr` empty) . format ("echo " % s % " | pbcopy") 44 | 45 | openRepo :: Project -> Shell (Either Line Line) 46 | openRepo project = openLink (repoUrl project) 47 | 48 | openLog :: Project -> Shell (Either Line Line) 49 | openLog project = do 50 | projectEnv <- inshell "gum choose dev prod" empty 51 | case lineToText projectEnv of 52 | "dev" -> openLink (devLog project) 53 | "prod" -> openLink (prodLog project) 54 | 55 | work :: Map.Map Text Project -> Shell (Either Line Line) 56 | work projectMap = do 57 | repo <- inshell (foldr (\a b -> b <> " " <> a) "gum choose " (Map.keys projectMap)) empty 58 | action <- inshell (actions . fromJust . flip Map.lookup projectMap . lineToText $ repo) empty 59 | case lineToText action of 60 | "repo" -> openRepo (fromJust . flip Map.lookup projectMap . lineToText $ repo) 61 | "log" -> openLog (fromJust . flip Map.lookup projectMap . lineToText $ repo) 62 | "checkout" -> 63 | pasteCmd 64 | ( fromJust 65 | . ( checkoutCommand 66 | Control.Monad.<=< (flip Map.lookup projectMap . lineToText) 67 | ) 68 | $ repo 69 | ) 70 | 71 | main :: IO () 72 | main = do 73 | projectMap <- fmap toMap loadProject 74 | view (work projectMap) 75 | 76 | getConfigDir :: IO String 77 | getConfigDir = liftA2 (++) base (pure "hi-chew") 78 | where 79 | base = 80 | fmap 81 | (maybe "$HOME/." (++ "/")) 82 | (lookupEnv "XDG_CONFIG_HOME") 83 | 84 | loadProject :: IO (Vector Project) 85 | loadProject = do 86 | file <- fmap (++ "/config.dhall") getConfigDir 87 | input auto (T.pack file) 88 | -------------------------------------------------------------------------------- /packages/hi-chew/hi-chew.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.4 2 | name: hi-chew 3 | version: 0.1.0.0 4 | 5 | -- A short (one-line) description of the package. 6 | -- synopsis: 7 | 8 | -- A longer description of the package. 9 | -- description: 10 | 11 | -- A URL where users can report bugs. 12 | -- bug-reports: 13 | 14 | -- The license under which the package is released. 15 | -- license: 16 | author: yuanwang 17 | maintainer: yuan.wang@workiva.com 18 | 19 | -- A copyright notice. 20 | -- copyright: 21 | -- category: 22 | extra-source-files: CHANGELOG.md 23 | 24 | executable hi-chew 25 | main-is: Main.hs 26 | default-extensions: ImportQualifiedPost 27 | 28 | -- Modules included in this executable, other than Main. 29 | -- other-modules: 30 | 31 | -- LANGUAGE extensions used by modules in this package. 32 | -- other-extensions: 33 | build-depends: 34 | , base >=4.16.3.0 && <5 35 | , containers 36 | , dhall 37 | , text 38 | , turtle 39 | , vector 40 | 41 | hs-source-dirs: app 42 | default-language: Haskell2010 43 | -------------------------------------------------------------------------------- /packages/hi-chew/release.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkDerivation, 3 | base, 4 | containers, 5 | dhall, 6 | text, 7 | turtle, 8 | vector, 9 | }: 10 | mkDerivation { 11 | pname = "hi-chew"; 12 | version = "0.1.0.0"; 13 | src = ./.; 14 | isLibrary = false; 15 | isExecutable = true; 16 | executableHaskellDepends = [ 17 | base 18 | containers 19 | dhall 20 | text 21 | turtle 22 | vector 23 | ]; 24 | license = "unknown"; 25 | mainProgram = "hi-chew"; 26 | } 27 | -------------------------------------------------------------------------------- /packages/hosts.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchFromGitHub }: 2 | 3 | stdenv.mkDerivation rec { 4 | pname = "StevenBlack-hosts"; 5 | version = "3.9.30"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "StevenBlack"; 9 | repo = "hosts"; 10 | rev = "${version}"; 11 | sha256 = "187j7w2g0dv5c5d1q8hl1ldcy7j9w78ir7vklhmbpw5mkyaigdby"; 12 | }; 13 | installPhase = '' 14 | mkdir -p $out/share/hosts 15 | cp hosts $out/share/hosts 16 | mv alternates $out/share/hosts 17 | ''; 18 | } 19 | -------------------------------------------------------------------------------- /packages/ical-buddy.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | stdenv, 4 | fetchFromGitHub, 5 | pkgs, 6 | }: 7 | # https://github.com/Homebrew/homebrew-core/blob/a187304f3f6471f13717893439a39ab152a44a5d/Formula/i/ical-buddy.rb 8 | let 9 | 10 | # https://stackoverflow.com/questions/51161225/how-can-i-make-macos-frameworks-available-to-clang-in-a-nix-environment 11 | frameworks = pkgs.darwin.apple_sdk.frameworks; 12 | in 13 | stdenv.mkDerivation rec { 14 | pname = "icallBuddy"; 15 | version = "1.10.1"; 16 | 17 | src = fetchFromGitHub { 18 | owner = "dkaluta"; 19 | repo = "icalBuddy64"; 20 | rev = "v${version}"; 21 | hash = "sha256-ID3U7lAve3DHTHx2kCunwg1LWkIEIIpQrXkvmkvn/Mg="; 22 | }; 23 | 24 | buildInputs = [ 25 | pkgs.perl 26 | frameworks.AppKit 27 | frameworks.Carbon 28 | frameworks.Cocoa 29 | frameworks.AddressBook 30 | frameworks.CalendarStore 31 | ]; 32 | # https://github.com/Homebrew/homebrew-core/blob/2f089a6f55a7496248be39f4d883094fd79cbdc4/Formula/ical-buddy.rb#L24 33 | buildPhase = '' 34 | # Allow native builds rather than only x86_64 35 | sed -i 's/-arch x86_64//g' Makefile 36 | make icalBuddy icalBuddy.1 icalBuddyLocalization.1 icalBuddyConfig.1 37 | ''; 38 | installPhase = '' 39 | mkdir -p $out/bin 40 | mkdir -p $out/share/man/man1/ 41 | cp icalBuddy $out/bin/icalBuddy 42 | mv *.1 $out/share/man/man1/ 43 | 44 | ''; 45 | 46 | meta = with lib; { 47 | description = "Get events and tasks from the macOS calendar database"; 48 | homepage = "https://hasseg.org/icalBuddy/"; 49 | platforms = platforms.darwin; 50 | license = licenses.mit; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /packages/pragmata-pro-font.nix: -------------------------------------------------------------------------------- 1 | # https://github.com/ahmedelgabri/dotfiles/blob/main/nix/pkgs/pragmatapro.nix 2 | # requireFile https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix 3 | { 4 | lib, 5 | stdenv, 6 | requireFile, 7 | unzip, 8 | }: 9 | 10 | stdenv.mkDerivation rec { 11 | 12 | name = "pragmatapro-${version}"; 13 | version = "0.829"; 14 | 15 | src = requireFile rec { 16 | name = "PragmataPro${version}.zip"; 17 | url = "file:///Users/yuanwang/workspace/nix-home/private/PragmataPro0.829.zip"; 18 | # nix-hash --flat --base32 --type sha256 /path/to/file 19 | sha256 = "187skl3ac8rp4k0jd8dcgdn4kwksdd12044isccxnwq3cajhlay1"; 20 | message = '' 21 | ${name} font not found in nix store, to add it run: 22 | 23 | using either 24 | nix-store --add-fixed sha256 file:///path/to${name} 25 | or 26 | nix-prefetch-url --type sha256 file:///path/to/${name} 27 | 28 | don't forget to git-crypt unlock 29 | 30 | Did you change the file? maybe you need to update the sha256 31 | $ nix-hash --flat --base32 --type sha256 /path/to/${name}''; 32 | }; 33 | buildInputs = [ unzip ]; 34 | phases = [ 35 | "unpackPhase" 36 | "installPhase" 37 | ]; 38 | pathsToLink = [ "/share/fonts/truetype/" ]; 39 | sourceRoot = "."; 40 | installPhase = '' 41 | install_path=$out/share/fonts/truetype 42 | mkdir -p $install_path 43 | find -name "PragmataPro*.ttf" -exec cp {} $install_path \; 44 | ''; 45 | 46 | meta = with lib; { 47 | homepage = "https://www.fsd.it/shop/fonts/pragmatapro/"; 48 | description = '' 49 | PragmataPro™ is a condensed monospaced font optimized for screen, 50 | designed by Fabrizio Schiavi to be the ideal font for coding, math and engineering 51 | ''; 52 | platforms = platforms.all; 53 | licence = licences.unfree; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /packages/resource-id/ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Changelog for resource-id 2 | 3 | ## Unreleased changes 4 | -------------------------------------------------------------------------------- /packages/resource-id/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019, TBD 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Author name here nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /packages/resource-id/README.md: -------------------------------------------------------------------------------- 1 | # resource-id 2 | 3 | A command line tool to decode resource id 4 | 5 | ## Install via nix 6 | 7 | `nix build` 8 | 9 | ## Usage 10 | 11 |

12 | 13 | `rid QWNjb3VudB8xNzc0MDg1Mw` 14 | 15 | ## TODO 16 | 17 | . Add encode ability 18 | . Add property-based tests 19 | -------------------------------------------------------------------------------- /packages/resource-id/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | 3 | main = defaultMain 4 | -------------------------------------------------------------------------------- /packages/resource-id/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Data.ByteString.Char8 qualified as C 4 | import Lib 5 | import Options.Applicative qualified as OA 6 | import System.Environment 7 | import System.Exit 8 | 9 | data Config = Config 10 | { rid :: String, 11 | decode :: Bool 12 | } 13 | 14 | config :: OA.Parser Config 15 | config = error "" 16 | 17 | work :: String -> IO () 18 | work = display . Lib.decode . C.pack 19 | 20 | main :: IO () 21 | main = do 22 | args <- getArgs 23 | if length args == 1 then work (head args) else die "incorrect argument" 24 | -------------------------------------------------------------------------------- /packages/resource-id/img/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/packages/resource-id/img/demo.gif -------------------------------------------------------------------------------- /packages/resource-id/release.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkDerivation, 3 | base, 4 | base64-bytestring, 5 | bytestring, 6 | lib, 7 | optparse-applicative, 8 | pretty-terminal, 9 | text, 10 | }: 11 | mkDerivation { 12 | pname = "resource-id"; 13 | version = "0.1.0.0"; 14 | src = ./.; 15 | isLibrary = false; 16 | isExecutable = true; 17 | libraryHaskellDepends = [ 18 | base 19 | base64-bytestring 20 | bytestring 21 | optparse-applicative 22 | pretty-terminal 23 | text 24 | ]; 25 | executableHaskellDepends = [ 26 | base 27 | base64-bytestring 28 | bytestring 29 | optparse-applicative 30 | pretty-terminal 31 | text 32 | ]; 33 | testHaskellDepends = [ 34 | base 35 | base64-bytestring 36 | bytestring 37 | pretty-terminal 38 | text 39 | ]; 40 | homepage = "https://github.com/yuanwang-wf/resource-id#readme"; 41 | license = lib.licenses.bsd3; 42 | mainProgram = "rid"; 43 | } 44 | -------------------------------------------------------------------------------- /packages/resource-id/resource-id.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | name: resource-id 3 | version: 0.1.0.0 4 | description: 5 | Please see the README on GitHub at 6 | 7 | homepage: https://github.com/yuanwang-wf/resource-id#readme 8 | bug-reports: https://github.com/yuanwang-wf/resource-id/issues 9 | author: Yuan Wang 10 | maintainer: yuan.wang@workiva.com 11 | copyright: 2019 Yuan Wang 12 | license: BSD3 13 | license-file: LICENSE 14 | build-type: Simple 15 | extra-source-files: 16 | ChangeLog.md 17 | README.md 18 | 19 | source-repository head 20 | type: git 21 | location: https://github.com/yuanwang-wf/resource-id 22 | 23 | library 24 | exposed-modules: Lib 25 | other-modules: Paths_resource_id 26 | hs-source-dirs: src 27 | default-extensions: ImportQualifiedPost 28 | build-depends: 29 | base >=4.7 && <5 30 | , base64-bytestring 31 | , bytestring 32 | , optparse-applicative 33 | , pretty-terminal 34 | , text 35 | 36 | default-language: Haskell2010 37 | 38 | executable rid 39 | main-is: Main.hs 40 | other-modules: Paths_resource_id 41 | hs-source-dirs: app 42 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 43 | default-extensions: ImportQualifiedPost 44 | build-depends: 45 | base >=4.7 && <5 46 | , base64-bytestring 47 | , bytestring 48 | , optparse-applicative 49 | , pretty-terminal 50 | , resource-id 51 | , text 52 | 53 | default-language: Haskell2010 54 | 55 | test-suite resource-id-test 56 | type: exitcode-stdio-1.0 57 | main-is: Spec.hs 58 | other-modules: Paths_resource_id 59 | hs-source-dirs: test 60 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 61 | build-depends: 62 | base >=4.7 && <5 63 | , base64-bytestring 64 | , bytestring 65 | , pretty-terminal 66 | , resource-id 67 | , text 68 | 69 | default-language: Haskell2010 70 | -------------------------------------------------------------------------------- /packages/resource-id/src/Lib.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | 3 | module Lib (display, decode) where 4 | 5 | import Control.Monad 6 | import Data.ByteString qualified as B 7 | import Data.ByteString.Base64 qualified as Base64 8 | import Data.ByteString.Char8 qualified as C 9 | import Data.Char 10 | import Data.List (intersperse) 11 | import Data.Text qualified as T 12 | import Data.Text.Encoding qualified as E 13 | import Data.Text.IO qualified as TIO 14 | import System.Console.Pretty (Color (..), Pretty, color) 15 | 16 | type Kind = B.ByteString 17 | 18 | type KeyPath = [(B.ByteString, B.ByteString)] 19 | 20 | appendMissingChar :: B.ByteString -> B.ByteString 21 | appendMissingChar input = if modulo == 0 then input else B.append input (C.replicate (4 - modulo) '=') 22 | where 23 | len = B.length input 24 | modulo = len `mod` 4 25 | 26 | splitBy :: B.ByteString -> [B.ByteString] 27 | splitBy = join . map (C.split (chr 31)) . C.split (chr 30) 28 | 29 | decode :: B.ByteString -> Either String KeyPath 30 | decode = (pairUp . splitBy) <=< (Base64.decode . appendMissingChar) 31 | 32 | pairUp :: [B.ByteString] -> Either String KeyPath 33 | pairUp [] = Right [] 34 | pairUp (kind : name : rest) = ((kind, name) :) <$> pairUp rest 35 | pairUp _ = Left "unmatch kind name" 36 | 37 | keyPathToPrettyText :: KeyPath -> T.Text 38 | keyPathToPrettyText paths = 39 | color Default "Key(" 40 | `T.append` T.intercalate 41 | ", " 42 | ( foldl 43 | ( \ls (kind, name) -> 44 | ls ++ [color Blue (E.decodeUtf8 kind), color Green (E.decodeUtf8 name)] 45 | ) 46 | [] 47 | paths 48 | ) 49 | `T.append` color Default ")" 50 | 51 | displayKeyPath :: KeyPath -> IO () 52 | displayKeyPath = TIO.putStrLn . keyPathToPrettyText 53 | 54 | display :: Either String KeyPath -> IO () 55 | display (Left err) = putStrLn (color Red err) 56 | display (Right keyPath) = displayKeyPath keyPath 57 | -------------------------------------------------------------------------------- /packages/resource-id/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /packages/reveal-js.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchFromGitHub }: 2 | 3 | stdenv.mkDerivation rec { 4 | pname = "reveal-js"; 5 | version = "5.1.0"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "hakimel"; 9 | repo = "reveal.js"; 10 | rev = "${version}"; 11 | sha256 = "sha256-L6KVBw20K67lHT07Ws+ZC2DwdURahqyuyjAaK0kTgN0="; 12 | # sha256 = "187j7w2g0dv5c5d1q8hl1ldcy7j9w78ir7vklhmbpw5mkyaigdby"; 13 | }; 14 | installPhase = '' 15 | runHook preInstall 16 | 17 | mkdir -p $out/share/ 18 | cp -r plugin $out/share/ 19 | cp -r dist $out/share/ 20 | runHook postInstall 21 | 22 | ''; 23 | } 24 | -------------------------------------------------------------------------------- /packages/sf_symbols.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | fetchurl, 4 | lib, 5 | pkgs, 6 | ... 7 | }: 8 | # https://github.com/Homebrew/homebrew-cask/blob/d5acc87dd9ebf3cc1a38f2e4f99c1c2872f5ceb6/Casks/sf-symbols.rb 9 | stdenv.mkDerivation rec { 10 | pname = "sf-symbols"; 11 | version = "5"; 12 | 13 | src = fetchurl { 14 | url = "https://devimages-cdn.apple.com/design/resources/download/SF-Symbols-${version}.dmg"; 15 | hash = "sha256-6dtcrwRY1qEHquZPbwnEo2CmcuNN9ZkFo8rn/8S+ctM="; 16 | }; 17 | unpackPhase = '' 18 | undmg $src 19 | ls 20 | 7z x 'SF Symbols.pkg' 21 | 7z x 'Payload~' 22 | ''; 23 | buildInputs = [ 24 | pkgs.p7zip 25 | pkgs.undmg 26 | ]; 27 | installPhase = '' 28 | mkdir -p $out/share/fonts 29 | mkdir -p $out/share/fonts/opentype 30 | mkdir -p $out/share/fonts/truetype 31 | find -name \*.otf -exec mv {} $out/share/fonts/opentype/ \; 32 | find -name \*.ttf -exec mv {} $out/share/fonts/truetype/ \; 33 | ''; 34 | meta = with lib; { 35 | description = '' 36 | SF-symbols 37 | ''; 38 | platforms = platforms.darwin; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /packages/sketchybar-app-font.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | fetchurl, 4 | lib, 5 | }: 6 | 7 | stdenv.mkDerivation rec { 8 | pname = "sketchybar-app-font"; 9 | version = "1.0.9"; 10 | 11 | src = fetchurl { 12 | url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/sketchybar-app-font.ttf"; 13 | hash = "sha256-3QEKNT026lhstJtHPsFA8f7/XXO7Bmjrth92dd9D2xw="; 14 | }; 15 | 16 | buildCommand = '' 17 | install -m444 -Dt $out/share/fonts/truetype ${src} 18 | ''; 19 | 20 | meta = with lib; { 21 | description = '' 22 | sketchybar-app-font 23 | ''; 24 | homepage = "https://github.com/kvndrsslr/sketchybar-app-font"; 25 | platforms = platforms.darwin; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /packages/sketchybar-cpu-helper/default.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs }: 2 | let 3 | stdenv = pkgs.clangStdenv; 4 | in 5 | stdenv.mkDerivation rec { 6 | pname = "cpu-helper"; 7 | version = "0.0.1"; 8 | 9 | src = ./helper; 10 | 11 | buildPhase = '' 12 | make 13 | ''; 14 | installPhase = '' 15 | mkdir -p $out/bin 16 | cp helper $out/bin/sketchybar-cpu-helper 17 | ''; 18 | 19 | meta = with lib; { 20 | description = "cpu helper"; 21 | homepage = "https://github.com/FelixKratz/dotfiles/tree/master/.config/sketchybar/helper"; 22 | platforms = platforms.darwin; 23 | license = licenses.mit; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /packages/sketchybar-cpu-helper/helper/cpu.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define MAX_TOPPROC_LEN 28 9 | 10 | static const char TOPPROC[] = { "/bin/ps -Aceo pid,pcpu,comm -r" }; 11 | static const char FILTER_PATTERN[] = { "com.apple." }; 12 | 13 | struct cpu { 14 | host_t host; 15 | mach_msg_type_number_t count; 16 | host_cpu_load_info_data_t load; 17 | host_cpu_load_info_data_t prev_load; 18 | bool has_prev_load; 19 | 20 | char command[256]; 21 | }; 22 | 23 | static inline void cpu_init(struct cpu* cpu) { 24 | cpu->host = mach_host_self(); 25 | cpu->count = HOST_CPU_LOAD_INFO_COUNT; 26 | cpu->has_prev_load = false; 27 | snprintf(cpu->command, 100, ""); 28 | } 29 | 30 | static inline void cpu_update(struct cpu* cpu) { 31 | kern_return_t error = host_statistics(cpu->host, 32 | HOST_CPU_LOAD_INFO, 33 | (host_info_t)&cpu->load, 34 | &cpu->count ); 35 | 36 | if (error != KERN_SUCCESS) { 37 | printf("Error: Could not read cpu host statistics.\n"); 38 | return; 39 | } 40 | 41 | if (cpu->has_prev_load) { 42 | uint32_t delta_user = cpu->load.cpu_ticks[CPU_STATE_USER] 43 | - cpu->prev_load.cpu_ticks[CPU_STATE_USER]; 44 | 45 | uint32_t delta_system = cpu->load.cpu_ticks[CPU_STATE_SYSTEM] 46 | - cpu->prev_load.cpu_ticks[CPU_STATE_SYSTEM]; 47 | 48 | uint32_t delta_idle = cpu->load.cpu_ticks[CPU_STATE_IDLE] 49 | - cpu->prev_load.cpu_ticks[CPU_STATE_IDLE]; 50 | 51 | double user_perc = (double)delta_user / (double)(delta_system 52 | + delta_user 53 | + delta_idle); 54 | 55 | double sys_perc = (double)delta_system / (double)(delta_system 56 | + delta_user 57 | + delta_idle); 58 | 59 | double total_perc = user_perc + sys_perc; 60 | 61 | FILE* file; 62 | char line[1024]; 63 | 64 | file = popen(TOPPROC, "r"); 65 | if (!file) { 66 | printf("Error: TOPPROC command errored out...\n" ); 67 | return; 68 | } 69 | 70 | fgets(line, sizeof(line), file); 71 | fgets(line, sizeof(line), file); 72 | 73 | char* start = strstr(line, FILTER_PATTERN); 74 | char topproc[MAX_TOPPROC_LEN + 4]; 75 | uint32_t caret = 0; 76 | for (int i = 0; i < sizeof(line); i++) { 77 | if (start && i == start - line) { 78 | i+=9; 79 | continue; 80 | } 81 | 82 | if (caret >= MAX_TOPPROC_LEN && caret <= MAX_TOPPROC_LEN + 2) { 83 | topproc[caret++] = '.'; 84 | continue; 85 | } 86 | if (caret > MAX_TOPPROC_LEN + 2) break; 87 | topproc[caret++] = line[i]; 88 | if (line[i] == '\0') break; 89 | } 90 | 91 | topproc[MAX_TOPPROC_LEN + 3] = '\0'; 92 | 93 | pclose(file); 94 | 95 | char color[16]; 96 | if (total_perc >= .7) { 97 | snprintf(color, 16, "%s", getenv("RED")); 98 | } else if (total_perc >= .3) { 99 | snprintf(color, 16, "%s", getenv("ORANGE")); 100 | } else if (total_perc >= .1) { 101 | snprintf(color, 16, "%s", getenv("YELLOW")); 102 | } else { 103 | snprintf(color, 16, "%s", getenv("LABEL_COLOR")); 104 | } 105 | 106 | snprintf(cpu->command, 256, "--push cpu.sys %.2f " 107 | "--push cpu.user %.2f " 108 | "--set cpu.top label='%s' " 109 | "--set cpu.percent label=%.0f%% label.color=%s ", 110 | sys_perc, 111 | user_perc, 112 | topproc, 113 | total_perc*100., 114 | color ); 115 | } 116 | else { 117 | snprintf(cpu->command, 256, ""); 118 | } 119 | 120 | cpu->prev_load = cpu->load; 121 | cpu->has_prev_load = true; 122 | } 123 | -------------------------------------------------------------------------------- /packages/sketchybar-cpu-helper/helper/helper.c: -------------------------------------------------------------------------------- 1 | #include "cpu.h" 2 | #include "sketchybar.h" 3 | 4 | struct cpu g_cpu; 5 | 6 | void handler(env env) { 7 | // Environment variables passed from sketchybar can be accessed as seen below 8 | char* name = env_get_value_for_key(env, "NAME"); 9 | char* sender = env_get_value_for_key(env, "SENDER"); 10 | char* info = env_get_value_for_key(env, "INFO"); 11 | char* selected = env_get_value_for_key(env, "SELECTED"); 12 | 13 | if ((strcmp(name, "cpu.percent") == 0)) { 14 | // CPU graph updates 15 | cpu_update(&g_cpu); 16 | 17 | if (strlen(g_cpu.command) > 0) sketchybar(g_cpu.command); 18 | } 19 | } 20 | 21 | int main (int argc, char** argv) { 22 | cpu_init(&g_cpu); 23 | 24 | if (argc < 2) { 25 | printf("Usage: helper \"\"\n"); 26 | exit(1); 27 | } 28 | 29 | event_server_begin(handler, argv[1]); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /packages/sketchybar-cpu-helper/helper/makefile: -------------------------------------------------------------------------------- 1 | 2 | helper: helper.c cpu.h sketchybar.h 3 | clang -std=c99 -O3 helper.c -o helper 4 | -------------------------------------------------------------------------------- /packages/ws-access-token/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import WsAccessToken (getAccessToken) 4 | 5 | main = getAccessToken 6 | -------------------------------------------------------------------------------- /packages/ws-access-token/readme.org: -------------------------------------------------------------------------------- 1 | #+title: ws-access-token 2 | a simple CLI to fetch access token base on PEM file 3 | 4 | 5 | ** Install 6 | *** with nix 7 | TODO 8 | *** Pre-built binaries 9 | There are pre-built binaries for macOS 10 | ** Usage 11 | TODO 12 | 13 | ~ws-access-token example | pbcopy~ 14 | -------------------------------------------------------------------------------- /packages/ws-access-token/release.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkDerivation, 3 | aeson, 4 | base, 5 | bytestring, 6 | containers, 7 | cryptonite, 8 | dhall, 9 | hedgehog, 10 | jwt, 11 | lib, 12 | req, 13 | text, 14 | time, 15 | vector, 16 | }: 17 | mkDerivation { 18 | pname = "ws-access-token"; 19 | version = "0.0.1.0"; 20 | src = ./.; 21 | isLibrary = true; 22 | isExecutable = true; 23 | libraryHaskellDepends = [ 24 | aeson 25 | base 26 | bytestring 27 | containers 28 | cryptonite 29 | dhall 30 | jwt 31 | req 32 | text 33 | time 34 | vector 35 | ]; 36 | executableHaskellDepends = [ base ]; 37 | testHaskellDepends = [ 38 | base 39 | hedgehog 40 | ]; 41 | homepage = "https://github.com/yuanwang-wf/ws-access-token"; 42 | description = "Project synopsis"; 43 | license = lib.licenses.bsd3; 44 | mainProgram = "ws-access-token"; 45 | } 46 | -------------------------------------------------------------------------------- /packages/ws-access-token/test/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | main :: IO () 4 | main = putStrLn "Test suite not yet implemented" 5 | -------------------------------------------------------------------------------- /packages/ws-access-token/ws-access-token.cabal: -------------------------------------------------------------------------------- 1 | name: ws-access-token 2 | synopsis: Project synopsis 3 | version: 0.0.1.0 4 | homepage: https://github.com/yuanwang-wf/ws-access-token 5 | license: BSD3 6 | author: Your Name 7 | maintainer: Your Name 8 | copyright: Your Name 9 | category: Package.Category 10 | build-type: Simple 11 | cabal-version: >=1.10 12 | 13 | library 14 | hs-source-dirs: src 15 | default-language: Haskell2010 16 | exposed-modules: WsAccessToken 17 | ghc-options: -Wall -fno-warn-name-shadowing 18 | default-extensions: ImportQualifiedPost 19 | build-depends: 20 | aeson 21 | , base >=4.11 && <5 22 | , bytestring 23 | , containers 24 | , cryptonite 25 | , dhall 26 | , jwt 27 | , req 28 | , text 29 | , time 30 | , vector 31 | 32 | executable ws-access-token 33 | main-is: Main.hs 34 | hs-source-dirs: app 35 | default-language: Haskell2010 36 | ghc-options: -threaded -O2 37 | default-extensions: ImportQualifiedPost 38 | build-depends: 39 | base 40 | , ws-access-token 41 | 42 | test-suite ws-access-token-tests 43 | type: exitcode-stdio-1.0 44 | hs-source-dirs: test 45 | main-is: Main.hs 46 | default-language: Haskell2010 47 | ghc-options: -Wall -threaded 48 | build-depends: 49 | base >=4.11 && <5 50 | , ws-access-token 51 | -------------------------------------------------------------------------------- /packages/xmonad/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.log 4 | tmp/ 5 | 6 | 7 | pdist 8 | dist-* 9 | cabal-dev 10 | *.o 11 | *.hi 12 | *.hie 13 | *.chi 14 | *.chs.h 15 | *.dyn_o 16 | *.dyn_hi 17 | .hpc 18 | .hsenv 19 | .cabal-sandbox/ 20 | cabal.sandbox.config 21 | *.prof 22 | *.aux 23 | *.hp 24 | *.eventlog 25 | .stack-work/ 26 | cabal.project.local 27 | cabal.project.local~ 28 | .HTF/ 29 | .ghc.environment.* 30 | result 31 | -------------------------------------------------------------------------------- /packages/xmonad/package.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - base == 4.* 3 | executables: 4 | my-xmobar: 5 | main: xmobar.hs 6 | dependencies: 7 | - xmobar 8 | my-xmonad: 9 | main: xmonad.hs 10 | dependencies: 11 | - xmonad 12 | -------------------------------------------------------------------------------- /packages/xmonad/readme.org: -------------------------------------------------------------------------------- 1 | #+TITLE: XMonad Config 2 | 3 | * How to restart xmonad without quitting 4 | \https://discourse.nixos.org/t/xmonad-reloading-without-quitting/10206 5 | 6 | * References 7 | - https://mwhittaker.github.io/blog/gnome_with_xmonad_on_ubuntu_12_04/ 8 | 9 | * Example 10 | - https://github.com/Sloopy3333/Dotfiles 11 | - https://github.com/jumper149/xpm-status-icons 12 | - https://gitlab.com/dwt1/dotfiles/-/blob/master/.xmonad/xmonad.hs 13 | -------------------------------------------------------------------------------- /pictures/haskell-red-noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/pictures/haskell-red-noise.png -------------------------------------------------------------------------------- /pictures/meditate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/pictures/meditate.png -------------------------------------------------------------------------------- /pictures/mountains-clouds-landscape-4k-d6-3840x2400.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/pictures/mountains-clouds-landscape-4k-d6-3840x2400.jpg -------------------------------------------------------------------------------- /pictures/nix-wallpaper-dracula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/pictures/nix-wallpaper-dracula.png -------------------------------------------------------------------------------- /pictures/reiryoku.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/pictures/reiryoku.pdf -------------------------------------------------------------------------------- /screenshots/macos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/screenshots/macos.png -------------------------------------------------------------------------------- /secrets/adguard-encryption-certificate.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/secrets/adguard-encryption-certificate.age -------------------------------------------------------------------------------- /secrets/adguard-encryption-key.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/secrets/adguard-encryption-key.age -------------------------------------------------------------------------------- /secrets/adguard.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/secrets/adguard.age -------------------------------------------------------------------------------- /secrets/secret1.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/secrets/secret1.age -------------------------------------------------------------------------------- /secrets/secrets.nix: -------------------------------------------------------------------------------- 1 | let 2 | user1 = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDEkr1oPi6Yk3iHFI568FNJLr3TAAy9EzjotVxf5vM3UvLCP2K7N3Jax8zamdMVajSH+s07xq8f7yyB2kFZtkPs8bs6ccWgbLakGehZOVo1Q0NZOiqVZ/viodK+maG3jhsp6oEdfuwMzQDLbcKj75kF3ma9LWHZNP47m6gsKvSC7GGZV5VG7JAUkUmWZyfGGXq1ExvkHT3/xf03R8g2CLDcC7rJtwhPTzyCzZBoZsPgOQ/ALPXpVhAhRPgNiReVaZyA5ROAnDm2iq7wJiwjs6A7PogE1N7E/T55SIgyQN3sBBpQwxo8tEVMmybmTeycmOnbTGwJWvLsdlCNXuFKjuzbEyBiJWi2r+q5p6Dvg02Eo/ESt6xmxjXICMPq1xn3qp/Q1tNlbXcV8oAqQQJE0wWD0tNWCV8onGgFY2MHVJT/Cqsx7mWOuSF8cgNkQ6U4/KKkAvUTNrgVFc85NqvlCnwC8evlPZz23K47QhL2VZr++sZ4L/l07eGBmEsynbTFVNnhVm4MGCsXPjabLO9pC9mV3JDoWG/47nCoIOlM8xs1nR82I6REi85DF4Wa9sJqGHGcSSjmKbnkl656RYVh19fuETk3RhuCVdyd88hMVm4V3KQPTTBtTF/6yjd0KFoYjKGZhDUnnV7UYXlo4rT/9VJHyzeJbTV502Vj07Ensapmvw=="; 3 | yuanwang_wv = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHM9A47jwAmysQRtmnDdfXtV1Slt8irXG2UsDZUn41rS"; 4 | yuanwang_ca = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFpYgmWwtRG7vlRbtWheYrtHl9E9qx84sdU+YlE8w+CZ"; 5 | users = [ 6 | user1 7 | yuanwang_wv 8 | yuanwang_ca 9 | ]; 10 | ashe = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINLStUG7iJOYDhS3GLuI0LkvSiY9fqsw2bM5p9JfoUqf"; 11 | adguard = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvgQaTxQmNGhbmkXYXmeTcbHo6vnpC0h0olTIErZxIC"; 12 | systems = [ 13 | ashe 14 | adguard 15 | ]; 16 | in 17 | { 18 | "secret1.age".publicKeys = users ++ systems; 19 | "adguard.age".publicKeys = users ++ systems; 20 | "adguard-encryption-key.age".publicKeys = users ++ systems; 21 | "adguard-encryption-certificate.age".publicKeys = users ++ systems; 22 | "wireguard-server-private.age".publicKeys = users ++ systems; 23 | } 24 | -------------------------------------------------------------------------------- /secrets/wireguard-server-private.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanw/nix-home/dfd2154c68c0364418d988218f881ad237183259/secrets/wireguard-server-private.age -------------------------------------------------------------------------------- /treefmt.nix: -------------------------------------------------------------------------------- 1 | { 2 | projectRootFile = "flake.lock"; 3 | programs.deadnix.enable = true; 4 | programs.nixfmt.enable = true; 5 | #programs.nixfmt.excludes = [ "/modules/private/*" "/hosts/wk01174.nix" ]; 6 | settings.formatter.nixfmt = { 7 | excludes = [ "modules/private/*" ]; 8 | }; 9 | programs.ormolu.enable = true; 10 | programs.cabal-fmt.enable = true; 11 | programs.hlint.enable = true; 12 | programs.shellcheck.enable = true; 13 | programs.shfmt.enable = true; 14 | } 15 | -------------------------------------------------------------------------------- /update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | import json 5 | import os 6 | import subprocess 7 | 8 | def main(args): 9 | path = os.getcwd() 10 | 11 | if args.nixpkgs: 12 | nixpkgs = args.nixpkgs 13 | else: 14 | nixpkgs = json.loads(subprocess.check_output(['nix', 'eval', '-f', path, 'inputs.nixpkgs.outPath', '--json']).decode('utf-8')) 15 | 16 | update_nix = os.path.join(nixpkgs, 'maintainers/scripts/update.nix') 17 | 18 | nix_args = [update_nix] 19 | nix_args += ['--arg', 'include-overlays', f'(import {path} {{ }}).outputs.legacyPackages.x86_64-linux.overlays'] 20 | nix_args += ['--argstr', 'path', args.attr_path] 21 | if args.commit: 22 | nix_args += ['--argstr', 'commit', 'true'] 23 | 24 | nix_shell = ['nix-shell'] + nix_args 25 | 26 | os.execvp(nix_shell[0], nix_shell) 27 | 28 | if __name__ == '__main__': 29 | parser = argparse.ArgumentParser(description='Rebuild system') 30 | parser.add_argument('--commit', help='Commit the changes', action='store_true') 31 | parser.add_argument('--nixpkgs', dest='nixpkgs', help='Override the nixpkgs flake input with this path, it will be used fir finding update.nix', nargs='?') 32 | parser.add_argument('attr_path', metavar='attr-path', help='Attribute path of package to update') 33 | 34 | args = parser.parse_args() 35 | 36 | main(args) --------------------------------------------------------------------------------