commit 4363d1a7d408e027de64e0a59bd98bc5127cd013 Author: Jip J. Dekker Date: Mon Dec 11 17:35:39 2023 +1100 Initial Commit Add flake template from dustinlyons/nixos-config diff --git a/bin/apply b/bin/apply new file mode 100755 index 0000000..fd105cd --- /dev/null +++ b/bin/apply @@ -0,0 +1,145 @@ +#!/usr/bin/env bash + +VERSION=1.0 + +# Color codes +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Determine the operating system +export OS=$(uname) + +# Primary network interface +if [[ "$OS" != "Darwin" ]]; then + export PRIMARY_IFACE=$(ip -o -4 route show to default | awk '{print $5}') + echo -e "${GREEN}Found primary network interface $PRIMARY_IFACE${NC}" +fi + +# Custom print function +_print() { + if [[ "$OS" == "Darwin" ]]; then + echo -e "$1" + else + echo "$1" + fi +} + +# Custom prompt function +_prompt() { + local message="$1" + local variable="$2" + + _print "$message" + read -r $variable +} + +# Fetch username from the system +export USERNAME=$(whoami) + +# If the username is 'nixos' or 'root', ask the user for their username +if [[ "$USERNAME" == "nixos" ]] || [[ "$USERNAME" == "root" ]]; then + _prompt "${YELLOW}You're running as $USERNAME. Please enter your desired username: ${NC}" USERNAME +fi + +# Check if git is available +if command -v git >/dev/null 2>&1; then + # Fetch email and name from git config + export GIT_EMAIL=$(git config --get user.email) + export GIT_NAME=$(git config --get user.name) +else + _print "${RED}Git is not available on this system.${NC}" +fi + +# If git email is not found or git is not available, ask the user +if [[ -z "$GIT_EMAIL" ]]; then + _prompt "${YELLOW}Please enter your email: ${NC}" GIT_EMAIL +fi + +# If git name is not found or git is not available, ask the user +if [[ -z "$GIT_NAME" ]]; then + _prompt "${YELLOW}Please enter your name: ${NC}" GIT_NAME +fi + +select_boot_disk() { + local disks + local _boot_disk + + _print "${YELLOW}Available disks:${NC}" + disks=$(lsblk -nd --output NAME,SIZE | grep -v loop) + echo "$disks" + + # Warning message for data deletion + _print "${RED}WARNING: All data on the chosen disk will be erased during the installation!${NC}" + _prompt "${YELLOW}Please choose your boot disk (e.g., nvme0n1, sda): ${NC}" _boot_disk + + # Confirmation for disk selection to prevent accidental data loss + _print "${YELLOW}You have selected $_boot_disk as the boot disk. This will delete everything on this disk. Are you sure? (Y/N): ${NC}" + read -r confirmation + if [[ "$confirmation" =~ ^[Yy]$ ]]; then + export BOOT_DISK=$_boot_disk + else + _print "${RED}Disk selection cancelled by the user. Please run the script again to select the correct disk.${NC}" + exit 1 + fi +} + +# Set hostname and find primary disk if this is NixOS +if [[ "$OS" != "Darwin" ]]; then + _prompt "${YELLOW}Please enter a hostname for the system: ${NC}" HOST_NAME + export HOST_NAME + select_boot_disk +fi + +# Confirmation step +confirm_details() { + _print "${GREEN}Username: $USERNAME" + _print "Email: $GIT_EMAIL" + _print "Name: $GIT_NAME${NC}" + + if([[ "$OS" != "Darwin" ]]); then + _print "${GREEN}Primary interface: $PRIMARY_IFACE" + _print "Boot disk: $BOOT_DISK" + _print "Hostname: $HOST_NAME${NC}" + fi + + _prompt "${YELLOW}Is this correct? (Y/N): ${NC}" choice + + case "$choice" in + [Nn] ) _print "${RED}Exiting script.${NC}" && exit 1;; + [Yy] ) _print "${GREEN}Continuing...${NC}";; + * ) _print "${RED}Invalid option. Exiting script.${NC}" && exit 1;; + esac +} + +# Call the confirmation function +confirm_details + +# Function to replace tokens in each file +replace_tokens() { + local file="$1" + if [[ $(basename $1) != "apply" ]]; then + if [[ "$OS" == "Darwin" ]]; then + # macOS + LC_ALL=C LANG=C sed -i '' -e "s/%USER%/$USERNAME/g" "$file" + LC_ALL=C LANG=C sed -i '' -e "s/%EMAIL%/$GIT_EMAIL/g" "$file" + LC_ALL=C LANG=C sed -i '' -e "s/%NAME%/$GIT_NAME/g" "$file" + else + # Linux or other + sed -i -e "s/%USER%/$USERNAME/g" "$file" + sed -i -e "s/%EMAIL%/$GIT_EMAIL/g" "$file" + sed -i -e "s/%NAME%/$GIT_NAME/g" "$file" + sed -i -e "s/%INTERFACE%/$PRIMARY_IFACE/g" "$file" + sed -i -e "s/%DISK%/$BOOT_DISK/g" "$file" + sed -i -e "s/%HOST%/$HOST_NAME/g" "$file" + fi + fi +} + +# Traverse directories and call replace_tokens on each Nix file +export -f replace_tokens +find . -type f -exec bash -c 'replace_tokens "$0"' {} \; + +echo "$USERNAME" > /tmp/username.txt +_print "${GREEN}User $USERNAME information applied.${NC}" diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..5cd3f58 --- /dev/null +++ b/bin/build @@ -0,0 +1,22 @@ +#!/bin/sh -e + +VERSION=1.0 +export args=$@ + +# Navigate to the directory of this script +cd $(dirname $(readlink -f $0)) +cd .. + +SYSTEM=$(uname) + +build() { + if [ $SYSTEM == "Darwin" ]; then + ./bin/darwin-build $args + elif [ $SYSTEM == "Linux" ]; then + ./bin/nixos-build $args + else + echo "Unknown platform" + fi +} + +build diff --git a/bin/darwin-build b/bin/darwin-build new file mode 100755 index 0000000..b4eccef --- /dev/null +++ b/bin/darwin-build @@ -0,0 +1,27 @@ +#!/bin/sh -e + +VERSION=1.0 + +GREEN='\033[1;32m' +RED='\033[1;31m' +NC='\033[0m' + +FLAKE="macos" +SYSTEM="darwinConfigurations.$FLAKE.system" + +export NIXPKGS_ALLOW_UNFREE=1 + +# Navigate to the directory of this script +cd $(dirname $(readlink -f $0)) +cd .. + +echo "${GREEN}Starting build...${NC}" +nix --experimental-features 'nix-command flakes' build .#$SYSTEM $@ + +echo "${GREEN}Switching to new generation...${NC}" +./result/sw/bin/darwin-rebuild switch --flake .#$FLAKE $@ + +echo "${GREEN}Cleaning up...${NC}" +unlink ./result + +echo "${GREEN}Switch to new generation complete!${NC}" diff --git a/bin/nixos-build b/bin/nixos-build new file mode 100644 index 0000000..a8092c4 --- /dev/null +++ b/bin/nixos-build @@ -0,0 +1,29 @@ +#!/bin/sh -e + +VERSION=1.0 + +GREEN='\033[1;32m' +RED='\033[1;31m' +NC='\033[0m' + +SYSTEM=$(uname -m) + +case "$SYSTEM" in + x86_64) + FLAKE_TARGET="x86_64-linux" + ;; + aarch64) + FLAKE_TARGET="aarch64-linux" + ;; + *) + echo -e "${RED}Unsupported architecture: $SYSTEM${NC}" + exit 1 + ;; +esac + +echo -e "${GREEN}Starting...${NC}" + +# We pass SSH from user to root so root can download secrets from your private Github +sudo SSH_AUTH_SOCK=$SSH_AUTH_SOCK /run/current-system/sw/bin/nixos-rebuild switch --flake .#$FLAKE_TARGET $@ + +echo -e "${GREEN}Switch to new generation complete!${NC}" diff --git a/darwin/README.md b/darwin/README.md new file mode 100644 index 0000000..90ab44e --- /dev/null +++ b/darwin/README.md @@ -0,0 +1,11 @@ + +## Layout +``` +. +├── dock # MacOS dock configuration +├── casks.nix # List of homebrew casks +├── default.nix # Defines module, system-level config +├── files.nix # Non-Nix, static configuration files (now immutable!) +├── home-manager.nix # Defines user programs +├── packages.nix # List of packages to install for MacOS +``` diff --git a/darwin/casks.nix b/darwin/casks.nix new file mode 100644 index 0000000..4b10878 --- /dev/null +++ b/darwin/casks.nix @@ -0,0 +1,36 @@ +{}: + +[ + # Development Tools + "homebrew/cask/docker" + "insomnia" + "ngrok" + "postico" + "visual-studio-code" + + # Communication Tools + "discord" + "loom" + "notion" + "slack" + "telegram" + "zoom" + + # Utility Tools + "appcleaner" + "syncthing" + + # Entertainment Tools + "steam" + "vlc" + + # Productivity Tools + "raycast" + "asana" + + # Browsers + "google-chrome" + + # AI + "diffusionbee" +] diff --git a/darwin/default.nix b/darwin/default.nix new file mode 100644 index 0000000..bf7de51 --- /dev/null +++ b/darwin/default.nix @@ -0,0 +1,103 @@ +{ config, pkgs, ... }: + +let user = "dekker1"; in + +{ + + imports = [ + ./home-manager.nix + ../shared + ../shared/cachix + ]; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + + # Setup user, packages, programs + nix = { + package = pkgs.nixUnstable; + settings.trusted-users = [ "@admin" "${user}" ]; + + gc = { + user = "root"; + automatic = true; + interval = { Weekday = 0; Hour = 2; Minute = 0; }; + options = "--delete-older-than 30d"; + }; + + # Turn this on to make command line easier + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + # Turn off NIX_PATH warnings now that we're using flakes + system.checks.verifyNixPath = false; + + # Load configuration that is shared across systems + environment.systemPackages = with pkgs; [ + emacs-unstable + ] ++ (import ../shared/packages.nix { inherit pkgs; }); + + # Enable fonts dir + fonts.fontDir.enable = true; + + launchd.user.agents.emacs.path = [ config.environment.systemPath ]; + launchd.user.agents.emacs.serviceConfig = { + KeepAlive = true; + ProgramArguments = [ + "/bin/sh" + "-c" + "/bin/wait4path ${pkgs.emacs}/bin/emacs && exec ${pkgs.emacs}/bin/emacs --fg-daemon" + ]; + StandardErrorPath = "/tmp/emacs.err.log"; + StandardOutPath = "/tmp/emacs.out.log"; + }; + + system = { + stateVersion = 4; + + defaults = { + LaunchServices = { + LSQuarantine = false; + }; + + NSGlobalDomain = { + AppleShowAllExtensions = true; + ApplePressAndHoldEnabled = false; + + # 120, 90, 60, 30, 12, 6, 2 + KeyRepeat = 2; + + # 120, 94, 68, 35, 25, 15 + InitialKeyRepeat = 15; + + "com.apple.mouse.tapBehavior" = 1; + "com.apple.sound.beep.volume" = 0.0; + "com.apple.sound.beep.feedback" = 0; + }; + + dock = { + autohide = false; + show-recents = false; + launchanim = true; + orientation = "bottom"; + tilesize = 48; + }; + + finder = { + _FXShowPosixPathInTitle = false; + }; + + trackpad = { + Clicking = true; + TrackpadThreeFingerDrag = true; + }; + }; + + keyboard = { + enableKeyMapping = true; + remapCapsLockToControl = true; + }; + }; +} diff --git a/darwin/dock/default.nix b/darwin/dock/default.nix new file mode 100644 index 0000000..19af49f --- /dev/null +++ b/darwin/dock/default.nix @@ -0,0 +1,67 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.local.dock; + inherit (pkgs) stdenv dockutil; +in +{ + options = { + local.dock.enable = mkOption { + description = "Enable dock"; + default = stdenv.isDarwin; + example = false; + }; + + local.dock.entries = mkOption + { + description = "Entries on the Dock"; + type = with types; listOf (submodule { + options = { + path = lib.mkOption { type = str; }; + section = lib.mkOption { + type = str; + default = "apps"; + }; + options = lib.mkOption { + type = str; + default = ""; + }; + }; + }); + readOnly = true; + }; + }; + + config = + mkIf cfg.enable + ( + let + normalize = path: if hasSuffix ".app" path then path + "/" else path; + entryURI = path: "file://" + (builtins.replaceStrings + [" " "!" "\"" "#" "$" "%" "&" "'" "(" ")"] + ["%20" "%21" "%22" "%23" "%24" "%25" "%26" "%27" "%28" "%29"] + (normalize path) + ); + wantURIs = concatMapStrings + (entry: "${entryURI entry.path}\n") + cfg.entries; + createEntries = concatMapStrings + (entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n") + cfg.entries; + in + { + system.activationScripts.postUserActivation.text = '' + echo >&2 "Setting up the Dock..." + haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" + if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then + echo >&2 "Resetting Dock." + ${dockutil}/bin/dockutil --no-restart --remove all + ${createEntries} + killall Dock + else + echo >&2 "Dock setup complete." + fi + ''; + } + ); +} diff --git a/darwin/files.nix b/darwin/files.nix new file mode 100644 index 0000000..f0bbac1 --- /dev/null +++ b/darwin/files.nix @@ -0,0 +1,34 @@ +{ user, config, pkgs, ... }: + +let + xdg_configHome = "${config.users.users.${user}.home}/.config"; + xdg_dataHome = "${config.users.users.${user}.home}/.local/share"; + xdg_stateHome = "${config.users.users.${user}.home}/.local/state"; in +{ + + # Raycast script so that "Run Emacs" is available and uses Emacs daemon + "${xdg_dataHome}/bin/emacsclient" = { + executable = true; + text = '' + #!/bin/zsh + # + # Required parameters: + # @raycast.schemaVersion 1 + # @raycast.title Run Emacs + # @raycast.mode silent + # + # Optional parameters: + # @raycast.packageName Emacs + # @raycast.icon ${xdg_dataHome}/img/icons/Emacs.icns + # @raycast.iconDark ${xdg_dataHome}/img/icons/Emacs.icns + + if [[ $1 = "-t" ]]; then + # Terminal mode + ${pkgs.emacs}/bin/emacsclient -t $@ + else + # GUI mode + ${pkgs.emacs}/bin/emacsclient -c -n $@ + fi + ''; + }; +} diff --git a/darwin/home-manager.nix b/darwin/home-manager.nix new file mode 100644 index 0000000..8dca7c1 --- /dev/null +++ b/darwin/home-manager.nix @@ -0,0 +1,90 @@ +{ config, pkgs, lib, home-manager, ... }: + +let + user = "dekker1"; + # Define the content of your file as a derivation + myEmacsLauncher = pkgs.writeScript "emacs-launcher.command" '' + #!/bin/sh + emacsclient -c -n & + ''; + sharedFiles = import ../shared/files.nix { inherit config pkgs; }; + additionalFiles = import ./files.nix { inherit user config pkgs; }; +in +{ + imports = [ + ./dock + ]; + + # It me + users.users.${user} = { + name = "${user}"; + home = "/Users/${user}"; + isHidden = false; + shell = pkgs.zsh; + }; + + homebrew.enable = true; + homebrew.casks = pkgs.callPackage ./casks.nix {}; + + # These app IDs are from using the mas CLI app + # mas = mac app store + # https://github.com/mas-cli/mas + # + # $ nix shell nixpkgs#mas + # $ mas search + # + homebrew.masApps = { + "1password" = 1333542190; + "wireguard" = 1451685025; + }; + + # Enable home-manager + home-manager = { + useGlobalPkgs = true; + users.${user} = { pkgs, config, lib, ... }:{ + home.enableNixpkgsReleaseCheck = false; + home.packages = pkgs.callPackage ./packages.nix {}; + home.file = lib.mkMerge [ + sharedFiles + additionalFiles + { "emacs-launcher.command".source = myEmacsLauncher; } + ]; + home.stateVersion = "21.11"; + programs = {} // import ../shared/home-manager.nix { inherit config pkgs lib; }; + + # Marked broken Oct 20, 2022 check later to remove this + # https://github.com/nix-community/home-manager/issues/3344 + manual.manpages.enable = false; + }; + }; + + # Fully declarative dock using the latest from Nix Store + local.dock.enable = true; + local.dock.entries = [ + { path = "/Applications/Slack.app/"; } + { path = "/System/Applications/Messages.app/"; } + { path = "/System/Applications/Facetime.app/"; } + { path = "${pkgs.alacritty}/Applications/Alacritty.app/"; } + { path = "/System/Applications/Music.app/"; } + { path = "/System/Applications/News.app/"; } + { path = "/System/Applications/Photos.app/"; } + { path = "/System/Applications/Photo Booth.app/"; } + { path = "/System/Applications/TV.app/"; } + { path = "/System/Applications/Home.app/"; } + { + path = toString myEmacsLauncher; + section = "others"; + } + { + path = "${config.users.users.${user}.home}/.local/share/"; + section = "others"; + options = "--sort name --view grid --display folder"; + } + { + path = "${config.users.users.${user}.home}/.local/share/downloads"; + section = "others"; + options = "--sort name --view grid --display stack"; + } + ]; + +} diff --git a/darwin/packages.nix b/darwin/packages.nix new file mode 100644 index 0000000..7eaa1d8 --- /dev/null +++ b/darwin/packages.nix @@ -0,0 +1,7 @@ +{ pkgs }: + +with pkgs; +let shared-packages = import ../shared/packages.nix { inherit pkgs; }; in +shared-packages ++ [ + dockutil +] diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d139acf --- /dev/null +++ b/flake.nix @@ -0,0 +1,117 @@ + +{ + description = "Starter Configuration for NixOS and MacOS"; + + inputs = { + nixpkgs.url = "github:dustinlyons/nixpkgs/master"; + + # My nixpkgs fork includes a feather-font package (https://github.com/dustinlyons/feather-font) + # and a timeout setting for Emacs daemon. If you don't want to use my it, follow these steps to use the official repo instead: + # + # Change the flake input + # - Official repository + # nixpkgs.url = "github:NixOS/nixpkgs/master"; + # + # Remove this setting and retry builds if they sometimes timeout: + # - NixOS configuration + # https://github.com/dustinlyons/nixos-config/blob/8114714c10d61cd5da34df842dd5bac0301f688a/nixos/default.nix#L280 + # + # Replace feather-font with another font: + # - Rofi: + # https://github.com/dustinlyons/nixos-config/blob/1290219734b53b26d9c20d13989846788462ff26/nixos/config/rofi/launcher.rasi#L42 + # + # - Polybar: + # https://github.com/dustinlyons/nixos-config/blob/1290219734b53b26d9c20d13989846788462ff26/nixos/home-manager.nix#L21 + # https://github.com/dustinlyons/nixos-config/blob/1290219734b53b26d9c20d13989846788462ff26/nixos/config/rofi/styles.rasi#L49 + # https://github.com/dustinlyons/nixos-config/blob/1290219734b53b26d9c20d13989846788462ff26/nixos/config/rofi/powermenu.rasi#L49 + # https://github.com/dustinlyons/nixos-config/blob/1290219734b53b26d9c20d13989846788462ff26/nixos/config/rofi/networkmenu.rasi#L49 + # + # - Fonts: + # https://github.com/dustinlyons/nixos-config/blob/1290219734b53b26d9c20d13989846788462ff26/nixos/default.nix#L286 + + home-manager.url = "github:nix-community/home-manager"; + darwin = { + url = "github:LnL7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-homebrew = { + url = "github:zhaofengli-wip/nix-homebrew"; + }; + homebrew-bundle = { + url = "github:homebrew/homebrew-bundle"; + flake = false; + }; + homebrew-core = { + url = "github:homebrew/homebrew-core"; + flake = false; + }; + homebrew-cask = { + url = "github:homebrew/homebrew-cask"; + flake = false; + }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { self, darwin, nix-homebrew, homebrew-bundle, homebrew-core, homebrew-cask, home-manager, nixpkgs, disko } @inputs: + let + user = "dekker1"; + linuxSystems = [ "x86_64-linux" "aarch64-linux" ]; + darwinSystems = [ "aarch64-darwin" ]; + forAllLinuxSystems = f: nixpkgs.lib.genAttrs linuxSystems (system: f system); + forAllDarwinSystems = f: nixpkgs.lib.genAttrs darwinSystems (system: f system); + forAllSystems = f: nixpkgs.lib.genAttrs (linuxSystems ++ darwinSystems) (system: f system); + devShell = system: let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = with pkgs; mkShell { + nativeBuildInputs = with pkgs; [ bashInteractive git age age-plugin-yubikey ]; + shellHook = with pkgs; '' + export EDITOR=vim + ''; + }; + }; + in + { + devShells = forAllSystems devShell; + darwinConfigurations = let user = "dekker1"; in { + macos = darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = inputs; + modules = [ + nix-homebrew.darwinModules.nix-homebrew + home-manager.darwinModules.home-manager + { + nix-homebrew = { + enable = true; + user = "${user}"; + taps = { + "homebrew/homebrew-core" = homebrew-core; + "homebrew/homebrew-cask" = homebrew-cask; + "homebrew/homebrew-bundle" = homebrew-bundle; + }; + mutableTaps = false; + autoMigrate = true; + }; + } + ./darwin + ]; + }; + }; + nixosConfigurations = nixpkgs.lib.genAttrs linuxSystems (system: nixpkgs.lib.nixosSystem { + system = system; + specialArgs = inputs; + modules = [ + disko.nixosModules.disko + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${user} = import ./nixos/home-manager.nix; + } + ./nixos + ]; + }); + }; +} diff --git a/nixos/README.md b/nixos/README.md new file mode 100644 index 0000000..22dc572 --- /dev/null +++ b/nixos/README.md @@ -0,0 +1,10 @@ +## Layout +``` +. +├── config # Config files not written in Nix +├── default.nix # Defines module, system-level config, +├── disk-config.nix # Disks, partitions, and filesystems +├── files.nix # Non-Nix, static configuration files (now immutable!) +├── home-manager.nix # Defines user programs +├── packages.nix # List of packages to install for NixOS +``` diff --git a/nixos/config/login-wallpaper.png b/nixos/config/login-wallpaper.png new file mode 100644 index 0000000..7a91f64 Binary files /dev/null and b/nixos/config/login-wallpaper.png differ diff --git a/nixos/config/polybar/bars.ini b/nixos/config/polybar/bars.ini new file mode 100644 index 0000000..2cd1a7a --- /dev/null +++ b/nixos/config/polybar/bars.ini @@ -0,0 +1,498 @@ +;; ┌────────────────────────────────────────────────────┐ +;; │░█▀█░█▀█░█░░░█░█░█▀▄░█▀█░█▀▄░░░░░░░░░█▀▄░█▀█░█▀▄░█▀▀│ +;; │░█▀▀░█░█░█░░░░█░░█▀▄░█▀█░█▀▄░░░░▀░░░░█▀▄░█▀█░█▀▄░▀▀█│ +;; │░▀░░░▀▀▀░▀▀▀░░▀░░▀▀░░▀░▀░▀░▀░░░░▀░░░░▀▀░░▀░▀░▀░▀░▀▀▀│ +;; │░Created░By░Aditya░Shakya░@adi1090x░░░░░░░░░░░░░░░░░│ +;; └────────────────────────────────────────────────────┘ + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[bar] +fill =  +empty =  +indicator = ⏽ +; Nerd font :   ,  ⏽,  樂 籠 錄 , 雷 絛 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/volume] +type = internal/alsa + +; Soundcard to be used +; Usually in the format hw:# where # is the card number +; You can find the different card numbers in `/proc/asound/cards` +master-soundcard = default +speaker-soundcard = default +headphone-soundcard = default + +; Name of the master, speaker and headphone mixers +; Use the following command to list available mixer controls: +; $ amixer scontrols | sed -nr "s/.*'([[:alnum:]]+)'.*/\1/p" +; If master, speaker or headphone-soundcard isn't the default, +; use `amixer -c # scontrols` instead where # is the number +; of the master, speaker or headphone soundcard respectively +; +; Default: Master +master-mixer = Master + +; Optionally define speaker and headphone mixers +; Default: none +;;speaker-mixer = Speaker +; Default: none +;;headphone-mixer = Headphone + +; NOTE: This is required if headphone_mixer is defined +; Use the following command to list available device controls +; $ amixer controls | sed -r "/CARD/\!d; s/.*=([0-9]+).*name='([^']+)'.*/printf '%3.0f: %s\n' '\1' '\2'/e" | sort +; You may also need to use `amixer -c # controls` as above for the mixer names +; Default: none +;;headphone-id = 9 + +; Use volume mapping (similar to amixer -M and alsamixer), where the increase in volume is linear to the ear +; Default: false +;;mapped = true + +; Interval for volume increase/decrease (in percent points) +; Default: 5 +interval = 5 + +; Available tags: +; (default) +; +; +format-volume = + +; Available tags: +; (default) +; +; +format-muted = +format-muted-prefix =  + +; Available tokens: +; %percentage% (default) +label-volume = %percentage%% + +; Available tokens: +; %percentage% (default +label-muted = " Muted" +label-muted-foreground = ${color.foreground-alt} + +; Only applies if is used +ramp-volume-0 =  +ramp-volume-1 =  +ramp-volume-2 =  + +; Only applies if is used +bar-volume-width = 10 +bar-volume-gradient = false + +bar-volume-indicator = ${bar.indicator} +bar-volume-indicator-foreground = ${color.foreground} + +bar-volume-fill = ${bar.fill} +bar-volume-foreground-0 = ${color.foreground} +bar-volume-foreground-1 = ${color.foreground} +bar-volume-foreground-2 = ${color.foreground} + +bar-volume-empty = ${bar.empty} +bar-volume-empty-foreground = ${color.foreground} + +; If defined, it will replace when +; headphones are plugged in to `headphone_control_numid` +; If undefined, will be used for both +; Only applies if is used +ramp-headphones-0 =  + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/brightness] +;type = internal/xbacklight +type = internal/backlight + +; Use the following command to list available cards: +; $ ls -1 /sys/class/backlight/ +;card = intel_backlight +card = amdgpu_bl0 + +; Available tags: +;