add basic vm configuration

This commit is contained in:
Rouven Seifert 2023-05-01 12:30:21 +02:00
parent a9cfb32b12
commit 26e43a6da8
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
5 changed files with 111 additions and 6 deletions

View file

@ -62,3 +62,6 @@ sda
├─sda14 # BIOS boot ├─sda14 # BIOS boot
└─sda15 /boot/efi # EFI stuff └─sda15 /boot/efi # EFI stuff
``` ```
### vm
Barebones configuration that can be easily deployed to virtual machines.

View file

@ -46,11 +46,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1682813751, "lastModified": 1682906023,
"narHash": "sha256-gwR5vd1rVD6W/3BXbVohrfZKKOhPtp66vthGIG9758Y=", "narHash": "sha256-u0ngImxdfv2oSxFsjcfoQx6G2haZociXB5jHovEO1w8=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "02312cac59e8b22a823043ef64a34bc9cf0eef02", "rev": "11b7ce14f87448417ce39cb667df6c6b9a591804",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -121,6 +121,21 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": {
"locked": {
"lastModified": 1682268411,
"narHash": "sha256-ICDKQ7tournRVtfM8C2II0qHiOZOH1b3dXVOCsgr11o=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "df1692e2d9f1efc4300b1ea9201831730e0b817d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nix-colors": { "nix-colors": {
"inputs": { "inputs": {
"base16-schemes": "base16-schemes", "base16-schemes": "base16-schemes",
@ -224,11 +239,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1682786779, "lastModified": 1682879489,
"narHash": "sha256-m7QFzPS/CE8hbkbIVK4UStihAQMtczr0vSpOgETOM1g=", "narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "08e4dc3a907a6dfec8bb3bbf1540d8abbffea22b", "rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -263,6 +278,7 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprpaper": "hyprpaper", "hyprpaper": "hyprpaper",
"impermanence": "impermanence",
"nix-colors": "nix-colors", "nix-colors": "nix-colors",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",

View file

@ -15,6 +15,10 @@
}; };
}; };
impermanence = {
url = "github:nix-community/impermanence";
};
nix-index-database = { nix-index-database = {
url = "github:Mic92/nix-index-database"; url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -63,6 +67,7 @@
{ nixpkgs { nixpkgs
, home-manager , home-manager
, nix-index-database , nix-index-database
, impermanence
, hyprland , hyprland
, sops-nix , sops-nix
, nix-colors , nix-colors
@ -120,6 +125,16 @@
trucksimulatorbot-images.nixosModules.default trucksimulatorbot-images.nixosModules.default
]; ];
}; };
vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs.inputs = attrs;
modules = [
./hosts/vm
./shared
impermanence.nixosModules.impermanence
sops-nix.nixosModules.sops
];
};
}; };
}; };
} }

48
hosts/vm/default.nix Normal file
View file

@ -0,0 +1,48 @@
{ config, pkgs, ... }:
{
nix.settings.experimental-features = [ "nix-command" "flakes" ];
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
];
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
kernelPackages = pkgs.linuxPackages_latest;
tmp.useTmpfs = true;
};
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "dvorak";
};
environment.systemPackages = with pkgs; [
vim
wget
htop-vim
];
programs.git = {
enable = true;
config = {
user.name = "Rouven Seifert";
user.email = "rouven@rfive.de";
};
};
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# firmware updates
users.users.root.openssh.authorizedKeys.keyFiles = [
../../keys/ssh/rouven-thinkpad
];
system.stateVersion = "22.11";
}

View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
# Replace with actual config
device = "/dev/sda";
fsType = "ext4";
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}