init: working configuration for ahrc-laptop

Not modularized for now.
This commit is contained in:
Ahurac 2024-09-30 13:17:30 +02:00
commit 6c619fd2aa
5 changed files with 521 additions and 0 deletions

310
ahrc-laptop/home.nix Normal file
View file

@ -0,0 +1,310 @@
{ config, pkgs, ... }:
{
home.username = "ahurac";
home.homeDirectory = "/home/ahurac";
home.stateVersion = "24.05";
home.packages = with pkgs; [
pavucontrol
thunderbird
wl-clipboard
swayosd
prismlauncher
anyrun
noto-fonts
libreoffice
mosh
webcord
element-desktop
joplin-desktop
gnumake
man-pages
man-pages-posix
clang-tools
gdb
gcc
valgrind
weston
(nerdfonts.override { fonts = [ "Hack" ]; })
];
home.sessionVariables = {
EDITOR = "hx";
# XDG_DATA_DIRS =
# "${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:${HOME}/.local/share/flatpak/exports/share";
};
gtk = {
enable = true;
theme = {
package = pkgs.adw-gtk3;
name = "adw-gtk3-dark";
};
iconTheme = {
package = pkgs.adwaita-icon-theme;
name = "Adwaita";
};
};
programs.home-manager.enable = true;
programs.firefox.enable = true;
programs.kitty.enable = true;
programs.hyprlock.enable = true;
programs.helix = {
enable = true;
package = pkgs.evil-helix;
languages.language = [
{
name = "nix";
auto-format = true;
formatter.command = "nixfmt";
}
{
name = "c";
auto-format = true;
formatter.command = "clang-format";
}
];
};
programs.rbw = {
enable = true;
settings = {
email = "hchauvin@mailbox.org";
base_url = "https://vw.ahur.ac";
pinentry = pkgs.pinentry-curses;
};
};
fonts.fontconfig.enable = true;
fonts.fontconfig.defaultFonts = {
sansSerif = [ "Noto Sans" ];
monospace = [ "Hack Nerd Font" ];
emoji = [ "Noto Color Emoji" ];
};
home.pointerCursor = {
name = "Bibata-Modern-Ice";
package = pkgs.bibata-cursors;
size = 24;
gtk.enable = true;
};
programs.git = {
enable = true;
aliases = {
a = "add";
c = "commit";
s = "status";
d = "diff";
ch = "checkout";
r = "restore";
re = "reset";
p = "pull";
pu = "push";
m = "merge";
l = "log";
graph = "log --graph --oneline";
sh = "show";
};
userEmail = "ahurac@mailbox.org";
userName = "Ahurac";
extraConfig = {
init.defaultBranch = "main";
push.autoSetupRemote = true;
};
};
programs.zsh = {
enable = true;
shellAliases = {
g = "git";
j = "jobs";
};
localVariables = {
PROMPT = ''
(%F{green}%B%n@%m%f%b)(%F{blue}%B%50<...<%5~%<<%b%f)(%B%?%b)
(%B%j%b%# '';
};
plugins = [{
name = "vi-mode";
src = pkgs.zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}];
};
wayland.windowManager.hyprland = {
enable = true;
plugins = [ pkgs.hyprlandPlugins.hy3 ];
settings = {
monitor = ", highrr, 0x0, 1";
"$terminal" = "kitty";
"$browser" = "firefox";
"$locker" = "hyprlock";
"$launcher" = "anyrun";
"$joplin" = "";
"$matrix_client" = "";
"$discord" = "";
"$deezer" = "";
"$col_accentdark" = "rgb(00ff00)";
"$col_accentlight" = "rgb(80ff80)";
"$col_inactive" = "rgba(80808040)";
"$col_urgent" = "rgb(ffd966)";
animations = { enabled = false; };
binds = {
scroll_event_delay = 0;
workspace_back_and_forth = false;
allow_workspace_cycles = false;
workspace_center_on = 1;
focus_preferred_method = 1;
movefocus_cycles_fullscreen = false;
};
decoration = {
rounding = 10;
active_opacity = 1.0;
inactive_opacity = 1.0;
fullscreen_opacity = 1.0;
drop_shadow = false;
dim_inactive = false;
blur.enabled = false;
};
general = {
border_size = 2;
"col.inactive_border" = "$col_inactive";
"col.nogroup_border" = "$col_inactive";
"col.active_border" = "$col_accentdark $col_accentlight 90deg";
resize_on_border = false;
gaps_in = 5;
gaps_out = 10;
gaps_workspaces = 0;
layout = "hy3";
no_focus_fallback = true;
};
gestures.workspace_swipe = true;
input = {
kb_layout = "fr";
numlock_by_default = true;
repeat_rate = 75;
repeat_delay = 300;
kb_options = "compose:rctrl";
sensitivity = 0.0;
accel_profile = "flat";
touchpad = {
disable_while_typing = false;
natural_scroll = true;
};
};
misc = {
disable_hyprland_logo = false;
disable_splash_rendering = false;
layers_hog_keyboard_focus = true;
mouse_move_focuses_monitor = true;
enable_swallow = false;
close_special_on_empty = true;
new_window_takes_over_fullscreen = 2;
animate_manual_resizes = false;
};
plugin.hy3 = {
no_gaps_when_only = false;
node_collapse_policy = 0;
tabs = {
height = 5;
padding = 5;
from_top = true;
rounding = 4;
render_text = false;
"col.active" = "$col_accentdark";
"col.urgent" = "$col_urgent";
"col.inactive" = "$col_inactive";
};
autotile.enable = true;
};
xwayland = { force_zero_scaling = true; };
env = [
"QT_QPA_PLATFORM, wayland"
"QT_QPA_PLATFORM, qt6ct"
"QT_AUTO_SCREEN_SCALE_FACTOR, 1"
"QT_WAYLAND_DISABLE_WINDOWDECORATION, 1"
"CLUTTER_BACKEND, wayland"
"SDL_VIDEODRIVER, wayland"
"ELM_DISPLAY, wl"
"_JAVA_AWT_WM_NONREPARENTING, 1"
"XDG_SESSION_DESKTOP, Hyprland"
"ELECTRON_OZONE_PLATFORM_HINT, auto"
"HYPRCURSOR_THEME, bibata_modern_ice-hyprcursor"
];
bind = [
"SUPER, Space, exec, $terminal"
"SUPER SHIFT, Space, exec, $terminal -e sudo -i"
"SUPER, equal, movetoworkspace, special"
"SUPER, 10, workspace, 1"
"SUPER, 11, workspace, 2"
"SUPER, 12, workspace, 3"
"SUPER, 13, workspace, 4"
"SUPER, R, workspace, 5"
"SUPER, F, workspace, 6"
"SUPER, V, workspace, 7"
"SUPER, C, workspace, 8"
"SUPER, X, workspace, 9"
"SUPER, W, workspace, 10"
"SUPER, mouse_down, workspace, e-1"
"SUPER, mouse_up, workspace, e+1"
"SUPER SHIFT, Q, hy3:killactive"
"SUPER SHIFT, 10, movetoworkspacesilent, 1"
"SUPER SHIFT, 11, movetoworkspacesilent, 2"
"SUPER SHIFT, 12, movetoworkspacesilent, 3"
"SUPER SHIFT, 13, movetoworkspacesilent, 4"
"SUPER SHIFT, R, movetoworkspacesilent, 5"
"SUPER SHIFT, F, movetoworkspacesilent, 6"
"SUPER SHIFT, V, movetoworkspacesilent, 7"
"SUPER SHIFT, C, movetoworkspacesilent, 8"
"SUPER SHIFT, X, movetoworkspacesilent, 9"
"SUPER SHIFT, W, movetoworkspacesilent, 10"
"SUPER SHIFT, A, hy3:movewindow, l"
"SUPER SHIFT, Z, hy3:movewindow, u"
"SUPER SHIFT, S, hy3:movewindow, d"
"SUPER SHIFT, D, hy3:movewindow, r"
"SUPER SHIFT, Return, togglefloating"
"SUPER Alt_L, F, fullscreen"
"SUPER, A, hy3:movefocus, l"
"SUPER, Z, hy3:movefocus, u"
"SUPER, S, hy3:movefocus, d"
"SUPER, D, hy3:movefocus, r"
"SUPER, Q, hy3:makegroup, tab, force_ephemeral"
"SUPER, E, hy3:changegroup, opposite"
"SUPER, B, hy3:changegroup, toggletab"
"SUPER SHIFT, BackSpace, exit"
"SUPER, F1, exec, $launcher"
"SUPER, F2, exec, $joplin"
"SUPER, F3, exec, $matrix_client"
"SUPER, F4, exec, $discord"
"SUPER, F5, exec, $deezer"
"SUPER, G, exec, $browser"
"SUPER, L, exec, $locker"
];
bindm =
[ "SUPER, mouse:272, movewindow" "SUPER, mouse:273, resizewindow" ];
bindn = [
", mouse:272, hy3:focustab, mouse"
", mouse_up, hy3:focustab, r, require_hovered, wrap"
", mouse_down, hy3:focustab, l, require_hovered, wrap"
];
bindel = [
", XF86AudioRaiseVolume, exec, swayosd-client --output-volume=raise"
", XF86AudioLowerVolume, exec, swayosd-client --output-volume=lower"
", XF86AudioMute, exec, swayosd-client --output-volume=mute-toggle"
", XF86MonBrightnessUp, exec, swayosd-client --brightness=up"
", XF86MonBrightnessDown, exec, swayosd-client --brightness=lower"
];
};
};
}

93
configuration.nix Normal file
View file

@ -0,0 +1,93 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./hardware-configuration.nix ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.timeout = 0;
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.tmp.useTmpfs = true;
networking.hostName = "ahrc-laptop";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "fr-pc";
};
services.pipewire = {
enable = true;
pulse.enable = true;
};
#nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [
vim
curl
ncdu
htop
tmux
powertop
file
nixfmt-classic
tree
brightnessctl
podman-compose
];
services.libinput.enable = true;
services.udisks2.enable = true;
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 100;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 20;
CPU_MAX_PERF_ON_BAT = 100;
};
};
programs.hyprland.enable = true;
programs.zsh.enable = true;
programs.bash.promptInit = ''
if [ "$(whoami)" = root ]; then
color=31
else
color=32
user='\u@'
fi
PS1="\[\033[0m\](\[\033[1;''${color}m\]''${user}\h\[\033[0m\] \[\033[1;34m\]\W\[\033[0m\])\\$ "
'';
virtualisation.containers.enable = true;
virtualisation = {
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
boot.kernel.sysctl."net.ipv4.ip_unprivileged_port_start" = 0;
users.users.ahurac = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.zsh;
};
system.stateVersion = "24.05";
}

49
flake.lock Normal file
View file

@ -0,0 +1,49 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1727383923,
"narHash": "sha256-4/vacp3CwdGoPf8U4e/N8OsGYtO09WTcQK5FqYfJbKs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ffe2d07e771580a005e675108212597e5b367d2d",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1727348695,
"narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View file

@ -0,0 +1,24 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }: {
nixosConfigurations.ahrc-laptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.ahurac = import ./ahrc-laptop/home.nix;
}
];
};
};
}

View file

@ -0,0 +1,45 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.initrd.luks.devices.crypted.device = "/dev/disk/by-uuid/6ee3bc81-e827-4b53-9655-8acff61dc369";
fileSystems."/" =
{ device = "/dev/disk/by-uuid/84df99b4-ba9f-418b-9b79-c015ed17ed30";
fsType = "xfs";
};
fileSystems."/var" =
{ device = "/dev/disk/by-uuid/7ea116a5-b910-450b-aeeb-d006b820be92";
fsType = "ext4";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/0c4f356b-b738-4c63-915a-ef82dd59c01e";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/58CB-B4D3";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ {
device = "/swapfile";
size = 8 * 1024;
} ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}