This commit is contained in:
DashieTM 2025-05-10 13:29:37 +02:00
parent 1cb30eadca
commit cee415973f
13 changed files with 1747 additions and 1678 deletions

View file

@ -1,174 +1,174 @@
{
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://hyprland.cachix.org"
"https://anyrun.cachix.org"
"https://cache.garnix.io"
"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"
"https://chaotic-nyx.cachix.org/"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"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://hyprland.cachix.org"
"https://anyrun.cachix.org"
"https://cache.garnix.io"
"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"
"https://chaotic-nyx.cachix.org/"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"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";
};
};
}

View file

@ -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;
};
};
}

260
flake.nix
View file

@ -1,130 +1,130 @@
{
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;
build_systems = dashNixLib.build_systems;
};
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";
};
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;
build_systems = dashNixLib.build_systems;
};
dashNixInputs = inputs;
stablePkgs = stable;
unstablePkgs = unstable;
modules = ./modules;
iso = dashNixLib.buildIso.config.system.build.isoImage;
};
}

View file

@ -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}
'';
};
}

View file

@ -1,49 +1,49 @@
{
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,
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;
};
};
}

View file

@ -1,144 +1,144 @@
{
inputs,
lib,
unstable,
self,
stable,
system,
...
}: {
/*
*
# build_systems
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 = build_systems { root = ./.; };
```
:::
*/
# let
# paths = builtins.readDir ;
# names = lib.lists.remove "default" (
# map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths)
# );
# in
build_systems = {
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,
...
}: {
/*
*
# build_systems
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 = build_systems { root = ./.; };
```
:::
*/
# let
# paths = builtins.readDir ;
# names = lib.lists.remove "default" (
# map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths)
# );
# in
build_systems = {
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
];
};
}

View file

@ -1,128 +1,128 @@
{
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 = 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;
};
}

File diff suppressed because it is too large Load diff

View file

@ -1,49 +1,49 @@
{
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
./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
./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
./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
];
}

View file

@ -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}
'';
};
})
);
}

View file

@ -52,6 +52,7 @@ in {
alias rebuild='nh os switch -- --accept-flake-config'
alias update='nix flake update --flake $FLAKE --accept-flake-config'
alias gcli='gh'
abbr --add ls 'lsd'
abbr --add :q 'exit'
abbr --add gh 'git push origin'

View file

@ -6,13 +6,13 @@
}: {
options.mods.git = {
username = lib.mkOption {
default = "DashieTM";
default = "";
example = "globi";
type = lib.types.str;
description = "Git user name";
};
email = lib.mkOption {
default = "fabio.lenherr@gmail.com";
default = "";
example = "globi@globus.glob";
type = lib.types.str;
description = "Git email";

View file

@ -1,402 +1,402 @@
{
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;
};
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 config.mods.gpu.nvidia.enable;
# 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.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;
};
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 config.mods.gpu.nvidia.enable;
# 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;
};
}
);
}