Initial nixos configuration

This commit is contained in:
Samy Avrillon 2025-08-14 17:35:16 +02:00
parent 35f4a8026e
commit 7ac5d06c18
No known key found for this signature in database
GPG Key ID: 4E77725580DA73CE
9 changed files with 103 additions and 65 deletions

7
flake.lock generated
View File

@ -25,15 +25,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1745627989, "lastModified": 1746171682,
"narHash": "sha256-mOCdFmxocBPae7wg7RYWOtJzWMJk34u9493ItY0dVqw=", "narHash": "sha256-EyXUNSa+H+YvGVuQJP1nZskXAowxKYp79RNUsNdQTj4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "4d2d32231797bfa7213ae5e8ac89d25f8caaae82", "rev": "50eee705bbdbac942074a8c120e8194185633675",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }

View File

@ -4,32 +4,34 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs"; nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs: let outputs =
inputs:
let
inherit (inputs.nixpkgs) lib; inherit (inputs.nixpkgs) lib;
mkNixosSystems = lib.mapAttrs ( mkNixosSystems = lib.mapAttrs (
name: modules: name: modules:
lib.nixosSystem { lib.nixosSystem {
modules = modules = modules ++ [
modules
++ [
{ {
imports = [ (import "${inputs.home-manager}/nixos") ];
networking.hostName = name; networking.hostName = name;
nixpkgs.overlays = [inputs.nix-vscode-extensions.overlays.default]; nixpkgs.overlays = [ inputs.nix-vscode-extensions.overlays.default ];
} }
]; ];
specialArgs = {inherit inputs;}; specialArgs = { inherit inputs; };
} }
); );
in { in
formatter.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.alejandra; {
formatter.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
nixosConfigurations = mkNixosSystems { nixosConfigurations = mkNixosSystems {
polysaa = [ polysaa = [

View File

@ -7,16 +7,25 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = ["dm-snapshot"]; "xhci_pci"
boot.initrd.luks.devices.cryptroot.device = "/dev/disk/by-uuid/c75f2769-d32f-4eed-9237-ece7e783fec3"; "thunderbolt"
boot.kernelModules = ["kvm-intel"]; "nvme"
boot.extraModulePackages = []; "usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.initrd.luks.devices.cryptroot.device =
"/dev/disk/by-uuid/c75f2769-d32f-4eed-9237-ece7e783fec3";
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
fileSystems."/" = { fileSystems."/" = {
@ -27,11 +36,14 @@
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/6B09-29A2"; device = "/dev/disk/by-uuid/6B09-29A2";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0022" "dmask=0022"]; options = [
"fmask=0022"
"dmask=0022"
];
}; };
swapDevices = [ swapDevices = [
{device = "/dev/disk/by-uuid/77ed2d48-365d-4a61-8ada-509e8b7a744c";} { device = "/dev/disk/by-uuid/77ed2d48-365d-4a61-8ada-509e8b7a744c"; }
]; ];
networking.hostName = "polysaa"; networking.hostName = "polysaa";
@ -54,7 +66,7 @@
intel-media-driver intel-media-driver
]; ];
}; };
boot.kernelParams = ["i915.force_probe=7d45"]; boot.kernelParams = [ "i915.force_probe=7d45" ];
system.stateVersion = "24.11"; system.stateVersion = "24.11";
} }

View File

@ -6,12 +6,16 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
./locale.nix ./locale.nix
]; ];
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
@ -21,10 +25,11 @@
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
networking.networkmanager.ensureProfiles.profiles = with builtins; networking.networkmanager.ensureProfiles.profiles =
lib.concatMapAttrs with builtins;
(fname: _: import (./networks + "/${fname}")) lib.concatMapAttrs (fname: _: import (./networks + "/${fname}")) (
(lib.filterAttrs (fname: _: lib.hasSuffix ".nix" fname) (readDir ./networks)); lib.filterAttrs (fname: _: lib.hasSuffix ".nix" fname) (readDir ./networks)
);
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";
@ -36,10 +41,15 @@
# 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.mysaa = { users.users.mysaa = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel"]; # Enable sudo for the user. extraGroups = [ "wheel" ]; # Enable sudo for the user.
packages = with pkgs; [ };
home-manager.users.mysaa =
{ pkgs, ... }:
{
home.packages = with pkgs; [
tree tree
]; ];
home.stateVersion = "24.11";
}; };
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:

View File

@ -4,7 +4,8 @@
pkgs, pkgs,
modulePath, modulePath,
... ...
}: { }:
{
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
console.keyMap = "fr-bepo"; console.keyMap = "fr-bepo";
@ -12,7 +13,10 @@
i18n.inputMethod = { i18n.inputMethod = {
enable = true; enable = true;
type = "fcitx5"; type = "fcitx5";
fcitx5.addons = with pkgs; [fcitx5-gtk fcitx5-mozc]; fcitx5.addons = with pkgs; [
fcitx5-gtk
fcitx5-mozc
];
fcitx5.waylandFrontend = true; fcitx5.waylandFrontend = true;
fcitx5.plasma6Support = true; fcitx5.plasma6Support = true;
fcitx5.settings.inputMethod = { fcitx5.settings.inputMethod = {
@ -35,8 +39,12 @@
}; };
}; };
fcitx5.settings.globalOptions = { fcitx5.settings.globalOptions = {
"[Hotkey]" = {"EnumerateWithTriggerKeys" = true;}; "[Hotkey]" = {
"[Hotkey/TriggerKeys]" = {"0" = "Control+Shift+K";}; "EnumerateWithTriggerKeys" = true;
};
"[Hotkey/TriggerKeys]" = {
"0" = "Control+Shift+K";
};
"[Behaviour]" = { "[Behaviour]" = {
"ActiveByDefault" = true; "ActiveByDefault" = true;
}; };
@ -56,7 +64,7 @@
enable = true; enable = true;
keyboards = { keyboards = {
default = { default = {
ids = ["*"]; ids = [ "*" ];
settings = { settings = {
main = { main = {
"f23+leftshift+leftmeta" = "layer(control)"; "f23+leftshift+leftmeta" = "layer(control)";

View File

@ -24,7 +24,7 @@
may-fail = "false"; may-fail = "false";
method = "auto"; method = "auto";
}; };
proxy = {}; proxy = { };
wifi = { wifi = {
mode = "infrastructure"; mode = "infrastructure";
ssid = "eduroam-IPv6only"; ssid = "eduroam-IPv6only";
@ -58,7 +58,7 @@
addr-gen-mode = "1"; addr-gen-mode = "1";
method = "auto"; method = "auto";
}; };
proxy = {}; proxy = { };
wifi = { wifi = {
mode = "infrastructure"; mode = "infrastructure";
ssid = "eduroam"; ssid = "eduroam";

View File

@ -14,7 +14,7 @@
addr-gen-mode = "default"; addr-gen-mode = "default";
method = "auto"; method = "auto";
}; };
proxy = {}; proxy = { };
wifi = { wifi = {
mode = "infrastructure"; mode = "infrastructure";
ssid = "Livebox-bas"; ssid = "Livebox-bas";

View File

@ -6,7 +6,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
../basic ../basic
./packages.nix ./packages.nix
@ -17,7 +18,10 @@
services.displayManager.sddm.enable = true; services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true; services.desktopManager.plasma6.enable = true;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = ["displaylink" "modesetting"]; services.xserver.videoDrivers = [
"displaylink"
"modesetting"
];
# Enable CUPS to print documents. # Enable CUPS to print documents.
# services.printing.enable = true; # services.printing.enable = true;

View File

@ -3,8 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
users.users.mysaa.packages = with pkgs; [ {
home-manager.users.mysaa.home.packages = with pkgs; [
firefox firefox
vlc vlc
(vscode-with-extensions.override { (vscode-with-extensions.override {