feat: modularization

This commit is contained in:
Ahurac 2024-09-30 13:54:20 +02:00
parent 6c619fd2aa
commit 9e890279e6
6 changed files with 92 additions and 94 deletions

View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
{
imports = [ ../common/configuration.nix ./hardware-configuration.nix ];
networking.hostName = "ahrc-laptop";
environment.systemPackages = with pkgs; [ powertop brightnessctl ];
services.libinput.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.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\])\\$ "
'';
system.stateVersion = "24.05";
}

View file

@ -27,6 +27,7 @@
gcc
valgrind
weston
nixfmt-classic
(nerdfonts.override { fonts = [ "Hack" ]; })
];
@ -110,6 +111,7 @@
l = "log";
graph = "log --graph --oneline";
sh = "show";
ds = "diff --staged";
};
userEmail = "ahurac@mailbox.org";
userName = "Ahurac";

50
common/configuration.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
{
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.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; [
git
vim
curl
ncdu
htop
tmux
file
tree
];
services.udisks2.enable = true;
programs.hyprland.enable = true;
programs.zsh.enable = true;
users.users.ahurac = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.zsh;
};
system.stateVersion = "24.05";
}

View file

@ -1,93 +0,0 @@
{ 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";
}

View file

@ -11,7 +11,7 @@
nixosConfigurations.ahrc-laptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
./ahrc-laptop/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;