From 9c895e9cc06eb19d843ad0ca50ba5c2bc14a0f82 Mon Sep 17 00:00:00 2001 From: Aleksandr Lebedev Date: Fri, 25 Jul 2025 22:56:40 +0200 Subject: [PATCH] Formatting + update --- disko/ext4-swap.nix | 25 +- disko/ext4.nix | 6 +- disko/impermanence-btrfs.nix | 5 +- disko/impermanence-tmpfs-luks.nix | 32 +- disko/impermanence-tmpfs.nix | 11 +- flake.lock | 18 +- flake.nix | 248 ++++++----- nixos/configuration.nix | 226 +++++----- .../hardware/apple-silicon-linux/default.nix | 32 +- .../hardware/apple-silicon-linux/homemac.nix | 6 +- .../apple-silicon-linux/widevine-overlay.nix | 9 +- .../hardware/apple-silicon-linux/widevine.nix | 58 ++- nixos/hardware/nvidia/default.nix | 89 ++-- nixos/home.nix | 23 +- nixos/homes/kylekrein/battery-status.nix | 150 +++---- nixos/homes/kylekrein/default.nix | 20 +- nixos/homes/kylekrein/hyprlock.nix | 101 +++-- nixos/homes/kylekrein/lisgd.nix | 4 +- nixos/homes/kylekrein/niri.nix | 405 +++++++++--------- nixos/homes/kylekrein/waybar/default.nix | 208 ++++----- nixos/hosts/andrej-pc/configuration.nix | 234 +++++----- nixos/hosts/android/default.nix | 25 +- nixos/hosts/android/home.nix | 33 +- nixos/hosts/kylekrein-framework12/default.nix | 16 +- nixos/hosts/kylekrein-homepc/default.nix | 29 +- .../kylekrein-homepc/homepc-hardware-conf.nix | 22 +- nixos/hosts/kylekrein-mac/default.nix | 14 +- .../hosts/kylekrein-mac/mac-hardware-conf.nix | 58 +-- nixos/hosts/kylekrein-server/conduwuit.nix | 74 ++-- nixos/hosts/kylekrein-server/default.nix | 339 ++++++++------- nixos/hosts/kylekrein-server/hardware.nix | 32 +- nixos/hosts/kylekrein-server/networking.nix | 34 +- nixos/hosts/kylekrein-wsl/default.nix | 24 +- nixos/modules/cosmic/default.nix | 7 +- nixos/modules/direnv/default.nix | 3 +- nixos/modules/dolphin/default.nix | 95 ++-- nixos/modules/emacs/packages.nix | 3 +- nixos/modules/fastfetch/default.nix | 180 ++++---- nixos/modules/firefox/aarch64-linux.nix | 10 +- nixos/modules/firefox/default.nix | 121 +++--- nixos/modules/gnome/default.nix | 3 +- nixos/modules/gnupg/default.nix | 16 +- nixos/modules/hyprland/battery-status.nix | 150 +++---- nixos/modules/hyprland/default.nix | 251 +++++------ nixos/modules/hyprland/home.nix | 3 +- nixos/modules/hyprland/hypridle.nix | 115 ++--- nixos/modules/hyprland/hyprland.nix | 31 +- nixos/modules/hyprland/hyprlock.nix | 99 +++-- nixos/modules/hyprland/waybar.nix | 192 +++++---- nixos/modules/kando/default.nix | 15 +- nixos/modules/kde-plasma/default.nix | 11 +- nixos/modules/libvirt/default.nix | 5 +- nixos/modules/libvirt/user.nix | 11 +- nixos/modules/niri/default.nix | 7 +- .../modules/services/autoupgrade/default.nix | 37 +- nixos/modules/sops/default.nix | 28 +- nixos/modules/steam/default.nix | 164 +++---- nixos/users/andrej/default.nix | 58 ++- nixos/users/dima/default.nix | 51 ++- nixos/users/tania/default.nix | 56 ++- nixos/wsl.nix | 118 ++--- 61 files changed, 2350 insertions(+), 2100 deletions(-) diff --git a/disko/ext4-swap.nix b/disko/ext4-swap.nix index e8677df..f5ae368 100644 --- a/disko/ext4-swap.nix +++ b/disko/ext4-swap.nix @@ -1,5 +1,7 @@ -{ device, swapSize ? "16G" }: { + device, + swapSize ? "16G", +}: { disko.devices = { disk.${device} = { type = "disk"; @@ -7,7 +9,8 @@ content = { type = "gpt"; # Initialize the disk with a GPT partition table partitions = { - ESP = { # Setup the EFI System Partition + ESP = { + # Setup the EFI System Partition type = "EF00"; # Set the partition type size = "1000M"; # Make the partition a gig content = { @@ -16,7 +19,8 @@ mountpoint = "/boot"; # Mount it to /boot }; }; - primary = { # Setup the LVM partition + primary = { + # Setup the LVM partition size = "100%"; # Fill up the rest of the drive with it content = { type = "lvm_pv"; # pvcreate @@ -26,17 +30,22 @@ }; }; }; - lvm_vg = { # vgcreate - vg1 = { # /dev/vg1 + lvm_vg = { + # vgcreate + vg1 = { + # /dev/vg1 type = "lvm_vg"; - lvs = { # lvcreate - swap = { # Logical Volume = "swap", /dev/vg1/swap + lvs = { + # lvcreate + swap = { + # Logical Volume = "swap", /dev/vg1/swap size = swapSize; content = { type = "swap"; }; }; - root = { # Logical Volume = "root", /dev/vg1/root + root = { + # Logical Volume = "root", /dev/vg1/root size = "100%FREE"; # Use the remaining space in the Volume Group content = { type = "filesystem"; diff --git a/disko/ext4.nix b/disko/ext4.nix index 0f7d4ca..9e41ee1 100644 --- a/disko/ext4.nix +++ b/disko/ext4.nix @@ -1,5 +1,7 @@ -{ device, mountpoint ? "/run/extraDrive" }: { + device, + mountpoint ? "/run/extraDrive", +}: { disko.devices = { disk = { "${device}" = { @@ -7,7 +9,7 @@ type = "disk"; content = { type = "gpt"; - partitions = { + partitions = { root = { size = "100%"; content = { diff --git a/disko/impermanence-btrfs.nix b/disko/impermanence-btrfs.nix index 10f240b..097a1bd 100644 --- a/disko/impermanence-btrfs.nix +++ b/disko/impermanence-btrfs.nix @@ -1,7 +1,4 @@ -{ - device ? throw "Set this to your disk device, e.g. /dev/sda", - ... -}: { +{device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: { disko.devices = { disk.main = { inherit device; diff --git a/disko/impermanence-tmpfs-luks.nix b/disko/impermanence-tmpfs-luks.nix index e173639..a411f8c 100644 --- a/disko/impermanence-tmpfs-luks.nix +++ b/disko/impermanence-tmpfs-luks.nix @@ -1,8 +1,4 @@ -{ - device ? throw "Set this to your disk device, e.g. /dev/sda", - ... -}: -{ +{device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: { disko.devices = { disk = { main = { @@ -41,42 +37,44 @@ content = { type = "filesystem"; format = "ext4"; - mountpoint = "/persist"; - }; + mountpoint = "/persist"; }; }; }; }; }; }; + }; nodev = { "/" = { fsType = "tmpfs"; - mountOptions = [ "defaults" "size=8G" "mode=755" ]; + mountOptions = ["defaults" "size=8G" "mode=755"]; }; }; }; fileSystems."/persist" = { - depends = [ "/" ]; + depends = ["/"]; neededForBoot = true; }; fileSystems."/nix" = { device = "/persist/nix"; - options = [ "bind" ]; - depends = [ "/persist" ]; + options = ["bind"]; + depends = ["/persist"]; neededForBoot = true; }; fileSystems."/tmp" = { device = "/persist/tmp"; - options = [ "bind" ]; - depends = [ "/persist" ]; + options = ["bind"]; + depends = ["/persist"]; neededForBoot = true; }; - swapDevices = [{ - device = "/persist/swapfile"; - size = 64*1024; # 64 GB - }]; + swapDevices = [ + { + device = "/persist/swapfile"; + size = 64 * 1024; # 64 GB + } + ]; boot.resumeDevice = "/persist/swapfile"; } diff --git a/disko/impermanence-tmpfs.nix b/disko/impermanence-tmpfs.nix index 325e529..ff11f03 100644 --- a/disko/impermanence-tmpfs.nix +++ b/disko/impermanence-tmpfs.nix @@ -1,7 +1,4 @@ -{ - device ? throw "Set this to your disk device, e.g. /dev/sda", - ... -}: { +{device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: { disko.devices = { disk.main = { inherit device; @@ -30,7 +27,7 @@ content = { type = "filesystem"; format = "ext4"; - mountpoint = "/persist"; + mountpoint = "/persist"; }; }; }; @@ -41,10 +38,10 @@ fsType = "tmpfs"; }; "/nix" = { - device = "/persist/nix"; + device = "/persist/nix"; }; "/tmp" = { - device = "/persist/tmp"; + device = "/persist/tmp"; }; }; }; diff --git a/flake.lock b/flake.lock index 3e03b57..f94c9fd 100644 --- a/flake.lock +++ b/flake.lock @@ -333,11 +333,11 @@ ] }, "locked": { - "lastModified": 1753393138, - "narHash": "sha256-mJp8QEFiVQNc3fZLf5zeKGIHeigMj33LYQ0EogcHz5g=", + "lastModified": 1753476892, + "narHash": "sha256-VZg9Oq9apTi2JEnlOSiCGl6iglwqNFr6A2u3CTWqGpQ=", "owner": "kylekrein", "repo": "emacs-config", - "rev": "f3880c6f9f32661dfae8d10f2fd522561dc73f25", + "rev": "1b0367dca5e6b37e2ca9c53f41f2316a5bf335eb", "type": "github" }, "original": { @@ -358,11 +358,11 @@ ] }, "locked": { - "lastModified": 1753376867, - "narHash": "sha256-FAPCW/szK3qvCUD+ThOX4sFyqz/MSadJ4SltA8lNamc=", + "lastModified": 1753460825, + "narHash": "sha256-MNu9l5nukxFpT5LzsT7Q83BqmO36EByn6/o/xA7hu7I=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "b8df6094952273f3b7e5e7c99b96ed1bf9830034", + "rev": "07c08ea0037b2fd7e0b5416361586d4552ac8255", "type": "github" }, "original": { @@ -1233,11 +1233,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1753468267, - "narHash": "sha256-KnwZCY92VjKvGyjnsnNHOvG9mllpFbKyeUkDpD//nvs=", + "lastModified": 1753473560, + "narHash": "sha256-bT4abIU3eGDraRATwkdeJAeIvxt9e23dhpjjp2dsRqg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dd386adc75a0061fbb9b1b62595dbc8c52330648", + "rev": "a6b41ef5e0c274f96b1f1b52b3d382302763f62a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b1f819f..2d78412 100644 --- a/flake.nix +++ b/flake.nix @@ -78,114 +78,133 @@ nixpkgs-unstable, ... } @ inputs: let - #systems = ["aarch64-linux" "x86_64-linux" ]; - #forAllSystems = nixpkgs.lib.genAttrs systems; - #pkgs = import nixpkgs { - # inherit system; - # config = { - # allowUnfree = true; - # }; - #}; + systems = ["aarch64-linux" "x86_64-linux"]; + eachSystem = nixpkgs.lib.genAttrs systems; + pkgsFor = eachSystem (system: + import nixpkgs { + localSystem = system; + overlays = [ + ]; + }); arm = "aarch64-linux"; x86 = "x86_64-linux"; - ladybirdMaster = self: super: { ladybird = super.ladybird.overrideAttrs(old: { - src = super.fetchFromGitHub { - owner = "LadybirdWebBrowser"; - repo = "ladybird"; - rev = "71222df4c4103d306fd05b9b0bffb1c1b8e5485e"; - hash = "sha256-hJkK7nag3Z9E8etPFCo0atUEJJnPjjkl7sle/UwkzbE="; - }; - version = "0-unstable-2025-05-22"; - });}; - nativePackagesOverlay = self: super: { - stdenv = super.impureUseNativeOptimizations super.stdenv; - }; - kylekrein-homepc-pkgs = nixpkgs: import nixpkgs { - system = x86; - overlays = [ - inputs.beeengine.overlays.${x86} - (final: prev: { #https://github.com/NixOS/nixpkgs/issues/388681 - pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [( - python-final: python-prev: { - onnxruntime = python-prev.onnxruntime.overridePythonAttrs ( - oldAttrs: { - buildInputs = prev.lib.lists.remove prev.onnxruntime oldAttrs.buildInputs; - } - ); - } - )]; - }) - #nativePackagesOverlay - #ladybirdMaster - ]; - config = { - allowBroken = true; - allowUnfree = true; - cudaSupport = true; - }; + ladybirdMaster = self: super: { + ladybird = super.ladybird.overrideAttrs (old: { + src = super.fetchFromGitHub { + owner = "LadybirdWebBrowser"; + repo = "ladybird"; + rev = "71222df4c4103d306fd05b9b0bffb1c1b8e5485e"; + hash = "sha256-hJkK7nag3Z9E8etPFCo0atUEJJnPjjkl7sle/UwkzbE="; }; - kylekrein-server-pkgs = nixpkgs: import nixpkgs { - system = x86; - overlays = [ - (self: super: { - conduwuit = inputs.conduwuit.packages."${x86}".all-features; - }) - #nativePackagesOverlay - #ladybirdMaster - ]; - config = { - allowBroken = true; - allowUnfree = true; - }; - }; - kylekrein-framework12-pkgs = nixpkgs: import nixpkgs { - system = x86; - overlays = [ - inputs.beeengine.overlays.${x86} - ]; - config = { - allowBroken = true; - allowUnfree = true; - }; + version = "0-unstable-2025-05-22"; + }); }; - kylekrein-mac-pkgs = nixpkgs: import nixpkgs { - system = arm; - overlays = [ - inputs.beeengine.overlays.${arm} - #nativePackagesOverlay - #(import ./nixos/macos/widevine.nix) - ]; - #config.replaceStdenv = {pkgs}: pkgs.impureUseNativeOptimizations pkgs.stdenv; - config = { - allowBroken = true; - allowUnfree = true; - allowUnsupportedSystem = true; - }; + nativePackagesOverlay = self: super: { + stdenv = super.impureUseNativeOptimizations super.stdenv; + }; + kylekrein-homepc-pkgs = nixpkgs: + import nixpkgs { + system = x86; + overlays = [ + inputs.beeengine.overlays.${x86} + (final: prev: { + #https://github.com/NixOS/nixpkgs/issues/388681 + pythonPackagesExtensions = + prev.pythonPackagesExtensions + ++ [ + ( + python-final: python-prev: { + onnxruntime = python-prev.onnxruntime.overridePythonAttrs ( + oldAttrs: { + buildInputs = prev.lib.lists.remove prev.onnxruntime oldAttrs.buildInputs; + } + ); + } + ) + ]; + }) + #nativePackagesOverlay + #ladybirdMaster + ]; + config = { + allowBroken = true; + allowUnfree = true; + cudaSupport = true; }; - kylekrein-wsl-pkgs = nixpkgs: import nixpkgs { - system = x86; - overlays = [ - #nativePackagesOverlay - ]; - config = { - allowUnfree = true; - }; + }; + kylekrein-server-pkgs = nixpkgs: + import nixpkgs { + system = x86; + overlays = [ + (self: super: { + conduwuit = inputs.conduwuit.packages."${x86}".all-features; + }) + #nativePackagesOverlay + #ladybirdMaster + ]; + config = { + allowBroken = true; + allowUnfree = true; }; - andrej-pc-pkgs = nixpkgs: import nixpkgs { - system = x86; - overlays = [ - inputs.beeengine.overlays.${x86} - #nativePackagesOverlay - ]; - config = { - #allowBroken = true; - allowUnfree = true; - #cudaSupport = true; - }; + }; + kylekrein-framework12-pkgs = nixpkgs: + import nixpkgs { + system = x86; + overlays = [ + inputs.beeengine.overlays.${x86} + ]; + config = { + allowBroken = true; + allowUnfree = true; }; + }; + kylekrein-mac-pkgs = nixpkgs: + import nixpkgs { + system = arm; + overlays = [ + inputs.beeengine.overlays.${arm} + #nativePackagesOverlay + #(import ./nixos/macos/widevine.nix) + ]; + #config.replaceStdenv = {pkgs}: pkgs.impureUseNativeOptimizations pkgs.stdenv; + config = { + allowBroken = true; + allowUnfree = true; + allowUnsupportedSystem = true; + }; + }; + kylekrein-wsl-pkgs = nixpkgs: + import nixpkgs { + system = x86; + overlays = [ + #nativePackagesOverlay + ]; + config = { + allowUnfree = true; + }; + }; + andrej-pc-pkgs = nixpkgs: + import nixpkgs { + system = x86; + overlays = [ + inputs.beeengine.overlays.${x86} + #nativePackagesOverlay + ]; + config = { + #allowBroken = true; + allowUnfree = true; + #cudaSupport = true; + }; + }; first-nixos-install = "1729112485"; #stat -c %W / in { + formatter = eachSystem ( + system: let + pkgs = pkgsFor.${system}; + in + pkgs.alejandra + ); nixOnDroidConfigurations.default = inputs.nix-on-droid.lib.nixOnDroidConfiguration { pkgs = import nixpkgs { system = "aarch64-linux"; @@ -213,13 +232,13 @@ hwconfig = { hostname = "kylekrein-homepc"; isLaptop = false; - hasTouchscreen = false; + hasTouchscreen = false; system = x86; useImpermanence = true; }; inherit first-nixos-install; inherit inputs; - unstable-pkgs = kylekrein-homepc-pkgs nixpkgs-unstable; + unstable-pkgs = kylekrein-homepc-pkgs nixpkgs-unstable; }; system = x86; @@ -234,13 +253,13 @@ hwconfig = { hostname = "kylekrein-framework12"; isLaptop = true; - hasTouchscreen = true; + hasTouchscreen = true; system = x86; useImpermanence = true; }; inherit first-nixos-install; inherit inputs; - unstable-pkgs = kylekrein-framework12-pkgs nixpkgs-unstable; + unstable-pkgs = kylekrein-framework12-pkgs nixpkgs-unstable; }; system = x86; @@ -248,7 +267,7 @@ modules = [ (import ./disko/impermanence-tmpfs-luks.nix {device = "/dev/nvme0n1";}) ./nixos/configuration.nix - inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel + inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel ]; }; "kylekrein-mac" = nixpkgs.lib.nixosSystem { @@ -256,13 +275,13 @@ hwconfig = { hostname = "kylekrein-mac"; isLaptop = true; - hasTouchscreen = false; + hasTouchscreen = false; system = arm; useImpermanence = true; }; inherit first-nixos-install; inherit inputs; - unstable-pkgs = kylekrein-mac-pkgs nixpkgs-unstable; + unstable-pkgs = kylekrein-mac-pkgs nixpkgs-unstable; }; system = arm; @@ -276,13 +295,13 @@ hwconfig = { hostname = "kylekrein-server"; isLaptop = false; - hasTouchscreen = false; + hasTouchscreen = false; system = x86; useImpermanence = false; }; inherit first-nixos-install; inherit inputs; - unstable-pkgs = kylekrein-server-pkgs nixpkgs-unstable; + unstable-pkgs = kylekrein-server-pkgs nixpkgs-unstable; }; system = x86; @@ -296,13 +315,13 @@ hwconfig = { hostname = "kylekrein-wsl"; isLaptop = true; - hasTouchscreen = false; + hasTouchscreen = false; system = x86; useImpermanence = false; }; inherit first-nixos-install; inherit inputs; - unstable-pkgs = kylekrein-wsl-pkgs nixpkgs-unstable; + unstable-pkgs = kylekrein-wsl-pkgs nixpkgs-unstable; }; system = x86; @@ -317,20 +336,23 @@ hwconfig = { hostname = "andrej-pc"; isLaptop = false; - hasTouchscreen = false; + hasTouchscreen = false; system = x86; useImpermanence = false; }; inherit first-nixos-install; inherit inputs; - unstable-pkgs = andrej-pc-pkgs nixpkgs-unstable; + unstable-pkgs = andrej-pc-pkgs nixpkgs-unstable; }; system = x86; pkgs = andrej-pc-pkgs nixpkgs; modules = [ - (import ./disko/ext4-swap.nix {device = "/dev/sda"; swapSize = "16G";}) - (import ./disko/ext4.nix {device = "/dev/sdb";}) + (import ./disko/ext4-swap.nix { + device = "/dev/sda"; + swapSize = "16G"; + }) + (import ./disko/ext4.nix {device = "/dev/sdb";}) ./nixos/hosts/andrej-pc/configuration.nix ]; }; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 2e6e077..d84eacd 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -10,33 +10,33 @@ inputs, unstable-pkgs, ... -}: -let -in -{ - imports = [ - inputs.sops-nix.nixosModules.sops - inputs.nixos-facter-modules.nixosModules.facter - inputs.home-manager.nixosModules.default - inputs.disko.nixosModules.default +}: let +in { + imports = + [ + inputs.sops-nix.nixosModules.sops + inputs.nixos-facter-modules.nixosModules.facter + inputs.home-manager.nixosModules.default + inputs.disko.nixosModules.default - ./modules/firefox - ./modules/flatpak - ./modules/steam - ./modules/ly - ./modules/sddm - ./modules/services/autoupgrade - ./modules/sops - ./modules/dolphin - ./modules/emacs - ./modules/gnupg - ./modules/direnv - ./hosts/${hwconfig.hostname} - ] ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; + ./modules/firefox + ./modules/flatpak + ./modules/steam + ./modules/ly + ./modules/sddm + ./modules/services/autoupgrade + ./modules/sops + ./modules/dolphin + ./modules/emacs + ./modules/gnupg + ./modules/direnv + ./hosts/${hwconfig.hostname} + ] + ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; facter.reportPath = ./hosts/${hwconfig.hostname}/facter.json; kylekrein.services.autoUpgrade = { enable = true; - pushUpdates = false;#if hwconfig.hostname == "kylekrein-homepc" then true else false; + pushUpdates = false; #if hwconfig.hostname == "kylekrein-homepc" then true else false; configDir = "/etc/nixos-config"; user = "root"; }; @@ -45,7 +45,10 @@ in kernelPackages = lib.mkDefault pkgs.linuxPackages_6_14; loader = { systemd-boot.enable = true; - efi.canTouchEfiVariables = if hwconfig.hostname != "kylekrein-mac" then true else false; + efi.canTouchEfiVariables = + if hwconfig.hostname != "kylekrein-mac" + then true + else false; }; # Hide the OS choice for bootloaders. # It's still possible to open the bootloader list by pressing any key @@ -63,7 +66,6 @@ in #flatpak #kk.services.flatpak.enable = hwconfig.system != "aarch64-linux"; services.flatpak.packages = [ - ]; # Enable networking @@ -167,7 +169,7 @@ in csharp-ls element-desktop unstable-pkgs.fluffychat - + beeengineeditor beelocalization ]; @@ -223,102 +225,102 @@ in security.polkit.enable = true; #programs.thunar = { - # enable = true; - # plugins = with pkgs.xfce; [ - # thunar-archive-plugin - # thunar-volman - # ]; - # }; - #programs.xfconf.enable = true; # so thunar can save config - #services.gvfs.enable = true; # Mount, trash, and other functionalities - #services.tumbler.enable = true; # Thumbnail support for images + # enable = true; + # plugins = with pkgs.xfce; [ + # thunar-archive-plugin + # thunar-volman + # ]; + # }; + #programs.xfconf.enable = true; # so thunar can save config + #services.gvfs.enable = true; # Mount, trash, and other functionalities + #services.tumbler.enable = true; # Thumbnail support for images - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - }; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; - programs.bash = { - shellAliases = { - ls = "${pkgs.eza}/bin/eza --icons=always"; - }; - }; + programs.bash = { + shellAliases = { + ls = "${pkgs.eza}/bin/eza --icons=always"; + }; + }; - #printing - services.printing.enable = true; - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; + #printing + services.printing.enable = true; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; - #services.flatpak.enable = true; - #services.flatpak.packages = [ - # "flathub:app/org.kde.dolphin//stable" - # ]; + #services.flatpak.enable = true; + #services.flatpak.packages = [ + # "flathub:app/org.kde.dolphin//stable" + # ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; - kk.steam.enable = true; + kk.steam.enable = true; - # List services that you want to enable: + # List services that you want to enable: - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - # require public key authentication for better security - settings.PasswordAuthentication = false; - settings.KbdInteractiveAuthentication = false; - settings.PermitRootLogin = "no"; - extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; - }; + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + # require public key authentication for better security + settings.PasswordAuthentication = false; + settings.KbdInteractiveAuthentication = false; + settings.PermitRootLogin = "no"; + extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; + }; - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 22 53317 ]; - networking.firewall.allowedUDPPorts = [ 22 53317 ]; - # Or disable the firewall altogether. - #networking.firewall.enable = false; + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [22 53317]; + networking.firewall.allowedUDPPorts = [22 53317]; + # Or disable the firewall altogether. + #networking.firewall.enable = false; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? - nix = { - settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - auto-optimise-store = true; - substituters = [ - "https://hyprland.cachix.org" - "https://nix-gaming.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - }; + nix = { + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + substituters = [ + "https://hyprland.cachix.org" + "https://nix-gaming.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + }; } diff --git a/nixos/hardware/apple-silicon-linux/default.nix b/nixos/hardware/apple-silicon-linux/default.nix index e2183f9..726c9d7 100644 --- a/nixos/hardware/apple-silicon-linux/default.nix +++ b/nixos/hardware/apple-silicon-linux/default.nix @@ -4,12 +4,12 @@ inputs, ... }: let -pkgs-master = import inputs.nixpkgs-master { - inherit (pkgs) system; - config.allowUnfree = true; -}; + pkgs-master = import inputs.nixpkgs-master { + inherit (pkgs) system; + config.allowUnfree = true; + }; in { -nixpkgs = { + nixpkgs = { overlays = [ (self: super: { widevine-cdm = pkgs-master.widevine-cdm; @@ -23,17 +23,17 @@ nixpkgs = { imports = [ #./apple-silicon-support ]; -programs.firefox.policies.Preferences = { - "media.gmp-widevinecdm.version" = "system-installed"; - "media.gmp-widevinecdm.visible" = true; - "media.gmp-widevinecdm.enabled" = true; - "media.gmp-widevinecdm.autoupdate" = false; - "media.eme.enabled" = true; - "media.eme.encrypted-media-encryption-scheme.enabled" = true; -}; -programs.firefox.autoConfig = '' -// Zhu -lockPref("general.useragent.override","Mozilla/5.0 (X11; CrOS aarch64 15236.80.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.125 Safari/537.36");''; #doesn't work. You need to manually add this to about:config + programs.firefox.policies.Preferences = { + "media.gmp-widevinecdm.version" = "system-installed"; + "media.gmp-widevinecdm.visible" = true; + "media.gmp-widevinecdm.enabled" = true; + "media.gmp-widevinecdm.autoupdate" = false; + "media.eme.enabled" = true; + "media.eme.encrypted-media-encryption-scheme.enabled" = true; + }; + programs.firefox.autoConfig = '' + // Zhu + lockPref("general.useragent.override","Mozilla/5.0 (X11; CrOS aarch64 15236.80.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.125 Safari/537.36");''; #doesn't work. You need to manually add this to about:config hardware.asahi = { peripheralFirmwareDirectory = ./firmware; useExperimentalGPUDriver = true; #deprecated diff --git a/nixos/hardware/apple-silicon-linux/homemac.nix b/nixos/hardware/apple-silicon-linux/homemac.nix index a2bcfac..9b34415 100644 --- a/nixos/hardware/apple-silicon-linux/homemac.nix +++ b/nixos/hardware/apple-silicon-linux/homemac.nix @@ -1,5 +1,4 @@ -{pkgs, ...}: -{ +{pkgs, ...}: { programs.firefox.profiles.default.settings = { "media.gmp-widevinecdm.version" = pkgs.widevinecdm-aarch64.version; "media.gmp-widevinecdm.visible" = true; @@ -12,7 +11,7 @@ home.file."firefox-widevinecdm" = { enable = true; target = ".mozilla/firefox/default/gmp-widevinecdm"; - source = pkgs.runCommandLocal "firefox-widevinecdm" { } '' + source = pkgs.runCommandLocal "firefox-widevinecdm" {} '' out=$out/${pkgs.widevinecdm-aarch64.version} mkdir -p $out ln -s ${pkgs.widevinecdm-aarch64}/manifest.json $out/manifest.json @@ -20,5 +19,4 @@ ''; recursive = true; }; - } diff --git a/nixos/hardware/apple-silicon-linux/widevine-overlay.nix b/nixos/hardware/apple-silicon-linux/widevine-overlay.nix index 26cacb9..fde4e48 100644 --- a/nixos/hardware/apple-silicon-linux/widevine-overlay.nix +++ b/nixos/hardware/apple-silicon-linux/widevine-overlay.nix @@ -1,6 +1,5 @@ -prev: final: -{ - widevinecdm-aarch64 = import ./widevine.nix { - inherit (final) stdenvNoCC fetchFromGitHub fetchurl python3 squashfsTools nspr; - }; +prev: final: { + widevinecdm-aarch64 = import ./widevine.nix { + inherit (final) stdenvNoCC fetchFromGitHub fetchurl python3 squashfsTools nspr; + }; } diff --git a/nixos/hardware/apple-silicon-linux/widevine.nix b/nixos/hardware/apple-silicon-linux/widevine.nix index 525fef8..ccae416 100644 --- a/nixos/hardware/apple-silicon-linux/widevine.nix +++ b/nixos/hardware/apple-silicon-linux/widevine.nix @@ -1,11 +1,11 @@ -{ stdenvNoCC -, fetchFromGitHub -, fetchurl -, python3 -, squashfsTools -, nspr -}: -let +{ + stdenvNoCC, + fetchFromGitHub, + fetchurl, + python3, + squashfsTools, + nspr, +}: let widevine-installer = fetchFromGitHub { owner = "AsahiLinux"; repo = "widevine-installer"; @@ -13,31 +13,29 @@ let sha256 = "sha256-XI1y4pVNpXS+jqFs0KyVMrxcULOJ5rADsgvwfLF6e0Y="; }; lacros-image = fetchurl { - url = - let - distfiles_base = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles"; - lacros_name = "chromeos-lacros-arm64-squash-zstd"; - lacrosVersion = "120.0.6098.0"; - in - "${distfiles_base}/${lacros_name}-${lacrosVersion}"; + url = let + distfiles_base = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles"; + lacros_name = "chromeos-lacros-arm64-squash-zstd"; + lacrosVersion = "120.0.6098.0"; + in "${distfiles_base}/${lacros_name}-${lacrosVersion}"; hash = "sha256-OKV8w5da9oZ1oSGbADVPCIkP9Y0MVLaQ3PXS3ZBLFXY="; }; in -stdenvNoCC.mkDerivation { - name = "widevine"; - version = "4.10.2662.3"; + stdenvNoCC.mkDerivation { + name = "widevine"; + version = "4.10.2662.3"; - dontUnpack = true; - dontBuild = true; + dontUnpack = true; + dontBuild = true; - buildInputs = [ python3 squashfsTools ]; + buildInputs = [python3 squashfsTools]; - installPhase = '' - mkdir $out - unsquashfs -q ${lacros-image} 'WidevineCdm/*' - python3 ${widevine-installer}/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so $out/libwidevinecdm.so - mv squashfs-root/WidevineCdm/manifest.json $out/ - mv squashfs-root/WidevineCdm/LICENSE $out/ - patchelf --add-rpath ${nspr}/lib $out/libwidevinecdm.so - ''; -} + installPhase = '' + mkdir $out + unsquashfs -q ${lacros-image} 'WidevineCdm/*' + python3 ${widevine-installer}/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so $out/libwidevinecdm.so + mv squashfs-root/WidevineCdm/manifest.json $out/ + mv squashfs-root/WidevineCdm/LICENSE $out/ + patchelf --add-rpath ${nspr}/lib $out/libwidevinecdm.so + ''; + } diff --git a/nixos/hardware/nvidia/default.nix b/nixos/hardware/nvidia/default.nix index 827445d..029d730 100644 --- a/nixos/hardware/nvidia/default.nix +++ b/nixos/hardware/nvidia/default.nix @@ -1,53 +1,56 @@ -{ config, pkgs, lib, ... }: { + config, + pkgs, + lib, + ... +}: { hardware = { - graphics = { - enable = true; - extraPackages = with pkgs; [ - nvidia-vaapi-driver - ]; - }; - nvidia = { - # https://nixos.wiki/wiki/Nvidia - # Modesetting is required. - modesetting.enable = true; + graphics = { + enable = true; + extraPackages = with pkgs; [ + nvidia-vaapi-driver + ]; + }; + nvidia = { + # https://nixos.wiki/wiki/Nvidia + # Modesetting is required. + modesetting.enable = true; - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = true;#false; + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; #false; - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = true; + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = true; - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.latest; - }; - - logitech.wireless.enable = true; + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.latest; + }; + + logitech.wireless.enable = true; }; - services.xserver.videoDrivers = [ "nvidia" ]; + services.xserver.videoDrivers = ["nvidia"]; #hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver { #fixes https://github.com/NixOS/nixpkgs/issues/375730 temporary - # version = "570.133.07"; # use new 570 drivers - # sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; - # openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; - # settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; - # usePersistenced = false; - #}; - + # version = "570.133.07"; # use new 570 drivers + # sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; + # openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; + # settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; + # usePersistenced = false; + #}; } diff --git a/nixos/home.nix b/nixos/home.nix index 1ba7454..2f67752 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -7,16 +7,14 @@ username, inputs, ... -}: -let -in -{ +}: let +in { imports = [ #./modules/fastfetch #./modules/tmux/home.nix ] -++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ./modules/fastfetch + ++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ./modules/fastfetch ++ lib.optional (hwconfig.useImpermanence) ( import ./modules/impermanence/home.nix { inherit username; @@ -30,16 +28,23 @@ in # inherit inputs; # inherit hwconfig; # inherit lib; - # } + # } #) ++ lib.optional (builtins.pathExists ./homes/${username}) ( - import ./homes/${username} { inherit username; inherit config; inherit pkgs; inherit lib; inherit inputs; inherit hwconfig; } + import ./homes/${username} { + inherit username; + inherit config; + inherit pkgs; + inherit lib; + inherit inputs; + inherit hwconfig; + } ); # Home Manager needs a bit of information about you and the paths it should # manage. home.username = username; home.homeDirectory = "/home/${username}"; - + #xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" { # General.theme = "Catppuccin-Mocha"; # }; @@ -102,7 +107,7 @@ in ]; programs.kitty = { - enable = lib.strings.hasInfix "kylekrein" hwconfig.hostname; + enable = lib.strings.hasInfix "kylekrein" hwconfig.hostname; font = { name = "JetBrainsMono Nerd Font"; size = 20; diff --git a/nixos/homes/kylekrein/battery-status.nix b/nixos/homes/kylekrein/battery-status.nix index f363627..e9f93d9 100644 --- a/nixos/homes/kylekrein/battery-status.nix +++ b/nixos/homes/kylekrein/battery-status.nix @@ -1,83 +1,89 @@ -{pkgs, hwconfig, ...}: -let - battery-path = "/sys/class/power_supply/${if hwconfig.hostname == "kylekrein-mac" then "macsmc-battery" else "BAT0"}"; - get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" '' - cat ${battery-path}/capacity 2>/dev/null || echo "N/A" - ''}/bin/get-battery-level"; - get-status = "${pkgs.writeShellScriptBin "get-status" '' - cat ${battery-path}/status 2>/dev/null || echo "Unknown" - ''}/bin/get-status"; - get-icon = "${pkgs.writeShellScriptBin "get-icon" '' -BATTERY_LEVEL=$(${get-battery-level}) -STATUS=$(${get-status}) -if [[ "$BATTERY_LEVEL" == "N/A" ]]; then - ICON="󰂑 " -elif [[ "$STATUS" == "Charging" ]]; then - if [[ $BATTERY_LEVEL -ge 90 ]]; then - ICON="󰂋 " - elif [[ $BATTERY_LEVEL -ge 80 ]]; then - ICON="󰂊 " - elif [[ $BATTERY_LEVEL -ge 70 ]]; then - ICON="󰢞 " - elif [[ $BATTERY_LEVEL -ge 60 ]]; then - ICON="󰂉 " - elif [[ $BATTERY_LEVEL -ge 50 ]]; then - ICON="󰢝 " - elif [[ $BATTERY_LEVEL -ge 40 ]]; then - ICON="󰂈 " - elif [[ $BATTERY_LEVEL -ge 30 ]]; then - ICON="󰂇 " - elif [[ $BATTERY_LEVEL -ge 20 ]]; then - ICON="󰂆 " - elif [[ $BATTERY_LEVEL -ge 10 ]]; then - ICON="󰢜 " - else - ICON="󰢜 " - fi -else - if [[ $BATTERY_LEVEL -ge 90 ]]; then - ICON="󰂂 " - elif [[ $BATTERY_LEVEL -ge 70 ]]; then - ICON="󰂀 " - elif [[ $BATTERY_LEVEL -ge 50 ]]; then - ICON="󰁾 " - elif [[ $BATTERY_LEVEL -ge 30 ]]; then - ICON="󰁼 " - elif [[ $BATTERY_LEVEL -ge 10 ]]; then - ICON="󰁺 " - else - ICON="󰁺 " - fi -fi - -echo "$ICON" - ''}/bin/get-icon"; - get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" '' -REMAINING_ENERGY=$(cat ${battery-path}/energy_now) -POWER_USAGE=$(cat ${battery-path}/power_now) -if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then - TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE))) - MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60))) - echo "$TIME_LEFT h $MINUTES_LEFT min" -else - echo "" -fi - ''}/bin/get-remaining-time"; -in { + pkgs, + hwconfig, + ... +}: let + battery-path = "/sys/class/power_supply/${ + if hwconfig.hostname == "kylekrein-mac" + then "macsmc-battery" + else "BAT0" + }"; + get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" '' + cat ${battery-path}/capacity 2>/dev/null || echo "N/A" + ''}/bin/get-battery-level"; + get-status = "${pkgs.writeShellScriptBin "get-status" '' + cat ${battery-path}/status 2>/dev/null || echo "Unknown" + ''}/bin/get-status"; + get-icon = "${pkgs.writeShellScriptBin "get-icon" '' + BATTERY_LEVEL=$(${get-battery-level}) + STATUS=$(${get-status}) + if [[ "$BATTERY_LEVEL" == "N/A" ]]; then + ICON="󰂑 " + elif [[ "$STATUS" == "Charging" ]]; then + if [[ $BATTERY_LEVEL -ge 90 ]]; then + ICON="󰂋 " + elif [[ $BATTERY_LEVEL -ge 80 ]]; then + ICON="󰂊 " + elif [[ $BATTERY_LEVEL -ge 70 ]]; then + ICON="󰢞 " + elif [[ $BATTERY_LEVEL -ge 60 ]]; then + ICON="󰂉 " + elif [[ $BATTERY_LEVEL -ge 50 ]]; then + ICON="󰢝 " + elif [[ $BATTERY_LEVEL -ge 40 ]]; then + ICON="󰂈 " + elif [[ $BATTERY_LEVEL -ge 30 ]]; then + ICON="󰂇 " + elif [[ $BATTERY_LEVEL -ge 20 ]]; then + ICON="󰂆 " + elif [[ $BATTERY_LEVEL -ge 10 ]]; then + ICON="󰢜 " + else + ICON="󰢜 " + fi + else + if [[ $BATTERY_LEVEL -ge 90 ]]; then + ICON="󰂂 " + elif [[ $BATTERY_LEVEL -ge 70 ]]; then + ICON="󰂀 " + elif [[ $BATTERY_LEVEL -ge 50 ]]; then + ICON="󰁾 " + elif [[ $BATTERY_LEVEL -ge 30 ]]; then + ICON="󰁼 " + elif [[ $BATTERY_LEVEL -ge 10 ]]; then + ICON="󰁺 " + else + ICON="󰁺 " + fi + fi + + echo "$ICON" + ''}/bin/get-icon"; + get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" '' + REMAINING_ENERGY=$(cat ${battery-path}/energy_now) + POWER_USAGE=$(cat ${battery-path}/power_now) + if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then + TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE))) + MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60))) + echo "$TIME_LEFT h $MINUTES_LEFT min" + else + echo "" + fi + ''}/bin/get-remaining-time"; +in { available = hwconfig.isLaptop; icon = get-icon; status = get-status; time = get-remaining-time; level = get-battery-level; labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" '' - if [[ "$(${get-status})" == "Charging" ]]; then - echo "$(${get-battery-level})% $(${get-icon})" - else - echo "$(${get-remaining-time}) $(${get-icon})" - fi + if [[ "$(${get-status})" == "Charging" ]]; then + echo "$(${get-battery-level})% $(${get-icon})" + else + echo "$(${get-remaining-time}) $(${get-icon})" + fi ''}/bin/labelAdaptive"; labelPercent = "${pkgs.writeShellScriptBin "labelPercent" '' - echo "$(${get-battery-level})% $(${get-icon})" + echo "$(${get-battery-level})% $(${get-icon})" ''}/bin/labelPercent"; } diff --git a/nixos/homes/kylekrein/default.nix b/nixos/homes/kylekrein/default.nix index b7531fb..217621b 100644 --- a/nixos/homes/kylekrein/default.nix +++ b/nixos/homes/kylekrein/default.nix @@ -1,10 +1,20 @@ -{config, username, pkgs, lib, inputs, hwconfig, ...}: { - imports = [ - ./git.nix - ] ++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ( +{ + config, + username, + pkgs, + lib, + inputs, + hwconfig, + ... +}: { + imports = + [ + ./git.nix + ] + ++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ( import ./niri.nix { inherit pkgs; - inherit config; + inherit config; inherit username; inherit inputs; inherit hwconfig; diff --git a/nixos/homes/kylekrein/hyprlock.nix b/nixos/homes/kylekrein/hyprlock.nix index 565e6ee..0cdb100 100644 --- a/nixos/homes/kylekrein/hyprlock.nix +++ b/nixos/homes/kylekrein/hyprlock.nix @@ -1,21 +1,28 @@ -{ pkgs, lib, hwconfig, ... }: -let - profile-image = ./nixos-warbler.png; - battery-level = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;}).labelPercent; -in { + pkgs, + lib, + hwconfig, + ... +}: let + profile-image = ./nixos-warbler.png; + battery-level = + (import ./battery-status.nix { + inherit pkgs; + inherit hwconfig; + }).labelPercent; +in { programs.hyprlock = { enable = true; settings = { general = { #enable_fingerprint = true; - disable_loading_bar = true; - hide_cursor = true; - no_fade_in = false; - grace = 10; + disable_loading_bar = true; + hide_cursor = true; + no_fade_in = false; + grace = 10; }; background = { - path = "${../../modules/hyprland/wallpaper.jpg}"; + path = "${../../modules/hyprland/wallpaper.jpg}"; blur_passes = 1; blur_size = 7; noise = 0.0117; @@ -25,14 +32,14 @@ in vibrancy_darkness = 0.0; }; image = { - path = "${profile-image}"; - size = 150; - border_size = 4; - #border_color = "rgb(0C96F9)"; - rounding = -1; # Negative means circle - position = "0, 220"; - halign = "center"; - valign = "center"; + path = "${profile-image}"; + size = 150; + border_size = 4; + #border_color = "rgb(0C96F9)"; + rounding = -1; # Negative means circle + position = "0, 220"; + halign = "center"; + valign = "center"; }; input-field = { size = "600, 100"; @@ -52,41 +59,41 @@ in halign = "center"; valign = "center"; }; - label = [ - { - text = "$USER"; - font_family = "Fira Code"; - font_size = 56; - position = "0, 100"; - halign = "center"; - valign = "center"; - } - { - text = "$TIME"; - font_family = "Roboto"; - font_size = 72; - position = "-40, -40"; - halign = "right"; - valign = "top"; - } - { - text = "$LAYOUT"; - font_family = "JetBrains Mono"; - font_size = 28; - position = "-20, 20"; - halign = "right"; - valign = "bottom"; - } - ] ++ lib.optional (hwconfig.isLaptop) ( - { + label = + [ + { + text = "$USER"; + font_family = "Fira Code"; + font_size = 56; + position = "0, 100"; + halign = "center"; + valign = "center"; + } + { + text = "$TIME"; + font_family = "Roboto"; + font_size = 72; + position = "-40, -40"; + halign = "right"; + valign = "top"; + } + { + text = "$LAYOUT"; + font_family = "JetBrains Mono"; + font_size = 28; + position = "-20, 20"; + halign = "right"; + valign = "bottom"; + } + ] + ++ lib.optional (hwconfig.isLaptop) { text = ''cmd[update:10000] ${battery-level}''; font_family = "JetBrains Mono"; font_size = 28; position = "20, 20"; halign = "left"; valign = "bottom"; - }); + }; }; }; } - diff --git a/nixos/homes/kylekrein/lisgd.nix b/nixos/homes/kylekrein/lisgd.nix index 411b149..e0d565d 100644 --- a/nixos/homes/kylekrein/lisgd.nix +++ b/nixos/homes/kylekrein/lisgd.nix @@ -1,2 +1,2 @@ -{ pkgs }: -pkgs.lisgd.override { conf = ./lisgd-config.h; } +{pkgs}: +pkgs.lisgd.override {conf = ./lisgd-config.h;} diff --git a/nixos/homes/kylekrein/niri.nix b/nixos/homes/kylekrein/niri.nix index c7a574c..7f74c7d 100644 --- a/nixos/homes/kylekrein/niri.nix +++ b/nixos/homes/kylekrein/niri.nix @@ -1,8 +1,15 @@ #https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix #https://github.com/sodiboo/niri-flake/blob/main/docs.md #https://github.com/sodiboo/system/blob/main/niri.mod.nix -{config, pkgs, lib, inputs, hwconfig, username, ...}: { + config, + pkgs, + lib, + inputs, + hwconfig, + username, + ... +}: { programs.fuzzel = { enable = true; settings.main.terminal = "kitty"; @@ -14,74 +21,76 @@ ./waybar ./hyprlock.nix ]; - home.packages = with pkgs;[ - nwg-drawer - wlogout - brightnessctl - fuzzel - waybar - swaybg - libnotify - hyprlock - networkmanagerapplet - ] ++ lib.optionals (hwconfig.hasTouchscreen) (with pkgs;[ - wvkbd # https://github.com/jjsullivan5196/wvkbd - ]); + home.packages = with pkgs; + [ + nwg-drawer + wlogout + brightnessctl + fuzzel + waybar + swaybg + libnotify + hyprlock + networkmanagerapplet + ] + ++ lib.optionals (hwconfig.hasTouchscreen) (with pkgs; [ + wvkbd # https://github.com/jjsullivan5196/wvkbd + ]); programs.niri = { settings = { outputs = lib.mkIf (hwconfig.hostname == "kylekrein-homepc") { - "DP-1" = { - scale = 1.6; - position.x = 1600; - position.y = 0; - }; - "DP-3" = { - scale = 1.6; - position.x = 0; - position.y = 0; - }; + "DP-1" = { + scale = 1.6; + position.x = 1600; + position.y = 0; + }; + "DP-3" = { + scale = 1.6; + position.x = 0; + position.y = 0; + }; }; spawn-at-startup = let - set-low-brightness = lib.mkIf (hwconfig.isLaptop) { - command = [ - "${lib.getExe pkgs.brightnessctl}" - "set" - "25%" - ]; - }; - touchscreen-gestures = lib.mkIf (hwconfig.hasTouchscreen) { + set-low-brightness = lib.mkIf (hwconfig.isLaptop) { command = [ - "${lib.getExe (import ./lisgd.nix { inherit pkgs; })}" #https://git.sr.ht/~mil/lisgd + "${lib.getExe pkgs.brightnessctl}" + "set" + "25%" + ]; + }; + touchscreen-gestures = lib.mkIf (hwconfig.hasTouchscreen) { + command = [ + "${lib.getExe (import ./lisgd.nix {inherit pkgs;})}" #https://git.sr.ht/~mil/lisgd ]; }; in [ - set-low-brightness - touchscreen-gestures - { + set-low-brightness + touchscreen-gestures + { command = [ "${lib.getExe pkgs.networkmanagerapplet}" ]; } - { + { command = [ "${lib.getExe pkgs.networkmanagerapplet}" ]; } - { + { command = [ "dbus-update-activation-environment" - "--systemd" - "--all" + "--systemd" + "--all" ]; } - { + { command = [ "${pkgs.solaar}/bin/solaar" - "-w" - "hide" + "-w" + "hide" ]; } - { + { command = [ "${lib.getExe pkgs.swaybg}" "-m" @@ -90,7 +99,7 @@ "${../../modules/hyprland/wallpaper.jpg}" ]; } - { + { command = [ "emacs" "--daemon" @@ -99,96 +108,100 @@ ]; layout = { preset-column-widths = [ - {proportion = 1.0 / 2.0;} - {proportion = 1.0;} - {proportion = 2.0 / 3.0;} - {proportion = 1.0 / 3.0;} + {proportion = 1.0 / 2.0;} + {proportion = 1.0;} + {proportion = 2.0 / 3.0;} + {proportion = 1.0 / 3.0;} ]; default-column-width = {proportion = 1.0 / 2.0;}; }; - binds = with config.lib.niri.actions; - let - sh = spawn "sh" "-c"; + binds = with config.lib.niri.actions; let + sh = spawn "sh" "-c"; emacs = action: sh "emacsclient -c --eval \"${action}\""; homedir = "/home/${username}/"; - screenshot-annotate = sh ''${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp} -w 0)" -t ppm - | ${lib.getExe pkgs.satty} --early-exit --copy-command 'wl-copy' --filename '-' --initial-tool brush''; - in { - "Mod+E".action = sh "emacsclient -c"; - "Mod+Shift+C".action = sh "dolphin"; - "Mod+C".action = emacs ''(dirvish \"${homedir}\")''; - "Mod+T".action = spawn "kitty"; - "Mod+D".action = spawn "fuzzel"; - "Mod+B".action = spawn "librewolf"; - "Mod+H".action = show-hotkey-overlay; - "Mod+F".action = fullscreen-window; - "Mod+R".action = switch-preset-column-width; - "Mod+Q".action = close-window; - "Mod+Shift+S".action = screenshot-annotate; - "Mod+1".action = focus-workspace 1; - "Mod+2".action = focus-workspace 2; - "Mod+3".action = focus-workspace 3; - "Mod+4".action = focus-workspace 4; - "Mod+5".action = focus-workspace 5; - "Mod+6".action = focus-workspace 6; - "Mod+7".action = focus-workspace 7; - "Mod+8".action = focus-workspace 8; - "Mod+9".action = focus-workspace 9; - "Mod+0".action = focus-workspace 10; - - "Mod+Shift+1".action.move-column-to-workspace = 1; - "Mod+Shift+2".action.move-column-to-workspace = 2; - "Mod+Shift+3".action.move-column-to-workspace = 3; - "Mod+Shift+4".action.move-column-to-workspace = 4; - "Mod+Shift+5".action.move-column-to-workspace = 5; - "Mod+Shift+6".action.move-column-to-workspace = 6; - "Mod+Shift+7".action.move-column-to-workspace = 7; - "Mod+Shift+8".action.move-column-to-workspace = 8; - "Mod+Shift+9".action.move-column-to-workspace = 9; - "Mod+Shift+0".action.move-column-to-workspace = 10; - - "Mod+Left".action = focus-column-left; - "Mod+Right".action = focus-column-right; - "Mod+Up".action = focus-workspace-up; - "Mod+Down".action = focus-workspace-down; - "Mod+Shift+Left".action = move-column-left; - "Mod+Shift+Right".action = move-column-right; - "Mod+Shift+Up".action = move-column-to-workspace-up; - "Mod+Shift+Down".action = move-column-to-workspace-down; - "Mod+Ctrl+Left".action = focus-monitor-left; - "Mod+Ctrl+Right".action = focus-monitor-right; - "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; - "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; + screenshot-annotate = sh ''${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp} -w 0)" -t ppm - | ${lib.getExe pkgs.satty} --early-exit --copy-command 'wl-copy' --filename '-' --initial-tool brush''; + in { + "Mod+E".action = sh "emacsclient -c"; + "Mod+Shift+C".action = sh "dolphin"; + "Mod+C".action = emacs ''(dirvish \"${homedir}\")''; + "Mod+T".action = spawn "kitty"; + "Mod+D".action = spawn "fuzzel"; + "Mod+B".action = spawn "librewolf"; + "Mod+H".action = show-hotkey-overlay; + "Mod+F".action = fullscreen-window; + "Mod+R".action = switch-preset-column-width; + "Mod+Q".action = close-window; + "Mod+Shift+S".action = screenshot-annotate; + "Mod+1".action = focus-workspace 1; + "Mod+2".action = focus-workspace 2; + "Mod+3".action = focus-workspace 3; + "Mod+4".action = focus-workspace 4; + "Mod+5".action = focus-workspace 5; + "Mod+6".action = focus-workspace 6; + "Mod+7".action = focus-workspace 7; + "Mod+8".action = focus-workspace 8; + "Mod+9".action = focus-workspace 9; + "Mod+0".action = focus-workspace 10; + "Mod+Shift+1".action.move-column-to-workspace = 1; + "Mod+Shift+2".action.move-column-to-workspace = 2; + "Mod+Shift+3".action.move-column-to-workspace = 3; + "Mod+Shift+4".action.move-column-to-workspace = 4; + "Mod+Shift+5".action.move-column-to-workspace = 5; + "Mod+Shift+6".action.move-column-to-workspace = 6; + "Mod+Shift+7".action.move-column-to-workspace = 7; + "Mod+Shift+8".action.move-column-to-workspace = 8; + "Mod+Shift+9".action.move-column-to-workspace = 9; + "Mod+Shift+0".action.move-column-to-workspace = 10; - "XF86AudioRaiseVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; + "Mod+Left".action = focus-column-left; + "Mod+Right".action = focus-column-right; + "Mod+Up".action = focus-workspace-up; + "Mod+Down".action = focus-workspace-down; + "Mod+Shift+Left".action = move-column-left; + "Mod+Shift+Right".action = move-column-right; + "Mod+Shift+Up".action = move-column-to-workspace-up; + "Mod+Shift+Down".action = move-column-to-workspace-down; + "Mod+Ctrl+Left".action = focus-monitor-left; + "Mod+Ctrl+Right".action = focus-monitor-right; + "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; + + "XF86AudioRaiseVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; "XF86AudioLowerVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; "XF86AudioMute".action = sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; "XF86MonBrightnessUp".action = sh "brightnessctl set 10%+"; "XF86MonBrightnessDown".action = sh "brightnessctl set 10%-"; - #"Mod+Tab".action = focus-window-down-or-column-right; + #"Mod+Tab".action = focus-window-down-or-column-right; #"Mod+Shift+Tab".action = focus-window-up-or-column-left; - "Mod+Tab".action = toggle-overview; + "Mod+Tab".action = toggle-overview; }; input = { - focus-follows-mouse = { - #enable = true; - }; - warp-mouse-to-focus.enable = true; - keyboard = { - xkb.layout = "us, ru, de"; - xkb.options = "grp:lctrl_toggle, ctrl:nocaps" + (if hwconfig.hostname == "kylekrein-mac" then ", altwin:swap_alt_win" else ""); - track-layout = "window"; - numlock = true; - }; - touchpad = { - tap = true; - #accel-profile = "adaptive"; - click-method = "clickfinger"; - }; + focus-follows-mouse = { + #enable = true; + }; + warp-mouse-to-focus.enable = true; + keyboard = { + xkb.layout = "us, ru, de"; + xkb.options = + "grp:lctrl_toggle, ctrl:nocaps" + + ( + if hwconfig.hostname == "kylekrein-mac" + then ", altwin:swap_alt_win" + else "" + ); + track-layout = "window"; + numlock = true; + }; + touchpad = { + tap = true; + #accel-profile = "adaptive"; + click-method = "clickfinger"; + }; }; cursor = { - hide-after-inactive-ms = 10000; + hide-after-inactive-ms = 10000; }; gestures.hot-corners.enable = true; prefer-no-csd = true; @@ -196,68 +209,77 @@ XDG_SESSION_TYPE = "wayland"; __GL_GSYNC_ALLOWED = "1"; QT_QPA_PLATFORM = "wayland"; - DISPLAY = ":0"; + DISPLAY = ":0"; }; window-rules = [ - { #active - matches = [ + { + #active + matches = [ { - is-active = true; - } - ]; - opacity = 1.0; - } - { #inactive - matches = [ + is-active = true; + } + ]; + opacity = 1.0; + } + { + #inactive + matches = [ { - is-active = false; - } - ]; - opacity = 1.0; - } - { #opaque - matches = [ + is-active = false; + } + ]; + opacity = 1.0; + } + { + #opaque + matches = [ { - app-id = "emacs"; - } - { - app-id = "blender"; - } - ]; - opacity = 1.0; - } - { #app-launcher - matches = [ + app-id = "emacs"; + } { - title = "emacs-run-launcher"; - } - ]; - open-floating = true; - open-focused = true; - } - { #PiP - matches = [ + app-id = "blender"; + } + ]; + opacity = 1.0; + } + { + #app-launcher + matches = [ { - title = "Picture-in-Picture"; - } - ]; - open-floating = true; - open-focused = false; - opacity = 1.0; - default-floating-position = { x = 0; y = 0; relative-to = "top-right"; }; - } + title = "emacs-run-launcher"; + } + ]; + open-floating = true; + open-focused = true; + } + { + #PiP + matches = [ + { + title = "Picture-in-Picture"; + } + ]; + open-floating = true; + open-focused = false; + opacity = 1.0; + default-floating-position = { + x = 0; + y = 0; + relative-to = "top-right"; + }; + } ]; debug = lib.mkIf (hwconfig.hostname == "kylekrein-mac") { - render-drm-device = "/dev/dri/renderD128"; + render-drm-device = "/dev/dri/renderD128"; }; xwayland-satellite = { - enable = true; - path = "${lib.getExe pkgs.xwayland-satellite-unstable}"; + enable = true; + path = "${lib.getExe pkgs.xwayland-satellite-unstable}"; }; }; }; - services.hypridle = let + services.hypridle = let niri = lib.getExe config.programs.niri.package; loginctl = "${pkgs.systemd}/bin/loginctl"; pidof = "${pkgs.procps}/bin/pidof"; @@ -265,43 +287,44 @@ systemctl = "${pkgs.systemd}/bin/systemctl"; #locking-script = "${pkgs.swaylock}/bin/swaylock --daemonize"; #unlocking-script = "pkill -SIGUSR1 swaylock"; - suspendScript = cmd: pkgs.writeShellScript "suspend-script" '' - # check if any player has status "Playing" - ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q - # only suspend if nothing is playing - if [ $? == 1 ]; then - ${cmd} - fi - ''; -in{ + suspendScript = cmd: + pkgs.writeShellScript "suspend-script" '' + # check if any player has status "Playing" + ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q + # only suspend if nothing is playing + if [ $? == 1 ]; then + ${cmd} + fi + ''; + in { enable = true; settings.general = { before_sleep_cmd = "${pidof} hyprlock || ${loginctl} lock-session;#${niri} msg action power-off-monitors"; after_sleep_cmd = "#${niri} msg action power-on-monitors"; lock_cmd = "${locking-script}"; }; - settings.listener = let - secondary = "${systemctl} suspend"; - in lib.mkIf (hwconfig.isLaptop) [ - #{ - # timeout = 30; - # command = "pidof hyprlock && ${secondary}"; - #} - { - timeout = 870; - on-timeout = "${suspendScript ''${pkgs.libnotify}/bin/notify-send "You are idle. Going to sleep in 30 seconds"''}"; - } - { - timeout = 900; - on-timeout = "${suspendScript "${systemctl} suspend"}"; - } - ]; + settings.listener = let + secondary = "${systemctl} suspend"; + in + lib.mkIf (hwconfig.isLaptop) [ + #{ + # timeout = 30; + # command = "pidof hyprlock && ${secondary}"; + #} + { + timeout = 870; + on-timeout = "${suspendScript ''${pkgs.libnotify}/bin/notify-send "You are idle. Going to sleep in 30 seconds"''}"; + } + { + timeout = 900; + on-timeout = "${suspendScript "${systemctl} suspend"}"; + } + ]; }; services = { mako = { enable = false; settings = { - }; }; }; diff --git a/nixos/homes/kylekrein/waybar/default.nix b/nixos/homes/kylekrein/waybar/default.nix index 4933982..1b22c2b 100644 --- a/nixos/homes/kylekrein/waybar/default.nix +++ b/nixos/homes/kylekrein/waybar/default.nix @@ -1,67 +1,76 @@ -{ pkgs, lib, hwconfig, ... }: -let -battery = (import ../battery-status.nix {inherit pkgs; inherit hwconfig;}); -in { + pkgs, + lib, + hwconfig, + ... +}: let + battery = import ../battery-status.nix { + inherit pkgs; + inherit hwconfig; + }; +in { programs.waybar = { enable = true; systemd.enable = true; #window#waybar { - # background: transparent; - #border-bottom: none; - #} - #${builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css"} - style = '' -${builtins.readFile ./waybarstyle.css}''; - settings = [{ + # background: transparent; + #border-bottom: none; + #} + #${builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css"} + style = '' + ${builtins.readFile ./waybarstyle.css}''; + settings = [ + { height = 36; layer = "top"; position = "top"; - tray = { spacing = 3; }; - modules-center = [ - #"hyprland/window" - "clock" - ]; - modules-left = [ - "custom/drawer" - "wlr/taskbar" - "niri/workspaces" - "niri/window" + tray = {spacing = 3;}; + modules-center = [ + #"hyprland/window" + "clock" ]; - modules-right = lib.optional hwconfig.isLaptop "backlight" - ++ [ - "pulseaudio" - #"network" - #"cpu" - "memory" - #"temperature" - "niri/language" - ] ++ lib.optional battery.available "custom/battery" - ++ [ - "tray" - "custom/notification" - #"custom/disablehypridle" - "custom/power" + modules-left = [ + "custom/drawer" + "wlr/taskbar" + "niri/workspaces" + "niri/window" ]; + modules-right = + lib.optional hwconfig.isLaptop "backlight" + ++ [ + "pulseaudio" + #"network" + #"cpu" + "memory" + #"temperature" + "niri/language" + ] + ++ lib.optional battery.available "custom/battery" + ++ [ + "tray" + "custom/notification" + #"custom/disablehypridle" + "custom/power" + ]; battery = { format = " {time} {icon} "; format-alt = " {capacity}% {icon} "; format-charging = " {capacity}%  "; - format-icons = [ "" "" "" "" "" ]; + format-icons = ["" "" "" "" ""]; format-plugged = " {capacity}%  "; states = { critical = 10; warning = 20; }; }; - backlight = { - format = "{percent}% 󰛩"; - on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; - on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; - }; + backlight = { + format = "{percent}% 󰛩"; + on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; + on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; + }; "custom/battery" = { - exec ="${pkgs.writeShellScriptBin "battery-widget" '' + exec = "${pkgs.writeShellScriptBin "battery-widget" '' ${battery.labelAdaptive} ${battery.labelPercent} ''}/bin/battery-widget"; @@ -69,7 +78,7 @@ ${builtins.readFile ./waybarstyle.css}''; tooltip = true; }; clock = { - format = "{:%a %d | %H:%M}"; + format = "{:%a %d | %H:%M}"; format-alt = "{:%d.%m.%Y}"; tooltip-format = "{:%d.%m.%Y | %H:%M}"; }; @@ -77,30 +86,30 @@ ${builtins.readFile ./waybarstyle.css}''; format = "{usage}% "; tooltip = false; }; - "custom/drawer" = { - format = "󱄅"; - tooltip = false; - on-click = ''nwg-drawer -fm "dolphin" -closebtn "right" -nocats -term "kitty" -ovl -wm "niri" -s "${./drawerstyle.css}" ''; - }; - "niri/language" = { - format = "{}"; - format-en = "EN"; - format-ru = "RU"; - format-de = "DE"; - on-click = "niri msg action switch-layout next"; - on-click-right = "niri msg action switch-layout prev"; + "custom/drawer" = { + format = "󱄅"; + tooltip = false; + on-click = ''nwg-drawer -fm "dolphin" -closebtn "right" -nocats -term "kitty" -ovl -wm "niri" -s "${./drawerstyle.css}" ''; + }; + "niri/language" = { + format = "{}"; + format-en = "EN"; + format-ru = "RU"; + format-de = "DE"; + on-click = "niri msg action switch-layout next"; + on-click-right = "niri msg action switch-layout prev"; + }; + "wlr/taskbar" = { + format = "{icon}"; + icon-size = 18; + tooltip-format = "{title}"; + on-click = "activate"; + on-click-middle = "close"; + }; + memory = { + interval = 1; + format = " {used}/{total}Gb"; }; - "wlr/taskbar" = { - format = "{icon}"; - icon-size = 18; - tooltip-format = "{title}"; - on-click = "activate"; - on-click-middle = "close"; - }; - memory = { - interval = 1; - format = " {used}/{total}Gb"; - }; network = { interval = 1; format-alt = "{ifname}: {ipaddr}/{cidr}"; @@ -117,7 +126,7 @@ ${builtins.readFile ./waybarstyle.css}''; format-bluetooth-muted = "  {format_source}"; format-icons = { car = ""; - default = [ " " " " " " ]; + default = [" " " " " "]; handsfree = ""; headphones = ""; headset = ""; @@ -129,49 +138,49 @@ ${builtins.readFile ./waybarstyle.css}''; format-source-muted = "  "; on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol"; }; - "hyprland/submap" = { format = ''{}''; }; + "hyprland/submap" = {format = ''{}'';}; temperature = { critical-threshold = 80; format = "{temperatureC}°C {icon}"; - format-icons = [ "" "" "" ]; + format-icons = ["" "" ""]; }; "hyprland/workspaces" = { - disable-scroll = true; - all-outputs = false; - warp-on-scroll = true; - format = "{name}{icon} "; - format-icons = { - urgent = ""; - active = ""; - default = ""; - }; - #persistent-workspaces = { - # "*" = 3; - #}; + disable-scroll = true; + all-outputs = false; + warp-on-scroll = true; + format = "{name}{icon} "; + format-icons = { + urgent = ""; + active = ""; + default = ""; + }; + #persistent-workspaces = { + # "*" = 3; + #}; }; "custom/power" = { - format = "⏻"; - tooltip = false; - on-click = "wlogout"; + format = "⏻"; + tooltip = false; + on-click = "wlogout"; }; "custom/notification" = { - tooltip = false; - format = "{icon}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "sleep 0.1 && swaync-client -t -sw"; - on-click-right = "sleep 0.1 && swaync-client -d -sw"; - escape = true; + tooltip = false; + format = "{icon}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "sleep 0.1 && swaync-client -t -sw"; + on-click-right = "sleep 0.1 && swaync-client -d -sw"; + escape = true; }; "custom/disablehypridle" = { @@ -191,6 +200,7 @@ ${builtins.readFile ./waybarstyle.css}''; fi ''; }; - }]; + } + ]; }; } diff --git a/nixos/hosts/andrej-pc/configuration.nix b/nixos/hosts/andrej-pc/configuration.nix index 2e37cab..7cb4585 100644 --- a/nixos/hosts/andrej-pc/configuration.nix +++ b/nixos/hosts/andrej-pc/configuration.nix @@ -10,27 +10,28 @@ inputs, unstable-pkgs, ... -}: -{ +}: { programs.firefox.policies.Preferences."browser.startup.page" = lib.mkForce 1; - imports = [ - inputs.sops-nix.nixosModules.sops - inputs.stylix.nixosModules.stylix - inputs.nixos-facter-modules.nixosModules.facter - inputs.home-manager.nixosModules.default - inputs.disko.nixosModules.default + imports = + [ + inputs.sops-nix.nixosModules.sops + inputs.stylix.nixosModules.stylix + inputs.nixos-facter-modules.nixosModules.facter + inputs.home-manager.nixosModules.default + inputs.disko.nixosModules.default - ../../modules/firefox - #../../modules/flatpak - ../../modules/steam - ../../modules/ly - ../../modules/sddm - ../../modules/services/autoupgrade - ../../modules/sops - #../../modules/emacs - ./default.nix - ] ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; + ../../modules/firefox + #../../modules/flatpak + ../../modules/steam + ../../modules/ly + ../../modules/sddm + ../../modules/services/autoupgrade + ../../modules/sops + #../../modules/emacs + ./default.nix + ] + ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; facter.reportPath = ./facter.json; kylekrein.services.autoUpgrade = { enable = true; @@ -39,7 +40,6 @@ user = "root"; }; - boot = { kernelPackages = lib.mkDefault pkgs.linuxPackages_6_14; loader = { @@ -62,11 +62,10 @@ #flatpak kk.services.flatpak.enable = true; services.flatpak.packages = [ - ]; services.pipewire = { - extraLv2Packages = [ pkgs.rnnoise-plugin ]; + extraLv2Packages = [pkgs.rnnoise-plugin]; configPackages = [ (pkgs.writeTextDir "share/pipewire/pipewire.conf.d/20-rnnoise.conf" '' context.modules = [ @@ -190,7 +189,8 @@ clean.extraArgs = "--keep-since 4d --keep 3"; flake = "/etc/nixos-config"; }; - fonts.packages = with unstable-pkgs; [ #TODO change to pkgs when 25.05 comes out + fonts.packages = with unstable-pkgs; [ + #TODO change to pkgs when 25.05 comes out nerd-fonts.jetbrains-mono font-awesome nerd-fonts.symbols-only @@ -209,7 +209,7 @@ enable = true; }; logitech.wireless.enable = true; - bluetooth = { + bluetooth = { enable = true; powerOnBoot = true; settings = { @@ -222,110 +222,110 @@ services.blueman.enable = true; security.polkit.enable = true; - security.rtkit.enable = true; - services.pipewire = { + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + stylix = { + enable = false; + image = "${../../modules/hyprland/wallpaper.jpg}"; + autoEnable = true; + opacity = { + desktop = 0.0; #0.5; + }; + targets = { + gtk.enable = true; + plymouth = { enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; + #logo = ./fastfetch/nixos.png; + logoAnimated = false; }; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - }; - stylix = { - enable = false; - image = "${../../modules/hyprland/wallpaper.jpg}"; - autoEnable = true; - opacity = { - desktop = 0.0;#0.5; - }; - targets = { - gtk.enable = true; - plymouth = { - enable = true; - #logo = ./fastfetch/nixos.png; - logoAnimated = false; - }; - }; - fonts = { - sizes = { - applications = 14; - desktop = 12; - popups = 12; - terminal = 16; - }; - }; - polarity = "dark"; - base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + }; + fonts = { + sizes = { + applications = 14; + desktop = 12; + popups = 12; + terminal = 16; }; + }; + polarity = "dark"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + }; - programs.bash = { - shellAliases = { - ls = "${pkgs.eza}/bin/eza --icons=always"; - }; - }; + programs.bash = { + shellAliases = { + ls = "${pkgs.eza}/bin/eza --icons=always"; + }; + }; - #services.flatpak.enable = true; - #services.flatpak.packages = [ - # "flathub:app/org.kde.dolphin//stable" - # ]; + #services.flatpak.enable = true; + #services.flatpak.packages = [ + # "flathub:app/org.kde.dolphin//stable" + # ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; - kk.steam.enable = true; + kk.steam.enable = true; - # List services that you want to enable: + # List services that you want to enable: - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - # require public key authentication for better security - settings.PasswordAuthentication = false; - settings.KbdInteractiveAuthentication = false; - settings.PermitRootLogin = "no"; - #extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; - }; + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + # require public key authentication for better security + settings.PasswordAuthentication = false; + settings.KbdInteractiveAuthentication = false; + settings.PermitRootLogin = "no"; + #extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; + }; - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 22 25565 ]; - networking.firewall.allowedUDPPorts = [ 22 25565 ]; - # Or disable the firewall altogether. - #networking.firewall.enable = false; + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [22 25565]; + networking.firewall.allowedUDPPorts = [22 25565]; + # Or disable the firewall altogether. + #networking.firewall.enable = false; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.11"; # Did you read the comment? + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; # Did you read the comment? - nix = { - settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - auto-optimise-store = true; - substituters = [ - "https://hyprland.cachix.org" - "https://nix-gaming.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - }; + nix = { + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + substituters = [ + "https://hyprland.cachix.org" + "https://nix-gaming.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + }; } diff --git a/nixos/hosts/android/default.nix b/nixos/hosts/android/default.nix index 6e9f16f..be35f0b 100644 --- a/nixos/hosts/android/default.nix +++ b/nixos/hosts/android/default.nix @@ -5,20 +5,19 @@ }: { imports = [ ]; - environment.packages = with pkgs; - [ - neovim - git - fastfetch - asciiquarium - cmatrix - #inputs.neovim.packages.aarch64-linux.default + environment.packages = with pkgs; [ + neovim + git + fastfetch + asciiquarium + cmatrix + #inputs.neovim.packages.aarch64-linux.default - (pkgs.writeShellScriptBin "droid-switch" '' - nix-on-droid switch --flake /data/data/com.termux.nix/files/home/nixos-config - '') - inputs.emacs-kylekrein.packages.aarch64-linux.default - ]; + (pkgs.writeShellScriptBin "droid-switch" '' + nix-on-droid switch --flake /data/data/com.termux.nix/files/home/nixos-config + '') + inputs.emacs-kylekrein.packages.aarch64-linux.default + ]; home-manager = { config = ./home.nix; useGlobalPkgs = true; diff --git a/nixos/hosts/android/home.nix b/nixos/hosts/android/home.nix index 7107ff3..b79b483 100644 --- a/nixos/hosts/android/home.nix +++ b/nixos/hosts/android/home.nix @@ -1,17 +1,22 @@ -{ pkgs, config, lib, ... }: { - imports = [ -#../../modules/nixvim - ../../homes/kylekrein/git.nix - ]; - home.activation = { - copyFont = let - font_src = "${pkgs.nerd-fonts.fira-code}/share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf"; - font_dst = "${config.home.homeDirectory}/.termux/font.ttf"; - in lib.hm.dag.entryAfter ["writeBoundary"] '' - ( test ! -e "${font_dst}" || test $(sha1sum "${font_src}"|cut -d' ' -f1 ) != $(sha1sum "${font_dst}" |cut -d' ' -f1)) && $DRY_RUN_CMD install $VERBOSE_ARG -D "${font_src}" "${font_dst}" - ''; - }; + pkgs, + config, + lib, + ... +}: { + imports = [ + #../../modules/nixvim + ../../homes/kylekrein/git.nix + ]; + home.activation = { + copyFont = let + font_src = "${pkgs.nerd-fonts.fira-code}/share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf"; + font_dst = "${config.home.homeDirectory}/.termux/font.ttf"; + in + lib.hm.dag.entryAfter ["writeBoundary"] '' + ( test ! -e "${font_dst}" || test $(sha1sum "${font_src}"|cut -d' ' -f1 ) != $(sha1sum "${font_dst}" |cut -d' ' -f1)) && $DRY_RUN_CMD install $VERBOSE_ARG -D "${font_src}" "${font_dst}" + ''; + }; - home.stateVersion = "24.05"; + home.stateVersion = "24.05"; } diff --git a/nixos/hosts/kylekrein-framework12/default.nix b/nixos/hosts/kylekrein-framework12/default.nix index 78db5a1..44bda75 100644 --- a/nixos/hosts/kylekrein-framework12/default.nix +++ b/nixos/hosts/kylekrein-framework12/default.nix @@ -28,8 +28,8 @@ (self: super: { prismlauncher = pkgs.symlinkJoin { name = "prismlauncher"; - paths = [ super.prismlauncher]; - buildInputs = [ pkgs.makeWrapper ]; + paths = [super.prismlauncher]; + buildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/prismlauncher --set HOME /persist/home/kylekrein ''; @@ -38,8 +38,8 @@ (self: super: { bottles = pkgs.symlinkJoin { name = "bottles"; - paths = [ super.bottles]; - buildInputs = [ pkgs.makeWrapper ]; + paths = [super.bottles]; + buildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/bottles --set HOME /persist/home/kylekrein ''; @@ -50,7 +50,7 @@ blender ladybird prismlauncher - + #inputs.nix-gaming.packages.${pkgs.system}.star-citizen ]; @@ -68,14 +68,14 @@ #LLMs services.ollama = { enable = true; - loadModels = [ "qwq" "llama3.1" "qwen2.5-coder:7b" ]; + loadModels = ["qwq" "llama3.1" "qwen2.5-coder:7b"]; acceleration = "cuda"; home = "/persist/ollama"; user = "ollama"; group = "ollama"; }; - boot.binfmt.emulatedSystems = [ "aarch64-linux" "riscv64-linux" ]; + boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"]; services.open-webui.enable = true; #services.open-webui.package = unstable-pkgs.open-webui; @@ -87,7 +87,7 @@ systemd.services.open-webui.serviceConfig.DynamicUser = lib.mkForce false; #Chat host - networking.firewall.allowedTCPPorts = [ 80 443 22 8448 9993 8081] ++ [ config.services.zerotierone.port ]; + networking.firewall.allowedTCPPorts = [80 443 22 8448 9993 8081] ++ [config.services.zerotierone.port]; networking.firewall.allowedUDPPorts = [config.services.zerotierone.port]; systemd.network.wait-online.enable = lib.mkForce false; diff --git a/nixos/hosts/kylekrein-homepc/default.nix b/nixos/hosts/kylekrein-homepc/default.nix index 463bf20..46dc8a0 100644 --- a/nixos/hosts/kylekrein-homepc/default.nix +++ b/nixos/hosts/kylekrein-homepc/default.nix @@ -26,8 +26,8 @@ (self: super: { prismlauncher = pkgs.symlinkJoin { name = "prismlauncher"; - paths = [ super.prismlauncher]; - buildInputs = [ pkgs.makeWrapper ]; + paths = [super.prismlauncher]; + buildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/prismlauncher --set HOME /persist/home/kylekrein ''; @@ -36,8 +36,8 @@ (self: super: { bottles = pkgs.symlinkJoin { name = "bottles"; - paths = [ super.bottles]; - buildInputs = [ pkgs.makeWrapper ]; + paths = [super.bottles]; + buildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/bottles --set HOME /persist/home/kylekrein ''; @@ -48,7 +48,7 @@ blender ladybird prismlauncher - + #inputs.nix-gaming.packages.${pkgs.system}.star-citizen ]; @@ -66,14 +66,14 @@ #LLMs services.ollama = { enable = true; - loadModels = [ "qwq" "llama3.1" "qwen2.5-coder:7b" ]; + loadModels = ["qwq" "llama3.1" "qwen2.5-coder:7b"]; acceleration = "cuda"; home = "/persist/ollama"; user = "ollama"; group = "ollama"; }; - boot.binfmt.emulatedSystems = [ "aarch64-linux" "riscv64-linux" ]; + boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"]; services.open-webui.enable = true; #services.open-webui.package = unstable-pkgs.open-webui; @@ -85,9 +85,9 @@ systemd.services.open-webui.serviceConfig.DynamicUser = lib.mkForce false; #Chat host - networking.firewall.allowedTCPPorts = [ 80 443 22 8448 9993 8081] ++ [ config.services.zerotierone.port ]; + networking.firewall.allowedTCPPorts = [80 443 22 8448 9993 8081] ++ [config.services.zerotierone.port]; networking.firewall.allowedUDPPorts = [config.services.zerotierone.port]; -# users.users.nginx.extraGroups = [ "acme" ]; + # users.users.nginx.extraGroups = [ "acme" ]; services.hypridle.enable = lib.mkForce false; programs.hyprlock.enable = lib.mkForce false; @@ -106,14 +106,17 @@ #forceSSL = true; #useACMEHost = "kylekrein.com"; #acmeRoot = "/var/lib/acme/challenges-kylekrein"; - }; in { - "chat.kylekrein.com" = (SSL // { + }; + in { + "chat.kylekrein.com" = + SSL + // { locations."/" = { proxyPass = "http://localhost:8080/"; proxyWebsockets = true; }; - }); - }; + }; + }; systemd.network.wait-online.enable = lib.mkForce false; } diff --git a/nixos/hosts/kylekrein-homepc/homepc-hardware-conf.nix b/nixos/hosts/kylekrein-homepc/homepc-hardware-conf.nix index 8fb7993..22f44ad 100644 --- a/nixos/hosts/kylekrein-homepc/homepc-hardware-conf.nix +++ b/nixos/hosts/kylekrein-homepc/homepc-hardware-conf.nix @@ -1,17 +1,21 @@ # 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, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; # 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/nixos/hosts/kylekrein-mac/default.nix b/nixos/hosts/kylekrein-mac/default.nix index 6c34e44..9024d9e 100644 --- a/nixos/hosts/kylekrein-mac/default.nix +++ b/nixos/hosts/kylekrein-mac/default.nix @@ -18,25 +18,25 @@ ]; sops.secrets."ssh_keys/${hwconfig.hostname}" = {}; facter.reportPath = lib.mkForce null; #fails to generate - boot.binfmt.emulatedSystems = [ "x86_64-linux" ]; + boot.binfmt.emulatedSystems = ["x86_64-linux"]; nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; - + services.displayManager.sddm = { - wayland.enable = lib.mkForce false; # black screen - }; - environment.systemPackages = with pkgs;[ + wayland.enable = lib.mkForce false; # black screen + }; + environment.systemPackages = with pkgs; [ prismlauncher unstable-pkgs.mcpelauncher-ui-qt ]; services.ollama = { enable = true; - loadModels = [ "llama3.1" "qwen2.5-coder:7b" ]; + loadModels = ["llama3.1" "qwen2.5-coder:7b"]; home = "/persist/ollama"; user = "ollama"; group = "ollama"; }; - boot = { + boot = { kernelParams = [ "zswap.enabled=1" "zswap.compressor=lzo" diff --git a/nixos/hosts/kylekrein-mac/mac-hardware-conf.nix b/nixos/hosts/kylekrein-mac/mac-hardware-conf.nix index 4342e83..b99a538 100644 --- a/nixos/hosts/kylekrein-mac/mac-hardware-conf.nix +++ b/nixos/hosts/kylekrein-mac/mac-hardware-conf.nix @@ -1,49 +1,53 @@ # 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, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "usb_storage" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["usb_storage"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; fileSystems."/" = { device = "tmpfs"; fsType = "tmpfs"; - options = [ "defaults" "size=8G" "mode=755" ]; + options = ["defaults" "size=8G" "mode=755"]; + }; + fileSystems."/persist" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + depends = ["/"]; + neededForBoot = true; }; - fileSystems."/persist" = - { device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - depends = [ "/" ]; - neededForBoot = true; - }; fileSystems."/nix" = { device = "/persist/nix"; - options = [ "bind" ]; - depends = [ "/persist" ]; + options = ["bind"]; + depends = ["/persist"]; }; fileSystems."/tmp" = { device = "/persist/tmp"; - options = [ "bind" ]; - depends = [ "/persist" ]; + options = ["bind"]; + depends = ["/persist"]; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/EFI\\x20-\\x20NIXOS"; + fsType = "vfat"; + #options = [ "fmask=0022" "dmask=0022" ]; }; - fileSystems."/boot" = - { device = "/dev/disk/by-label/EFI\\x20-\\x20NIXOS"; - fsType = "vfat"; - #options = [ "fmask=0022" "dmask=0022" ]; - }; - swapDevices = [ + swapDevices = [ { device = "/persist/swapfile"; - size = 16*1024; + size = 16 * 1024; } ]; diff --git a/nixos/hosts/kylekrein-server/conduwuit.nix b/nixos/hosts/kylekrein-server/conduwuit.nix index 5858d50..4391546 100644 --- a/nixos/hosts/kylekrein-server/conduwuit.nix +++ b/nixos/hosts/kylekrein-server/conduwuit.nix @@ -3,17 +3,15 @@ lib, pkgs, ... -}: -let +}: let cfg = config.kk.services.conduwuit; defaultUser = "conduwuit"; defaultGroup = "conduwuit"; - format = pkgs.formats.toml { }; + format = pkgs.formats.toml {}; configFile = format.generate "conduwuit.toml" cfg.settings; -in -{ - meta.maintainers = with lib.maintainers; [ niklaskorz ]; +in { + meta.maintainers = with lib.maintainers; [niklaskorz]; options.kk.services.conduwuit = { enable = lib.mkEnableOption "conduwuit"; @@ -36,13 +34,13 @@ in extraEnvironment = lib.mkOption { type = lib.types.attrsOf lib.types.str; description = "Extra Environment variables to pass to the conduwuit server."; - default = { }; + default = {}; example = { RUST_BACKTRACE = "yes"; }; }; - package = lib.mkPackageOption pkgs "conduwuit" { }; + package = lib.mkPackageOption pkgs "conduwuit" {}; settings = lib.mkOption { type = lib.types.submodule { @@ -68,7 +66,7 @@ in }; global.port = lib.mkOption { type = lib.types.listOf lib.types.port; - default = [ 6167 ]; + default = [6167]; description = '' The port(s) conduwuit will be running on. You need to set up a reverse proxy in your web server (e.g. apache or nginx), @@ -127,7 +125,7 @@ in }; global.trusted_servers = lib.mkOption { type = lib.types.listOf lib.types.nonEmptyStr; - default = [ "matrix.org" ]; + default = ["matrix.org"]; description = '' Servers listed here will be used to gather public keys of other servers (notary trusted key servers). @@ -147,14 +145,14 @@ in Note that database_path cannot be edited because of the service's reliance on systemd StateDir. ''; }; - global.database_backup_path = lib.mkOption { + global.database_backup_path = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; description = '' Path to the conduwuit database, the directory where conduwuit will backup its data. ''; }; - global.database_backups_to_keep = lib.mkOption { + global.database_backups_to_keep = lib.mkOption { type = lib.types.ints.positive; default = 1; description = ""; @@ -170,103 +168,103 @@ in Disabled by default. ''; }; - global.allow_local_presence = lib.mkOption { + global.allow_local_presence = lib.mkOption { type = lib.types.bool; default = true; description = '' ''; }; - global.allow_incoming_presence = lib.mkOption { + global.allow_incoming_presence = lib.mkOption { type = lib.types.bool; default = true; description = '' ''; }; - global.allow_outgoing_presence = lib.mkOption { + global.allow_outgoing_presence = lib.mkOption { type = lib.types.bool; default = false; description = '' ''; }; - global.require_auth_for_profile_requests = lib.mkOption { + global.require_auth_for_profile_requests = lib.mkOption { type = lib.types.bool; default = false; description = '' ''; }; - global.new_user_displayname_suffix = lib.mkOption { + global.new_user_displayname_suffix = lib.mkOption { type = lib.types.str; default = "🏳️‍⚧️"; description = '' ''; }; - global.registration_token = lib.mkOption { + global.registration_token = lib.mkOption { type = lib.types.str; default = ""; description = '' ''; }; - global.registration_token_file = lib.mkOption { + global.registration_token_file = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; description = '' ''; }; - global.allow_public_room_directory_over_federation = lib.mkOption { + global.allow_public_room_directory_over_federation = lib.mkOption { type = lib.types.bool; default = false; description = '' ''; }; - global.allow_public_room_directory_without_auth = lib.mkOption { + global.allow_public_room_directory_without_auth = lib.mkOption { type = lib.types.bool; default = false; description = '' ''; }; - global.allow_device_name_federation = lib.mkOption { + global.allow_device_name_federation = lib.mkOption { type = lib.types.bool; default = false; description = '' ''; }; - global.allow_inbound_profile_lookup_federation_requests = lib.mkOption { + global.allow_inbound_profile_lookup_federation_requests = lib.mkOption { type = lib.types.bool; default = true; description = '' ''; }; - global.turn_secret = lib.mkOption { + global.turn_secret = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = '' ''; }; - global.turn_uris = lib.mkOption { + global.turn_uris = lib.mkOption { type = lib.types.listOf lib.types.nonEmptyStr; default = []; description = '' ''; }; - global.turn_secret_file = lib.mkOption { + global.turn_secret_file = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; description = '' ''; }; - global.prevent_media_downloads_from = lib.mkOption { + global.prevent_media_downloads_from = lib.mkOption { type = lib.types.listOf lib.types.nonEmptyStr; default = []; description = '' ''; }; - global.well_known.client = lib.mkOption { + global.well_known.client = lib.mkOption { type = lib.types.str; default = ""; description = '' ''; }; - global.well_known.server = lib.mkOption { + global.well_known.server = lib.mkOption { type = lib.types.str; default = ""; description = '' @@ -274,7 +272,7 @@ in }; }; }; - default = { }; + default = {}; # TOML does not allow null values, so we use null to omit those fields apply = lib.filterAttrsRecursive (_: v: v != null); description = '' @@ -314,19 +312,19 @@ in }; users.groups = lib.mkIf (cfg.group == defaultGroup) { - ${defaultGroup} = { }; + ${defaultGroup} = {}; }; systemd.services.conduwuit = { description = "Conduwuit Matrix Server"; - documentation = [ "https://conduwuit.puppyirl.gay/" ]; - wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; - environment = lib.mkMerge ([ - { CONDUWUIT_CONFIG = configFile; } + documentation = ["https://conduwuit.puppyirl.gay/"]; + wantedBy = ["multi-user.target"]; + wants = ["network-online.target"]; + after = ["network-online.target"]; + environment = lib.mkMerge [ + {CONDUWUIT_CONFIG = configFile;} cfg.extraEnvironment - ]); + ]; startLimitBurst = 5; startLimitIntervalSec = 60; serviceConfig = { diff --git a/nixos/hosts/kylekrein-server/default.nix b/nixos/hosts/kylekrein-server/default.nix index 6564231..665ef58 100644 --- a/nixos/hosts/kylekrein-server/default.nix +++ b/nixos/hosts/kylekrein-server/default.nix @@ -8,7 +8,7 @@ ... }: { imports = [ - inputs.sops-nix.nixosModules.sops + inputs.sops-nix.nixosModules.sops inputs.stylix.nixosModules.stylix inputs.nixos-facter-modules.nixosModules.facter inputs.home-manager.nixosModules.default @@ -21,177 +21,176 @@ ./hardware.nix ./networking.nix ]; -#options.services.conduwuit.settings.global.database_path = lib.mkOption { apply = old: "/persist/conduwuit/";}; -config = { - home-manager.users = lib.mkForce {}; - stylix.image = ../../modules/hyprland/wallpaper.jpg; - #sops.secrets."ssh_keys/${hwconfig.hostname}" = {}; - boot.tmp.cleanOnBoot = true; - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/sda"; - networking.hostName = hwconfig.hostname; -users = { - mutableUsers = false; + #options.services.conduwuit.settings.global.database_path = lib.mkOption { apply = old: "/persist/conduwuit/";}; + config = { + home-manager.users = lib.mkForce {}; + stylix.image = ../../modules/hyprland/wallpaper.jpg; + #sops.secrets."ssh_keys/${hwconfig.hostname}" = {}; + boot.tmp.cleanOnBoot = true; + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + networking.hostName = hwconfig.hostname; users = { - root = { - # disable root login here, and also when installing nix by running nixos-install --no-root-passwd - # https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/3 - hashedPassword = "!"; # disable root logins, nothing hashes to ! + mutableUsers = false; + users = { + root = { + # disable root login here, and also when installing nix by running nixos-install --no-root-passwd + # https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/3 + hashedPassword = "!"; # disable root logins, nothing hashes to ! + }; + }; + }; + environment.systemPackages = with pkgs; [ + neovim + git + ]; + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 3"; + flake = "/etc/nixos-config"; + }; + services.openssh = { + enable = true; + # require public key authentication for better security + settings.PasswordAuthentication = false; + settings.KbdInteractiveAuthentication = false; + settings.PermitRootLogin = "no"; + #extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; + }; + + zramSwap = { + enable = true; # Hopefully? helps with freezing when using swap + }; + #Chat host + networking.firewall.allowedTCPPorts = [80 443 22 8448]; + networking.firewall.allowedUDPPorts = [3478 5349]; + #sops.secrets."services/conduwuit" = {mode = "0755";}; + + sops.secrets."services/gitlab/dbPassword" = {owner = "gitlab";}; + sops.secrets."services/gitlab/rootPassword" = {owner = "gitlab";}; + sops.secrets."services/gitlab/secret" = {owner = "gitlab";}; + sops.secrets."services/gitlab/otpsecret" = {owner = "gitlab";}; + sops.secrets."services/gitlab/dbsecret" = {owner = "gitlab";}; + sops.secrets."services/gitlab/oidcKeyBase" = {owner = "gitlab";}; + sops.secrets."services/gitlab/activeRecordSalt" = {owner = "gitlab";}; + sops.secrets."services/gitlab/activeRecordPrimaryKey" = {owner = "gitlab";}; + sops.secrets."services/gitlab/activeRecordDeterministicKey" = {owner = "gitlab";}; + services.gitlab = { + enable = true; + host = "gitlab.kylekrein.com"; + port = 443; + #statePath = "/persist/gitlab/state"; + backup.startAt = "3:00"; + databasePasswordFile = config.sops.secrets."services/gitlab/dbPassword".path; + initialRootPasswordFile = config.sops.secrets."services/gitlab/rootPassword".path; + secrets = { + secretFile = config.sops.secrets."services/gitlab/secret".path; + otpFile = config.sops.secrets."services/gitlab/otpsecret".path; + dbFile = config.sops.secrets."services/gitlab/dbsecret".path; + jwsFile = config.sops.secrets."services/gitlab/oidcKeyBase".path; #pkgs.runCommand "oidcKeyBase" {} "${pkgs.openssl}/bin/openssl genrsa 2048 > $out"; + activeRecordSaltFile = config.sops.secrets."services/gitlab/activeRecordSalt".path; + activeRecordPrimaryKeyFile = config.sops.secrets."services/gitlab/activeRecordPrimaryKey".path; + activeRecordDeterministicKeyFile = config.sops.secrets."services/gitlab/activeRecordDeterministicKey".path; + }; + }; + + systemd.services.gitlab-backup.environment.BACKUP = "dump"; + + kk.services.conduwuit = { + enable = true; + #user = "turnserver"; + settings = { + global = { + server_name = "kylekrein.com"; + well_known = { + server = "matrix.kylekrein.com:443"; + client = "https://matrix.kylekrein.com"; + }; + port = [6167]; + trusted_servers = ["matrix.org"]; + allow_registration = false; + registration_token = ""; #nix shell nixpkgs#openssl -c openssl rand -base64 48 | tr -d '/+' | cut -c1-64 + allow_federation = true; + allow_encryption = true; + + allow_local_presence = true; + require_auth_for_profile_requests = true; + }; + }; + extraEnvironment = { + }; + }; + services.caddy = { + enable = true; + #virtualHosts."kylekrein.com:8448".extraConfig = '' + # reverse_proxy http://localhost:6167 + #''; + virtualHosts."kylekrein.com".extraConfig = '' + handle_path /.well-known/matrix/* { + + header Access-Control-Allow-Origin * + + ## `Content-Type: application/json` isn't required by the matrix spec + ## but some browsers (firefox) and some other tooling might preview json + ## content prettier when they are made aware via Content-Type + header Content-Type application/json + + respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }` + + respond /server `{ "m.server": "https://matrix.kylekrein.com" }` + + ## return http/404 if nothing matches + respond 404 + } + respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}` + reverse_proxy * http://localhost:6167 + ''; + # reverse_proxy /.well-known/* http://localhost:6167 + #''; + virtualHosts."matrix.kylekrein.com".extraConfig = '' + handle_path /.well-known/matrix/* { + + header Access-Control-Allow-Origin * + + ## `Content-Type: application/json` isn't required by the matrix spec + ## but some browsers (firefox) and some other tooling might preview json + ## content prettier when they are made aware via Content-Type + header Content-Type application/json + + respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }` + + respond /server `{ "m.server": "https://matrix.kylekrein.com" }` + + ## return http/404 if nothing matches + respond 404 + } + respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}` + reverse_proxy * http://localhost:6167 + ''; + virtualHosts."gitlab.kylekrein.com".extraConfig = '' + reverse_proxy * unix//run/gitlab/gitlab-workhorse.socket + ''; + }; + system.stateVersion = "24.11"; + nix = { + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + substituters = [ + "https://hyprland.cachix.org" + "https://nix-gaming.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; }; }; }; - environment.systemPackages = with pkgs; [ - neovim - git - ]; - programs.nh = { - enable = true; - clean.enable = true; - clean.extraArgs = "--keep-since 4d --keep 3"; - flake = "/etc/nixos-config"; - }; - services.openssh = { - enable = true; - # require public key authentication for better security - settings.PasswordAuthentication = false; - settings.KbdInteractiveAuthentication = false; - settings.PermitRootLogin = "no"; - #extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; - }; - - zramSwap = { - enable = true; # Hopefully? helps with freezing when using swap - }; - #Chat host - networking.firewall.allowedTCPPorts = [ 80 443 22 8448 ]; - networking.firewall.allowedUDPPorts = [ 3478 5349 ]; - #sops.secrets."services/conduwuit" = {mode = "0755";}; - - - sops.secrets."services/gitlab/dbPassword" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/rootPassword" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/secret" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/otpsecret" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/dbsecret" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/oidcKeyBase" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/activeRecordSalt" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/activeRecordPrimaryKey" = { owner = "gitlab"; }; - sops.secrets."services/gitlab/activeRecordDeterministicKey" = { owner = "gitlab"; }; - services.gitlab = { - enable = true; - host = "gitlab.kylekrein.com"; - port = 443; - #statePath = "/persist/gitlab/state"; - backup.startAt = "3:00"; - databasePasswordFile = config.sops.secrets."services/gitlab/dbPassword".path; - initialRootPasswordFile = config.sops.secrets."services/gitlab/rootPassword".path; - secrets = { - secretFile = config.sops.secrets."services/gitlab/secret".path; - otpFile = config.sops.secrets."services/gitlab/otpsecret".path; - dbFile = config.sops.secrets."services/gitlab/dbsecret".path; - jwsFile = config.sops.secrets."services/gitlab/oidcKeyBase".path;#pkgs.runCommand "oidcKeyBase" {} "${pkgs.openssl}/bin/openssl genrsa 2048 > $out"; - activeRecordSaltFile = config.sops.secrets."services/gitlab/activeRecordSalt".path; - activeRecordPrimaryKeyFile = config.sops.secrets."services/gitlab/activeRecordPrimaryKey".path; - activeRecordDeterministicKeyFile = config.sops.secrets."services/gitlab/activeRecordDeterministicKey".path; - }; - }; - - systemd.services.gitlab-backup.environment.BACKUP = "dump"; - - kk.services.conduwuit = { - enable = true; - #user = "turnserver"; - settings = { - global = { - server_name = "kylekrein.com"; - well_known = { - server = "matrix.kylekrein.com:443"; - client = "https://matrix.kylekrein.com"; - }; - port = [ 6167 ]; - trusted_servers = [ "matrix.org" ]; - allow_registration = false; - registration_token = ""; #nix shell nixpkgs#openssl -c openssl rand -base64 48 | tr -d '/+' | cut -c1-64 - allow_federation = true; - allow_encryption = true; - - allow_local_presence = true; - require_auth_for_profile_requests = true; - }; - }; - extraEnvironment = { - }; - }; - services.caddy = { - enable = true; - #virtualHosts."kylekrein.com:8448".extraConfig = '' - # reverse_proxy http://localhost:6167 - #''; - virtualHosts."kylekrein.com".extraConfig = '' -handle_path /.well-known/matrix/* { - - header Access-Control-Allow-Origin * - - ## `Content-Type: application/json` isn't required by the matrix spec - ## but some browsers (firefox) and some other tooling might preview json - ## content prettier when they are made aware via Content-Type - header Content-Type application/json - - respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }` - - respond /server `{ "m.server": "https://matrix.kylekrein.com" }` - - ## return http/404 if nothing matches - respond 404 -} -respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}` - reverse_proxy * http://localhost:6167 - ''; - # reverse_proxy /.well-known/* http://localhost:6167 - #''; - virtualHosts."matrix.kylekrein.com".extraConfig = '' -handle_path /.well-known/matrix/* { - - header Access-Control-Allow-Origin * - - ## `Content-Type: application/json` isn't required by the matrix spec - ## but some browsers (firefox) and some other tooling might preview json - ## content prettier when they are made aware via Content-Type - header Content-Type application/json - - respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }` - - respond /server `{ "m.server": "https://matrix.kylekrein.com" }` - - ## return http/404 if nothing matches - respond 404 -} -respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}` - reverse_proxy * http://localhost:6167 - ''; - virtualHosts."gitlab.kylekrein.com".extraConfig = '' - reverse_proxy * unix//run/gitlab/gitlab-workhorse.socket - ''; -}; - system.stateVersion = "24.11"; - nix = { - settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - auto-optimise-store = true; - substituters = [ - "https://hyprland.cachix.org" - "https://nix-gaming.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - }; -}; } diff --git a/nixos/hosts/kylekrein-server/hardware.nix b/nixos/hosts/kylekrein-server/hardware.nix index 644b075..eb6daec 100644 --- a/nixos/hosts/kylekrein-server/hardware.nix +++ b/nixos/hosts/kylekrein-server/hardware.nix @@ -1,21 +1,25 @@ -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + 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/4f7e141c-0fc7-415a-815d-944b36f93806"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/4f7e141c-0fc7-415a-815d-944b36f93806"; + fsType = "ext4"; + }; - swapDevices = [ ]; + swapDevices = []; # 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/nixos/hosts/kylekrein-server/networking.nix b/nixos/hosts/kylekrein-server/networking.nix index ece31d1..28206ce 100644 --- a/nixos/hosts/kylekrein-server/networking.nix +++ b/nixos/hosts/kylekrein-server/networking.nix @@ -1,9 +1,10 @@ -{ lib, ... }: { +{lib, ...}: { # This file was populated at runtime with the networking # details gathered from the active system. networking = { - nameservers = [ "8.8.8.8" - ]; + nameservers = [ + "8.8.8.8" + ]; defaultGateway = "172.31.1.1"; defaultGateway6 = { address = ""; @@ -14,19 +15,34 @@ interfaces = { eth0 = { ipv4.addresses = [ - { address="91.99.0.169"; prefixLength=32; } + { + address = "91.99.0.169"; + prefixLength = 32; + } ]; ipv6.addresses = [ - { address="fe80::9400:4ff:fe30:830e"; prefixLength=64; } + { + address = "fe80::9400:4ff:fe30:830e"; + prefixLength = 64; + } + ]; + ipv4.routes = [ + { + address = "172.31.1.1"; + prefixLength = 32; + } + ]; + ipv6.routes = [ + { + address = ""; + prefixLength = 128; + } ]; - ipv4.routes = [ { address = "172.31.1.1"; prefixLength = 32; } ]; - ipv6.routes = [ { address = ""; prefixLength = 128; } ]; }; - }; }; services.udev.extraRules = '' ATTR{address}=="96:00:04:30:83:0e", NAME="eth0" - + ''; } diff --git a/nixos/hosts/kylekrein-wsl/default.nix b/nixos/hosts/kylekrein-wsl/default.nix index 3be0249..9dd7b14 100755 --- a/nixos/hosts/kylekrein-wsl/default.nix +++ b/nixos/hosts/kylekrein-wsl/default.nix @@ -1,12 +1,12 @@ -{ - pkgs, - lib, - hwconfig, - inputs, - config, - unstable-pkgs, - ... -}: { - imports = [ - ]; -} +{ + pkgs, + lib, + hwconfig, + inputs, + config, + unstable-pkgs, + ... +}: { + imports = [ + ]; +} diff --git a/nixos/modules/cosmic/default.nix b/nixos/modules/cosmic/default.nix index d692ea4..842260c 100644 --- a/nixos/modules/cosmic/default.nix +++ b/nixos/modules/cosmic/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ - services.desktopManager.cosmic.enable = true; -services.displayManager.cosmic-greeter.enable = true; +{...}: { + services.desktopManager.cosmic.enable = true; + services.displayManager.cosmic-greeter.enable = true; } diff --git a/nixos/modules/direnv/default.nix b/nixos/modules/direnv/default.nix index 20fd92c..d6d8cef 100644 --- a/nixos/modules/direnv/default.nix +++ b/nixos/modules/direnv/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ...}: -{ +{pkgs, ...}: { programs.direnv = { enable = true; nix-direnv.enable = true; diff --git a/nixos/modules/dolphin/default.nix b/nixos/modules/dolphin/default.nix index fe5c2e4..5e25d00 100644 --- a/nixos/modules/dolphin/default.nix +++ b/nixos/modules/dolphin/default.nix @@ -1,49 +1,54 @@ -{ pkgs, inputs, hwconfig, unstable-pkgs, ... }: { - environment.systemPackages = with pkgs; [ - kdePackages.qtwayland - kdePackages.qtsvg - kdePackages.kio-fuse #to mount remote filesystems via FUSE - kdePackages.kio-extras #extra protocols support (sftp, fish and more) - kdePackages.kio-admin - libheif #https://github.com/NixOS/nixpkgs/issues/164021 - libheif.out - - #kde - kdePackages.breeze-icons - kdePackages.breeze - kdePackages.kdesdk-thumbnailers - kdePackages.kdegraphics-thumbnailers - kdePackages.kservice - kdePackages.kdbusaddons - kdePackages.kfilemetadata - kdePackages.kconfig - kdePackages.kcoreaddons - kdePackages.kcrash - kdePackages.kguiaddons - kdePackages.ki18n - kdePackages.kitemviews - kdePackages.kwidgetsaddons - kdePackages.kwindowsystem - shared-mime-info + pkgs, + inputs, + hwconfig, + unstable-pkgs, + ... +}: { + environment.systemPackages = with pkgs; [ + kdePackages.qtwayland + kdePackages.qtsvg + kdePackages.kio-fuse #to mount remote filesystems via FUSE + kdePackages.kio-extras #extra protocols support (sftp, fish and more) + kdePackages.kio-admin + libheif #https://github.com/NixOS/nixpkgs/issues/164021 + libheif.out - #kde support tools - #libsForQt5.qt5ct - #qt6ct - kdePackages.kimageformats - kdePackages.dolphin - kdePackages.dolphin-plugins - ]; - xdg = { - menus.enable = true; - mime.enable = true; - }; + #kde + kdePackages.breeze-icons + kdePackages.breeze + kdePackages.kdesdk-thumbnailers + kdePackages.kdegraphics-thumbnailers + kdePackages.kservice + kdePackages.kdbusaddons + kdePackages.kfilemetadata + kdePackages.kconfig + kdePackages.kcoreaddons + kdePackages.kcrash + kdePackages.kguiaddons + kdePackages.ki18n + kdePackages.kitemviews + kdePackages.kwidgetsaddons + kdePackages.kwindowsystem + shared-mime-info - #https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3 - # This fixes the unpopulated MIME menus - environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; - environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; - #environment.pathsToLink = [ - # "share/thumbnailers" - #]; + #kde support tools + #libsForQt5.qt5ct + #qt6ct + kdePackages.kimageformats + kdePackages.dolphin + kdePackages.dolphin-plugins + ]; + xdg = { + menus.enable = true; + mime.enable = true; + }; + + #https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3 + # This fixes the unpopulated MIME menus + environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; + environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; + #environment.pathsToLink = [ + # "share/thumbnailers" + #]; } diff --git a/nixos/modules/emacs/packages.nix b/nixos/modules/emacs/packages.nix index c2eab12..9b4ea71 100644 --- a/nixos/modules/emacs/packages.nix +++ b/nixos/modules/emacs/packages.nix @@ -1,8 +1,7 @@ { pkgs, emacs, -}: -{ +}: { packages = with pkgs; [ git gzip diff --git a/nixos/modules/fastfetch/default.nix b/nixos/modules/fastfetch/default.nix index 5a715d8..10bd2dc 100644 --- a/nixos/modules/fastfetch/default.nix +++ b/nixos/modules/fastfetch/default.nix @@ -1,5 +1,8 @@ -{ hwconfig, first-nixos-install, ... }: { + hwconfig, + first-nixos-install, + ... +}: { programs.fastfetch = { enable = true; @@ -23,91 +26,96 @@ }; modules = [ - "break" - { - type = "custom"; - format = "┌──────────────────────Hardware──────────────────────┐"; - } - { - type = "cpu"; - key = "│  "; - } - { - type = "gpu"; - key = "│ 󰍛 "; - } - { - type = "memory"; - key = "│ 󰑭 "; - } - { - type = "custom"; - format = "└────────────────────────────────────────────────────┘"; - } - "break" - { - type = "custom"; - format = "┌──────────────────────Software──────────────────────┐"; - } - { - type = "custom"; - format = " OS -> NixOS btw"; - } - { - type = "kernel"; - key = "│ ├ "; - } - { - type = "packages"; - key = "│ ├󰏖 "; - } - { - type = "shell"; - key = "└ └ "; - } - "break" - { - type = "wm"; - key = " WM"; - } - { - type = "wmtheme"; - key = "│ ├󰉼 "; - } - { - type = "terminal"; - key = "└ └ "; - } - { - type = "custom"; - format = "└────────────────────────────────────────────────────┘"; - } - "break" - { - type = "custom"; - format = "┌────────────────────Age / Uptime────────────────────┐"; - } - { - type = "command"; - key = "│  "; - text = #bash - '' - birth_install=${if hwconfig.useImpermanence then "${first-nixos-install}" else "$(stat -c %W /)"} - current=$(date +%s) - delta=$((current - birth_install)) - delta_days=$((delta / 86400)) - echo $delta_days days - ''; - } - { - type = "uptime"; - key = "│  "; - } - { - type = "custom"; - format = "└────────────────────────────────────────────────────┘"; - } - "break" + "break" + { + type = "custom"; + format = "┌──────────────────────Hardware──────────────────────┐"; + } + { + type = "cpu"; + key = "│  "; + } + { + type = "gpu"; + key = "│ 󰍛 "; + } + { + type = "memory"; + key = "│ 󰑭 "; + } + { + type = "custom"; + format = "└────────────────────────────────────────────────────┘"; + } + "break" + { + type = "custom"; + format = "┌──────────────────────Software──────────────────────┐"; + } + { + type = "custom"; + format = " OS -> NixOS btw"; + } + { + type = "kernel"; + key = "│ ├ "; + } + { + type = "packages"; + key = "│ ├󰏖 "; + } + { + type = "shell"; + key = "└ └ "; + } + "break" + { + type = "wm"; + key = " WM"; + } + { + type = "wmtheme"; + key = "│ ├󰉼 "; + } + { + type = "terminal"; + key = "└ └ "; + } + { + type = "custom"; + format = "└────────────────────────────────────────────────────┘"; + } + "break" + { + type = "custom"; + format = "┌────────────────────Age / Uptime────────────────────┐"; + } + { + type = "command"; + key = "│  "; + text = + #bash + '' + birth_install=${ + if hwconfig.useImpermanence + then "${first-nixos-install}" + else "$(stat -c %W /)" + } + current=$(date +%s) + delta=$((current - birth_install)) + delta_days=$((delta / 86400)) + echo $delta_days days + ''; + } + { + type = "uptime"; + key = "│  "; + } + { + type = "custom"; + format = "└────────────────────────────────────────────────────┘"; + } + "break" ]; }; }; diff --git a/nixos/modules/firefox/aarch64-linux.nix b/nixos/modules/firefox/aarch64-linux.nix index 2d3970d..261dca6 100644 --- a/nixos/modules/firefox/aarch64-linux.nix +++ b/nixos/modules/firefox/aarch64-linux.nix @@ -1,6 +1,5 @@ -{ pkgs, ... }: -{ - nixpkgs = { +{pkgs, ...}: { + nixpkgs = { overlays = [ (final: prev: { firefox = prev.firefox.overrideAttrs (old: { @@ -14,7 +13,7 @@ --set MOZ_GMP_PATH "$out/gmp-widevinecdm/system-installed" ''; }); - librewolf = prev.librewolf.overrideAttrs (old: { + librewolf = prev.librewolf.overrideAttrs (old: { buildCommand = old.buildCommand + '' @@ -25,6 +24,7 @@ --set MOZ_GMP_PATH "$out/gmp-widevinecdm/system-installed" ''; }); - })]; + }) + ]; }; } diff --git a/nixos/modules/firefox/default.nix b/nixos/modules/firefox/default.nix index 04ab8d5..0939a07 100644 --- a/nixos/modules/firefox/default.nix +++ b/nixos/modules/firefox/default.nix @@ -1,30 +1,35 @@ -{ lib, config, pkgs, hwconfig, ... }: - - let - lock-false = { - Value = false; - Status = "locked"; - }; - lock-true = { - Value = true; - Status = "locked"; - }; - in { + lib, + config, + pkgs, + hwconfig, + ... +}: let + lock-false = { + Value = false; + Status = "locked"; + }; + lock-true = { + Value = true; + Status = "locked"; + }; +in { imports = [] ++ lib.optional (hwconfig.system == "aarch64-linux") ./aarch64-linux.nix; programs = { firefox = { package = pkgs.librewolf; enable = true; - languagePacks = [ "de" "en-US" "ru"]; + languagePacks = ["de" "en-US" "ru"]; - /* ---- POLICIES ---- */ + /* + ---- POLICIES ---- + */ # Check about:policies#documentation for options. policies = { DisableTelemetry = true; DisableFirefoxStudies = true; EnableTrackingProtection = { - Value= true; + Value = true; Locked = true; Cryptomining = true; Fingerprinting = true; @@ -39,19 +44,21 @@ DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab" DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on" SearchBar = "unified"; # alternative: "separate" - OfferToSaveLogins = false; - OffertosaveloginsDefault = false; - PasswordManagerEnabled = false; - NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OffertosaveloginsDefault = false; + PasswordManagerEnabled = false; + NoDefaultBookmarks = true; - /* ---- EXTENSIONS ---- */ + /* + ---- EXTENSIONS ---- + */ # Check about:support for extension/add-on ID strings. # Valid strings for installation_mode are "allowed", "blocked", # "force_installed" and "normal_installed". - #https://mozilla.github.io/policy-templates/#extensionsettings - ExtensionSettings = { - "*".installation_mode = "allowed"; # blocks all addons except the ones specified below -# uBlock Origin + #https://mozilla.github.io/policy-templates/#extensionsettings + ExtensionSettings = { + "*".installation_mode = "allowed"; # blocks all addons except the ones specified below + # uBlock Origin "uBlock0@raymondhill.net" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; installation_mode = "force_installed"; @@ -62,41 +69,45 @@ installation_mode = "force_installed"; }; - # Dark Reader - "addon@darkreader.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; - installation_mode = "force_installed"; - }; - #auto tab discard - "{c2c003ee-bd69-42a2-b0e9-6f34222cb046}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/auto-tab-discard/latest.xpi"; - installation_mode = "force_installed"; - }; - # global speed - "{f4961478-ac79-4a18-87e9-d2fb8c0442c4}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/global-speed/latest.xpi"; - installation_mode = "force_installed"; - }; - # sponsorblock - "sponsorBlocker@ajay.app" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; - installation_mode = "force_installed"; - }; - - # Adguard adblocker - "adguardadblocker@adguard.com" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi"; - installation_mode = "force_installed"; - }; + # Dark Reader + "addon@darkreader.org" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; + installation_mode = "force_installed"; + }; + #auto tab discard + "{c2c003ee-bd69-42a2-b0e9-6f34222cb046}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/auto-tab-discard/latest.xpi"; + installation_mode = "force_installed"; + }; + # global speed + "{f4961478-ac79-4a18-87e9-d2fb8c0442c4}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/global-speed/latest.xpi"; + installation_mode = "force_installed"; + }; + # sponsorblock + "sponsorBlocker@ajay.app" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; + installation_mode = "force_installed"; + }; - }; - /* ---- PREFERENCES ---- */ + # Adguard adblocker + "adguardadblocker@adguard.com" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + /* + ---- PREFERENCES ---- + */ # Check about:config for options. - Preferences = { - "browser.contentblocking.category" = { Value = "strict"; Status = "locked"; }; + Preferences = { + "browser.contentblocking.category" = { + Value = "strict"; + Status = "locked"; + }; "extensions.pocket.enabled" = lock-false; "extensions.screenshots.disabled" = lock-true; - "browser.startup.page" = 3; # restore session on startup + "browser.startup.page" = 3; # restore session on startup "browser.topsites.contile.enabled" = lock-false; "browser.formfill.enable" = lock-false; "browser.search.suggest.enabled" = lock-false; diff --git a/nixos/modules/gnome/default.nix b/nixos/modules/gnome/default.nix index 6f822c7..68c127c 100644 --- a/nixos/modules/gnome/default.nix +++ b/nixos/modules/gnome/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { services.xserver = { enable = true; displayManager.gdm.enable = true; diff --git a/nixos/modules/gnupg/default.nix b/nixos/modules/gnupg/default.nix index db85528..5668bdd 100644 --- a/nixos/modules/gnupg/default.nix +++ b/nixos/modules/gnupg/default.nix @@ -1,15 +1,19 @@ -{ pkgs, lib,... }: { + pkgs, + lib, + ... +}: { programs.gnupg.agent = { enable = true; settings = { pinentry-program = lib.mkForce "${pkgs.pinentry-curses}/bin/pinentry-curses"; }; }; - environment.systemPackages = with pkgs;[ - (pass.withExtensions (exts: with exts;[ - pass-otp - pass-import - ])) + environment.systemPackages = with pkgs; [ + (pass.withExtensions (exts: + with exts; [ + pass-otp + pass-import + ])) ]; } diff --git a/nixos/modules/hyprland/battery-status.nix b/nixos/modules/hyprland/battery-status.nix index f363627..e9f93d9 100644 --- a/nixos/modules/hyprland/battery-status.nix +++ b/nixos/modules/hyprland/battery-status.nix @@ -1,83 +1,89 @@ -{pkgs, hwconfig, ...}: -let - battery-path = "/sys/class/power_supply/${if hwconfig.hostname == "kylekrein-mac" then "macsmc-battery" else "BAT0"}"; - get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" '' - cat ${battery-path}/capacity 2>/dev/null || echo "N/A" - ''}/bin/get-battery-level"; - get-status = "${pkgs.writeShellScriptBin "get-status" '' - cat ${battery-path}/status 2>/dev/null || echo "Unknown" - ''}/bin/get-status"; - get-icon = "${pkgs.writeShellScriptBin "get-icon" '' -BATTERY_LEVEL=$(${get-battery-level}) -STATUS=$(${get-status}) -if [[ "$BATTERY_LEVEL" == "N/A" ]]; then - ICON="󰂑 " -elif [[ "$STATUS" == "Charging" ]]; then - if [[ $BATTERY_LEVEL -ge 90 ]]; then - ICON="󰂋 " - elif [[ $BATTERY_LEVEL -ge 80 ]]; then - ICON="󰂊 " - elif [[ $BATTERY_LEVEL -ge 70 ]]; then - ICON="󰢞 " - elif [[ $BATTERY_LEVEL -ge 60 ]]; then - ICON="󰂉 " - elif [[ $BATTERY_LEVEL -ge 50 ]]; then - ICON="󰢝 " - elif [[ $BATTERY_LEVEL -ge 40 ]]; then - ICON="󰂈 " - elif [[ $BATTERY_LEVEL -ge 30 ]]; then - ICON="󰂇 " - elif [[ $BATTERY_LEVEL -ge 20 ]]; then - ICON="󰂆 " - elif [[ $BATTERY_LEVEL -ge 10 ]]; then - ICON="󰢜 " - else - ICON="󰢜 " - fi -else - if [[ $BATTERY_LEVEL -ge 90 ]]; then - ICON="󰂂 " - elif [[ $BATTERY_LEVEL -ge 70 ]]; then - ICON="󰂀 " - elif [[ $BATTERY_LEVEL -ge 50 ]]; then - ICON="󰁾 " - elif [[ $BATTERY_LEVEL -ge 30 ]]; then - ICON="󰁼 " - elif [[ $BATTERY_LEVEL -ge 10 ]]; then - ICON="󰁺 " - else - ICON="󰁺 " - fi -fi - -echo "$ICON" - ''}/bin/get-icon"; - get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" '' -REMAINING_ENERGY=$(cat ${battery-path}/energy_now) -POWER_USAGE=$(cat ${battery-path}/power_now) -if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then - TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE))) - MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60))) - echo "$TIME_LEFT h $MINUTES_LEFT min" -else - echo "" -fi - ''}/bin/get-remaining-time"; -in { + pkgs, + hwconfig, + ... +}: let + battery-path = "/sys/class/power_supply/${ + if hwconfig.hostname == "kylekrein-mac" + then "macsmc-battery" + else "BAT0" + }"; + get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" '' + cat ${battery-path}/capacity 2>/dev/null || echo "N/A" + ''}/bin/get-battery-level"; + get-status = "${pkgs.writeShellScriptBin "get-status" '' + cat ${battery-path}/status 2>/dev/null || echo "Unknown" + ''}/bin/get-status"; + get-icon = "${pkgs.writeShellScriptBin "get-icon" '' + BATTERY_LEVEL=$(${get-battery-level}) + STATUS=$(${get-status}) + if [[ "$BATTERY_LEVEL" == "N/A" ]]; then + ICON="󰂑 " + elif [[ "$STATUS" == "Charging" ]]; then + if [[ $BATTERY_LEVEL -ge 90 ]]; then + ICON="󰂋 " + elif [[ $BATTERY_LEVEL -ge 80 ]]; then + ICON="󰂊 " + elif [[ $BATTERY_LEVEL -ge 70 ]]; then + ICON="󰢞 " + elif [[ $BATTERY_LEVEL -ge 60 ]]; then + ICON="󰂉 " + elif [[ $BATTERY_LEVEL -ge 50 ]]; then + ICON="󰢝 " + elif [[ $BATTERY_LEVEL -ge 40 ]]; then + ICON="󰂈 " + elif [[ $BATTERY_LEVEL -ge 30 ]]; then + ICON="󰂇 " + elif [[ $BATTERY_LEVEL -ge 20 ]]; then + ICON="󰂆 " + elif [[ $BATTERY_LEVEL -ge 10 ]]; then + ICON="󰢜 " + else + ICON="󰢜 " + fi + else + if [[ $BATTERY_LEVEL -ge 90 ]]; then + ICON="󰂂 " + elif [[ $BATTERY_LEVEL -ge 70 ]]; then + ICON="󰂀 " + elif [[ $BATTERY_LEVEL -ge 50 ]]; then + ICON="󰁾 " + elif [[ $BATTERY_LEVEL -ge 30 ]]; then + ICON="󰁼 " + elif [[ $BATTERY_LEVEL -ge 10 ]]; then + ICON="󰁺 " + else + ICON="󰁺 " + fi + fi + + echo "$ICON" + ''}/bin/get-icon"; + get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" '' + REMAINING_ENERGY=$(cat ${battery-path}/energy_now) + POWER_USAGE=$(cat ${battery-path}/power_now) + if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then + TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE))) + MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60))) + echo "$TIME_LEFT h $MINUTES_LEFT min" + else + echo "" + fi + ''}/bin/get-remaining-time"; +in { available = hwconfig.isLaptop; icon = get-icon; status = get-status; time = get-remaining-time; level = get-battery-level; labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" '' - if [[ "$(${get-status})" == "Charging" ]]; then - echo "$(${get-battery-level})% $(${get-icon})" - else - echo "$(${get-remaining-time}) $(${get-icon})" - fi + if [[ "$(${get-status})" == "Charging" ]]; then + echo "$(${get-battery-level})% $(${get-icon})" + else + echo "$(${get-remaining-time}) $(${get-icon})" + fi ''}/bin/labelAdaptive"; labelPercent = "${pkgs.writeShellScriptBin "labelPercent" '' - echo "$(${get-battery-level})% $(${get-icon})" + echo "$(${get-battery-level})% $(${get-icon})" ''}/bin/labelPercent"; } diff --git a/nixos/modules/hyprland/default.nix b/nixos/modules/hyprland/default.nix index ee2ebea..7464afa 100644 --- a/nixos/modules/hyprland/default.nix +++ b/nixos/modules/hyprland/default.nix @@ -1,134 +1,137 @@ -{ pkgs, inputs, hwconfig, unstable-pkgs, ... }: { + pkgs, + inputs, + hwconfig, + unstable-pkgs, + ... +}: { stylix = { - enable = true; - image = "${./wallpaper.jpg}"; - autoEnable = true; - opacity = { - desktop = 0.0;#0.5; - }; - targets = { - gtk.enable = true; - plymouth = { - enable = false; - #logo = ./fastfetch/nixos.png; - logoAnimated = false; - }; - }; - fonts = { - sizes = { - applications = 14; - desktop = 12; - popups = 12; - terminal = 16; - }; - }; - polarity = "dark"; - base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + enable = true; + image = "${./wallpaper.jpg}"; + autoEnable = true; + opacity = { + desktop = 0.0; #0.5; + }; + targets = { + gtk.enable = true; + plymouth = { + enable = false; + #logo = ./fastfetch/nixos.png; + logoAnimated = false; }; - environment.systemPackages = with pkgs; [ - #kando + }; + fonts = { + sizes = { + applications = 14; + desktop = 12; + popups = 12; + terminal = 16; + }; + }; + polarity = "dark"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + }; + environment.systemPackages = with pkgs; [ + #kando - kdePackages.qtwayland - #libsForQt5.qt5.qtwayland - #libsForQt5.qt5.qtsvg - kdePackages.qtsvg - #kio-fuse #to mount remote filesystems via FUSE - #libsForQt5.kio-extras #extra protocols support (sftp, fish and more) - kdePackages.kio-fuse #to mount remote filesystems via FUSE - kdePackages.kio-extras #extra protocols support (sftp, fish and more) - kdePackages.kio-admin - waybar - swaynotificationcenter - libnotify - swww - hyprpicker - networkmanagerapplet - hyprlock - wlogout - hypridle - qpwgraph - pwvucontrol - brightnessctl - unstable-pkgs.satty #fixes crash in 0.18.0 - grim - slurp - clipse - libheif #https://github.com/NixOS/nixpkgs/issues/164021 - libheif.out - - #kde - kdePackages.breeze-icons - kdePackages.breeze - kdePackages.polkit-kde-agent-1 - kdePackages.kdesdk-thumbnailers - kdePackages.kdegraphics-thumbnailers - kdePackages.kservice - kdePackages.kdbusaddons - kdePackages.kfilemetadata - kdePackages.kconfig - kdePackages.kcoreaddons - kdePackages.kcrash - kdePackages.kguiaddons - kdePackages.ki18n - kdePackages.kitemviews - kdePackages.kwidgetsaddons - kdePackages.kwindowsystem - shared-mime-info - #kdePackages.plasma-workspace + kdePackages.qtwayland + #libsForQt5.qt5.qtwayland + #libsForQt5.qt5.qtsvg + kdePackages.qtsvg + #kio-fuse #to mount remote filesystems via FUSE + #libsForQt5.kio-extras #extra protocols support (sftp, fish and more) + kdePackages.kio-fuse #to mount remote filesystems via FUSE + kdePackages.kio-extras #extra protocols support (sftp, fish and more) + kdePackages.kio-admin + waybar + swaynotificationcenter + libnotify + swww + hyprpicker + networkmanagerapplet + hyprlock + wlogout + hypridle + qpwgraph + pwvucontrol + brightnessctl + unstable-pkgs.satty #fixes crash in 0.18.0 + grim + slurp + clipse + libheif #https://github.com/NixOS/nixpkgs/issues/164021 + libheif.out - #kde support tools - libsForQt5.qt5ct - qt6ct - kdePackages.kimageformats - kdePackages.dolphin - kdePackages.dolphin-plugins + #kde + kdePackages.breeze-icons + kdePackages.breeze + kdePackages.polkit-kde-agent-1 + kdePackages.kdesdk-thumbnailers + kdePackages.kdegraphics-thumbnailers + kdePackages.kservice + kdePackages.kdbusaddons + kdePackages.kfilemetadata + kdePackages.kconfig + kdePackages.kcoreaddons + kdePackages.kcrash + kdePackages.kguiaddons + kdePackages.ki18n + kdePackages.kitemviews + kdePackages.kwidgetsaddons + kdePackages.kwindowsystem + shared-mime-info + #kdePackages.plasma-workspace + + #kde support tools + libsForQt5.qt5ct + qt6ct + kdePackages.kimageformats + kdePackages.dolphin + kdePackages.dolphin-plugins + ]; + + programs.kdeconnect.enable = true; + programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde; + programs.hyprlock.enable = true; + + xdg = { + menus.enable = true; + mime.enable = true; + }; + xdg.portal = { + enable = true; + config = { + hyprland = { + default = [ + "hyprland" + "kde" + ]; + }; + }; + configPackages = with pkgs; [ + xdg-desktop-portal-hyprland + kdePackages.xdg-desktop-portal-kde ]; + }; - programs.kdeconnect.enable = true; - programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde; - programs.hyprlock.enable = true; - - xdg = { - menus.enable = true; - mime.enable = true; - }; - xdg.portal = { - enable = true; - config = { - hyprland = { - default = [ - "hyprland" - "kde" - ]; - }; - }; - configPackages = with pkgs; [ - xdg-desktop-portal-hyprland - kdePackages.xdg-desktop-portal-kde - ]; - }; - - #https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3 - # This fixes the unpopulated MIME menus - environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; - environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; - #environment.pathsToLink = [ - # "share/thumbnailers" - #]; - - programs.hyprland = { - enable = true; - xwayland.enable = true; - systemd.setPath.enable = true; - }; - services.hypridle.enable = true; - - # qt = { - #enable = true; - #platformTheme = "qt5ct"; - #style = "kvantum"; - # }; + #https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3 + # This fixes the unpopulated MIME menus + environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; + environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; + #environment.pathsToLink = [ + # "share/thumbnailers" + #]; + programs.hyprland = { + enable = true; + xwayland.enable = true; + systemd.setPath.enable = true; + }; + services.hypridle.enable = true; + # qt = { + #enable = true; + #platformTheme = "qt5ct"; + #style = "kvantum"; + # }; } diff --git a/nixos/modules/hyprland/home.nix b/nixos/modules/hyprland/home.nix index 7557bcd..78072a9 100644 --- a/nixos/modules/hyprland/home.nix +++ b/nixos/modules/hyprland/home.nix @@ -4,8 +4,7 @@ lib, hwconfig, ... -}: -{ +}: { imports = [ (import ./hyprland.nix { inherit pkgs; diff --git a/nixos/modules/hyprland/hypridle.nix b/nixos/modules/hyprland/hypridle.nix index 54a53f4..1a5b212 100644 --- a/nixos/modules/hyprland/hypridle.nix +++ b/nixos/modules/hyprland/hypridle.nix @@ -1,65 +1,66 @@ -{ pkgs, lib, hwconfig, ... }: -let -suspendScript = pkgs.writeShellScript "suspend-script" '' +{ + pkgs, + lib, + hwconfig, + ... +}: let + suspendScript = pkgs.writeShellScript "suspend-script" '' # check if any player has status "Playing" ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q # only suspend if nothing is playing if [ $? == 1 ]; then - ${if hwconfig.isLaptop then "${pkgs.systemd}/bin/systemctl suspend" else "loginctl lock-session"} + ${ + if hwconfig.isLaptop + then "${pkgs.systemd}/bin/systemctl suspend" + else "loginctl lock-session" + } fi ''; -in -{ - -services.hypridle = { - enable = true; - settings = { - -general = { - lock_cmd="pidof hyprlock || hyprlock"; - before_sleep_cmd = "pidof hyprlock || loginctl lock-session"; # lock before suspend. - after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. - ignore_dbus_inhibit = false; -}; - -listener = [ - -#{ -# on-resume="brightnessctl -r"; # monitor backlight restore. -# on-timeout="brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. -# timeout=240; -#} -#{ -# on-resume="brightnessctl -rd rgb:kbd_backlight"; -# on-timeout="brightnessctl -sd rgb:kbd_backlight set 0"; -# timeout=300; -#} -{ - on-timeout="notify-send \"You're idle. Locking in 30 seconds.\""; - timeout=830; -} -{ - on-timeout = "pidof hyprlock && systemctl suspend"; - timeout = 120; -} -#{ -# on-timeout="loginctl lock-session"; -# timeout=360; -#} -{ - on-resume = "hyprctl dispatch dpms on"; - on-timeout = suspendScript.outPath; - timeout = 900; -} -#{ -# on-resume="hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired. -# on-timeout="hyprctl dispatch dpms off"; # screen off when timeout has passed -# timeout=420; -#} -]; - - - }; -}; +in { + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "pidof hyprlock || loginctl lock-session"; # lock before suspend. + after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. + ignore_dbus_inhibit = false; + }; + listener = [ + #{ + # on-resume="brightnessctl -r"; # monitor backlight restore. + # on-timeout="brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + # timeout=240; + #} + #{ + # on-resume="brightnessctl -rd rgb:kbd_backlight"; + # on-timeout="brightnessctl -sd rgb:kbd_backlight set 0"; + # timeout=300; + #} + { + on-timeout = "notify-send \"You're idle. Locking in 30 seconds.\""; + timeout = 830; + } + { + on-timeout = "pidof hyprlock && systemctl suspend"; + timeout = 120; + } + #{ + # on-timeout="loginctl lock-session"; + # timeout=360; + #} + { + on-resume = "hyprctl dispatch dpms on"; + on-timeout = suspendScript.outPath; + timeout = 900; + } + #{ + # on-resume="hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired. + # on-timeout="hyprctl dispatch dpms off"; # screen off when timeout has passed + # timeout=420; + #} + ]; + }; + }; } diff --git a/nixos/modules/hyprland/hyprland.nix b/nixos/modules/hyprland/hyprland.nix index 9375fa6..374eb74 100644 --- a/nixos/modules/hyprland/hyprland.nix +++ b/nixos/modules/hyprland/hyprland.nix @@ -118,7 +118,7 @@ in { "$mainMod ALT, L, exec, ${pkgs.hyprlock}/bin/hyprlock" ''$mainMod, E, exec, $emacs'' - #''$mainMod SHIFT, E, exec, emacsclient -e "(emacs-everywhere)"'' + #''$mainMod SHIFT, E, exec, emacsclient -e "(emacs-everywhere)"'' ]; bindm = [ @@ -126,17 +126,23 @@ in { "$mod, mouse:273, resizewindow" ]; misc = { - vfr = true; #lowers the amount of frames when nothing happens - allow_session_lock_restore = true; # hope that it fixes the crash of hyprlock - disable_hyprland_logo = true;# disables the random Hyprland logo / anime girl background. :( + vfr = true; #lowers the amount of frames when nothing happens + allow_session_lock_restore = true; # hope that it fixes the crash of hyprlock + disable_hyprland_logo = true; # disables the random Hyprland logo / anime girl background. :( }; input = { kb_layout = "us, ru"; - kb_options = "grp:lctrl_toggle, ctrl:nocaps" + (if hwconfig.hostname == "kylekrein-mac" then ", altwin:swap_alt_win" else ""); # "ctrl:nocaps, grp:toggle" + kb_options = + "grp:lctrl_toggle, ctrl:nocaps" + + ( + if hwconfig.hostname == "kylekrein-mac" + then ", altwin:swap_alt_win" + else "" + ); # "ctrl:nocaps, grp:toggle" touchpad = { natural_scroll = true; - disable_while_typing = false; #for games + disable_while_typing = false; #for games }; }; env = [ @@ -159,7 +165,7 @@ in { cursor = { no_hardware_cursors = true; - inactive_timeout = 10; + inactive_timeout = 10; }; general = { @@ -173,8 +179,9 @@ in { allow_tearing = false; layout = "dwindle"; }; - render = lib.mkIf (hwconfig.system == "aarch64-linux") { # Explicit sync breaks asahi driver https://github.com/hyprwm/Hyprland/issues/8158 - explicit_sync = 0; + render = lib.mkIf (hwconfig.system == "aarch64-linux") { + # Explicit sync breaks asahi driver https://github.com/hyprwm/Hyprland/issues/8158 + explicit_sync = 0; }; windowrule = [ @@ -212,9 +219,9 @@ in { #emacs run launcher "float, title:emacs-run-launcher" "pin, title:emacs-run-launcher" - - #emacs - "opaque, class:emacs" + + #emacs + "opaque, class:emacs" ]; decoration = { diff --git a/nixos/modules/hyprland/hyprlock.nix b/nixos/modules/hyprland/hyprlock.nix index d23c0c4..3d242a4 100644 --- a/nixos/modules/hyprland/hyprlock.nix +++ b/nixos/modules/hyprland/hyprlock.nix @@ -1,18 +1,25 @@ -{ pkgs, lib, hwconfig, ... }: -let - profile-image = ./profile-image.png; - battery-level = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;}).labelPercent; -in { + pkgs, + lib, + hwconfig, + ... +}: let + profile-image = ./profile-image.png; + battery-level = + (import ./battery-status.nix { + inherit pkgs; + inherit hwconfig; + }).labelPercent; +in { programs.hyprlock = { enable = true; settings = { general = { #enable_fingerprint = true; - disable_loading_bar = true; - hide_cursor = true; - no_fade_in = false; - grace = 10; + disable_loading_bar = true; + hide_cursor = true; + no_fade_in = false; + grace = 10; }; background = { blur_passes = 1; @@ -24,14 +31,14 @@ in vibrancy_darkness = 0.0; }; image = { - path = "${profile-image}"; - size = 150; - border_size = 4; - #border_color = "rgb(0C96F9)"; - rounding = -1; # Negative means circle - position = "0, 220"; - halign = "center"; - valign = "center"; + path = "${profile-image}"; + size = 150; + border_size = 4; + #border_color = "rgb(0C96F9)"; + rounding = -1; # Negative means circle + position = "0, 220"; + halign = "center"; + valign = "center"; }; input-field = { size = "600, 100"; @@ -51,41 +58,41 @@ in halign = "center"; valign = "center"; }; - label = [ - { - text = "$USER"; - font_family = "Fira Code"; - font_size = 56; - position = "0, 100"; - halign = "center"; - valign = "center"; - } - { - text = "$TIME"; - font_family = "Roboto"; - font_size = 72; - position = "-40, -40"; - halign = "right"; - valign = "top"; - } - { - text = "$LAYOUT"; - font_family = "JetBrains Mono"; - font_size = 28; - position = "-20, 20"; - halign = "right"; - valign = "bottom"; - } - ] ++ lib.optional (hwconfig.isLaptop) ( - { + label = + [ + { + text = "$USER"; + font_family = "Fira Code"; + font_size = 56; + position = "0, 100"; + halign = "center"; + valign = "center"; + } + { + text = "$TIME"; + font_family = "Roboto"; + font_size = 72; + position = "-40, -40"; + halign = "right"; + valign = "top"; + } + { + text = "$LAYOUT"; + font_family = "JetBrains Mono"; + font_size = 28; + position = "-20, 20"; + halign = "right"; + valign = "bottom"; + } + ] + ++ lib.optional (hwconfig.isLaptop) { text = ''cmd[update:10000] ${battery-level}''; font_family = "JetBrains Mono"; font_size = 28; position = "20, 20"; halign = "left"; valign = "bottom"; - }); + }; }; }; } - diff --git a/nixos/modules/hyprland/waybar.nix b/nixos/modules/hyprland/waybar.nix index 5ee6808..3700796 100644 --- a/nixos/modules/hyprland/waybar.nix +++ b/nixos/modules/hyprland/waybar.nix @@ -1,70 +1,79 @@ -{ pkgs, lib, hwconfig, ... }: -let -battery = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;}); -in { + pkgs, + lib, + hwconfig, + ... +}: let + battery = import ./battery-status.nix { + inherit pkgs; + inherit hwconfig; + }; +in { programs.waybar = { enable = true; #systemd.enable = true; #window#waybar { - # background: transparent; - #border-bottom: none; - #} - #${builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css"} - style = '' - ${builtins.readFile ./waybarstyle.css} - - * { - font-size: 15px; - } - ''; - settings = [{ + # background: transparent; + #border-bottom: none; + #} + #${builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css"} + style = '' + ${builtins.readFile ./waybarstyle.css} + + * { + font-size: 15px; + } + ''; + settings = [ + { height = 36; layer = "top"; position = "top"; - tray = { spacing = 3; }; - modules-center = [ - #"hyprland/window" - "clock" - ]; - modules-left = [ - "hyprland/workspaces" - # "hyprland/window" + tray = {spacing = 3;}; + modules-center = [ + #"hyprland/window" + "clock" ]; - modules-right = lib.optional hwconfig.isLaptop "backlight" - ++ [ - "pulseaudio" - #"network" - #"cpu" - "memory" - #"temperature" - "hyprland/language" - ] ++ lib.optional battery.available "custom/battery" - ++ [ - "tray" - "custom/notification" - #"custom/disablehypridle" - "custom/power" + modules-left = [ + "hyprland/workspaces" + # "hyprland/window" ]; + modules-right = + lib.optional hwconfig.isLaptop "backlight" + ++ [ + "pulseaudio" + #"network" + #"cpu" + "memory" + #"temperature" + "hyprland/language" + ] + ++ lib.optional battery.available "custom/battery" + ++ [ + "tray" + "custom/notification" + #"custom/disablehypridle" + "custom/power" + ]; battery = { format = " {time} {icon} "; format-alt = " {capacity}% {icon} "; format-charging = " {capacity}%  "; - format-icons = [ "" "" "" "" "" ]; + format-icons = ["" "" "" "" ""]; format-plugged = " {capacity}%  "; states = { critical = 10; warning = 20; }; }; - backlight = { - format = "{percent}% 󰛩"; - on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; - on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; - }; + backlight = { + format = "{percent}% 󰛩"; + on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; + on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; + }; "custom/battery" = { - exec ="${pkgs.writeShellScriptBin "battery-widget" '' + exec = "${pkgs.writeShellScriptBin "battery-widget" '' ${battery.labelAdaptive} ${battery.labelPercent} ''}/bin/battery-widget"; @@ -80,12 +89,12 @@ in tooltip = false; }; "hyprland/language" = { - format = " {}"; + format = " {}"; + }; + memory = { + interval = 1; + format = "{used}/{total}Gb "; }; - memory = { - interval = 1; - format = "{used}/{total}Gb "; - }; network = { interval = 1; format-alt = "{ifname}: {ipaddr}/{cidr}"; @@ -102,7 +111,7 @@ in format-bluetooth-muted = " {icon}  {format_source}"; format-icons = { car = ""; - default = [ "" "" "" ]; + default = ["" "" ""]; handsfree = ""; headphones = ""; headset = ""; @@ -114,57 +123,57 @@ in format-source-muted = ""; on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol"; }; - "hyprland/submap" = { format = ''{}''; }; + "hyprland/submap" = {format = ''{}'';}; temperature = { critical-threshold = 80; format = "{temperatureC}°C {icon}"; - format-icons = [ "" "" "" ]; + format-icons = ["" "" ""]; }; "hyprland/workspaces" = { - disable-scroll = true; - all-outputs = false; - warp-on-scroll = true; - format = "{name}{icon} "; - format-icons = { - urgent = ""; - active = ""; - default = ""; - }; - #persistent-workspaces = { - # "*" = 3; - #}; + disable-scroll = true; + all-outputs = false; + warp-on-scroll = true; + format = "{name}{icon} "; + format-icons = { + urgent = ""; + active = ""; + default = ""; + }; + #persistent-workspaces = { + # "*" = 3; + #}; }; "custom/power" = { - format = "⏻ "; - tooltip = false; - #menu = "on-click"; - #menu-file = ./power_menu.xml; - #menu-actions = { - # shutdown = "shutdown -h now"; - # reboot = "reboot"; - # suspend = "systemctl suspend"; - # hibernate = "systemctl hibernate"; - #}; - on-click = "wlogout"; + format = "⏻ "; + tooltip = false; + #menu = "on-click"; + #menu-file = ./power_menu.xml; + #menu-actions = { + # shutdown = "shutdown -h now"; + # reboot = "reboot"; + # suspend = "systemctl suspend"; + # hibernate = "systemctl hibernate"; + #}; + on-click = "wlogout"; }; "custom/notification" = { - tooltip = false; - format = "{icon}"; - format-icons = { - notification = " "; - none = " "; - dnd-notification = " "; - dnd-none = "  "; - }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "sleep 0.1 && swaync-client -t -sw"; - on-click-right = "sleep 0.1 && swaync-client -d -sw"; - escape = true; + tooltip = false; + format = "{icon}"; + format-icons = { + notification = " "; + none = " "; + dnd-notification = " "; + dnd-none = "  "; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "sleep 0.1 && swaync-client -t -sw"; + on-click-right = "sleep 0.1 && swaync-client -d -sw"; + escape = true; }; "custom/disablehypridle" = { @@ -184,6 +193,7 @@ in fi ''; }; - }]; + } + ]; }; } diff --git a/nixos/modules/kando/default.nix b/nixos/modules/kando/default.nix index c520f97..4c1db5b 100644 --- a/nixos/modules/kando/default.nix +++ b/nixos/modules/kando/default.nix @@ -1,9 +1,8 @@ -{ ... }: -let folder = ".config/kando"; -in -{ - home.file = { - #"${folder}/config.json".source = ./config.json; - "${folder}/menus.json".source = ./menus.json; - }; +{...}: let + folder = ".config/kando"; +in { + home.file = { + #"${folder}/config.json".source = ./config.json; + "${folder}/menus.json".source = ./menus.json; + }; } diff --git a/nixos/modules/kde-plasma/default.nix b/nixos/modules/kde-plasma/default.nix index f55f18c..44a8717 100644 --- a/nixos/modules/kde-plasma/default.nix +++ b/nixos/modules/kde-plasma/default.nix @@ -1,9 +1,8 @@ -{ ... }: -{ - services.xserver.enable = true; - services.desktopManager.plasma6.enable = true; +{...}: { + services.xserver.enable = true; + services.desktopManager.plasma6.enable = true; - programs.dconf.enable = true; + programs.dconf.enable = true; - #stylix.targets.qt.platform = "qtct"; + #stylix.targets.qt.platform = "qtct"; } diff --git a/nixos/modules/libvirt/default.nix b/nixos/modules/libvirt/default.nix index e3fefde..b8220e9 100644 --- a/nixos/modules/libvirt/default.nix +++ b/nixos/modules/libvirt/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { virtualisation = { libvirtd = { enable = true; @@ -7,7 +6,7 @@ package = pkgs.qemu_kvm; swtpm.enable = true; ovmf.enable = true; - ovmf.packages = [ pkgs.OVMFFull.fd ]; + ovmf.packages = [pkgs.OVMFFull.fd]; }; }; spiceUSBRedirection.enable = true; diff --git a/nixos/modules/libvirt/user.nix b/nixos/modules/libvirt/user.nix index 3fe5bc3..830cbe2 100644 --- a/nixos/modules/libvirt/user.nix +++ b/nixos/modules/libvirt/user.nix @@ -1,11 +1,10 @@ -{ username, ... }: -{ - users.users.${username}.extraGroups = [ "libvirtd" ]; - home-manager.users.${username} = { +{username, ...}: { + users.users.${username}.extraGroups = ["libvirtd"]; + home-manager.users.${username} = { dconf.settings = { "org/virt-manager/virt-manager/connections" = { - autoconnect = [ "qemu:///system" ]; - uris = [ "qemu:///system" ]; + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; }; }; }; diff --git a/nixos/modules/niri/default.nix b/nixos/modules/niri/default.nix index e61ec2b..5ea2ddb 100644 --- a/nixos/modules/niri/default.nix +++ b/nixos/modules/niri/default.nix @@ -1,5 +1,8 @@ -{ pkgs, inputs, ...}: { + pkgs, + inputs, + ... +}: { nixpkgs.overlays = [ inputs.niri-flake.overlays.niri ]; @@ -12,7 +15,7 @@ package = pkgs.niri-unstable; }; niri-flake.cache.enable = true; - environment.systemPackages = with pkgs;[ + environment.systemPackages = with pkgs; [ wl-clipboard wayland-utils libsecret diff --git a/nixos/modules/services/autoupgrade/default.nix b/nixos/modules/services/autoupgrade/default.nix index 2b0ad8e..e1ce49b 100644 --- a/nixos/modules/services/autoupgrade/default.nix +++ b/nixos/modules/services/autoupgrade/default.nix @@ -3,13 +3,10 @@ config, lib, ... -}: - -let +}: let cfg = config.kylekrein.services.autoUpgrade; script = ./nixos-upgrade-script.sh; -in -{ +in { options = { kylekrein.services.autoUpgrade = { enable = lib.mkEnableOption "Enables automatic system updates."; @@ -69,15 +66,31 @@ in unitConfig.RequiresMountsFor = cfg.configDir; script = "${script} --operation ${cfg.operation} " - + (if (cfg.configDir != "") then "--flake ${cfg.configDir} " else "") - + (if (cfg.user != "") then "--user ${cfg.user} " else "") - + (if (cfg.pushUpdates) then "--update " else "") - + (if (cfg.extraFlags != "") then cfg.extraFlags else ""); + + ( + if (cfg.configDir != "") + then "--flake ${cfg.configDir} " + else "" + ) + + ( + if (cfg.user != "") + then "--user ${cfg.user} " + else "" + ) + + ( + if (cfg.pushUpdates) + then "--update " + else "" + ) + + ( + if (cfg.extraFlags != "") + then cfg.extraFlags + else "" + ); }; timers."nixos-upgrade" = { - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; - wantedBy = [ "timers.target" ]; + wants = ["network-online.target"]; + after = ["network-online.target"]; + wantedBy = ["timers.target"]; timerConfig = { OnCalendar = cfg.onCalendar; Persistent = cfg.persistent; diff --git a/nixos/modules/sops/default.nix b/nixos/modules/sops/default.nix index a311f29..f5ebda2 100644 --- a/nixos/modules/sops/default.nix +++ b/nixos/modules/sops/default.nix @@ -1,12 +1,20 @@ -{ config, pkgs, inputs, lib, hwconfig, ... }: -let - keyPath = (if hwconfig.useImpermanence then "/persist/sops/age/keys.txt" else "/var/lib/sops/age/keys.txt"); -in { - environment.systemPackages = with pkgs; [sops]; - sops.defaultSopsFile = ./secrets/secrets.yaml; - sops.defaultSopsFormat = "yaml"; - sops.age.keyFile = keyPath; - # This will generate a new key if the key specified above does not exist - sops.age.generateKey = true; + config, + pkgs, + inputs, + lib, + hwconfig, + ... +}: let + keyPath = + if hwconfig.useImpermanence + then "/persist/sops/age/keys.txt" + else "/var/lib/sops/age/keys.txt"; +in { + environment.systemPackages = with pkgs; [sops]; + sops.defaultSopsFile = ./secrets/secrets.yaml; + sops.defaultSopsFormat = "yaml"; + sops.age.keyFile = keyPath; + # This will generate a new key if the key specified above does not exist + sops.age.generateKey = true; } diff --git a/nixos/modules/steam/default.nix b/nixos/modules/steam/default.nix index 9d6c583..6b856a0 100644 --- a/nixos/modules/steam/default.nix +++ b/nixos/modules/steam/default.nix @@ -7,7 +7,10 @@ ... }: let cfg = config.kk.steam; - containerPath = if hwconfig.useImpermanence then "/persist/home/containers/steam" else "/var/containers/steam"; + containerPath = + if hwconfig.useImpermanence + then "/persist/home/containers/steam" + else "/var/containers/steam"; containerName = "fedora-steam"; in { options.kk.steam = { @@ -15,92 +18,91 @@ in { }; config = lib.mkIf cfg.enable ( - if hwconfig.system == "aarch64-linux" - then { - virtualisation.podman = { - enable = true; - dockerCompat = true; - }; - environment.systemPackages = with pkgs;[ - distrobox - (pkgs.writeShellScriptBin "steam-install" '' - set -e - echo "Проверяем контейнер Steam..." - - if [ ! -d "${containerPath}" ]; then - echo "Контейнер не найден, создаем новый с Fedora..." - - # Создаём контейнер с Fedora - export PATH=${pkgs.podman}/bin:$PATH - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-create --name "${containerName}" --image registry.fedoraproject.org/fedora:latest --home ${containerPath} --hostname ${containerName} --yes - - echo "Контейнер ${containerName} создан, устанавливаем Steam..." - - # Устанавливаем Steam внутри контейнера - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf upgrade --refresh -y - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/steam - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-branding - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-scripts - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/kernel - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/kernel-edge - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/packit-builds - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/u-boot - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/rawhide-rebuilds - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa - -env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf upgrade --refresh -y - -env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true asahi-repos -y - -env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true steam -y -env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf remove dhcpcd -y - fi - - echo "Экспортируем Steam..." - env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox enter "${containerName}" -- distrobox-export --app steam - '') - ]; - - } - else - { + if hwconfig.system == "aarch64-linux" + then { + virtualisation.podman = { + enable = true; + dockerCompat = true; + }; environment.systemPackages = with pkgs; [ - unzip - wget - xdotool - xorg.xprop - xorg.xrandr - unixtools.xxd - xorg.xwininfo - yad - protonup-qt - protontricks - bottles + distrobox + (pkgs.writeShellScriptBin "steam-install" '' + set -e + echo "Проверяем контейнер Steam..." + + if [ ! -d "${containerPath}" ]; then + echo "Контейнер не найден, создаем новый с Fedora..." + + # Создаём контейнер с Fedora + export PATH=${pkgs.podman}/bin:$PATH + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-create --name "${containerName}" --image registry.fedoraproject.org/fedora:latest --home ${containerPath} --hostname ${containerName} --yes + + echo "Контейнер ${containerName} создан, устанавливаем Steam..." + + # Устанавливаем Steam внутри контейнера + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf upgrade --refresh -y + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/steam + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-branding + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-scripts + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/kernel + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/kernel-edge + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/packit-builds + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/u-boot + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/rawhide-rebuilds + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa + + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf upgrade --refresh -y + + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true asahi-repos -y + + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true steam -y + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf remove dhcpcd -y + fi + + echo "Экспортируем Steam..." + env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox enter "${containerName}" -- distrobox-export --app steam + '') + ]; + } + else { + environment.systemPackages = with pkgs; [ + unzip + wget + xdotool + xorg.xprop + xorg.xrandr + unixtools.xxd + xorg.xwininfo + yad + protonup-qt + protontricks + bottles ]; programs.steam = { - enable = true;#!hwconfig.useImpermanence; + enable = true; #!hwconfig.useImpermanence; remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers - package = pkgs.steam.override { - extraPkgs = pkgs: with pkgs; [ - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - libpng - libpulseaudio - libvorbis - sdl3 - SDL2 - stdenv.cc.cc.lib - libkrb5 - keyutils - gamescope - ]; - }; + package = pkgs.steam.override { + extraPkgs = pkgs: + with pkgs; [ + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + sdl3 + SDL2 + stdenv.cc.cc.lib + libkrb5 + keyutils + gamescope + ]; + }; }; programs.gamemode.enable = true; } diff --git a/nixos/users/andrej/default.nix b/nixos/users/andrej/default.nix index 4278b2e..a313585 100644 --- a/nixos/users/andrej/default.nix +++ b/nixos/users/andrej/default.nix @@ -1,25 +1,43 @@ -{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }: -let username = "andrej"; -in { - imports = [ + pkgs, + config, + lib, + hwconfig, + inputs, + first-nixos-install, + ... +}: let + username = "andrej"; +in { + imports = [ + ]; + users.users.${username} = { + isNormalUser = true; + description = "Andrej Lebedev"; + extraGroups = ["networkmanager"]; + #initialPassword = "1234"; + hashedPasswordFile = config.sops.secrets."users/${username}".path; + packages = with pkgs; [ + flatpak ]; - users.users.${username} = { - isNormalUser = true; - description = "Andrej Lebedev"; - extraGroups = [ "networkmanager" ]; - #initialPassword = "1234"; - hashedPasswordFile = config.sops.secrets."users/${username}".path; - packages = with pkgs; [ - flatpak - ]; - }; - sops.secrets = { - "users/${username}" = { - neededForUsers = true; - }; + }; + sops.secrets = { + "users/${username}" = { + neededForUsers = true; }; + }; - home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; - systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/ created, owned by that user + home-manager.users."${username}" = import ../../home.nix { + inherit lib; + inherit username; + inherit inputs; + inherit first-nixos-install; + inherit hwconfig; + inherit config; + inherit pkgs; + }; + systemd.tmpfiles.rules = + if hwconfig.useImpermanence + then ["d /persist/home/${username} 0700 ${username} users -"] + else []; # /persist/home/ created, owned by that user } diff --git a/nixos/users/dima/default.nix b/nixos/users/dima/default.nix index a1ea0a9..c5635ae 100644 --- a/nixos/users/dima/default.nix +++ b/nixos/users/dima/default.nix @@ -1,24 +1,41 @@ -{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }: -let username = "dima"; -in { - imports = [ + pkgs, + config, + lib, + hwconfig, + inputs, + first-nixos-install, + ... +}: let + username = "dima"; +in { + imports = [ + ]; + users.users.${username} = { + isNormalUser = true; + description = "Dima"; + extraGroups = ["networkmanager"]; + initialPassword = "1234"; + #hashedPasswordFile = config.sops.secrets."users/${username}".path; + packages = with pkgs; [ ]; - users.users.${username} = { - isNormalUser = true; - description = "Dima"; - extraGroups = [ "networkmanager" ]; - initialPassword = "1234"; - #hashedPasswordFile = config.sops.secrets."users/${username}".path; - packages = with pkgs; [ - ]; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILIc/J6YxwWKajJ923/PZ2fcgLgWZdVMcZQ4oZZ+2hwn dima@dragonarch" ]; + }; + programs.ssh.forwardX11 = true; - }; - programs.ssh.forwardX11 = true; - - home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; - systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/ created, owned by that user + home-manager.users."${username}" = import ../../home.nix { + inherit lib; + inherit username; + inherit inputs; + inherit first-nixos-install; + inherit hwconfig; + inherit config; + inherit pkgs; + }; + systemd.tmpfiles.rules = + if hwconfig.useImpermanence + then ["d /persist/home/${username} 0700 ${username} users -"] + else []; # /persist/home/ created, owned by that user } diff --git a/nixos/users/tania/default.nix b/nixos/users/tania/default.nix index 74ec878..3bfdbc7 100644 --- a/nixos/users/tania/default.nix +++ b/nixos/users/tania/default.nix @@ -1,24 +1,42 @@ -{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }: -let username = "tania"; -in { - imports = [ + pkgs, + config, + lib, + hwconfig, + inputs, + first-nixos-install, + ... +}: let + username = "tania"; +in { + imports = [ + ]; + users.users.${username} = { + isNormalUser = true; + description = "Tetiana"; + extraGroups = ["networkmanager"]; + #initialPassword = "1234"; + hashedPasswordFile = config.sops.secrets."users/${username}".path; + packages = with pkgs; [ ]; - users.users.${username} = { - isNormalUser = true; - description = "Tetiana"; - extraGroups = [ "networkmanager" ]; - #initialPassword = "1234"; - hashedPasswordFile = config.sops.secrets."users/${username}".path; - packages = with pkgs; [ - ]; - }; - sops.secrets = { - "users/${username}" = { - neededForUsers = true; - }; + }; + sops.secrets = { + "users/${username}" = { + neededForUsers = true; }; + }; - home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; - systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/ created, owned by that user + home-manager.users."${username}" = import ../../home.nix { + inherit lib; + inherit username; + inherit inputs; + inherit first-nixos-install; + inherit hwconfig; + inherit config; + inherit pkgs; + }; + systemd.tmpfiles.rules = + if hwconfig.useImpermanence + then ["d /persist/home/${username} 0700 ${username} users -"] + else []; # /persist/home/ created, owned by that user } diff --git a/nixos/wsl.nix b/nixos/wsl.nix index fa04ea3..d109816 100644 --- a/nixos/wsl.nix +++ b/nixos/wsl.nix @@ -7,16 +7,17 @@ inputs, unstable-pkgs, ... -}: -{ - imports = [ - ./modules/firefox - ./modules/flatpak - ./modules/emacs - ./modules/gnupg - ./modules/direnv - ./hosts/${hwconfig.hostname} - ] ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; +}: { + imports = + [ + ./modules/firefox + ./modules/flatpak + ./modules/emacs + ./modules/gnupg + ./modules/direnv + ./hosts/${hwconfig.hostname} + ] + ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; networking.hostName = hwconfig.hostname; time.timeZone = "Europe/Berlin"; @@ -29,7 +30,6 @@ #flatpak #kk.services.flatpak.enable = hwconfig.system != "aarch64-linux"; services.flatpak.packages = [ - ]; # Enable common container config files in /etc/containers @@ -74,7 +74,7 @@ }; services.ollama = { enable = true; - loadModels = [ "llama3.1" "qwen2.5-coder:7b" ]; + loadModels = ["llama3.1" "qwen2.5-coder:7b"]; acceleration = "cuda"; user = "ollama"; group = "ollama"; @@ -101,57 +101,57 @@ }; security.polkit.enable = true; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; - programs.bash = { - shellAliases = { - ls = "${pkgs.eza}/bin/eza --icons=always"; - }; - }; + programs.bash = { + shellAliases = { + ls = "${pkgs.eza}/bin/eza --icons=always"; + }; + }; - # List services that you want to enable: + # List services that you want to enable: - # Enable the OpenSSH daemon. - services.openssh.enable = true; + # Enable the OpenSSH daemon. + services.openssh.enable = true; - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 22 ]; - networking.firewall.allowedUDPPorts = [ 22 ]; - # Or disable the firewall altogether. - #networking.firewall.enable = false; + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [22]; + networking.firewall.allowedUDPPorts = [22]; + # Or disable the firewall altogether. + #networking.firewall.enable = false; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? - nix = { - settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - auto-optimise-store = true; - substituters = [ - "https://hyprland.cachix.org" - "https://nix-gaming.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - }; + nix = { + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + substituters = [ + "https://hyprland.cachix.org" + "https://nix-gaming.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + }; }