diff --git a/README.md b/README.md index eee3330..abaf756 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,6 @@ On lance le rebuild : ``` nixos-rebuild switch --flake ~/dev#test-kvm --target-host beastie@192.168.122.204 --sudo ``` +## TODO + +1. simplifier pkgs.rofi dans la conf du au merge rofi et rofi-wayland \ No newline at end of file diff --git a/flake.lock b/flake.lock index 10ebe16..a4b7a32 100644 --- a/flake.lock +++ b/flake.lock @@ -23,17 +23,17 @@ "mysecrets": { "flake": false, "locked": { - "lastModified": 1758040565, - "narHash": "sha256-Mq2BEI6ik6W49mSBotPi4zva6CyjXqdft+A7hy4ENGw=", + "lastModified": 1758805800, + "narHash": "sha256-gpsVmfnAx5WvuJccSEFFCGQauVwTtMOvNX8MU2rAh9g=", "ref": "refs/heads/main", - "rev": "4640274dc3767b3f8b968f801f9f8e3be0619415", - "revCount": 3, + "rev": "e323fa4ec284046bd64842e70123ffadfa2b859f", + "revCount": 6, "type": "git", - "url": "file:///home/beastie/nixos-secrets" + "url": "file:///home/beastie/nixos/secrets" }, "original": { "type": "git", - "url": "file:///home/beastie/nixos-secrets" + "url": "file:///home/beastie/nixos/secrets" } }, "nixpkgs": { diff --git a/flake.nix b/flake.nix index 0e5f5c0..1af449b 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ }; mysecrets = { - url = "git+file:///home/beastie/nixos-secrets"; + url = "git+file:///home/beastie/nixos/secrets"; flake = false; }; }; @@ -49,6 +49,7 @@ generic = mkSystem inputs.nixpkgs "x86_64-linux" "generic" "beastie"; test-kvm = mkSystem inputs.nixpkgs "x86_64-linux" "test-kvm" "beastie"; home-nix = mkSystem inputs.nixpkgs "x86_64-linux" "home-nix" "beastie"; + work-nix = mkSystem inputs.nixpkgs "x86_64-linux" "work-nix" "beastie"; # live-usb = mkSystem inputs.nixpkgs "x86_64-linux" "live-usb" "beastie"; #nixos-rebuild switch --flake ./#home-nix --sudo }; diff --git a/hosts/generic/disk-config.nix b/hosts/generic/disk-config.nix index 155610e..196c23e 100644 --- a/hosts/generic/disk-config.nix +++ b/hosts/generic/disk-config.nix @@ -6,7 +6,7 @@ disk = { main = { type = "disk"; - device = "/dev/vda"; + device = "/dev/nvme0n1"; content = { type = "gpt"; partitions = { diff --git a/hosts/home-nix/default.nix b/hosts/home-nix/default.nix index 1978881..91c583a 100644 --- a/hosts/home-nix/default.nix +++ b/hosts/home-nix/default.nix @@ -36,21 +36,4 @@ ]; }; }; - - ## Enable virtualisation guest settings - services.qemuGuest.enable = true; - services.spice-vdagentd.enable = true; - services.xserver = { - videoDrivers = [ "modesetting" ]; # Driver vidéo optimisé pour QEMU/KVM - }; - - environment.systemPackages = [ - pkgs.spice-gtk # Outils SPICE - pkgs.spice-protocol # Protocoles SPICE - ]; - - #fileSystems."/" = { - # device = "/dev/vda2"; # Disque virtuel typique - # fsType = "btrfs"; - #}; } diff --git a/hosts/home-nix/disk-config.nix b/hosts/home-nix/disk-config.nix index 155610e..196c23e 100644 --- a/hosts/home-nix/disk-config.nix +++ b/hosts/home-nix/disk-config.nix @@ -6,7 +6,7 @@ disk = { main = { type = "disk"; - device = "/dev/vda"; + device = "/dev/nvme0n1"; content = { type = "gpt"; partitions = { diff --git a/hosts/work-nix/default.nix b/hosts/work-nix/default.nix new file mode 100644 index 0000000..37632fe --- /dev/null +++ b/hosts/work-nix/default.nix @@ -0,0 +1,38 @@ +{ + pkgs, + username, + hostname, + modulesPath, + inputs, + ... +}: +{ + system.stateVersion = "25.11"; + + imports = builtins.trace "${inputs.mysecrets}" [ + (modulesPath + "/installer/scan/not-detected.nix") + ./network.nix + ./hardware-configuration.nix + ../../modules/core + ../../modules/optionnals/hosts/${hostname}.nix + ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + time.timeZone = "Europe/Paris"; + + nix = { + settings = { + ## Enable flakes + experimental-features = [ + "nix-command" + "flakes" + ]; + ## Users trusted to use flake command + trusted-users = [ + "root" + "${username}" + ]; + }; + }; +} diff --git a/hosts/work-nix/hardware-configuration.nix b/hosts/work-nix/hardware-configuration.nix new file mode 100644 index 0000000..dc67b2f --- /dev/null +++ b/hosts/work-nix/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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 = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/mapper/rootfs"; + fsType = "btrfs"; + options = [ "discard=async" "compress=zstd" ]; + }; + + boot.initrd.luks.devices."rootfs" = { + device = "/dev/disk/by-uuid/6b1c7ee5-6489-4c47-bb8b-2e663e493aed"; + allowDiscards = true; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/B210-971B"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/work-nix/network.nix b/hosts/work-nix/network.nix new file mode 100644 index 0000000..c1fc802 --- /dev/null +++ b/hosts/work-nix/network.nix @@ -0,0 +1,11 @@ +{ + hostname, + ... +}: +{ + networking = { + hostName = "${hostname}"; + networkmanager.enable = true; + firewall.enable = true; + }; +} diff --git a/modules/core/packages.nix b/modules/core/packages.nix index f460a31..b3c2ede 100644 --- a/modules/core/packages.nix +++ b/modules/core/packages.nix @@ -15,6 +15,7 @@ pkgs.unzip pkgs.sops pkgs.ssh-to-age + pkgs.efibootmgr ]; services = { locate = { diff --git a/modules/optionnals/desktop/amd.nix b/modules/optionnals/desktop/amd.nix new file mode 100644 index 0000000..88812a8 --- /dev/null +++ b/modules/optionnals/desktop/amd.nix @@ -0,0 +1,9 @@ +{ + ... +}: +{ + hardware.graphics = { + enable = true; + enable32Bit = true; + }; +} \ No newline at end of file diff --git a/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland-work-nix.conf b/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland-work-nix.conf new file mode 100644 index 0000000..d106ee1 --- /dev/null +++ b/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland-work-nix.conf @@ -0,0 +1,15 @@ +################ +### MONITORS ### +################ +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=eDP-1,1920x1200,0x0,1 + +workspace = 1, monitor:eDP-1 +workspace = 2, monitor:eDP-1 +workspace = 3, monitor:eDP-1 +workspace = 4, monitor:eDP-1 +workspace = 5, monitor:eDP-1 +workspace = 6, monitor:eDP-1 +workspace = 7, monitor:eDP-1 +workspace = 8, monitor:eDP-1 +workspace = 9, monitor:eDP-1 diff --git a/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland.conf b/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland.conf index d493859..f44d5ff 100644 --- a/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland.conf +++ b/modules/optionnals/desktop/config/etc/xdg/hypr/hyprland.conf @@ -194,9 +194,7 @@ input { } # https://wiki.hyprland.org/Configuring/Variables/#gestures -gestures { - workspace_swipe = false -} +gesture = 3, horizontal, workspace # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more @@ -260,6 +258,7 @@ bind = $mainMod, KP_Begin, workspace, 5 bind = $mainMod, KP_Right, workspace, 6 bind = $mainMod, KP_Home, workspace, 7 bind = $mainMod, KP_Up, workspace, 8 +bind = $mainMod, KP_Prior, workspace, 9 # Déplacement de fenêtre avec keypad bind = $mainMod CONTROL, KP_End, movetoworkspacesilent, 1 @@ -270,6 +269,7 @@ bind = $mainMod CONTROL, KP_Begin, movetoworkspacesilent, 5 bind = $mainMod CONTROL, KP_Right, movetoworkspacesilent, 6 bind = $mainMod CONTROL, KP_Home, movetoworkspacesilent, 7 bind = $mainMod CONTROL, KP_Up, movetoworkspacesilent, 8 +bind = $mainMod CONTROL, KP_Prior, movetoworkspacesilent, 9 # Example special workspace (scratchpad) bind = $mainMod, S, togglespecialworkspace, magic diff --git a/modules/optionnals/desktop/config/etc/xdg/waybar/config.jsonc b/modules/optionnals/desktop/config/etc/xdg/waybar/config.jsonc index 8944bf2..94322a4 100644 --- a/modules/optionnals/desktop/config/etc/xdg/waybar/config.jsonc +++ b/modules/optionnals/desktop/config/etc/xdg/waybar/config.jsonc @@ -73,8 +73,9 @@ "all-outputs": false, "on-click": "activate", "persistent-workspaces": { - "HDMI-A-1": [1, 2, 3, 4], - "HDMI-A-2": [5, 6, 7, 8], + "HDMI-A-1": [1, 2, 3], + "HDMI-A-2": [4, 5, 6], + "eDP-1": [7, 8, 9], }, "format": "{name}", "format-icons": { diff --git a/modules/optionnals/desktop/kitty.nix b/modules/optionnals/desktop/kitty.nix index bad6734..91040c6 100644 --- a/modules/optionnals/desktop/kitty.nix +++ b/modules/optionnals/desktop/kitty.nix @@ -31,5 +31,4 @@ ''; }; }; - } diff --git a/modules/optionnals/desktop/starship.nix b/modules/optionnals/desktop/starship.nix new file mode 100644 index 0000000..500fd71 --- /dev/null +++ b/modules/optionnals/desktop/starship.nix @@ -0,0 +1,113 @@ +{ + pkgs, + ... +}: +{ + programs.starship = { + enable = true; + settings = { + add_newline = true; + command_timeout = 1300; + scan_timeout = 50; + format = "$hostname$username$directory[](bg:pink fg:green)$nix_shell$git_branch$git_status[ ](bg:pink)[](fg:pink)$line_break$character"; + palette = "catppuccin_frappe"; + palettes.catppuccin_frappe = { + rosewater = "#f2d5cf"; + flamingo = "#eebebe"; + pink = "#f4b8e4"; + mauve = "#ca9ee6"; + red = "#e78284"; + maroon = "#ea999c"; + peach = "#ef9f76"; + yellow = "#e5c890"; + green = "#a6d189"; + teal = "#81c8be"; + sky = "#99d1db"; + sapphire = "#85c1dc"; + blue = "#8caaee"; + lavender = "#babbf1"; + text = "#c6d0f5"; + subtext1 = "#b5bfe2"; + subtext0 = "#a5adce"; + overlay2 = "#949cbb"; + overlay1 = "#838ba7"; + overlay0 = "#737994"; + surface2 = "#626880"; + surface1 = "#51576d"; + surface0 = "#414559"; + base = "#303446"; + mantle = "#292c3c"; + crust = "#232634"; + }; + + hostname = { + ssh_only = false; + ssh_symbol = "󰣀"; + format = "(bg:blue fg:base)[ $ssh_symbol $hostname ](bg:blue fg:base)[](bg:teal fg:blue)"; + trim_at = "companyname.com"; + disabled = false; + }; + + username = { + show_always = true; + style_user = "bg:teal fg:base"; + style_root = "bg:red fg:base"; + format = "[ $user ]($style)[](bg:green fg:teal)"; + }; + + directory = { + style = "bg:green fg:base"; + format = "[ $path ]($style)"; + truncation_length = 3; + truncation_symbol = "…/"; + }; + + nix_shell = { + disabled = false; + impure_msg = "[impure shell](bold red)"; + pure_msg = "[pure shell](bold green)"; + unknown_msg = "[unknown shell](bold yellow)"; + format = "[ ($name)](bold bg:pink fg:base)"; + }; + + + directory.substitutions = { + Documents = "󰈙 "; + Downloads = " Downloads"; + Music = "󰝚 "; + Pictures = " "; + Developer = "󰲋 "; + }; + + git_branch = { + symbol = ""; + style = "bg: pink"; + format = "[[ $symbol $branch ](bg:pink fg:base)]($style)"; + }; + + git_status = { + style = "bg:pink fg:base"; + format = "([$modified$untracked$ahead_behind]($style))"; + ahead = ""; + behind = ""; + modified = "✗"; + untracked = "★"; + up_to_date = ""; + }; + + line_break = { + disabled = false; + }; + + character = { + disabled = false; + success_symbol = "[](bold fg:green)"; + error_symbol = "[✗](bold fg:red)"; + vimcmd_symbol = "[](bold fg:creen)"; + vimcmd_replace_one_symbol = "[](bold fg:purple)"; + vimcmd_replace_symbol = "[](bold fg:purple)"; + vimcmd_visual_symbol = "[](bold fg:lavender)"; + }; + }; + }; +} diff --git a/modules/optionnals/desktop/wayland.nix b/modules/optionnals/desktop/wayland.nix index 2fb3c5e..ca37f4d 100644 --- a/modules/optionnals/desktop/wayland.nix +++ b/modules/optionnals/desktop/wayland.nix @@ -24,12 +24,12 @@ etc = { "xdg/hypr/frappe.conf".source = ./config/etc/xdg/hypr/frappe.conf; "xdg/hypr/hyprland.conf".source = ./config/etc/xdg/hypr/hyprland.conf; - "xdg/hypr/hyprland-host.conf".source = ./config/etc/xdg/hypr/hyperland-${hostname}.conf; + "xdg/hypr/hyprland-host.conf".source = ./config/etc/xdg/hypr/hyprland-${hostname}.conf; "xdg/hypr/hyprlock.conf".source = ./config/etc/xdg/hypr/hyprlock.conf; "xdg/hypr/hyprpaper.conf".source = ./config/etc/xdg/hypr/hyprpaper.conf; "xdg/hypr/rofi.conf" = { text = '' - $rofi = ${pkgs.rofi-wayland}/bin/rofi -show drun -show-icons -config /etc/xdg/rofi/config.rasi + $rofi = ${pkgs.rofi}/bin/rofi -show drun -show-icons -config /etc/xdg/rofi/config.rasi ''; }; "xdg/waybar".source = ./config/etc/xdg/waybar; diff --git a/modules/optionnals/hosts/work-nix.nix b/modules/optionnals/hosts/work-nix.nix new file mode 100644 index 0000000..0f50d2c --- /dev/null +++ b/modules/optionnals/hosts/work-nix.nix @@ -0,0 +1,23 @@ +{ + ... +}: +{ + imports = [ + ../sops-desktop.nix + ../sudo-nopasswd.nix + ../autologin.nix + ../ssh.nix + + ### Import GUI modules + ../desktop/dunst.nix + ../desktop/kitty.nix + ../desktop/packages.nix + ../desktop/qwerty-fr.nix + ../desktop/rofi.nix + ../desktop/starship.nix + ../desktop/wayland.nix + + ### Import Graphics modules + ../desktop/amd.nix + ]; +}