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

View file

@ -36,80 +36,84 @@ in {
++ lib.optional flatpakEnabled flatpak; ++ lib.optional flatpakEnabled flatpak;
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
# Browser # Browser
programs.firefox.enable = true; programs = {
# Dynamic Menu firefox.enable = true;
programs.fuzzel = { # Dynamic Menu
enable = true; fuzzel = {
settings.main = { enable = true;
icon-theme = "Papirus-Dark"; settings.main = {
terminal = cfg.terminal; icon-theme = "Papirus-Dark";
inherit (cfg) terminal;
layer = "overlay";
};
};
# Video player
mpv = {
enable = true;
scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;};
};
# Status bar
waybar = {
enable = true;
systemd.enable = true;
settings = import ./waybar-settings.nix {inherit config lib;};
style = ''
.modules-left #workspaces button {
border-bottom: 3px solid @base01;
}
.modules-left #workspaces button.persistent {
border-bottom: 3px solid transparent;
}
'';
};
# Terminal
wezterm = {
enable = cfg.terminal == "wezterm";
extraConfig = ''
config = {}
config.hide_tab_bar_if_only_one_tab = true
config.window_padding = { left = 1, right = 1, top = 1, bottom = 1 }
return config
'';
};
alacritty.enable = cfg.terminal == "alacritty";
zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexerr built in
# PDF reader
zathura.enable = true;
# Auto start sway
zsh.loginExtra = lib.optionalString cfg.sway.autostart ''
# Start Sway on login to TTY 1
if [ "$TTY" = /dev/tty1 ]; then
exec sway
fi
'';
};
services = {
# Volume/Backlight control and notifications
avizo = {
enable = true;
settings.default = {
time = 0.8;
border-width = 0;
height = 176;
y-offset = 0.1;
block-spacing = 1;
};
};
# Sound tuning
easyeffects.enable = true;
# Auto configure displays
kanshi.enable = lib.mkDefault true;
# Notifications
mako = {
enable = true;
layer = "overlay"; layer = "overlay";
borderRadius = 8;
defaultTimeout = 15000;
}; };
}; };
# Video player
programs.mpv = {
enable = true;
scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;};
};
# Status bar
programs.waybar = {
enable = true;
systemd.enable = true;
settings = import ./waybar-settings.nix {inherit config lib;};
style = ''
.modules-left #workspaces button {
border-bottom: 3px solid @base01;
}
.modules-left #workspaces button.persistent {
border-bottom: 3px solid transparent;
}
'';
};
# Terminal
programs.wezterm = {
enable = cfg.terminal == "wezterm";
extraConfig = ''
config = {}
config.hide_tab_bar_if_only_one_tab = true
config.window_padding = { left = 1, right = 1, top = 1, bottom = 1 }
return config
'';
};
programs.alacritty.enable = cfg.terminal == "alacritty";
programs.zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexerr built in
# PDF reader
programs.zathura.enable = true;
# Auto start sway
programs.zsh.loginExtra = lib.optionalString cfg.sway.autostart ''
# Start Sway on login to TTY 1
if [ "$TTY" = /dev/tty1 ]; then
exec sway
fi
'';
# Volume/Backlight control and notifications
services.avizo = {
enable = true;
settings.default = {
time = 0.8;
border-width = 0;
height = 176;
y-offset = 0.1;
block-spacing = 1;
};
};
# Sound tuning
services.easyeffects.enable = true;
# Auto configure displays
services.kanshi.enable = lib.mkDefault true;
# Notifications
services.mako = {
enable = true;
layer = "overlay";
borderRadius = 8;
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,103 +4,96 @@
}: 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";
# Choose the order of the modules margin = "2 2 2 2";
mainBar.modules-left = ["sway/workspaces"]; # Choose the order of the modules
mainBar.modules-center = ["clock"]; modules-left = ["sway/workspaces"];
mainBar.modules-right = modules-center = ["clock"];
[ modules-right =
"pulseaudio" [
"backlight" "pulseaudio"
"battery" "backlight"
"sway/language" "battery"
"memory" "sway/language"
] "memory"
++ lib.optional (cfg.tempInfo != null) "temperature" ]
++ ["tray"]; ++ lib.optional (cfg.tempInfo != null) "temperature"
mainBar."sway/workspaces".disable-scroll = true; ++ ["tray"];
mainBar."sway/workspaces".persistent-workspaces."1" = []; "sway/workspaces" = {
mainBar."sway/workspaces".persistent-workspaces."2" = []; disable-scroll = true;
mainBar."sway/workspaces".persistent-workspaces."3" = []; persistent-workspaces = {
mainBar."sway/workspaces".persistent-workspaces."4" = []; "1" = [];
mainBar."sway/workspaces".persistent-workspaces."5" = []; "2" = [];
mainBar."sway/workspaces".persistent-workspaces."6" = []; "3" = [];
mainBar."sway/workspaces".persistent-workspaces."7" = []; "4" = [];
mainBar."sway/workspaces".persistent-workspaces."8" = []; "5" = [];
mainBar."sway/workspaces".persistent-workspaces."9" = []; "6" = [];
mainBar."sway/language".format = "{} "; "7" = [];
mainBar."sway/language".min-length = 5; "8" = [];
mainBar."sway/language".tooltip = false; "9" = [];
mainBar.memory.format = "{used:0.1f}/{total:0.1f}GiB "; };
mainBar.memory.interval = 3; };
mainBar.clock.timezone = "Europe/Berlin"; "sway/language" = {
mainBar.clock.tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"; format = "{} ";
mainBar.clock.format = "{:%a, %d %b, %H:%M}"; min-length = 5;
mainBar.pulseaudio.reverse-scrolling = 1; tooltip = false;
mainBar.pulseaudio.format = "{volume}% {icon} {format_source}"; };
mainBar.pulseaudio.format-bluetooth = "{volume}% {icon} {format_source}"; memory = {
mainBar.pulseaudio.format-bluetooth-muted = "{volume}% 󰖁 {icon} {format_source}"; format = "{used:0.1f}/{total:0.1f}GiB ";
mainBar.pulseaudio.format-muted = "{volume}% 󰖁 {format_source}"; interval = 3;
mainBar.pulseaudio.format-source = "{volume}% "; };
mainBar.pulseaudio.format-source-muted = "{volume}% 󰍭"; clock = {
mainBar.pulseaudio.format-icons.headphone = "󰋋"; timezone = "Europe/Berlin";
mainBar.pulseaudio.format-icons.hands-free = ""; tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
mainBar.pulseaudio.format-icons.headset = "󰋎"; format = "{:%a, %d %b, %H:%M}";
mainBar.pulseaudio.format-icons.phone = "󰘂"; };
mainBar.pulseaudio.format-icons.portable = ""; pulseaudio = {
mainBar.pulseaudio.format-icons.car = ""; reverse-scrolling = 1;
mainBar.pulseaudio.format-icons.default = [ format = "{volume}% {icon} {format_source}";
"󰕿" format-bluetooth = "{volume}% {icon} {format_source}";
"󰖀" format-bluetooth-muted = "{volume}% 󰖁 {icon} {format_source}";
"󰕾" format-muted = "{volume}% 󰖁 {format_source}";
]; format-source = "{volume}% ";
mainBar.pulseaudio.on-click = "pavucontrol"; format-source-muted = "{volume}% 󰍭";
mainBar.pulseaudio.min-length = 13; format-icons = {
mainBar.temperature = lib.optionalAttrs (cfg.tempInfo != null) { headphone = "󰋋";
inherit (cfg.tempInfo) hwmon-path; hands-free = "";
critical-threshold = 80; headset = "󰋎";
format = "{temperatureC}°C {icon}"; phone = "󰘂";
format-icons = [ portable = "";
"" car = "";
"" default = ["󰕿" "󰖀" "󰕾"];
"" };
"" on-click = "pavucontrol";
"" min-length = 13;
]; };
tooltip = false; temperature = lib.optionalAttrs (cfg.tempInfo != null) {
inherit (cfg.tempInfo) hwmon-path;
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = ["" "" "" "" ""];
tooltip = false;
};
backlight = {
device = "intel_backlight";
format = "{percent}% {icon}";
format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"];
min-length = 7;
};
battery = {
states.warning = 30;
states.critical = 15;
format = "{capacity}% {icon}";
format-charging = "{capacity}% 󰂄";
format-plugged = "{capacity}% 󰚥";
format-alt = "{time} {icon}";
format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
tray = {
icon-size = 16;
spacing = 0;
};
}; };
mainBar.backlight.device = "intel_backlight";
mainBar.backlight.format = "{percent}% {icon}";
mainBar.backlight.format-icons = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
mainBar.backlight.min-length = 7;
mainBar.battery.states.warning = 30;
mainBar.battery.states.critical = 15;
mainBar.battery.format = "{capacity}% {icon}";
mainBar.battery.format-charging = "{capacity}% 󰂄";
mainBar.battery.format-plugged = "{capacity}% 󰚥";
mainBar.battery.format-alt = "{time} {icon}";
mainBar.battery.format-icons = [
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
mainBar.tray.icon-size = 16;
mainBar.tray.spacing = 0;
} }

View file

@ -155,28 +155,30 @@ 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";
["jq"] # json parser extraPackages = mkExtraPackagesOption "dev" [
["just"] # just a command runner ["jq"] # json parser
["typos"] # low false positive rate typo checker ["just"] # just a command runner
["git-absorb"] # fixup! but automatic ["typos"] # low false positive rate typo checker
["man-pages"] # gimme the man pages ["git-absorb"] # fixup! but automatic
["man-pages-posix"] # I said gimme the man pages!!! ["man-pages"] # gimme the man pages
]; ["man-pages-posix"] # I said gimme the man pages!!!
options.rust = lib.mkOption { ];
description = "Jalil's default rust configuration."; rust = lib.mkOption {
default = {}; description = "Jalil's default rust configuration.";
type = types.submodule { default = {};
options.enable = lib.mkEnableOption "rust development settings"; type = types.submodule {
options.extraPackages = mkExtraPackagesOption "Rust" [ options.enable = lib.mkEnableOption "rust development settings";
["cargo-kcov"] # code coverage options.extraPackages = mkExtraPackagesOption "Rust" [
["cargo-msrv"] # minimum supported version ["cargo-kcov"] # code coverage
["cargo-nextest"] # better testing harness ["cargo-msrv"] # minimum supported version
["cargo-sort"] # sort deps and imports ["cargo-nextest"] # better testing harness
["cargo-watch"] # watch for file changes and run commands ["cargo-sort"] # sort deps and imports
]; ["cargo-watch"] # watch for file changes and run commands
];
};
}; };
}; };
}; };

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;
"1.1.1.1" wifi.backend = "iwd";
"1.0.0.1" appendNameservers = [
"8.8.8.8" "1.1.1.1"
"8.4.4.8" "1.0.0.1"
]; "8.8.8.8"
"8.4.4.8"
];
};
};
console.useXkbConfig = true; console.useXkbConfig = true;

View file

@ -8,37 +8,41 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
boot.initrd.availableKernelModules = [ initrd = {
"xhci_pci" availableKernelModules = [
"ahci" "xhci_pci"
"usb_storage" "ahci"
"sd_mod" "usb_storage"
]; "sd_mod"
boot.initrd.kernelModules = []; ];
boot.kernelModules = ["kvm-intel"]; kernelModules = [];
boot.extraModulePackages = []; };
kernelModules = ["kvm-intel"];
fileSystems."/" = { extraModulePackages = [];
device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = ["subvol=root"];
}; };
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
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"
]; ];
};
# Use the systemd-boot EFI boot loader. boot.loader = {
boot.loader.systemd-boot.enable = true; systemd-boot = {
boot.loader.systemd-boot.configurationLimit = 3; # Use the systemd-boot EFI boot loader.
boot.loader.efi.canTouchEfiVariables = true; enable = true;
configurationLimit = 3;
};
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,46 +8,50 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
boot.initrd.availableKernelModules = [ initrd = {
"nvme" availableKernelModules = [
"xhci_pci" "nvme"
"ahci" "xhci_pci"
"usbhid" "ahci"
"usb_storage" "usbhid"
"sd_mod" "usb_storage"
]; "sd_mod"
boot.initrd.kernelModules = []; ];
boot.kernelModules = ["kvm-amd"]; kernelModules = [];
boot.extraModulePackages = []; };
kernelModules = ["kvm-amd"];
fileSystems."/" = { extraModulePackages = [];
# device = "/dev/disk/by-label/NIXOSROOT";
device = "/dev/disk/by-label/NIXOSHOME";
fsType = "btrfs";
options = ["subvol=root"];
}; };
fileSystems = {
"/" = {
# device = "/dev/disk/by-label/NIXOSROOT";
device = "/dev/disk/by-label/NIXOSHOME";
fsType = "btrfs";
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 = {
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["amdgpu.dcdebugmask=0x10"];
loader = {
# Use the systemd-boot EFI boot loader.
timeout = 0; # Press Space to show the menu
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
systemd-boot.configurationLimit = 10;
};
};
# 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
appendNameservers = [
"1.1.1.1"
"1.0.0.1"
"8.8.8.8"
"8.4.4.8"
];
};
};
boot.kernelPackages = pkgs.linuxPackages_latest; # use xkb.options in tty.
boot.kernelParams = ["amdgpu.dcdebugmask=0x10"]; # Fixes graphical issues console.useXkbConfig = true;
services = {
# Enable CUPS to print documents.
printing.enable = true;
hardware.opengl.enable = true; # Enable the OpenSSH daemon.
hardware.bluetooth.enable = true; openssh.enable = true;
hardware.tuxedo-rs.enable = true; };
hardware.tuxedo-rs.tailor-gui.enable = true;
# Use the systemd-boot EFI boot loader.
boot.loader.timeout = 0; # Press Space to show the menu
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 10;
networking.hostName = "libra";
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# networking.networkmanager.wifi.backend = "iwd"; # Seems to cause problems
networking.networkmanager.appendNameservers = [
"1.1.1.1"
"1.0.0.1"
"8.8.8.8"
"8.4.4.8"
];
# Select internationalisation properties.
console.useXkbConfig = true; # use xkb.options in tty.
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable the OpenSSH daemon.
services.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,38 +9,42 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
boot.initrd.availableKernelModules = [ initrd = {
"nvme" availableKernelModules = [
"xhci_pci" "nvme"
"usb_storage" "xhci_pci"
"sd_mod" "usb_storage"
]; "sd_mod"
boot.initrd.kernelModules = []; ];
boot.kernelModules = ["kvm-amd"]; kernelModules = [];
boot.extraModulePackages = []; };
kernelModules = ["kvm-amd"];
fileSystems."/" = { extraModulePackages = [];
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs";
options = ["subvol=root"];
}; };
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs";
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,20 +51,29 @@ 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;
format = "$time$all"; settings = lib.mkIf cfg.styling.enable {
add_newline = false; format = "$time$all";
cmd_duration.min_time = 500; add_newline = false;
cmd_duration.show_milliseconds = true; cmd_duration.min_time = 500;
time.format = "[$time](bold yellow) "; cmd_duration.show_milliseconds = true;
time.disabled = false; time = {
status.format = "[$signal_name$common_meaning$maybe_int](red)"; format = "[$time](bold yellow) ";
status.symbol = "[](bold red)"; disabled = false;
status.disabled = false; };
sudo.disabled = false; status = {
format = "[$signal_name$common_meaning$maybe_int](red)";
symbol = "[](bold red)";
disabled = false;
};
sudo.disabled = false;
};
};
# Default shell
zsh.enable = true;
}; };
environment.etc = keysFromGithub; environment.etc = keysFromGithub;
@ -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;
# run between 0 and 45min after boot if run was missed dates = "weekly";
nix.gc.randomizedDelaySec = "45min"; options = "--delete-older-than 30d";
nix.settings.auto-optimise-store = true; # run between 0 and 45min after boot if run was missed
nix.settings.experimental-features = [ randomizedDelaySec = "45min";
"nix-command" };
"flakes" settings = {
]; auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
};
};
}; };
} }

View file

@ -17,65 +17,80 @@ 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";
documentation = [ documentation = [
"man:ydotool(1)" "man:ydotool(1)"
"man:ydotoold(8)" "man:ydotoold(8)"
]; ];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
Restart = "always"; Restart = "always";
ExecStart = "${pkgs.ydotool}/bin/ydotoold"; ExecStart = "${pkgs.ydotool}/bin/ydotoold";
ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID"; ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
KillMode = "process"; KillMode = "process";
TimeoutSec = 180; TimeoutSec = 180;
};
}; };
# Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851
user.extraConfig = ''
DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
'';
}; };
# Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851
systemd.user.extraConfig = ''
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; };
# Audio security = {
services.pipewire.enable = true; polkit.enable = true;
services.pipewire.alsa.enable = true; rtkit.enable = true; # Recommended for pipewire
services.pipewire.alsa.support32Bit = true; };
services.pipewire.pulse.enable = true; services = {
services.pipewire.wireplumber.enable = true; flatpak.enable = true;
# Dbus # Audio
services.dbus.enable = true; pipewire = {
enable = true;
# XDG portals alsa = {
xdg.portal.enable = true; enable = true;
xdg.portal.wlr.enable = true; support32Bit = true;
xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; };
# Default to the gtk portal pulse.enable = true;
xdg.portal.config.preferred.default = "gtk"; wireplumber.enable = true;
# Use wlr for screenshots and screen recording };
xdg.portal.config.preferred."org.freedesktop.impl.portal.Screenshot" = "wlr"; # Dbus
xdg.portal.config.preferred."org.freedesktop.impl.portal.ScreenCast" = "wlr"; dbus.enable = true;
# Consider using darkman like upstream };
xdg.portal = {
hardware.opengl.enable = true; # XDG portals
hardware.uinput.enable = true; enable = true;
hardware.steam-hardware.enable = cfg.steamHardwareSupport; wlr.enable = true;
extraPortals = [pkgs.xdg-desktop-portal-gtk];
config.preferred = {
# Default to the gtk portal
default = "gtk";
# Use wlr for screenshots and screen recording
"org.freedesktop.impl.portal.Screenshot" = "wlr";
};
# Consider using darkman like upstream
};
hardware = {
opengl.enable = true;
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"; {
package = pkgs.jetbrains-mono; name = "JetBrains Mono";
} package = pkgs.jetbrains-mono;
fallbackSymbols }
]; fallbackSymbols
fonts.sansSerif = [ ];
{ sansSerif = [
name = "Noto Sans"; {
package = pkgs.noto-fonts; name = "Noto Sans";
} package = pkgs.noto-fonts;
fallbackSymbols }
]; fallbackSymbols
fonts.serif = [ ];
{ serif = [
name = "Noto Serif"; {
package = pkgs.noto-fonts; name = "Noto Serif";
} package = pkgs.noto-fonts;
fallbackSymbols }
]; fallbackSymbols
fonts.emoji = { ];
package = pkgs.noto-fonts-emoji; emoji = {
name = "Noto Color Emoji"; package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
sizes.popups = 12;
};
targets.plymouth = {
logoAnimated = false;
logo = cfg.bootLogo;
}; };
fonts.sizes.popups = 12;
targets.plymouth.logoAnimated = false;
targets.plymouth.logo = cfg.bootLogo;
} }