From c1a677a5d2ffb3e1f3540f9d0cdddb54ec4734b9 Mon Sep 17 00:00:00 2001 From: srv-sin Date: Wed, 8 Oct 2025 13:11:14 +0200 Subject: [PATCH] init --- configuration.nix | 62 ++++++++++++++++++++++++++++++++++++++ flake.lock | 48 +++++++++++++++++++++++++++++ flake.nix | 24 +++++++++++++++ hardware-configuration.nix | 34 +++++++++++++++++++++ home.nix | 32 ++++++++++++++++++++ 5 files changed, 200 insertions(+) create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 home.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..668c283 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,62 @@ +{ inputs, config, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sdb"; + + networking.hostName = "srv-sin"; + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Paris"; + + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "fr_FR.UTF-8"; + LC_IDENTIFICATION = "fr_FR.UTF-8"; + LC_MEASUREMENT = "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"; + }; + + services.xserver.xkb = { + layout = "fr"; + variant = "azerty"; + }; + + console.keyMap = "fr"; + + users.users.baptiste = { + isNormalUser = true; + description = "server1"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + baptiste = import ./home.nix; + }; + }; + + environment.systemPackages = with pkgs; [ + vim + git + wget + ]; + system.stateVersion = "25.05"; + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..edaab72 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1759853171, + "narHash": "sha256-uqbhyXtqMbYIiMqVqUhNdSuh9AEEkiasoK3mIPIVRhk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1a09eb84fa9e33748432a5253102d01251f72d6d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1759831965, + "narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c9b6fb798541223bbb396d287d16f43520250518", + "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..e6a58d0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager= { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, ... } @ inputs: + let + system = "x86_64-linux"; + in + { + nixosConfigurations = { + srv-sin = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs system; }; + modules = [ ./configuration.nix ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..15f2af7 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,34 @@ +# 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 = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/009a39bc-c875-4f0f-aa47-3da0bb3cb086"; + fsType = "ext4"; + }; + + 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.enp3s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0f1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..2dfc9bf --- /dev/null +++ b/home.nix @@ -0,0 +1,32 @@ +{ config, pkgs, ... }: + +{ + + home.username = "baptiste"; + home.homeDirectory = "/home/baptiste"; + home.stateVersion = "25.05"; + + home.packages = with pkgs; [ + ]; + + home.sessionVariables = { + EDITOR = "vim"; + MANPAGER = "vim +Man!"; + }; + + programs.git = { + enable = true; + userName = "srv-sin"; + userEmail = "srv-sin@smayzy.ovh"; + extraConfig = { + core.editor = "vim"; + core.autocrlf = "input"; + credential.helper = "store"; + pull.rebase = "true"; + }; + }; + + programs.zoxide.enable = true; + + programs.home-manager.enable = true; +}