Pull out more host settings to common

This commit is contained in:
Oystein Kristoffer Tveit 2022-06-02 16:33:21 +02:00
parent 00709602b3
commit e72231e80a
4 changed files with 93 additions and 93 deletions

View File

@ -1,42 +1,27 @@
{ pkgs, config, inputs, secrets, ... }:
let
inherit (pkgs) lib;
# inherit (specialArgs) machineVars;
inherit (specialArgs) machineVars;
# inherit (config) machineVars;
# has_graphics = !config.machineVars.headless;
in {
time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.UTF-8";
nixpkgs.config = {
allowUnfree = true;
};
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
networking = {
useDHCP = false;
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
};
nix = {
package = pkgs.nixFlakes;
distributedBuilds = machineVars.hostname != "Tsuki";
binaryCaches = [
"https://cache.nixos.org/"
];
extraOptions = ''
experimental-features = nix-command flakes
builders-use-substitutes = true
'';
distributedBuilds = (config.networking.hostName != "Tsuki");
binaryCaches = [
"https://cache.nixos.org/"
];
trustedUsers = [ "h7x4" ];
buildMachines = [
{
@ -53,6 +38,40 @@ in {
mandatoryFeatures = [];
}
];
# registry = {
# };
};
time.timeZone = "Europe/Oslo";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
networking = {
useDHCP = false;
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
};
i18n = {
defaultLocale = "en_US.UTF-8";
inputMethod = lib.mkIf (!machineVars.headless) {
enabled = "fcitx";
fcitx.engines = with pkgs.fcitx-engines; [ mozc ];
};
# inputMethod = {
# enabled = "fcitx5";
# fcitx5.addons = with pkgs; [
# fcitx5-mozc
# fcitx5-gtk
# ];
# };
};
environment = {
@ -73,6 +92,12 @@ in {
dash
];
systemPackages = with pkgs; [
wget
] ++ (lib.optionals (!machineVars.headless) [
haskellPackages.xmobar
]);
etc = {
# TODO: move this out of etc, and reference it directly in sudo config.
sudoLecture = {
@ -99,6 +124,18 @@ in {
in concatStringsSep "\n" sortedUnique;
};
};
shellAliases.fixDisplay = let
inherit (config.machineVars) screens headless fixDisplayCommand;
screenToArgs = screen: with screen;
"--output ${name} --mode ${resolution}"
+ (lib.optionalString (frequency != null) " --rate ${frequency}");
screenArgs = lib.concatStringsSep " " (lib.mapAttrsToList screenToArgs screens);
in lib.mkIf (!headless)
(lib.mkMerge [
"xrandr ${screenArgs}"
(lib.mkIf (fixDisplayCommand != null) fixDisplayCommand)
]);
};
fonts = {
@ -123,6 +160,7 @@ in {
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
ocr-a
open-sans
source-han-sans
source-sans
@ -142,19 +180,26 @@ in {
};
};
users.users.h7x4 = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel"
"networkmanager"
"docker"
"audio"
"video"
"disk"
"libvirtd"
"input"
];
users = {
users.h7x4 = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel"
"networkmanager"
"docker"
"disk"
"audio"
"video"
"libvirtd"
"input"
];
};
groups = {
adbusers.members = [ "h7x4" ];
};
};
home-manager = {
@ -189,7 +234,7 @@ in {
};
xserver = {
# TODO: What is going on here?
# TODO: What is going on here?
# For some reason, this leads to infinite recursion.
# This needs to be fixed!
# Same with `displayManager.lightdm.enable`
@ -268,18 +313,6 @@ in {
};
};
environment.shellAliases.fixDisplay = let
inherit (config.machineVars) screens headless fixDisplayCommand;
screenToArgs = screen: with screen;
"--output ${name} --mode ${resolution}"
+ (lib.optionalString (frequency != null) " --rate ${frequency}");
screenArgs = lib.concatStringsSep " " (lib.mapAttrsToList screenToArgs screens);
in lib.mkIf (!headless)
(lib.mkMerge [
"xrandr ${screenArgs}"
(lib.mkIf (fixDisplayCommand != null) fixDisplayCommand)
]);
system.extraDependencies =
lib.optionals (config.machineVars.development) (with pkgs; [
asciidoc

View File

@ -9,7 +9,7 @@ in {
];
# TODO: See ../common.nix
services.xserver.enable = true;
services.xserver.enable = true;
services.xserver.displayManager.lightdm.enable = true;
machineVars = {
@ -59,21 +59,6 @@ in {
# };
};
i18n = {
inputMethod = {
enabled = "fcitx";
fcitx.engines = with pkgs.fcitx-engines; [ mozc ];
};
# inputMethod = {
# enabled = "fcitx5";
# fcitx5.addons = with pkgs; [
# fcitx5-mozc
# fcitx5-gtk
# ];
# };
};
services = {
openssh.enable = true;
printing.enable = true;
@ -85,11 +70,6 @@ in {
};
};
hardware.bluetooth.enable = true;
virtualisation = {
docker.enable = true;
# libvirtd.enable = true;
};
hardware.bluetooth.enable = false;
}

View File

@ -14,7 +14,7 @@
development = true;
creative = true;
dataDrives = let
dataDrives = let
main = "/data";
in {
drives = { inherit main; };
@ -51,27 +51,16 @@
networking = {
hostName = "kasei";
networkmanager.enable = true;
interfaces.wlp5s0.useDHCP = true;
interfaces.wlp2s0f0u4.useDHCP = true;
interfaces.wlp2s0f0u7u3.useDHCP = true;
firewall.enable = true;
};
i18n = {
inputMethod = {
enabled = "fcitx";
fcitx.engines = with pkgs.fcitx-engines; [ mozc ];
environment = {
shellAliases = {
fixscreen = "xrandr --output DP-4 --mode 1920x1080 --pos 0x0 -r 144 --output DVI-D-1 --primary --mode 1920x1080 --pos 1920x0 -r 60";
};
# inputMethod = {
# enabled = "fcitx5";
# fcitx5.addons = with pkgs; [
# fcitx5-mozc
# fcitx5-gtk
# ];
# };
};
services = {
openssh.enable = true;
printing.enable = true;
@ -81,6 +70,7 @@
# "*/5 * * * * root date >> /tmp/cron.log"
];
};
};
hardware.bluetooth.enable = true;

View File

@ -29,7 +29,7 @@
machineVars = {
headless = true;
dataDrives = let
dataDrives = let
momiji = "/data2";
in {
drives = {
@ -80,11 +80,9 @@
};
};
users.groups.media = {};
users.users = {
h7x4.extraGroups = [ "media" ];
media = {
users = {
groups.media = {};
users.media = {
isSystemUser = true;
group = "media";
};
@ -92,6 +90,5 @@
virtualisation = {
docker.enable = true;
libvirtd.enable = true;
};
}