diff --git a/base/common_hardware.nix b/base/common_hardware.nix index 5f019da..5af3cba 100644 --- a/base/common_hardware.nix +++ b/base/common_hardware.nix @@ -1,175 +1,175 @@ -{ - mkDashDefault, - pkgs, - config, - lib, - hostName, - modulesPath, - ... -}: let - username = config.conf.username; -in { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - wsl.enable = mkDashDefault config.conf.wsl; - - # Bootloader. - boot = lib.mkIf (!config.conf.wsl) { - consoleLogLevel = mkDashDefault 0; - - lanzaboote = lib.mkIf config.conf.secureBoot { - enable = mkDashDefault true; - pkiBundle = mkDashDefault "/var/lib/sbctl"; - settings.reboot-for-bitlocker = mkDashDefault true; - }; - - loader = { - systemd-boot = { - enable = - if config.conf.secureBoot - then lib.mkForce false - else if config.conf.useSystemdBootloader - then true - else mkDashDefault false; - configurationLimit = 5; - }; - efi.canTouchEfiVariables = mkDashDefault true; - }; - - kernelPackages = mkDashDefault pkgs.linuxPackages_latest; - initrd = { - verbose = mkDashDefault false; - availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - ]; - }; - kernelParams = - [ - ''resume="PARTLABEL=SWAP"'' - ''quiet'' - ''udev.log_level=3'' - ] - ++ config.conf.bootParams; - }; - - networking = { - useDHCP = mkDashDefault true; - networkmanager.enable = mkDashDefault true; - hostName = mkDashDefault hostName; - }; - - time = { - timeZone = mkDashDefault config.conf.timezone; - hardwareClockInLocalTime = mkDashDefault config.conf.systemLocalTime; - }; - - i18n.defaultLocale = mkDashDefault config.conf.locale; - - services = { - lorri.enable = mkDashDefault true; - xserver.enable = mkDashDefault true; - fstrim.enable = mkDashDefault true; - pulseaudio.enable = mkDashDefault false; - pipewire = { - enable = mkDashDefault true; - alsa = { - enable = mkDashDefault true; - support32Bit = mkDashDefault true; - }; - jack.enable = mkDashDefault true; - pulse.enable = mkDashDefault true; - }; - }; - - nixpkgs.hostPlatform = mkDashDefault config.conf.system; - nix = { - gc = { - automatic = mkDashDefault true; - dates = mkDashDefault "weekly"; - options = mkDashDefault "--delete-older-than 7d --delete-generations +5"; - }; - settings = { - trusted-users = [username]; - auto-optimise-store = mkDashDefault true; - - builders-use-substitutes = mkDashDefault true; - - substituters = [ - "https://chaotic-nyx.cachix.org/" - ]; - - trusted-substituters = [ - "https://hyprland.cachix.org" - "https://anyrun.cachix.org" - "https://oxipaste.cachix.org" - "https://oxinoti.cachix.org" - "https://oxishut.cachix.org" - "https://oxidash.cachix.org" - "https://oxicalc.cachix.org" - "https://hyprdock.cachix.org" - "https://reset.cachix.org" - ]; - - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" - "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" - "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" - "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" - "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" - "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" - "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" - "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" - "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8=" - ]; - - experimental-features = mkDashDefault "nix-command flakes pipe-operators"; - }; - }; - - hardware = { - cpu.${config.conf.cpu}.updateMicrocode = - mkDashDefault - config.hardware.enableRedistributableFirmware; - }; - - security.rtkit.enable = mkDashDefault true; - - environment.variables = { - XDG_CACHE_HOME = mkDashDefault "$HOME/.cache"; - DIRENV_LOG_FORMAT = mkDashDefault ""; - QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; - }; - - # allows user change later on - users = { - mutableUsers = mkDashDefault true; - users.${username} = { - isNormalUser = mkDashDefault true; - description = mkDashDefault username; - extraGroups = [ - "networkmanager" - "wheel" - "gamemode" - "docker" - "vboxusers" - "video" - "audio" - ]; - packages = with pkgs; [ - home-manager - xdg-desktop-portal-gtk - ]; - # this password will only last for the first login - # e.g. login, then change to whatever else, this also ensures no public hash is available - password = mkDashDefault "firstlogin"; - }; - }; -} +{ + mkDashDefault, + pkgs, + config, + lib, + hostName, + modulesPath, + ... +}: let + username = config.conf.username; +in { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + wsl.enable = mkDashDefault config.conf.wsl; + + # Bootloader. + boot = lib.mkIf (!config.conf.wsl) { + consoleLogLevel = mkDashDefault 0; + + lanzaboote = lib.mkIf config.conf.secureBoot { + enable = mkDashDefault true; + pkiBundle = mkDashDefault "/var/lib/sbctl"; + settings.reboot-for-bitlocker = mkDashDefault true; + }; + + loader = { + systemd-boot = { + enable = + if config.conf.secureBoot + then lib.mkForce false + else if config.conf.useSystemdBootloader + then true + else mkDashDefault false; + configurationLimit = 5; + }; + efi.canTouchEfiVariables = mkDashDefault true; + }; + + kernelPackages = mkDashDefault pkgs.linuxPackages_latest; + initrd = { + verbose = mkDashDefault false; + availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + }; + kernelParams = + [ + ''resume="PARTLABEL=SWAP"'' + ''quiet'' + ''udev.log_level=3'' + ] + ++ config.conf.bootParams; + }; + + networking = { + useDHCP = mkDashDefault true; + networkmanager.enable = mkDashDefault true; + hostName = mkDashDefault hostName; + }; + + time = { + timeZone = mkDashDefault config.conf.timezone; + hardwareClockInLocalTime = mkDashDefault config.conf.systemLocalTime; + }; + + i18n.defaultLocale = mkDashDefault config.conf.locale; + + services = { + lorri.enable = mkDashDefault true; + xserver.enable = mkDashDefault true; + fstrim.enable = mkDashDefault true; + pulseaudio.enable = mkDashDefault false; + pipewire = { + enable = mkDashDefault true; + alsa = { + enable = mkDashDefault true; + support32Bit = mkDashDefault true; + }; + jack.enable = mkDashDefault true; + pulse.enable = mkDashDefault true; + }; + }; + + nixpkgs.hostPlatform = mkDashDefault config.conf.system; + nix = { + gc = { + automatic = mkDashDefault true; + dates = mkDashDefault "weekly"; + options = mkDashDefault "--delete-older-than 7d --delete-generations +5"; + }; + settings = { + trusted-users = [username]; + auto-optimise-store = mkDashDefault true; + + builders-use-substitutes = mkDashDefault true; + + substituters = [ + "https://chaotic-nyx.cachix.org/" + ]; + + trusted-substituters = [ + "https://hyprland.cachix.org" + "https://anyrun.cachix.org" + "https://oxipaste.cachix.org" + "https://oxinoti.cachix.org" + "https://oxishut.cachix.org" + "https://oxidash.cachix.org" + "https://oxicalc.cachix.org" + "https://hyprdock.cachix.org" + "https://reset.cachix.org" + ]; + + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" + "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" + "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" + "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" + "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" + "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" + "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" + "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" + "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8=" + ]; + + experimental-features = mkDashDefault "nix-command flakes pipe-operators"; + }; + }; + + hardware = { + cpu.${config.conf.cpu}.updateMicrocode = + mkDashDefault + config.hardware.enableRedistributableFirmware; + }; + + security.rtkit.enable = mkDashDefault true; + + environment.variables = { + XDG_CACHE_HOME = mkDashDefault "$HOME/.cache"; + DIRENV_LOG_FORMAT = mkDashDefault ""; + QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; + }; + + # allows user change later on + users = { + mutableUsers = mkDashDefault true; + users.${username} = { + isNormalUser = mkDashDefault true; + description = mkDashDefault username; + extraGroups = [ + "networkmanager" + "wheel" + "gamemode" + "docker" + "vboxusers" + "video" + "audio" + ]; + packages = with pkgs; [ + home-manager + xdg-desktop-portal-gtk + ]; + # this password will only last for the first login + # e.g. login, then change to whatever else, this also ensures no public hash is available + password = mkDashDefault "firstlogin"; + }; + }; +} diff --git a/base/env.nix b/base/env.nix index 7937030..0eaf068 100644 --- a/base/env.nix +++ b/base/env.nix @@ -1,24 +1,24 @@ -{ - mkDashDefault, - pkgs, - config, - lib, - ... -}: { - environment = { - variables = { - GSETTINGS_SCHEMA_DIR = mkDashDefault "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; - NEOVIDE_MAXIMIZED = mkDashDefault "0"; - GPG_TTY = mkDashDefault "$(tty)"; - EDITOR = mkDashDefault "neovide --no-fork"; - SUDO_EDITOR = mkDashDefault "neovide --no-fork"; - SCRIPTS = mkDashDefault "$HOME/.config/scripts"; - }; - sessionVariables = { - NIXOS_OZONE_WL = mkDashDefault "1"; - GOPATH = mkDashDefault "$HOME/.go"; - FLAKE = mkDashDefault config.conf.nixosConfigPath; - NH_FLAKE = mkDashDefault config.conf.nixosConfigPath; - }; - }; -} +{ + mkDashDefault, + pkgs, + config, + lib, + ... +}: { + environment = { + variables = { + GSETTINGS_SCHEMA_DIR = mkDashDefault "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; + NEOVIDE_MAXIMIZED = mkDashDefault "0"; + GPG_TTY = mkDashDefault "$(tty)"; + EDITOR = mkDashDefault "neovide --no-fork"; + SUDO_EDITOR = mkDashDefault "neovide --no-fork"; + SCRIPTS = mkDashDefault "$HOME/.config/scripts"; + }; + sessionVariables = { + NIXOS_OZONE_WL = mkDashDefault "1"; + GOPATH = mkDashDefault "$HOME/.go"; + FLAKE = mkDashDefault config.conf.nixosConfigPath; + NH_FLAKE = mkDashDefault config.conf.nixosConfigPath; + }; + }; +} diff --git a/base/xkb_layout.nix b/base/xkb_layout.nix index ce87b6e..b399693 100644 --- a/base/xkb_layout.nix +++ b/base/xkb_layout.nix @@ -1,23 +1,23 @@ -{ - mkDashDefault, - pkgs, - ... -}: let - layout = pkgs.writeText "enIntUmlaut" '' - xkb_symbols "enIntUmlaut" - { - include "us(basic)" - include "level3(ralt_switch)" - key { [ a, A, adiaeresis, Adiaeresis ] }; - key { [ o, O, odiaeresis, Odiaeresis ] }; - key { [ u, U, udiaeresis, Udiaeresis ] }; - }; - ''; -in { - environment.systemPackages = mkDashDefault [pkgs.xorg.xkbcomp]; - services.xserver.xkb.extraLayouts.enIntUmlaut = { - description = "US layout with 'umlaut'"; - languages = ["eng"]; - symbolsFile = "${layout}"; - }; -} +{ + mkDashDefault, + pkgs, + ... +}: let + layout = pkgs.writeText "enIntUmlaut" '' + xkb_symbols "enIntUmlaut" + { + include "us(basic)" + include "level3(ralt_switch)" + key { [ a, A, adiaeresis, Adiaeresis ] }; + key { [ o, O, odiaeresis, Odiaeresis ] }; + key { [ u, U, udiaeresis, Udiaeresis ] }; + }; + ''; +in { + environment.systemPackages = mkDashDefault [pkgs.xorg.xkbcomp]; + services.xserver.xkb.extraLayouts.enIntUmlaut = { + description = "US layout with 'umlaut'"; + languages = ["eng"]; + symbolsFile = "${layout}"; + }; +} diff --git a/docs/src/README.md b/docs/src/README.md index fabdf0b..6233312 100644 --- a/docs/src/README.md +++ b/docs/src/README.md @@ -1,4 +1,3 @@ -
![Logo of DashNix](logo.svg) @@ -7,7 +6,6 @@ An opinionated flake to bootstrap NixOS systems with default configurations for various programs and services from both NixOS and HomeManager which can be enabled, disabled, configured or replaced at will. - # Usage This flake is intended to be used as an input to your own NixOS configuration: @@ -57,26 +55,52 @@ Here is a minimal required configuration.nix (the TODOs mention a required chang ```nix {config, ...}: { + # TODO denote important changes + # variables for system - # TODO important changes conf = { - # change this to your monitor and your pc name - # should be something like DP-1 - defaultMonitor = "YOURMONITOR"; - # width x height @ refreshrate - defaultMonitorMode = "1920x1080@60"; - # scale for your main monitor - defaultMonitorScale = "1"; - # your username + # TODO your username username = "YOURNAME"; # TODO only needed when you use intel -> amd is default # cpu = "intel"; + # TODO your xkb layout locale = "something.UTF-8"; + # TODO your timezone timezone = "CONTINENT/CITY"; }; + # modules mods = { # default disk config has root home boot and swap partition, overwrite if you want something different + sops.enable = false; + nextcloud.enable = false; + hypr.hyprland = { + # TODO monitor configuration for hyprland (hyprland is default) + # should be something like DP-1 + defaultMonitor = "YOURMONITOR"; + # width x height @ refreshrate + defaultMonitorMode = "1920x1080@60"; + # scale for your main monitor + defaultMonitorScale = "1"; + # additional configruation can be done as well + # customConfig = { + # monitor = [ + # # default + # "${config.mods.hypr.hyprland.defaultMonitor},${config.mods.hypr.hyprland.defaultMonitorMode},0x0,${config.mods.hypr.hyprland.defaultMonitorScale}" + # # second example monitor + # "DP-2,3440x1440@180,auto,1" + # # all others + # ",highrr,auto,1" + # ]; + # } + }; + gpu.nvidia.enable = true; + kdeConnect.enable = true; + # login manager: + # default is greetd + # greetd = { }; + # sddm = { }; + # gdm = { }; drives = { # default assumes ROOT, BOOT, HOME and SWAP labaled drives exist # for an example without HOME see below @@ -99,29 +123,9 @@ Here is a minimal required configuration.nix (the TODOs mention a required chang # }; # } # ]; - # You can also use disko to format your disks on installation. + # You can also use disko to format your disks on installation. # Please refer to the Documentation about the drives module for an example. }; - sops.enable = false; - nextcloud.enable = false; - # default hyprland monitor config -> uncomment when necessary - # TODO: Add more monitors when needed - # hyprland.monitor = [ - # # default - # "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" - # # second example monitor - # "DP-2,3440x1440@180,auto,1" - # # all others - # ",highrr,auto,1" - # ]; - # or amd, whatever you have - gpu.nvidia.enable = true; - kdeConnect.enable = true; - # login manager: - # default is greetd - # greetd = { }; - # sddm = { }; - # gdm = { }; }; } ``` @@ -186,7 +190,7 @@ This can be done with the overridePkgs flag for the lib function: ``` You can now place your systems in the respective directories. -Keep in mind that the hosts directory will still need to exist in each variant. +Keep in mind that the hosts directory will still need to exist in each variant. E.g. stable/hosts/yourserver and unstable/hosts/yourdesktop # Installation @@ -212,7 +216,7 @@ Installation via manual configuration: ```sh sudo nixos-install --flake # --root #example -#nixos-install --flake ~/config#globi --root /mnt +#nixos-install --flake ~/config#globi --root /mnt ``` Installation via disko: diff --git a/example/hosts/example/configuration.nix b/example/hosts/example/configuration.nix index b08e1c0..3567918 100644 --- a/example/hosts/example/configuration.nix +++ b/example/hosts/example/configuration.nix @@ -1,71 +1,43 @@ {config, ...}: { + # TODO denote important changes + # variables for system - # TODO important changes conf = { - # change this to your monitor and your pc name - # should be something like DP-1 - defaultMonitor = "YOURMONITOR"; - # width x height @ refreshrate - defaultMonitorMode = "1920x1080@60"; - # scale for your main monitor - defaultMonitorScale = "1"; - # your username + # TODO your username username = "YOURNAME"; # TODO only needed when you use intel -> amd is default # cpu = "intel"; + # TODO your xkb layout locale = "something.UTF-8"; + # TODO your timezone timezone = "CONTINENT/CITY"; }; + # modules mods = { # default disk config has root home boot and swap partition, overwrite if you want something different - drives = { - # WARNING: Only do this when installing for the first time, as I am not sure if disko would format your disk - variant = "disko"; - # default assumes ROOT, BOOT, HOME and SWAP labaled drives exist - # for an example without HOME see below - #defaultDrives.enable = false; - #extraDrives = [ - # { - # name = "boot"; - # drive = { - # device = "/dev/disk/by-label/BOOT"; - # fsType = "vfat"; - # options = [ - # "rw" - # "fmask=0022" - # "dmask=0022" - # "noatime" - # ]; - # }; - # } - # { - # name = ""; - # drive = { - # device = "/dev/disk/by-label/ROOT"; - # fsType = "ext4"; - # options = [ - # "noatime" - # "nodiratime" - # "discard" - # ]; - # }; - # } - #]; - }; sops.enable = false; nextcloud.enable = false; - # default hyprland monitor config -> uncomment when necessary - # TODO: Add more monitors when needed - # hyprland.monitor = [ - # # default - # "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" - # # second example monitor - # "DP-2,3440x1440@180,auto,1" - # # all others - # ",highrr,auto,1" - # ]; - # or amd, whatever you have + hypr.hyprland = { + # TODO monitor configuration for hyprland (hyprland is default) + # should be something like DP-1 + defaultMonitor = "YOURMONITOR"; + # width x height @ refreshrate + defaultMonitorMode = "1920x1080@60"; + # scale for your main monitor + defaultMonitorScale = "1"; + # additional configruation can be done as well + # customConfig = { + # monitor = [ + # # default + # "${config.mods.hypr.hyprland.defaultMonitor},${config.mods.hypr.hyprland.defaultMonitorMode},0x0,${config.mods.hypr.hyprland.defaultMonitorScale}" + # # second example monitor + # "DP-2,3440x1440@180,auto,1" + # # all others + # ",highrr,auto,1" + # ]; + # } + }; gpu.nvidia.enable = true; kdeConnect.enable = true; # login manager: @@ -73,5 +45,30 @@ # greetd = { }; # sddm = { }; # gdm = { }; + drives = { + # default assumes ROOT, BOOT, HOME and SWAP labaled drives exist + # for an example without HOME see below + # defaultDrives.enable = false; + # extraDrives = [ + # { + # name = "boot"; + # drive = { + # device = "/dev/disk/by-label/BOOT"; + # fsType = "vfat"; + # options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ]; + # }; + # } + # { + # name = ""; + # drive = { + # device = "/dev/disk/by-label/ROOT"; + # fsType = "ext4"; + # options = [ "noatime" "nodiratime" "discard" ]; + # }; + # } + # ]; + # You can also use disko to format your disks on installation. + # Please refer to the Documentation about the drives module for an example. + }; }; } diff --git a/flake.nix b/flake.nix index 154187a..893527f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,130 +1,123 @@ -{ - description = "DashNix"; - - inputs = { - unstable.url = "github:NixOs/nixpkgs/nixos-unstable"; - stable.url = "github:NixOs/nixpkgs/nixos-24.11"; - nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; - nur.url = "github:nix-community/NUR"; - lanzaboote = { - url = "github:nix-community/lanzaboote/v0.4.2"; - inputs.nixpkgs.follows = "unstable"; - }; - - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "unstable"; - }; - - sops-nix.url = "github:Mic92/sops-nix"; - - Hyprspace = { - url = "github:KZDKM/Hyprspace"; - inputs.hyprland.follows = "hyprland"; - }; - - hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - - ironbar = { - url = "github:JakeStanger/ironbar"; - inputs.nixpkgs.follows = "unstable"; - }; - - zen-browser.url = "github:youwen5/zen-browser-flake"; - - # TODO move to upstream repository after merged nix flake pr - fancontrol.url = "git+https://github.com/DashieTM/fancontrol-gui?ref=nix-flake"; - - stylix.url = "github:danth/stylix"; - base16.url = "github:SenchoPens/base16.nix"; - disko.url = "github:nix-community/disko/latest"; - - anyrun.url = "github:Kirottu/anyrun"; - oxicalc.url = "github:Xetibo/OxiCalc"; - oxishut.url = "github:Xetibo/OxiShut"; - oxinoti.url = "github:Xetibo/OxiNoti"; - oxidash.url = "github:Xetibo/OxiDash"; - oxipaste.url = "github:Xetibo/OxiPaste"; - oxirun.url = "github:Xetibo/OxiRun"; - hyprdock.url = "github:Xetibo/hyprdock"; - reset.url = "github:Xetibo/ReSet"; - reset-plugins.url = "github:Xetibo/ReSet-Plugins"; - - # absolute insanity - chaoticNyx.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; - - dashvim = { - url = "github:Xetibo/DashVim"; - }; - }; - - outputs = {self, ...} @ inputs: let - currentSystem = "x86_64-linux"; - permittedPackages = [ - "olm-3.2.16" - # well done dotnet... - # this is just for omnisharp - "dotnet-core-combined" - "dotnet-wrapped-combined" - "dotnet-combined" - "dotnet-sdk-6.0.428" - "dotnet-sdk-wrapped-6.0.428" - "dotnet-sdk-6.0.136" - "dotnet-sdk-wrapped-6.0.136" - "dotnet-sdk-7.0.120" - "dotnet-sdk-wrapped-7.0.120" - "dotnet-sdk-7.0.410" - "dotnet-sdk-wrapped-7.0.410" - "jitsi-meet-1.0.8043" - "nextcloud-27.1.11" - ]; - stable = import inputs.stable { - system = currentSystem; - config = { - allowUnfree = true; - permittedInsecurePackages = permittedPackages; - }; - overlays = [ - inputs.nur.overlays.default - inputs.chaoticNyx.overlays.default - ]; - }; - unstable = import inputs.unstable { - system = currentSystem; - config = { - allowUnsupportedSystem = true; - permittedInsecurePackages = permittedPackages; - # Often happens with neovim, this should not block everything. - allowBroken = true; - allowUnfree = true; - }; - overlays = [ - inputs.nur.overlays.default - inputs.chaoticNyx.overlays.default - ]; - }; - in rec { - dashNixLib = import ./lib { - inherit - self - inputs - unstable - stable - ; - system = currentSystem; - lib = inputs.unstable.lib; - }; - docs = import ./docs { - inherit inputs; - pkgs = unstable; - system = currentSystem; - lib = inputs.unstable.lib; - buildSystems = dashNixLib.buildSystems; - }; - dashNixInputs = inputs; - stablePkgs = stable; - unstablePkgs = unstable; - modules = ./modules; - iso = dashNixLib.buildIso.config.system.build.isoImage; - }; -} +{ + description = "DashNix"; + + inputs = { + unstable.url = "github:NixOs/nixpkgs/nixos-unstable"; + stable.url = "github:NixOs/nixpkgs/nixos-24.11"; + nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; + nur.url = "github:nix-community/NUR"; + lanzaboote = { + url = "github:nix-community/lanzaboote/v0.4.2"; + inputs.nixpkgs.follows = "unstable"; + }; + + # Darkreader requires es20, hence a stable pin + pkgsDarkreader.url = "github:NixOs/nixpkgs/nixos-24.11"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "unstable"; + }; + + sops-nix.url = "github:Mic92/sops-nix"; + + Hyprspace = { + url = "github:KZDKM/Hyprspace"; + inputs.hyprland.follows = "hyprland"; + }; + + hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + + ironbar = { + url = "github:JakeStanger/ironbar"; + inputs.nixpkgs.follows = "unstable"; + }; + + zen-browser.url = "github:youwen5/zen-browser-flake"; + + # TODO move to upstream repository after merged nix flake pr + fancontrol.url = "git+https://github.com/DashieTM/fancontrol-gui?ref=nix-flake"; + + stylix.url = "github:danth/stylix"; + base16.url = "github:SenchoPens/base16.nix"; + disko.url = "github:nix-community/disko/latest"; + + anyrun.url = "github:Kirottu/anyrun"; + oxicalc.url = "github:Xetibo/OxiCalc"; + oxishut.url = "github:Xetibo/OxiShut"; + oxinoti.url = "github:Xetibo/OxiNoti"; + oxidash.url = "github:Xetibo/OxiDash"; + oxipaste.url = "github:Xetibo/OxiPaste"; + oxirun.url = "github:Xetibo/OxiRun"; + hyprdock.url = "github:Xetibo/hyprdock"; + reset.url = "github:Xetibo/ReSet"; + reset-plugins.url = "github:Xetibo/ReSet-Plugins"; + + # absolute insanity + chaoticNyx.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + + dashvim = { + url = "github:Xetibo/DashVim"; + }; + }; + + outputs = {self, ...} @ inputs: let + currentSystem = "x86_64-linux"; + permittedPackages = [ + "olm-3.2.16" + # well done dotnet... + # this is just for omnisharp + "dotnet-core-combined" + "dotnet-wrapped-combined" + "dotnet-combined" + "dotnet-sdk-6.0.428" + "dotnet-sdk-wrapped-6.0.428" + "dotnet-sdk-6.0.136" + "dotnet-sdk-wrapped-6.0.136" + "dotnet-sdk-7.0.120" + "dotnet-sdk-wrapped-7.0.120" + "dotnet-sdk-7.0.410" + "dotnet-sdk-wrapped-7.0.410" + "jitsi-meet-1.0.8043" + "nextcloud-27.1.11" + ]; + stable = import ./lib/importPkgs.nix { + inherit inputs permittedPackages currentSystem; + pkgs = inputs.stable; + }; + unstable = import ./lib/importPkgs.nix { + inherit inputs permittedPackages currentSystem; + pkgs = inputs.unstable; + }; + pkgsDarkreader = import ./lib/importPkgs.nix { + inherit inputs permittedPackages currentSystem; + pkgs = inputs.pkgsDarkreader; + }; + in rec { + dashNixLib = import ./lib { + inherit + self + inputs + unstable + stable + ; + dashNixAdditionalProps = { + inherit pkgsDarkreader; + }; + system = currentSystem; + lib = inputs.unstable.lib; + }; + docs = import ./docs { + inherit inputs; + pkgs = unstable; + system = currentSystem; + lib = inputs.unstable.lib; + buildSystems = dashNixLib.buildSystems; + }; + dashNixInputs = inputs; + stablePkgs = stable; + unstablePkgs = unstable; + modules = ./modules; + iso = dashNixLib.buildIso.config.system.build.isoImage; + }; +} diff --git a/home/common.nix b/home/common.nix index 11be1e2..1a3ccf3 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,41 +1,41 @@ -{ - mkDashDefault, - config, - lib, - ... -}: let - username = config.conf.username; -in { - manual = { - html.enable = mkDashDefault false; - json.enable = mkDashDefault false; - manpages.enable = mkDashDefault false; - }; - - fonts.fontconfig.enable = mkDashDefault true; - - home = { - username = mkDashDefault username; - homeDirectory = mkDashDefault "/home/${username}"; - sessionPath = ["$HOME/.cargo/bin"]; - - enableNixpkgsReleaseCheck = mkDashDefault false; - sessionVariables = { - GOROOT = mkDashDefault "$HOME/.go"; - QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; - }; - - keyboard = mkDashDefault null; - }; - - programs.nix-index = { - enable = mkDashDefault true; - enableFishIntegration = mkDashDefault true; - }; - - nix = { - extraOptions = lib.mkIf (config ? sops.secrets && config.sops.secrets ? access.path) '' - !include ${config.sops.secrets.access.path} - ''; - }; -} +{ + mkDashDefault, + config, + lib, + ... +}: let + username = config.conf.username; +in { + manual = { + html.enable = mkDashDefault false; + json.enable = mkDashDefault false; + manpages.enable = mkDashDefault false; + }; + + fonts.fontconfig.enable = mkDashDefault true; + + home = { + username = mkDashDefault username; + homeDirectory = mkDashDefault "/home/${username}"; + sessionPath = ["$HOME/.cargo/bin"]; + + enableNixpkgsReleaseCheck = mkDashDefault false; + sessionVariables = { + GOROOT = mkDashDefault "$HOME/.go"; + QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; + }; + + keyboard = mkDashDefault null; + }; + + programs.nix-index = { + enable = mkDashDefault true; + enableFishIntegration = mkDashDefault true; + }; + + nix = { + extraOptions = lib.mkIf (config ? sops.secrets && config.sops.secrets ? access.path) '' + !include ${config.sops.secrets.access.path} + ''; + }; +} diff --git a/home/default.nix b/home/default.nix index af3d656..8b6d079 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,49 +1,59 @@ -{ - mkDashDefault, - additionalHomeConfig, - additionalHomeMods, - additionalInputs, - config, - homeMods, - inputs, - lib, - mod, - pkgs, - root, - alternativePkgs, - system, - stable, - unstable, - ... -}: { - xdg = { - portal.config.common.default = mkDashDefault "*"; - portal = { - enable = mkDashDefault true; - extraPortals = [pkgs.xdg-desktop-portal-gtk]; - }; - }; - home-manager = { - useGlobalPkgs = mkDashDefault true; - useUserPackages = mkDashDefault true; - extraSpecialArgs = { - inherit inputs root additionalInputs alternativePkgs system stable unstable; - mkDashDefault = import ../lib/override.nix {inherit lib;}; - }; - - users.${config.conf.username} = { - disabledModules = ["programs/anyrun.nix"]; - imports = - [ - ./common.nix - ./themes - ./sync.nix - ../lib/foxwrappers.nix - ] - ++ homeMods - ++ additionalHomeMods - ++ lib.optional (builtins.pathExists mod) mod - ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig; - }; - }; -} +{ + mkDashDefault, + additionalHomeConfig, + additionalHomeMods, + additionalInputs, + dashNixAdditionalProps, + config, + homeMods, + inputs, + lib, + mod, + pkgs, + root, + alternativePkgs, + system, + stable, + unstable, + ... +}: { + xdg = { + portal.config.common.default = mkDashDefault "*"; + portal = { + enable = mkDashDefault true; + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + }; + }; + home-manager = { + useGlobalPkgs = mkDashDefault true; + useUserPackages = mkDashDefault true; + extraSpecialArgs = { + inherit + inputs + root + additionalInputs + alternativePkgs + system + stable + unstable + dashNixAdditionalProps + ; + mkDashDefault = import ../lib/override.nix {inherit lib;}; + }; + + users.${config.conf.username} = { + disabledModules = ["programs/anyrun.nix"]; + imports = + [ + ./common.nix + ./themes + ./sync.nix + ../lib/foxwrappers.nix + ] + ++ homeMods + ++ additionalHomeMods + ++ lib.optional (builtins.pathExists mod) mod + ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig; + }; + }; +} diff --git a/home/themes/firefoxTheme.nix b/home/themes/firefoxTheme.nix index 91c5804..c73f07c 100644 --- a/home/themes/firefoxTheme.nix +++ b/home/themes/firefoxTheme.nix @@ -289,37 +289,41 @@ } ''; browsername = config.mods.homePackages.browser; - profiles = - if config.mods.homePackages.browser == "firefox" then - config.mods.browser.firefox.profiles - else if config.mods.homePackages.browser == "zen" then - config.mods.browser.zen.profiles - else if config.mods.homePackages.browser == "librewolf" then - [{name = "default"; value = {};}] - else - []; + profiles = + if config.mods.homePackages.browser == "firefox" + then config.mods.browser.firefox.profiles + else if config.mods.homePackages.browser == "zen" + then config.mods.browser.zen.profiles + else if config.mods.homePackages.browser == "librewolf" + then [ + { + name = "default"; + value = {}; + } + ] + else []; profileNamesFn = builtins.catAttrs "name"; chromesFn = builtins.map ( name: - if (builtins.isString browsername) - then { - ".${browsername}/${name}/chrome/userContent.css" = { - text = userChrome; - }; + if (builtins.isString browsername) + then { + ".${browsername}/${name}/chrome/userContent.css" = { + text = userChrome; + }; - ".${browsername}/${name}/chrome/userChrome.css" = { - text = userContent; - }; - } - else {} + ".${browsername}/${name}/chrome/userChrome.css" = { + text = userContent; + }; + } + else {} ); moduleFn = lib.lists.foldr (attr1: attr2: attr1 // attr2) {}; - mkFirefoxTheme = (profiles: - profiles - |> profileNamesFn - |> chromesFn - |> moduleFn - ); -in - {home.file = mkFirefoxTheme profiles;} + mkFirefoxTheme = ( + profiles: + profiles + |> profileNamesFn + |> chromesFn + |> moduleFn + ); +in {home.file = mkFirefoxTheme profiles;} diff --git a/lib/default.nix b/lib/default.nix index 79bc9f4..40a924a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,144 +1,146 @@ -{ - inputs, - lib, - unstable, - self, - stable, - system, - ... -}: { - /* - * - # buildSystems - - Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. - - A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. - - The second parameter is the root of your configuration, which should be ./. in most cases. - - `root` - - : the root path of your configuration - - # Example usage - :::{.example} - ```nix - nixosConfigurations = buildSystems { root = ./.; }; - ``` - ::: - */ - # let - # paths = builtins.readDir ; - # names = lib.lists.remove "default" ( - # map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths) - # ); - - # in - buildSystems = { - root, - additionalMods ? { - nixos = []; - home = []; - }, - mods ? { - nixos = [ - inputs.lanzaboote.nixosModules.lanzaboote - inputs.nixos-wsl.nixosModules.default - inputs.home-manager.nixosModules.home-manager - inputs.stylix.nixosModules.stylix - inputs.disko.nixosModules.disko - ../base - ../home - ../modules - ]; - home = [ - inputs.anyrun.homeManagerModules.default - inputs.ironbar.homeManagerModules.default - inputs.oxicalc.homeManagerModules.default - inputs.oxishut.homeManagerModules.default - inputs.oxinoti.homeManagerModules.default - inputs.oxidash.homeManagerModules.default - inputs.oxipaste.homeManagerModules.default - inputs.oxirun.homeManagerModules.default - inputs.hyprdock.homeManagerModules.default - inputs.hyprland.homeManagerModules.default - inputs.reset.homeManagerModules.default - inputs.sops-nix.homeManagerModules.sops - inputs.dashvim.homeManagerModules.dashvim - inputs.fancontrol.homeManagerModules.default - ../modules - ]; - }, - additionalInputs ? {}, - overridePkgs ? false, - ... - }: - builtins.listToAttrs ( - map - (name: { - name = name; - value = let - mod = root + /hosts/${name}/configuration.nix; - additionalNixosConfig = root + /hosts/${name}/hardware.nix; - additionalHomeConfig = root + /hosts/${name}/home.nix; - args = { - inherit - self - inputs - mod - additionalHomeConfig - system - root - stable - unstable - ; - pkgs = lib.mkForce ( - if overridePkgs - then stable - else unstable - ); - alternativePkgs = - if overridePkgs - then unstable - else stable; - hostName = name; - homeMods = mods.home; - additionalHomeMods = additionalMods.home; - additionalInputs = additionalInputs; - mkDashDefault = import ./override.nix {inherit lib;}; - }; - in - inputs.unstable.lib.nixosSystem { - modules = - [ - {_module.args = args;} - mod - ] - ++ mods.nixos - ++ additionalMods.nixos - ++ inputs.unstable.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig - ++ inputs.unstable.lib.optional (builtins.pathExists mod) mod; - }; - }) - ( - lib.lists.remove "" ( - lib.attrsets.mapAttrsToList (name: fType: - if fType == "directory" - then name - else "") ( - builtins.readDir (root + /hosts) - ) - ) - ) - ); - - buildIso = inputs.unstable.lib.nixosSystem { - specialArgs = { - inherit self inputs unstable; - }; - modules = [ - ../iso/configuration.nix - ]; - }; -} +{ + inputs, + lib, + unstable, + self, + stable, + system, + dashNixAdditionalProps ? {}, + ... +}: { + /* + * + # buildSystems + + Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. + + A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. + + The second parameter is the root of your configuration, which should be ./. in most cases. + + `root` + + : the root path of your configuration + + # Example usage + :::{.example} + ```nix + nixosConfigurations = buildSystems { root = ./.; }; + ``` + ::: + */ + # let + # paths = builtins.readDir ; + # names = lib.lists.remove "default" ( + # map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths) + # ); + + # in + buildSystems = { + root, + additionalMods ? { + nixos = []; + home = []; + }, + mods ? { + nixos = [ + inputs.lanzaboote.nixosModules.lanzaboote + inputs.nixos-wsl.nixosModules.default + inputs.home-manager.nixosModules.home-manager + inputs.stylix.nixosModules.stylix + inputs.disko.nixosModules.disko + ../base + ../home + ../modules + ]; + home = [ + inputs.anyrun.homeManagerModules.default + inputs.ironbar.homeManagerModules.default + inputs.oxicalc.homeManagerModules.default + inputs.oxishut.homeManagerModules.default + inputs.oxinoti.homeManagerModules.default + inputs.oxidash.homeManagerModules.default + inputs.oxipaste.homeManagerModules.default + inputs.oxirun.homeManagerModules.default + inputs.hyprdock.homeManagerModules.default + inputs.hyprland.homeManagerModules.default + inputs.reset.homeManagerModules.default + inputs.sops-nix.homeManagerModules.sops + inputs.dashvim.homeManagerModules.dashvim + inputs.fancontrol.homeManagerModules.default + ../modules + ]; + }, + additionalInputs ? {}, + overridePkgs ? false, + ... + }: + builtins.listToAttrs ( + map + (name: { + name = name; + value = let + mod = root + /hosts/${name}/configuration.nix; + additionalNixosConfig = root + /hosts/${name}/hardware.nix; + additionalHomeConfig = root + /hosts/${name}/home.nix; + args = { + inherit + self + inputs + mod + additionalHomeConfig + system + root + stable + unstable + additionalInputs + dashNixAdditionalProps + ; + pkgs = lib.mkForce ( + if overridePkgs + then stable + else unstable + ); + alternativePkgs = + if overridePkgs + then unstable + else stable; + hostName = name; + homeMods = mods.home; + additionalHomeMods = additionalMods.home; + mkDashDefault = import ./override.nix {inherit lib;}; + }; + in + inputs.unstable.lib.nixosSystem { + modules = + [ + {_module.args = args;} + mod + ] + ++ mods.nixos + ++ additionalMods.nixos + ++ inputs.unstable.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig + ++ inputs.unstable.lib.optional (builtins.pathExists mod) mod; + }; + }) + ( + lib.lists.remove "" ( + lib.attrsets.mapAttrsToList (name: fType: + if fType == "directory" + then name + else "") ( + builtins.readDir (root + /hosts) + ) + ) + ) + ); + + buildIso = inputs.unstable.lib.nixosSystem { + specialArgs = { + inherit self inputs unstable; + }; + modules = [ + ../iso/configuration.nix + ]; + }; +} diff --git a/modules/programs/browser/ffextensions.nix b/lib/foxextensions.nix similarity index 85% rename from modules/programs/browser/ffextensions.nix rename to lib/foxextensions.nix index 27b1598..48603de 100644 --- a/modules/programs/browser/ffextensions.nix +++ b/lib/foxextensions.nix @@ -1,6 +1,6 @@ { lib, - stable, + dashNixAdditionalProps, pkgs, name, ... @@ -24,9 +24,16 @@ in { (mkExtension "@react-devtools" "https://addons.mozilla.org/firefox/downloads/latest/react-devtools/latest.xpi") (mkExtension "extension@redux.devtools" "https://addons.mozilla.org/firefox/downloads/latest/reduxdevtools/latest.xpi") (mkExtension "private-relay@firefox.com" "https://addons.mozilla.org/firefox/downloads/latest/private-relay/latest.xpi") - (mkExtension "addon@darkreader.org" "file://${pkgs.callPackage ../../../patches/darkreader.nix {inherit lib stable;}}/latest.xpi") + (mkExtension "addon@darkreader.org" "file://${pkgs.callPackage ../patches/darkreader.nix {inherit lib dashNixAdditionalProps;}}/latest.xpi") + ]; + example = [ + { + "78272b6fa58f4a1abaac99321d503a20@proton.me" = { + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/proton-pass/latest.xpi"; + installation_mode = "normal_installed"; + }; + } ]; - example = []; type = with lib.types; listOf anything; description = '' List of extensions via attrsets: diff --git a/lib/importPkgs.nix b/lib/importPkgs.nix new file mode 100644 index 0000000..5ce6aad --- /dev/null +++ b/lib/importPkgs.nix @@ -0,0 +1,17 @@ +{ + inputs, + currentSystem, + permittedPackages, + pkgs, +}: +import pkgs { + system = currentSystem; + config = { + allowUnfree = true; + permittedInsecurePackages = permittedPackages; + }; + overlays = [ + inputs.nur.overlays.default + inputs.chaoticNyx.overlays.default + ]; +} diff --git a/modules/conf.nix b/modules/conf.nix index 93ec67e..472e002 100644 --- a/modules/conf.nix +++ b/modules/conf.nix @@ -1,199 +1,173 @@ -{ - lib, - config, - options, - ... -}: { - options.conf = { - system = lib.mkOption { - default = "x86_64-linux"; - # no fisherprice unix support - type = with lib.types; (enum [ - "x86_64-linux" - "aarch64-linux" - "aarch64-linux-android" - ]); - example = "aarch64-linux"; - description = '' - System architecture. - ''; - }; - - systemLocalTime = lib.mkOption { - default = false; - example = true; - description = '' - System time for dualbooting - ''; - }; - - wsl = lib.mkOption { - default = false; - example = true; - description = '' - Runs Nix in wsl - ''; - }; - - secureBoot = lib.mkOption { - default = false; - example = true; - description = '' - enables secure boot. - Note: Secure boot is NOT reproducible - Here are the necessary steps: - + create your keys with sbctl -> sudo sbctl create-keys - + build with systemd once -> set this to false and build once - + build with secureBoot true - + verify that your keys are signed (note, only systemd and your generations should now be signed): sudo sbtcl verify - + enroll your keys (microsoft is necessary for windows dualboot support, leave it there): sudo sbctl enroll-keys --microsoft - + reboot with secureboot enabled - Note: Some motherboards have vendor specific keys for secure boot, this may not necessarily work with our self signed keys - You likely have to disable these vendor specific keys (example HP: sure boot) - ''; - }; - - useSystemdBootloader = lib.mkOption { - default = true; - example = false; - description = '' - use systemd bootloader. - ''; - }; - - cpu = lib.mkOption { - # TODO: how to enable arm? - default = "amd"; - type = with lib.types; (enum [ - "amd" - "intel" - ]); - example = "intel"; - description = '' - cpu microcode. - ''; - }; - - additionalBootKernalParams = lib.mkOption { - default = [ - "video=${config.conf.defaultMonitor}:${config.conf.defaultMonitorMode}" - ]; - example = []; - type = with lib.types; listOf str; - description = '' - additional kernelParams passed to bootloader - ''; - }; - - defaultMonitor = lib.mkOption { - default = ""; - example = "eDP-1"; - type = lib.types.str; - description = '' - main monitor - ''; - }; - - defaultMonitorMode = lib.mkOption { - default = ""; - example = "3440x1440@180"; - type = lib.types.str; - description = '' - main monitor mode: width x height @ refreshrate - ''; - }; - - defaultMonitorScale = lib.mkOption { - default = "1"; - example = "1.5"; - type = lib.types.str; - description = '' - main monitor scaling - ''; - }; - - bootParams = lib.mkOption { - default = []; - example = ["resume=something"]; - type = with lib.types; listOf str; - description = '' - Boot params - ''; - }; - - kernelOverride = lib.mkOption { - default = null; - type = with lib.types; nullOr package; - description = '' - kernel to be used - Has no examples as doc complains... - #example = pkgs.linuxPackages_xanmod_latest; - ''; - }; - - username = lib.mkOption { - default = "DashNix"; - example = "pingpang"; - type = lib.types.str; - description = '' - The username. - ''; - }; - - timezone = lib.mkOption { - default = "Europe/Zurich"; - example = "Europe/Berlin"; - type = lib.types.str; - description = '' - The timezone. - ''; - }; - - locale = lib.mkOption { - default = "en_US.UTF-8"; - example = "de_DE.UTF-8"; - type = lib.types.str; - description = '' - The locale. - ''; - }; - - nixosConfigPath = lib.mkOption { - default = "/home/${config.conf.username}/gits/nixos/."; - example = "yourpath/."; - type = lib.types.str; - description = '' - The path for your build command, you can then simply type rebuild to switch to a new configuration. - ''; - }; - - systemStateVersion = lib.mkOption { - example = "24.11"; - default = "23.05"; - type = lib.types.str; - description = '' - System state version - ''; - }; - homeStateVersion = lib.mkOption { - default = "24.11"; - example = "23.05"; - type = lib.types.str; - description = '' - Home state version - ''; - }; - }; - - config = - (lib.optionalAttrs (options ? system.stateVersion) { - boot = { - kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel; - kernelParams = config.conf.additionalBootKernalParams; - }; - system.stateVersion = config.conf.systemStateVersion; - }) - // (lib.optionalAttrs (options ? home.stateVersion) { - home.stateVersion = config.conf.homeStateVersion; - }); -} +{ + lib, + config, + options, + ... +}: { + options.conf = { + system = lib.mkOption { + default = "x86_64-linux"; + # no fisherprice unix support + type = with lib.types; (enum [ + "x86_64-linux" + "aarch64-linux" + "aarch64-linux-android" + ]); + example = "aarch64-linux"; + description = '' + System architecture. + ''; + }; + + systemLocalTime = lib.mkOption { + default = false; + example = true; + description = '' + System time for dualbooting + ''; + }; + + wsl = lib.mkOption { + default = false; + example = true; + description = '' + Runs Nix in wsl + ''; + }; + + secureBoot = lib.mkOption { + default = false; + example = true; + description = '' + enables secure boot. + Note: Secure boot is NOT reproducible + Here are the necessary steps: + + create your keys with sbctl -> sudo sbctl create-keys + + build with systemd once -> set this to false and build once + + build with secureBoot true + + verify that your keys are signed (note, only systemd and your generations should now be signed): sudo sbtcl verify + + enroll your keys (microsoft is necessary for windows dualboot support, leave it there): sudo sbctl enroll-keys --microsoft + + reboot with secureboot enabled + Note: Some motherboards have vendor specific keys for secure boot, this may not necessarily work with our self signed keys + You likely have to disable these vendor specific keys (example HP: sure boot) + ''; + }; + + useSystemdBootloader = lib.mkOption { + default = true; + example = false; + description = '' + use systemd bootloader. + ''; + }; + + cpu = lib.mkOption { + # TODO: how to enable arm? + default = "amd"; + type = with lib.types; (enum [ + "amd" + "intel" + ]); + example = "intel"; + description = '' + cpu microcode. + ''; + }; + + additionalBootKernalParams = lib.mkOption { + default = [ + # TODO test if needed + #"video=${config.conf.defaultMonitor}:${config.conf.defaultMonitorMode}" + ]; + example = []; + type = with lib.types; listOf str; + description = '' + additional kernelParams passed to bootloader + ''; + }; + + bootParams = lib.mkOption { + default = []; + example = ["resume=something"]; + type = with lib.types; listOf str; + description = '' + Boot params + ''; + }; + + kernelOverride = lib.mkOption { + default = null; + type = with lib.types; nullOr package; + description = '' + kernel to be used + Has no examples as doc complains... + #example = pkgs.linuxPackages_xanmod_latest; + ''; + }; + + username = lib.mkOption { + default = "DashNix"; + example = "pingpang"; + type = lib.types.str; + description = '' + The username. + ''; + }; + + timezone = lib.mkOption { + default = "Europe/Zurich"; + example = "Europe/Berlin"; + type = lib.types.str; + description = '' + The timezone. + ''; + }; + + locale = lib.mkOption { + default = "en_US.UTF-8"; + example = "de_DE.UTF-8"; + type = lib.types.str; + description = '' + The locale. + ''; + }; + + nixosConfigPath = lib.mkOption { + default = "/home/${config.conf.username}/gits/nixos/."; + example = "yourpath/."; + type = lib.types.str; + description = '' + The path for your build command, you can then simply type rebuild to switch to a new configuration. + ''; + }; + + systemStateVersion = lib.mkOption { + example = "24.11"; + default = "23.05"; + type = lib.types.str; + description = '' + System state version + ''; + }; + homeStateVersion = lib.mkOption { + default = "24.11"; + example = "23.05"; + type = lib.types.str; + description = '' + Home state version + ''; + }; + }; + + config = + (lib.optionalAttrs (options ? system.stateVersion) { + boot = { + kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel; + kernelParams = config.conf.additionalBootKernalParams; + }; + system.stateVersion = config.conf.systemStateVersion; + }) + // (lib.optionalAttrs (options ? home.stateVersion) { + home.stateVersion = config.conf.homeStateVersion; + }); +} diff --git a/modules/programs/anyrun.nix b/modules/programs/anyrun.nix new file mode 100644 index 0000000..46f4d5c --- /dev/null +++ b/modules/programs/anyrun.nix @@ -0,0 +1,144 @@ +{ + mkDashDefault, + lib, + config, + pkgs, + options, + inputs, + ... +}: { + options.mods.anyrun = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables anyrun"; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured anyrun config. + ''; + }; + customConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom anyrun configuration. + Will be merged with default configuration if enabled. + ''; + }; + useDefaultCss = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured anyrun css. + ''; + }; + customCss = lib.mkOption { + default = ''''; + example = '' + #window { + border-radius: none; + } + ''; + type = lib.types.lines; + description = '' + Custom anyrun css. + Will be merged with default css if enabled. + ''; + }; + }; + + config = lib.mkIf config.mods.anyrun.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.anyrun = lib.mkForce { + enable = true; + config = + if config.mods.anyrun.useDefaultConfig + then + lib.mkMerge + [ + { + plugins = [ + inputs.anyrun.packages.${pkgs.system}.applications + inputs.anyrun.packages.${pkgs.system}.rink + inputs.anyrun.packages.${pkgs.system}.translate + inputs.anyrun.packages.${pkgs.system}.websearch + ]; + hideIcons = mkDashDefault false; + width = { + fraction = mkDashDefault 0.3; + }; + y = { + fraction = mkDashDefault 0.5; + }; + layer = mkDashDefault "overlay"; + hidePluginInfo = mkDashDefault true; + closeOnClick = mkDashDefault true; + } + config.mods.anyrun.customConfig + ] + else config.mods.anyrun.customConfig; + + extraCss = + if config.mods.anyrun.useDefaultCss + then + '' + #window { + border-radius: 10px; + background-color: transparent; + } + + box#main { + border-radius: 10px; + } + + list#main { + border-radius: 10px; + margin: 0px 10px 10px 10px; + } + + list#plugin { + border-radius: 10px; + } + + list#match { + border-radius: 10px; + } + + entry#entry { + border: 0; + border-radius: 10px; + margin: 10px 10px 0px 10px; + } + + label#match-desc { + font-size: 12px; + border-radius: 10px; + } + + label#match-title { + font-size: 12px; + border-radius: 10px; + } + + label#plugin { + font-size: 16px; + border-radius: 10px; + } + + * { + border-radius: 10px; + } + '' + + config.mods.anyrun.customCss + else config.mods.anyrun.customCss; + }; + } + ); +} diff --git a/modules/programs/basePackages.nix b/modules/programs/basePackages.nix index eb21428..4a2d157 100644 --- a/modules/programs/basePackages.nix +++ b/modules/programs/basePackages.nix @@ -1,128 +1,131 @@ -{ - mkDashDefault, - config, - lib, - options, - pkgs, - ... -}: { - options.mods = { - basePackages = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables default system packages. - ''; - }; - additionalPackages = lib.mkOption { - default = []; - example = [pkgs.openssl]; - type = with lib.types; listOf package; - description = '' - Additional packages to install. - Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. - ''; - }; - specialPrograms = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - special program configuration to be added which require programs.something notation. - ''; - }; - specialServices = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - special services configuration to be added which require an services.something notation. - ''; - }; - }; - }; - - config = lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = - if config.mods.basePackages.enable - then - with pkgs; - [ - adwaita-icon-theme - dbus - dconf - direnv - glib - gnome.nixos-gsettings-overrides - gsettings-desktop-schemas - gtk-layer-shell - gtk3 - gtk4 - gtk4-layer-shell - hicolor-icon-theme - icon-library - kdePackages.breeze-icons - kdePackages.breeze - libsForQt5.breeze-qt5 - kdePackages.qtstyleplugin-kvantum - libsForQt5.qtstyleplugin-kvantum - libadwaita - libxkbcommon - alejandra - openssl - seahorse - upower - xorg.xkbutils - sbctl - ] - ++ config.mods.basePackages.additionalPackages - else config.mods.basePackages.additionalPackages; - - gtk.iconCache.enable = false; - services = - if config.mods.basePackages.enable - then - { - preload.enable = mkDashDefault true; - upower.enable = mkDashDefault true; - dbus = { - enable = mkDashDefault true; - }; - avahi = { - enable = mkDashDefault true; - nssmdns4 = mkDashDefault true; - openFirewall = mkDashDefault true; - }; - } - // config.mods.basePackages.specialServices - else config.mods.basePackages.specialServices; - - programs = - if config.mods.basePackages.enable - then - { - nix-ld = { - enable = mkDashDefault true; - libraries = with pkgs; [ - jdk - zlib - ]; - }; - direnv = { - package = mkDashDefault pkgs.direnv; - silent = mkDashDefault false; - loadInNixShell = mkDashDefault true; - direnvrcExtra = mkDashDefault ""; - nix-direnv = { - enable = mkDashDefault true; - package = mkDashDefault pkgs.nix-direnv; - }; - }; - gnupg.agent.enable = mkDashDefault true; - } - // config.mods.basePackages.specialPrograms - else config.mods.basePackages.specialPrograms; - }; -} +{ + mkDashDefault, + config, + lib, + options, + pkgs, + ... +}: { + options.mods = { + basePackages = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables default system packages. + ''; + }; + additionalPackages = lib.mkOption { + default = []; + example = [pkgs.openssl]; + type = with lib.types; listOf package; + description = '' + Additional packages to install. + Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. + ''; + }; + specialPrograms = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + specialServices = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; + }; + }; + + config = lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = + if config.mods.basePackages.enable + then + with pkgs; + [ + adwaita-icon-theme + dbus + dconf + direnv + glib + gnome.nixos-gsettings-overrides + gsettings-desktop-schemas + gtk-layer-shell + gtk3 + gtk4 + gtk4-layer-shell + hicolor-icon-theme + icon-library + kdePackages.breeze-icons + kdePackages.breeze + libsForQt5.breeze-qt5 + kdePackages.qtstyleplugin-kvantum + libsForQt5.qtstyleplugin-kvantum + libadwaita + libxkbcommon + alejandra + openssl + seahorse + upower + xorg.xkbutils + sbctl + ] + ++ config.mods.basePackages.additionalPackages + else config.mods.basePackages.additionalPackages; + + gtk.iconCache.enable = mkDashDefault false; + services = + if config.mods.basePackages.enable + then + { + preload.enable = mkDashDefault true; + upower.enable = mkDashDefault true; + dbus = { + enable = mkDashDefault true; + }; + avahi = { + enable = mkDashDefault true; + nssmdns4 = mkDashDefault true; + openFirewall = mkDashDefault true; + }; + } + // config.mods.basePackages.specialServices + else config.mods.basePackages.specialServices; + + programs = + if config.mods.basePackages.enable + then + lib.mkMerge + [ + { + nix-ld = { + enable = mkDashDefault true; + libraries = with pkgs; [ + jdk + zlib + ]; + }; + direnv = { + package = mkDashDefault pkgs.direnv; + silent = mkDashDefault false; + loadInNixShell = mkDashDefault true; + direnvrcExtra = mkDashDefault ""; + nix-direnv = { + enable = mkDashDefault true; + package = mkDashDefault pkgs.nix-direnv; + }; + }; + gnupg.agent.enable = mkDashDefault true; + } + config.mods.basePackages.specialPrograms + ] + else config.mods.basePackages.specialPrograms; + }; +} diff --git a/modules/programs/bluetooth.nix b/modules/programs/bluetooth.nix index e09b382..f0e2ef1 100644 --- a/modules/programs/bluetooth.nix +++ b/modules/programs/bluetooth.nix @@ -1,4 +1,5 @@ { + mkDashDefault, lib, config, options, @@ -18,8 +19,8 @@ config = lib.mkIf config.mods.bluetooth.enable ( lib.optionalAttrs (options ? hardware.bluetooth) { hardware.bluetooth = { - enable = true; - powerOnBoot = true; + enable = mkDashDefault true; + powerOnBoot = mkDashDefault true; }; } ); diff --git a/modules/programs/browser/firefox.nix b/modules/programs/browser/firefox.nix index f48f098..5a0abac 100644 --- a/modules/programs/browser/firefox.nix +++ b/modules/programs/browser/firefox.nix @@ -1,16 +1,16 @@ { lib, + dashNixAdditionalProps, config, options, pkgs, - stable, ... }: let name = "firefox"; in { imports = [ - (import ./ffextensions.nix - {inherit lib stable pkgs name;}) + (import ../../../lib/foxextensions.nix + {inherit lib dashNixAdditionalProps pkgs name;}) ]; options.mods.browser.${name} = { enable = lib.mkOption { diff --git a/modules/programs/browser/librewolf.nix b/modules/programs/browser/librewolf.nix index d0d77ac..79f67af 100644 --- a/modules/programs/browser/librewolf.nix +++ b/modules/programs/browser/librewolf.nix @@ -1,16 +1,16 @@ { lib, + dashNixAdditionalProps, config, options, pkgs, - stable, ... }: let name = "librewolf"; in { imports = [ - (import ./ffextensions.nix - {inherit lib stable pkgs name;}) + (import ../../../lib/foxextensions.nix + {inherit lib dashNixAdditionalProps pkgs name;}) ]; options.mods.browser.${name} = { enable = lib.mkOption { diff --git a/modules/programs/browser/zen.nix b/modules/programs/browser/zen.nix index 080a3cc..571edf3 100644 --- a/modules/programs/browser/zen.nix +++ b/modules/programs/browser/zen.nix @@ -1,140 +1,140 @@ -# credits to Voronind for darkreader config https://github.com/voronind-com/nix/blob/main/home/program/firefox/default.nix -{ - lib, - config, - options, - inputs, - stable, - system, - pkgs, - ... -}: let - # at time of using this here, stylix might not be evaluated yet - # hence ensure it is by using base16 mkSchemeAttrs - base16 = pkgs.callPackage inputs.base16.lib {}; - scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; - name = "zen"; -in { - imports = [ - (import ./ffextensions.nix - {inherit lib stable pkgs name;}) - ]; - options.mods.browser.${name} = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables the zen browser"; - }; - configuration = lib.mkOption { - default = { - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - DisablePocket = true; - CaptivePortal = false; - DisableFirefoxStudies = true; - DisableTelemetry = true; - NoDefaultBookmarks = true; - PasswordManagerEnabled = false; - FirefoxHome = { - Search = true; - Pocket = false; - Snippets = false; - TopSites = true; - Highlights = false; - }; - UserMessaging = { - ExtensionRecommendations = false; - SkipOnboarding = true; - }; - "3rdparty".Extensions = { - "addon@darkreader.org" = { - theme = { - darkSchemeBackgroundColor = "#${scheme.base00}"; - darkSchemeTextColor = "#${scheme.base05}"; - }; - previewNewDesign = true; - }; - }; - }; - example = {}; - type = with lib.types; attrsOf anything; - description = "Zen policy configuration. See https://mozilla.github.io/policy-templates for more information."; - }; - profiles = lib.mkOption { - default = [ - { - name = "${config.conf.username}"; - value = { - settings = { - "zen.view.compact.hide-tabbar" = false; - "zen.view.compact.hide-toolbar" = true; - "zen.view.sidebar-expanded" = false; - "zen.view.use-single-toolbar" = false; - "zen.view.welcome-screen.seen" = true; - "zen.theme.accent-color" = "#b4bbff"; - "extensions.autoDisableScopes" = 0; - "cookiebanners.service.mode" = 2; - }; - isDefault = true; - id = 0; - }; - } - { - name = "special"; - value = { - settings = { - "zen.view.compact.hide-tabbar" = false; - "zen.view.compact.hide-toolbar" = true; - "zen.view.sidebar-expanded" = false; - "zen.view.use-single-toolbar" = false; - "zen.view.welcome-screen.seen" = true; - "zen.theme.accent-color" = "#b4bbff"; - "extensions.autoDisableScopes" = 0; - }; - isDefault = false; - id = 1; - }; - } - ]; - example = [ - { - name = "custom"; - value = { - settings = { - extensions.autoDisableScopes = 0; - }; - extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader]; - isDefault = true; - id = 0; - }; - } - ]; - type = with lib.types; listOf (attrsOf anything); - description = "Zen profiles"; - }; - }; - config = lib.mkIf (config.mods.browser.zen.enable || config.mods.homePackages.browser == "zen") ( - lib.optionalAttrs (options ? home.packages) { - programs.zen-browser = { - enable = true; - package = - pkgs.wrapFirefox - inputs.zen-browser.packages.${system}.zen-browser-unwrapped - { - pname = "zen-browser"; - extraPolicies = - config.mods.browser.zen.configuration - // { - ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} config.mods.browser.zen.extensions; - }; - }; - profiles = builtins.listToAttrs config.mods.browser.zen.profiles; - }; - } - ); -} +# credits to Voronind for darkreader config https://github.com/voronind-com/nix/blob/main/home/program/firefox/default.nix +{ + lib, + dashNixAdditionalProps, + config, + options, + inputs, + system, + pkgs, + ... +}: let + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + name = "zen"; +in { + imports = [ + (import ../../../lib/foxextensions.nix + {inherit lib dashNixAdditionalProps pkgs name;}) + ]; + options.mods.browser.${name} = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables the zen browser"; + }; + configuration = lib.mkOption { + default = { + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + CaptivePortal = false; + DisableFirefoxStudies = true; + DisableTelemetry = true; + NoDefaultBookmarks = true; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = true; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + "3rdparty".Extensions = { + "addon@darkreader.org" = { + theme = { + darkSchemeBackgroundColor = "#${scheme.base00}"; + darkSchemeTextColor = "#${scheme.base05}"; + }; + previewNewDesign = true; + }; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Zen policy configuration. See https://mozilla.github.io/policy-templates for more information."; + }; + profiles = lib.mkOption { + default = [ + { + name = "${config.conf.username}"; + value = { + settings = { + "zen.view.compact.hide-tabbar" = false; + "zen.view.compact.hide-toolbar" = true; + "zen.view.sidebar-expanded" = false; + "zen.view.use-single-toolbar" = false; + "zen.view.welcome-screen.seen" = true; + "zen.theme.accent-color" = "#b4bbff"; + "extensions.autoDisableScopes" = 0; + "cookiebanners.service.mode" = 2; + }; + isDefault = true; + id = 0; + }; + } + { + name = "special"; + value = { + settings = { + "zen.view.compact.hide-tabbar" = false; + "zen.view.compact.hide-toolbar" = true; + "zen.view.sidebar-expanded" = false; + "zen.view.use-single-toolbar" = false; + "zen.view.welcome-screen.seen" = true; + "zen.theme.accent-color" = "#b4bbff"; + "extensions.autoDisableScopes" = 0; + }; + isDefault = false; + id = 1; + }; + } + ]; + example = [ + { + name = "custom"; + value = { + settings = { + extensions.autoDisableScopes = 0; + }; + extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader]; + isDefault = true; + id = 0; + }; + } + ]; + type = with lib.types; listOf (attrsOf anything); + description = "Zen profiles"; + }; + }; + config = lib.mkIf (config.mods.browser.zen.enable || config.mods.homePackages.browser == "zen") ( + lib.optionalAttrs (options ? home.packages) { + programs.zen-browser = { + enable = true; + package = + pkgs.wrapFirefox + inputs.zen-browser.packages.${system}.zen-browser-unwrapped + { + pname = "zen-browser"; + extraPolicies = + config.mods.browser.zen.configuration + // { + ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} config.mods.browser.zen.extensions; + }; + }; + profiles = builtins.listToAttrs config.mods.browser.zen.profiles; + }; + } + ); +} diff --git a/modules/programs/coding.nix b/modules/programs/coding.nix index 781d9dd..f845a1d 100644 --- a/modules/programs/coding.nix +++ b/modules/programs/coding.nix @@ -1,567 +1,568 @@ -{ - lib, - config, - pkgs, - options, - ... -}: let - font_family = "${config.mods.stylix.fonts.monospace.name}"; -in { - options.mods = { - coding = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables coding packages. - ''; - }; - dashvim = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables dashvim package. - ''; - }; - jetbrains = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Enables jetbrains toolbox. - ''; - }; - vscodium = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Enables vscodium. - ''; - }; - extensions = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = "Extensions to be installed"; - }; - }; - penpot = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables penpot"; - }; - neovide = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables neovide"; - }; - config = lib.mkOption { - default = { - font = { - size = 12; - normal = { - family = font_family; - style = ""; - }; - bold = { - family = font_family; - style = "ExtraBold"; - }; - italic = { - family = font_family; - style = "Italic"; - }; - bold_italic = { - family = font_family; - style = "Bold Italic"; - }; - }; - }; - example = {}; - type = with lib.types; attrsOf anything; - description = "Config for neovide"; - }; - }; - gh = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables and configures gh"; - }; - config = lib.mkOption { - default = { - version = 1; - git_protocol = "ssh"; - editor = ""; - prompt = "enabled"; - prefer_editor_prompt = "disabled"; - pager = ""; - aliases = { - co = "pr checkout"; - }; - http_unix_socket = ""; - browser = ""; - }; - example = {}; - type = with lib.types; attrsOf anything; - description = "config for gh. Keep in mind, empty values refer to using environment variables"; - }; - hosts = lib.mkOption { - default = { - "github.com" = { - git_protocol = "ssh"; - users = { - ${config.mods.git.username} = ""; - }; - user = "${config.mods.git.username}"; - }; - }; - example = {}; - type = with lib.types; attrsOf anything; - description = "hosts for gh"; - }; - }; - useDefaultPackages = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Use default base packages (only additionalPackages are installed if false)"; - }; - additionalPackages = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = "Additional packages to be installed"; - }; - languages = { - haskell = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables haskell. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - haskellPackages.cabal-install - ghc - haskellPackages.haskell-language-server - ]; - example = []; - type = with lib.types; listOf package; - description = '' - haskell packages - ''; - }; - }; - typst = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables typst. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - typst - tinymist - ltex-ls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - typst packages - ''; - }; - }; - go = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables go. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - go - gopls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - Go packages - ''; - }; - }; - rust = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables rust. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [rustup]; - example = []; - type = with lib.types; listOf package; - description = '' - Rust packages - ''; - }; - }; - ts-js = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables TS/JS. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - nodejs_20 - deno - typescript - nodePackages.typescript-language-server - nodePackages.prettier - ]; - example = []; - type = with lib.types; listOf package; - description = '' - TS/JS packages - ''; - }; - }; - zig = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables zig. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - zig - zls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - zig packages - ''; - }; - }; - java = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables java. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - gradle - maven - jdt-language-server - temurin-jre-bin - ]; - example = []; - type = with lib.types; listOf package; - description = '' - Java packages - ''; - }; - }; - dotnet = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables C#/F#. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - #.! - dotnet-sdk - omnisharp-roslyn - csharpier - netcoredbg - fsharp - fsautocomplete - ]; - example = []; - type = with lib.types; listOf package; - description = '' - C#/F# packages - ''; - }; - }; - C-CPP = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables C/C++. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - bear - gdb - gcc - clang-tools - ]; - example = []; - type = with lib.types; listOf package; - description = '' - C/C++ packages - ''; - }; - }; - python = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables python. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - python3 - python312Packages.python-lsp-server - python312Packages.python-lsp-ruff - python312Packages.python-lsp-black - ]; - example = []; - type = with lib.types; listOf package; - description = '' - python packages - ''; - }; - }; - configFiles = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables Json/toml/yaml etc. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - #yaml - yamlfmt - yamllint - yaml-language-server - - #json - jq - ]; - example = []; - type = with lib.types; listOf package; - description = '' - packages for said filetypes - ''; - }; - }; - bash = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables bash. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - bash-language-server - shfmt - ]; - example = []; - type = with lib.types; listOf package; - description = '' - bash packages - ''; - }; - }; - html-css = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables html/css. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - tailwindcss - tailwindcss-language-server - # html-tidy - ]; - example = []; - type = with lib.types; listOf package; - description = '' - html/css packages - ''; - }; - }; - sql = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables sql. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - nodePackages.sql-formatter - sqls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - sql packages - ''; - }; - }; - gleam = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables gleam. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [gleam]; - example = []; - type = with lib.types; listOf package; - description = '' - gleam packages - ''; - }; - }; - asm = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables assembly. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [asm-lsp]; - example = []; - type = with lib.types; listOf package; - description = '' - assembly packages - ''; - }; - }; - }; - }; - }; - - config = let - basePackages = with pkgs; [ - gitui - meson - ninja - tree-sitter - unzip - pkg-config - sqlite - plantuml - d-spy - tmux - tmate - ]; - in - lib.mkIf config.mods.coding.enable ( - lib.optionalAttrs (options ? home.packages) { - programs.dashvim = lib.mkIf config.mods.coding.dashvim { - enable = true; - colorscheme = config.mods.stylix.colorscheme; - }; - programs.vscode = lib.mkIf config.mods.coding.vscodium.enable { - enable = true; - package = pkgs.vscodium; - profiles.default.extensions = config.mods.coding.vscodium.extensions; - }; - xdg.configFile."neovide/config.toml" = lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) { - source = - (pkgs.formats.toml {}).generate "neovide" - config.mods.coding.neovide.config; - }; - - xdg.configFile."gh/config.yml" = lib.mkIf config.mods.coding.gh.enable { - source = - (pkgs.formats.yaml {}).generate "config" - config.mods.coding.gh.config; - }; - xdg.configFile."gh/hosts.yml" = lib.mkIf config.mods.coding.gh.enable { - source = - (pkgs.formats.yaml {}).generate "hosts" - config.mods.coding.gh.hosts; - }; - - home.packages = with pkgs; - [ - (lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) neovide) - (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) - (lib.mkIf config.mods.coding.penpot pkgs.penpot-desktop) - (lib.mkIf config.mods.coding.gh.enable gh) - ] - ++ config.mods.coding.additionalPackages - ++ (lib.lists.optionals config.mods.coding.useDefaultPackages basePackages) - ++ (lib.lists.optionals config.mods.coding.languages.haskell.enable config.mods.coding.languages.haskell.packages) - ++ (lib.lists.optionals config.mods.coding.languages.rust.enable config.mods.coding.languages.rust.packages) - ++ (lib.lists.optionals config.mods.coding.languages.go.enable config.mods.coding.languages.go.packages) - ++ (lib.lists.optionals config.mods.coding.languages.java.enable config.mods.coding.languages.java.packages) - ++ (lib.lists.optionals config.mods.coding.languages.dotnet.enable config.mods.coding.languages.dotnet.packages) - ++ (lib.lists.optionals config.mods.coding.languages.bash.enable config.mods.coding.languages.bash.packages) - ++ (lib.lists.optionals config.mods.coding.languages.C-CPP.enable config.mods.coding.languages.C-CPP.packages) - ++ (lib.lists.optionals config.mods.coding.languages.asm.enable config.mods.coding.languages.asm.packages) - ++ (lib.lists.optionals config.mods.coding.languages.sql.enable config.mods.coding.languages.sql.packages) - ++ (lib.lists.optionals config.mods.coding.languages.html-css.enable config.mods.coding.languages.html-css.packages) - ++ (lib.lists.optionals config.mods.coding.languages.configFiles.enable config.mods.coding.languages.configFiles.packages) - ++ (lib.lists.optionals config.mods.coding.languages.ts-js.enable config.mods.coding.languages.ts-js.packages) - ++ (lib.lists.optionals config.mods.coding.languages.typst.enable config.mods.coding.languages.typst.packages) - ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages) - ++ (lib.lists.optionals config.mods.coding.languages.gleam.enable config.mods.coding.languages.gleam.packages); - } - ); -} +{ + mkDashDefault, + lib, + config, + pkgs, + options, + ... +}: let + font_family = "${config.mods.stylix.fonts.monospace.name}"; +in { + options.mods = { + coding = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables coding packages. + ''; + }; + dashvim = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables dashvim package. + ''; + }; + jetbrains = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables jetbrains toolbox. + ''; + }; + vscodium = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables vscodium. + ''; + }; + extensions = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = "Extensions to be installed"; + }; + }; + penpot = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables penpot"; + }; + neovide = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables neovide"; + }; + config = lib.mkOption { + default = { + font = { + size = 12; + normal = { + family = font_family; + style = ""; + }; + bold = { + family = font_family; + style = "ExtraBold"; + }; + italic = { + family = font_family; + style = "Italic"; + }; + bold_italic = { + family = font_family; + style = "Bold Italic"; + }; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Config for neovide"; + }; + }; + gh = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables and configures gh"; + }; + config = lib.mkOption { + default = { + version = 1; + git_protocol = "ssh"; + editor = ""; + prompt = "enabled"; + prefer_editor_prompt = "disabled"; + pager = ""; + aliases = { + co = "pr checkout"; + }; + http_unix_socket = ""; + browser = ""; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config for gh. Keep in mind, empty values refer to using environment variables"; + }; + hosts = lib.mkOption { + default = { + "github.com" = { + git_protocol = "ssh"; + users = { + ${config.mods.git.username} = ""; + }; + user = "${config.mods.git.username}"; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "hosts for gh"; + }; + }; + useDefaultPackages = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default base packages (only additionalPackages are installed if false)"; + }; + additionalPackages = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = "Additional packages to be installed"; + }; + languages = { + haskell = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables haskell. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + haskellPackages.cabal-install + ghc + haskellPackages.haskell-language-server + ]; + example = []; + type = with lib.types; listOf package; + description = '' + haskell packages + ''; + }; + }; + typst = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables typst. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + typst + tinymist + ltex-ls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + typst packages + ''; + }; + }; + go = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables go. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + go + gopls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + Go packages + ''; + }; + }; + rust = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables rust. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [rustup]; + example = []; + type = with lib.types; listOf package; + description = '' + Rust packages + ''; + }; + }; + ts-js = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables TS/JS. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + nodejs_20 + deno + typescript + nodePackages.typescript-language-server + nodePackages.prettier + ]; + example = []; + type = with lib.types; listOf package; + description = '' + TS/JS packages + ''; + }; + }; + zig = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables zig. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + zig + zls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + zig packages + ''; + }; + }; + java = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables java. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + gradle + maven + jdt-language-server + temurin-jre-bin + ]; + example = []; + type = with lib.types; listOf package; + description = '' + Java packages + ''; + }; + }; + dotnet = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables C#/F#. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + #.! + dotnet-sdk + omnisharp-roslyn + csharpier + netcoredbg + fsharp + fsautocomplete + ]; + example = []; + type = with lib.types; listOf package; + description = '' + C#/F# packages + ''; + }; + }; + C-CPP = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables C/C++. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + bear + gdb + gcc + clang-tools + ]; + example = []; + type = with lib.types; listOf package; + description = '' + C/C++ packages + ''; + }; + }; + python = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables python. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + python3 + python312Packages.python-lsp-server + python312Packages.python-lsp-ruff + python312Packages.python-lsp-black + ]; + example = []; + type = with lib.types; listOf package; + description = '' + python packages + ''; + }; + }; + configFiles = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables Json/toml/yaml etc. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + #yaml + yamlfmt + yamllint + yaml-language-server + + #json + jq + ]; + example = []; + type = with lib.types; listOf package; + description = '' + packages for said filetypes + ''; + }; + }; + bash = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables bash. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + bash-language-server + shfmt + ]; + example = []; + type = with lib.types; listOf package; + description = '' + bash packages + ''; + }; + }; + html-css = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables html/css. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + tailwindcss + tailwindcss-language-server + # html-tidy + ]; + example = []; + type = with lib.types; listOf package; + description = '' + html/css packages + ''; + }; + }; + sql = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables sql. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + nodePackages.sql-formatter + sqls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + sql packages + ''; + }; + }; + gleam = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables gleam. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [gleam]; + example = []; + type = with lib.types; listOf package; + description = '' + gleam packages + ''; + }; + }; + asm = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables assembly. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [asm-lsp]; + example = []; + type = with lib.types; listOf package; + description = '' + assembly packages + ''; + }; + }; + }; + }; + }; + + config = let + basePackages = with pkgs; [ + gitui + meson + ninja + tree-sitter + unzip + pkg-config + sqlite + plantuml + d-spy + tmux + tmate + ]; + in + lib.mkIf config.mods.coding.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.dashvim = lib.mkIf config.mods.coding.dashvim { + enable = true; + colorscheme = config.mods.stylix.colorscheme; + }; + programs.vscode = lib.mkIf config.mods.coding.vscodium.enable { + enable = true; + package = mkDashDefault pkgs.vscodium; + profiles.default.extensions = config.mods.coding.vscodium.extensions; + }; + xdg.configFile."neovide/config.toml" = lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) { + source = + (pkgs.formats.toml {}).generate "neovide" + config.mods.coding.neovide.config; + }; + + xdg.configFile."gh/config.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "config" + config.mods.coding.gh.config; + }; + xdg.configFile."gh/hosts.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "hosts" + config.mods.coding.gh.hosts; + }; + + home.packages = with pkgs; + [ + (lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) neovide) + (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) + (lib.mkIf config.mods.coding.penpot pkgs.penpot-desktop) + (lib.mkIf config.mods.coding.gh.enable gh) + ] + ++ config.mods.coding.additionalPackages + ++ (lib.lists.optionals config.mods.coding.useDefaultPackages basePackages) + ++ (lib.lists.optionals config.mods.coding.languages.haskell.enable config.mods.coding.languages.haskell.packages) + ++ (lib.lists.optionals config.mods.coding.languages.rust.enable config.mods.coding.languages.rust.packages) + ++ (lib.lists.optionals config.mods.coding.languages.go.enable config.mods.coding.languages.go.packages) + ++ (lib.lists.optionals config.mods.coding.languages.java.enable config.mods.coding.languages.java.packages) + ++ (lib.lists.optionals config.mods.coding.languages.dotnet.enable config.mods.coding.languages.dotnet.packages) + ++ (lib.lists.optionals config.mods.coding.languages.bash.enable config.mods.coding.languages.bash.packages) + ++ (lib.lists.optionals config.mods.coding.languages.C-CPP.enable config.mods.coding.languages.C-CPP.packages) + ++ (lib.lists.optionals config.mods.coding.languages.asm.enable config.mods.coding.languages.asm.packages) + ++ (lib.lists.optionals config.mods.coding.languages.sql.enable config.mods.coding.languages.sql.packages) + ++ (lib.lists.optionals config.mods.coding.languages.html-css.enable config.mods.coding.languages.html-css.packages) + ++ (lib.lists.optionals config.mods.coding.languages.configFiles.enable config.mods.coding.languages.configFiles.packages) + ++ (lib.lists.optionals config.mods.coding.languages.ts-js.enable config.mods.coding.languages.ts-js.packages) + ++ (lib.lists.optionals config.mods.coding.languages.typst.enable config.mods.coding.languages.typst.packages) + ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages) + ++ (lib.lists.optionals config.mods.coding.languages.gleam.enable config.mods.coding.languages.gleam.packages); + } + ); +} diff --git a/modules/programs/containers.nix b/modules/programs/containers.nix index aacf6f4..e65eb06 100644 --- a/modules/programs/containers.nix +++ b/modules/programs/containers.nix @@ -1,4 +1,5 @@ { + mkDashDefault, lib, config, options, @@ -63,8 +64,8 @@ containers.enable = true; podman = { enable = true; - dockerCompat = true; - defaultNetwork.settings.dns_enabled = true; + dockerCompat = mkDashDefault true; + defaultNetwork.settings.dns_enabled = mkDashDefault true; }; } else if (config.mods.containers.variant == "docker") diff --git a/modules/programs/default.nix b/modules/programs/default.nix index fdfb163..5ad3e09 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -1,50 +1,52 @@ -{ - imports = [ - ./acpid.nix - ./basePackages.nix - ./bluetooth.nix - ./browser - ./coding.nix - ./containers.nix - ./drives.nix - ./fancontrol.nix - ./fastfetch.nix - ./fish.nix - ./flatpak.nix - ./gaming.nix - ./gdm.nix - ./git.nix - ./gnome.nix - ./gnomeServices.nix - ./gpu.nix - ./greetd.nix - ./homePackages.nix - ./hyprland - ./kde.nix - ./kdeConnect.nix - ./keepassxc.nix - ./kitty.nix - ./media.nix - ./mime.nix - ./ncspot.nix - ./nextcloud.nix - ./onedrive.nix - ./oxi - ./piper.nix - ./plymouth.nix - ./printing.nix - ./scripts.nix - ./sddm.nix - ./sops.nix - ./starship.nix - ./streamcontroller.nix - ./stylix.nix - ./supersonic.nix - ./sway.nix - ./teams.nix - ./virtmanager.nix - ./xkb.nix - ./xone.nix - ./yazi - ]; -} +{ + imports = [ + ./acpid.nix + ./anyrun.nix + ./basePackages.nix + ./bluetooth.nix + ./browser + ./coding.nix + ./containers.nix + ./drives.nix + ./fancontrol.nix + ./fastfetch.nix + ./fish.nix + ./flatpak.nix + ./gaming.nix + ./gdm.nix + ./git.nix + ./gnome.nix + ./gnomeServices.nix + ./gpu.nix + ./greetd.nix + ./homePackages.nix + ./hypr + ./ironbar.nix + ./kde.nix + ./kdeConnect.nix + ./keepassxc.nix + ./kitty.nix + ./media.nix + ./mime.nix + ./ncspot.nix + ./nextcloud.nix + ./onedrive.nix + ./oxi + ./piper.nix + ./plymouth.nix + ./printing.nix + ./scripts.nix + ./sddm.nix + ./sops.nix + ./starship.nix + ./streamcontroller.nix + ./stylix.nix + ./supersonic.nix + ./sway.nix + ./teams.nix + ./virtmanager.nix + ./xkb.nix + ./xone.nix + ./yazi + ]; +} diff --git a/modules/programs/fancontrol.nix b/modules/programs/fancontrol.nix index f7a2e3a..87be9af 100644 --- a/modules/programs/fancontrol.nix +++ b/modules/programs/fancontrol.nix @@ -1,36 +1,36 @@ -{ - lib, - config, - options, - ... -}: { - options.mods.fancontrol = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables fancontrol-gui with needed drivers"; - }; - forceId = lib.mkOption { - default = null; - example = "force_id=0x8628"; - type = with lib.types; nullOr str; - description = "Modprobe options for the it87 driver. Information at: https://wiki.archlinux.org/title/Lm_sensors#Gigabyte_B250/Z370/B450M/B560M/B660M/Z690/B550_motherboards"; - }; - }; - config = lib.mkIf config.mods.fancontrol.enable ( - lib.optionalAttrs (options ? home.packages) { - programs.fancontrol-gui.enable = true; - } - // (lib.optionalAttrs (options ? boot.kernelModules) { - boot = { - kernelParams = ["acpi_enforce_resources=lax"]; - extraModulePackages = with config.boot.kernelPackages; [liquidtux it87]; - kernelModules = ["v4l2loopback" "it87"]; - extraModprobeConfig = lib.mkIf (config.mods.fancontrol.forceId != null) '' - options it87 ${config.mods.fancontrol.forceId} - ''; - }; - }) - ); -} +{ + lib, + config, + options, + ... +}: { + options.mods.fancontrol = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables fancontrol-gui with needed drivers"; + }; + forceId = lib.mkOption { + default = null; + example = "force_id=0x8628"; + type = with lib.types; nullOr str; + description = "Modprobe options for the it87 driver. Information at: https://wiki.archlinux.org/title/Lm_sensors#Gigabyte_B250/Z370/B450M/B560M/B660M/Z690/B550_motherboards"; + }; + }; + config = lib.mkIf config.mods.fancontrol.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.fancontrol-gui.enable = true; + } + // (lib.optionalAttrs (options ? boot.kernelModules) { + boot = { + kernelParams = ["acpi_enforce_resources=lax"]; + extraModulePackages = with config.boot.kernelPackages; [liquidtux it87]; + kernelModules = ["v4l2loopback" "it87"]; + extraModprobeConfig = lib.mkIf (config.mods.fancontrol.forceId != null) '' + options it87 ${config.mods.fancontrol.forceId} + ''; + }; + }) + ); +} diff --git a/modules/programs/fastfetch.nix b/modules/programs/fastfetch.nix index 9652bf3..71b6218 100644 --- a/modules/programs/fastfetch.nix +++ b/modules/programs/fastfetch.nix @@ -1,66 +1,73 @@ { + mkDashDefault, pkgs, lib, options, config, ... }: { - options.mods = { - dashfetch = lib.mkOption { + options.mods.dashfetch = { + enable = lib.mkOption { default = true; example = false; type = lib.types.bool; description = "A custom configuration for fastfetch"; }; + modules = lib.mkOption { + default = [ + "title" + "separator" + { + type = "os"; + key = "OS"; + format = "DashNix ({name} {version})"; + } + "host" + "kernel" + "uptime" + "packages" + "shell" + "display" + "de" + "wm" + "wmtheme" + "theme" + "icons" + "font" + "cursor" + "terminal" + "terminalfont" + "cpu" + "gpu" + "memory" + "swap" + "disk" + "localip" + "battery" + "poweradapter" + "locale" + "break" + "colors" + ]; + example = []; + type = with lib.types; listOf anything; + description = "modules for fastfetch"; + }; }; config = lib.optionalAttrs (options ? home.packages) { - xdg.configFile."fastfetch/config.jsonc" = lib.mkIf (config.mods.dashfetch) { + xdg.configFile."fastfetch/config.jsonc" = lib.mkIf (config.mods.dashfetch.enable) { source = (pkgs.formats.json {}).generate "config.jsonc" { "$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"; logo = { - type = "kitty"; - source = ../../assets/logo2.png; - width = 35; - padding = { - top = 1; + type = mkDashDefault "kitty"; + source = mkDashDefault ../../assets/logo2.png; + width = mkDashDefault 35; + padding = mkDashDefault { + top = mkDashDefault 1; }; }; - modules = [ - "title" - "separator" - { - type = "os"; - key = "OS"; - format = "DashNix ({name} {version})"; - } - "host" - "kernel" - "uptime" - "packages" - "shell" - "display" - "de" - "wm" - "wmtheme" - "theme" - "icons" - "font" - "cursor" - "terminal" - "terminalfont" - "cpu" - "gpu" - "memory" - "swap" - "disk" - "localip" - "battery" - "poweradapter" - "locale" - "break" - "colors" - ]; + modules = config.mods.dashfetch.modules; }; }; }; diff --git a/modules/programs/gaming.nix b/modules/programs/gaming.nix index 2e235bc..17157ae 100644 --- a/modules/programs/gaming.nix +++ b/modules/programs/gaming.nix @@ -1,4 +1,5 @@ { + mkDashDefault, lib, config, options, @@ -76,27 +77,27 @@ boot.kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos; programs = { - steam.enable = config.mods.gaming.steam; + steam.enable = mkDashDefault config.mods.gaming.steam; gamemode.enable = true; gamemode = { - enableRenice = true; + enableRenice = mkDashDefault true; settings = { general = { - desiredgov = "performance"; + desiredgov = mkDashDefault "performance"; }; cpu = { - pin_cores = config.mods.gaming.pinCores; - park_cores = config.mods.gaming.parkCores; + pin_cores = mkDashDefault config.mods.gaming.pinCores; + park_cores = mkDashDefault config.mods.gaming.parkCores; }; gpu = lib.mkIf config.mods.gaming.gpuOptimization { - apply_gpu_optimisations = "accept-responsibility"; - gpu_device = config.mods.gaming.gpuDevice; - amd_performance_level = "high"; - nv_powermizer_mode = 1; + apply_gpu_optimisations = mkDashDefault "accept-responsibility"; + gpu_device = mkDashDefault config.mods.gaming.gpuDevice; + amd_performance_level = mkDashDefault "high"; + nv_powermizer_mode = mkDashDefault 1; }; custom = { - start = "notify-send -a 'Gamemode' 'Optimizations activated'"; - end = "notify-send -a 'Gamemode' 'Optimizations deactivated'"; + start = mkDashDefault "notify-send -a 'Gamemode' 'Optimizations activated'"; + end = mkDashDefault "notify-send -a 'Gamemode' 'Optimizations deactivated'"; }; }; }; diff --git a/modules/programs/gpu.nix b/modules/programs/gpu.nix index 9bc2a4a..5cd26bf 100644 --- a/modules/programs/gpu.nix +++ b/modules/programs/gpu.nix @@ -67,16 +67,16 @@ environment.variables = if (config.mods.gpu.amdgpu.enable && config.mods.gpu.vapi.rocm.enable) then { - RUSTICL_ENABLE = "radeonsi"; + RUSTICL_ENABLE = mkDashDefault "radeonsi"; } else {}; hardware = { nvidia = lib.mkIf config.mods.gpu.nvidia.enable { - modesetting.enable = true; - open = true; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.beta; + modesetting.enable = mkDashDefault true; + open = mkDashDefault true; + nvidiaSettings = mkDashDefault true; + package = mkDashDefault config.boot.kernelPackages.nvidiaPackages.beta; }; graphics = let amdPackages = [ diff --git a/modules/programs/greetd.nix b/modules/programs/greetd.nix index 01c13a3..064f61b 100644 --- a/modules/programs/greetd.nix +++ b/modules/programs/greetd.nix @@ -1,4 +1,5 @@ { + mkDashDefault, config, lib, inputs, @@ -17,7 +18,7 @@ ''; }; monitor = lib.mkOption { - default = "${config.conf.defaultMonitor}"; + default = "${config.mods.hypr.hyprland.defaultMonitor}"; example = "eDP-1"; type = lib.types.str; description = '' @@ -26,7 +27,7 @@ ''; }; scale = lib.mkOption { - default = "${config.conf.defaultMonitorScale}"; + default = "${config.mods.hypr.hyprland.defaultMonitorScale}"; example = "1.5"; type = lib.types.str; description = '' @@ -45,7 +46,7 @@ description = "The compositor/greeter command to run"; }; resolution = lib.mkOption { - default = "${config.conf.defaultMonitorMode}"; + default = "${config.mods.hypr.hyprland.defaultMonitorMode}"; example = "3440x1440@180"; type = lib.types.str; description = '' @@ -86,16 +87,16 @@ lib.mkIf config.mods.greetd.enable ( lib.optionalAttrs (options ? environment) { # greetd display manager - programs.hyprland.enable = true; + programs.hyprland.enable = mkDashDefault true; services = { displayManager.sessionPackages = config.mods.greetd.environments; greetd = { enable = true; settings = { - terminal.vt = 1; + terminal.vt = mkDashDefault 1; default_session = { - command = config.mods.greetd.greeterCommand; - user = username; + command = mkDashDefault config.mods.greetd.greeterCommand; + user = mkDashDefault username; }; }; }; @@ -129,9 +130,9 @@ ''; # unlock GPG keyring on login - security.pam.services.greetd.enableGnomeKeyring = true; - security.pam.services.greetd.sshAgentAuth = true; - security.pam.sshAgentAuth.enable = true; + security.pam.services.greetd.enableGnomeKeyring = mkDashDefault true; + security.pam.services.greetd.sshAgentAuth = mkDashDefault true; + security.pam.sshAgentAuth.enable = mkDashDefault true; } // lib.optionalAttrs (options ? home) { xdg.configFile."regreet/regreet.toml".source = diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hypr/default.nix similarity index 69% rename from modules/programs/hyprland/default.nix rename to modules/programs/hypr/default.nix index a181f64..68b88ea 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hypr/default.nix @@ -1,8 +1,6 @@ { imports = [ ./hyprland.nix - ./anyrun.nix - ./ironbar.nix ./hyprlock.nix ./hyprpaper.nix ]; diff --git a/modules/programs/hyprland/hyprland.nix b/modules/programs/hypr/hyprland.nix similarity index 76% rename from modules/programs/hyprland/hyprland.nix rename to modules/programs/hypr/hyprland.nix index 5c1fe9a..676b567 100644 --- a/modules/programs/hyprland/hyprland.nix +++ b/modules/programs/hypr/hyprland.nix @@ -1,410 +1,442 @@ -{ - mkDashDefault, - config, - lib, - options, - pkgs, - inputs, - ... -}: let - browserName = - if (builtins.isString config.mods.homePackages.browser) - then config.mods.homePackages.browser - else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram - then config.mods.homePackages.browser.meta.mainProgram - else config.mods.homePackages.browser.pname; -in { - options.mods.hyprland = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enable Hyprland - ''; - }; - monitor = lib.mkOption { - default = [ - # main monitor - "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" - # all others - ]; - example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"]; - type = with lib.types; listOf str; - description = '' - The monitor configuration for hyprland. - ''; - }; - workspace = lib.mkOption { - default = []; - example = ["2,monitor:DP-1, default:true"]; - type = with lib.types; listOf str; - description = '' - The workspace configuration for hyprland. - ''; - }; - noAtomic = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Use tearing - ''; - }; - extraAutostart = lib.mkOption { - default = []; - example = ["your application"]; - type = lib.types.listOf lib.types.str; - description = '' - Extra exec_once. - ''; - }; - useDefaultConfig = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use preconfigured Hyprland config. - ''; - }; - customConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Custom Hyprland configuration. - Will be merged with default configuration if enabled. - ''; - }; - plugins = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = '' - Plugins to be added to Hyprland. - ''; - }; - pluginConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Plugin configuration to be added to Hyprland. - ''; - }; - hyprspaceEnable = lib.mkOption { - default = false; - type = lib.types.bool; - example = true; - description = '' - Enables Hyprspace plugin for hyprland. - Please note, plugins tend to break VERY often. - ''; - }; - }; - - config = lib.mkIf config.mods.hyprland.enable ( - lib.optionalAttrs (options ? wayland.windowManager.hyprland) { - # install Hyprland related packages - home.packages = with pkgs; [ - xorg.xprop - grim - slurp - satty - xdg-desktop-portal-gtk - # xdg-desktop-portal-hyprland - copyq - wl-clipboard - hyprcursor - hyprpicker - ]; - - wayland.windowManager.hyprland = { - enable = true; - settings = - if config.mods.hyprland.useDefaultConfig - then - lib.mkMerge - [ - { - "$mod" = "SUPER"; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizeactive" - ]; - - bind = [ - # screenshots - ''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy'' - ''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -'' - ''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' - - # regular programs - "$mod SUPER,F,exec,${browserName}" - (lib.mkIf ( - browserName == "firefox" || browserName == "zen" - ) "$mod SUPERSHIFT,F,exec,${browserName} -p special") - "$mod SUPER,T,exec,kitty -1" - "$mod SUPER,E,exec,nautilus -w" - "$mod SUPER,N,exec,neovide" - (lib.mkIf (config.mods.hyprland.anyrun.enable) "$mod SUPER,R,exec,anyrun") - (lib.mkIf (config.mods.oxi.oxirun.enable) "$mod SUPER,R,exec,oxirun") - (lib.mkIf (config.mods.oxi.oxidash.enable) "$mod SUPER,M,exec,oxidash") - (lib.mkIf (config.mods.oxi.oxicalc.enable) "$mod SUPER,G,exec,oxicalc") - (lib.mkIf (config.mods.oxi.oxishut.enable) "$mod SUPER,D,exec,oxishut") - (lib.mkIf (config.mods.oxi.oxipaste.enable) "$mod SUPER,A,exec,oxipaste-iced") - (lib.mkIf (config.mods.oxi.hyprdock.enable) "$mod SUPERSHIFT,P,exec,hyprdock --gui") - "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend" - "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate" - - # media keys - (lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audioControl mute") - (lib.mkIf config.mods.scripts.audioControl ",XF86AudioLowerVolume,exec, audioControl sink -5%") - (lib.mkIf config.mods.scripts.audioControl ",XF86AudioRaiseVolume,exec, audioControl sink +5%") - ",XF86AudioPlay,exec, playerctl play-pause" - ",XF86AudioNext,exec, playerctl next" - ",XF86AudioPrev,exec, playerctl previous" - (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, changeBrightness brightness 10%-") - (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, changeBrightness brightness +10%") - - # hyprland keybinds - # misc - "$mod SUPER,V,togglefloating," - "$mod SUPER,B,fullscreen," - "$mod SUPER,C,togglesplit" - "$mod SUPER,Q,killactive," - "$mod SUPERSHIFTALT,M,exit," - "$mod SUPERSHIFT,W,togglespecialworkspace" - - # move - "$mod SUPER,left,movewindow,l" - "$mod SUPER,right,movewindow,r" - "$mod SUPER,up,movewindow,u" - "$mod SUPER,down,movewindow,d" - - # workspaces - "$mod SUPER,1,workspace,1" - "$mod SUPER,2,workspace,2" - "$mod SUPER,3,workspace,3" - "$mod SUPER,4,workspace,4" - "$mod SUPER,5,workspace,5" - "$mod SUPER,6,workspace,6" - "$mod SUPER,7,workspace,7" - "$mod SUPER,8,workspace,8" - "$mod SUPER,9,workspace,9" - "$mod SUPER,0,workspace,10" - - # move to workspace - "$mod SUPERSHIFT,1,movetoworkspace,1" - "$mod SUPERSHIFT,2,movetoworkspace,2" - "$mod SUPERSHIFT,3,movetoworkspace,3" - "$mod SUPERSHIFT,4,movetoworkspace,4" - "$mod SUPERSHIFT,5,movetoworkspace,5" - "$mod SUPERSHIFT,6,movetoworkspace,6" - "$mod SUPERSHIFT,7,movetoworkspace,7" - "$mod SUPERSHIFT,8,movetoworkspace,8" - "$mod SUPERSHIFT,9,movetoworkspace,9" - "$mod SUPERSHIFT,0,movetoworkspace,10" - - # move to workspace silent - "$mod SUPERSHIFTALT,1,movetoworkspacesilent,1" - "$mod SUPERSHIFTALT,2,movetoworkspacesilent,2" - "$mod SUPERSHIFTALT,3,movetoworkspacesilent,3" - "$mod SUPERSHIFTALT,4,movetoworkspacesilent,4" - "$mod SUPERSHIFTALT,5,movetoworkspacesilent,5" - "$mod SUPERSHIFTALT,6,movetoworkspacesilent,6" - "$mod SUPERSHIFTALT,7,movetoworkspacesilent,7" - "$mod SUPERSHIFTALT,8,movetoworkspacesilent,8" - "$mod SUPERSHIFTALT,9,movetoworkspacesilent,9" - "$mod SUPERSHIFTALT,0,movetoworkspacesilent,10" - - # preselection - "$mod SUPERALT,j,layoutmsg,preselect l" - "$mod SUPERALT,k,layoutmsg,preselect d" - "$mod SUPERALT,l,layoutmsg,preselect u" - "$mod SUPERALT,semicolon,layoutmsg,preselect r" - "$mod SUPERALT,h,layoutmsg,preselect n" - ]; - - binde = [ - # hyprland keybinds - # focus - "$mod SUPER,J,movefocus,l" - "$mod SUPER,semicolon,movefocus,r" - "$mod SUPER,L,movefocus,u" - "$mod SUPER,K,movefocus,d" - - # resize - "$mod SUPER,U,resizeactive,-20 0" - "$mod SUPER,P,resizeactive,20 0" - "$mod SUPER,O,resizeactive,0 -20" - "$mod SUPER,I,resizeactive,0 20" - ]; - - general = { - gaps_out = "3,5,5,5"; - border_size = 3; - "col.active_border" = lib.mkOverride 51 "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; - # "col.inactive_border" = "0x66333333"; - allow_tearing = lib.mkIf config.mods.hyprland.noAtomic true; - }; - - decoration = { - rounding = 4; - }; - - render = { - direct_scanout = mkDashDefault config.mods.gaming.enable; - }; - - animations = { - bezier = "penguin,0.05,0.9,0.1,1.0"; - animation = [ - "windowsMove,1,4,default" - "windows,1,7,default,popin 70%" - "windowsOut,1,7,default,popin 70%" - "border,1,10,default" - "fade,1,7,default" - "workspaces,1,6,default" - "layers,1,3,default,popin" - ]; - }; - - dwindle = { - preserve_split = true; - pseudotile = 0; - permanent_direction_override = false; - }; - - input = { - kb_layout = "${config.mods.xkb.layout}"; - kb_variant = "${config.mods.xkb.variant}"; - repeat_delay = 200; - force_no_accel = true; - touchpad = { - natural_scroll = true; - tap-to-click = true; - tap-and-drag = true; - }; - }; - - misc = { - animate_manual_resizes = 1; - enable_swallow = true; - disable_splash_rendering = true; - disable_hyprland_logo = true; - swallow_regex = "^(.*)(kitty)(.*)$"; - initial_workspace_tracking = 1; - # just doesn't work - enable_anr_dialog = false; - }; - - cursor = { - enable_hyprcursor = true; - no_hardware_cursors = mkDashDefault ( - if config.mods.gpu.nvidia.enable - then 2 - else 0 - ); - # done with nix, this would break the current setup otherwise - sync_gsettings_theme = false; - }; - - gestures = { - workspace_swipe = true; - }; - - monitor = config.mods.hyprland.monitor; - workspace = config.mods.hyprland.workspace; - - env = [ - "GTK_CSD,0" - ''TERM,"kitty /bin/fish"'' - "XDG_CURRENT_DESKTOP=Hyprland" - "XDG_SESSION_TYPE=wayland" - "XDG_SESSION_DESKTOP=Hyprland" - "HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}" - "HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" - "XCURSOR_THEME,${config.mods.stylix.cursor.name}" - "XCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" - "QT_QPA_PLATFORM,wayland" - "QT_QPA_PLATFORMTHEME,qt5ct" - "QT_WAYLAND_FORCE_DPI,96" - "QT_AUTO_SCREEN_SCALE_FACTOR,0" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "QT_SCALE_FACTOR,1" - ''EDITOR,"neovide --novsync --nofork"'' - (lib.mkIf config.mods.hyprland.noAtomic "WLR_DRM_NO_ATOMIC,1") - "GTK_USE_PORTAL, 1" - - (lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia") - (lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland") - (lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm") - (lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia") - ]; - - layerrule = [ - # layer rules - # mainly to disable animations within slurp and grim - "noanim, selection" - ]; - - windowrule = [ - # window rules - "float,class:^(.*)(OxiCalc)(.*)$" - "float,class:^(.*)(winecfg.exe)(.*)$" - "float,class:^(.*)(copyq)(.*)$" - "center,class:^(.*)(swappy)(.*)$" - "float,title:^(.*)(reset)(.*)$" - "workspace 10 silent,class:^(.*)(steam)(.*)$" - "workspace 9 silent,class:^(.*)(dota)(.*)$" - "workspace 9 silent,class:^(.*)(battlebits)(.*)$" - "workspace 9 silent,class:^(.*)(aoe)(.*)$" - "suppressevent fullscreen maximize,class:^(.*)(neovide)(.*)$" - "immediate,class:^(.*)(Pal)$" - "immediate,class:^(.*)(dota2)$" - "immediate,class:^(.*)(needforspeedheat.exe)$" - ]; - - exec-once = - [ - # environment - "systemctl --user import-environment" - "dbus-update-activation-environment --systemd --all" - "hyprctl setcursor Bibata-Modern-Classic 24" - - # other programs - "hyprpaper" - "ironbar" - "${browserName}" - "oxipaste_daemon" - "oxinoti" - ] - ++ config.mods.hyprland.extraAutostart; - - plugin = - lib.mkMerge - [ - { - hyprspace = lib.mkIf config.mods.hyprland.hyprspaceEnable { - bind = [ - "SUPER, W, overview:toggle, toggle" - ]; - }; - } - config.mods.hyprland.pluginConfig - ]; - } - config.mods.hyprland.customConfig - ] - else lib.mkForce config.mods.hyprland.customConfig; - plugins = - [ - (lib.mkIf config.mods.hyprland.hyprspaceEnable inputs.Hyprspace.packages.${pkgs.system}.Hyprspace) - ] - ++ config.mods.hyprland.plugins; - }; - } - ); -} +{ + mkDashDefault, + config, + lib, + options, + pkgs, + inputs, + ... +}: let + browserName = + if (builtins.isString config.mods.homePackages.browser) + then config.mods.homePackages.browser + else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram + then config.mods.homePackages.browser.meta.mainProgram + else config.mods.homePackages.browser.pname; +in { + options.mods.hypr.hyprland = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enable Hyprland + ''; + }; + defaultMonitor = lib.mkOption { + default = ""; + example = "eDP-1"; + type = lib.types.str; + description = '' + main monitor + ''; + }; + defaultMonitorMode = lib.mkOption { + default = ""; + example = "3440x1440@180"; + type = lib.types.str; + description = '' + main monitor mode: width x height @ refreshrate + ''; + }; + defaultMonitorScale = lib.mkOption { + default = "1"; + example = "1.5"; + type = lib.types.str; + description = '' + main monitor scaling + ''; + }; + monitor = lib.mkOption { + default = [ + # main monitor + "${config.mods.hypr.hyprland.defaultMonitor},${config.mods.hypr.hyprland.defaultMonitorMode},0x0,${config.mods.hypr.hyprland.defaultMonitorScale}" + # all others + ]; + example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"]; + type = with lib.types; listOf str; + description = '' + The monitor configuration for hyprland. + ''; + }; + workspace = lib.mkOption { + default = []; + example = ["2,monitor:DP-1, default:true"]; + type = with lib.types; listOf str; + description = '' + The workspace configuration for hyprland. + ''; + }; + noAtomic = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Use tearing + ''; + }; + extraAutostart = lib.mkOption { + default = []; + example = ["your application"]; + type = lib.types.listOf lib.types.str; + description = '' + Extra exec_once. + ''; + }; + useIronbar = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Whether to use ironbar in hyprland. + ''; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured Hyprland config. + ''; + }; + customConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom Hyprland configuration. + Will be merged with default configuration if enabled. + ''; + }; + plugins = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = '' + Plugins to be added to Hyprland. + ''; + }; + pluginConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Plugin configuration to be added to Hyprland. + ''; + }; + hyprspaceEnable = lib.mkOption { + default = false; + type = lib.types.bool; + example = true; + description = '' + Enables Hyprspace plugin for hyprland. + Please note, plugins tend to break VERY often. + ''; + }; + }; + + config = lib.mkIf config.mods.hypr.hyprland.enable ( + lib.optionalAttrs (options ? wayland.windowManager.hyprland) { + # install Hyprland related packages + home.packages = with pkgs; [ + xorg.xprop + grim + slurp + satty + xdg-desktop-portal-gtk + # xdg-desktop-portal-hyprland + copyq + wl-clipboard + hyprcursor + hyprpicker + ]; + + wayland.windowManager.hyprland = { + enable = true; + settings = + if config.mods.hypr.hyprland.useDefaultConfig + then + lib.mkMerge + [ + { + "$mod" = mkDashDefault "SUPER"; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizeactive" + ]; + + bind = [ + # screenshots + ''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy'' + ''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -'' + ''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' + + # regular programs + "$mod SUPER,F,exec,${browserName}" + (lib.mkIf ( + browserName == "firefox" || browserName == "zen" + ) "$mod SUPERSHIFT,F,exec,${browserName} -p special") + "$mod SUPER,T,exec,kitty -1" + "$mod SUPER,E,exec,nautilus -w" + "$mod SUPER,N,exec,neovide" + (lib.mkIf (config.mods.anyrun.enable) "$mod SUPER,R,exec,anyrun") + (lib.mkIf (config.mods.oxi.oxirun.enable) "$mod SUPER,R,exec,oxirun") + (lib.mkIf (config.mods.oxi.oxidash.enable) "$mod SUPER,M,exec,oxidash") + (lib.mkIf (config.mods.oxi.oxicalc.enable) "$mod SUPER,G,exec,oxicalc") + (lib.mkIf (config.mods.oxi.oxishut.enable) "$mod SUPER,D,exec,oxishut") + (lib.mkIf (config.mods.oxi.oxipaste.enable) "$mod SUPER,A,exec,oxipaste-iced") + (lib.mkIf (config.mods.oxi.hyprdock.enable) "$mod SUPERSHIFT,P,exec,hyprdock --gui") + (lib.mkIf (config.mods.hypr.hyprlock.enable) "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend") + (lib.mkIf (config.mods.hypr.hyprlock.enable) "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate") + + # media keys + (lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audioControl mute") + (lib.mkIf config.mods.scripts.audioControl ",XF86AudioLowerVolume,exec, audioControl sink -5%") + (lib.mkIf config.mods.scripts.audioControl ",XF86AudioRaiseVolume,exec, audioControl sink +5%") + ",XF86AudioPlay,exec, playerctl play-pause" + ",XF86AudioNext,exec, playerctl next" + ",XF86AudioPrev,exec, playerctl previous" + (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, changeBrightness brightness 10%-") + (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, changeBrightness brightness +10%") + + # hyprland keybinds + # misc + "$mod SUPER,V,togglefloating," + "$mod SUPER,B,fullscreen," + "$mod SUPER,C,togglesplit" + "$mod SUPER,Q,killactive," + "$mod SUPERSHIFTALT,M,exit," + "$mod SUPERSHIFT,W,togglespecialworkspace" + + # move + "$mod SUPER,left,movewindow,l" + "$mod SUPER,right,movewindow,r" + "$mod SUPER,up,movewindow,u" + "$mod SUPER,down,movewindow,d" + + # workspaces + "$mod SUPER,1,workspace,1" + "$mod SUPER,2,workspace,2" + "$mod SUPER,3,workspace,3" + "$mod SUPER,4,workspace,4" + "$mod SUPER,5,workspace,5" + "$mod SUPER,6,workspace,6" + "$mod SUPER,7,workspace,7" + "$mod SUPER,8,workspace,8" + "$mod SUPER,9,workspace,9" + "$mod SUPER,0,workspace,10" + + # move to workspace + "$mod SUPERSHIFT,1,movetoworkspace,1" + "$mod SUPERSHIFT,2,movetoworkspace,2" + "$mod SUPERSHIFT,3,movetoworkspace,3" + "$mod SUPERSHIFT,4,movetoworkspace,4" + "$mod SUPERSHIFT,5,movetoworkspace,5" + "$mod SUPERSHIFT,6,movetoworkspace,6" + "$mod SUPERSHIFT,7,movetoworkspace,7" + "$mod SUPERSHIFT,8,movetoworkspace,8" + "$mod SUPERSHIFT,9,movetoworkspace,9" + "$mod SUPERSHIFT,0,movetoworkspace,10" + + # move to workspace silent + "$mod SUPERSHIFTALT,1,movetoworkspacesilent,1" + "$mod SUPERSHIFTALT,2,movetoworkspacesilent,2" + "$mod SUPERSHIFTALT,3,movetoworkspacesilent,3" + "$mod SUPERSHIFTALT,4,movetoworkspacesilent,4" + "$mod SUPERSHIFTALT,5,movetoworkspacesilent,5" + "$mod SUPERSHIFTALT,6,movetoworkspacesilent,6" + "$mod SUPERSHIFTALT,7,movetoworkspacesilent,7" + "$mod SUPERSHIFTALT,8,movetoworkspacesilent,8" + "$mod SUPERSHIFTALT,9,movetoworkspacesilent,9" + "$mod SUPERSHIFTALT,0,movetoworkspacesilent,10" + + # preselection + "$mod SUPERALT,j,layoutmsg,preselect l" + "$mod SUPERALT,k,layoutmsg,preselect d" + "$mod SUPERALT,l,layoutmsg,preselect u" + "$mod SUPERALT,semicolon,layoutmsg,preselect r" + "$mod SUPERALT,h,layoutmsg,preselect n" + ]; + + binde = [ + # hyprland keybinds + # focus + "$mod SUPER,J,movefocus,l" + "$mod SUPER,semicolon,movefocus,r" + "$mod SUPER,L,movefocus,u" + "$mod SUPER,K,movefocus,d" + + # resize + "$mod SUPER,U,resizeactive,-20 0" + "$mod SUPER,P,resizeactive,20 0" + "$mod SUPER,O,resizeactive,0 -20" + "$mod SUPER,I,resizeactive,0 20" + ]; + + general = { + gaps_out = mkDashDefault "3,5,5,5"; + border_size = mkDashDefault 3; + "col.active_border" = lib.mkOverride 51 "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; + # "col.inactive_border" = "0x66333333"; + allow_tearing = lib.mkIf config.mods.hypr.hyprland.noAtomic true; + }; + + decoration = { + rounding = mkDashDefault 4; + }; + + render = { + direct_scanout = mkDashDefault config.mods.gaming.enable; + }; + + animations = { + bezier = mkDashDefault "penguin,0.05,0.9,0.1,1.0"; + animation = [ + "windowsMove,1,4,default" + "windows,1,7,default,popin 70%" + "windowsOut,1,7,default,popin 70%" + "border,1,10,default" + "fade,1,7,default" + "workspaces,1,6,default" + "layers,1,3,default,popin" + ]; + }; + + dwindle = { + preserve_split = mkDashDefault true; + pseudotile = mkDashDefault 0; + permanent_direction_override = mkDashDefault false; + }; + + input = { + kb_layout = mkDashDefault "${config.mods.xkb.layout}"; + kb_variant = mkDashDefault "${config.mods.xkb.variant}"; + repeat_delay = mkDashDefault 200; + force_no_accel = mkDashDefault true; + touchpad = { + natural_scroll = mkDashDefault true; + tap-to-click = mkDashDefault true; + tap-and-drag = mkDashDefault true; + }; + }; + + misc = { + animate_manual_resizes = mkDashDefault 1; + enable_swallow = mkDashDefault true; + disable_splash_rendering = mkDashDefault true; + disable_hyprland_logo = mkDashDefault true; + swallow_regex = mkDashDefault "^(.*)(kitty)(.*)$"; + initial_workspace_tracking = mkDashDefault 1; + # just doesn't work + enable_anr_dialog = false; + }; + + cursor = { + enable_hyprcursor = mkDashDefault true; + no_hardware_cursors = mkDashDefault ( + if config.mods.gpu.nvidia.enable + then 2 + else 0 + ); + # done with nix, this would break the current setup otherwise + sync_gsettings_theme = mkDashDefault false; + }; + + gestures = { + workspace_swipe = mkDashDefault true; + }; + + monitor = mkDashDefault config.mods.hypr.hyprland.monitor; + workspace = mkDashDefault config.mods.hypr.hyprland.workspace; + + env = [ + "GTK_CSD,0" + ''TERM,"kitty /bin/fish"'' + "XDG_CURRENT_DESKTOP=Hyprland" + "XDG_SESSION_TYPE=wayland" + "XDG_SESSION_DESKTOP=Hyprland" + "HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}" + "HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" + "XCURSOR_THEME,${config.mods.stylix.cursor.name}" + "XCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" + "QT_QPA_PLATFORM,wayland" + "QT_QPA_PLATFORMTHEME,qt5ct" + "QT_WAYLAND_FORCE_DPI,96" + "QT_AUTO_SCREEN_SCALE_FACTOR,0" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + "QT_SCALE_FACTOR,1" + ''EDITOR,"neovide --novsync --nofork"'' + (lib.mkIf config.mods.hypr.hyprland.noAtomic "WLR_DRM_NO_ATOMIC,1") + "GTK_USE_PORTAL, 1" + + (lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia") + (lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland") + (lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm") + (lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia") + ]; + + layerrule = [ + # layer rules + # mainly to disable animations within slurp and grim + "noanim, selection" + ]; + + windowrule = [ + # window rules + "float,class:^(.*)(OxiCalc)(.*)$" + "float,class:^(.*)(winecfg.exe)(.*)$" + "float,class:^(.*)(copyq)(.*)$" + "center,class:^(.*)(swappy)(.*)$" + "float,title:^(.*)(reset)(.*)$" + "workspace 10 silent,class:^(.*)(steam)(.*)$" + "workspace 9 silent,class:^(.*)(dota)(.*)$" + "workspace 9 silent,class:^(.*)(battlebits)(.*)$" + "workspace 9 silent,class:^(.*)(aoe)(.*)$" + "suppressevent fullscreen maximize,class:^(.*)(neovide)(.*)$" + "immediate,class:^(.*)(Pal)$" + "immediate,class:^(.*)(dota2)$" + "immediate,class:^(.*)(needforspeedheat.exe)$" + ]; + + exec-once = + [ + # environment + "systemctl --user import-environment" + "dbus-update-activation-environment --systemd --all" + "hyprctl setcursor Bibata-Modern-Classic 24" + + # other programs + "${browserName}" + (lib.mkIf config.mods.hypr.hyprpaper.enable "hyprpaper") + (lib.mkIf config.mods.hypr.hyprland.useIronbar "ironbar") + (lib.mkIf config.mods.oxi.oxipaste.enable "oxipaste_daemon") + (lib.mkIf config.mods.oxi.oxinoti.enable "oxinoti") + ] + ++ config.mods.hypr.hyprland.extraAutostart; + + plugin = + lib.mkMerge + [ + { + hyprspace = lib.mkIf config.mods.hypr.hyprland.hyprspaceEnable { + bind = [ + "SUPER, W, overview:toggle, toggle" + ]; + }; + } + config.mods.hypr.hyprland.pluginConfig + ]; + } + config.mods.hypr.hyprland.customConfig + ] + else lib.mkForce config.mods.hypr.hyprland.customConfig; + plugins = + [ + (lib.mkIf config.mods.hypr.hyprland.hyprspaceEnable inputs.Hyprspace.packages.${pkgs.system}.Hyprspace) + ] + ++ config.mods.hypr.hyprland.plugins; + }; + } + ); +} diff --git a/modules/programs/hypr/hyprlock.nix b/modules/programs/hypr/hyprlock.nix new file mode 100644 index 0000000..30ea707 --- /dev/null +++ b/modules/programs/hypr/hyprlock.nix @@ -0,0 +1,61 @@ +{ + config, + lib, + options, + pkgs, + ... +}: { + options.mods.hypr.hyprlock = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables Hyprlock"; + }; + config = lib.mkOption { + default = { + background = [ + { + monitor = ""; + path = ""; + color = "rgba(26, 27, 38, 1.0)"; + } + ]; + + input-field = [ + { + monitor = "${config.mods.hypr.hyprland.defaultMonitor}"; + placeholder_text = "password or something"; + } + ]; + + label = [ + { + monitor = "${config.mods.hypr.hyprland.defaultMonitor}"; + text = "$TIME"; + font_size = 50; + position = "0, 200"; + valign = "center"; + halign = "center"; + } + ]; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config"; + }; + }; + + config = lib.mkIf config.mods.hypr.hyprlock.enable ( + lib.optionalAttrs (options ? xdg.configFile) { + stylix.targets.hyprlock = { + enable = false; + }; + home.packages = with pkgs; [hyprlock]; + programs.hyprlock = lib.mkIf config.mods.hypr.hyprlock.enable { + enable = true; + settings = config.mods.hypr.hyprlock.config; + }; + } + ); +} diff --git a/modules/programs/hypr/hyprpaper.nix b/modules/programs/hypr/hyprpaper.nix new file mode 100644 index 0000000..b392b54 --- /dev/null +++ b/modules/programs/hypr/hyprpaper.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + options, + pkgs, + ... +}: { + options.mods.hypr.hyprpaper = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables Hyprpaper"; + }; + config = lib.mkOption { + default = ""; + example = '' + preload = path/to/wallpaper + wallpaper = YOURMONITOR,path/to/wallpaper + ''; + type = lib.types.lines; + description = '' + Hyprpaper config + ''; + }; + }; + + config = lib.mkIf config.mods.hypr.hyprpaper.enable ( + lib.optionalAttrs (options ? xdg.configFile) { + home.packages = with pkgs; [hyprpaper]; + xdg.configFile."hypr/hyprpaper.conf" = lib.mkIf config.mods.hypr.hyprpaper.enable { + text = config.mods.hypr.hyprpaper.config; + }; + } + ); +} diff --git a/modules/programs/hyprland/anyrun.nix b/modules/programs/hyprland/anyrun.nix deleted file mode 100644 index 6a3a24e..0000000 --- a/modules/programs/hyprland/anyrun.nix +++ /dev/null @@ -1,144 +0,0 @@ -{ - lib, - config, - pkgs, - options, - inputs, - ... -}: { - options.mods = { - hyprland = { - anyrun = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables anyrun"; - }; - useDefaultConfig = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use preconfigured anyrun config. - ''; - }; - customConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Custom anyrun configuration. - Will be merged with default configuration if enabled. - ''; - }; - useDefaultCss = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use preconfigured anyrun css. - ''; - }; - customCss = lib.mkOption { - default = ''''; - example = '' - #window { - border-radius: none; - } - ''; - type = lib.types.lines; - description = '' - Custom anyrun css. - Will be merged with default css if enabled. - ''; - }; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.anyrun.enable ( - lib.optionalAttrs (options ? home.packages) { - programs.anyrun = lib.mkForce { - enable = true; - config = - if config.mods.hyprland.anyrun.useDefaultConfig - then - { - plugins = [ - inputs.anyrun.packages.${pkgs.system}.applications - inputs.anyrun.packages.${pkgs.system}.rink - inputs.anyrun.packages.${pkgs.system}.translate - inputs.anyrun.packages.${pkgs.system}.websearch - ]; - hideIcons = false; - width = { - fraction = 0.3; - }; - y = { - fraction = 0.5; - }; - layer = "overlay"; - hidePluginInfo = true; - closeOnClick = true; - } - // config.mods.hyprland.anyrun.customConfig - else config.mods.hyprland.anyrun.customConfig; - - extraCss = - if config.mods.hyprland.anyrun.useDefaultCss - then - '' - #window { - border-radius: 10px; - background-color: transparent; - } - - box#main { - border-radius: 10px; - } - - list#main { - border-radius: 10px; - margin: 0px 10px 10px 10px; - } - - list#plugin { - border-radius: 10px; - } - - list#match { - border-radius: 10px; - } - - entry#entry { - border: 0; - border-radius: 10px; - margin: 10px 10px 0px 10px; - } - - label#match-desc { - font-size: 12px; - border-radius: 10px; - } - - label#match-title { - font-size: 12px; - border-radius: 10px; - } - - label#plugin { - font-size: 16px; - border-radius: 10px; - } - - * { - border-radius: 10px; - } - '' - + config.mods.hyprland.anyrun.customCss - else config.mods.hyprland.anyrun.customCss; - }; - } - ); -} diff --git a/modules/programs/hyprland/hyprlock.nix b/modules/programs/hyprland/hyprlock.nix deleted file mode 100644 index 0a807ea..0000000 --- a/modules/programs/hyprland/hyprlock.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - config, - lib, - options, - pkgs, - ... -}: { - options.mods = { - hyprland.hyprlock = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables Hyprlock"; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.hyprlock.enable ( - lib.optionalAttrs (options ? xdg.configFile) { - stylix.targets.hyprlock = { - enable = false; - }; - home.packages = with pkgs; [hyprlock]; - programs.hyprlock = lib.mkIf config.mods.hyprland.hyprlock.enable { - enable = true; - settings = { - background = [ - { - monitor = ""; - path = ""; - color = "rgba(26, 27, 38, 1.0)"; - } - ]; - - input-field = [ - { - monitor = "${config.conf.defaultMonitor}"; - - placeholder_text = "password or something"; - } - ]; - - label = [ - { - monitor = "${config.conf.defaultMonitor}"; - text = "$TIME"; - font_size = 50; - position = "0, 200"; - valign = "center"; - halign = "center"; - } - ]; - }; - }; - } - ); -} diff --git a/modules/programs/hyprland/hyprpaper.nix b/modules/programs/hyprland/hyprpaper.nix deleted file mode 100644 index 31c4d05..0000000 --- a/modules/programs/hyprland/hyprpaper.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - config, - lib, - options, - pkgs, - ... -}: { - options.mods = { - hyprland.hyprpaper = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables Hyprpaper"; - }; - config = lib.mkOption { - default = ""; - example = '' - preload = path/to/wallpaper - wallpaper = YOURMONITOR,path/to/wallpaper - ''; - type = lib.types.lines; - description = '' - Hyprpaper config - ''; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.hyprpaper.enable ( - lib.optionalAttrs (options ? xdg.configFile) { - home.packages = with pkgs; [hyprpaper]; - xdg.configFile."hypr/hyprpaper.conf" = lib.mkIf config.mods.hyprland.hyprpaper.enable { - text = config.mods.hyprland.hyprpaper.config; - }; - } - ); -} diff --git a/modules/programs/hyprland/ironbar.nix b/modules/programs/ironbar.nix similarity index 50% rename from modules/programs/hyprland/ironbar.nix rename to modules/programs/ironbar.nix index 8e60c8b..ca8255b 100644 --- a/modules/programs/hyprland/ironbar.nix +++ b/modules/programs/ironbar.nix @@ -9,12 +9,127 @@ username = config.conf.username; base16 = pkgs.callPackage inputs.base16.lib {}; scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + ironbarDefaultConfig = { + end = [ + { + type = "sys_info"; + format = [" {memory_percent}"]; + interval.memory = 30; + class = "memory-usage"; + } + { + type = "custom"; + bar = [ + { + type = "button"; + class = "popup-button"; + label = ""; + on_click = "popup:toggle"; + } + ]; + class = "popup-button-box"; + popup = [ + { + type = "box"; + orientation = "vertical"; + class = "audio-box"; + widgets = [ + { + type = "box"; + orientation = "horizontal"; + widgets = [ + { + type = "button"; + class = "audio-button"; + label = ""; + on_click = lib.mkIf config.mods.scripts.audioControl "!audioControl bluetooth"; + } + { + type = "button"; + class = "audio-button"; + label = "󰋋"; + on_click = lib.mkIf config.mods.scripts.audioControl "!audioControl internal"; + } + ]; + class = "audio-button-box"; + } + { + type = "label"; + label = "Output"; + } + { + type = "slider"; + class = "audio-slider"; + step = 1.0; + length = 200; + value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; + on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%"; + } + { + type = "label"; + label = "Input"; + } + { + type = "slider"; + class = "audio-slider"; + step = 1.0; + length = 200; + value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; + on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%"; + } + ]; + } + ]; + } + { + type = "custom"; + bar = [ + { + type = "button"; + class = "popup-button"; + label = ""; + on_click = "!oxidash --css /home/${username}/gits/oxidash/style.css"; + } + ]; + class = "popup-button-box"; + } + { + type = "clock"; + format = "%I:%M"; + format_popup = "%I:%M:%S"; + locale = "en_US"; + } + {type = "tray";} + ]; + position = "top"; + height = 10; + anchor_to_edges = true; + start = [ + { + type = "workspaces"; + all_monitors = true; + } + ]; + center = [ + { + type = "focused"; + show_icon = true; + show_title = true; + icon_size = 20; + truncate = "end"; + } + ]; + }; + monitorConfig = + if config.mods.hypr.hyprland.enable + then {monitors.${config.mods.hypr.hyprland.defaultMonitor} = ironbarDefaultConfig;} + else ironbarDefaultConfig; in { options.mods = { - hyprland.ironbar = { + ironbar = { enable = lib.mkOption { - default = true; - example = false; + default = false; + example = true; type = lib.types.bool; description = "Enables ironbar"; }; @@ -26,19 +141,6 @@ in { Use preconfigured ironbar config. ''; }; - modules = lib.mkOption { - default = []; - example = [ - { - type = "upower"; - class = "memory-usage"; - } - ]; - type = with lib.types; listOf attrs; - description = '' - Adds modules to ironbar. See https://github.com/JakeStanger/ironbar/wiki/ for more information. - ''; - }; customConfig = lib.mkOption { default = {}; example = {}; @@ -71,12 +173,12 @@ in { }; }; }; - config = lib.mkIf config.mods.hyprland.ironbar.enable ( + config = lib.mkIf (config.mods.ironbar.enable || config.mods.hypr.hyprland.useIronbar) ( lib.optionalAttrs (options ? programs.ironbar) { programs.ironbar = { enable = true; style = - if config.mods.hyprland.ironbar.useDefaultCss + if config.mods.ironbar.useDefaultCss then /* css @@ -212,131 +314,20 @@ in { background-color: #${scheme.base02}; } '' - + config.mods.hyprland.ironbar.customCss - else config.mods.hyprland.ironbar.customCss; + + config.mods.ironbar.customCss + else config.mods.ironbar.customCss; features = [ #"another_feature" ]; - config = { - monitors."${config.conf.defaultMonitor}" = - if config.mods.hyprland.ironbar.useDefaultConfig - then - { - end = - config.mods.hyprland.ironbar.modules - ++ [ - { - type = "sys_info"; - format = [" {memory_percent}"]; - interval.memory = 30; - class = "memory-usage"; - } - { - type = "custom"; - bar = [ - { - type = "button"; - class = "popup-button"; - label = ""; - on_click = "popup:toggle"; - } - ]; - class = "popup-button-box"; - popup = [ - { - type = "box"; - orientation = "vertical"; - class = "audio-box"; - widgets = [ - { - type = "box"; - orientation = "horizontal"; - widgets = [ - { - type = "button"; - class = "audio-button"; - label = ""; - on_click = lib.mkIf config.mods.scripts.audioControl "!audioControl bluetooth"; - } - { - type = "button"; - class = "audio-button"; - label = "󰋋"; - on_click = lib.mkIf config.mods.scripts.audioControl "!audioControl internal"; - } - ]; - class = "audio-button-box"; - } - { - type = "label"; - label = "Output"; - } - { - type = "slider"; - class = "audio-slider"; - step = 1.0; - length = 200; - value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; - on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%"; - } - { - type = "label"; - label = "Input"; - } - { - type = "slider"; - class = "audio-slider"; - step = 1.0; - length = 200; - value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; - on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%"; - } - ]; - } - ]; - } - { - type = "custom"; - bar = [ - { - type = "button"; - class = "popup-button"; - label = ""; - on_click = "!oxidash --css /home/${username}/gits/oxidash/style.css"; - } - ]; - class = "popup-button-box"; - } - { - type = "clock"; - format = "%I:%M"; - format_popup = "%I:%M:%S"; - locale = "en_US"; - } - {type = "tray";} - ]; - position = "top"; - height = 10; - anchor_to_edges = true; - start = [ - { - type = "workspaces"; - all_monitors = true; - } - ]; - center = [ - { - type = "focused"; - show_icon = true; - show_title = true; - icon_size = 20; - truncate = "end"; - } - ]; - } - // config.mods.hyprland.ironbar.customConfig - else config.mods.hyprland.ironbar.customConfig; - }; + config = + if config.mods.ironbar.useDefaultConfig + then + lib.mkMerge + [ + monitorConfig + config.mods.ironbar.customConfig + ] + else config.mods.ironbar.customConfig; }; } ); diff --git a/modules/programs/keepassxc.nix b/modules/programs/keepassxc.nix index 93c9142..d8c0c6a 100644 --- a/modules/programs/keepassxc.nix +++ b/modules/programs/keepassxc.nix @@ -12,54 +12,63 @@ type = lib.types.bool; description = "Enables the piper program and its daemon"; }; - use_cache_config = lib.mkOption { + useConfig = lib.mkOption { default = true; example = false; type = lib.types.bool; - description = "Whether to overwrite the cache config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; + description = "Whether to overwrite the config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; }; - cache_config = lib.mkOption { + config = lib.mkOption { default = '' [General] - LastDatabases=/home/${config.conf.username}/pws/Passwords.kdbx - LastActiveDatabase=/home/${config.conf.username}/pws/Passwords.kdbx - LastOpenedDatabases=/home/${config.conf.username}/pws/Passwords.kdbx - LastKeyFiles=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0>\0/\0h\0o\0m\0\x65\0/\0\x64\0\x61\0s\0h\0i\0\x65\0/\0p\0w\0s\0/\0P\0\x61\0s\0s\0w\0o\0r\0\x64\0s\0.\0k\0\x64\0\x62\0x\0\0\0\n\0\0\0>\0/\0h\0o\0m\0\x65\0/\0\x64\0\x61\0s\0h\0i\0\x65\0/\0p\0w\0s\0/\0l\0o\0g\0i\0n\0_\0k\0\x65\0y\0.\0k\0\x65\0y\0x) + ConfigVersion=2 + + [Browser] + Enabled=true + + [GUI] + ApplicationTheme=classic + HidePasswords=true + MinimizeOnClose=true + MinimizeToTray=true + ShowTrayIcon=true + TrayIconAppearance=monochrome-light + + [PasswordGenerator] + Length=30 + + [Security] + EnableCopyOnDoubleClick=true ''; example = ""; type = lib.types.lines; description = "Cache config to be used."; }; + useCacheConfig = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Whether to overwrite the cache config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; + }; + cacheConfig = lib.mkOption { + default = ''''; + example = '' + [General] + LastDatabases=/path/to/database + ''; + type = lib.types.lines; + description = "Cache config to be used."; + }; }; config = lib.mkIf config.mods.keepassxc.enable ( lib.optionalAttrs (options ? home.file) { home.packages = [pkgs.keepassxc]; - xdg.configFile."keepassxc/keepassxc.ini" = { - text = '' - [General] - ConfigVersion=2 - - [Browser] - Enabled=true - - [GUI] - ApplicationTheme=classic - HidePasswords=true - MinimizeOnClose=true - MinimizeToTray=true - ShowTrayIcon=true - TrayIconAppearance=monochrome-light - - [PasswordGenerator] - Length=30 - - [Security] - EnableCopyOnDoubleClick=true - ''; + xdg.configFile."keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.useConfig { + text = config.mods.keepassxc.config; }; - home.file.".cache/keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.use_cache_config { - text = config.mods.keepassxc.cache_config; + home.file.".cache/keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.useCacheConfig { + text = config.mods.keepassxc.cacheConfig; }; } ); diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index eb41e44..ab2ae5a 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -41,6 +41,12 @@ in { type = lib.types.bool; description = "Enables kitty"; }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enable default config for kitty"; + }; additionalConfig = lib.mkOption { default = {}; example = { @@ -48,7 +54,7 @@ in { enable_audio_bell = "yes"; }; type = with lib.types; attrsOf anything; - description = "Additional kitty configuration"; + description = "Additional kitty configuration. Will be the only configuration if useDefaultConfig is disabled."; }; }; config = lib.mkIf config.mods.kitty.enable ( @@ -59,80 +65,64 @@ in { programs.kitty = { enable = true; settings = - { - enable_audio_bell = "no"; - window_alert_on_bell = "no"; - cursor_blink_interval = "0"; - window_padding_width = "1"; - shell_integration = "yes"; - sync_with_monitor = "no"; - background_opacity = "0.8"; + if config.mods.kitty.useDefaultConfig + then + { + enable_audio_bell = "no"; + window_alert_on_bell = "no"; + cursor_blink_interval = "0"; + window_padding_width = "1"; + shell_integration = "yes"; + sync_with_monitor = "no"; + background_opacity = "0.8"; - font_family = "${config.mods.stylix.fonts.monospace.name}"; - bold_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold"; - italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Italic"; - bold_italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold Italic"; + font_family = "${config.mods.stylix.fonts.monospace.name}"; + bold_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold"; + italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Italic"; + bold_italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold Italic"; - background = base; - foreground = "#" + scheme.base05; - selection_foreground = "#" + scheme.base05; - selection_background = base; - url_color = "#" + scheme.base04; - cursor = "#" + scheme.base05; - active_border_color = "#" + scheme.base03; - inactive_border_color = "#" + scheme.base01; - active_tab_background = base; - active_tab_foreground = "#" + scheme.base05; - inactive_tab_background = "#" + scheme.base01; - inactive_tab_foreground = "#" + scheme.base04; - tab_bar_background = "#" + scheme.base01; + background = base; + foreground = "#" + scheme.base05; + selection_foreground = "#" + scheme.base05; + selection_background = base; + url_color = "#" + scheme.base04; + cursor = "#" + scheme.base05; + active_border_color = "#" + scheme.base03; + inactive_border_color = "#" + scheme.base01; + active_tab_background = base; + active_tab_foreground = "#" + scheme.base05; + inactive_tab_background = "#" + scheme.base01; + inactive_tab_foreground = "#" + scheme.base04; + tab_bar_background = "#" + scheme.base01; - mark1_foreground = "#" + scheme.base00; - mark1_background = "#" + scheme.base07; - mark2_foreground = "#" + scheme.base00; - mark2_background = "#" + scheme.base0E; - mark3_foreground = "#" + scheme.base00; - mark3_background = "#" + scheme.base08; + mark1_foreground = "#" + scheme.base00; + mark1_background = "#" + scheme.base07; + mark2_foreground = "#" + scheme.base00; + mark2_background = "#" + scheme.base0E; + mark3_foreground = "#" + scheme.base00; + mark3_background = "#" + scheme.base08; - color0 = "#" + scheme.base03; - color1 = "#" + scheme.base08; - color2 = "#" + scheme.base0B; - color3 = "#" + scheme.base0A; - color4 = "#" + scheme.base0D; - color5 = "#" + scheme.base06; - color6 = "#" + scheme.base0C; - color7 = "#" + scheme.base07; + color0 = "#" + scheme.base03; + color1 = "#" + scheme.base08; + color2 = "#" + scheme.base0B; + color3 = "#" + scheme.base0A; + color4 = "#" + scheme.base0D; + color5 = "#" + scheme.base06; + color6 = "#" + scheme.base0C; + color7 = "#" + scheme.base07; - color8 = "#" + scheme.base04; - color9 = "#" + scheme.base08; - color10 = "#" + scheme.base0B; - color11 = "#" + scheme.base0A; - color12 = "#" + scheme.base0D; - color13 = "#" + scheme.base06; - color14 = "#" + scheme.base0C; - color15 = "#" + scheme.base0B; - - # color0 = base; - # color1 = "#" + scheme.base08; - # color2 = "#" + scheme.base0B; - # color3 = "#" + scheme.base0A; - # color4 = "#" + scheme.base0D; - # color5 = "#" + scheme.base0E; - # color6 = "#" + scheme.base0C; - # color7 = "#" + scheme.base05; - # - # color8 = "#" + scheme.base03; - # color9 = "#" + scheme.base08; - # color10 = "#" + scheme.base0B; - # color11 = "#" + scheme.base0A; - # color12 = "#" + scheme.base0D; - # color13 = "#" + scheme.base0E; - # color14 = "#" + scheme.base0C; - # color15 = "#" + scheme.base07; - - shell = lib.mkIf config.mods.fish.enable "fish"; - } - // config.mods.kitty.additionalConfig; + color8 = "#" + scheme.base04; + color9 = "#" + scheme.base08; + color10 = "#" + scheme.base0B; + color11 = "#" + scheme.base0A; + color12 = "#" + scheme.base0D; + color13 = "#" + scheme.base06; + color14 = "#" + scheme.base0C; + color15 = "#" + scheme.base0B; + shell = lib.mkIf config.mods.fish.enable "fish"; + } + // config.mods.kitty.additionalConfig + else config.mods.kitty.additionalConfig; }; } ); diff --git a/modules/programs/mime.nix b/modules/programs/mime.nix index 1f193d2..03d04d8 100644 --- a/modules/programs/mime.nix +++ b/modules/programs/mime.nix @@ -1,6 +1,7 @@ # Copyright (c) 2020-2021 Mihai Fufezan # credits to fufexan https://github.com/fufexan/dotfiles/blob/main/home/terminal/programs/xdg.nix { + mkDashDefault, config, lib, options, @@ -148,11 +149,11 @@ in { }; userDirs = { - enable = true; - createDirectories = true; + enable = mkDashDefault true; + createDirectories = mkDashDefault true; extraConfig = { - XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; - pws = "${config.home.homeDirectory}/pws"; + XDG_SCREENSHOTS_DIR = mkDashDefault "${config.xdg.userDirs.pictures}/Screenshots"; + pws = mkDashDefault "${config.home.homeDirectory}/pws"; }; }; }; diff --git a/modules/programs/ncspot.nix b/modules/programs/ncspot.nix index 8e9064d..b998942 100644 --- a/modules/programs/ncspot.nix +++ b/modules/programs/ncspot.nix @@ -12,11 +12,8 @@ type = lib.types.bool; description = "Enables ncspot with a config"; }; - }; - config = lib.mkIf config.mods.ncspot.enable ( - lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ncspot]; - xdg.configFile."ncspot/config.toml".source = (pkgs.formats.toml {}).generate "ncspot" { + config = lib.mkOption { + default = { notify = true; shuffle = true; cover_max_scale = 2; @@ -52,6 +49,16 @@ body = "%title"; }; }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config"; + }; + }; + config = lib.mkIf config.mods.ncspot.enable ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [ncspot]; + xdg.configFile."ncspot/config.toml".source = + lib.mkIf config.mods.ncspot.useConfig (pkgs.formats.toml {}).generate "ncspot" config.mods.ncspot.config; } ); } diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 25fc53b..de86504 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -1,4 +1,5 @@ { + mkDashDefault, lib, config, options, @@ -45,7 +46,7 @@ code_format = "[](bg:prev_bg fg:#5256c3)[ $symbol ($version)](bg:#5256c3)"; in { enable = true; - interactiveOnly = true; + interactiveOnly = mkDashDefault true; presets = lib.mkIf config.mods.starship.useDefaultPrompt ["pastel-powerline"]; settings = lib.mkIf config.mods.starship.useDefaultPrompt { diff --git a/modules/programs/stylix.nix b/modules/programs/stylix.nix index 515f45c..657f078 100644 --- a/modules/programs/stylix.nix +++ b/modules/programs/stylix.nix @@ -1,4 +1,5 @@ { + mkDashDefault, lib, config, options, @@ -88,11 +89,11 @@ (lib.optionalAttrs (options ? stylix) { stylix = { enable = true; - image = ../../base/black.jpg; - polarity = "dark"; + image = mkDashDefault ../../base/black.jpg; + polarity = mkDashDefault "dark"; targets = { - nixvim.enable = false; - fish.enable = false; + nixvim.enable = mkDashDefault false; + fish.enable = mkDashDefault false; }; fonts = config.mods.stylix.fonts; cursor = config.mods.stylix.cursor; diff --git a/modules/programs/virtmanager.nix b/modules/programs/virtmanager.nix index 84c7c0a..bf81b93 100644 --- a/modules/programs/virtmanager.nix +++ b/modules/programs/virtmanager.nix @@ -1,4 +1,5 @@ { + mkDashDefault, lib, config, options, @@ -41,15 +42,15 @@ in { libvirtd = { enable = true; qemu = { - package = pkgs.qemu_kvm; - swtpm.enable = true; - ovmf.enable = true; + package = mkDashDefault pkgs.qemu_kvm; + swtpm.enable = mkDashDefault true; + ovmf.enable = mkDashDefault true; ovmf.packages = [pkgs.OVMFFull.fd]; }; }; - spiceUSBRedirection.enable = true; + spiceUSBRedirection.enable = mkDashDefault true; }; - services.spice-vdagentd.enable = true; + services.spice-vdagentd.enable = mkDashDefault true; users.users.${config.conf.username}.extraGroups = [ "libvirtd" diff --git a/patches/darkreader.nix b/patches/darkreader.nix index a1c462a..ef2c19f 100644 --- a/patches/darkreader.nix +++ b/patches/darkreader.nix @@ -1,23 +1,25 @@ # credits to Voronind for darkreader config https://github.com/voronind-com/nix/blob/main/home/program/firefox/default.nix { lib, - stable, + dashNixAdditionalProps, ... -}: -stable.buildNpmPackage rec { - version = "4.9.99"; - pname = "dark-reader"; - npmDepsHash = "sha256-m41HkwgbeRRmxJALQFJl/grYjjIqFOc47ltaesob1FA="; - env.ESBUILD_BINARY_PATH = lib.getExe stable.esbuild; - patches = [./darkeader.patch]; - src = stable.fetchFromGitHub { - hash = "sha256-K375/4qOyE1Tp/T5V5uCGcNd1IVVbT1Pjdnq/8oRHj0="; - owner = "darkreader"; - repo = "darkreader"; - rev = "v${version}"; - }; - installPhase = '' - mkdir -p $out - cp build/release/darkreader-firefox.xpi $out/latest.xpi - ''; -} +}: let + stable = dashNixAdditionalProps.pkgsDarkreader; +in + stable.buildNpmPackage rec { + version = "4.9.99"; + pname = "dark-reader"; + npmDepsHash = "sha256-m41HkwgbeRRmxJALQFJl/grYjjIqFOc47ltaesob1FA="; + env.ESBUILD_BINARY_PATH = lib.getExe stable.esbuild; + patches = [./darkeader.patch]; + src = stable.fetchFromGitHub { + hash = "sha256-K375/4qOyE1Tp/T5V5uCGcNd1IVVbT1Pjdnq/8oRHj0="; + owner = "darkreader"; + repo = "darkreader"; + rev = "v${version}"; + }; + installPhase = '' + mkdir -p $out + cp build/release/darkreader-firefox.xpi $out/latest.xpi + ''; + }