commit 1ed75082fd8d125286087d40695f05ec4f386878 Author: Laurent Le Houerou Date: Thu Nov 14 16:36:40 2024 +0400 initial commit diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8c6c062 --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730633670, + "narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1730327045, + "narHash": "sha256-xKel5kd1AbExymxoIfQ7pgcX6hjw9jCgbiBjiUfSVJ8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "080166c15633801df010977d9d7474b4a6c549d7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..300a174 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + description = "NixOS configuration of Laurent Le Houerou"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; + + home-manager = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { + self, + nixpkgs, + home-manager, + ... + }: { + + nixosConfigurations.nixos = let + username = "laurent"; + specialArgs = { inherit username; }; + in nixpkgs.lib.nixosSystem { + inherit specialArgs; + system = "x86_64-linux"; + modules = [ + ./hosts/vm + ./users/${username}/nixos.nix + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = inputs; + home-manager.users.${username} = import ./users/${username}/home.nix; + } + + ]; + }; + }; +} diff --git a/home/core.nix b/home/core.nix new file mode 100644 index 0000000..c386cfb --- /dev/null +++ b/home/core.nix @@ -0,0 +1,8 @@ +{username, ...}: { + home = { + inherit username; + homeDirectory = "/home/${username}"; + stateVersion = "24.05"; + } + programs.home-manager.enable = true; +} \ No newline at end of file diff --git a/home/i3/config b/home/i3/config new file mode 100644 index 0000000..cd381f9 --- /dev/null +++ b/home/i3/config @@ -0,0 +1,235 @@ +# Catppuccin color scheme +set $rosewater #f5e0dc +set $flamingo #f2cdcd +set $pink #f5c2e7 +set $mauve #cba6f7 +set $red #f38ba8 +set $maroon #eba0ac +set $peach #fab387 +set $yellow #f9e2af +set $green #a6e3a1 +set $teal #94e2d5 +set $sky #89dceb +set $sapphire #74c7ec +set $blue #89b4fa +set $lavender #b4befe +set $text #cdd6f4 +set $subtext1 #bac2de +set $subtext0 #a6adc8 +set $overlay2 #9399b2 +set $overlay1 #7f849c +set $overlay0 #6c7086 +set $surface2 #585b70 +set $surface1 #45475a +set $surface0 #313244 +set $base #1e1e2e +set $mantle #181825 +set $crust #11111b + +# Window colors +# target title bg text indicator border +client.focused $lavender $crust $text $rosewater $lavender +client.focused_inactive $overlay0 $base $text $rosewater $overlay0 +client.unfocused $overlay0 $base $text $rosewater $overlay0 +client.urgent $peach $base $peach $overlay0 $peach +client.placeholder $overlay0 $base $text $overlay0 $overlay0 +client.background $base + +# Set mod key (Mod4 = Windows key) +set $mod Mod4 + +# Window title settings +for_window [class="^.*"] title_format "%title" +title_align center + +# General window behavior +# Set the default orientation for new windows (horizontal, vertical, or auto) +default_orientation auto +# Disable focus wrapping (moving focus past the edge of the screen) +focus_wrapping no +# Handle popups during fullscreen mode (leave fullscreen, display popup on current workspace, or ignore) +popup_during_fullscreen smart +# Show urgent workspace for 1000 milliseconds when a window requests attention +force_display_urgency_hint 1000 ms +# Determine how to handle focus when a window is activated (smart, urgent, focus, or none) +focus_on_window_activation urgent +# Enable quick switching between current and previous workspace +workspace_auto_back_and_forth yes + +# Font for window titles and bar +font pango:FiraCode Nerd Font Mono Regular 10 + +# Border settings +default_border pixel 4 +default_floating_border pixel 4 +smart_borders on + +# Gaps settings +gaps inner 8 +gaps outer 0 +smart_gaps on + +hide_edge_borders none + +# Floating windows +for_window [window_role="(?i)(?:pop-up|setup)"] floating enable +for_window [class="zoom"] floating enable + +# Disable mouse warping +mouse_warping none + +# Startup applications +exec --no-startup-id picom +exec_always --no-startup-id $HOME/.config/polybar/launch.sh + +# XDG desktop portal +exec --no-startup-id /usr/lib/xdg-desktop-portal & +exec --no-startup-id /usr/lib/xdg-desktop-portal-gtk & + +# Start XDG autostart .desktop files using dex +exec --no-startup-id dex --autostart --environment i3 + +# Use Mouse+$mod to drag floating windows +floating_modifier $mod + +# Allow dragging tiling windows by holding down $mod and left mouse button +tiling_drag modifier titlebar + +# Keybindings + +# Start a terminal +bindsym $mod+Return exec kitty + +# Start a brave browser +bindsym $mod+b exec brave + +bindsym $mod+c exec cursor + +# Kill focused window +bindsym $mod+a kill + +# Start rofi (a program launcher) +bindsym $mod+d exec --no-startup-id rofi -show run +bindsym $mod+Tab exec --no-startup-id rofi -show window + +# Change focus +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Move focused window +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# Split orientation +bindsym $mod+h split h +bindsym $mod+v split v + +# Enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# Change container layout +bindsym $mod+s layout stacking +bindsym $mod+z layout tabbed +bindsym $mod+e layout toggle split + +# Toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# Change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# Focus the parent container +bindsym $mod+q focus parent + +# Workspace names +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# Assign workspaces to specific outputs +workspace $ws1 output DP-0 +workspace $ws2 output DP-0 +workspace $ws3 output DP-0 +workspace $ws4 output DP-2 +workspace $ws5 output DP-2 +workspace $ws6 output DP-2 +workspace $ws7 output DP-1-3 +workspace $ws8 output DP-1-3 +workspace $ws9 output DP-1-3 +workspace $ws10 output DP-1-3 + +# Switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# Reload the configuration file +bindsym $mod+Shift+c reload + +# Restart i3 inplace +bindsym $mod+Shift+r restart + +# Exit i3 +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# Lock screen +bindsym $mod+l exec betterlockscreen -l dimblur --display 1 --off 10 + +# Resize window mode +bindsym $mod+r mode "resize" +mode "resize" { + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +# Screenshot +bindsym $mod+p --release exec scrot -s ~/Pictures/Screenshots/scrot_%F.png -e 'xclip -selection clipboard -t image/png -i $f' + +# Assign applications to specific workspaces +assign [class="Brave-browser"] $ws4 +assign [class="thunderbird"] $ws9 +assign [class="Jellyfin Media Player"] $ws8 +assign [class="ZapZap"] $ws7 + +# Autostart applications +exec --no-startup-id deadd-notification-center +exec --no-startup-id brave +exec --no-startup-id thunderbird +exec --no-startup-id jellyfinmediaplayer +exec --no-startup-id zapzap \ No newline at end of file diff --git a/home/i3/default.nix b/home/i3/default.nix new file mode 100644 index 0000000..8ee92d0 --- /dev/null +++ b/home/i3/default.nix @@ -0,0 +1,5 @@ +{ pkgs, config, ... }: + +{ + home.file.".config/i3/config".source = ./config; +} diff --git a/hosts/vm/default.nix b/hosts/vm/default.nix new file mode 100644 index 0000000..f2ce2ca --- /dev/null +++ b/hosts/vm/default.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ../../modules/system.nix + ../../modules/i3.nix + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.grub = { + enable = true; + device = "/dev/vda"; + useOSProber = true; + }; + + networking.hostName = "nixosvm"; # Define your hostname. + networking.networkmanager.enable = true; + + + system.stateVersion = "24.05"; # Did you read the comment? + +} diff --git a/hosts/vm/hardware-configuration.nix b/hosts/vm/hardware-configuration.nix new file mode 100644 index 0000000..e37f78a --- /dev/null +++ b/hosts/vm/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a8020c06-641c-4e37-b190-f3b0a2fc61f7"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/34e9e2e2-6223-4d5c-9926-68f4d92f341b"; } + ]; + + # 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.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/modules/i3.nix b/modules/i3.nix new file mode 100644 index 0000000..0e6b1bc --- /dev/null +++ b/modules/i3.nix @@ -0,0 +1,26 @@ +{ + pkgs, + ... +}: { + services.xserver = { + enable = true; + windowManager.i3 = { + enable = true; + }; + displayManager = { + lightdm.enable = true; + }; + xkb = { + layout = "fr"; + variant = ""; + }; + extraPackages = with pkgs; [ + i3status + dmenu + picom + arandr + ]; + }; + + services.displayManager.defaultSession = "none+i3"; +} \ No newline at end of file diff --git a/modules/system.nix b/modules/system.nix new file mode 100644 index 0000000..a26ba7c --- /dev/null +++ b/modules/system.nix @@ -0,0 +1,55 @@ +{ + pkgs, + lib, + username, + ... +}: { + users.users.${username} = { + isNormalUser = true; + description = username; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + }; + + nix.gc = { + automatic = lib.mkDefault true; + dates = lib.mkDefault "weekly"; + options = lib.mkDefault "--delete-older-than 7d"; + }; + + nixpkgs.config.allowUnfree = true; + + time.timeZone = "Indian/Reunion"; + + console.keyMap = "fr"; + i18n = { + defaultLocale = "fr_FR.UTF-8"; + 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.printing.enable = true; + + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + + environment.systemPackages = with pkgs; [ + git + vim + wget + ]; + +} \ No newline at end of file diff --git a/users/laurent/home.nix b/users/laurent/home.nix new file mode 100644 index 0000000..7100660 --- /dev/null +++ b/users/laurent/home.nix @@ -0,0 +1,115 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ../../home/core.nix + + ../../home/i3 + ]; + + programs.git = { + userName = "Laurent Le Houerou"; + userEmail = "laurent@lehouerou.net"; + }; + + services.picom = { + enable = true; + vSync = true; + shadow = true; + fade = true; + fadeDelta = 4; + }; + + home.packages = with pkgs; [ + btop + code-cursor + lazygit + neovim + brave + + ]; + + programs.kitty = lib.mkForce { + enable = true; + settings = { + font_family = "FiraCode Nerd Font Mono"; + bold_font = "auto"; + italic_font = "auto"; + bold_italic_font = "auto"; + font_size = "12.0"; + confirm_os_window_close = 0; + # Colors + foreground = "#CDD6F4"; + background = "#1E1E2E"; + selection_foreground = "#1E1E2E"; + selection_background = "#F5E0DC"; + cursor = "#F5E0DC"; + cursor_text_color = "#1E1E2E"; + url_color = "#F5E0DC"; + active_border_color = "#B4BEFE"; + inactive_border_color = "#6C7086"; + bell_border_color = "#F9E2AF"; + wayland_titlebar_color = "system"; + macos_titlebar_color = "system"; + active_tab_foreground = "#11111B"; + active_tab_background = "#CBA6F7"; + inactive_tab_foreground = "#CDD6F4"; + inactive_tab_background = "#181825"; + tab_bar_background = "#11111B"; + mark1_foreground = "#1E1E2E"; + mark1_background = "#B4BEFE"; + mark2_foreground = "#1E1E2E"; + mark2_background = "#CBA6F7"; + mark3_foreground = "#1E1E2E"; + mark3_background = "#74C7EC"; + color0 = "#45475A"; + color8 = "#585B70"; + color1 = "#F38BA8"; + color9 = "#F38BA8"; + color2 = "#A6E3A1"; + color10 = "#A6E3A1"; + color3 = "#F9E2AF"; + color11 = "#F9E2AF"; + color4 = "#89B4FA"; + color12 = "#89B4FA"; + color5 = "#F5C2E7"; + color13 = "#F5C2E7"; + color6 = "#94E2D5"; + color14 = "#94E2D5"; + color7 = "#BAC2DE"; + color15 = "#A6ADC8"; + }; + }; + + programs.zsh = { + enable = true; + }; + + services.grobi = { + enable = true; + rules = [ + { + name = "VM Setup"; + outputs_connected = [ "Virtual-1" ]; + configure_single = "Virtual-1@2048x1152"; + atomic = true; + } + { + name = "Triple Monitor Setup"; + outputs_connected = [ "DP-0" "DP-2" "DP-1-3" ]; + configure_row = [ + "DP-2" + "DP-0" + "DP-1-3" + ]; + atomic = true; + primary = "DP-0"; + execute_after = [ + "${pkgs.xorg.xrandr}/bin/xrandr --output DP-1-3 --rotate left" + ]; + } + ]; + + + }; +} diff --git a/users/laurent/nixos.nix b/users/laurent/nixos.nix new file mode 100644 index 0000000..0af704e --- /dev/null +++ b/users/laurent/nixos.nix @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file