[fix] *.nix: statix checks

This commit is contained in:
Jalil David Salamé Messina 2024-05-17 18:50:01 +02:00
parent 15a60141ad
commit c19ceb54b7
Signed by: jalil
GPG key ID: F016B9E770737A0B
18 changed files with 728 additions and 626 deletions

View file

@ -210,28 +210,31 @@
{ {
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
users.users.jdoe = {
users.users.jdoe.password = "example"; password = "example";
users.users.jdoe.isNormalUser = true; isNormalUser = true;
users.users.jdoe.extraGroups = [ extraGroups = [
"wheel" "wheel"
"video" "video"
"networkmanager" "networkmanager"
]; ];
home-manager.users.jdoe = {
home.username = "jdoe";
home.homeDirectory = "/home/jdoe";
jhome.enable = true;
jhome.gui.enable = true;
jhome.dev.rust.enable = true;
}; };
home-manager.users.jdoe = {
home = {
username = "jdoe";
homeDirectory = "/home/jdoe";
};
jhome = {
enable = true;
gui.enable = true;
dev.rust.enable = true;
};
};
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
jconfig = {
jconfig.enable = true; enable = true;
jconfig.gui.enable = true; gui.enable = true;
};
} }
]; ];
}; };
@ -251,11 +254,11 @@
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
] ]
++ nixpkgs.lib.optional (lix != null && lix-module != null) lix-module.nixosModules.default; ++ nixpkgs.lib.optional (lix != null && lix-module != null) lix-module.nixosModules.default;
home-manager = {
home-manager.useGlobalPkgs = true; useGlobalPkgs = true;
home-manager.useUserPackages = true; useUserPackages = true;
home-manager.sharedModules = [homeManagerModuleNixOS]; sharedModules = [homeManagerModuleNixOS];
};
# Pin nixpkgs # Pin nixpkgs
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
}; };

View file

@ -36,74 +36,92 @@ in {
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
programs.bat = { programs = {
# Better cat (bat) # Better cat (bat)
bat = {
enable = true; enable = true;
config.style = "plain"; # Disable headers and numbers # Disable headers and numbers
config.style = "plain";
}; };
# Direnv # Direnv
programs.direnv.enable = true; direnv = {
programs.direnv.nix-direnv.enable = true; enable = true;
nix-direnv.enable = true;
};
# ls replacement # ls replacement
programs.eza.enable = true; eza = {
programs.eza.git = true; enable = true;
programs.eza.icons = true; git = true;
icons = true;
};
# GnuPG # GnuPG
programs.gpg.enable = true; gpg = {
programs.gpg.homedir = "${config.xdg.dataHome}/gnupg"; enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
};
# Mail client # Mail client
programs.himalaya.enable = true; himalaya.enable = true;
# Another shell # Another shell
programs.nushell.enable = true; nushell.enable = true;
# Password manager # Password manager
programs.password-store.enable = true; password-store = {
programs.password-store.package = pkgs.pass-nodmenu; enable = true;
programs.password-store.settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass"; package = pkgs.pass-nodmenu;
settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass";
};
# SSH # SSH
programs.ssh.enable = true; ssh.enable = true;
# cd replacement # cd replacement
programs.zoxide.enable = true; zoxide.enable = true;
# Shell # Shell
programs.zsh.enable = true; zsh = {
programs.zsh.autosuggestion.enable = true; enable = true;
programs.zsh.enableCompletion = true; autosuggestion.enable = true;
programs.zsh.autocd = true; enableCompletion = true;
programs.zsh.dotDir = ".config/zsh"; autocd = true;
programs.zsh.history.path = "${config.xdg.dataHome}/zsh/zsh_history"; dotDir = ".config/zsh";
programs.zsh.syntaxHighlighting.enable = true; history.path = "${config.xdg.dataHome}/zsh/zsh_history";
syntaxHighlighting.enable = true;
};
};
services = {
# GPG Agent # GPG Agent
services.gpg-agent.enable = true; gpg-agent = {
services.gpg-agent.maxCacheTtl = 86400; enable = true;
services.gpg-agent.pinentryPackage = maxCacheTtl = 86400;
pinentryPackage =
if config.jhome.gui.enable if config.jhome.gui.enable
then pkgs.pinentry-qt then pkgs.pinentry-qt
else pkgs.pinentry-curses; else pkgs.pinentry-curses;
services.gpg-agent.extraConfig = "allow-preset-passphrase"; extraConfig = "allow-preset-passphrase";
};
# Spotifyd # Spotifyd
services.spotifyd.enable = true; spotifyd = {
services.spotifyd.settings.global.device_name = config.jhome.hostName; inherit (config.jhome.gui) enable;
services.spotifyd.settings.global.device_type = "computer"; settings.global = {
services.spotifyd.settings.global.backend = "pulseaudio"; device_name = config.jhome.hostName;
services.spotifyd.settings.global.zeroconf_port = 2020; device_type = "computer";
backend = "pulseaudio";
home.stateVersion = "22.11"; zeroconf_port = 2020;
};
};
};
home = {
stateVersion = "22.11";
# Extra packages # Extra packages
home.packages = [ packages = [
pkgs.gopass pkgs.gopass
pkgs.sshfs pkgs.sshfs
pkgs.gitoxide pkgs.gitoxide
pkgs.xplr pkgs.xplr
]; ];
# Extra variables # Extra variables
home.sessionVariables = { sessionVariables = {
CARGO_HOME = "${config.xdg.dataHome}/cargo"; CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
GOPATH = "${config.xdg.dataHome}/go"; GOPATH = "${config.xdg.dataHome}/go";
}; };
home.shellAliases = { shellAliases = {
# Verbose Commands # Verbose Commands
cp = "cp --verbose"; cp = "cp --verbose";
ln = "ln --verbose"; ln = "ln --verbose";
@ -117,56 +135,67 @@ in {
# Use exa/eza # Use exa/eza
tree = "eza --tree"; tree = "eza --tree";
}; };
};
# XDG directories # XDG directories
xdg.enable = true; xdg = {
xdg.userDirs.enable = true; enable = true;
xdg.userDirs.createDirectories = true; userDirs = {
enable = true;
createDirectories = true;
};
};
}) })
(lib.mkIf (cfg.enable && devcfg.enable) { (lib.mkIf (cfg.enable && devcfg.enable) {
home = { home = {
sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -"; sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -";
packages = devcfg.extraPackages; packages = devcfg.extraPackages;
}; };
# Github CLI # Github CLI
programs.gh.enable = true; programs = {
programs.gh-dash.enable = true; gh.enable = true;
gh-dash.enable = true;
# Git # Git
programs.git = { git = {
enable = true; enable = true;
difftastic.enable = true; difftastic = {
difftastic.background = "dark"; enable = true;
lfs.enable = true; background = "dark";
# Add diff to the commit message editor
extraConfig.commit.verbose = true;
# Improve submodule diff
extraConfig.diff.submodule = "log";
# Set the default branch name for new branches
extraConfig.init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
extraConfig.merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
extraConfig.pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
extraConfig.push.autoSetupRemote = true;
# If there are uncommitted changes, stash them before rebasing
extraConfig.rebase.autoStash = true;
# If there are fixup! commits, squash them while rebasing
extraConfig.rebase.autoSquash = true;
# Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts
extraConfig.rerere.enabled = true;
# Improve submodule status
extraConfig.status.submoduleSummary = true;
}; };
programs.lazygit.enable = true; lfs.enable = true;
extraConfig = {
# Add diff to the commit message editor
commit.verbose = true;
# Improve submodule diff
diff.submodule = "log";
# Set the default branch name for new branches
init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
push.autoSetupRemote = true;
rebase = {
# If there are uncommitted changes, stash them before rebasing
autoStash = true;
# If there are fixup! commits, squash them while rebasing
autoSquash = true;
};
# Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts
rerere.enabled = true;
# Improve submodule status
status.submoduleSummary = true;
};
};
lazygit.enable = true;
# Jujutsu (alternative DVCS (git-compatible)) # Jujutsu (alternative DVCS (git-compatible))
programs.jujutsu = { jujutsu = {
enable = true; enable = true;
settings = { settings = {
ui.pager = "bat"; ui.pager = "bat";
}; };
}; };
};
}) })
(lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) { (lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) {
home.packages = [pkgs.rustup] ++ devcfg.rust.extraPackages; home.packages = [pkgs.rustup] ++ devcfg.rust.extraPackages;

View file

@ -36,25 +36,25 @@ in {
++ lib.optional flatpakEnabled flatpak; ++ lib.optional flatpakEnabled flatpak;
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
# Browser # Browser
programs.firefox.enable = true; programs = {
firefox.enable = true;
# Dynamic Menu # Dynamic Menu
programs.fuzzel = { fuzzel = {
enable = true; enable = true;
settings.main = { settings.main = {
icon-theme = "Papirus-Dark"; icon-theme = "Papirus-Dark";
terminal = cfg.terminal; inherit (cfg) terminal;
layer = "overlay"; layer = "overlay";
}; };
}; };
# Video player # Video player
programs.mpv = { mpv = {
enable = true; enable = true;
scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;}; scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;};
}; };
# Status bar # Status bar
programs.waybar = { waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
settings = import ./waybar-settings.nix {inherit config lib;}; settings = import ./waybar-settings.nix {inherit config lib;};
@ -68,7 +68,7 @@ in {
''; '';
}; };
# Terminal # Terminal
programs.wezterm = { wezterm = {
enable = cfg.terminal == "wezterm"; enable = cfg.terminal == "wezterm";
extraConfig = '' extraConfig = ''
config = {} config = {}
@ -77,19 +77,21 @@ in {
return config return config
''; '';
}; };
programs.alacritty.enable = cfg.terminal == "alacritty"; alacritty.enable = cfg.terminal == "alacritty";
programs.zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexerr built in zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexerr built in
# PDF reader # PDF reader
programs.zathura.enable = true; zathura.enable = true;
# Auto start sway # Auto start sway
programs.zsh.loginExtra = lib.optionalString cfg.sway.autostart '' zsh.loginExtra = lib.optionalString cfg.sway.autostart ''
# Start Sway on login to TTY 1 # Start Sway on login to TTY 1
if [ "$TTY" = /dev/tty1 ]; then if [ "$TTY" = /dev/tty1 ]; then
exec sway exec sway
fi fi
''; '';
};
services = {
# Volume/Backlight control and notifications # Volume/Backlight control and notifications
services.avizo = { avizo = {
enable = true; enable = true;
settings.default = { settings.default = {
time = 0.8; time = 0.8;
@ -100,16 +102,18 @@ in {
}; };
}; };
# Sound tuning # Sound tuning
services.easyeffects.enable = true; easyeffects.enable = true;
# Auto configure displays # Auto configure displays
services.kanshi.enable = lib.mkDefault true; kanshi.enable = lib.mkDefault true;
# Notifications # Notifications
services.mako = { mako = {
enable = true; enable = true;
layer = "overlay"; layer = "overlay";
borderRadius = 8; borderRadius = 8;
defaultTimeout = 15000; defaultTimeout = 15000;
}; };
};
# Window Manager # Window Manager
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
@ -123,7 +127,7 @@ in {
# Set Gtk theme # Set Gtk theme
gtk = { gtk = {
enable = true; enable = true;
iconTheme = iconTheme; inherit iconTheme;
gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; gtk3.extraConfig.gtk-application-prefer-dark-theme = 1;
gtk4.extraConfig.gtk-application-prefer-dark-theme = 1; gtk4.extraConfig.gtk-application-prefer-dark-theme = 1;
}; };

View file

@ -4,7 +4,7 @@
}: let }: let
cfg = config.jhome.gui.sway; cfg = config.jhome.gui.sway;
modifier = "Mod4"; modifier = "Mod4";
terminal = config.jhome.gui.terminal; inherit (config.jhome.gui) terminal;
termCmd = termCmd =
if terminal == "wezterm" if terminal == "wezterm"
then "wezterm start" then "wezterm start"

View file

@ -4,13 +4,14 @@
}: let }: let
cfg = config.jhome.gui; cfg = config.jhome.gui;
in { in {
mainBar.layer = "top"; mainBar = {
mainBar.position = "top"; layer = "top";
mainBar.margin = "2 2 2 2"; position = "top";
margin = "2 2 2 2";
# Choose the order of the modules # Choose the order of the modules
mainBar.modules-left = ["sway/workspaces"]; modules-left = ["sway/workspaces"];
mainBar.modules-center = ["clock"]; modules-center = ["clock"];
mainBar.modules-right = modules-right =
[ [
"pulseaudio" "pulseaudio"
"backlight" "backlight"
@ -20,87 +21,79 @@ in {
] ]
++ lib.optional (cfg.tempInfo != null) "temperature" ++ lib.optional (cfg.tempInfo != null) "temperature"
++ ["tray"]; ++ ["tray"];
mainBar."sway/workspaces".disable-scroll = true; "sway/workspaces" = {
mainBar."sway/workspaces".persistent-workspaces."1" = []; disable-scroll = true;
mainBar."sway/workspaces".persistent-workspaces."2" = []; persistent-workspaces = {
mainBar."sway/workspaces".persistent-workspaces."3" = []; "1" = [];
mainBar."sway/workspaces".persistent-workspaces."4" = []; "2" = [];
mainBar."sway/workspaces".persistent-workspaces."5" = []; "3" = [];
mainBar."sway/workspaces".persistent-workspaces."6" = []; "4" = [];
mainBar."sway/workspaces".persistent-workspaces."7" = []; "5" = [];
mainBar."sway/workspaces".persistent-workspaces."8" = []; "6" = [];
mainBar."sway/workspaces".persistent-workspaces."9" = []; "7" = [];
mainBar."sway/language".format = "{} "; "8" = [];
mainBar."sway/language".min-length = 5; "9" = [];
mainBar."sway/language".tooltip = false; };
mainBar.memory.format = "{used:0.1f}/{total:0.1f}GiB "; };
mainBar.memory.interval = 3; "sway/language" = {
mainBar.clock.timezone = "Europe/Berlin"; format = "{} ";
mainBar.clock.tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"; min-length = 5;
mainBar.clock.format = "{:%a, %d %b, %H:%M}"; tooltip = false;
mainBar.pulseaudio.reverse-scrolling = 1; };
mainBar.pulseaudio.format = "{volume}% {icon} {format_source}"; memory = {
mainBar.pulseaudio.format-bluetooth = "{volume}% {icon} {format_source}"; format = "{used:0.1f}/{total:0.1f}GiB ";
mainBar.pulseaudio.format-bluetooth-muted = "{volume}% 󰖁 {icon} {format_source}"; interval = 3;
mainBar.pulseaudio.format-muted = "{volume}% 󰖁 {format_source}"; };
mainBar.pulseaudio.format-source = "{volume}% "; clock = {
mainBar.pulseaudio.format-source-muted = "{volume}% 󰍭"; timezone = "Europe/Berlin";
mainBar.pulseaudio.format-icons.headphone = "󰋋"; tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
mainBar.pulseaudio.format-icons.hands-free = ""; format = "{:%a, %d %b, %H:%M}";
mainBar.pulseaudio.format-icons.headset = "󰋎"; };
mainBar.pulseaudio.format-icons.phone = "󰘂"; pulseaudio = {
mainBar.pulseaudio.format-icons.portable = ""; reverse-scrolling = 1;
mainBar.pulseaudio.format-icons.car = ""; format = "{volume}% {icon} {format_source}";
mainBar.pulseaudio.format-icons.default = [ format-bluetooth = "{volume}% {icon} {format_source}";
"󰕿" format-bluetooth-muted = "{volume}% 󰖁 {icon} {format_source}";
"󰖀" format-muted = "{volume}% 󰖁 {format_source}";
"󰕾" format-source = "{volume}% ";
]; format-source-muted = "{volume}% 󰍭";
mainBar.pulseaudio.on-click = "pavucontrol"; format-icons = {
mainBar.pulseaudio.min-length = 13; headphone = "󰋋";
mainBar.temperature = lib.optionalAttrs (cfg.tempInfo != null) { hands-free = "";
headset = "󰋎";
phone = "󰘂";
portable = "";
car = "";
default = ["󰕿" "󰖀" "󰕾"];
};
on-click = "pavucontrol";
min-length = 13;
};
temperature = lib.optionalAttrs (cfg.tempInfo != null) {
inherit (cfg.tempInfo) hwmon-path; inherit (cfg.tempInfo) hwmon-path;
critical-threshold = 80; critical-threshold = 80;
format = "{temperatureC}°C {icon}"; format = "{temperatureC}°C {icon}";
format-icons = [ format-icons = ["" "" "" "" ""];
""
""
""
""
""
];
tooltip = false; tooltip = false;
}; };
mainBar.backlight.device = "intel_backlight"; backlight = {
mainBar.backlight.format = "{percent}% {icon}"; device = "intel_backlight";
mainBar.backlight.format-icons = [ format = "{percent}% {icon}";
"󰃚" format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"];
"󰃛" min-length = 7;
"󰃜" };
"󰃝" battery = {
"󰃞" states.warning = 30;
"󰃟" states.critical = 15;
"󰃠" format = "{capacity}% {icon}";
]; format-charging = "{capacity}% 󰂄";
mainBar.backlight.min-length = 7; format-plugged = "{capacity}% 󰚥";
mainBar.battery.states.warning = 30; format-alt = "{time} {icon}";
mainBar.battery.states.critical = 15; format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
mainBar.battery.format = "{capacity}% {icon}"; };
mainBar.battery.format-charging = "{capacity}% 󰂄"; tray = {
mainBar.battery.format-plugged = "{capacity}% 󰚥"; icon-size = 16;
mainBar.battery.format-alt = "{time} {icon}"; spacing = 0;
mainBar.battery.format-icons = [ };
"󰁺" };
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
mainBar.tray.icon-size = 16;
mainBar.tray.spacing = 0;
} }

View file

@ -155,9 +155,10 @@ in {
description = "Setup development environment for programming languages."; description = "Setup development environment for programming languages.";
default = {}; default = {};
type = types.submodule { type = types.submodule {
options.enable = lib.mkEnableOption "development settings"; options = {
options.neovimAsManPager = lib.mkEnableOption "neovim as the man pager"; enable = lib.mkEnableOption "development settings";
options.extraPackages = mkExtraPackagesOption "dev" [ neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
extraPackages = mkExtraPackagesOption "dev" [
["jq"] # json parser ["jq"] # json parser
["just"] # just a command runner ["just"] # just a command runner
["typos"] # low false positive rate typo checker ["typos"] # low false positive rate typo checker
@ -165,7 +166,7 @@ in {
["man-pages"] # gimme the man pages ["man-pages"] # gimme the man pages
["man-pages-posix"] # I said gimme the man pages!!! ["man-pages-posix"] # I said gimme the man pages!!!
]; ];
options.rust = lib.mkOption { rust = lib.mkOption {
description = "Jalil's default rust configuration."; description = "Jalil's default rust configuration.";
default = {}; default = {};
type = types.submodule { type = types.submodule {
@ -181,6 +182,7 @@ in {
}; };
}; };
}; };
};
user = lib.mkOption { user = lib.mkOption {
description = "User settings."; description = "User settings.";
default = null; default = null;

View file

@ -7,32 +7,39 @@
nixos-hardware.nixosModules.common-pc-laptop-ssd nixos-hardware.nixosModules.common-pc-laptop-ssd
nixos-hardware.nixosModules.common-cpu-intel nixos-hardware.nixosModules.common-cpu-intel
]; ];
fileSystems = {
# Setup extra filesystem options # Setup extra filesystem options
fileSystems."/".options = ["compress=zstd"]; "/".options = ["compress=zstd"];
fileSystems."/home".options = ["compress=zstd"]; "/home".options = ["compress=zstd"];
fileSystems."/nix".options = [ "/nix".options = [
"compress=zstd" "compress=zstd"
"noatime" "noatime"
]; ];
};
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
boot.loader = {
# Bootloader # Bootloader
boot.loader.systemd-boot.enable = true; systemd-boot = {
boot.loader.systemd-boot.configurationLimit = 10; enable = true;
boot.loader.efi.canTouchEfiVariables = true; configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};
# Network configuration # Network configuration
networking.hostName = "capricorn"; networking = {
networking.networkmanager.enable = true; hostName = "capricorn";
networking.networkmanager.wifi.backend = "iwd"; networkmanager = {
networking.networkmanager.appendNameservers = [ enable = true;
wifi.backend = "iwd";
appendNameservers = [
"1.1.1.1" "1.1.1.1"
"1.0.0.1" "1.0.0.1"
"8.8.8.8" "8.8.8.8"
"8.4.4.8" "8.4.4.8"
]; ];
};
};
console.useXkbConfig = true; console.useXkbConfig = true;

View file

@ -8,38 +8,42 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
boot.initrd.availableKernelModules = [ initrd = {
availableKernelModules = [
"xhci_pci" "xhci_pci"
"ahci" "ahci"
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
]; ];
boot.initrd.kernelModules = []; kernelModules = [];
boot.kernelModules = ["kvm-intel"]; };
boot.extraModulePackages = []; kernelModules = ["kvm-intel"];
extraModulePackages = [];
fileSystems."/" = { };
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=root"]; options = ["subvol=root"];
}; };
fileSystems."/nix" = { "/nix" = {
device = "/dev/disk/by-label/NIXROOT"; device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=nix"]; options = ["subvol=nix"];
}; };
fileSystems."/home" = { "/home" = {
device = "/dev/disk/by-label/NIXHOME"; device = "/dev/disk/by-label/NIXHOME";
fsType = "btrfs"; fsType = "btrfs";
}; };
fileSystems."/boot" = { "/boot" = {
device = "/dev/disk/by-label/NIXBOOT"; device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat"; fsType = "vfat";
}; };
};
swapDevices = [{device = "/dev/disk/by-label/NIXSWAP";}]; swapDevices = [{device = "/dev/disk/by-label/NIXSWAP";}];

View file

@ -11,40 +11,46 @@
nixos-hardware.nixosModules.common-cpu-amd nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-gpu-amd nixos-hardware.nixosModules.common-gpu-amd
]; ];
fileSystems = {
fileSystems."/".options = ["compress=zstd"]; "/".options = ["compress=zstd"];
fileSystems."/steam".options = ["compress=zstd"]; "/steam".options = ["compress=zstd"];
fileSystems."/home".options = ["compress=zstd"]; "/home".options = ["compress=zstd"];
fileSystems."/nix".options = [ "/nix".options = [
"compress=zstd" "compress=zstd"
"noatime" "noatime"
]; ];
};
boot.loader = {
systemd-boot = {
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; enable = true;
boot.loader.systemd-boot.configurationLimit = 3; configurationLimit = 3;
boot.loader.efi.canTouchEfiVariables = true; };
efi.canTouchEfiVariables = true;
};
# Enable bluetooth # Enable bluetooth
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
networking = {
networking.hostName = "gemini"; hostName = "gemini";
networking.networkmanager.enable = true; networkmanager.enable = true;
networking.interfaces.enp4s0.wakeOnLan.enable = true; interfaces.enp4s0.wakeOnLan.enable = true;
};
console = { console = {
# font = "Lat2-Terminus16"; # font = "Lat2-Terminus16";
# keyMap = "us"; # keyMap = "us";
useXkbConfig = true; # use xkbOptions in tty. useXkbConfig = true; # use xkbOptions in tty.
}; };
services.openssh = {
# Configure keymap in X11 # Configure keymap in X11
# services.xserver.xkbOptions = { # services.xserver.xkbOptions = {
# "caps:swapescape" # map caps to escape. # "caps:swapescape" # map caps to escape.
# }; # };
services.openssh.enable = true; enable = true;
services.openssh.startWhenNeeded = true; startWhenNeeded = true;
services.openssh.settings.AllowUsers = ["jalil"]; settings.AllowUsers = ["jalil"];
};
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;

View file

@ -8,8 +8,9 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
boot.initrd.availableKernelModules = [ initrd = {
availableKernelModules = [
"nvme" "nvme"
"xhci_pci" "xhci_pci"
"ahci" "ahci"
@ -17,38 +18,41 @@
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
]; ];
boot.initrd.kernelModules = []; kernelModules = [];
boot.kernelModules = ["kvm-amd"]; };
boot.extraModulePackages = []; kernelModules = ["kvm-amd"];
extraModulePackages = [];
fileSystems."/" = { };
fileSystems = {
"/" = {
# device = "/dev/disk/by-label/NIXOSROOT"; # device = "/dev/disk/by-label/NIXOSROOT";
device = "/dev/disk/by-label/NIXOSHOME"; device = "/dev/disk/by-label/NIXOSHOME";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=root"]; options = ["subvol=root"];
}; };
fileSystems."/steam" = { "/steam" = {
device = "/dev/disk/by-label/STEAM"; device = "/dev/disk/by-label/STEAM";
fsType = "btrfs"; fsType = "btrfs";
}; };
fileSystems."/home" = { "/home" = {
device = "/dev/disk/by-label/NIXOSHOME"; device = "/dev/disk/by-label/NIXOSHOME";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=home"]; options = ["subvol=home"];
}; };
fileSystems."/nix" = { "/nix" = {
device = "/dev/disk/by-label/NIXOSROOT"; device = "/dev/disk/by-label/NIXOSROOT";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=nix"]; options = ["subvol=nix"];
}; };
fileSystems."/boot" = { "/boot" = {
device = "/dev/disk/by-label/BOOT"; device = "/dev/disk/by-label/BOOT";
fsType = "vfat"; fsType = "vfat";
}; };
};
swapDevices = [{device = "/dev/disk/by-label/SWAP";}]; swapDevices = [{device = "/dev/disk/by-label/SWAP";}];

View file

@ -20,39 +20,49 @@
"noatime" "noatime"
]; ];
}; };
boot = {
boot.kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = ["amdgpu.dcdebugmask=0x10"]; # Fixes graphical issues kernelParams = ["amdgpu.dcdebugmask=0x10"];
loader = {
hardware.opengl.enable = true;
hardware.bluetooth.enable = true;
hardware.tuxedo-rs.enable = true;
hardware.tuxedo-rs.tailor-gui.enable = true;
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.timeout = 0; # Press Space to show the menu timeout = 0; # Press Space to show the menu
boot.loader.efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = true; systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 10; systemd-boot.configurationLimit = 10;
};
networking.hostName = "libra"; };
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. # Fixes graphical issues
hardware = {
opengl.enable = true;
bluetooth.enable = true;
tuxedo-rs = {
enable = true;
tailor-gui.enable = true;
};
};
networking = {
hostName = "libra";
networkmanager = {
enable = true; # Easiest to use and most distros use this by default.
# networking.networkmanager.wifi.backend = "iwd"; # Seems to cause problems # networking.networkmanager.wifi.backend = "iwd"; # Seems to cause problems
networking.networkmanager.appendNameservers = [ appendNameservers = [
"1.1.1.1" "1.1.1.1"
"1.0.0.1" "1.0.0.1"
"8.8.8.8" "8.8.8.8"
"8.4.4.8" "8.4.4.8"
]; ];
};
};
# Select internationalisation properties. # use xkb.options in tty.
console.useXkbConfig = true; # use xkb.options in tty. console.useXkbConfig = true;
services = {
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; printing.enable = true;
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; openssh.enable = true;
};
# This option defines the first version of NixOS you have installed on this particular machine, # This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.

View file

@ -9,39 +9,43 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
boot.initrd.availableKernelModules = [ initrd = {
availableKernelModules = [
"nvme" "nvme"
"xhci_pci" "xhci_pci"
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
]; ];
boot.initrd.kernelModules = []; kernelModules = [];
boot.kernelModules = ["kvm-amd"]; };
boot.extraModulePackages = []; kernelModules = ["kvm-amd"];
extraModulePackages = [];
fileSystems."/" = { };
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=root"]; options = ["subvol=root"];
}; };
fileSystems."/home" = { "/home" = {
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=home"]; options = ["subvol=home"];
}; };
fileSystems."/nix" = { "/nix" = {
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=nix"]; options = ["subvol=nix"];
}; };
fileSystems."/boot" = { "/boot" = {
device = "/dev/disk/by-uuid/4E80-8B60"; device = "/dev/disk/by-uuid/4E80-8B60";
fsType = "vfat"; fsType = "vfat";
}; };
};
swapDevices = []; swapDevices = [];

View file

@ -1,4 +1,4 @@
{...}: { _: {
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [

View file

@ -1,7 +1,9 @@
{ {
autoGroups."highlightOnYank" = {}; autoGroups = {
autoGroups."lspConfig" = {}; "highlightOnYank" = {};
autoGroups."restoreCursorPosition" = {}; "lspConfig" = {};
"restoreCursorPosition" = {};
};
autoCmd = [ autoCmd = [
{ {
group = "highlightOnYank"; group = "highlightOnYank";

View file

@ -20,12 +20,15 @@ in {
package = pkgs.neovim; package = pkgs.neovim;
globals.mapleader = " "; globals.mapleader = " ";
# Appearance # Appearance
colorschemes = { colorschemes.gruvbox = {
gruvbox.enable = true; enable = true;
gruvbox.settings.bold = true; settings = {
gruvbox.settings.transparent_mode = true; bold = true;
gruvbox.settings.terminal_colors = true; transparent_mode = true;
terminal_colors = true;
}; };
};
opts = { opts = {
number = true; number = true;
relativenumber = true; relativenumber = true;

View file

@ -51,21 +51,30 @@ in {
# Enable dev documentation # Enable dev documentation
documentation.dev.enable = cfg.dev.enable; documentation.dev.enable = cfg.dev.enable;
programs = {
# Shell prompt # Shell prompt
programs.starship.enable = true; starship = {
programs.starship.settings = lib.mkIf cfg.styling.enable { enable = true;
settings = lib.mkIf cfg.styling.enable {
format = "$time$all"; format = "$time$all";
add_newline = false; add_newline = false;
cmd_duration.min_time = 500; cmd_duration.min_time = 500;
cmd_duration.show_milliseconds = true; cmd_duration.show_milliseconds = true;
time.format = "[$time](bold yellow) "; time = {
time.disabled = false; format = "[$time](bold yellow) ";
status.format = "[$signal_name$common_meaning$maybe_int](red)"; disabled = false;
status.symbol = "[](bold red)"; };
status.disabled = false; status = {
format = "[$signal_name$common_meaning$maybe_int](red)";
symbol = "[](bold red)";
disabled = false;
};
sudo.disabled = false; sudo.disabled = false;
}; };
};
# Default shell
zsh.enable = true;
};
environment.etc = keysFromGithub; environment.etc = keysFromGithub;
services.openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") ( services.openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (
@ -74,29 +83,32 @@ in {
# Enable printer autodiscovery if printing is enabled # Enable printer autodiscovery if printing is enabled
services.avahi = { services.avahi = {
enable = config.services.printing.enable; inherit (config.services.printing) enable;
nssmdns4 = true; nssmdns4 = true;
openFirewall = true; openFirewall = true;
}; };
# Default shell
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
# Open ports for spotifyd # Open ports for spotifyd
networking.firewall.allowedUDPPorts = [5353]; networking.firewall = {
networking.firewall.allowedTCPPorts = [2020]; allowedUDPPorts = [5353];
allowedTCPPorts = [2020];
};
# Nix Settings # Nix Settings
nix.gc.automatic = true; nix = {
nix.gc.dates = "weekly"; gc = {
nix.gc.options = "--delete-older-than 30d"; automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
# run between 0 and 45min after boot if run was missed # run between 0 and 45min after boot if run was missed
nix.gc.randomizedDelaySec = "45min"; randomizedDelaySec = "45min";
nix.settings.auto-optimise-store = true; };
nix.settings.experimental-features = [ settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; ];
}; };
};
};
} }

View file

@ -17,8 +17,8 @@ in {
pkgs.pinentry-qt pkgs.pinentry-qt
] ]
++ lib.optional cfg.ydotool.enable pkgs.ydotool; ++ lib.optional cfg.ydotool.enable pkgs.ydotool;
systemd = {
systemd.user.services.ydotool = lib.mkIf cfg.ydotool.enable { user.services.ydotool = lib.mkIf cfg.ydotool.enable {
enable = cfg.ydotool.autoStart; enable = cfg.ydotool.autoStart;
wantedBy = ["default.target"]; wantedBy = ["default.target"];
description = "Generic command-line automation tool"; description = "Generic command-line automation tool";
@ -36,46 +36,61 @@ in {
}; };
}; };
# Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851 # Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851
systemd.user.extraConfig = '' user.extraConfig = ''
DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
''; '';
};
fonts.fontDir.enable = true; fonts.fontDir.enable = true;
programs = {
programs.dconf.enable = true; dconf.enable = true;
sway = {
programs.sway.enable = cfg.sway; enable = cfg.sway;
programs.sway.extraPackages = []; # No extra packages (by default it adds foot, dmenu, and other stuff) # No extra packages (by default it adds foot, dmenu, and other stuff)
programs.sway.wrapperFeatures.base = true; extraPackages = [];
programs.sway.wrapperFeatures.gtk = true; wrapperFeatures = {
base = true;
security.polkit.enable = true; gtk = true;
security.rtkit.enable = true; # Recommended for pipewire };
};
services.flatpak.enable = true; };
security = {
polkit.enable = true;
rtkit.enable = true; # Recommended for pipewire
};
services = {
flatpak.enable = true;
# Audio # Audio
services.pipewire.enable = true; pipewire = {
services.pipewire.alsa.enable = true; enable = true;
services.pipewire.alsa.support32Bit = true; alsa = {
services.pipewire.pulse.enable = true; enable = true;
services.pipewire.wireplumber.enable = true; support32Bit = true;
};
pulse.enable = true;
wireplumber.enable = true;
};
# Dbus # Dbus
services.dbus.enable = true; dbus.enable = true;
};
xdg.portal = {
# XDG portals # XDG portals
xdg.portal.enable = true; enable = true;
xdg.portal.wlr.enable = true; wlr.enable = true;
xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; extraPortals = [pkgs.xdg-desktop-portal-gtk];
config.preferred = {
# Default to the gtk portal # Default to the gtk portal
xdg.portal.config.preferred.default = "gtk"; default = "gtk";
# Use wlr for screenshots and screen recording # Use wlr for screenshots and screen recording
xdg.portal.config.preferred."org.freedesktop.impl.portal.Screenshot" = "wlr"; "org.freedesktop.impl.portal.Screenshot" = "wlr";
xdg.portal.config.preferred."org.freedesktop.impl.portal.ScreenCast" = "wlr"; };
# Consider using darkman like upstream # Consider using darkman like upstream
};
hardware.opengl.enable = true; hardware = {
hardware.uinput.enable = true; opengl.enable = true;
hardware.steam-hardware.enable = cfg.steamHardwareSupport; uinput.enable = true;
steam-hardware.enable = cfg.steamHardwareSupport;
};
}) })
(lib.mkIf (enable && cfg."8bitdoFix") { (lib.mkIf (enable && cfg."8bitdoFix") {
# Udev rules to start or stop systemd service when controller is connected or disconnected # Udev rules to start or stop systemd service when controller is connected or disconnected

View file

@ -13,32 +13,36 @@ in {
image = cfg.wallpaper; image = cfg.wallpaper;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
polarity = "dark"; polarity = "dark";
fonts.monospace = [ fonts = {
monospace = [
{ {
name = "JetBrains Mono"; name = "JetBrains Mono";
package = pkgs.jetbrains-mono; package = pkgs.jetbrains-mono;
} }
fallbackSymbols fallbackSymbols
]; ];
fonts.sansSerif = [ sansSerif = [
{ {
name = "Noto Sans"; name = "Noto Sans";
package = pkgs.noto-fonts; package = pkgs.noto-fonts;
} }
fallbackSymbols fallbackSymbols
]; ];
fonts.serif = [ serif = [
{ {
name = "Noto Serif"; name = "Noto Serif";
package = pkgs.noto-fonts; package = pkgs.noto-fonts;
} }
fallbackSymbols fallbackSymbols
]; ];
fonts.emoji = { emoji = {
package = pkgs.noto-fonts-emoji; package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji"; name = "Noto Color Emoji";
}; };
fonts.sizes.popups = 12; sizes.popups = 12;
targets.plymouth.logoAnimated = false; };
targets.plymouth.logo = cfg.bootLogo; targets.plymouth = {
logoAnimated = false;
logo = cfg.bootLogo;
};
} }