diff --git a/config-manager/default.nix b/config-manager/default.nix index 69846d6..0602add 100644 --- a/config-manager/default.nix +++ b/config-manager/default.nix @@ -1,4 +1,10 @@ -{ inputs, pkgs, lib, config, ... }: +{ + inputs, + pkgs, + lib, + config, + ... +}: let flakePath = config.config-manager.flakePath; nixosConfiguration = config.config-manager.nixosConfiguration; @@ -12,49 +18,49 @@ let throw "'config-manager.nixosConfiguration' cannot be empty" else pkgs.writeShellScriptBin "cm" '' - help() { - cat << EOF -Usage: - cm [flag] + help() { + cat << EOF + Usage: + cm [flag] -Flags: - --update updates the flake - --switch rebuilds + switches configuration (using 'nh') - --build-test-vm, --btvm build test-vm - --run-test-vm, --rtvm run test-vm -EOF - } + Flags: + --update updates the flake + --switch rebuilds + switches configuration (using 'nh') + --build-test-vm, --btvm build test-vm + --run-test-vm, --rtvm run test-vm + EOF + } - update() { - echo -e "\033[0;31mUPDATING FLAKE\033[0m" - nix flake update ${flakePath} - } + update() { + echo -e "\033[0;31mUPDATING FLAKE\033[0m" + nix flake update ${flakePath} + } - switch() { - nixos-rebuild dry-build --flake ${flakePath}#${nixosConfiguration} - ${nh}/bin/nh os switch --hostname ${nixosConfiguration} ${flakePath} - } + switch() { + nixos-rebuild dry-build --flake ${flakePath}#${nixosConfiguration} + ${nh}/bin/nh os switch --hostname ${nixosConfiguration} ${flakePath} + } - build-test-vm() { - nixos-rebuild build-vm --flake ${flakePath}#test-vm - } + build-test-vm() { + nixos-rebuild build-vm --flake ${flakePath}#test-vm + } - run-test-vm() { - ${flakePath}/result/bin/run-test-vm-vm - } + run-test-vm() { + ${flakePath}/result/bin/run-test-vm-vm + } - case $1 in - --update) - update ;; - --switch) - switch ;; - --build-test-vm | --btvm) - build-test-vm ;; - --run-test-vm | --rtvm) - run-test-vm ;; - --help | *) - help ;; - esac + case $1 in + --update) + update ;; + --switch) + switch ;; + --build-test-vm | --btvm) + build-test-vm ;; + --run-test-vm | --rtvm) + run-test-vm ;; + --help | *) + help ;; + esac ''; in { diff --git a/flake.nix b/flake.nix index e9a42ff..ca1ee43 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - nix-gc-env.url= "github:Julow/nix-gc-env"; + nix-gc-env.url = "github:Julow/nix-gc-env"; home-manager = { url = "github:nix-community/home-manager"; @@ -39,51 +39,62 @@ }; }; - outputs = { ... }@inputs: { - nixosConfigurations = { - pinwheel = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/pinwheel/configuration.nix - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-10th-gen - ./hosts/pinwheel/home.nix - ]; - }; + outputs = + { ... }@inputs: + { + nixosConfigurations = { + pinwheel = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/pinwheel/configuration.nix + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-10th-gen + ./hosts/pinwheel/home.nix + ]; + }; - backwards = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/backwards/configuration.nix - ./hosts/backwards/home.nix - ]; - }; + backwards = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/backwards/configuration.nix + ./hosts/backwards/home.nix + ]; + }; - tadpole = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/tadpole/configuration.nix - ./hosts/tadpole/home.nix - ]; - }; + tadpole = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/tadpole/configuration.nix + ./hosts/tadpole/home.nix + ]; + }; - test-vm = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ ./hosts/test-vm/configuration.nix ]; - }; - }; - - devShells = let - system = "x86_64-linux"; - pkgs = inputs.nixpkgs.legacyPackages.${system}; - in - { - ${system}.default = pkgs.mkShell { - packages = [ pkgs.nixfmt-rfc-style ]; + test-vm = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ ./hosts/test-vm/configuration.nix ]; }; }; - }; + + devShells = + let + system = "x86_64-linux"; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in + { + ${system}.default = pkgs.mkShell { + packages = [ pkgs.nixfmt-rfc-style ]; + }; + }; + }; } diff --git a/hosts/backwards/configuration.nix b/hosts/backwards/configuration.nix index 87db4ba..fa986df 100644 --- a/hosts/backwards/configuration.nix +++ b/hosts/backwards/configuration.nix @@ -1,14 +1,16 @@ { pkgs, ... }: { - imports = - [ - ../../config-manager/default.nix - ../../shared-modules/syncthing.nix - ./hardware-configuration.nix - ./modules - ]; + imports = [ + ../../config-manager/default.nix + ../../shared-modules/syncthing.nix + ./hardware-configuration.nix + ./modules + ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nixpkgs.config.allowUnfree = true; console.keyMap = "sv-latin1"; @@ -25,8 +27,11 @@ users.users.alex = { isNormalUser = true; description = "alex"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = []; + extraGroups = [ + "networkmanager" + "wheel" + ]; + packages = [ ]; }; environment.variables.EDITOR = "vim"; diff --git a/hosts/backwards/hardware-configuration.nix b/hosts/backwards/hardware-configuration.nix index 754e486..8ff5f6c 100644 --- a/hosts/backwards/hardware-configuration.nix +++ b/hosts/backwards/hardware-configuration.nix @@ -1,32 +1,47 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/bad3d82a-7bb8-490f-bd01-a4b16fe6f33d"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/bad3d82a-7bb8-490f-bd01-a4b16fe6f33d"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/D049-60DD"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/ff4de0e5-2c60-4ee7-a55c-450727efb921"; } + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/D049-60DD"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/ff4de0e5-2c60-4ee7-a55c-450727efb921"; } + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/backwards/modules/boot/default.nix b/hosts/backwards/modules/boot/default.nix index 2b44506..5db298a 100644 --- a/hosts/backwards/modules/boot/default.nix +++ b/hosts/backwards/modules/boot/default.nix @@ -1,4 +1,9 @@ -{ inputs, lib, config, ... }: +{ + inputs, + lib, + config, + ... +}: let configurationLimit = config.mod.gc.configurationLimit; in diff --git a/hosts/backwards/modules/git/default.nix b/hosts/backwards/modules/git/default.nix index b50b146..34c955b 100644 --- a/hosts/backwards/modules/git/default.nix +++ b/hosts/backwards/modules/git/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.git.enable; in diff --git a/hosts/backwards/modules/network/default.nix b/hosts/backwards/modules/network/default.nix index 16d1fd2..cbd9d05 100644 --- a/hosts/backwards/modules/network/default.nix +++ b/hosts/backwards/modules/network/default.nix @@ -12,10 +12,12 @@ wlp1s0 = { useDHCP = false; ipv4 = { - addresses = [{ - address = "192.168.50.202"; - prefixLength = 24; - }]; + addresses = [ + { + address = "192.168.50.202"; + prefixLength = 24; + } + ]; }; }; }; diff --git a/hosts/backwards/modules/restic/default.nix b/hosts/backwards/modules/restic/default.nix index 0e84e51..6ead640 100644 --- a/hosts/backwards/modules/restic/default.nix +++ b/hosts/backwards/modules/restic/default.nix @@ -45,7 +45,7 @@ in environmentFile = config.age.secrets.restic-cloud-sync-key.path; repositoryFile = config.age.secrets.restic-cloud-sync-repository.path; - paths = ["/home/alex/sync"]; + paths = [ "/home/alex/sync" ]; timerConfig = { OnCalendar = "*-*-* 0/12:00:00"; # Every 12th hour, i.e. twice a day @@ -70,4 +70,3 @@ in }; }; } - diff --git a/hosts/backwards/modules/ssh/default.nix b/hosts/backwards/modules/ssh/default.nix index 2c8f954..b4ea417 100644 --- a/hosts/backwards/modules/ssh/default.nix +++ b/hosts/backwards/modules/ssh/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.ssh.enable; @@ -41,10 +46,12 @@ in enable = true; ports = [ 1122 ]; - hostKeys = [{ - path = "${rootSSHKeyPath}/root.backwards"; - type = "ed25519"; - }]; + hostKeys = [ + { + path = "${rootSSHKeyPath}/root.backwards"; + type = "ed25519"; + } + ]; settings = { PasswordAuthentication = false; diff --git a/hosts/backwards/modules/syncthing/default.nix b/hosts/backwards/modules/syncthing/default.nix index 3d1b60a..4f5c4f4 100644 --- a/hosts/backwards/modules/syncthing/default.nix +++ b/hosts/backwards/modules/syncthing/default.nix @@ -39,7 +39,10 @@ in folders = { org = { path = "/home/alex/sync/org"; - devices = [ "phone" "pinwheel" ]; + devices = [ + "phone" + "pinwheel" + ]; versioning = { type = "staggered"; params = { diff --git a/hosts/backwards/modules/transmission/default.nix b/hosts/backwards/modules/transmission/default.nix index 2b2b81a..fddcb6c 100644 --- a/hosts/backwards/modules/transmission/default.nix +++ b/hosts/backwards/modules/transmission/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.transmission.enable; in diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index 0c19cc1..13bd45f 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -1,15 +1,17 @@ { pkgs, ... }: { - imports = - [ - ../../config-manager/default.nix - ../../nix-wrapper/default.nix - ../../shared-modules/syncthing.nix - ./hardware-configuration.nix - ./modules - ]; + imports = [ + ../../config-manager/default.nix + ../../nix-wrapper/default.nix + ../../shared-modules/syncthing.nix + ./hardware-configuration.nix + ./modules + ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nixpkgs.config.allowUnfree = true; users.users.alex = { diff --git a/hosts/pinwheel/hardware-configuration.nix b/hosts/pinwheel/hardware-configuration.nix index 9b46d5d..71c2631 100644 --- a/hosts/pinwheel/hardware-configuration.nix +++ b/hosts/pinwheel/hardware-configuration.nix @@ -1,29 +1,40 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, modulesPath, ... }: +{ + config, + lib, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/9c3ef2ad-0244-4310-9984-2e548ced3e22"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/9c3ef2ad-0244-4310-9984-2e548ced3e22"; + fsType = "ext4"; + }; boot.initrd.luks.devices."luks-f569d036-e500-4839-bc78-ce4b032840d8".device = "/dev/disk/by-uuid/f569d036-e500-4839-bc78-ce4b032840d8"; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/FCAE-6849"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/FCAE-6849"; + fsType = "vfat"; + }; swapDevices = [ ]; diff --git a/hosts/pinwheel/modules/bemenu/default.nix b/hosts/pinwheel/modules/bemenu/default.nix index 9e0c88c..e2ace13 100644 --- a/hosts/pinwheel/modules/bemenu/default.nix +++ b/hosts/pinwheel/modules/bemenu/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let hyprlandEnabled = config.mod.hyprland.enable; diff --git a/hosts/pinwheel/modules/bluetooth/default.nix b/hosts/pinwheel/modules/bluetooth/default.nix index 46571f8..169859f 100644 --- a/hosts/pinwheel/modules/bluetooth/default.nix +++ b/hosts/pinwheel/modules/bluetooth/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.bluetooth.enable; in @@ -37,77 +42,87 @@ in threshold = "30"; }; in - { - timers = - let - mkTimer = device: { - name = "notify-low-battery-for-${device.name}"; + { + timers = + let + mkTimer = device: { + name = "notify-low-battery-for-${device.name}"; - value = { - unitConfig = { - Description = "notify-battery-low timer for '${device.name}'"; - }; + value = { + unitConfig = { + Description = "notify-battery-low timer for '${device.name}'"; + }; - wantedBy = [ "timers.target" ]; + wantedBy = [ "timers.target" ]; - timerConfig = { - Unit = "notify-low-battery-for-${device.name}.service"; - OnCalendar = "*-*-* *:00:00"; # Every hour - Persistent = true; - }; + timerConfig = { + Unit = "notify-low-battery-for-${device.name}.service"; + OnCalendar = "*-*-* *:00:00"; # Every hour + Persistent = true; }; }; - in - builtins.listToAttrs (builtins.map mkTimer [ trackpad headphones ]); + }; + in + builtins.listToAttrs ( + builtins.map mkTimer [ + trackpad + headphones + ] + ); - services = - let - mkService = device: { - name = "notify-low-battery-for-${device.name}"; + services = + let + mkService = device: { + name = "notify-low-battery-for-${device.name}"; - value = { - unitConfig = { - Description = "check battery level of '${device.name}'"; - }; + value = { + unitConfig = { + Description = "check battery level of '${device.name}'"; + }; - wantedBy = [ "default.target" ]; - serviceConfig = { - Type = "exec"; - }; + wantedBy = [ "default.target" ]; + serviceConfig = { + Type = "exec"; + }; - path = [ - pkgs.upower - pkgs.gawk - pkgs.bc - pkgs.libnotify - ]; + path = [ + pkgs.upower + pkgs.gawk + pkgs.bc + pkgs.libnotify + ]; - script = '' - CONNECTED=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep native-path | awk '{print $2}') - [ "$CONNECTED" == "(null)" ] && exit 0 + script = '' + CONNECTED=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep native-path | awk '{print $2}') + [ "$CONNECTED" == "(null)" ] && exit 0 - CHECKING="/tmp/checking-dismiss-low-battery-${device.id}" - [ ! -f "$CHECKING" ] && touch $CHECKING || exit 0 + CHECKING="/tmp/checking-dismiss-low-battery-${device.id}" + [ ! -f "$CHECKING" ] && touch $CHECKING || exit 0 - DISMISSED="/tmp/dismiss-low-battery-${device.id}" - PERCENT=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep percentage | grep -o '[0-9]*') - if (( $(echo "$PERCENT < ${device.threshold}" | bc) )); then - echo "'${device.name}' is under threshold. battery = $PERCENT% - threshold = ${device.threshold}%" - if [ ! -f "$DISMISSED" ]; then - DISMISS=$(notify-send --expire-time 0 "Low battery" "${device.name} has $PERCENT% battery" --action=dismiss=Dismiss) - [ "$DISMISS" == "dismiss" ] && touch $DISMISSED && echo "'${device.name}' dismissed" - fi - else - echo "'${device.name}' is over threshold. battery = $PERCENT% - threshold = ${device.threshold}%" - [ -f "$DISMISSED" ] && rm $DISMISSED && echo "'${device.name}' undismissed" + DISMISSED="/tmp/dismiss-low-battery-${device.id}" + PERCENT=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep percentage | grep -o '[0-9]*') + if (( $(echo "$PERCENT < ${device.threshold}" | bc) )); then + echo "'${device.name}' is under threshold. battery = $PERCENT% - threshold = ${device.threshold}%" + if [ ! -f "$DISMISSED" ]; then + DISMISS=$(notify-send --expire-time 0 "Low battery" "${device.name} has $PERCENT% battery" --action=dismiss=Dismiss) + [ "$DISMISS" == "dismiss" ] && touch $DISMISSED && echo "'${device.name}' dismissed" fi + else + echo "'${device.name}' is over threshold. battery = $PERCENT% - threshold = ${device.threshold}%" + [ -f "$DISMISSED" ] && rm $DISMISSED && echo "'${device.name}' undismissed" + fi - rm $CHECKING - ''; - }; + rm $CHECKING + ''; }; - in - builtins.listToAttrs (builtins.map mkService [ trackpad headphones ]); - }; + }; + in + builtins.listToAttrs ( + builtins.map mkService [ + trackpad + headphones + ] + ); + }; }; } diff --git a/hosts/pinwheel/modules/boot/default.nix b/hosts/pinwheel/modules/boot/default.nix index c3c9e15..fb72c5e 100644 --- a/hosts/pinwheel/modules/boot/default.nix +++ b/hosts/pinwheel/modules/boot/default.nix @@ -1,4 +1,10 @@ -{ inputs, pkgs, lib, config, ... }: +{ + inputs, + pkgs, + lib, + config, + ... +}: let configurationLimit = config.mod.gc.configurationLimit; in diff --git a/hosts/pinwheel/modules/c/default.nix b/hosts/pinwheel/modules/c/default.nix index 845773d..d04e823 100644 --- a/hosts/pinwheel/modules/c/default.nix +++ b/hosts/pinwheel/modules/c/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.c.enable; in diff --git a/hosts/pinwheel/modules/chromium/default.nix b/hosts/pinwheel/modules/chromium/default.nix index 14196a5..6f8d827 100644 --- a/hosts/pinwheel/modules/chromium/default.nix +++ b/hosts/pinwheel/modules/chromium/default.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - home-manager.users.alex= { + home-manager.users.alex = { home.packages = [ pkgs.ungoogled-chromium ]; }; diff --git a/hosts/pinwheel/modules/containers/default.nix b/hosts/pinwheel/modules/containers/default.nix index a0aefa2..a264015 100644 --- a/hosts/pinwheel/modules/containers/default.nix +++ b/hosts/pinwheel/modules/containers/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let dockerEnabled = config.mod.containers.docker.enable; podmanEnabled = config.mod.containers.podman.enable; diff --git a/hosts/pinwheel/modules/direnv/default.nix b/hosts/pinwheel/modules/direnv/default.nix index 4954c3b..4b1e3a6 100644 --- a/hosts/pinwheel/modules/direnv/default.nix +++ b/hosts/pinwheel/modules/direnv/default.nix @@ -9,7 +9,6 @@ in nix-direnv.enable = true; }; - programs.direnv.enableZshIntegration = lib.mkIf zshEnabled true; }; } diff --git a/hosts/pinwheel/modules/emacs/config.nix b/hosts/pinwheel/modules/emacs/config.nix index eacab8e..af50090 100644 --- a/hosts/pinwheel/modules/emacs/config.nix +++ b/hosts/pinwheel/modules/emacs/config.nix @@ -1,5 +1,5 @@ -{ emacs, runCommand, ... }: -runCommand "default.el" {} '' +{ emacs, runCommand, ... }: +runCommand "default.el" { } '' cp ${./config.org} $TMPDIR/config.org cd $TMPDIR ${emacs}/bin/emacs --batch -Q \ @@ -7,4 +7,4 @@ runCommand "default.el" {} '' -f org-babel-tangle mv config.el $out - '' +'' diff --git a/hosts/pinwheel/modules/emacs/default.nix b/hosts/pinwheel/modules/emacs/default.nix index ce4e1a7..ff0ab4b 100644 --- a/hosts/pinwheel/modules/emacs/default.nix +++ b/hosts/pinwheel/modules/emacs/default.nix @@ -3,7 +3,7 @@ let emacs = pkgs.emacsWithPackagesFromUsePackage { package = pkgs.emacs-unstable; config = ./config.org; - defaultInitFile = pkgs.callPackage ./config.nix {}; + defaultInitFile = pkgs.callPackage ./config.nix { }; alwaysEnsure = true; alwaysTangle = true; @@ -40,9 +40,9 @@ in home-manager.users.alex = { home.sessionVariables = { - EDITOR = "${e}/bin/e $@"; - VISUAL = "${e}/bin/e $@"; - TIG_EDITOR = "${e}/bin/e $@"; + EDITOR = "${e}/bin/e $@"; + VISUAL = "${e}/bin/e $@"; + TIG_EDITOR = "${e}/bin/e $@"; }; home.packages = [ diff --git a/hosts/pinwheel/modules/firefox/default.nix b/hosts/pinwheel/modules/firefox/default.nix index e0d6d43..88ebb90 100644 --- a/hosts/pinwheel/modules/firefox/default.nix +++ b/hosts/pinwheel/modules/firefox/default.nix @@ -59,7 +59,7 @@ in name = "alex"; isDefault = true; - settings = sharedSettings // {}; + settings = sharedSettings // { }; }; work = { @@ -109,12 +109,14 @@ in configFile."mimeapps.list".force = true; }; - - home.packages = [ ff ff-alex ]; + home.packages = [ + ff + ff-alex + ]; }; environment.variables = { - MOZ_ENABLE_WAYLAND=1; + MOZ_ENABLE_WAYLAND = 1; BROWSER = "${ff-alex}/bin/ff-alex $@"; }; } diff --git a/hosts/pinwheel/modules/foot/default.nix b/hosts/pinwheel/modules/foot/default.nix index 509ea35..fb86c27 100644 --- a/hosts/pinwheel/modules/foot/default.nix +++ b/hosts/pinwheel/modules/foot/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.foot.enable; diff --git a/hosts/pinwheel/modules/git/default.nix b/hosts/pinwheel/modules/git/default.nix index d16b8c0..d100a05 100644 --- a/hosts/pinwheel/modules/git/default.nix +++ b/hosts/pinwheel/modules/git/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.git.enable; in diff --git a/hosts/pinwheel/modules/go/default.nix b/hosts/pinwheel/modules/go/default.nix index f944781..25ec013 100644 --- a/hosts/pinwheel/modules/go/default.nix +++ b/hosts/pinwheel/modules/go/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.go.enable; in @@ -10,19 +15,19 @@ in }; config = lib.mkIf enabled { - nixpkgs.overlays = let - buildGo122 = pkgs: pkg: - pkg.override { buildGoModule = pkgs.buildGo122Module; }; - in - [ - (final: prev: { - go = prev.go_1_22; - gopls = buildGo122 prev prev.gopls; - go-tools = buildGo122 prev prev.go-tools; - govulncheck = buildGo122 prev prev.govulncheck; - gotestsum = buildGo122 prev prev.gotestsum; - }) - ]; + nixpkgs.overlays = + let + buildGo122 = pkgs: pkg: pkg.override { buildGoModule = pkgs.buildGo122Module; }; + in + [ + (final: prev: { + go = prev.go_1_22; + gopls = buildGo122 prev prev.gopls; + go-tools = buildGo122 prev prev.go-tools; + govulncheck = buildGo122 prev prev.govulncheck; + gotestsum = buildGo122 prev prev.gotestsum; + }) + ]; home-manager.users.alex = { programs.go = { diff --git a/hosts/pinwheel/modules/greetd/default.nix b/hosts/pinwheel/modules/greetd/default.nix index 82c44fa..e173689 100644 --- a/hosts/pinwheel/modules/greetd/default.nix +++ b/hosts/pinwheel/modules/greetd/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.greetd.enable; in @@ -13,16 +18,17 @@ in services.greetd = { enable = true; - settings = let - session = { - user = "alex"; - command = "${pkgs.hyprland}/bin/Hyprland"; - }; - in + settings = + let + session = { + user = "alex"; + command = "${pkgs.hyprland}/bin/Hyprland"; + }; + in { initial_session = session; default_session = session; - }; + }; }; }; } diff --git a/hosts/pinwheel/modules/hyprland/default.nix b/hosts/pinwheel/modules/hyprland/default.nix index b444e9e..0e3df19 100644 --- a/hosts/pinwheel/modules/hyprland/default.nix +++ b/hosts/pinwheel/modules/hyprland/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.hyprland.enable; in @@ -55,7 +60,7 @@ in # 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window. follow_mouse = 2; - sensitivity = 0.30; + sensitivity = 0.3; touchpad = { natural_scroll = false; tap-and-drag = false; @@ -70,7 +75,7 @@ in general = { layout = "dwindle"; - gaps_in = 0; # gaps between windows + gaps_in = 0; # gaps between windows gaps_out = 0; # gaps between windows and monitor edges "col.active_border" = "rgba(${config.lib.colors.foreground}ff)"; @@ -82,54 +87,59 @@ in no_gaps_when_only = 1; }; - bind = let - ws = x: - let n = if (x + 1) < 10 - then (x + 1) - else 0; - in + bind = + let + ws = + x: + let + n = if (x + 1) < 10 then (x + 1) else 0; + in builtins.toString n; - select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10; - move = builtins.genList (x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}") 10; + select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10; + move = builtins.genList ( + x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}" + ) 10; - magnifier = pkgs.writeShellScript "magnifier" '' - CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption cursor:zoom_factor -j | ${pkgs.jq}/bin/jq .float) - DELTA=0.1 + magnifier = pkgs.writeShellScript "magnifier" '' + CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption cursor:zoom_factor -j | ${pkgs.jq}/bin/jq .float) + DELTA=0.1 - UPDATED=1 - case $1 in - --increase) - UPDATED=$(echo $CURRENT + $DELTA | ${pkgs.bc}/bin/bc) ;; - --decrease) - UPDATED=$(echo $CURRENT - $DELTA | ${pkgs.bc}/bin/bc) ;; - --reset) - UPDATED=1 - esac + UPDATED=1 + case $1 in + --increase) + UPDATED=$(echo $CURRENT + $DELTA | ${pkgs.bc}/bin/bc) ;; + --decrease) + UPDATED=$(echo $CURRENT - $DELTA | ${pkgs.bc}/bin/bc) ;; + --reset) + UPDATED=1 + esac - if (( $(echo "$UPDATED < 1" | bc) )); then UPDATED=1; fi - ${pkgs.hyprland}/bin/hyprctl keyword cursor:zoom_factor $UPDATED - ''; - in - select ++ move ++ [ - "$mod, ESCAPE, killactive" + if (( $(echo "$UPDATED < 1" | bc) )); then UPDATED=1; fi + ${pkgs.hyprland}/bin/hyprctl keyword cursor:zoom_factor $UPDATED + ''; + in + select + ++ move + ++ [ + "$mod, ESCAPE, killactive" - "$mod, f, fullscreen, 1" - "$mod SHIFT, f, togglefloating, active" + "$mod, f, fullscreen, 1" + "$mod SHIFT, f, togglefloating, active" - "$mod, h, movefocus, l" - "$mod, j, movefocus, d" - "$mod, k, movefocus, u" - "$mod, l, movefocus, r" + "$mod, h, movefocus, l" + "$mod, j, movefocus, d" + "$mod, k, movefocus, u" + "$mod, l, movefocus, r" - "$mod CONTROL, 1, exec, ${magnifier} --increase" - "$mod CONTROL, 2, exec, ${magnifier} --decrease" - "$mod CONTROL, 3, exec, ${magnifier} --reset" - ]; + "$mod CONTROL, 1, exec, ${magnifier} --increase" + "$mod CONTROL, 2, exec, ${magnifier} --decrease" + "$mod CONTROL, 3, exec, ${magnifier} --reset" + ]; bindm = [ # mouse movements - "$mod, mouse:272, movewindow" # left click + "$mod, mouse:272, movewindow" # left click "$mod, mouse:273, resizewindow" # right click ]; @@ -183,62 +193,66 @@ in pkgs.libnotify ]; - script = let - moveWSToMonitor = monitor: first: last: - if last < first - then throw "'first' has to be less than or equal to 'last'" - else - builtins.genList (n: "dispatch moveworkspacetomonitor ${builtins.toString (first + n)} ${monitor}") (last - first + 1); + script = + let + moveWSToMonitor = + monitor: first: last: + if last < first then + throw "'first' has to be less than or equal to 'last'" + else + builtins.genList ( + n: "dispatch moveworkspacetomonitor ${builtins.toString (first + n)} ${monitor}" + ) (last - first + 1); - external = moveWSToMonitor "HDMI-A-1" 1 5; - internal = moveWSToMonitor "eDPI-1" 6 10; - onlyInternal = moveWSToMonitor "eDPI-1" 1 10; - in - '' - update() { - HDMI_STATUS=$(cat /sys/class/drm/card1-HDMI-A-1/status) + external = moveWSToMonitor "HDMI-A-1" 1 5; + internal = moveWSToMonitor "eDPI-1" 6 10; + onlyInternal = moveWSToMonitor "eDPI-1" 1 10; + in + '' + update() { + HDMI_STATUS=$(cat /sys/class/drm/card1-HDMI-A-1/status) - INTERNAL_WIDTH=1920 - INTERNAL_HEIGHT=1200 + INTERNAL_WIDTH=1920 + INTERNAL_HEIGHT=1200 - if [ $HDMI_STATUS = "connected" ]; then - notify-send "Using external and laptop monitor" + if [ $HDMI_STATUS = "connected" ]; then + notify-send "Using external and laptop monitor" - hyprctl keyword monitor HDMI-A-1,preferred,0x0,1 + hyprctl keyword monitor HDMI-A-1,preferred,0x0,1 - HDMI=$(hyprctl monitors -j | jq '.[] | select(.name=="HDMI-A-1")') - HDMI_WIDTH=$(echo $HDMI | jq .width) - HDMI_HEIGHT=$(echo $HDMI | jq .height) + HDMI=$(hyprctl monitors -j | jq '.[] | select(.name=="HDMI-A-1")') + HDMI_WIDTH=$(echo $HDMI | jq .width) + HDMI_HEIGHT=$(echo $HDMI | jq .height) - INTERNAL_POS_X=$(echo "($HDMI_WIDTH - $INTERNAL_WIDTH) / 2" | bc) - if (( $(echo "$INTERNAL_POS_X < 0" | bc) )); then INTERNAL_POS_X=0; fi - INTERNAL_POS_Y=$HDMI_HEIGHT + INTERNAL_POS_X=$(echo "($HDMI_WIDTH - $INTERNAL_WIDTH) / 2" | bc) + if (( $(echo "$INTERNAL_POS_X < 0" | bc) )); then INTERNAL_POS_X=0; fi + INTERNAL_POS_Y=$HDMI_HEIGHT - hyprctl keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,$INTERNAL_POS_X"x"$INTERNAL_POS_Y,1 - hyprctl --batch "${lib.strings.concatStringsSep ";" (external ++ internal)}" - else - notify-send "Using only laptop monitor" + hyprctl keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,$INTERNAL_POS_X"x"$INTERNAL_POS_Y,1 + hyprctl --batch "${lib.strings.concatStringsSep ";" (external ++ internal)}" + else + notify-send "Using only laptop monitor" - hyprctl --batch "keyword monitor HDMI-A,disable; keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,0x0,1" - hyprctl --batch "${lib.strings.concatStringsSep ";" onlyInternal}" - fi - } + hyprctl --batch "keyword monitor HDMI-A,disable; keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,0x0,1" + hyprctl --batch "${lib.strings.concatStringsSep ";" onlyInternal}" + fi + } - handle() { - case $1 in - monitoradded\>\>*|monitorremoved\>\>*) - echo "handling event: \"$1\"" - update ;; - esac - } + handle() { + case $1 in + monitoradded\>\>*|monitorremoved\>\>*) + echo "handling event: \"$1\"" + update ;; + esac + } - echo "Starting service with instance \"$HYPRLAND_INSTANCE_SIGNATURE\"" + echo "Starting service with instance \"$HYPRLAND_INSTANCE_SIGNATURE\"" - # Do initial configuration - update + # Do initial configuration + update - socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done - ''; + socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done + ''; }; }; } diff --git a/hosts/pinwheel/modules/javascript/default.nix b/hosts/pinwheel/modules/javascript/default.nix index 021d404..6a3fe16 100644 --- a/hosts/pinwheel/modules/javascript/default.nix +++ b/hosts/pinwheel/modules/javascript/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: { home-manager.users.alex = { home.packages = [ pkgs.nodePackages.typescript-language-server ]; diff --git a/hosts/pinwheel/modules/keyboard/default.nix b/hosts/pinwheel/modules/keyboard/default.nix index f33e5de..6e11f41 100644 --- a/hosts/pinwheel/modules/keyboard/default.nix +++ b/hosts/pinwheel/modules/keyboard/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.keyboard.enable; in diff --git a/hosts/pinwheel/modules/light/default.nix b/hosts/pinwheel/modules/light/default.nix index 48526d8..419fc30 100644 --- a/hosts/pinwheel/modules/light/default.nix +++ b/hosts/pinwheel/modules/light/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let hyprlandEnabled = config.mod.hyprland.enable; in diff --git a/hosts/pinwheel/modules/mullvad/default.nix b/hosts/pinwheel/modules/mullvad/default.nix index 2130c29..3d226bf 100644 --- a/hosts/pinwheel/modules/mullvad/default.nix +++ b/hosts/pinwheel/modules/mullvad/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.mullvad.enable; in diff --git a/hosts/pinwheel/modules/openvpn/default.nix b/hosts/pinwheel/modules/openvpn/default.nix index 98d0892..4c42479 100644 --- a/hosts/pinwheel/modules/openvpn/default.nix +++ b/hosts/pinwheel/modules/openvpn/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.openvpn.enable; in diff --git a/hosts/pinwheel/modules/physlock/default.nix b/hosts/pinwheel/modules/physlock/default.nix index ad9ae33..5c7473e 100644 --- a/hosts/pinwheel/modules/physlock/default.nix +++ b/hosts/pinwheel/modules/physlock/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.physlock.enable; hyprlandEnabled = config.mod.hyprland.enable; @@ -31,11 +36,11 @@ in let pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; in - [ - # will lock the screen with `physlock`, see `lockOn.suspend - "$mod SHIFT, x, exec, ${pause-music}; systemctl suspend" - "$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m" - ]; + [ + # will lock the screen with `physlock`, see `lockOn.suspend + "$mod SHIFT, x, exec, ${pause-music}; systemctl suspend" + "$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m" + ]; }; }; }; diff --git a/hosts/pinwheel/modules/power/default.nix b/hosts/pinwheel/modules/power/default.nix index 84640ca..36b9745 100644 --- a/hosts/pinwheel/modules/power/default.nix +++ b/hosts/pinwheel/modules/power/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.power.enable; lowbat = config.mod.lowbat; @@ -39,8 +44,8 @@ in enable = true; settings = { - START_CHARGE_THRESH_BAT0=75; - STOP_CHARGE_THRESH_BAT0=80; + START_CHARGE_THRESH_BAT0 = 75; + STOP_CHARGE_THRESH_BAT0 = 80; }; }; }; @@ -58,7 +63,7 @@ in Persistent = true; }; - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; }; }; @@ -78,28 +83,30 @@ in pkgs.swaylock ]; - script = let - pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; - in '' - BATTERY_CAPACITY=$(cat /sys/class/power_supply/${lowbat.battery}/capacity) - BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status) - echo "Battery capacity: $BATTERY_CAPACITY" - echo "Battery status: $BATTERY_STATUS" - - if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.notifyCapacity} && $BATTERY_STATUS = "Discharging" ]]; then - notify-send --expire-time=0 --urgency=critical "Battery Low" - fi - - if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.suspendCapacity} && $BATTERY_STATUS = "Discharging" ]]; then - notify-send --expire-time=0 --urgency=critical "Battery Critically Low" "Suspending in 60 seconds if power is not plugged in" - sleep 60s - + script = + let + pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; + in + '' + BATTERY_CAPACITY=$(cat /sys/class/power_supply/${lowbat.battery}/capacity) BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status) - if [[ $BATTERY_STATUS = "Discharging" ]]; then - ${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend + echo "Battery capacity: $BATTERY_CAPACITY" + echo "Battery status: $BATTERY_STATUS" + + if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.notifyCapacity} && $BATTERY_STATUS = "Discharging" ]]; then + notify-send --expire-time=0 --urgency=critical "Battery Low" fi - fi - ''; + + if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.suspendCapacity} && $BATTERY_STATUS = "Discharging" ]]; then + notify-send --expire-time=0 --urgency=critical "Battery Critically Low" "Suspending in 60 seconds if power is not plugged in" + sleep 60s + + BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status) + if [[ $BATTERY_STATUS = "Discharging" ]]; then + ${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend + fi + fi + ''; }; }; }; diff --git a/hosts/pinwheel/modules/python/default.nix b/hosts/pinwheel/modules/python/default.nix index 5887a21..348aa98 100644 --- a/hosts/pinwheel/modules/python/default.nix +++ b/hosts/pinwheel/modules/python/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.python.enable; in diff --git a/hosts/pinwheel/modules/rust/default.nix b/hosts/pinwheel/modules/rust/default.nix index a6e0846..13d322e 100644 --- a/hosts/pinwheel/modules/rust/default.nix +++ b/hosts/pinwheel/modules/rust/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.rust.enable; in diff --git a/hosts/pinwheel/modules/scala/default.nix b/hosts/pinwheel/modules/scala/default.nix index 6d37db6..469f848 100644 --- a/hosts/pinwheel/modules/scala/default.nix +++ b/hosts/pinwheel/modules/scala/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.scala.enable; diff --git a/hosts/pinwheel/modules/screenshot/default.nix b/hosts/pinwheel/modules/screenshot/default.nix index 08a9f8b..a04ee4d 100644 --- a/hosts/pinwheel/modules/screenshot/default.nix +++ b/hosts/pinwheel/modules/screenshot/default.nix @@ -1,4 +1,10 @@ -{ inputs, pkgs, lib, config, ...}: +{ + inputs, + pkgs, + lib, + config, + ... +}: let hyprlandEnabled = config.mod.hyprland.enable; diff --git a/hosts/pinwheel/modules/scripts/default.nix b/hosts/pinwheel/modules/scripts/default.nix index 612870b..c78e5bc 100644 --- a/hosts/pinwheel/modules/scripts/default.nix +++ b/hosts/pinwheel/modules/scripts/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.scripts.enable; diff --git a/hosts/pinwheel/modules/sound/default.nix b/hosts/pinwheel/modules/sound/default.nix index c9c8917..223dda6 100644 --- a/hosts/pinwheel/modules/sound/default.nix +++ b/hosts/pinwheel/modules/sound/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let hyprlandEnabled = config.mod.hyprland.enable; in @@ -20,24 +25,26 @@ in home-manager.users.alex = { wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { - bind = let - toggle-output-mute = pkgs.writeShellScript "toggle-output-mute" '' - ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep MUTED | wc -l) - echo $MUTED > /sys/class/leds/platform::mute/brightness - ''; + bind = + let + toggle-output-mute = pkgs.writeShellScript "toggle-output-mute" '' + ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep MUTED | wc -l) + echo $MUTED > /sys/class/leds/platform::mute/brightness + ''; - toggle-input-mute = pkgs.writeShellScript "toggle-input-mute" '' - ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle - MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep MUTED | wc -l) - echo $MUTED > /sys/class/leds/platform::micmute/brightness - ''; - in [ - ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+" - ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" - ", XF86AudioMute, exec, ${toggle-output-mute}" - ", XF86AudioMicMute, exec, ${toggle-input-mute}" - ]; + toggle-input-mute = pkgs.writeShellScript "toggle-input-mute" '' + ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep MUTED | wc -l) + echo $MUTED > /sys/class/leds/platform::micmute/brightness + ''; + in + [ + ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+" + ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" + ", XF86AudioMute, exec, ${toggle-output-mute}" + ", XF86AudioMicMute, exec, ${toggle-input-mute}" + ]; }; }; diff --git a/hosts/pinwheel/modules/spotify/default.nix b/hosts/pinwheel/modules/spotify/default.nix index 7e33d11..ab67879 100644 --- a/hosts/pinwheel/modules/spotify/default.nix +++ b/hosts/pinwheel/modules/spotify/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let hyprlandEnabled = config.mod.hyprland.enable; in @@ -6,19 +11,21 @@ in home-manager.users.alex = { wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { - bind = let - prev = "${pkgs.playerctl}/bin/playerctl -p spotify previous"; - next = "${pkgs.playerctl}/bin/playerctl -p spotify next"; - in [ - ", XF86AudioPrev, exec, ${prev}" - ", XF86AudioNext, exec, ${next}" - ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause" - ", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl -p spoitfy play-pause" + bind = + let + prev = "${pkgs.playerctl}/bin/playerctl -p spotify previous"; + next = "${pkgs.playerctl}/bin/playerctl -p spotify next"; + in + [ + ", XF86AudioPrev, exec, ${prev}" + ", XF86AudioNext, exec, ${next}" + ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause" + ", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl -p spoitfy play-pause" - "$mod ALT, LEFT, exec, ${prev}" - "$mod ALT, RIGHT, exec, ${next}" - "$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause" - ]; + "$mod ALT, LEFT, exec, ${prev}" + "$mod ALT, RIGHT, exec, ${next}" + "$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause" + ]; }; }; diff --git a/hosts/pinwheel/modules/ssh/default.nix b/hosts/pinwheel/modules/ssh/default.nix index a515a46..2a77bca 100644 --- a/hosts/pinwheel/modules/ssh/default.nix +++ b/hosts/pinwheel/modules/ssh/default.nix @@ -129,9 +129,11 @@ enable = true; ports = [ 1122 ]; - hostKeys = [{ - path = "/etc/ssh/pinwheel"; - type = "ed25519"; - }]; + hostKeys = [ + { + path = "/etc/ssh/pinwheel"; + type = "ed25519"; + } + ]; }; } diff --git a/hosts/pinwheel/modules/swaylock/default.nix b/hosts/pinwheel/modules/swaylock/default.nix index cc40c4d..66b1cce 100644 --- a/hosts/pinwheel/modules/swaylock/default.nix +++ b/hosts/pinwheel/modules/swaylock/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.swaylock.enable; hyprlandEnabled = config.mod.hyprland.enable; @@ -30,18 +35,19 @@ in wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { - bind = let - pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; + bind = + let + pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; - dpmsTimeout = config.mod.swaylock.dpmsTimeout; - dpms-lock = pkgs.writeShellScript "dpms-lock" '' - ${pkgs.swayidle}/bin/swayidle \ - timeout ${dpmsTimeout} "${pkgs.hyprland}/bin/hyprctl dispatch dpms off" \ - resume "${pkgs.hyprland}/bin/hyprctl dispatch dpms on" & + dpmsTimeout = config.mod.swaylock.dpmsTimeout; + dpms-lock = pkgs.writeShellScript "dpms-lock" '' + ${pkgs.swayidle}/bin/swayidle \ + timeout ${dpmsTimeout} "${pkgs.hyprland}/bin/hyprctl dispatch dpms off" \ + resume "${pkgs.hyprland}/bin/hyprctl dispatch dpms on" & - ${pkgs.swaylock}/bin/swaylock && ${pkgs.procps}/bin/pkill swayidle - ''; - in + ${pkgs.swaylock}/bin/swaylock && ${pkgs.procps}/bin/pkill swayidle + ''; + in [ "$mod, x, exec, ${pause-music}; ${dpms-lock}" "$mod SHIFT, x, exec, ${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend" diff --git a/hosts/pinwheel/modules/syncthing/default.nix b/hosts/pinwheel/modules/syncthing/default.nix index 9473512..cbfd1ed 100644 --- a/hosts/pinwheel/modules/syncthing/default.nix +++ b/hosts/pinwheel/modules/syncthing/default.nix @@ -21,7 +21,10 @@ folders = { org = { path = "/home/alex/sync/org"; - devices = [ "phone" "backwards" ]; + devices = [ + "phone" + "backwards" + ]; versioning = { type = "staggered"; params = { diff --git a/hosts/pinwheel/modules/terraform/default.nix b/hosts/pinwheel/modules/terraform/default.nix index f2e8478..78f3915 100644 --- a/hosts/pinwheel/modules/terraform/default.nix +++ b/hosts/pinwheel/modules/terraform/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: { home-manager.users.alex = { home.packages = [ diff --git a/hosts/pinwheel/modules/vm/default.nix b/hosts/pinwheel/modules/vm/default.nix index 1dd4118..1ad4d74 100644 --- a/hosts/pinwheel/modules/vm/default.nix +++ b/hosts/pinwheel/modules/vm/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.vm.enable; in @@ -26,8 +31,8 @@ in home-manager.users.alex = { dconf.settings = { "org/virt-manager/virt-manager/connections" = { - autoconnect = ["qemu:///system"]; - uris = ["qemu:///system"]; + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; }; }; }; diff --git a/hosts/pinwheel/modules/waybar/default.nix b/hosts/pinwheel/modules/waybar/default.nix index a7f6edb..711dbb2 100644 --- a/hosts/pinwheel/modules/waybar/default.nix +++ b/hosts/pinwheel/modules/waybar/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let hyprlandEnabled = config.mod.hyprland.enable; @@ -194,8 +199,15 @@ in "interval" = 60; "format" = "{icon} {capacity}%"; "format-time" = "{H}h {M}min"; - "format-charging" ="󰂄 {capacity}%"; - "format-icons" = ["󰁺" "󰁻" "󰁽" "󰁿" "󰂁" "󰁹" ]; + "format-charging" = "󰂄 {capacity}%"; + "format-icons" = [ + "󰁺" + "󰁻" + "󰁽" + "󰁿" + "󰂁" + "󰁹" + ]; }; "clock" = { diff --git a/hosts/pinwheel/modules/wezterm/default.nix b/hosts/pinwheel/modules/wezterm/default.nix index 64234ac..d889ba9 100644 --- a/hosts/pinwheel/modules/wezterm/default.nix +++ b/hosts/pinwheel/modules/wezterm/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.wezterm.enable; diff --git a/hosts/pinwheel/modules/work/default.nix b/hosts/pinwheel/modules/work/default.nix index 4cb777c..cb6b475 100644 --- a/hosts/pinwheel/modules/work/default.nix +++ b/hosts/pinwheel/modules/work/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let gitEnabled = config.mod.git.enable; goEnabled = config.mod.go.enable; @@ -7,16 +12,18 @@ in { home-manager.users.alex = { home.sessionVariables = { - GITHUB_ACTOR="Alexander Heldt"; - GITHUB_TOKEN="$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-github-token.path})"; + GITHUB_ACTOR = "Alexander Heldt"; + GITHUB_TOKEN = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-github-token.path})"; }; home.packages = [ - (pkgs.callPackage ./syb-cli.nix {}) + (pkgs.callPackage ./syb-cli.nix { }) (pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ]) - (pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]) - (pkgs.graphite-cli.overrideAttrs(_: { + (pkgs.google-cloud-sdk.withExtraComponents [ + pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin + ]) + (pkgs.graphite-cli.overrideAttrs (_: { version = "1.4.3"; })) pkgs.xdg-utils # needed by graphite-cli diff --git a/hosts/pinwheel/modules/zsh/default.nix b/hosts/pinwheel/modules/zsh/default.nix index 31106db..2a6bd2d 100644 --- a/hosts/pinwheel/modules/zsh/default.nix +++ b/hosts/pinwheel/modules/zsh/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.zsh.enable; in diff --git a/hosts/tadpole/configuration.nix b/hosts/tadpole/configuration.nix index c8a4ee4..1ca97fe 100644 --- a/hosts/tadpole/configuration.nix +++ b/hosts/tadpole/configuration.nix @@ -1,20 +1,22 @@ { pkgs, ... }: { - imports = - [ - ../../config-manager/default.nix - ./hardware-configuration.nix - ./modules - ]; + imports = [ + ../../config-manager/default.nix + ./hardware-configuration.nix + ./modules + ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nixpkgs.config.allowUnfree = true; users.users.alex = { isNormalUser = true; extraGroups = [ "wheel" ]; - packages = []; + packages = [ ]; }; environment.variables.EDITOR = "vim"; diff --git a/hosts/tadpole/hardware-configuration.nix b/hosts/tadpole/hardware-configuration.nix index 9b26fb7..5d5d6ae 100644 --- a/hosts/tadpole/hardware-configuration.nix +++ b/hosts/tadpole/hardware-configuration.nix @@ -1,26 +1,39 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/7a2b1179-6582-4ef1-b094-0f11449373ed"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/7a2b1179-6582-4ef1-b094-0f11449373ed"; + fsType = "ext4"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/aa0634e1-a1c2-4461-978a-cf1768f38b0c"; } - ]; + swapDevices = [ + { device = "/dev/disk/by-uuid/aa0634e1-a1c2-4461-978a-cf1768f38b0c"; } + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/tadpole/home.nix b/hosts/tadpole/home.nix index 080ed0f..764b029 100644 --- a/hosts/tadpole/home.nix +++ b/hosts/tadpole/home.nix @@ -17,7 +17,7 @@ pkgs.git pkgs.tig pkgs.vim - ]; + ]; home.stateVersion = "24.05"; }; diff --git a/hosts/tadpole/modules/boot/default.nix b/hosts/tadpole/modules/boot/default.nix index d2366b4..90be4a5 100644 --- a/hosts/tadpole/modules/boot/default.nix +++ b/hosts/tadpole/modules/boot/default.nix @@ -1,4 +1,9 @@ -{ inputs, lib, config, ... }: +{ + inputs, + lib, + config, + ... +}: let configurationLimit = config.mod.gc.configurationLimit; in diff --git a/hosts/tadpole/modules/gitea/default.nix b/hosts/tadpole/modules/gitea/default.nix index 76b7c8a..f5e5f39 100644 --- a/hosts/tadpole/modules/gitea/default.nix +++ b/hosts/tadpole/modules/gitea/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let conf = config.mod.gitea; gitDomain = "git.${conf.baseDomain}"; @@ -26,7 +31,7 @@ in webfingerAccounts = lib.mkOption { type = lib.types.listOf lib.types.str; - default = []; + default = [ ]; description = "The accounts that should be listed"; }; }; @@ -47,7 +52,7 @@ in message = "There is no cert configured for ${conf.baseDomain} used by webfinger"; } { - assertion = conf.webfingerEnable && conf.webfingerAccounts != []; + assertion = conf.webfingerEnable && conf.webfingerAccounts != [ ]; message = "Option 'mod.gitea.webfingerAccounts' cannot be empty"; } ]; @@ -81,38 +86,43 @@ in services.nginx = { virtualHosts."${conf.baseDomain}" = let - mkWebfinger = account: - pkgs.writeTextDir (lib.escapeURL "acct:${account}") (lib.generators.toJSON {} { - subject = "acct:${account}"; - links = [{ - rel = "http://openid.net/specs/connect/1.0/issuer"; - href = "https://${gitDomain}"; - }]; - }); + mkWebfinger = + account: + pkgs.writeTextDir (lib.escapeURL "acct:${account}") ( + lib.generators.toJSON { } { + subject = "acct:${account}"; + links = [ + { + rel = "http://openid.net/specs/connect/1.0/issuer"; + href = "https://${gitDomain}"; + } + ]; + } + ); webfingerRoot = pkgs.symlinkJoin { name = "${gitDomain}-webfinger"; paths = builtins.map mkWebfinger conf.webfingerAccounts; }; in - lib.mkIf conf.webfingerEnable { - forceSSL = true; - useACMEHost = conf.baseDomain; + lib.mkIf conf.webfingerEnable { + forceSSL = true; + useACMEHost = conf.baseDomain; - locations."/.well-known/webfinger" = { - root = webfingerRoot; + locations."/.well-known/webfinger" = { + root = webfingerRoot; - extraConfig = '' - add_header Access-Control-Allow-Origin "*"; - default_type "application/jrd+json"; - types { application/jrd+json json; } - if ($arg_resource) { - rewrite ^(.*)$ /$arg_resource break; - } - return 400; - ''; - }; + extraConfig = '' + add_header Access-Control-Allow-Origin "*"; + default_type "application/jrd+json"; + types { application/jrd+json json; } + if ($arg_resource) { + rewrite ^(.*)$ /$arg_resource break; + } + return 400; + ''; }; + }; virtualHosts."${gitDomain}" = { forceSSL = true; diff --git a/hosts/tadpole/modules/nginx/default.nix b/hosts/tadpole/modules/nginx/default.nix index ed90b6f..7dcae9e 100644 --- a/hosts/tadpole/modules/nginx/default.nix +++ b/hosts/tadpole/modules/nginx/default.nix @@ -31,7 +31,10 @@ in networking = { firewall = { - allowedTCPPorts = [ 80 443 ]; + allowedTCPPorts = [ + 80 + 443 + ]; }; }; }; diff --git a/hosts/tadpole/modules/ppp.pm-site/default.nix b/hosts/tadpole/modules/ppp.pm-site/default.nix index 7f3b284..150c5f4 100644 --- a/hosts/tadpole/modules/ppp.pm-site/default.nix +++ b/hosts/tadpole/modules/ppp.pm-site/default.nix @@ -1,4 +1,9 @@ -{ inputs, lib, config, ... }: +{ + inputs, + lib, + config, + ... +}: let enabled = config.mod.pppdotpm-site.enable; diff --git a/hosts/tadpole/modules/ssh/default.nix b/hosts/tadpole/modules/ssh/default.nix index 685d238..69d7cab 100644 --- a/hosts/tadpole/modules/ssh/default.nix +++ b/hosts/tadpole/modules/ssh/default.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let enabled = config.mod.ssh.enable; @@ -41,10 +46,12 @@ in enable = true; ports = [ 1122 ]; - hostKeys = [{ - path = "${rootSSHKeyPath}/root.tadpole"; - type = "ed25519"; - }]; + hostKeys = [ + { + path = "${rootSSHKeyPath}/root.tadpole"; + type = "ed25519"; + } + ]; settings = { PasswordAuthentication = false; diff --git a/hosts/test-vm/configuration.nix b/hosts/test-vm/configuration.nix index 27321b8..144a9b4 100644 --- a/hosts/test-vm/configuration.nix +++ b/hosts/test-vm/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, ... }: { imports = [ ./ppp.pm-site.nix @@ -28,7 +28,7 @@ }; }; - environment.systemPackages = []; + environment.systemPackages = [ ]; system.stateVersion = "24.05"; }; diff --git a/hosts/test-vm/ppp.pm-site.nix b/hosts/test-vm/ppp.pm-site.nix index 8cb9eba..9bf4407 100644 --- a/hosts/test-vm/ppp.pm-site.nix +++ b/hosts/test-vm/ppp.pm-site.nix @@ -1,4 +1,9 @@ -{ inputs, lib, config, ... }: +{ + inputs, + lib, + config, + ... +}: let enabled = config.mod.pppdotpm-site.enable; in