Factorised some nix expressions because I had some time to spare, started adding a new host

This commit is contained in:
Alexandre1a 2026-01-14 22:10:18 +01:00
parent a6c0ba30dc
commit 9fddd3f4c8
No known key found for this signature in database
GPG Key ID: CE01C28FBC5EEF10
21 changed files with 348 additions and 232 deletions

View File

@ -28,12 +28,9 @@
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
# CLI # CLI
btop
hello hello
fastfetch
yt-dlp yt-dlp
syncthing # ToDo: configure it ig syncthing # ToDo: configure it ig
cmatrix
spicetify-cli spicetify-cli
# Dev CLI # Dev CLI
doxygen doxygen
@ -41,9 +38,6 @@
pkg-config pkg-config
swig swig
pandoc pandoc
gh
fzf
eza
# GUI apps # GUI apps
vscode vscode
@ -70,6 +64,7 @@
python312 # The main interpreter python312 # The main interpreter
#pip # The package manager #pip # The package manager
]; ];
shellAliases = { shellAliases = {
drs = "sudo darwin-rebuild switch --flake ~/Developer/nix/NixOSDots#macOS"; drs = "sudo darwin-rebuild switch --flake ~/Developer/nix/NixOSDots#macOS";
nrs = "sudo nixos-rebuild switch --flake ~/Developer/nix/NixOSDots#nixos"; nrs = "sudo nixos-rebuild switch --flake ~/Developer/nix/NixOSDots#nixos";

View File

@ -1,6 +1,10 @@
{ {
# Common nixos systems modules (not nix-darwin)
imports = [ imports = [
../../modules/common/nix.nix ../../modules/common/nix.nix
../../modules/nixos/locale.nix ../../modules/nixos/locale.nix # For localisation options
../../modules/common/ssh.nix
../../modules/nixos/bootloader.nix
../../modules/common/environment.nix
]; ];
} }

View File

@ -4,4 +4,41 @@
./modules.nix ./modules.nix
]; ];
networking = {
hostName = "light";
};
# Users
# Don't forget to add a password or change the username
users = {
users = {
light = { # Here
isNormalUser = true;
# You can change the description too !
description = "A lightweight system for lowend or performance machines"
shell = pkgs.zsh;
extraGroups = [ "networkmanager" "wheel" ];
};
};
};
# Home-Manager config
home-manager = {
extraSpecialArgs = { inherit inputs };
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "HM-backup";
users = {
# Change this to your username
"light" = import ./home.nix";
};
};
environment = {
systemPackages = with pkgs; [
wget
git
];
};
} }

View File

@ -13,32 +13,21 @@
environment = { environment = {
systemPackages = with pkgs; systemPackages = with pkgs;
[ [
# Basic text editing for all users
neovim
vim
# General tools
btop
eza
fastfetch
ffmpeg
fzf
git
git-lfs git-lfs
gnupg
wget
tree
netcat
tmux
#telnet #telnet
]; ];
pathsToLink = [ "/share/zsh" ]; pathsToLink = [ "/share/zsh" ];
}; };
# Create the user # Create the user
users.users.alex = { users = {
users = {
alex = {
description = "Alexandre Delcamp--Enache"; description = "Alexandre Delcamp--Enache";
home = "/Users/alex"; home = "/Users/alex";
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
};
};
# HomeManager # HomeManager
home-manager = { home-manager = {
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
@ -61,14 +50,18 @@
}; };
# Enable required settings # Enable required settings
# TouchID login # TouchID login
security.pam.services.sudo_local.touchIdAuth = true; security = {
pam = {
services = {
sudo_local = {
touchIdAuth = true;
};
};
};
};
# Target arch # Target arch
nixpkgs = { nixpkgs = {
hostPlatform = "aarch64-darwin"; hostPlatform = "aarch64-darwin";
config = {
allowUnfree = true;
};
}; };
# Nix-Darwin State Version # Nix-Darwin State Version
system = { system = {

View File

@ -6,14 +6,14 @@
../common/home.nix ../common/home.nix
]; ];
home.stateVersion = "25.11";
# Allow unfree packages
#nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [ home = {
packages = with pkgs; [
# Window management (maybe configure it with home-manager) # Window management (maybe configure it with home-manager)
yabai yabai
skhd skhd
#borders #borders
]; ];
stateVersion = "25.11";
};
} }

View File

@ -3,7 +3,7 @@
{ {
# Enpty file for future imports # Enpty file for future imports
imports = [ imports = [
../common/modules.nix ../../modules/common/nix.nix
../../modules/macos/ollama.nix ../../modules/macos/ollama.nix
../../modules/common/ai.nix ../../modules/common/ai.nix
]; ];

View File

@ -11,11 +11,12 @@
./modules.nix ./modules.nix
]; ];
# Bootloader. networking = {
boot.loader.systemd-boot.enable = true; hostName = "nixos"; # Define your hostname.
boot.loader.efi.canTouchEfiVariables = true; networkmanager = {
enable = true; # Enables wireless connectivity
networking.hostName = "nixos"; # Define your hostname. };
};
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
@ -47,11 +48,11 @@
# networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.alex = { users = {
users = {
alex = {
isNormalUser = true; isNormalUser = true;
description = "Alexandre Delcamp--Enache"; description = "Alexandre Delcamp--Enache";
shell = pkgs.zsh; shell = pkgs.zsh;
@ -59,6 +60,8 @@
packages = with pkgs; [ packages = with pkgs; [
]; ];
}; };
};
};
home-manager = { home-manager = {
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
@ -83,23 +86,11 @@
enableAutosuggestions = true; enableAutosuggestions = true;
}; };
}; };
# Hint Electron Apps to use Wayland
environment = {
sessionVariables.NIXOS_OZONE_WL = "1";
pathsToLink = [ "/share/zsh" ];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment = {
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. systemPackages = with pkgs; [
wget
git
tree
kitty
neovim
playerctl playerctl
# Nvidia packages # Nvidia packages
@ -113,6 +104,10 @@
# Theme SDDM # Theme SDDM
sddm-astronaut sddm-astronaut
]; ];
# Hint Electron Apps to use Wayland
sessionVariables.NIXOS_OZONE_WL = "1";
pathsToLink = [ "/share/zsh" ];
};
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.

View File

@ -8,10 +8,14 @@
[ (modulesPath + "/installer/scan/not-detected.nix") [ (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; boot = {
boot.initrd.kernelModules = [ ]; initrd = {
boot.kernelModules = [ "kvm-intel" ]; availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.extraModulePackages = [ ]; kernelModules = [ ];
};
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
};
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/09ecff70-45e5-48b4-baed-00534605fc04"; { device = "/dev/disk/by-uuid/09ecff70-45e5-48b4-baed-00534605fc04";
@ -30,10 +34,20 @@
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true; networking ={
useDHCP = lib.mkDefault true;
};
# networking.interfaces.eno1.useDHCP = lib.mkDefault true; # networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs = {
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hostPlatform = lib.mkDefault "x86_64-linux";
};
hardware = {
cpu = {
intel = {
updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
};
};
};
} }

View File

@ -14,11 +14,10 @@
# You should not change this value, even if you update Home Manager. If you do # You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager # want to update the value, then make sure to first check the Home Manager
# release notes. # release notes.
home.stateVersion = "25.11"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your home = {
# environment. stateVersion = "25.11"; # Please read the comment before changing.
home.packages = with pkgs; [ packages = with pkgs; [
# # Adds the 'hello' command to your environment. It prints a friendly # # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run. # # "Hello, world!" when run.
@ -28,8 +27,10 @@
firefox firefox
cava cava
# File manager # File manager
kdePackages.dolphin kdePackages = [
kdePackages.gwenview dolphin
gwenview
]
# Hypr* ecosystem # Hypr* ecosystem
hyprlauncher hyprlauncher
@ -46,10 +47,9 @@
# echo "Hello, ${config.home.username}!" # echo "Hello, ${config.home.username}!"
# '') # '')
]; ];
# Home Manager is pretty good at managing dotfiles. The primary way to manage # Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'. # plain files is through 'home.file'.
home.file = { file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in # # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a # # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy. # # symlink to the Nix store copy.
@ -61,6 +61,12 @@
# org.gradle.daemon.idletimeout=3600000 # org.gradle.daemon.idletimeout=3600000
# ''; # '';
}; };
sessionVariables = {
EDITOR = "vim";
};
};
# Home Manager can also manage your environment variables through # Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a # 'home.sessionVariables'. These will be explicitly sourced when using a
@ -78,7 +84,4 @@
# #
# /etc/profiles/per-user/alex/etc/profile.d/hm-session-vars.sh # /etc/profiles/per-user/alex/etc/profile.d/hm-session-vars.sh
# #
home.sessionVariables = {
# EDITOR = "emacs";
};
} }

View File

@ -7,11 +7,9 @@
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
../../modules/nixos/secrets.nix # Sops ../../modules/nixos/secrets.nix # Sops
# ../../modules/nixos/wireless.nix # For the wifi # ../../modules/nixos/wireless.nix # For the wifi
../../modules/nixos/locale.nix # For localisation options
../../modules/nixos/gamming/nvidia.nix # Nvidia (Drivers and Settings) ../../modules/nixos/gamming/nvidia.nix # Nvidia (Drivers and Settings)
../../modules/nixos/gamming/steam.nix # For Steam/Proton/Lutris/MangoHUD/Heroic/Bottles ../../modules/nixos/gamming/steam.nix # For Steam/Proton/Lutris/MangoHUD/Heroic/Bottles
../../modules/common/spotify.nix # Spotify/Spicetify ../../modules/common/spotify.nix # Spotify
../../modules/common/ssh.nix
../../modules/common/ai.nix ../../modules/common/ai.nix
]; ];
} }

View File

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
environment = {
systemPackages = with pkgs; [
# Text editors
neovim
vim
# Sytem utilities
wget
git
tree
btop
eza
fastfetch
ffmpeg
fzf
netcat
tmux
gnupg
cmatrix
gh
];
}
}

View File

@ -25,4 +25,10 @@
]; ];
}; };
}; };
nixpkgs = {
config = {
allowUnfree = true;
};
};
} }

View File

@ -2,13 +2,19 @@
{ {
# Installs Spotify and Spicetify (import this module in configuration.nix) # Installs Spotify and Spicetify (import this module in configuration.nix)
environment.systemPackages = with pkgs; [ environment = {
systemPackages = with pkgs; [
spotify spotify
]; ];
};
networking = {
firewall = {
# Local discovery # Local discovery
networking.firewall.allowedTCPPorts = [ 57621 ]; allowedTCPPorts = [ 57621 ];
# Spotify Connect # Spotify Connect
networking.firewall.allowedUDPPorts = [ 5353 ]; allowedUDPPorts = [ 5353 ];
};
};
} }

View File

@ -1,10 +1,12 @@
{ {
# The OpenSSH agent # The OpenSSH agent
programs.ssh = { programs = {
ssh = {
startAgent = true; startAgent = true;
extraConfig = '' extraConfig = ''
Host github.com Host github.com
IdentityFile ~/.ssh/github IdentityFile ~/.ssh/github
''; '';
}; };
};
} }

View File

@ -1,7 +1,8 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
programs.zsh = { programs = {
zsh = {
enable = true; enable = true;
package = pkgs.zsh; package = pkgs.zsh;
enableCompletion = true; enableCompletion = true;
@ -42,4 +43,5 @@
]; ];
}; };
}; };
};
} }

View File

@ -0,0 +1,12 @@
{
boot = {
loader = {
systemd-boot = {
enable = true;
};
efi = {
canTouchEfiVariables = true;
};
};
};
}

View File

@ -22,17 +22,20 @@
kernelParams = [ kernelParams = [
"nvidia-drm.modset=1" # DRM modesetting "nvidia-drm.modset=1" # DRM modesetting
]; ];
initrd.kernelModules = [ initrd = {
kernelModules = [
"nvidia" "nvidia"
"nvidia_modeset" "nvidia_modeset"
"nvidia_uvm" "nvidia_uvm"
"nvidia_drm" "nvidia_drm"
]; ];
};
kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
}; };
# Environment variables # Environment variables
environment.sessionVariables = { environment ={
sessionVariables = {
# Backend GBM for NVIDIA # Backend GBM for NVIDIA
GBM_BACKEND = "nvidia-drm"; GBM_BACKEND = "nvidia-drm";
@ -49,7 +52,12 @@
# Native Wayland Electron Apps # Native Wayland Electron Apps
NIXOS_OZONE_WL = "1"; NIXOS_OZONE_WL = "1";
}; };
};
# Nvidia Drivers # Nvidia Drivers
services.xserver.videoDrivers = [ "nvidia" ]; services = {
xserver = {
videoDrivers = [ "nvidia" ];
};
};
} }

View File

@ -15,17 +15,21 @@
}; };
# Proton GE # Proton GE
environment.sessionVariables = { environment = {
sessionVariables = {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = STEAM_EXTRA_COMPAT_TOOLS_PATHS =
"/home/alex/.steam/root/compatibilitytools.d"; "/home/alex/.steam/root/compatibilitytools.d";
}; };
};
# Programmes requis # Programmes requis
environment.systemPackages = with pkgs; [ environment = {
systemPackages = with pkgs; [
mangohud mangohud
protonup-ng protonup-ng
lutris lutris
heroic heroic
bottles bottles
]; ];
};
} }

View File

@ -19,12 +19,17 @@
}; };
# Keymap in X11 # Keymap in X11
services.xserver.xkb = { services = {
xserver = {
xkb = {
layout = "fr"; layout = "fr";
#variant = "fr"; #variant = "fr";
}; };
};
};
# Keymap in the console # Keymap in the console
console.keyMap = "fr"; console = {
keyMap = "fr";
};
} }

View File

@ -5,6 +5,8 @@
defaultSopsFile = ../../secrets/secrets.yaml; defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml"; defaultSopsFormat = "yaml";
age.keyFile = "${config.home-manager.users.alex.home.homeDirectory}/.config/sops/age/keys.txt"; age = {
keyFile = "${config.home-manager.users.alex.home.homeDirectory}/.config/sops/age/keys.txt";
};
}; };
} }

View File

@ -1,15 +1,21 @@
{ config, ... }: { config, ... }:
{ {
sops.secrets."wireless/freebox-password" = { sops = {
secrets = {
"wireless/freebox-password" = {
owner = "root"; owner = "root";
group = "root"; group = "root";
mode = "0400"; mode = "0400";
}; };
};
};
networking.wireless.networks = { networking = {
wireless.networks = {
Freebox-357429 = { Freebox-357429 = {
pskRaw = "ext:${config.sops.secrets."wireless/freebox-password".path}"; pskRaw = "ext:${config.sops.secrets."wireless/freebox-password".path}";
}; };
}; };
};
} }