diff --git a/.gitignore b/.gitignore index 574e7eb..abd4567 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ result *.swp +*.qcow2 \ No newline at end of file diff --git a/TODO b/TODO deleted file mode 100644 index b4621b7..0000000 --- a/TODO +++ /dev/null @@ -1,59 +0,0 @@ -# Preparation integration server (Re-structuration configs) - -home/ -----> alacritty -----> chromium -----> direnv -----> emacs -----> flatpak -----> git -----> default - -======> hosts -> rename to machines -machines/ -----> machine1/ -------------> hardware-configuration.nix -------------> system.nix -------------> home.nix -----> machine2/ -------------> hardware-configuration.nix -------------> system.nix -------------> home.nix - -======> modules -> rename to system -system/ -----> server/ -------------> ssh -------------> openvscode -------------> docker -----> graphics/ -------------> plasma -------------> gnome -------------> hyprland -----> devices/ -------------> print-support -------------> bluetooth -------------> nvidia -----> modules/ -------------> plymouth - -secrets/ (In separate repo ? submodules ?) -----> service1_secrets -----> service2_secrets - -pkgs/ -overlays/ - -How work WSL ? -How work Darwin ? -How work Nix only system (Not nixos) ? -How work disko ? -Separate explicitly config and basic usage ? - -# SSH - -services.openssh = { - enable = true; - - authorizedKeysFiles = [key1 key2 key3]; # From agenix -} \ No newline at end of file diff --git a/flake.nix b/flake.nix index 8f4085f..82e6270 100644 --- a/flake.nix +++ b/flake.nix @@ -19,10 +19,10 @@ }; outputs = inputs@{ - nixpkgs, - home-manager, - agenix, - ... + nixpkgs, + home-manager, + agenix, + ... }: let systems = [ @@ -37,10 +37,15 @@ ${s.name} = nixpkgs.lib.nixosSystem { inherit (s) system; modules = [ - ./hosts/${s.name} + ./hosts/${s.name}/configuration.nix home-manager.nixosModules.home-manager agenix.nixosModules.default - (import ./home/common-home-manager.nix { inherit inputs; }) + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = inputs; + home-manager.users.florian = import ./hosts/${s.name}/home.nix; + } ]; }; }) {} systems; diff --git a/home/common-home-manager.nix b/home/common-home-manager.nix deleted file mode 100644 index 3dd0d04..0000000 --- a/home/common-home-manager.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ inputs, ... }: - -{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = inputs; - home-manager.users.florian = import ../home; -} \ No newline at end of file diff --git a/home/default.nix b/home/default.nix deleted file mode 100644 index fe30178..0000000 --- a/home/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./programs/agenix.nix - ./programs/shell.nix - ./programs/atuin.nix - ./programs/git.nix -# ./programs/emacs.nix - ./programs/jetbrains-toolbox.nix - ./programs/vscode.nix - ./programs/direnv.nix - ./programs/chromium.nix - ./programs/flatpak.nix - - ./homePrograms - ]; - - home = { - username = "florian"; - homeDirectory = "/home/florian"; - - stateVersion = "24.05"; - }; - - programs.home-manager.enable = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - homePrograms.kitty.enable = true; -} diff --git a/home/homePrograms/default.nix b/home/homePrograms/default.nix deleted file mode 100644 index 9166110..0000000 --- a/home/homePrograms/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - imports = [ - ./hyprland.nix - ./kitty.nix - ./zsh - ]; -} \ No newline at end of file diff --git a/home/homePrograms/hyprland.nix b/home/homePrograms/hyprland.nix deleted file mode 100644 index 7e60baa..0000000 --- a/home/homePrograms/hyprland.nix +++ /dev/null @@ -1,225 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -{ - options.homePrograms.hyprland = { - enable = mkEnableOption '' - Enable hyprland with my custom configurations - ''; - }; - config = - let - cfg = config.homePrograms.hyprland; - - set_volume = pkgs.writeScriptBin "set_volume.sh" '' - #!${pkgs.runtimeShell} - pactl set-sink-volume @DEFAULT_SINK@ $1 && $send_volume_notif notify-send "Volume" -h int:value:"$(pactl get-sink-volume @DEFAULT_SINK@ | cut -d ' ' -f6 | cut -d '%' -f1)" - ''; - in - mkIf cfg.enable { - homePrograms.kitty.enable = true; # Required - - wayland.windowManager.hyprland = { - enable = true; - - settings = { - exec-once = [ - "dunst -conf ~/.config/hypr/dunstrc" - "~/.config/hypr/eww/scripts/start" - "~/.config/hypr/swww/start" - - # Keyring daemon - "gnome-keyring-daemon --start --components=gpg" - "gnome-keyring-daemon --start --components=secrets" - "gnome-keyring-daemon --start --components=ssh" - "gnome-keyring-daemon --start --components=pkcs11" - - "/usr/libexec/kf5/polkit-kde-authentication-agent-1" - "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - ]; - - env = "XCURSOR_SIZE,24"; - - # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ - input = { - kb_layout = config.services.xserver.xkb.layout; - kb_variant = config.services.xserver.xkb.variant; - kb_model = ""; - kb_options = ""; - kb_rules = ""; - - follow_mouse = 1; - numlock_by_default = 1; - - touchpad = { - natural_scroll = "no"; - disable_while_typing = "yes"; - tap-to-click = "yes"; - }; - - sensitivity = 0; # -1.0 - 1.0, 0 means no modification. - }; - - # See https://wiki.hyprland.org/Configuring/Variables/ for more - general = { - gaps_in = 5; - gaps_out = 20; - border_size = 3; - col.active_border = "rgb()"; - col.inactive_border = "rgb()"; - - layout = "dwindle"; - }; - - # See https://wiki.hyprland.org/Configuring/Variables/ for more - decoration = { - rounding = 10; - - blur = { - enabled = true; - size = 3; - passes = 1; - }; - - drop_shadow = "yes"; - shadow_range = 15; - shadow_render_power = 4; - col.shadow = "rgb()"; - col.shadow_inactive = "rgb()"; - }; - - # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - animations = { - enabled = "yes"; - - bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; - - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 7, default, popin 80%" - "border, 1, 10, default" - "borderangle, 1, 8, default" - "fade, 1, 7, default" - "workspaces, 1, 6, default" - ]; - }; - - # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - dwindle = { - pseudotile = "yes"; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = "yes"; # you probably want this - }; - - # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - master = { - new_is_master = "true"; - }; - - # See https://wiki.hyprland.org/Configuring/Variables/ for more - gestures = { - workspace_swipe = "on"; - workspace_swipe_forever = "on"; - }; - - # Example per-device config - # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more - "device:epic-mouse-v1" = { - sensitivity = "-0.5"; - }; - - "$mod" = "SUPER"; - - bind = [ - "SUPERSHIFT,R,hyprload,reload" - "SUPERSHIFT,U,hyprload,update" - - # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - "$mainMod, RETURN, exec, kitty" - "$mainMod, C, killactive," - "$mainMod SHIFT, C, exec, hyprpicker -a -f hex" - "$mainMod SHIFT, Q, exit," - "$mainMod, E, exec, nautilus" - "$mainMod, V, togglefloating," - "$mainMod, F, fullscreen, 0" - "$mainMod, D, exec, wofi -i -s ~/.config/hypr/wofi/style.css --show drun" - "$mainMod, P, pseudo," # dwindle - "$mainMod, B, togglesplit," # dwindle - - # Move focus with mainMod + arrow keys - "$mainMod, h, movefocus, l" - "$mainMod, l, movefocus, r" - "$mainMod, j, movefocus, u" - "$mainMod, k, movefocus, d" - - "$mainMod SHIFT_L, h, movewindow, l" - "$mainMod SHIFT_L, l, movewindow, r" - "$mainMod SHIFT_L, j, movewindow, u" - "$mainMod SHIFT_L, k, movewindow, d" - - "$mainMod ALT_L, v, exec, dunstctl context" - "$mainMod ALT_L, c, exec, dunstctl close-all" - "$mainMod ALT_L, x, exec, dunstctl close" - - # Switch workspaces with mainMod + [0-9] - "$mainMod, 1, split-workspace, 1" - "$mainMod, 2, split-workspace, 2" - "$mainMod, 3, split-workspace, 3" - "$mainMod, 4, split-workspace, 4" - "$mainMod, 5, split-workspace, 5" - "$mainMod, 6, split-workspace, 6" - "$mainMod, 7, split-workspace, 7" - "$mainMod, 8, split-workspace, 8" - "$mainMod, 9, split-workspace, 9" - "$mainMod, 0, split-workspace, 10" - - # Move active window to a workspace with mainMod + SHIFT + [0-9] - "$mainMod SHIFT, 1, split-movetoworkspace, 1" - "$mainMod SHIFT, 2, split-movetoworkspace, 2" - "$mainMod SHIFT, 3, split-movetoworkspace, 3" - "$mainMod SHIFT, 4, split-movetoworkspace, 4" - "$mainMod SHIFT, 5, split-movetoworkspace, 5" - "$mainMod SHIFT, 6, split-movetoworkspace, 6" - "$mainMod SHIFT, 7, split-movetoworkspace, 7" - "$mainMod SHIFT, 8, split-movetoworkspace, 8" - "$mainMod SHIFT, 9, split-movetoworkspace, 9" - "$mainMod SHIFT, 0, split-movetoworkspace, 10" - - # Scroll through existing workspaces with mainMod + scroll - "$mainMod, mouse_down, workspace, e+1" - "$mainMod, mouse_up, workspace, e-1" - ]; - - bindm = [ - # Move/resize windows with mainMod + LMB/RMB and dragging - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" - ]; - - binde = [ - "$mainMod CTRL_L, h, resizeactive, -50 0" - "$mainMod CTRL_L, l, resizeactive, 50 0" - "$mainMod CTRL_L, j, resizeactive, 0 -50" - "$mainMod CTRL_L, k, resizeactive, 0 50" - - # Use pactl to adjust volume in PulseAudio. - ", XF86AudioRaiseVolume, exec, ${set_volume} \"+5%\"" - ", XF86AudioLowerVolume, exec, ${set_volume} \"-5%\"" - ]; - - bindl = [ - ", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" - ", XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle" - - # Media player controls - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioPause, exec, playerctl play-pause" - ", XF86AudioPrev, exec, playerctl previous" - ", XF86AudioNext, exec, playerctl next" - - # Screen brightness controls - ", XF86MonBrightnessUp, exec, xbacklight -inc 5" - ", XF86MonBrightnessDown, exec, xbacklight -dec 5" - ]; - }; - }; - }; -} \ No newline at end of file diff --git a/home/homePrograms/kitty.nix b/home/homePrograms/kitty.nix deleted file mode 100644 index a085f28..0000000 --- a/home/homePrograms/kitty.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -{ - options.homePrograms.kitty = { - enable = mkEnableOption '' - Enable kitty with my custom configurations - ''; - - enableBlur = mkOption { - default = !config.homePrograms.hyprland.enable; # Disable by default if hyprland is enabled (Hyprland enable own blur) - example = true; - description = '' - Enable blur (Usefull to disable with hyprland) - ''; - type = types.bool; - }; - }; - config = - let - cfg = config.homePrograms.kitty; - in - mkIf cfg.enable { - programs.kitty = { - enable = true; - - font = { - name = "FiraCode Nerd Font"; - package = pkgs.fira-code-nerdfont; - }; - - settings = lib.mkMerge [ - { - disable_ligatures = "never"; - sync_to_monitor = "yes"; # Avoid to update a lot - confirm_os_window_close = 0; # Disable close confirmation - - background_opacity = "0.7"; - } - - (lib.mkIf cfg.enableBlur { background_blur = "1"; }) - (lib.mkIf config.programs.zsh.enable { shell = "zsh"; }) - ]; - }; - }; -} \ No newline at end of file diff --git a/home/homePrograms/zsh/default.nix b/home/homePrograms/zsh/default.nix deleted file mode 100644 index cab5730..0000000 --- a/home/homePrograms/zsh/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -{ - options.homePrograms.zsh = { - enable = mkEnableOption '' - Enable zsh with my custom configurations - ''; - }; - config = - let - cfg = config.homePrograms.zsh; - in - mkIf cfg.enable { - programs.zsh = { - enable = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - - initExtra = '' - [[ ! -f ${./p10k.zsh} ]] || source ${./p10k.zsh} - ''; - - plugins = with pkgs; [ - { - file = "powerlevel10k.zsh-theme"; - name = "powerlevel10k"; - src = "${zsh-powerlevel10k}/share/zsh-powerlevel10k"; - } - { - file = "p10k.zsh"; - name = "powerlevel10k-config"; - src = zsh-powerlevel10k; - } - ]; - }; - }; -} \ No newline at end of file diff --git a/home/programs/agenix.nix b/home/programs/agenix.nix deleted file mode 100644 index e3ad7a7..0000000 --- a/home/programs/agenix.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, agenix, ... }: - -{ - home.packages = [ - agenix.packages."${pkgs.system}".default - ]; -} \ No newline at end of file diff --git a/home/programs/atuin.nix b/home/programs/atuin.nix deleted file mode 100644 index e70e39e..0000000 --- a/home/programs/atuin.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, ... }: - -{ - programs.atuin = { - enable = true; - settings = { - # Uncomment this to use your instance - # sync_address = "https://majiy00-shell.fly.dev"; - }; - }; -} diff --git a/home/programs/chromium.nix b/home/programs/chromium.nix deleted file mode 100644 index 790e439..0000000 --- a/home/programs/chromium.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.chromium = { - enable = true; - - package = pkgs.chromium.override { - enableWideVine = true; # Enable DRM - }; - - extensions = [ - { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # Ublock Origin - { id = "nngceckbapebfimnlniiiahkandclblb"; } # Bitwarden - { id = "fnaicdffflnofjppbagibeoednhnbjhg"; } # Floccus Bookmark manager - { id = "fihnjjcciajhdojfnbdddfaoknhalnja"; } # I don't care about cookies - { id = "cimiefiiaegbelhefglklhhakcgmhkai"; } # Plasma Integration - { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # Dark reader - { id = "mnjggcdmjocbbbhaepdhchncahnbgone"; } # SponsorBlock - ]; - }; -} diff --git a/home/programs/direnv.nix b/home/programs/direnv.nix deleted file mode 100644 index 2c61909..0000000 --- a/home/programs/direnv.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.direnv.enable = true; -} \ No newline at end of file diff --git a/home/programs/emacs.nix b/home/programs/emacs.nix deleted file mode 100644 index 9f23c6c..0000000 --- a/home/programs/emacs.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.emacs = { - enable = true; - }; -} \ No newline at end of file diff --git a/home/programs/flatpak.nix b/home/programs/flatpak.nix deleted file mode 100644 index a18bdbb..0000000 --- a/home/programs/flatpak.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, pkgs, nix-flatpak, ... }: - -{ - imports = [ nix-flatpak.homeManagerModules.nix-flatpak ]; - - services.flatpak = { - enable = true; - - update.onActivation = true; - - packages = [ - # Gaming - { appId = "com.discordapp.Discord"; origin = "flathub"; } - { appId = "com.valvesoftware.Steam"; origin = "flathub"; } - { appId = "net.lutris.Lutris"; origin = "flathub"; } - - # Pro - { appId = "com.slack.Slack"; origin = "flathub"; } - { appId = "com.skype.Client"; origin = "flathub"; } - { appId = "org.mozilla.Thunderbird"; origin = "flathub"; } - { appId = "ch.protonmail.protonmail-bridge"; origin = "flathub"; } - { appId = "org.kde.neochat"; origin = "flathub"; } - - # Loisir - { appId = "com.spotify.Client"; origin = "flathub"; } - { appId = "io.gitlab.news_flash.NewsFlash"; origin = "flathub"; } - { appId = "org.videolan.VLC"; origin = "flathub"; } - { appId = "com.obsproject.Studio"; origin = "flathub"; } - { appId = "io.github.achetagames.epic_asset_manager"; origin = "flathub"; } - ]; - }; -} diff --git a/home/programs/git.nix b/home/programs/git.nix deleted file mode 100644 index 60cee6a..0000000 --- a/home/programs/git.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.git = { - enable = true; - userName = "Florian RICHER"; - userEmail = "florian.richer@protonmail.com"; - - # signing.signByDefault = true; - }; -} \ No newline at end of file diff --git a/home/programs/jetbrains-toolbox.nix b/home/programs/jetbrains-toolbox.nix deleted file mode 100644 index 1e01ed1..0000000 --- a/home/programs/jetbrains-toolbox.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, ... }: - -{ - home.packages = with pkgs; [jetbrains-toolbox]; -} diff --git a/home/programs/shell.nix b/home/programs/shell.nix deleted file mode 100644 index fbc1dff..0000000 --- a/home/programs/shell.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, users, ... }: - -{ - homePrograms.zsh.enable = true; -} diff --git a/home/programs/vscode.nix b/home/programs/vscode.nix deleted file mode 100644 index 5da63cf..0000000 --- a/home/programs/vscode.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.vscode = { - enable = true; - enableUpdateCheck = false; - enableExtensionUpdateCheck = false; - - userSettings = { - "files.autoSave" = "onFocusChange"; - "emmet.includeLanguages" = { - "phoenix-heex" = "html"; - }; - "git.autofetch" = true; - }; - - userTasks = {}; - - extensions = with pkgs; with vscode-extensions; [ - # Nix - bbenoist.nix - - # Rust - rust-lang.rust-analyzer - serayuzgur.crates - tamasfe.even-better-toml - - # Phoenix - phoenixframework.phoenix - elixir-lsp.vscode-elixir-ls - - # Ruby - shopify.ruby-lsp - ]; - }; -} \ No newline at end of file diff --git a/hosts/nixos-test/default.nix b/hosts/nixos-test/configuration.nix similarity index 67% rename from hosts/nixos-test/default.nix rename to hosts/nixos-test/configuration.nix index e45767e..44d28b0 100644 --- a/hosts/nixos-test/default.nix +++ b/hosts/nixos-test/configuration.nix @@ -7,16 +7,8 @@ { imports = [ - ../../modules/linux_gaming.nix - ../../modules/system.nix - ../../modules/network.nix - ../../modules/keymaps/us.nix - ../../modules/pipewire.nix - ../../modules/plasma.nix - ../../modules/plymouth.nix + ../../modules/system - ../../modules # Import optional configuration - # Include the results of the hardware scan. ./hardware-configuration.nix ]; @@ -31,8 +23,10 @@ }; }; - # Configure for testing in vm + networking.hostName = "nixos-vm"; # Define your hostname. users.users.florian.initialPassword = "test"; + + # Configure for testing in vm virtualisation.vmVariant = { # following configuration is added only when building VM with build-vm virtualisation = { @@ -41,5 +35,24 @@ }; }; - networking.hostName = "nixos-vm"; # Define your hostname. + modules.system = { + desktop = { + plasma.enable = true; + }; + + server = { + docker.enable = true; + openssh.enable = true; + }; + + hardware = { + bluetooth.enable = true; + gamingKernel.enable = true; + keymaps.layout = "us"; + pipewire.enable = true; + plymouth.enable = true; + printing.enable = true; + waydroid.enable = true; + }; + }; } diff --git a/hosts/nixos-test/home.nix b/hosts/nixos-test/home.nix new file mode 100644 index 0000000..3666345 --- /dev/null +++ b/hosts/nixos-test/home.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../../modules/home + ]; + + modules.home = { + apps = { + chromium.enable = true; + flatpak.enable = true; + jetbrainsToolbox.enable = true; + kitty.enable = true; + vscode.enable = true; + }; + + shell = { + zsh.enable = true; + atuin.enable = true; + direnv.enable = true; + git.enable = true; + }; + }; +} + diff --git a/hosts/perso-desktop/default.nix b/hosts/perso-desktop/configuration.nix similarity index 57% rename from hosts/perso-desktop/default.nix rename to hosts/perso-desktop/configuration.nix index 8bb5d4c..43e5e9a 100644 --- a/hosts/perso-desktop/default.nix +++ b/hosts/perso-desktop/configuration.nix @@ -7,18 +7,7 @@ { imports = [ - ../../modules/linux_gaming.nix - ../../modules/system.nix - ../../modules/network.nix - ../../modules/nvidia.nix - ../../modules/plasma.nix - ../../modules/keymaps/us.nix - ../../modules/bluetooth.nix - ../../modules/pipewire.nix - ../../modules/plymouth.nix - ../../modules/waydroid.nix - - ../../modules # Import optional configuration + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -29,4 +18,21 @@ boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "nixos-desktop-perso"; # Define your hostname. + + modules.system = { + desktop = { + plasma.enable = true; + }; + + hardware = { + bluetooth.enable = true; + gamingKernel.enable = true; + keymaps.layout = "us"; + nvidia.enable = true; + pipewire.enable = true; + plymouth.enable = true; + printing.enable = true; + waydroid.enable = true; + }; + }; } diff --git a/hosts/perso-desktop/home.nix b/hosts/perso-desktop/home.nix new file mode 100644 index 0000000..3666345 --- /dev/null +++ b/hosts/perso-desktop/home.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../../modules/home + ]; + + modules.home = { + apps = { + chromium.enable = true; + flatpak.enable = true; + jetbrainsToolbox.enable = true; + kitty.enable = true; + vscode.enable = true; + }; + + shell = { + zsh.enable = true; + atuin.enable = true; + direnv.enable = true; + git.enable = true; + }; + }; +} + diff --git a/hosts/perso-laptop/default.nix b/hosts/perso-laptop/configuration.nix similarity index 68% rename from hosts/perso-laptop/default.nix rename to hosts/perso-laptop/configuration.nix index 10e6930..37c845a 100644 --- a/hosts/perso-laptop/default.nix +++ b/hosts/perso-laptop/configuration.nix @@ -7,17 +7,7 @@ { imports = [ - ../../modules/linux_gaming.nix - ../../modules/system.nix - ../../modules/network.nix - ../../modules/nvidia.nix - ../../modules/plasma.nix - ../../modules/keymaps/fr.nix - ../../modules/bluetooth.nix - ../../modules/pipewire.nix - ../../modules/plymouth.nix - - ../../modules # Import optional configuration + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -42,5 +32,20 @@ nvidiaBusId = "PCI:1:0:0"; }; -# customModules.gpuPassthrough.enable = true; + modules.system = { + desktop = { + plasma.enable = true; + }; + + hardware = { + bluetooth.enable = true; + gamingKernel.enable = true; + keymaps.layout = "fr"; + nvidia.enable = true; + pipewire.enable = true; + plymouth.enable = true; + printing.enable = true; + waydroid.enable = true; + }; + }; } diff --git a/hosts/perso-laptop/home.nix b/hosts/perso-laptop/home.nix new file mode 100644 index 0000000..3666345 --- /dev/null +++ b/hosts/perso-laptop/home.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../../modules/home + ]; + + modules.home = { + apps = { + chromium.enable = true; + flatpak.enable = true; + jetbrainsToolbox.enable = true; + kitty.enable = true; + vscode.enable = true; + }; + + shell = { + zsh.enable = true; + atuin.enable = true; + direnv.enable = true; + git.enable = true; + }; + }; +} + diff --git a/hosts/pro-laptop/default.nix b/hosts/pro-laptop/configuration.nix similarity index 69% rename from hosts/pro-laptop/default.nix rename to hosts/pro-laptop/configuration.nix index a32c402..4a0eec2 100644 --- a/hosts/pro-laptop/default.nix +++ b/hosts/pro-laptop/configuration.nix @@ -7,17 +7,7 @@ { imports = [ - ../../modules/linux_gaming.nix - ../../modules/system.nix - ../../modules/network.nix - ../../modules/nvidia.nix - ../../modules/plasma.nix - ../../modules/keymaps/fr.nix - ../../modules/bluetooth.nix - ../../modules/pipewire.nix - ../../modules/plymouth.nix - - ../../modules # Import optional configuration + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -41,4 +31,21 @@ # information bus: pci@0000:01:00.0 nvidiaBusId = "PCI:1:0:0"; }; + + modules.system = { + desktop = { + plasma.enable = true; + }; + + hardware = { + bluetooth.enable = true; + gamingKernel.enable = true; + keymaps.layout = "fr"; + nvidia.enable = true; + pipewire.enable = true; + plymouth.enable = true; + printing.enable = true; + waydroid.enable = true; + }; + }; } diff --git a/hosts/pro-laptop/home.nix b/hosts/pro-laptop/home.nix new file mode 100644 index 0000000..3666345 --- /dev/null +++ b/hosts/pro-laptop/home.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../../modules/home + ]; + + modules.home = { + apps = { + chromium.enable = true; + flatpak.enable = true; + jetbrainsToolbox.enable = true; + kitty.enable = true; + vscode.enable = true; + }; + + shell = { + zsh.enable = true; + atuin.enable = true; + direnv.enable = true; + git.enable = true; + }; + }; +} + diff --git a/modules/ai.nix b/modules/ai.nix deleted file mode 100644 index 842fa22..0000000 --- a/modules/ai.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -{ - options.customModules.AI = { - enable = mkEnableOption '' - Enable AI - ''; - }; - config = - let - cfg = config.customModules.AI; - nvidiaEnabled = config.hardware.nvidia.modesetting.enable; - in - mkIf cfg.enable { - services.ollama = { - enable = true; - - acceleration = - if nvidiaEnabled then - "cuda" - else - null; - }; - } - // mkIf nvidiaEnabled { environment.systemPackages = with pkgs; [cudatoolkit]; }; -} \ No newline at end of file diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix deleted file mode 100644 index 820709f..0000000 --- a/modules/bluetooth.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, ... }: - -{ - hardware.bluetooth.enable = true; -} diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index 979c98e..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - imports = [ - ./gpuPassthrough - ]; -} \ No newline at end of file diff --git a/modules/docker.nix b/modules/docker.nix deleted file mode 100644 index 886f2a2..0000000 --- a/modules/docker.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, pkgs, ... }: - -{ - virtualisation.docker.enable = true; - virtualisation.docker.enableNvidia = config.hardware.nvidia.modesetting.enable; - users.users.florian.extraGroups = [ "docker" ]; -} diff --git a/modules/gnome.nix b/modules/gnome.nix deleted file mode 100644 index 2314d6d..0000000 --- a/modules/gnome.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, ... }: -{ - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the Gnome Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - - # Enable the GNOME shell. - services.xserver.desktopManager.gnome.enable = true; -} diff --git a/modules/gpuPassthrough/default.nix b/modules/gpuPassthrough/default.nix deleted file mode 100644 index 6bfa3d0..0000000 --- a/modules/gpuPassthrough/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -{ - options.customModules.gpuPassthrough = { - enable = mkEnableOption '' - Enable gpu passthgrouth with my custom configurations - ''; - }; - config = - let - cfg = config.customModules.gpuPassthrough; - in - mkIf cfg.enable { - programs.virt-manager.enable = true; - - virtualisation.libvirtd = { - enable = true; - - hooks.qemu = { - is_working = "${pkgs.writeShellScript "testHook.sh" '' - touch /tmp/qemu_hook_is_working - ''}"; - }; - }; - }; -} \ No newline at end of file diff --git a/modules/gpuPassthrough/scripts/alloc_hugepages.sh b/modules/gpuPassthrough/scripts/alloc_hugepages.sh deleted file mode 100644 index bd96923..0000000 --- a/modules/gpuPassthrough/scripts/alloc_hugepages.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -## Load the config file -source "/etc/libvirt/hooks/kvm.conf" - -## Calculate number of hugepages to allocate from memory (in MB) -HUGEPAGES="$(($VM_MEMORY/$(($(grep Hugepagesize /proc/meminfo | awk '{print $2}')/1024))))" - -echo "Allocating hugepages..." -echo $HUGEPAGES > /proc/sys/vm/nr_hugepages -ALLOC_PAGES=$(cat /proc/sys/vm/nr_hugepages) - -TRIES=0 -while (( $ALLOC_PAGES != $HUGEPAGES && $TRIES < 1000 )) -do - echo 1 > /proc/sys/vm/compact_memory ## defrag ram - echo $HUGEPAGES > /proc/sys/vm/nr_hugepages - ALLOC_PAGES=$(cat /proc/sys/vm/nr_hugepages) - echo "Succesfully allocated $ALLOC_PAGES / $HUGEPAGES" - let TRIES+=1 -done - -if [ "$ALLOC_PAGES" -ne "$HUGEPAGES" ] -then - echo "Not able to allocate all hugepages. Reverting..." - echo 0 > /proc/sys/vm/nr_hugepages - exit 1 -fi diff --git a/modules/gpuPassthrough/scripts/cpu_mode_ondemand.sh b/modules/gpuPassthrough/scripts/cpu_mode_ondemand.sh deleted file mode 100644 index 07a5b4a..0000000 --- a/modules/gpuPassthrough/scripts/cpu_mode_ondemand.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -## Enable CPU governor on-demand mode -cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor -for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "ondemand" > $file; done -cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor diff --git a/modules/gpuPassthrough/scripts/cpu_mode_performance.sh b/modules/gpuPassthrough/scripts/cpu_mode_performance.sh deleted file mode 100644 index 7a1c821..0000000 --- a/modules/gpuPassthrough/scripts/cpu_mode_performance.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -## Enable CPU governor performance mode -cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor -for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done -cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor diff --git a/modules/gpuPassthrough/scripts/dealloc_hugepages.sh b/modules/gpuPassthrough/scripts/dealloc_hugepages.sh deleted file mode 100644 index 887bc1e..0000000 --- a/modules/gpuPassthrough/scripts/dealloc_hugepages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo 0 > /proc/sys/vm/nr_hugepages diff --git a/modules/gpuPassthrough/scripts/start.sh b/modules/gpuPassthrough/scripts/start.sh deleted file mode 100644 index c6a2f7a..0000000 --- a/modules/gpuPassthrough/scripts/start.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Helpful to read output when debugging -set -x - -# Load variables -source "/etc/libvirt/hooks/kvm.conf" - -# Stop display manager -systemctl stop gdm.service - -# Unbind VTconsoles -echo 0 > /sys/class/vtconsole/vtcon0/bind -echo 0 > /sys/class/vtconsole/vtcon1/bind - -# Unbind EFI-Framebuffer -echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind - -# Avoid a Race condition -sleep 5 - -# Unload all Nvidia drivers -modprobe -r nvidia_drm -modprobe -r nvidia_modeset -modprobe -r nvidia_uvm -modprobe -r nvidia - -# Unbind the GPU from display driver -virsh nodedev-detach $VIRSH_GPU_VIDEO -virsh nodedev-detach $VIRSH_GPU_AUDIO -virsh nodedev-detach $VIRSH_USB -virsh nodedev-detach $VIRSH_SERIAL_BUS - -# Load VFIO Kernel Module -modprobe vfio-pci diff --git a/modules/gpuPassthrough/scripts/stop.sh b/modules/gpuPassthrough/scripts/stop.sh deleted file mode 100644 index 9d7d483..0000000 --- a/modules/gpuPassthrough/scripts/stop.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -x - -# Load variables -source "/etc/libvirt/hooks/kvm.conf" - -# Unload VFIO-PCI Kernel Driver -modprobe -r vfio-pci -modprobe -r vfio_iommu_type1 -modprobe -r vfio - -# Re-Bind GPU to Nvidia Driver -virsh nodedev-reattach $VIRSH_GPU_VIDEO -virsh nodedev-reattach $VIRSH_GPU_AUDIO -virsh nodedev-reattach $VIRSH_USB -virsh nodedev-reattach $VIRSH_SERIAL_BUS - -# Rebind VT consoles -echo 1 > /sys/class/vtconsole/vtcon0/bind -echo 1 > /sys/class/vtconsole/vtcon1/bind - -# Bind EFI-Framebuffer -nvidia-xconfig --query-gpu-info > /dev/null 2>&1 -echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind - -# Load all Nvidia drivers -modprobe nvidia_drm -modprobe nvidia_modeset -modprobe drm_kms_helper -modprobe drm -modprobe nvidia_uvm -modprobe nvidia - -# Restart Display Manager -systemctl start gdm.service diff --git a/modules/gpuPassthrough/win10/win10.xml b/modules/gpuPassthrough/win10/win10.xml deleted file mode 100644 index 59e8aa6..0000000 --- a/modules/gpuPassthrough/win10/win10.xml +++ /dev/null @@ -1,247 +0,0 @@ - - win10 - b3d036ee-75ff-43fe-be76-b8c5494f5dd7 - - - - - - 25165824 - 25165824 - - - - 32 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - hvm - /usr/share/edk2-ovmf/x64/OVMF_CODE.fd - /var/lib/libvirt/qemu/nvram/win10_VARS.fd - - - - - - - - - - - - - - - - - - - - - - - - - - - - destroy - restart - destroy - - - - - - /usr/bin/qemu-system-x86_64 - - - - - -
- - - - - - -
- - - - - - -
- - -
- - -
- - - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - -
- - - - - -
- - - -