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 {
|
2024-06-29 14:02:04 +02:00
|
|
|
imports = [
|
|
|
|
./nix-builders/bob.nix
|
|
|
|
./nix-builders/isvegg.nix
|
|
|
|
./nix-builders/tsuki.nix
|
|
|
|
];
|
|
|
|
|
2024-06-29 12:46:20 +02:00
|
|
|
sops.defaultSopsFile = ./../.. + "/secrets/${config.networking.hostName}.yaml";
|
2023-03-07 23:08:39 +01:00
|
|
|
|
2024-06-02 16:34:07 +02:00
|
|
|
sops.secrets = {
|
2024-06-29 12:46:20 +02:00
|
|
|
"nix/access-tokens" = { sopsFile = ./../../secrets/common.yaml; };
|
2024-06-25 20:36:03 +02:00
|
|
|
|
2024-07-08 15:02:54 +02:00
|
|
|
"ssh/secret-config" = {
|
2024-06-29 12:46:20 +02:00
|
|
|
sopsFile = ./../../secrets/common.yaml;
|
2024-06-25 20:36:03 +02:00
|
|
|
mode = "0444";
|
|
|
|
};
|
2024-06-02 16:34:07 +02:00
|
|
|
};
|
|
|
|
|
2022-04-03 18:03:55 +02:00
|
|
|
nix = {
|
2022-10-13 23:58:48 +02:00
|
|
|
package = unstable-pkgs.nixVersions.stable;
|
2024-01-23 05:33:48 +01: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;
|
2024-06-08 12:45:16 +02:00
|
|
|
experimental-features = [ "nix-command" "flakes" ];
|
2023-02-26 04:36:21 +01:00
|
|
|
log-lines = 50;
|
2022-11-26 22:50:17 +01:00
|
|
|
trusted-users = [ "h7x4" "nix-builder" ];
|
2024-06-08 12:37:01 +02:00
|
|
|
use-xdg-base-directories = true;
|
2022-11-26 22:50:17 +01:00
|
|
|
};
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2024-06-25 20:21:16 +02:00
|
|
|
extraOptions = ''
|
|
|
|
!include ${config.sops.secrets."nix/access-tokens".path}
|
|
|
|
'';
|
|
|
|
|
2024-06-02 16:32:23 +02:00
|
|
|
registry = {
|
|
|
|
home.to = {
|
|
|
|
type = "path";
|
|
|
|
path = "/home/h7x4/nix";
|
|
|
|
};
|
|
|
|
wack.to = {
|
|
|
|
type = "path";
|
|
|
|
path = "/home/h7x4/git/wack-ctf-flake";
|
|
|
|
};
|
|
|
|
nxpt.to = {
|
|
|
|
type = "path";
|
|
|
|
path = "/home/h7x4/git/nixpkgs-tools";
|
|
|
|
};
|
|
|
|
};
|
2022-06-02 16:33:21 +02:00
|
|
|
};
|
|
|
|
|
2024-06-08 12:45:43 +02:00
|
|
|
programs.nix-ld = {
|
|
|
|
enable = true;
|
|
|
|
libraries = with pkgs; [
|
|
|
|
libusb1
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2022-10-13 23:58:48 +02:00
|
|
|
programs.ssh = {
|
|
|
|
extraConfig = ''
|
2024-07-08 15:02:54 +02:00
|
|
|
Include ${config.sops.secrets."ssh/secret-config".path}
|
2022-10-13 23:58:48 +02:00
|
|
|
'';
|
2024-06-29 14:02:04 +02:00
|
|
|
|
2022-10-13 23:58:48 +02:00
|
|
|
knownHosts = {
|
2024-06-02 16:34:07 +02:00
|
|
|
bob = {
|
|
|
|
hostNames = [
|
|
|
|
"bob.pvv.ntnu.no"
|
|
|
|
"bob.pvv.org"
|
|
|
|
];
|
|
|
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGJSgh20qDIYEXiK4MUZhc879dJIyH0K/s0RZ+9wFI0F";
|
|
|
|
};
|
|
|
|
hildring = {
|
|
|
|
hostNames = [
|
|
|
|
"hildring.pvv.ntnu.no"
|
|
|
|
"hildring.pvv.org"
|
|
|
|
"login.pvv.ntnu.no"
|
|
|
|
"login.pvv.org"
|
|
|
|
];
|
|
|
|
publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU=";
|
|
|
|
};
|
|
|
|
isvegg = {
|
|
|
|
hostNames = [
|
|
|
|
"isvegg.pvv.ntnu.no"
|
|
|
|
"isvegg.pvv.org"
|
|
|
|
];
|
|
|
|
publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU=";
|
2022-10-13 23:58:48 +02:00
|
|
|
};
|
2024-06-02 16:34:07 +02:00
|
|
|
# tsukir = {
|
|
|
|
# hostNames = [ "nani.wtf" "gingakei.loginto.me" ];
|
|
|
|
# # publicKeyFile = config.sops.secrets."ssh/nix-builders/tsuki/pub".path;
|
|
|
|
# publicKeyFile = "/var/keys/tsuki_nix-builder.pub";
|
|
|
|
# };
|
2022-10-13 23:58:48 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-06-25 18:51:18 +02:00
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
2023-07-28 17:59:34 +02:00
|
|
|
|
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 = {
|
|
|
|
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 = {
|
2022-06-21 01:47:36 +02:00
|
|
|
fontDir.enable = true;
|
|
|
|
|
2024-06-02 16:36:22 +02:00
|
|
|
enableDefaultPackages = true;
|
|
|
|
packages = with pkgs; [
|
2024-06-29 14:32:38 +02:00
|
|
|
ark-pixel-font
|
2022-04-03 18:03:55 +02:00
|
|
|
cm_unicode
|
2024-06-29 14:32:38 +02:00
|
|
|
corefonts
|
2022-04-03 18:03:55 +02:00
|
|
|
dejavu_fonts
|
|
|
|
fira-code
|
|
|
|
fira-code-symbols
|
|
|
|
iosevka
|
|
|
|
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
|
2024-06-29 14:32:38 +02:00
|
|
|
powerline-fonts
|
2022-04-03 18:03:55 +02:00
|
|
|
source-han-sans
|
|
|
|
source-sans
|
2024-06-29 14:32:38 +02:00
|
|
|
symbola
|
|
|
|
texlivePackages.asana-math
|
2022-04-03 18:03:55 +02:00
|
|
|
ubuntu_font_family
|
|
|
|
victor-mono
|
2024-06-29 14:32:38 +02:00
|
|
|
yasashisa-gothic
|
2022-04-03 18:03:55 +02:00
|
|
|
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
|
|
|
|
];
|
|
|
|
|
|
|
|
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"
|
2024-06-02 16:30:31 +02:00
|
|
|
"wireshark"
|
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 21:49:49 +02:00
|
|
|
openssh = {
|
|
|
|
startWhenNeeded = true;
|
|
|
|
settings = {
|
|
|
|
StreamLocalBindUnlink = true;
|
|
|
|
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
|
2024-06-26 20:32:26 +02:00
|
|
|
light
|
2022-09-22 04:08:38 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-06-02 17:13:29 +02:00
|
|
|
libinput = {
|
|
|
|
enable = !config.machineVars.headless;
|
|
|
|
touchpad.disableWhileTyping = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
displayManager.defaultSession = "none+xmonad";
|
|
|
|
|
2022-06-12 00:07:40 +02:00
|
|
|
xserver = {
|
2023-02-25 18:05:57 +01:00
|
|
|
enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2024-06-02 17:13:29 +02:00
|
|
|
xkb = {
|
|
|
|
layout = "us";
|
|
|
|
options = "caps:escape";
|
2022-06-12 00:07:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-06-02 17:13:29 +02:00
|
|
|
displayManager.lightdm.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
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
tmux.enable = true;
|
2022-11-20 17:12:27 +01:00
|
|
|
zsh.enable = true;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2023-07-28 22:23:43 +02:00
|
|
|
gnupg.agent.enable = true;
|
2024-06-02 17:13:29 +02:00
|
|
|
gnupg.agent.pinentryPackage = pkgs.pinentry-curses;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
|
|
|
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
|
2024-07-09 11:03:17 +02:00
|
|
|
nixfmt-rfc-style
|
2022-06-21 01:47:36 +02:00
|
|
|
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
|
|
|
|
]);
|
|
|
|
|
2024-06-26 20:29:25 +02:00
|
|
|
security.rtkit.enable = !config.machineVars.headless;
|
|
|
|
services.pipewire = {
|
2022-06-21 01:47:36 +02:00
|
|
|
enable = !config.machineVars.headless;
|
2024-06-26 20:29:25 +02:00
|
|
|
alsa.enable = true;
|
|
|
|
alsa.support32Bit = true;
|
|
|
|
pulse.enable = true;
|
2022-06-12 00:07:40 +02:00
|
|
|
};
|
|
|
|
|
2024-06-02 16:29:48 +02:00
|
|
|
security.sudo.extraConfig = let
|
|
|
|
sudoLecture = pkgs.writeText "sudo-lecture.txt" (extendedLib.termColors.front.red "Be careful or something, idk...\n");
|
|
|
|
in ''
|
2022-04-03 18:03:55 +02:00
|
|
|
Defaults lecture = always
|
2024-06-02 16:29:48 +02:00
|
|
|
Defaults lecture_file = ${sudoLecture}
|
2022-04-03 18:03:55 +02:00
|
|
|
'';
|
|
|
|
}
|