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 @ {
self,
nixpkgs,
nixpkgs-unstable,
home-manager,
...
}: let
mkHost = hostname: graphical: {
outputs =
inputs @ { self
, nixpkgs
, nixpkgs-unstable
, home-manager
, ...
}:
let
system = "x86_64-linux";
mkHost = hostname: {
imports = [
./hosts/${hostname}/configuration.nix
./modules/common
(import "${home-manager}/nixos")
(
if graphical
then ./modules/graphical
else null
)
];
deployment = {
@ -33,17 +30,25 @@
allowLocalDeployment = true;
};
};
in {
in
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
colmena = {
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [];
overlays = [ ];
};
};
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
];
cherrykitten.graphical.enable = true;
boot.loader.systemd-boot.enable = true;
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,16 +1,29 @@
{ lib
, config
, pkgs
, ...
}:
let
cfg = config.cherrykitten.common;
in
{
lib,
config,
pkgs,
...
}: {
imports = [
../users
./security.nix
./yubikey.nix
../graphical
];
nix.settings.experimental-features = ["nix-command" "flakes"];
options.cherrykitten.common = {
test = lib.mkOption {
type = lib.types.str;
default = "nya";
example = "nyanya";
};
};
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
time.timeZone = "Europe/Berlin";
@ -22,7 +35,7 @@
};
fonts = {
enableDefaultFonts = true;
enableDefaultPackages = true;
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
@ -31,10 +44,10 @@
nerdfonts
];
fontconfig = {
defaultFonts.emoji = ["Noto Emoji"];
defaultFonts.serif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font"];
defaultFonts.sansSerif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font"];
defaultFonts.monospace = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font"];
defaultFonts.emoji = [ "Noto Emoji" ];
defaultFonts.serif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font" ];
defaultFonts.sansSerif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font" ];
defaultFonts.monospace = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" ];
};
};
@ -46,4 +59,5 @@
pinentry
wget
];
};
}

View file

@ -1,9 +1,17 @@
{ pkgs
, config
, lib
, ...
}:
let
cfg = config.cherrykitten.graphical;
in
{
pkgs,
config,
lib,
...
}: {
options.cherrykitten.graphical = {
enable = lib.mkEnableOption (lib.mdDoc "graphical stuffs");
};
config = lib.mkIf cfg.enable {
services.xserver = {
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 = {
sammy.imports = [./sammy.nix];
};