2022-11-19 16:14:18 +01:00
|
|
|
{ pkgs, unstable-pkgs, lib, extendedLib, config, inputs, secrets, ... }:
|
2022-04-03 18:03:55 +02:00
|
|
|
let
|
2022-08-16 03:24:06 +02:00
|
|
|
inherit (config) machineVars;
|
2022-04-03 18:03:55 +02:00
|
|
|
in {
|
2022-06-21 01:47:36 +02:00
|
|
|
nixpkgs.config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
};
|
2022-04-03 18:03:55 +02:00
|
|
|
|
2023-03-07 23:08:39 +01:00
|
|
|
sops.defaultSopsFile = ../secrets/default.yaml;
|
|
|
|
|
2022-04-03 18:03:55 +02:00
|
|
|
nix = {
|
2022-10-13 23:58:48 +02:00
|
|
|
package = unstable-pkgs.nixVersions.stable;
|
2022-08-16 03:24:06 +02:00
|
|
|
distributedBuilds = config.networking.hostName != "Tsuki";
|
2022-06-02 16:33:21 +02:00
|
|
|
|
2022-11-26 22:50:17 +01:00
|
|
|
settings = {
|
2023-02-26 04:36:21 +01:00
|
|
|
allow-dirty = true;
|
|
|
|
allowed-uris = [ "http://" "https://" ];
|
|
|
|
auto-optimise-store = true;
|
|
|
|
binary-caches = [ "https://cache.nixos.org/" ];
|
|
|
|
builders-use-substitutes = true;
|
|
|
|
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
|
|
|
|
log-lines = 50;
|
2022-11-26 22:50:17 +01:00
|
|
|
trusted-users = [ "h7x4" "nix-builder" ];
|
|
|
|
};
|
2022-06-12 00:07:40 +02:00
|
|
|
|
|
|
|
buildMachines = [
|
|
|
|
{
|
2022-10-13 23:58:48 +02:00
|
|
|
# Login details configured in ssh module in nix-secrets
|
|
|
|
hostName = "nix-builder-tsukir";
|
2022-06-12 00:07:40 +02:00
|
|
|
system = "x86_64-linux";
|
2022-10-13 23:58:48 +02:00
|
|
|
speedFactor = 5;
|
|
|
|
maxJobs = 8;
|
2022-06-12 00:07:40 +02:00
|
|
|
supportedFeatures = [
|
|
|
|
"nixos-test"
|
|
|
|
"benchmark"
|
|
|
|
"big-paralell"
|
|
|
|
];
|
|
|
|
mandatoryFeatures = [];
|
2023-07-28 17:59:34 +02:00
|
|
|
sshUser = "nix-ssh";
|
2022-10-13 23:58:48 +02:00
|
|
|
sshKey = secrets.keys.ssh.nixBuilders.tsuki.private;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# Login details configured in ssh module in nix-secrets
|
|
|
|
hostName = "nix-builder-isvegg";
|
|
|
|
system = "x86_64-linux";
|
|
|
|
speedFactor = 7;
|
|
|
|
maxJobs = 16;
|
|
|
|
supportedFeatures = [
|
|
|
|
"benchmark"
|
|
|
|
"big-paralell"
|
|
|
|
];
|
|
|
|
mandatoryFeatures = [];
|
|
|
|
sshUser = secrets.ssh.users.pvv.normalUser;
|
|
|
|
sshKey = secrets.keys.ssh.nixBuilders.isvegg.private;
|
2022-06-12 00:07:40 +02:00
|
|
|
}
|
|
|
|
];
|
2022-06-02 16:33:21 +02:00
|
|
|
# registry = {
|
|
|
|
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
|
2022-10-13 23:58:48 +02:00
|
|
|
programs.ssh = {
|
|
|
|
extraConfig = ''
|
|
|
|
Host nix-builder-isvegg
|
|
|
|
HostName isvegg.pvv.ntnu.no
|
|
|
|
|
|
|
|
Host nix-builder-tsukir
|
2022-11-19 16:16:05 +01:00
|
|
|
HostName gingakei.loginto.me
|
2022-10-13 23:58:48 +02:00
|
|
|
Port ${toString secrets.ports.ssh.home-in}
|
|
|
|
'';
|
|
|
|
knownHosts = {
|
|
|
|
tsukir = {
|
|
|
|
hostNames = [ "nani.wtf" "gingakei.loginto.me" ];
|
|
|
|
publicKeyFile = secrets.keys.ssh.nixBuilders.tsuki.public;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-06-02 16:33:21 +02:00
|
|
|
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) {
|
2023-07-28 17:59:34 +02:00
|
|
|
# enabled = "fcitx";
|
|
|
|
# engines = with pkgs.fcitx-engines; [ mozc ];
|
2022-11-20 18:32:03 +01:00
|
|
|
enabled = "fcitx5";
|
|
|
|
fcitx5.addons = with pkgs; [
|
|
|
|
fcitx5-mozc
|
2023-07-28 17:59:34 +02:00
|
|
|
# fcitx5-gtk
|
|
|
|
# fcitx5-chinese-addons
|
2022-11-20 18:32:03 +01:00
|
|
|
];
|
2022-06-02 16:33:21 +02:00
|
|
|
};
|
2022-04-03 18:03:55 +02:00
|
|
|
};
|
|
|
|
|
2023-07-28 17:59:34 +02:00
|
|
|
systemd.user.services."fcitx5" = lib.mkIf (config.i18n.inputMethod.enabled == "fcitx5") {
|
|
|
|
description = "Fcitx5 IME";
|
|
|
|
wantedBy = [ "graphical.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
ExecStart = "${config.i18n.inputMethod.package}/bin/fcitx5";
|
|
|
|
ExecReload = "/bin/kill -HUP $MAINPID";
|
|
|
|
Restart="on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-04-03 18:03:55 +02:00
|
|
|
environment = {
|
|
|
|
variables = {
|
|
|
|
EDITOR = "nvim";
|
|
|
|
VISUAL = "nvim";
|
|
|
|
};
|
|
|
|
|
2022-06-21 01:47:36 +02:00
|
|
|
systemPackages = with pkgs; ([
|
2022-06-12 00:07:40 +02:00
|
|
|
wget
|
2022-06-22 20:16:57 +02:00
|
|
|
] ++ (lib.optionals (!config.machineVars.headless) [
|
2022-06-12 00:07:40 +02:00
|
|
|
haskellPackages.xmobar
|
2022-06-21 01:47:36 +02:00
|
|
|
]));
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2022-04-03 18:03:55 +02:00
|
|
|
shells = with pkgs; [
|
|
|
|
bashInteractive
|
|
|
|
zsh
|
|
|
|
dash
|
|
|
|
];
|
|
|
|
|
|
|
|
etc = {
|
|
|
|
# TODO: move this out of etc, and reference it directly in sudo config.
|
|
|
|
sudoLecture = {
|
|
|
|
target = "sudo.lecture";
|
2022-11-19 16:14:18 +01:00
|
|
|
text = extendedLib.termColors.front.red "Be careful or something, idk...\n";
|
2022-04-03 18:03:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
currentSystemPackages = {
|
|
|
|
target = "current-system-packages";
|
|
|
|
text = let
|
|
|
|
inherit (lib.strings) concatStringsSep;
|
|
|
|
inherit (lib.lists) sort;
|
|
|
|
inherit (lib.trivial) lessThan;
|
|
|
|
packages = map (p: "${p.name}") config.environment.systemPackages;
|
|
|
|
sortedUnique = sort lessThan (lib.unique packages);
|
|
|
|
in concatStringsSep "\n" sortedUnique;
|
|
|
|
};
|
|
|
|
};
|
2022-06-02 16:33:21 +02:00
|
|
|
|
2022-11-20 17:12:27 +01:00
|
|
|
shellAliases.fixdisplay = let
|
2022-06-02 16:33:21 +02:00
|
|
|
inherit (config.machineVars) screens headless fixDisplayCommand;
|
2022-08-16 03:24:06 +02:00
|
|
|
|
2022-11-20 17:12:27 +01:00
|
|
|
screenToArgs = name: screen: with screen;
|
|
|
|
"--output ${name} --mode ${resolution} --rate ${toString frequency} --pos ${position}"
|
|
|
|
+ (lib.optionalString primary " --primary");
|
2022-08-16 03:24:06 +02:00
|
|
|
|
2022-06-02 16:33:21 +02:00
|
|
|
screenArgs = lib.concatStringsSep " " (lib.mapAttrsToList screenToArgs screens);
|
2022-08-16 03:24:06 +02:00
|
|
|
|
2022-06-02 16:33:21 +02:00
|
|
|
in lib.mkIf (!headless)
|
2022-11-20 17:12:27 +01:00
|
|
|
(if screenArgs != null
|
2022-08-16 03:24:06 +02:00
|
|
|
then "xrandr ${screenArgs}"
|
|
|
|
else (lib.mkIf (fixDisplayCommand != null) fixDisplayCommand));
|
2022-04-03 18:03:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
fonts = {
|
|
|
|
enableDefaultFonts = true;
|
|
|
|
|
2022-06-21 01:47:36 +02:00
|
|
|
fontDir.enable = true;
|
|
|
|
|
2022-04-03 18:03:55 +02:00
|
|
|
fonts = with pkgs; [
|
|
|
|
cm_unicode
|
|
|
|
dejavu_fonts
|
|
|
|
fira-code
|
|
|
|
fira-code-symbols
|
|
|
|
powerline-fonts
|
|
|
|
iosevka
|
|
|
|
symbola
|
|
|
|
corefonts
|
|
|
|
ipaexfont
|
|
|
|
ipafont
|
|
|
|
liberation_ttf
|
|
|
|
migmix
|
|
|
|
noto-fonts
|
2022-06-12 00:23:10 +02:00
|
|
|
noto-fonts-cjk-sans
|
|
|
|
noto-fonts-cjk-serif
|
2022-04-03 18:03:55 +02:00
|
|
|
noto-fonts-emoji
|
2022-06-02 16:33:21 +02:00
|
|
|
ocr-a
|
2022-04-03 18:03:55 +02:00
|
|
|
open-sans
|
|
|
|
source-han-sans
|
|
|
|
source-sans
|
|
|
|
ubuntu_font_family
|
|
|
|
victor-mono
|
|
|
|
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
|
|
|
|
inputs.fonts
|
|
|
|
];
|
|
|
|
|
|
|
|
fontconfig = {
|
|
|
|
defaultFonts = {
|
|
|
|
serif = [ "Droid Sans Serif" "Ubuntu" ];
|
|
|
|
sansSerif = [ "Droid Sans" "Ubuntu" ];
|
|
|
|
monospace = [ "Fira Code" "Ubuntu" ];
|
|
|
|
emoji = [ "Noto Sans Emoji" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-06-02 16:33:21 +02:00
|
|
|
users = {
|
|
|
|
users.h7x4 = {
|
|
|
|
isNormalUser = true;
|
|
|
|
shell = pkgs.zsh;
|
|
|
|
|
|
|
|
extraGroups = [
|
|
|
|
"audio"
|
2023-01-16 16:06:34 +01:00
|
|
|
"disk"
|
|
|
|
"docker"
|
2022-06-02 16:33:21 +02:00
|
|
|
"input"
|
2023-01-16 16:06:34 +01:00
|
|
|
"libvirtd"
|
|
|
|
"media"
|
|
|
|
"minecraft"
|
|
|
|
"networkmanager"
|
|
|
|
"video"
|
|
|
|
"wheel"
|
2022-06-02 16:33:21 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
groups = {
|
|
|
|
adbusers.members = [ "h7x4" ];
|
|
|
|
};
|
2022-04-03 18:03:55 +02:00
|
|
|
};
|
|
|
|
|
2022-06-12 00:07:40 +02:00
|
|
|
services = {
|
2022-06-21 01:47:36 +02:00
|
|
|
tumbler.enable = !config.machineVars.headless;
|
|
|
|
gnome.gnome-keyring.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2023-01-20 19:53:08 +01:00
|
|
|
resolved.enable = true;
|
|
|
|
|
2023-07-28 17:59:34 +02:00
|
|
|
openssh= {
|
|
|
|
passwordAuthentication = false;
|
|
|
|
kbdInteractiveAuthentication = false;
|
|
|
|
permitRootLogin = "no";
|
2022-06-12 00:07:40 +02:00
|
|
|
};
|
|
|
|
|
2022-09-22 04:08:38 +02:00
|
|
|
udev.packages = with pkgs; [
|
|
|
|
yubikey-personalization
|
|
|
|
android-udev-rules
|
|
|
|
];
|
|
|
|
|
|
|
|
pcscd.enable = true;
|
|
|
|
|
2022-06-12 00:07:40 +02:00
|
|
|
dbus = {
|
2023-02-25 18:05:57 +01:00
|
|
|
enable = true;
|
2022-06-12 00:07:40 +02:00
|
|
|
packages = with pkgs; [
|
|
|
|
gcr
|
|
|
|
dconf
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
xserver = {
|
2023-02-25 18:05:57 +01:00
|
|
|
enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
layout = "us";
|
|
|
|
xkbOptions = "caps:escape";
|
|
|
|
|
|
|
|
libinput = {
|
|
|
|
enable = true;
|
|
|
|
touchpad.disableWhileTyping = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
desktopManager = {
|
|
|
|
xterm.enable = false;
|
2023-05-08 02:29:38 +02:00
|
|
|
xfce.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
windowManager.xmonad = {
|
|
|
|
enable = true;
|
|
|
|
enableContribAndExtras = true;
|
2022-08-19 03:49:21 +02:00
|
|
|
enableConfiguredRecompile = true;
|
|
|
|
extraPackages = hPkgs: with hPkgs; [
|
|
|
|
dbus
|
|
|
|
];
|
2022-06-12 00:07:40 +02:00
|
|
|
};
|
|
|
|
|
2023-05-08 02:29:38 +02:00
|
|
|
displayManager.lightdm.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
displayManager.defaultSession = "none+xmonad";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
programs = {
|
2022-06-21 01:47:36 +02:00
|
|
|
dconf.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
git.enable = true;
|
2022-06-21 01:47:36 +02:00
|
|
|
light.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
npm.enable = true;
|
|
|
|
tmux.enable = true;
|
2022-11-20 17:12:27 +01:00
|
|
|
zsh.enable = true;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-06-21 01:47:36 +02:00
|
|
|
system.extraDependencies =
|
|
|
|
lib.optionals (config.machineVars.development) (with pkgs; [
|
|
|
|
asciidoc
|
|
|
|
asciidoctor
|
|
|
|
cabal2nix
|
|
|
|
clang
|
|
|
|
dart
|
|
|
|
dotnet-sdk
|
2023-07-28 17:59:34 +02:00
|
|
|
# dotnet-sdk_3
|
|
|
|
# dotnet-sdk_5
|
2022-06-21 01:47:36 +02:00
|
|
|
dotnetPackages.Nuget
|
|
|
|
elm2nix
|
|
|
|
elmPackages.elm
|
|
|
|
flutter
|
|
|
|
gcc
|
|
|
|
ghc
|
|
|
|
ghcid
|
2023-07-28 17:59:34 +02:00
|
|
|
# haskellPackages.Cabal_3_6_3_0
|
2022-06-21 01:47:36 +02:00
|
|
|
maven
|
|
|
|
nixfmt
|
|
|
|
nixpkgs-fmt
|
|
|
|
# nixpkgs-hammering
|
|
|
|
nodePackages.node2nix
|
|
|
|
nodePackages.npm
|
|
|
|
nodePackages.sass
|
|
|
|
nodePackages.typescript
|
|
|
|
nodePackages.yarn
|
|
|
|
nodejs
|
|
|
|
plantuml
|
|
|
|
python3
|
|
|
|
rustc
|
|
|
|
rustc
|
|
|
|
rustup
|
|
|
|
sqlcheck
|
|
|
|
sqlint
|
|
|
|
sqlite
|
|
|
|
sqlite-web
|
|
|
|
]);
|
|
|
|
|
2022-06-12 00:07:40 +02:00
|
|
|
sound = {
|
2022-06-21 01:47:36 +02:00
|
|
|
enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
mediaKeys.enable = true;
|
|
|
|
};
|
|
|
|
|
2022-06-21 01:47:36 +02:00
|
|
|
hardware.pulseaudio.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2022-04-03 18:03:55 +02:00
|
|
|
security.sudo.extraConfig = ''
|
|
|
|
Defaults lecture = always
|
|
|
|
Defaults lecture_file = /etc/${config.environment.etc.sudoLecture.target}
|
|
|
|
'';
|
2022-06-12 00:07:40 +02:00
|
|
|
|
|
|
|
system.stateVersion = "22.05";
|
2022-04-03 18:03:55 +02:00
|
|
|
}
|