diff --git a/flake.nix b/flake.nix index 31e150b..4535d36 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,12 @@ ./hosts/${s.name} home-manager.nixosModules.home-manager agenix.nixosModules.default + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = inputs; + home-manager.users.florian = import ./home; + } ]; }; }) {} systems; diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..9a524dd --- /dev/null +++ b/home/default.nix @@ -0,0 +1,35 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../modules/home + ]; + + home = { + username = "florian"; + homeDirectory = "/home/florian"; + + stateVersion = "24.05"; + }; + + programs.home-manager.enable = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + homeModules = { + 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/nixos-test/default.nix b/hosts/nixos-test/default.nix index 29692d8..6fabb1b 100644 --- a/hosts/nixos-test/default.nix +++ b/hosts/nixos-test/default.nix @@ -23,30 +23,19 @@ }; }; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.florian = { - isNormalUser = true; - initialPassword = "test"; - description = "florian"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - home-manager.users.florian = { - home = { - username = "florian"; - homeDirectory = "/home/florian"; + networking.hostName = "nixos-vm"; # Define your hostname. + users.users.florian.initialPassword = "test"; - stateVersion = "24.05"; + # Configure for testing in vm + virtualisation.vmVariant = { + # following configuration is added only when building VM with build-vm + virtualisation = { + memorySize = 8192; # Use 8192MiB memory. + cores = 8; }; - - programs.home-manager.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; }; modules = { - home.users.florian = { - - }; - desktop = { plasma.enable = true; }; @@ -67,15 +56,4 @@ waydroid.enable = true; }; }; - - # Configure for testing in vm - virtualisation.vmVariant = { - # following configuration is added only when building VM with build-vm - virtualisation = { - memorySize = 8192; # Use 8192MiB memory. - cores = 8; - }; - }; - - networking.hostName = "nixos-vm"; # Define your hostname. } diff --git a/hosts/perso-desktop/default.nix b/hosts/perso-desktop/default.nix index f2e0303..6d167ca 100644 --- a/hosts/perso-desktop/default.nix +++ b/hosts/perso-desktop/default.nix @@ -17,23 +17,22 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.florian = { - isNormalUser = true; - description = "florian"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - home-manager.users.florian = { - home = { - username = "florian"; - homeDirectory = "/home/florian"; + networking.hostName = "nixos-desktop-perso"; # Define your hostname. - stateVersion = "24.05"; + modules = { + desktop = { + plasma.enable = true; }; - programs.home-manager.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + system = { + bluetooth.enable = true; + gamingKernel.enable = true; + keymaps.layout = "us"; + nvidia.enable = true; + pipewire.enable = true; + plymouth.enable = true; + printing.enable = true; + waydroid.enable = true; + }; }; - - networking.hostName = "nixos-desktop-perso"; # Define your hostname. } diff --git a/hosts/perso-laptop/default.nix b/hosts/perso-laptop/default.nix index f1b07cd..a0558d4 100644 --- a/hosts/perso-laptop/default.nix +++ b/hosts/perso-laptop/default.nix @@ -17,24 +17,6 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.florian = { - isNormalUser = true; - description = "florian"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - home-manager.users.florian = { - home = { - username = "florian"; - homeDirectory = "/home/florian"; - - stateVersion = "24.05"; - }; - - programs.home-manager.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - }; - networking.hostName = "nixos-laptop-perso"; # Define your hostname. hardware.nvidia.prime = { @@ -50,5 +32,20 @@ nvidiaBusId = "PCI:1:0:0"; }; -# customModules.gpuPassthrough.enable = true; + modules = { + desktop = { + plasma.enable = true; + }; + + system = { + 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/pro-laptop/default.nix b/hosts/pro-laptop/default.nix index 6c9d88d..043d03f 100644 --- a/hosts/pro-laptop/default.nix +++ b/hosts/pro-laptop/default.nix @@ -17,24 +17,6 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.florian = { - isNormalUser = true; - description = "florian"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - home-manager.users.florian = { - home = { - username = "florian"; - homeDirectory = "/home/florian"; - - stateVersion = "24.05"; - }; - - programs.home-manager.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - }; - networking.hostName = "nixos-laptop-pro"; # Define your hostname. hardware.nvidia.prime = { @@ -49,4 +31,21 @@ # information bus: pci@0000:01:00.0 nvidiaBusId = "PCI:1:0:0"; }; + + modules = { + desktop = { + plasma.enable = true; + }; + + system = { + 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/modules/default.nix b/modules/default.nix index 3629195..d0e6ab6 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,7 +3,6 @@ { imports = [ ./desktop - ./home ./server ./system ]; diff --git a/modules/home/apps/chromium/default.nix b/modules/home/apps/chromium/default.nix index 337b9fa..dbc7a90 100644 --- a/modules/home/apps/chromium/default.nix +++ b/modules/home/apps/chromium/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.desktop.chromium; + cfg = config.homeModules.apps.chromium; in { - options.modules.desktop.chromium = { + options.homeModules.apps.chromium = { enable = mkEnableOption '' Enable chromium with my custom configurations ''; diff --git a/modules/home/apps/flatpak/default.nix b/modules/home/apps/flatpak/default.nix index fcc4eb2..c379bc6 100644 --- a/modules/home/apps/flatpak/default.nix +++ b/modules/home/apps/flatpak/default.nix @@ -1,17 +1,19 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, nix-flatpak, ... }: with lib; let - cfg = config.modules.desktop.flatpak; + cfg = config.homeModules.apps.flatpak; in { - options.modules.desktop.flatpak = { + imports = [ nix-flatpak.homeManagerModules.nix-flatpak ]; + + options.homeModules.apps.flatpak = { enable = mkEnableOption '' Enable flatpak with my custom configurations ''; }; + config = mkIf cfg.enable { - imports = [ nix-flatpak.homeManagerModules.nix-flatpak ]; services.flatpak = { enable = true; diff --git a/modules/home/apps/jetbrainsToolbox/default.nix b/modules/home/apps/jetbrainsToolbox/default.nix index 39b5402..5bbc656 100644 --- a/modules/home/apps/jetbrainsToolbox/default.nix +++ b/modules/home/apps/jetbrainsToolbox/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.desktop.jetbrainsToolbox; + cfg = config.homeModules.apps.jetbrainsToolbox; in { - options.modules.desktop.jetbrainsToolbox = { + options.homeModules.apps.jetbrainsToolbox = { enable = mkEnableOption '' Enable jetbrainsToolbox with my custom configurations ''; diff --git a/modules/home/apps/kitty/default.nix b/modules/home/apps/kitty/default.nix index cb4525f..e8712d6 100644 --- a/modules/home/apps/kitty/default.nix +++ b/modules/home/apps/kitty/default.nix @@ -2,16 +2,16 @@ with lib; let - cfg = config.modules.desktop.kitty; + cfg = config.homeModules.apps.kitty; in { - options.modules.desktop.kitty = { + options.homeModules.apps.kitty = { enable = mkEnableOption '' Enable kitty with my custom configurations ''; enableBlur = mkOption { - default = !config.desktop.hyprland.enable; # Disable by default if hyprland is enabled (Hyprland enable own blur) + default = !config.homeModules.desktop.hyprland.enable; # Disable by default if hyprland is enabled (Hyprland enable own blur) example = true; description = '' Enable blur (Usefull to disable with hyprland) diff --git a/modules/home/apps/vscode/default.nix b/modules/home/apps/vscode/default.nix index 25ca4e6..a364002 100644 --- a/modules/home/apps/vscode/default.nix +++ b/modules/home/apps/vscode/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.home.vscode; + cfg = config.homeModules.apps.vscode; in { - options.modules.home.vscode = { + options.homeModules.apps.vscode = { enable = mkEnableOption '' Enable vscode with my custom configurations ''; diff --git a/modules/home/default.nix b/modules/home/default.nix index 92fb921..0782403 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,43 +1,10 @@ -inputs@{ config, pkgs, lib, ... }: +{ config, pkgs, ... }: -with lib; -let - cfg = config.modules.home; - - userOpts = { name, userconfig, ... }: { - options = {}; - config = { - # home = { - # username = name; - # homeDirectory = "/home/${name}"; - # stateVersion = "24.05"; - # }; - }; - }; -in { - options.modules.home = { - users = mkOption { - default = {}; - type = with types; attrsOf (submodule userOpts); - example = { - alice = { - shell.atuin.enable = true; - shell.direnv.enable = true; - shell.git.enable = true; - shell.zsh.enable = true; - }; - }; - description = '' - Additional user home configuration - ''; - }; - }; - config = { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = inputs; - home-manager.users = mapAttrs (name: userconfig: import ./home.nix) cfg.users; - }; + imports = [ + ./apps + ./desktop + ./shell + ]; } diff --git a/modules/home/home.nix b/modules/home/desktop/default.nix similarity index 63% rename from modules/home/home.nix rename to modules/home/desktop/default.nix index b40d028..5bc3c4d 100644 --- a/modules/home/home.nix +++ b/modules/home/desktop/default.nix @@ -2,7 +2,6 @@ { imports = [ - # ./apps - # ./shell + ./hyprland ]; } \ No newline at end of file diff --git a/modules/desktop/hyprland/default.nix b/modules/home/desktop/hyprland/default.nix similarity index 98% rename from modules/desktop/hyprland/default.nix rename to modules/home/desktop/hyprland/default.nix index c3fb062..8c3735a 100644 --- a/modules/desktop/hyprland/default.nix +++ b/modules/home/desktop/hyprland/default.nix @@ -2,7 +2,7 @@ with lib; let - cfg = config.modules.desktop.hyprland; + cfg = config.homeModules.desktop.hyprland; set_volume = pkgs.writeScriptBin "set_volume.sh" '' #!${pkgs.runtimeShell} @@ -10,13 +10,13 @@ let ''; in { - options.modules.desktop.hyprland = { + options.homeModules.desktop.hyprland = { enable = mkEnableOption '' Enable hyprland with my custom configurations ''; }; config = mkIf cfg.enable { - modules.desktop.kitty.enable = true; + homeModules.apps.kitty.enable = true; wayland.windowManager.hyprland = { enable = true; diff --git a/modules/home/shell/atuin/default.nix b/modules/home/shell/atuin/default.nix index 63db6de..7b31170 100644 --- a/modules/home/shell/atuin/default.nix +++ b/modules/home/shell/atuin/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.cli.atuin; + cfg = config.homeModules.shell.atuin; in { - options.modules.cli.atuin = { + options.homeModules.shell.atuin = { enable = mkEnableOption '' Enable atuin with my custom configurations ''; diff --git a/modules/home/shell/direnv/default.nix b/modules/home/shell/direnv/default.nix index 615ba65..0a8ae02 100644 --- a/modules/home/shell/direnv/default.nix +++ b/modules/home/shell/direnv/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.cli.direnv; + cfg = config.homeModules.shell.direnv; in { - options.modules.cli.direnv = { + options.homeModules.shell.direnv = { enable = mkEnableOption '' Enable direnv with my custom configurations ''; diff --git a/modules/home/shell/git/default.nix b/modules/home/shell/git/default.nix index 67aa41e..4166a12 100644 --- a/modules/home/shell/git/default.nix +++ b/modules/home/shell/git/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.cli.git; + cfg = config.homeModules.shell.git; in { - options.modules.cli.git = { + options.homeModules.shell.git = { enable = mkEnableOption '' Enable git with my custom configurations ''; diff --git a/modules/home/shell/zsh/default.nix b/modules/home/shell/zsh/default.nix index bea8585..610882c 100644 --- a/modules/home/shell/zsh/default.nix +++ b/modules/home/shell/zsh/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.cli.zsh; + cfg = config.homeModules.shell.zsh; in { - options.modules.cli.zsh = { + options.homeModules.shell.zsh = { enable = mkEnableOption '' Enable zsh with my custom configurations ''; diff --git a/modules/system/system.nix b/modules/system/system.nix index ffa7ad6..43cc570 100644 --- a/modules/system/system.nix +++ b/modules/system/system.nix @@ -28,6 +28,15 @@ nixd ]; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.florian = { + isNormalUser = true; + description = "florian"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + services.flatpak.enable = true; # Important can't be enabled from home-manager + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary