From ffaf1de0ee699c2ace4e1100f9a67ec7ef5a3df2 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 30 Nov 2025 13:46:58 +0100 Subject: [PATCH] First Commit --- flake.lock | 48 +++++++++ flake.nix | 24 +++++ hosts/default/configuration.nix | 95 ++++++++++++++++++ hosts/default/hardware-configuration.nix | 39 ++++++++ hosts/default/home.nix | 122 +++++++++++++++++++++++ hosts/default/modules.nix | 10 ++ modules/home-manager/hyprland.nix | 0 modules/nixos/gamming/nvidia.nix | 19 ++++ modules/nixos/gamming/steam.nix | 31 ++++++ modules/nixos/locale.nix | 30 ++++++ modules/nixos/wireless.nix | 7 ++ 11 files changed, 425 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/default/configuration.nix create mode 100644 hosts/default/hardware-configuration.nix create mode 100644 hosts/default/home.nix create mode 100644 hosts/default/modules.nix create mode 100644 modules/home-manager/hyprland.nix create mode 100644 modules/nixos/gamming/nvidia.nix create mode 100644 modules/nixos/gamming/steam.nix create mode 100644 modules/nixos/locale.nix create mode 100644 modules/nixos/wireless.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f0dc6fb --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764361670, + "narHash": "sha256-jgWzgpIaHbL3USIq0gihZeuy1lLf2YSfwvWEwnfAJUw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "780be8ef503a28939cf9dc7996b48ffb1a3e04c6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1764242076, + "narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f5456fe --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: { + # use "nixos", or your hostname as the name of the configuration + # it's a better practice than "default" shown in the video + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/default/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + }; +} diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix new file mode 100644 index 0000000..0e21334 --- /dev/null +++ b/hosts/default/configuration.nix @@ -0,0 +1,95 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./modules.nix + inputs.home-manager.nixosModules.default + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Enable Flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # 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’. + users.users.alex = { + isNormalUser = true; + description = "Alexandre Delcamp--Enache"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + ]; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + "alex" = import ./home.nix; + }; + }; + + # Hyrpland Install + programs.hyprland.enable = true; + + # Hint Electron Apps to use Wayland + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + git + tree + kitty + neovim + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; # Did you read the comment? + +} diff --git a/hosts/default/hardware-configuration.nix b/hosts/default/hardware-configuration.nix new file mode 100644 index 0000000..f60eecf --- /dev/null +++ b/hosts/default/hardware-configuration.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/09ecff70-45e5-48b4-baed-00534605fc04"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A0C2-4983"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (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 + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/default/home.nix b/hosts/default/home.nix new file mode 100644 index 0000000..d3f729d --- /dev/null +++ b/hosts/default/home.nix @@ -0,0 +1,122 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "alex"; + home.homeDirectory = "/home/alex"; + + # Hyprland + wayland.windowManager.hyprland = { + enable = true; + + settings = { + # Variables + "$mod" = "SUPER"; + "$term" = "alacritty"; + "$launcher" = "wofi --show drun"; + "$browser" = "firefox"; + + # Input + input = { + kb_layout = "fr"; + kb_variant = ""; + }; + + # Keybinds + bind = [ + "$mod, Q, killactive" + "$mod, RETURN, exec, $term" + "$mod, M, exit" + "$mod, R, exec, $launcher" + "$mod, F, exec, $browser" + ]; + }; + }; + + # Git + programs.git = { + enable = true; + settings = { + user = { + email = "mateialex@outlook.fr"; + name = "Alexandre"; + }; + }; + }; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # 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 + # release notes. + home.stateVersion = "25.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + pkgs.hello + pkgs.btop + pkgs.fastfetch + + # Hyprland related (rice, etc...) + pkgs.wofi + pkgs.alacritty + pkgs.firefox + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/alex/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/hosts/default/modules.nix b/hosts/default/modules.nix new file mode 100644 index 0000000..688b54e --- /dev/null +++ b/hosts/default/modules.nix @@ -0,0 +1,10 @@ +{ + # This file is used to import all modules required by this setup. + imports = + [ + ../../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/steam.nix # For Steam/Proton/Lutris/MangoHUD/Heroic/Bottles + ]; +} diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/nixos/gamming/nvidia.nix b/modules/nixos/gamming/nvidia.nix new file mode 100644 index 0000000..58ae88b --- /dev/null +++ b/modules/nixos/gamming/nvidia.nix @@ -0,0 +1,19 @@ +{ + hardware = { + #OpenGL + graphics = { + enable = true; + enable32Bit = true; + }; + #Nvidia Drivers + nvidia = { + open = true; + modesetting = { + enable = true; + }; + }; + }; + + # Nvidia Drivers + services.xserver.videoDrivers = ["nvidia"]; +} diff --git a/modules/nixos/gamming/steam.nix b/modules/nixos/gamming/steam.nix new file mode 100644 index 0000000..502eb9b --- /dev/null +++ b/modules/nixos/gamming/steam.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: + +{ + # Steam + programs = { + steam = { + enable = true; + gamescopeSession = { + enable = true; + }; + }; + gamemode = { + enable = true; + }; + }; + + # Proton GE + environment.sessionVariables = { + STEAM_EXTRA_COMPAT_TOOLS_PATHS = + "/home/alex/.steam/root/compatibilitytools.d"; + }; + + # Programmes requis + environment.systemPackages = with pkgs; [ + mangohud + protonup-ng + lutris + heroic + bottles + ]; +} diff --git a/modules/nixos/locale.nix b/modules/nixos/locale.nix new file mode 100644 index 0000000..4183a8d --- /dev/null +++ b/modules/nixos/locale.nix @@ -0,0 +1,30 @@ +{ + # Toute la configuration lié à la langue, etc... + time.timeZone = "Europe/Paris"; + + i18n = { + defaultLocale = "fr_FR.UTF-8"; + + extraLocaleSettings = { + LC_ADDRESS = "fr_FR.UTF-8"; + LC_IDENTIFICATION = "fr_FR.UTF-8"; + LC_MEASURMENT = "fr_FR.UTF-8"; + LC_MONETARY = "fr_FR.UTF-8"; + LC_NAME = "fr_FR.UTF-8"; + LC_NUMERIC = "fr_FR.UTF-8"; + LC_PAPER = "fr_FR.UTF-8"; + LC_TELEPHONE = "fr_FR.UTF-8"; + LC_TIME = "fr_FR.UTF-8"; + }; + }; + + # Keymap in X11 + services.xserver.xkb = { + layout = "fr"; + variant = "fr"; + }; + + # Keymap in the console + console.keyMap = "fr"; + +} diff --git a/modules/nixos/wireless.nix b/modules/nixos/wireless.nix new file mode 100644 index 0000000..e8e8219 --- /dev/null +++ b/modules/nixos/wireless.nix @@ -0,0 +1,7 @@ +{ + networking.wireless.networks = { + Freebox-357429 = { + psk = "nv9dmq2sxwqcfhzmqvn4xb"; + }; + }; +}