toaster: basic config, nixpkgs-fmt

This commit is contained in:
Grigory Shipunov 2023-01-09 23:07:46 +01:00
parent d3015fdbda
commit f690251f13
Signed by: 0xa
GPG key ID: 91FA5E5BF9AA901C
10 changed files with 259 additions and 24 deletions

View file

@ -4,6 +4,7 @@ keys:
- &cirrus age1qm70jkg7us4ft4x3nh7kwxlul022kteescjj83ywvjhysj6nsq5sw7l6p8 - &cirrus age1qm70jkg7us4ft4x3nh7kwxlul022kteescjj83ywvjhysj6nsq5sw7l6p8
- &dishwasher age1cxlskqynwl5njjm0qf363308dsjwxjq59rq7pn6ucpscpzpvry4qwtpx73 - &dishwasher age1cxlskqynwl5njjm0qf363308dsjwxjq59rq7pn6ucpscpzpvry4qwtpx73
- &nextcloud age1ds7zgenz9a664jqx5308m6q5mgtavzmelg239xsj8mdh64pmqa9qtkffmk - &nextcloud age1ds7zgenz9a664jqx5308m6q5mgtavzmelg239xsj8mdh64pmqa9qtkffmk
- &toaster age1qyj95tsntreefqeetawqy5pf26456s9c0v3tzz8yzs706c0jsg6qv56jzk
creation_rules: creation_rules:
- path_regex: secrets/microwave/[^/]+\.yaml$ - path_regex: secrets/microwave/[^/]+\.yaml$
key_groups: key_groups:
@ -29,3 +30,9 @@ creation_rules:
- *admin_oxa - *admin_oxa
age: age:
- *nextcloud - *nextcloud
- path_regex: secrets/toaster/[^/]+\.yaml$
key_groups:
- pgp:
- *admin_oxa
age:
- *toaster

View file

@ -53,7 +53,14 @@
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
sops-nix.nixosModules.sops
./hosts/toaster ./hosts/toaster
./modules/basic-tools.nix
./modules/binary-caches.nix
./modules/devtools.nix
./modules/gnupg.nix
./modules/sway.nix
./modules/tlp.nix
]; ];
}; };

47
hosts/toaster/default.nix Normal file
View file

@ -0,0 +1,47 @@
{ ... }: {
imports = [
./hardware-configuration.nix
./zfs.nix
./network.nix
];
nixpkgs.config.allowUnfree = true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties.
i18n = {
defaultLocale = "en_US.UTF-8";
supportedLocales = [ "all" ];
};
users.users.grue = {
extraGroups = [
"wheel"
"video"
"plugdev"
"dialout"
"bluetooth"
];
group = "users";
home = "/home/grue";
isNormalUser = true;
uid = 1000;
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}

View file

@ -0,0 +1,91 @@
# 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 =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "toasterpool/nixos/root";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/nix" =
{
device = "toasterpool/nixos/nix";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var" =
{
device = "toasterpool/userdata/var";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var/lib" =
{
device = "toasterpool/userdata/var/lib";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var/log" =
{
device = "toasterpool/userdata/var/log";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/home" =
{
device = "toasterpool/userdata/home";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/home/grue" =
{
device = "toasterpool/userdata/home/grue";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/7663-6239";
fsType = "vfat";
options = [ "X-mount.mkdir" ];
};
swapDevices = [
{
device = "/dev/disk/by-id/nvme-eui.ace42e002621ff2b2ee4ac0000000001-part2";
randomEncryption = true;
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
networking.interfaces.enp1s0f0.useDHCP = lib.mkDefault true;
#networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

62
hosts/toaster/network.nix Normal file
View file

@ -0,0 +1,62 @@
{ config, pkgs, ... }: {
environment.systemPackages = with pkgs; [ iwgtk ];
networking = {
hostName = "toaster";
firewall.enable = true;
networkmanager.enable = false;
useNetworkd = true;
wireguard.enable = true;
wireless.iwd.enable = true;
};
services.resolved = {
enable = true;
dnssec = "allow-downgrade";
};
# workaround for networkd waiting for shit
systemd.services.systemd-networkd-wait-online.serviceConfig.ExecStart = [
"" # clear old command
"${config.systemd.package}/lib/systemd/systemd-networkd-wait-online --any"
];
systemd.network = {
enable = true;
# wait-online.ignoredInterfaces = [ "wlan0" "enp53s0" ];
# Interfaces on the machine
netdevs."10-james" = {
netdevConfig = {
Name = "james";
Kind = "bond";
};
bondConfig = {
Mode = "active-backup";
PrimaryReselectPolicy = "always";
MIIMonitorSec = "1s";
};
};
networks."10-ether-bond" = {
matchConfig.MACAddress = "e8:80:88:2f:c6:70";
networkConfig = {
Bond = "james";
PrimarySlave = true;
};
};
networks."10-wlan-bond" = {
matchConfig.MACAddress = "04:7b:cb:2a:aa:8c";
networkConfig = {
Bond = "james";
};
};
networks."10-james-bond" = {
matchConfig.Name = "james";
networkConfig = {
DHCP = "yes";
IPv6AcceptRA = true;
};
};
};
}

19
hosts/toaster/zfs.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, pkgs, ... }: {
services.fstrim.enable = true;
services.zfs = {
autoSnapshot.enable = true;
trim.enable = true;
autoScrub = {
enable = true;
pools = [ "toasterpool" ];
};
};
networking.hostId = "dca22577";
boot = {
kernelPackages = pkgs.zfs.latestCompatibleLinuxPackages;
supportedFilesystems = [ "zfs" ];
kernelParams = [ "nohibernate" ];
plymouth.enable = false;
tmpOnTmpfs = true;
};
}

View file

@ -8,6 +8,8 @@
screen-message screen-message
qbittorrent qbittorrent
dino dino
tdesktop
signal-desktop
gajim gajim
imv imv
swayimg swayimg