add configuration to deploy on a PC

This commit is contained in:
sinavir 2024-01-18 18:55:22 +01:00
parent 6de155c764
commit 8b814c2e6d
9 changed files with 143 additions and 1 deletions

View file

@ -0,0 +1,8 @@
{
imports = [
./ssh.nix
./programs.nix
./nix-conf.nix
./hardware-configuration.nix
];
}

41
common-config/disko.nix Normal file
View file

@ -0,0 +1,41 @@
_:
{
disko.devices = {
disk = {
sdb = {
device = "/dev/sdb";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "500M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
end = "-4G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
swap = {
name = "swap";
size = "100%";
content = {
type = "swap";
randomEncryption = true;
};
};
};
};
};
};
};
}

View file

@ -0,0 +1,20 @@
# 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, ... }:
{
imports = [
(let sources = import ../npins; in sources.disko + "/module.nix")
./disko.nix
];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,15 @@
{
lib,
pkgs,
config,
metadata,
nodes,
name,
...
}: {
nix.settings = {
trusted-users = ["root" "@wheel"];
auto-optimise-store = true;
extra-experimental-features = ["nix-command" "flakes"];
};
}

View file

@ -0,0 +1,25 @@
{
config,
pkgs,
lib,
...
}: {
environment.systemPackages = with pkgs; [
colmena
dig
eza
git
htop
screen
tcpdump
];
environment.shellAliases = {
l = "eza -lah --git --git-repos-no-status";
};
programs.mosh.enable = !(builtins.elem config.networking.hostName []);
programs.mtr.enable = true;
programs.vim.defaultEditor = true;
}

7
common-config/ssh.nix Normal file
View file

@ -0,0 +1,7 @@
{
#users.users.root = {
# openssh.authorizedKeys.keyFiles = [./ssh.keys];
#};
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = true;
}

View file

@ -1,7 +1,8 @@
({ modulesPath, config, lib, pkgs, ... }: {
imports = [
./modules
"${modulesPath}/profiles/qemu-guest.nix"
./virtualisation.nix
./common-config
./games.nix
./retroarch
];
@ -29,9 +30,12 @@
services.xserver.displayManager.startx.enable = true;
services.xserver.libinput.enable = true;
users.mutableUsers = false;
users.users.arcade = {
isNormalUser = true;
home = "/home/arcade";
extraGroups = [ "wheel" ];
inherit (import ./opsec.nix) hashedPassword;
};
services.getty.autologinUser = "arcade";

View file

@ -1,5 +1,18 @@
{
"pins": {
"disko": {
"type": "GitRelease",
"repository": {
"type": "Git",
"url": "https://github.com/nix-community/disko"
},
"pre_releases": false,
"version_upper_bound": null,
"version": "v1.3.0",
"revision": "aef9a509db64a081186af2dc185654d78dc8e344",
"url": null,
"hash": "1lrnvgd5w41wrgidp3vwv2ahpvl0a61c2lai6qs16ri71g00kqn0"
},
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",

9
virtualisation.nix Normal file
View file

@ -0,0 +1,9 @@
{
virtualisation.vmVariant = {
# Give some fresh air to the vm
virtualisation = {
cores = 2;
memorySize = 4096;
};
};
}