diff --git a/flake.nix b/flake.nix index fd25ca8..85d6383 100644 --- a/flake.nix +++ b/flake.nix @@ -19,21 +19,21 @@ { nixosConfigurations = { laptop = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/laptop/configuration.nix - home-manager.nixosModules.default + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/laptop/configuration.nix + home-manager.nixosModules.default - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; - home-manager.users.river = import ./hosts/laptop/home.nix; - } + home-manager.users.river = import ./home; + } - ]; + ]; + }; }; - } }; } diff --git a/home/default.nix b/home/default.nix index e69de29..e06f678 100644 --- a/home/default.nix +++ b/home/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./programs/bash.nix + ]; + + home.username = "river"; + home.homeDirectory = "/home/river"; + home.stateVersion = "26.05"; # Update this when changing nixpkgs releases +} diff --git a/home/programs/bash.nix b/home/programs/bash.nix index 62f5a6f..8006f28 100644 --- a/home/programs/bash.nix +++ b/home/programs/bash.nix @@ -26,15 +26,15 @@ source ${pkgs.carapace}/share/bash/carapace.bash export EDITOR=nvim ''; + }; - # Just to make sure pkgs are installed - home.packages = with pkgs; [ - bat - eza - zoxide - carapace - neovim - kubectl - ]; - } -} \ No newline at end of file + # Just to make sure pkgs are installed + home.packages = with pkgs; [ + bat + eza + zoxide + carapace + neovim + kubectl + ]; +} diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 6b0cd54..a2d417a 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -8,10 +8,11 @@ { imports = [ ./hardware-configuration.nix + ../../modules/virtualization ]; boot = { - + loader = { grub = { enable = true; @@ -41,13 +42,10 @@ isNormalUser = true; extraGroups = [ "wheel" - "libvirtd" - "kvm" ]; }; programs.firefox.enable = true; - programs.virt-manager.enable = true; programs.mtr.enable = true; programs.gnupg.agent = { enable = true; @@ -69,17 +67,6 @@ cmatrix ]; - virtualization = { - libvirtd.enable = true; - spiceUSBRedirection.enable = true; - - podman = { - enable = true; - dockerCompat = true; # lets you use `docker` commands → podman - defaultNetwork.settings.dns_enabled = true; - }; - }; - services.openssh.enable = true; services.code-server = { enable = true; diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix index e92952c..4790e79 100644 --- a/hosts/laptop/hardware-configuration.nix +++ b/hosts/laptop/hardware-configuration.nix @@ -1,32 +1,46 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "uas" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "uas" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/38bebcad-2550-4dd2-88af-4fbce1c0c905"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/38bebcad-2550-4dd2-88af-4fbce1c0c905"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/59D6-6348"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/398298a3-c3df-45fb-9667-fbee66cdb40f"; } + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/59D6-6348"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/398298a3-c3df-45fb-9667-fbee66cdb40f"; } + ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix deleted file mode 100644 index e69de29..0000000 diff --git a/modules/virtualization/default.nix b/modules/virtualization/default.nix index e69de29..5c7c718 100644 --- a/modules/virtualization/default.nix +++ b/modules/virtualization/default.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: + +{ + imports = [ + ./qemu.nix + ./podman.nix + ]; +} diff --git a/modules/virtualization/podman.nix b/modules/virtualization/podman.nix new file mode 100644 index 0000000..29b8fc0 --- /dev/null +++ b/modules/virtualization/podman.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + virtualisation.podman = { + enable = true; + dockerCompat = true; + defaultNetwork.settings.dns_enabled = true; + }; + + users.users.river.extraGroups = [ "podman" ]; + + environment.systemPackages = with pkgs; [ + podman + podman-compose + ]; +} diff --git a/modules/virtualization/qemu.nix b/modules/virtualization/qemu.nix index 8e7b9ca..ffa54df 100644 --- a/modules/virtualization/qemu.nix +++ b/modules/virtualization/qemu.nix @@ -10,7 +10,6 @@ programs.virt-manager.enable = true; virtualisation.libvirtd.qemu = { - ovmf.enable = true; swtpm.enable = true; };