From fcc480dbf136b32b2122f2da82a8a3a3de473254 Mon Sep 17 00:00:00 2001 From: Xory Date: Thu, 28 Aug 2025 14:51:10 +0300 Subject: [PATCH] restructuring pt 1 --- flake.lock | 49 +++++++++++++++++++ flake.nix | 2 +- hardware-configuration.nix | 37 ++++++++++++++ home.nix | 13 ----- .../nixvm/configuration.nix | 2 +- hosts/nixvm/hardware-configuration.nix | 37 ++++++++++++++ hosts/nixvm/home.nix | 22 +++++++++ 7 files changed, 147 insertions(+), 15 deletions(-) create mode 100644 flake.lock create mode 100644 hardware-configuration.nix delete mode 100644 home.nix rename configuration.nix => hosts/nixvm/configuration.nix (98%) create mode 100644 hosts/nixvm/hardware-configuration.nix create mode 100644 hosts/nixvm/home.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..986171c --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1756245065, + "narHash": "sha256-aAZNbGcWrVRZgWgkQbkabSGcDVRDMgON4BipMy69gvI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "54b2879ce622d44415e727905925e21b8f833a98", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1756217674, + "narHash": "sha256-TH1SfSP523QI7kcPiNtMAEuwZR3Jdz0MCDXPs7TS8uo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4e7667a90c167f7a81d906e5a75cba4ad8bee620", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index c7471d5..6828dd0 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ { nixpkgs, home-manager, ... }: { nixosConfigurations = { - nixos = nixpkgs.lib.nixosSystem { + nixvm = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./configuration.nix diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..dad7edc --- /dev/null +++ b/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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ae26f9c8-bbc0-49e6-b792-20f10277367c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0160-925B"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # 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/home.nix b/home.nix deleted file mode 100644 index e5ffb02..0000000 --- a/home.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, pkgs, ... }: -{ - home.username = "xory"; - home.homeDirectory = "/home/xory"; - - home.packages = with pkgs; [ - neovim - fastfetch - firefox - ]; - - home.stateVersion = "25.05"; -} diff --git a/configuration.nix b/hosts/nixvm/configuration.nix similarity index 98% rename from configuration.nix rename to hosts/nixvm/configuration.nix index 470fa9c..fd5779f 100644 --- a/configuration.nix +++ b/hosts/nixvm/configuration.nix @@ -17,7 +17,7 @@ # Use latest kernel. boot.kernelPackages = pkgs.linuxPackages_latest; - networking.hostName = "nixos"; # Define your hostname. + networking.hostName = "nixvm"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary diff --git a/hosts/nixvm/hardware-configuration.nix b/hosts/nixvm/hardware-configuration.nix new file mode 100644 index 0000000..dad7edc --- /dev/null +++ b/hosts/nixvm/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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ae26f9c8-bbc0-49e6-b792-20f10277367c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0160-925B"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # 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/hosts/nixvm/home.nix b/hosts/nixvm/home.nix new file mode 100644 index 0000000..cba7eb5 --- /dev/null +++ b/hosts/nixvm/home.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: +{ + home.username = "xory"; + home.homeDirectory = "/home/xory"; + + home.packages = with pkgs; [ + neovim + fastfetch + firefox + ]; + + home.stateVersion = "25.05"; + + programs.zsh = { + enable = true; + enableCompletion = true; + shellAliases = { + "rebuild" = "sudo nixos-rebuild switch --flake ~/dots"; + }; + syntaxHighlighting.enable = true; + }; +}