Extract lots of host config to common config

This commit is contained in:
Oystein Kristoffer Tveit 2022-06-12 00:07:40 +02:00
parent b3b9b5136d
commit 8e3f28bc31
4 changed files with 148 additions and 269 deletions

View File

@ -15,12 +15,41 @@ in {
keyMap = "us"; keyMap = "us";
}; };
networking = {
useDHCP = false;
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
};
nix = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
builders-use-substitutes = true builders-use-substitutes = true
''; '';
distributedBuilds = config.networking.hostname != "Tsuki";
binaryCaches = [
"https://cache.nixos.org/"
];
buildMachines = [
{
hostName = "Tsuki";
system = "x86_64-linux";
maxJobs = 1;
speedFactor = 3;
supportedFeatures = [
"nixos-test"
"benchmark"
"big-paralell"
"kvm"
];
mandatoryFeatures = [];
}
];
}; };
environment = { environment = {
@ -29,6 +58,12 @@ in {
VISUAL = "nvim"; VISUAL = "nvim";
}; };
systemPackages = with pkgs; [
wget
] + lib.optionals (!machineVars.headless) [
haskellPackages.xmobar
];
shells = with pkgs; [ shells = with pkgs; [
bashInteractive bashInteractive
zsh zsh
@ -104,6 +139,16 @@ in {
users.users.h7x4 = { users.users.h7x4 = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = [
"wheel"
"networkmanager"
"docker"
"audio"
"video"
"disk"
"libvirtd"
"input"
];
}; };
home-manager = { home-manager = {
@ -117,10 +162,106 @@ in {
}; };
}; };
services = {
tumbler.enable = !machineVars.headless;
gnome.gnome-keyring.enable = !machineVars.headless;
openssh = {
# enable = true;
passwordAuthentication = false;
kbdInteractiveAuthentication = false;
permitRootLogin = "no";
};
dbus = {
enable = !machineVars.headless;
packages = with pkgs; [
gcr
dconf
];
};
xserver = {
enable = !machineVars.headless;
layout = "us";
xkbOptions = "caps:escape";
libinput = {
enable = true;
touchpad.disableWhileTyping = true;
};
desktopManager = {
xterm.enable = false;
xfce.enable = true;
};
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
# displayManager.startx.enable = true;
# displayManager.gdm.enable = true;
displayManager.lightdm.enable = true;
displayManager.defaultSession = "none+xmonad";
};
};
programs = {
dconf.enable = !machineVars.headless;
git.enable = true;
light.enable = !machineVars.headless;
npm.enable = true;
tmux.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
configure = {
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
direnv-vim
vim-nix
vim-polyglot
];
opt = [
vim-monokai
];
};
customRC = ''
set number relativenumber
set undofile
set undodir=~/.cache/vim/undodir
packadd! vim-monokai
colorscheme monokai
'';
};
};
};
sound = {
enable = !machineVars.headless;
mediaKeys.enable = true;
};
hardware.pulseaudio.enable = !machineVars.headless;
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
Defaults lecture = always Defaults lecture = always
Defaults lecture_file = /etc/${config.environment.etc.sudoLecture.target} Defaults lecture_file = /etc/${config.environment.etc.sudoLecture.target}
''; '';
system.stateVersion = "21.11"; system.stateVersion = "22.05";
} }

View File

@ -28,7 +28,6 @@ in {
networking = { networking = {
hostName = "Eisei"; hostName = "Eisei";
networkmanager.enable = true; networkmanager.enable = true;
useDHCP = false;
interfaces = { interfaces = {
eno1.useDHCP = true; eno1.useDHCP = true;
@ -59,128 +58,20 @@ in {
services = { services = {
openssh.enable = true; openssh.enable = true;
gnome.gnome-keyring.enable = true;
printing.enable = true; printing.enable = true;
dbus = {
enable = true;
packages = with pkgs; [
gcr
gnome3.dconf
];
};
cron = { cron = {
enable = true; enable = true;
systemCronJobs = [ systemCronJobs = [
# "*/5 * * * * root date >> /tmp/cron.log" # "*/5 * * * * root date >> /tmp/cron.log"
]; ];
}; };
xserver = {
enable = true;
layout = "us";
xkbOptions = "caps:escape";
libinput = {
enable = true;
touchpad.disableWhileTyping = true;
}; };
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
};
};
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
nix = {
distributedBuilds = true;
binaryCaches = [
"https://cache.nixos.org/"
];
buildMachines = [
{
hostName = "Tsuki";
system = "x86_64-linux";
maxJobs = 1;
speedFactor = 3;
supportedFeatures = [
"nixos-test"
"benchmark"
"big-paralell"
"kvm"
];
mandatoryFeatures = [];
}
];
};
users.users.h7x4.extraGroups = [
"wheel"
"networkmanager"
"docker"
"disk"
"audio"
"video"
"libvirtd"
"input"
];
environment.systemPackages = with pkgs; [
wget
haskellPackages.xmobar
];
programs = {
dconf.enable = true;
git.enable = true;
light.enable = true;
npm.enable = true;
tmux.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
configure = {
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
direnv-vim
vim-nix
vim-polyglot
];
opt = [
vim-monokai
];
};
customRC = ''
set number relativenumber
set undofile
set undodir=~/.cache/vim/undodir
packadd! vim-monokai
colorscheme monokai
'';
};
};
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
};
virtualisation = { virtualisation = {
docker.enable = true; docker.enable = true;
libvirtd.enable = true; # libvirtd.enable = true;
}; };
} }

View File

@ -29,13 +29,8 @@
networking = { networking = {
hostName = "kasei"; hostName = "kasei";
networkmanager.enable = true; networkmanager.enable = true;
useDHCP = false;
interfaces.wlp5s0.useDHCP = true; interfaces.wlp5s0.useDHCP = true;
interfaces.wlp2s0f0u4.useDHCP = true; interfaces.wlp2s0f0u4.useDHCP = true;
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
firewall.enable = true; firewall.enable = true;
}; };
@ -54,44 +49,10 @@
# }; # };
}; };
users.users.h7x4.extraGroups = [
"wheel"
"networkmanager"
"docker"
"audio"
"video"
"disk"
"libvirtd"
"input"
];
environment = {
shellAliases = {
fixscreen = "xrandr --output DP-4 --mode 1920x1080 --pos 0x0 -r 144 --output DVI-D-1 --primary --mode 1920x1080 --pos 1920x0 -r 60";
};
systemPackages = with pkgs; [
wget
haskellPackages.xmobar
];
};
services = { services = {
openssh = { openssh.enable = true;
enable = true;
passwordAuthentication = false;
challengeResponseAuthentication = false;
permitRootLogin = "no";
};
gnome.gnome-keyring.enable = true;
printing.enable = true; printing.enable = true;
dbus = {
enable = true;
packages = with pkgs; [
gcr
gnome3.dconf
];
};
cron = { cron = {
enable = true; enable = true;
systemCronJobs = [ systemCronJobs = [
@ -99,66 +60,8 @@
]; ];
}; };
xserver = {
enable = true;
layout = "us";
xkbOptions = "caps:escape";
displayManager.lightdm.enable = true;
libinput = {
enable = true;
touchpad.disableWhileTyping = true;
};
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
};
};
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
programs = {
dconf.enable = true;
git.enable = true;
light.enable = true;
npm.enable = true;
tmux.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
configure = {
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
direnv-vim
vim-nix
vim-polyglot
];
opt = [
vim-monokai
];
};
customRC = ''
set number relativenumber
set undofile
set undodir=~/.cache/vim/undodir
packadd! vim-monokai
colorscheme monokai
'';
};
};
};
virtualisation = { virtualisation = {
docker.enable = true; docker.enable = true;
libvirtd.enable = true; libvirtd.enable = true;

View File

@ -49,22 +49,12 @@
networking = { networking = {
hostName = "Tsuki"; hostName = "Tsuki";
networkmanager.enable = true; networkmanager.enable = true;
useDHCP = false;
interfaces.ens18.useDHCP = true; interfaces.ens18.useDHCP = true;
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
firewall.enable=true; firewall.enable=true;
}; };
services = { services = {
openssh = { openssh.enable = true;
enable = true;
passwordAuthentication = false;
challengeResponseAuthentication = false;
permitRootLogin = "no";
};
printing.enable = true; printing.enable = true;
cron = { cron = {
enable = true; enable = true;
@ -77,58 +67,12 @@
users.groups.media = {}; users.groups.media = {};
users.users = { users.users = {
h7x4.extraGroups = [
"wheel"
"networkmanager"
"docker"
"disk"
"libvirtd"
"input"
];
media = { media = {
isSystemUser = true; isSystemUser = true;
group = "media"; group = "media";
}; };
}; };
environment.systemPackages = with pkgs; [
wget
];
programs = {
git.enable = true;
npm.enable = true;
tmux.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
configure = {
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
direnv-vim
vim-nix
vim-polyglot
];
opt = [
vim-monokai
];
};
customRC = ''
set number relativenumber
set undofile
set undodir=~/.cache/vim/undodir
packadd! vim-monokai
colorscheme monokai
'';
};
};
};
virtualisation = { virtualisation = {
docker.enable = true; docker.enable = true;
libvirtd.enable = true; libvirtd.enable = true;