[feat] nixfmt and change the hyprpaper module

This commit is contained in:
uttarayan21
2024-03-05 11:30:24 +05:30
parent e9c95ee2e9
commit e698f4de80
13 changed files with 139 additions and 159 deletions

View File

@@ -2,20 +2,18 @@
programs.firefox = { programs.firefox = {
enable = device.isLinux; enable = device.isLinux;
profiles.default = { profiles.default = {
userChrome = userChrome = let
let csshacks = pkgs.fetchFromGitHub {
csshacks = pkgs.fetchFromGitHub { owner = "MrOtherGuy";
owner = "MrOtherGuy"; repo = "firefox-csshacks";
repo = "firefox-csshacks"; rev = "master";
rev = "master"; sha256 = "sha256-XJ+MTEADzOsCIh0I8EAxbtIpDHfMJsN68sKBy7/1l60=";
sha256 = "sha256-XJ+MTEADzOsCIh0I8EAxbtIpDHfMJsN68sKBy7/1l60="; };
}; in ''
in @import url(${csshacks}/chrome/toolbars_below_content.css);
'' @import url(${csshacks}/chrome/scrollable_menupopups.css);
@import url(${csshacks}/chrome/toolbars_below_content.css); @import url(${csshacks}/chrome/linux_gtk_window_control_patch.css);
@import url(${csshacks}/chrome/scrollable_menupopups.css); '';
@import url(${csshacks}/chrome/linux_gtk_window_control_patch.css);
'';
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ extensions = with pkgs.nur.repos.rycee.firefox-addons; [
privacy-badger privacy-badger
bitwarden bitwarden

View File

@@ -3,14 +3,13 @@ let
# https://mipmip.github.io/home-manager-option-search/ # https://mipmip.github.io/home-manager-option-search/
start-tmux = (import ../scripts/start-tmux.nix) pkgs; start-tmux = (import ../scripts/start-tmux.nix) pkgs;
lazy = false; lazy = false;
in in {
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./tmux.nix ./tmux.nix
./wezterm.nix ./wezterm.nix
] ++ (if device.isLinux then [ ../linux ] else [ ]) ] ++ (if device.isLinux then [ ../linux ] else [ ])
++ (if !lazy then [ ./nvim ] else [ ]); ++ (if !lazy then [ ./nvim ] else [ ]);
home.packages = with pkgs; home.packages = with pkgs;
[ [
@@ -158,14 +157,13 @@ in
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
enableNushellIntegration = true; enableNushellIntegration = true;
settings = settings = let flavour = "mocha"; # Replace with your preferred palette
let flavour = "mocha"; # Replace with your preferred palette in {
in { # Other config here
# Other config here format = "$all"; # Remove this line to disable the default prompt format
format = "$all"; # Remove this line to disable the default prompt format palette = "catppuccin_${flavour}";
palette = "catppuccin_${flavour}"; } // builtins.fromTOML (builtins.readFile
} // builtins.fromTOML (builtins.readFile (pkgs.catppuccinThemes.starship (pkgs.catppuccinThemes.starship + /palettes/${flavour}.toml));
+ /palettes/${flavour}.toml));
}; };
eza = { eza = {
enable = true; enable = true;
@@ -193,11 +191,10 @@ in
enable = true; enable = true;
config = { theme = "catppuccin"; }; config = { theme = "catppuccin"; };
themes = { themes = {
catppuccin = catppuccin = {
{ src = "${pkgs.catppuccinThemes.bat}/themes";
src = "${pkgs.catppuccinThemes.bat}/themes"; file = "Catppuccin Mocha.tmTheme";
file = "Catppuccin Mocha.tmTheme"; };
};
}; };
}; };
@@ -206,7 +203,8 @@ in
settings = { settings = {
email = "uttarayan21@gmail.com"; email = "uttarayan21@gmail.com";
base_url = "https://pass.uttarayan.me"; base_url = "https://pass.uttarayan.me";
pinenttry = if device.isMac then pkgs.pinentry_mac else pkgs.pinentry-qt; pinenttry =
if device.isMac then pkgs.pinentry_mac else pkgs.pinentry-qt;
}; };
}; };
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
@@ -218,11 +216,10 @@ in
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
username = device.user; username = device.user;
homeDirectory = homeDirectory = if device.isMac then
if device.isMac then lib.mkForce "/Users/${device.user}"
lib.mkForce "/Users/${device.user}" else
else lib.mkForce "/home/${device.user}";
lib.mkForce "/home/${device.user}";
stateVersion = "23.11"; stateVersion = "23.11";

View File

@@ -21,9 +21,7 @@
undofile = true; undofile = true;
}; };
globals = { globals = { mapleader = " "; };
mapleader = " ";
};
plugins = { plugins = {
lspconfig = { lspconfig = {
enable = true; enable = true;
@@ -31,7 +29,7 @@
nil = { nil = {
enable = true; enable = true;
extraConfig = extraConfig =
/* lua */ # lua
'' ''
settings = { settings = {
['nil'] = { ['nil'] = {
@@ -53,7 +51,7 @@
# rust-analyzer.enable = true; # rust-analyzer.enable = true;
}; };
extraLua.pre = extraLua.pre =
/* lua */ # lua
'' ''
local lsp_zero = require'lsp-zero' local lsp_zero = require'lsp-zero'
local lspconfig = require 'lspconfig' local lspconfig = require 'lspconfig'
@@ -71,9 +69,7 @@
nvim-dap.enable = true; nvim-dap.enable = true;
todo-comments.enable = true; todo-comments.enable = true;
lualine = { lualine = { enable = true; };
enable = true;
};
commentary.enable = true; commentary.enable = true;
surround.enable = true; surround.enable = true;
which-key.enable = true; which-key.enable = true;
@@ -92,9 +88,7 @@
refactor = { refactor = {
smartRename = { smartRename = {
enable = true; enable = true;
keymaps = { keymaps = { smartRename = "<leader>rn"; };
smartRename = "<leader>rn";
};
}; };
}; };
}; };
@@ -170,7 +164,6 @@
noice-nvim noice-nvim
nvim-web-devicons nvim-web-devicons
]; ];
extraConfigLua = builtins.readFile ./extraConfig.lua; extraConfigLua = builtins.readFile ./extraConfig.lua;
package = pkgs.neovim-nightly; package = pkgs.neovim-nightly;

View File

@@ -9,8 +9,7 @@ let
tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch" tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch"
fi fi
''; '';
in in {
{
programs.tmux = { programs.tmux = {
enable = true; enable = true;
shell = "${pkgs.nushellFull}/bin/nu"; shell = "${pkgs.nushellFull}/bin/nu";
@@ -28,7 +27,7 @@ in
{ {
plugin = tmuxPlugins.catppuccin; plugin = tmuxPlugins.catppuccin;
extraConfig = extraConfig =
/* tmux */ # tmux
'' ''
set -g @catppuccin_flavour 'mocha' set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_window_default_text '''''' set -g @catppuccin_window_default_text ''''''
@@ -37,14 +36,14 @@ in
{ {
plugin = tmuxPlugins.battery; plugin = tmuxPlugins.battery;
extraConfig = extraConfig =
/* tmux */ # tmux
'' ''
set -g @catppuccin_status_modules_right "battery application session date_time" set -g @catppuccin_status_modules_right "battery application session date_time"
''; '';
} }
]; ];
extraConfig = extraConfig =
/* tmux */ # tmux
'' ''
set -gw mode-keys vi set -gw mode-keys vi
set -g status-keys vi set -g status-keys vi

View File

@@ -1,7 +1,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
programs.wezterm = { programs.wezterm = {
enable = true; enable = true;
extraConfig = /* lua */ extraConfig = # lua
'' ''
local wezterm = require 'wezterm'; local wezterm = require 'wezterm';
return { return {

View File

@@ -18,7 +18,7 @@
# security.pam.enableSudoTouchIdAuth = true; # security.pam.enableSudoTouchIdAuth = true;
system.patches = [ system.patches = [
(pkgs.writeText "pam-reattach.patch" (pkgs.writeText "pam-reattach.patch"
/* diff */ # diff
'' ''
new file mode 100644 new file mode 100644
index 0000000..e4293c0 index 0000000..e4293c0

View File

@@ -78,16 +78,8 @@
}; };
outputs = outputs = { nixpkgs, home-manager, nix-darwin, flake-utils, anyrun, nur
{ nixpkgs , neovim-nightly-overlay, ... }@inputs:
, home-manager
, nix-darwin
, flake-utils
, anyrun
, nur
, neovim-nightly-overlay
, ...
}@inputs:
let let
config_devices = [ config_devices = [
{ {
@@ -174,9 +166,8 @@
}; };
catppuccinThemes = final: prev: { catppuccinThemes = final: prev: {
catppuccinThemes = import ./themes/catppuccin.nix { catppuccinThemes =
pkgs = final.pkgs; import ./themes/catppuccin.nix { pkgs = final.pkgs; };
};
}; };
overlays = [ overlays = [
@@ -189,24 +180,20 @@
inputs.nixneovimplugins.overlays.default inputs.nixneovimplugins.overlays.default
nur.overlay nur.overlay
]; ];
in in {
{ nixosConfigurations = let devices = nixos_devices;
nixosConfigurations = in import ./nixos/device.nix {
let devices = nixos_devices; inherit devices inputs nixpkgs home-manager overlays nur;
in import ./nixos/device.nix { };
inherit devices inputs nixpkgs home-manager overlays nur;
};
darwinConfigurations = darwinConfigurations = let devices = darwin_devices;
let devices = darwin_devices; in import ./darwin/device.nix {
in import ./darwin/device.nix { inherit devices inputs nixpkgs home-manager overlays nix-darwin;
inherit devices inputs nixpkgs home-manager overlays nix-darwin; };
};
homeConfigurations = homeConfigurations = let devices = linux_devices;
let devices = linux_devices; in import ./linux/device.nix {
in import ./linux/device.nix { inherit devices inputs nixpkgs home-manager overlays;
inherit devices inputs nixpkgs home-manager overlays; };
};
}; };
} }

View File

@@ -1,29 +1,19 @@
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ ../modules/hyprpaper.nix ]; imports = [ ../modules/hyprpaper.nix ];
programs.hyprpaper = programs.hyprpaper =
let let wallpapers = import ../utils/wallhaven.nix { inherit pkgs; };
wallpapers = [ in {
(builtins.fetchurl
{
url = "https://w.wallhaven.cc/full/zy/wallhaven-zy2x7v.png";
sha256 =
"1vy4knw8cdwb5gszgvjahnwa2g0hh5lmz3v2hbx1nylmjg2rzpda";
})
];
in
{
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
systemd.target = "hyprland-session.target"; systemd.target = "hyprland-session.target";
settings.preload = wallpapers; settings.preload = wallpapers.all;
settings.wallpapers = (map (wallpaper: "DP-1," + wallpaper) wallpapers); settings.wallpapers = { "DP-1" = wallpapers.shapes; };
}; };
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
settings = { settings = {
source = source = "${pkgs.catppuccinThemes.hyprland}/themes/mocha.conf";
"${pkgs.catppuccinThemes.hyprland}/themes/mocha.conf";
monitor = [ monitor = [
",preferred,auto,auto" ",preferred,auto,auto"
"DP-1, 2560x1440@170, 0x0, 1, transform, 0" "DP-1, 2560x1440@170, 0x0, 1, transform, 0"

View File

@@ -2,10 +2,8 @@
with lib; with lib;
let let cfg = config.programs.hyprpaper;
cfg = config.programs.hyprpaper; in {
in
{
options = { options = {
programs.hyprpaper = { programs.hyprpaper = {
enable = mkEnableOption "Hyprpaper - Wayland wallpaper utility"; enable = mkEnableOption "Hyprpaper - Wayland wallpaper utility";
@@ -34,8 +32,9 @@ in
}; };
wallpapers = mkOption { wallpapers = mkOption {
type = listOf str; type = attrsOf str;
default = [ ]; default = { };
example = { "DP-1" = ./wallpapers/tensura.png; };
description = '' description = ''
Wallpaper to monitor mapper Wallpaper to monitor mapper
''; '';
@@ -44,7 +43,8 @@ in
extraConfig = mkOption { extraConfig = mkOption {
type = str; type = str;
default = ""; default = "";
description = "Check https://github.com/hyprwm/hyprpaper#usage for info"; description =
"Check https://github.com/hyprwm/hyprpaper#usage for info";
example = '' example = ''
newConfigOption = foo,bar newConfigOption = foo,bar
''; '';
@@ -54,9 +54,7 @@ in
}; };
config = { config = {
home.packages = mkIf cfg.enable [ home.packages = mkIf cfg.enable [ pkgs.hyprpaper ];
pkgs.hyprpaper
];
systemd.user.services.hyprpaper = mkIf cfg.systemd.enable { systemd.user.services.hyprpaper = mkIf cfg.systemd.enable {
Unit = { Unit = {
@@ -73,11 +71,7 @@ in
KillMode = "mixed"; KillMode = "mixed";
}; };
Install = { Install = { WantedBy = [ cfg.systemd.target ]; };
WantedBy = [
cfg.systemd.target
];
};
}; };
xdg.configFile = mkIf cfg.enable { xdg.configFile = mkIf cfg.enable {
@@ -85,10 +79,17 @@ in
# Auto-generated by Nix home-manager module # Auto-generated by Nix home-manager module
# hyprpaper.settings.preload # hyprpaper.settings.preload
${(lists.foldl (acc: v: acc + "preload = ${v}\n") "" cfg.settings.preload)} ${(lists.foldl (acc: v:
acc + ''
preload = ${v}
'') "" cfg.settings.preload)}
# hyprpaper.settings.wallpapers # hyprpaper.settings.wallpapers
${(lists.foldl (acc: v: acc + "wallpaper = ${v}\n") "" cfg.settings.wallpapers)} ${(lists.foldl (acc: v:
acc + ''
wallpaper = ${v}
'') "" (pkgs.lib.attrsets.mapAttrsToList (name: val: name + "," + val)
cfg.settings.wallpapers))}
# hyprpaper.settings.extraConfig # hyprpaper.settings.extraConfig
${cfg.settings.extraConfig} ${cfg.settings.extraConfig}

View File

@@ -10,7 +10,6 @@
security.polkit.enable = true; security.polkit.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true; security.pam.services.greetd.enableGnomeKeyring = true;
services.mullvad-vpn.enable = true; services.mullvad-vpn.enable = true;
services.resolved.enable = true; services.resolved.enable = true;
services.devmon.enable = true; services.devmon.enable = true;
@@ -29,27 +28,22 @@
}; };
boot.plymouth.enable = true; boot.plymouth.enable = true;
boot.plymouth.theme = "catppuccin-mocha"; boot.plymouth.theme = "catppuccin-mocha";
boot.plymouth.themePackages = with pkgs; [ boot.plymouth.themePackages = with pkgs;
(catppuccin-plymouth.override [ (catppuccin-plymouth.override { variant = "mocha"; }) ];
{
variant = "mocha";
})
];
services.greetd = services.greetd = let
let tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet"; hyprland-session = "${pkgs.hyprland}/share/wayland-sessions";
hyprland-session = "${pkgs.hyprland}/share/wayland-sessions"; in {
in enable = true;
{ settings = {
enable = true; default_session = {
settings = { command =
default_session = { "${tuigreet} --time --remember --remember-session --sessions ${hyprland-session}";
command = "${tuigreet} --time --remember --remember-session --sessions ${hyprland-session}"; user = "greeter";
user = "greeter";
};
}; };
}; };
};
systemd.services.greetd.serviceConfig = { systemd.services.greetd.serviceConfig = {
Type = "idle"; Type = "idle";
@@ -149,8 +143,7 @@
fish fish
nushellFull nushellFull
(pkgs.wrapFirefox (pkgs.wrapFirefox
(pkgs.firefox-unwrapped.override { pipewireSupport = true; }) (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { })
{ })
gnumake gnumake
python3 python3
(nerdfonts.override { fonts = [ "FiraCode" "Hasklig" ]; }) (nerdfonts.override { fonts = [ "FiraCode" "Hasklig" ]; })

View File

@@ -4,29 +4,28 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules =
[ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/11d8beef-2a63-4231-af35-b9b8d3a17e9b"; device = "/dev/disk/by-uuid/11d8beef-2a63-4231-af35-b9b8d3a17e9b";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/4E27-DAC0"; device = "/dev/disk/by-uuid/4E27-DAC0";
fsType = "vfat"; fsType = "vfat";
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/d0835bd2-62fd-48d3-a0d1-8ae659f2e727"; device = "/dev/disk/by-uuid/d0835bd2-62fd-48d3-a0d1-8ae659f2e727";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = [ ]; swapDevices = [ ];
@@ -39,5 +38,6 @@
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@@ -1,9 +1,10 @@
{ pkgs, ... }: { pkgs, ... }:
let let
mkCatppuccin = { owner ? "catppuccin", item, rev ? "main", sha256 ? pkgs.lib.fakeSha256 }: mkCatppuccin = { owner ? "catppuccin", version ? "0.0.1", item, rev ? "main"
, sha256 ? pkgs.lib.fakeSha256 }:
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
inherit version;
pname = item; pname = item;
version = "0.0.1";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
inherit owner rev sha256; inherit owner rev sha256;
repo = item; repo = item;
@@ -14,8 +15,7 @@ let
cp -r ./* $out/ cp -r ./* $out/
''; '';
}; };
in in {
{
bat = mkCatppuccin { bat = mkCatppuccin {
item = "bat"; item = "bat";

View File

@@ -0,0 +1,22 @@
{ pkgs, ... }:
let
getWall = { url, sha256 ? pkgs.lib.fakeSha256 }:
builtins.fetchurl { inherit url sha256; };
in rec {
inherit getWall;
# Some predefined wallpapers
lights = getWall {
url = "https://w.wallhaven.cc/full/p2/wallhaven-p2el93.jpg";
sha256 = "1fzxqdrxh7mbd18lgq1kqnzwf1nsgl7rj04idaq35cgf2fh0914v";
};
shapes = getWall {
url = "https://w.wallhaven.cc/full/p8/wallhaven-p8o29m.jpg";
sha256 = "005qrq6dnzzwia9v9cv69krkcn86zv44s3790mxv7dfzj09r5amq";
};
cloud = getWall {
url = "https://w.wallhaven.cc/full/gp/wallhaven-gpv6rd.jpg";
sha256 = "18hpaxwi1npcfkmyw42plivmjlpgvxgblp8fy2glxh7g1yxh6qds";
};
all = [ lights shapes cloud ];
}