woah this vm shit is so so cool

This commit is contained in:
CherryKitten 2024-03-24 19:02:23 +01:00
parent 26ccd2af15
commit 4d9ede5faa
Signed by: sammy
GPG key ID: 98D8F75FB0658276
7 changed files with 190 additions and 119 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
result
*.qcow2

View file

@ -8,23 +8,20 @@
}; };
}; };
outputs = inputs @ { outputs =
self, inputs @ { self
nixpkgs, , nixpkgs
nixpkgs-unstable, , nixpkgs-unstable
home-manager, , home-manager
... , ...
}: let }:
mkHost = hostname: graphical: { let
system = "x86_64-linux";
mkHost = hostname: {
imports = [ imports = [
./hosts/${hostname}/configuration.nix ./hosts/${hostname}/configuration.nix
./modules/common ./modules/common
(import "${home-manager}/nixos") (import "${home-manager}/nixos")
(
if graphical
then ./modules/graphical
else null
)
]; ];
deployment = { deployment = {
@ -33,7 +30,8 @@
allowLocalDeployment = true; allowLocalDeployment = true;
}; };
}; };
in { in
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
colmena = { colmena = {
meta = { meta = {
@ -43,7 +41,14 @@
}; };
}; };
bengal = mkHost "bengal" true; bengal = mkHost "bengal";
};
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/test-vm/configuration.nix
(import "${home-manager}/nixos")
];
}; };
}; };
} }

View file

@ -12,6 +12,8 @@
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
cherrykitten.graphical.enable = true;
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
networking.hostName = "bengal"; networking.hostName = "bengal";

View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }: {
imports = [
../../modules/common
../../modules/graphical
];
cherrykitten.graphical.enable = false;
users.users.admin = {
isNormalUser = true;
extraGroups = [ "wheel" ];
password = "admin";
group = "admin";
};
users.groups.admin = { };
virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {
memorySize = 8192;
cores = 6;
graphics = true;
};
};
services.openssh = {
enable = true;
settings.PasswordAuthentication = lib.mkForce true;
};
networking.firewall.allowedTCPPorts = [ 22 ];
environment.systemPackages = with pkgs; [
htop
];
system.stateVersion = "23.10";
}

View file

@ -1,15 +1,28 @@
{ lib
, config
, pkgs
, ...
}:
let
cfg = config.cherrykitten.common;
in
{ {
lib,
config,
pkgs,
...
}: {
imports = [ imports = [
../users ../users
./security.nix ./security.nix
./yubikey.nix ./yubikey.nix
../graphical
]; ];
options.cherrykitten.common = {
test = lib.mkOption {
type = lib.types.str;
default = "nya";
example = "nyanya";
};
};
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
@ -22,7 +35,7 @@
}; };
fonts = { fonts = {
enableDefaultFonts = true; enableDefaultPackages = true;
packages = with pkgs; [ packages = with pkgs; [
noto-fonts noto-fonts
noto-fonts-cjk noto-fonts-cjk
@ -46,4 +59,5 @@
pinentry pinentry
wget wget
]; ];
};
} }

View file

@ -1,9 +1,17 @@
{ pkgs
, config
, lib
, ...
}:
let
cfg = config.cherrykitten.graphical;
in
{ {
pkgs, options.cherrykitten.graphical = {
config, enable = lib.mkEnableOption (lib.mdDoc "graphical stuffs");
lib, };
...
}: { config = lib.mkIf cfg.enable {
services.xserver = { services.xserver = {
enable = true; enable = true;
displayManager.sddm.enable = true; displayManager.sddm.enable = true;
@ -53,4 +61,5 @@
}; };
}; };
}; };
};
} }

View file

@ -12,7 +12,7 @@
}; };
}; };
home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true;
home-manager.users = { home-manager.users = {
sammy.imports = [./sammy.nix]; sammy.imports = [./sammy.nix];
}; };