Compare commits

..

5 Commits
main ... disko

11 changed files with 59 additions and 209 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@
result
result-*
nixos-efi-vars.fd

View File

@ -1,15 +1,9 @@
# nixos
## Set up virtual machine ([`disko`](https://github.com/nix-community/disko/blob/master/docs/interactive-vm.md))
1. Build the virtual machine
My NixOS config
```
nix build -L '.#nixosConfigurations.vm.config.system.build.vmWithDisko'
```
2. Run the virtual machine
```
./result/bin/disko-vm
git clone https://git.hektormisplon.xyz/hektor/nix.git
cd nix
sudo nix run 'github:nix-community/disko/latest#disko-install' -- --flake .#vm --disk root /dev/vda
```

View File

@ -44,11 +44,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1759580034,
"narHash": "sha256-YWo57PL7mGZU7D4WeKFMiW4ex/O6ZolUS6UNBHTZfkI=",
"lastModified": 1759439645,
"narHash": "sha256-oiAyQaRilPk525Z5aTtTNWNzSrcdJ7IXM0/PL3CGlbI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3bcc93c5f7a4b30335d31f21e2f1281cba68c318",
"rev": "879bd460b3d3e8571354ce172128fbcbac1ed633",
"type": "github"
},
"original": {

View File

@ -13,23 +13,18 @@
};
};
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
];
};
};
outputs = { self, nixpkgs, disko, home-manager }: {
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/vm/configuration.nix
disko.nixosModules.disko
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.h = ./hosts/vm/home.nix;
}
];
};
};
}

View File

@ -1,54 +1,41 @@
{ ... }:
{ pkgs, ... }:
{
system.stateVersion = "25.05";
imports = [
./hard.nix
./disk.nix
../../modules/bootloader.nix
../../modules/networking.nix
../../modules/users.nix
../../modules/audio.nix
../../modules/printing.nix
../../modules/localization.nix
../../modules/x.nix
];
imports =
[
./hard.nix
./disk.nix
../../modules/bootloader.nix
../../modules/networking.nix
../../modules/users.nix
../../modules/audio.nix
../../modules/printing.nix
../../modules/localization.nix
../../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";
# These are needed for ZFS
networking.hostId = "25698a58";
# https://discourse.nixos.org/t/zfs-with-disko-faluire-to-import-zfs-pool/61988/3
boot = {
zfs = {
devNodes = "/dev/disk/by-uuid";
};
};
virtualisation.vmVariantWithDisko = {
virtualisation = {
cores = 8;
memorySize = 16384;
qemu.options = [
"-enable-kvm"
"-cpu host"
"-nographic"
];
};
};
programs.git.enable = true;
programs.firefox.enable = true;
nixpkgs.config.allowUnfree = true;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.h = ./home.nix;
};
environment.systemPackages = with pkgs; [ neovim ];
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
services.openssh = {
enable = true;
startWhenNeeded = true;

View File

@ -1,36 +1 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}
import ../../modules/disko.zfs-encrypted-root.nix

View File

@ -1,26 +1,14 @@
# 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 = [ ];

View File

@ -6,81 +6,7 @@
home.username = "h";
home.homeDirectory = "/home/h";
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;
};
home.file.".inputrc".source = ../../dots/.inputrc;
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;
};
programs.home-manager.enable = true;
}

View File

@ -2,11 +2,7 @@
{
networking.hostName = "nixos";
networking.wireless = {
iwd = {
enable = true;
};
};
networking.wireless = { iwd = { enable = true; }; };
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 ];

View File

@ -2,10 +2,10 @@
{
services.xserver.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = builtins.readFile ../dots/.xmonad/xmonad.hs;
};
enable = true;
enableContribAndExtras = true;
config = builtins.readFile ../dots/.xmonad/xmonad.hs;
};
services.xserver = {
enable = true;