Add base eirene config

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-06-18 16:05:20 +03:00
parent e06aa045b4
commit aec06c4b37
7 changed files with 135 additions and 51 deletions

View File

@@ -26,6 +26,10 @@ The below installation example is for a fresh `eirene-vm` virtual machine.
mkdir -p /mnt/persist/etc/ssh
ssh-keygen -t ed25519 -f /mnt/persist/etc/ssh/ssh_host_ed25519_key
cp /mnt/persist/etc/ssh/ssh_host_ed25519_key /host/hosts/eirene/secrets/ssh_host_ed25519_key
# Optional - Copy user keys
mkdir -p /mnt/persist/home/nick/.local/share/sops-nix
cp /host/users/nick/secrets/key.txt /mnt/persist/home/nick/.local/share/sops-nix/key.txt
```
4. Update `sops` Configuration

View File

@@ -27,10 +27,18 @@
};
outputs = { self, nixpkgs, ... } @ inputs: {
nixosConfigurations.eirene-vm = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [ ./hosts/eirene/vm ];
nixosConfigurations = {
eirene-vm = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [ ./hosts/eirene/vm ];
};
eirene = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [ ./hosts/eirene/base ];
};
};
};
}

View File

@@ -98,4 +98,5 @@
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.allowUnfree = true;
}

View File

@@ -0,0 +1,59 @@
{ config, inputs, lib, pkgs, ... }:
{
imports = [
inputs.disko.nixosModules.disko
(import ../format.nix { device = "/dev/disk/by-id/nvme-SAMSUNG_MZVL22T0HBLB-00BL2_S64RNE0R602762"; })
./hardware-configuration.nix
../.
];
networking.hostName = "eirene";
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
hardware = {
cpu.amd = {
updateMicrocode = true;
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = false;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
nvidiaBusId = "PCI:1:0:0";
amdgpuBusId = "PCI:6:0:0";
};
};
opengl = {
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
amdvlk
driversi686Linux.amdvlk
rocmPackages.clr
rocmPackages.clr.icd
];
};
};
services = {
xserver.videoDrivers = [ "nvidia" ];
tlp.enable = true;
fstrim.enable = true;
};
boot = {
kernelParams = [ "amd_pstate=active" "video=eDP:2560x1600@165" ];
initrd.kernelModules = [ "amdgpu" ];
};
home-manager.sharedModules = lib.mkIf config.programs.hyprland.enable [{ wayland.windowManager.hyprland.settings.monitor = "eDP, 2560x1600@165, 0x0, 1"; }];
}

View File

@@ -0,0 +1,14 @@
{ config, lib, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd.availableKernelModules = [ "nvme" "ahci" "usbhid" ];
kernelModules = [ "kvm-amd" ];
};
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,18 +1,13 @@
{ lib, modulesPath, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot = {
initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk"];
initrd.kernelModules = [];
kernelModules = ["kvm-amd"];
extraModulePackages = [];
initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
kernelModules = [ "kvm-amd" ];
};
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@@ -15,9 +15,12 @@ in
dconf.enable = true;
};
environment.sessionVariables.NIXOS_OZONE_WL = "1";
home-manager = {
extraSpecialArgs = { inherit inputs; };
backupFileExtension = "bak";
sharedModules = [{
imports = [
inputs.impermanence.nixosModules.home-manager.impermanence
@@ -43,50 +46,50 @@ in
}];
users = lib.attrsets.mapAttrs' (user: config: lib.attrsets.nameValuePair
(user)
(let
init = pkgs.pkgs.writeShellScriptBin "hyprland-init" ''
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
(user)
(let
init = pkgs.pkgs.writeShellScriptBin "hyprland-init" ''
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
while ! swww query &> /dev/null; do
sleep 0.1
done
while ! swww query &> /dev/null; do
sleep 0.1
done
${pkgs.swww}/bin/swww img ${config.wallpaper}
'';
in
{
home.persistence."/persist${config.home}" = {
directories = [
"Documents"
"Downloads"
"Music"
"Pictures"
"Videos"
"Templates"
"VMs"
"git"
".mozilla"
".local/share/zsh"
];
files = [
".local/share/sops-nix/key.txt"
];
allowOther = true;
};
${pkgs.swww}/bin/swww img ${config.wallpaper}
'';
in
{
home.persistence."/persist${config.home}" = {
directories = [
"Documents"
"Downloads"
"Music"
"Pictures"
"Videos"
"Templates"
"VMs"
"git"
".mozilla"
".local/share/zsh"
];
files = [
".local/share/sops-nix/key.txt"
];
allowOther = true;
};
programs.git = {
userName = config.fullName;
userEmail = config.email;
};
programs.git = {
userName = config.fullName;
userEmail = config.email;
};
stylix = {
image = config.wallpaper;
base16Scheme = config.base16Scheme;
};
stylix = {
image = config.wallpaper;
base16Scheme = config.base16Scheme;
};
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/hyprland-init";
})
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/hyprland-init";
})
) normalUsers;
};