Compare commits
	
		
			9 Commits 
		
	
	
		
			069a3b8333
			...
			b25fc9a2b8
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
									
								
								 | 
						b25fc9a2b8 | |
| 
							
							
								
									
								
								 | 
						7bbd0dd8a8 | |
| 
							
							
								
									
								
								 | 
						07e4669bb8 | |
| 
							
							
								
									
								
								 | 
						203665a051 | |
| 
							
							
								
									
								
								 | 
						431fa046be | |
| 
							
							
								
									
								
								 | 
						83464117ae | |
| 
							
							
								
									
								
								 | 
						c8cf7aa5ca | |
| 
							
							
								
									
								
								 | 
						0ad84eed45 | |
| 
							
							
								
									
								
								 | 
						811388006f | 
| 
						 | 
				
			
			@ -5,11 +5,11 @@
 | 
			
		|||
1. Build the virtual machine
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
nix run -L '.#nixosConfigurations.vm.config.system.build.vmWithDisko'
 | 
			
		||||
nix build -L '.#nixosConfigurations.vm.config.system.build.vmWithDisko'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
2. Run the virtual machine
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
QEMU_KERNEL_PARAMS=console=ttyS0 ./result/bin/run-nixos-vm -nographic; reset
 | 
			
		||||
./result/bin/disko-vm
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										27
									
								
								flake.nix
								
								
								
								
							
							
						
						
									
										27
									
								
								flake.nix
								
								
								
								
							| 
						 | 
				
			
			@ -3,28 +3,33 @@
 | 
			
		|||
    nixpkgs = {
 | 
			
		||||
      url = "github:nixos/nixpkgs?ref=nixos-25.05";
 | 
			
		||||
    };
 | 
			
		||||
    home-manager = {
 | 
			
		||||
      url = "github:nix-community/home-manager/release-25.05";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
    disko = {
 | 
			
		||||
      url = "github:nix-community/disko/latest";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
    home-manager = {
 | 
			
		||||
      url = "github:nix-community/home-manager/release-25.05";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = { self, nixpkgs, disko, home-manager }: {
 | 
			
		||||
    nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
 | 
			
		||||
  outputs =
 | 
			
		||||
    {
 | 
			
		||||
      self,
 | 
			
		||||
      nixpkgs,
 | 
			
		||||
      disko,
 | 
			
		||||
      home-manager,
 | 
			
		||||
    }:
 | 
			
		||||
    {
 | 
			
		||||
      nixosConfigurations = {
 | 
			
		||||
        vm = nixpkgs.lib.nixosSystem {
 | 
			
		||||
          system = "x86_64-linux";
 | 
			
		||||
          modules = [
 | 
			
		||||
            disko.nixosModules.disko
 | 
			
		||||
            home-manager.nixosModules.home-manager
 | 
			
		||||
            ./hosts/vm/configuration.nix
 | 
			
		||||
        home-manager.nixosModules.home-manager {
 | 
			
		||||
          home-manager.useGlobalPkgs = true;
 | 
			
		||||
          home-manager.useUserPackages = true;
 | 
			
		||||
          home-manager.users.h = ./hosts/vm/home.nix;
 | 
			
		||||
	      }
 | 
			
		||||
          ];
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,9 @@
 | 
			
		|||
{ pkgs, ... }:
 | 
			
		||||
{ ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  system.stateVersion = "25.05";
 | 
			
		||||
 | 
			
		||||
  imports =
 | 
			
		||||
    [
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./hard.nix
 | 
			
		||||
    ./disk.nix
 | 
			
		||||
    ../../modules/bootloader.nix
 | 
			
		||||
| 
						 | 
				
			
			@ -16,22 +15,40 @@
 | 
			
		|||
    ../../modules/x.nix
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  nix.settings.experimental-features = [ "nix-command" "flakes" ];
 | 
			
		||||
  nix.settings.experimental-features = [
 | 
			
		||||
    "nix-command"
 | 
			
		||||
    "flakes"
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  disko = {
 | 
			
		||||
    devices.disk.main.device = "/dev/vda";
 | 
			
		||||
    devices.disk.main.imageName = "nixos-vm";
 | 
			
		||||
    devices.disk.main.imageSize = "32G";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  disko.devices.disk.main.device = "/dev/vda";
 | 
			
		||||
 | 
			
		||||
  programs.git.enable = true;
 | 
			
		||||
  programs.firefox.enable = true;
 | 
			
		||||
  virtualisation.vmVariantWithDisko = {
 | 
			
		||||
    virtualisation = {
 | 
			
		||||
      cores = 8;
 | 
			
		||||
      memorySize = 16384;
 | 
			
		||||
      qemu.options = [
 | 
			
		||||
        "-enable-kvm"
 | 
			
		||||
        "-cpu host"
 | 
			
		||||
        "-nographic"
 | 
			
		||||
      ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  nixpkgs.config.allowUnfree = true;
 | 
			
		||||
 | 
			
		||||
  environment.systemPackages = with pkgs; [
 | 
			
		||||
    neovim
 | 
			
		||||
    kitty
 | 
			
		||||
  ];
 | 
			
		||||
  home-manager = {
 | 
			
		||||
    useGlobalPkgs = true;
 | 
			
		||||
    useUserPackages = true;
 | 
			
		||||
    users.h = ./home.nix;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  services.qemuGuest.enable = true;
 | 
			
		||||
  services.spice-vdagentd.enable = true;
 | 
			
		||||
 | 
			
		||||
  services.openssh = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    startWhenNeeded = true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,3 @@
 | 
			
		|||
# USAGE in your configuration.nix.
 | 
			
		||||
# Update devices to match your hardware.
 | 
			
		||||
# {
 | 
			
		||||
#  imports = [ ./disko-config.nix ];
 | 
			
		||||
#  disko.devices.disk.main.device = "/dev/sda";
 | 
			
		||||
# }
 | 
			
		||||
{
 | 
			
		||||
  disko.devices = {
 | 
			
		||||
    disk = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,26 @@
 | 
			
		|||
# 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 + "/profiles/qemu-guest.nix")
 | 
			
		||||
  imports = [
 | 
			
		||||
    (modulesPath + "/profiles/qemu-guest.nix")
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
 | 
			
		||||
  boot.initrd.availableKernelModules = [
 | 
			
		||||
    "ahci"
 | 
			
		||||
    "xhci_pci"
 | 
			
		||||
    "virtio_pci"
 | 
			
		||||
    "sr_mod"
 | 
			
		||||
    "virtio_blk"
 | 
			
		||||
  ];
 | 
			
		||||
  boot.initrd.kernelModules = [ ];
 | 
			
		||||
  boot.kernelModules = [ "kvm-intel" ];
 | 
			
		||||
  boot.extraModulePackages = [ ];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,81 @@
 | 
			
		|||
  home.username = "h";
 | 
			
		||||
  home.homeDirectory = "/home/h";
 | 
			
		||||
 | 
			
		||||
  home.file.".inputrc".source = ../../dots/.inputrc;
 | 
			
		||||
  programs = {
 | 
			
		||||
    bash = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      enableCompletion = true;
 | 
			
		||||
      initExtra = ''
 | 
			
		||||
        for f in ${config.home.homeDirectory}/.bashrc.d/*; do
 | 
			
		||||
          [ -f "$f" ] && source "$f"
 | 
			
		||||
        done
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
    firefox.enable = true;
 | 
			
		||||
    fzf = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      enableBashIntegration = true;
 | 
			
		||||
    };
 | 
			
		||||
    git.enable = true;
 | 
			
		||||
    home-manager.enable = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  programs.home-manager.enable = true;
 | 
			
		||||
  home.packages = with pkgs; [
 | 
			
		||||
    bash-completion
 | 
			
		||||
    bash-language-server
 | 
			
		||||
    bat
 | 
			
		||||
    brightnessctl
 | 
			
		||||
    entr
 | 
			
		||||
    eslint_d
 | 
			
		||||
    feh
 | 
			
		||||
    firefox-devedition
 | 
			
		||||
    fzf
 | 
			
		||||
    git
 | 
			
		||||
    haskell-language-server
 | 
			
		||||
    haskellPackages.pandoc-crossref
 | 
			
		||||
    haskellPackages.hadolint
 | 
			
		||||
    htop
 | 
			
		||||
    iosevka
 | 
			
		||||
    jq
 | 
			
		||||
    keepassxc
 | 
			
		||||
    kitty
 | 
			
		||||
    lua-language-server
 | 
			
		||||
    neovim
 | 
			
		||||
    nmap
 | 
			
		||||
    nodejs_24
 | 
			
		||||
    nodePackages.ts-node
 | 
			
		||||
    nvimpager
 | 
			
		||||
    ormolu
 | 
			
		||||
    pandoc
 | 
			
		||||
    parallel
 | 
			
		||||
    pass
 | 
			
		||||
    pnpm
 | 
			
		||||
    ripgrep
 | 
			
		||||
    silver-searcher
 | 
			
		||||
    sshfs
 | 
			
		||||
    stylelint
 | 
			
		||||
    svelte-language-server
 | 
			
		||||
    tailwindcss-language-server
 | 
			
		||||
    taskwarrior3
 | 
			
		||||
    tldr
 | 
			
		||||
    tmux
 | 
			
		||||
    tmuxp
 | 
			
		||||
    tree
 | 
			
		||||
    tree-sitter
 | 
			
		||||
    typescript-language-server
 | 
			
		||||
    unzip
 | 
			
		||||
    vim-language-server
 | 
			
		||||
    vimPlugins.vim-plug
 | 
			
		||||
    vtsls
 | 
			
		||||
    wget
 | 
			
		||||
    xbanish
 | 
			
		||||
    xclip
 | 
			
		||||
    yaml-language-server
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  home.file = {
 | 
			
		||||
    ".inputrc".source = ../../dots/.inputrc;
 | 
			
		||||
    ".bashrc.d/prompt".source = ../../dots/.bashrc.d/prompt;
 | 
			
		||||
    ".bashrc.d/editor".source = ../../dots/.bashrc.d/editor;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,11 @@
 | 
			
		|||
 | 
			
		||||
{
 | 
			
		||||
  networking.hostName = "nixos";
 | 
			
		||||
  networking.wireless = { iwd = { enable = true; }; };
 | 
			
		||||
  networking.wireless = {
 | 
			
		||||
    iwd = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  networking.firewall = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    allowedTCPPorts = [ 22 ];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue