feat(nixos): Fucking Hyprland

This commit is contained in:
punkfairie 2025-01-09 08:08:30 -08:00
parent 7f98390592
commit 66485e77b9
No known key found for this signature in database
GPG key ID: B3C5488E9A1A7CA6
17 changed files with 439 additions and 56 deletions

View file

@ -267,6 +267,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_5": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakey-profile": { "flakey-profile": {
"locked": { "locked": {
"lastModified": 1712898590, "lastModified": 1712898590,
@ -282,6 +300,23 @@
"type": "github" "type": "github"
} }
}, },
"freetype2": {
"flake": false,
"locked": {
"lastModified": 1723459814,
"narHash": "sha256-4l90lDtpgm5xlh2m7ifrqNy373DTRTULRkAzicrM93c=",
"owner": "freetype",
"repo": "freetype",
"rev": "42608f77f20749dd6ddc9e0536788eaad70ea4b5",
"type": "github"
},
"original": {
"owner": "freetype",
"ref": "VER-2-13-3",
"repo": "freetype",
"type": "github"
}
},
"gen-luarc": { "gen-luarc": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
@ -398,6 +433,23 @@
"type": "github" "type": "github"
} }
}, },
"harfbuzz": {
"flake": false,
"locked": {
"lastModified": 1719502711,
"narHash": "sha256-2ieCf3ftNk851FZBDPVl+7QHWBqD729KiUxUyxi26Yg=",
"owner": "harfbuzz",
"repo": "harfbuzz",
"rev": "9c03576c49db6e7207d9bcdfe3abd170a809157f",
"type": "github"
},
"original": {
"owner": "harfbuzz",
"ref": "9.0.0",
"repo": "harfbuzz",
"type": "github"
}
},
"hercules-ci-effects": { "hercules-ci-effects": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_3",
@ -441,6 +493,23 @@
"type": "github" "type": "github"
} }
}, },
"libpng": {
"flake": false,
"locked": {
"lastModified": 1726173884,
"narHash": "sha256-gBfHgGaqVYdmhWXoNKZzPyGzyw2rr3zp+DjWmfC41jk=",
"owner": "pnggroup",
"repo": "libpng",
"rev": "f5e92d76973a7a53f517579bc95d61483bf108c0",
"type": "github"
},
"original": {
"owner": "pnggroup",
"ref": "v1.6.44",
"repo": "libpng",
"type": "github"
}
},
"lix": { "lix": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
@ -769,7 +838,8 @@
"rose-pine-amfora": "rose-pine-amfora", "rose-pine-amfora": "rose-pine-amfora",
"rose-pine-qt5ct": "rose-pine-qt5ct", "rose-pine-qt5ct": "rose-pine-qt5ct",
"snowfall-lib": "snowfall-lib", "snowfall-lib": "snowfall-lib",
"unstable": "unstable" "unstable": "unstable",
"wezterm": "wezterm"
} }
}, },
"rose-pine": { "rose-pine": {
@ -819,6 +889,27 @@
"type": "github" "type": "github"
} }
}, },
"rust-overlay": {
"inputs": {
"nixpkgs": [
"wezterm",
"nixpkgs"
]
},
"locked": {
"lastModified": 1735871325,
"narHash": "sha256-6Ta5E4mhSfCP6LdkzkG2+BciLOCPeLKuYTJ6lOHW+mI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a599f011db521766cbaf7c2f5874182485554f00",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"snowfall-lib": { "snowfall-lib": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_4",
@ -886,6 +977,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -945,6 +1051,51 @@
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
},
"wezterm": {
"inputs": {
"flake-utils": "flake-utils_5",
"freetype2": "freetype2",
"harfbuzz": "harfbuzz",
"libpng": "libpng",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay",
"zlib": "zlib"
},
"locked": {
"dir": "nix",
"lastModified": 1735931735,
"narHash": "sha256-4wzEN5IPYmqLP8TAdFatoRhCZ7W9y65AWoYN0Qgvbg8=",
"owner": "wez",
"repo": "wezterm",
"rev": "8e9cf912e66f704f300fac6107206a75036de1e7",
"type": "github"
},
"original": {
"dir": "nix",
"owner": "wez",
"repo": "wezterm",
"type": "github"
}
},
"zlib": {
"flake": false,
"locked": {
"lastModified": 1705948357,
"narHash": "sha256-TkPLWSN5QcPlL9D0kc/yhH0/puE9bFND24aj5NVDKYs=",
"owner": "madler",
"repo": "zlib",
"rev": "51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf",
"type": "github"
},
"original": {
"owner": "madler",
"ref": "v1.3.1",
"repo": "zlib",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -73,6 +73,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
wezterm = {
url = "github:wez/wezterm?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Rose pine themes that aren't included in the above flake: # Rose pine themes that aren't included in the above flake:
# TODO: Integrate these to punkfairie/rose-pine-nix. # TODO: Integrate these to punkfairie/rose-pine-nix.
rose-pine-amfora = { rose-pine-amfora = {

View file

@ -50,14 +50,16 @@ in {
zoxide = enabled; zoxide = enabled;
}; };
services = { services = {
clipboard = enabled; # clipboard = enabled;
# kanata = enabled; # syncthing = enabled;
syncthing = enabled; };
wayland.hyprland = {
enable = true;
monitors = [
"desc:Apple Computer Inc LED Cinema 2A91946Z0K0, 1920x1200, 0x0, 1"
"desc:Lenovo Group Limited LT2252p Wide 6V8ACF74, 1680x1050, 1920x0, 1"
];
}; };
#xorg = {
# xsession = enabled;
# i3 = enabled;
#};
}; };
home.stateVersion = "24.05"; home.stateVersion = "24.05";

View file

@ -4,9 +4,9 @@
pkgs, pkgs,
system, system,
... ...
}: }: let
let inherit
inherit (lib) (lib)
types types
mkOption mkOption
literalMD literalMD
@ -51,9 +51,7 @@ let
}; };
}; };
mkColorThemeOpt = mkColorThemeOpt = mode: flavor: (mkOption {
mode: flavor:
(mkOption {
type = with types; either str colorThemeType; type = with types; either str colorThemeType;
default = { default = {
base = "rose-pine"; base = "rose-pine";
@ -83,8 +81,7 @@ let
}; };
}; };
}; };
in in {
{
options.marleyos.theme = { options.marleyos.theme = {
colors = { colors = {
default = mkOption { default = mkOption {
@ -122,6 +119,15 @@ in
default = pkgs.pinentry-gtk2; default = pkgs.pinentry-gtk2;
description = "The pinentry package to use."; description = "The pinentry package to use.";
}; };
clipboard = mkOption {
type = with types; package;
default =
if config.marleyos.wayland.hyprland.enable
then pkgs.wl-clipboard
else pkgs.clipboard-jh;
description = "The clipboard manager to use.";
};
}; };
config = mkMerge [ config = mkMerge [
@ -158,6 +164,7 @@ in
(mkIf (is-linux system) { (mkIf (is-linux system) {
home.packages = [ home.packages = [
cfg.pinentry cfg.pinentry
cfg.clipboard
]; ];
programs.rbw = mkDefault { programs.rbw = mkDefault {

View file

@ -3,13 +3,11 @@
config, config,
pkgs, pkgs,
... ...
}: }: let
let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.programs.git; cfg = config.marleyos.programs.git;
in in {
{
options.marleyos.programs.git.enable = mkEnableOption "git"; options.marleyos.programs.git.enable = mkEnableOption "git";
imports = [ imports = [
@ -19,7 +17,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
gum gum
clipboard-jh config.marleyos.theme.clipboard
]; ];
# ██████╗ ██╗████████╗ # ██████╗ ██╗████████╗
@ -193,7 +191,8 @@ in
}; };
programs.fish.functions = { programs.fish.functions = {
git_develop_branch = # fish git_develop_branch =
# fish
'' ''
command git rev-parse --git-dir &>/dev/null || return command git rev-parse --git-dir &>/dev/null || return
set -l branch set -l branch
@ -209,7 +208,8 @@ in
return 1 return 1
''; '';
git_main_branch = # fish git_main_branch =
# fish
'' ''
command git rev-parse --git-dir &>/dev/null || return command git rev-parse --git-dir &>/dev/null || return
set -l ref set -l ref
@ -226,7 +226,8 @@ in
return 1 return 1
''; '';
git_current_branch = # fish git_current_branch =
# fish
'' ''
set -l ref (git symbolic-ref --quiet HEAD 2>/dev/null) set -l ref (git symbolic-ref --quiet HEAD 2>/dev/null)
set -l ret $status set -l ret $status
@ -239,7 +240,8 @@ in
echo (string replace "refs/heads/" "" $ref) echo (string replace "refs/heads/" "" $ref)
''; '';
git_open = # fish git_open =
# fish
'' ''
set -f origin "$(git remote get-url origin)" set -f origin "$(git remote get-url origin)"
@ -264,18 +266,15 @@ in
}; };
}; };
} }
# ███╗ ██╗ ██████╗ ████████╗███████╗███████╗ # ███╗ ██╗ ██████╗ ████████╗███████╗███████╗
# ████╗ ██║██╔═══██╗╚══██╔══╝██╔════╝██╔════╝ # ████╗ ██║██╔═══██╗╚══██╔══╝██╔════╝██╔════╝
# ██╔██╗ ██║██║ ██║ ██║ █████╗ ███████╗ # ██╔██╗ ██║██║ ██║ ██║ █████╗ ███████╗
# ██║╚██╗██║██║ ██║ ██║ ██╔══╝ ╚════██║ # ██║╚██╗██║██║ ██║ ██║ ██╔══╝ ╚════██║
# ██║ ╚████║╚██████╔╝ ██║ ███████╗███████║ # ██║ ╚████║╚██████╔╝ ██║ ███████╗███████║
# ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚══════╝╚══════╝ # ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚══════╝╚══════╝
# PATH VALUES: # PATH VALUES:
# :/ - all files within the root of the working tree, so all files in the # :/ - all files within the root of the working tree, so all files in the
# repo, a la git add's --all option. # repo, a la git add's --all option.
# A note on reset, restore, and revert, paraphrased from `man git`, plus my # A note on reset, restore, and revert, paraphrased from `man git`, plus my
# own on `rm`: # own on `rm`:
# #
@ -287,3 +286,4 @@ in
# #
# These are not a description of the *possible* uses, rather a narrowing of # These are not a description of the *possible* uses, rather a narrowing of
# the *intended* uses. # the *intended* uses.

View file

@ -3,9 +3,9 @@
config, config,
system, system,
pkgs, pkgs,
inputs,
... ...
}: }: let
let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
inherit (lib.snowfall.system) is-darwin; inherit (lib.snowfall.system) is-darwin;
@ -14,8 +14,7 @@ let
isGenericLinux = config.targets.genericLinux.enable; isGenericLinux = config.targets.genericLinux.enable;
isNotNixOS = isGenericLinux || (is-darwin system); isNotNixOS = isGenericLinux || (is-darwin system);
in in {
{
options.marleyos.programs.wezterm.enable = mkEnableOption "wezterm"; options.marleyos.programs.wezterm.enable = mkEnableOption "wezterm";
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -24,12 +23,15 @@ in
# Generic linux: NixGL makes Wezterm shit the bed for some reason. # Generic linux: NixGL makes Wezterm shit the bed for some reason.
# macOS: Prefer brew cask so a proper Applications shortcut is made. # macOS: Prefer brew cask so a proper Applications shortcut is made.
package = mkIf isNotNixOS pkgs.emptyDirectory; package =
if isNotNixOS
then pkgs.emptyDirectory
# TODO: make this an overlay.
else inputs.wezterm.packages."${pkgs.system}".default;
# TODO: create `local config` & return it seperately, so other modules can # TODO: create `local config` & return it seperately, so other modules can
# insert config in the middle # insert config in the middle
extraConfig = extraConfig = let
let
# TODO: Set this in marleyos.theme # TODO: Set this in marleyos.theme
fonts = config.fonts.fontconfig.defaultFonts.monospace; fonts = config.fonts.fontconfig.defaultFonts.monospace;
in in
@ -37,6 +39,9 @@ in
'' ''
local config = wezterm.config_builder() local config = wezterm.config_builder()
-- Fix color blocks instead of text issue.
config.front_end = "WebGpu"
config.enable_tab_bar = false config.enable_tab_bar = false
config.color_scheme = "${colors.base}" config.color_scheme = "${colors.base}"
@ -79,7 +84,11 @@ in
}) })
-- TODO: on mairley this should be set to 14.0 -- TODO: on mairley this should be set to 14.0
config.font_size = ${if (is-darwin system) then "14.0" else "11.0"} config.font_size = ${
if (is-darwin system)
then "14.0"
else "11.0"
}
return config return config
''; '';

View file

@ -0,0 +1,17 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.programs.wofi;
in {
options.marleyos.programs.wofi.enable = mkEnableOption "wofi";
config = mkIf cfg.enable {
programs.wofi = {
enable = true;
};
};
}

View file

@ -0,0 +1,87 @@
{
lib,
config,
inputs,
system,
...
}: let
inherit (lib) mkEnableOption mkOption mkIf getExe;
cfg = config.marleyos.wayland.hyprland;
in {
options.marleyos.wayland.hyprland = {
enable = mkEnableOption "hyprland";
monitors = mkOption {
description = "Monitor configuration.";
type = with lib.types; listOf str;
default = [];
};
};
config = mkIf cfg.enable {
marleyos.programs.wofi.enable = true;
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
xwayland.enable = true;
settings = {
monitor = cfg.monitors;
# TODO: Use overlay once it's made.
"$terminal" = getExe inputs.wezterm.packages."${system}".default;
"$launcher" = "wofi --show drun";
"$mod" = "SUPER";
bind = [
"$mod, Q, killactive,"
"$mod SHIFT, E, exit,"
"$mod SHIFT, SPACE, togglefloating"
"$mod, RETURN, exec, $terminal"
"$mod, R, exec, $launcher"
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
];
# bindm = [
# "$mod, mouse_down, workspace, e+1"
# "$mod, mouse_up, workspace, e-1"
#
# "$mod, mouse:272, movewindow"
# "$mod, mouse:273, resizewindow"
# ];
};
};
};
}

View file

@ -1,12 +1,15 @@
_: { _: {
hardware.pulseaudio.enable = false;
security.rtkit.enable = true; # Used for pulseaudio. security.rtkit.enable = true; # Used for pulseaudio.
services.pipewire = { services = {
pulseaudio.enable = false;
pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
pulse.enable = true; pulse.enable = true;
}; };
services.printing.enable = true; printing.enable = true;
};
} }

View file

@ -20,4 +20,6 @@ in {
hashedPassword = "$y$j9T$ztWf9WeUCENC2T12qS4mi1$51ihV/5cQ8mdJJrNe7MMguk4hPB61S5xHawsfi.1hL3"; hashedPassword = "$y$j9T$ztWf9WeUCENC2T12qS4mi1$51ihV/5cQ8mdJJrNe7MMguk4hPB61S5xHawsfi.1hL3";
}; };
}; };
home-manager.backupFileExtension = "bak";
} }

View file

@ -0,0 +1,32 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf mkForce;
cfg = config.marleyos.nvidia;
in {
options.marleyos.nvidia.enable = mkEnableOption "nvidia";
config = mkIf cfg.enable {
# NVIDIA drivers are unfree.
nixpkgs.config.allowUnfree = mkForce true;
# Load drivers for Xorg and Wayland.
services.xserver.videoDrivers = ["nvidia"];
hardware = {
# openGL.
graphics.enable = true;
nvidia = {
modesetting.enable = true;
nvidiaSettings = true;
# Disable open-source drivers.
open = false;
};
};
};
}

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib) mkOption types;
in {
options.marleyos.hasNvidia = mkOption {
type = with types; bool;
default = false;
description = "Whether this machine has an NVIDIA GPU.";
};
}

View file

@ -0,0 +1,17 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.services.ly;
in {
options.marleyos.services.ly.enable = mkEnableOption "ly";
config = mkIf cfg.enable {
services.displayManager.ly = {
enable = true;
};
};
}

View file

@ -0,0 +1,17 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.services.sddm;
in {
options.marleyos.services.sddm.enable = mkEnableOption "sddm";
config = mkIf cfg.enable {
services.displayManager.sddm = {
enable = true;
};
};
}

View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.wayland.hyprland;
in {
options.marleyos.wayland.hyprland.enable = mkEnableOption "hyprland";
config = mkIf cfg.enable {
programs.hyprland = {
enable = true;
withUWSM = false;
};
};
}

View file

@ -9,7 +9,7 @@ _: {
"HDMI-0" = "00ffffffffffff0030ae0c0a010101011d160103802f1e78ee23c5a5574f9e260f5054bdcf00714f8180818c9500950fa9c0b300010126399030621a274068b03600da281100001c000000fd00324b1e5311000a202020202020000000fc004c54323235327020576964650a000000ff0036563841434637340a2020202000f8"; "HDMI-0" = "00ffffffffffff0030ae0c0a010101011d160103802f1e78ee23c5a5574f9e260f5054bdcf00714f8180818c9500950fa9c0b300010126399030621a274068b03600da281100001c000000fd00324b1e5311000a202020202020000000fc004c54323235327020576964650a000000ff0036563841434637340a2020202000f8";
}; };
config = { config = {
"DP-0" = { "DP-1" = {
enable = true; enable = true;
crtc = 0; crtc = 0;
primary = true; primary = true;
@ -17,7 +17,7 @@ _: {
position = "0x0"; position = "0x0";
rate = "59.95"; rate = "59.95";
}; };
"HDMI-0" = { "HDMI-A-1" = {
enable = true; enable = true;
crtc = 1; crtc = 1;
mode = "1680x1050"; mode = "1680x1050";

View file

@ -16,7 +16,6 @@ in {
xserver = { xserver = {
enable = true; enable = true;
displayManager.lightdm.enable = true;
desktopManager.deepin.enable = true; desktopManager.deepin.enable = true;
xkb = { xkb = {
@ -31,7 +30,15 @@ in {
environment.systemPackages = [pkgs.vim pkgs.git]; environment.systemPackages = [pkgs.vim pkgs.git];
marleyos = { marleyos = {
hasNvidia = true;
mounts.babeshare = enabled; mounts.babeshare = enabled;
wayland.hyprland = enabled;
services = {
ly = enabled;
};
}; };
system.stateVersion = "24.05"; system.stateVersion = "24.05";