2024-09-26 10:23:14 +02:00
|
|
|
{ config, pkgs, lib, extendedLib, ... }:
|
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 = [
|
2024-08-12 17:36:13 +02:00
|
|
|
./fonts.nix
|
|
|
|
./nix.nix
|
|
|
|
|
|
|
|
./programs/gnupg.nix
|
|
|
|
./programs/neovim.nix
|
|
|
|
./programs/nix-ld.nix
|
|
|
|
./programs/ssh.nix
|
|
|
|
./programs/usbtop.nix
|
2024-12-02 12:07:39 +01:00
|
|
|
./programs/wireshark.nix
|
2024-08-12 17:36:13 +02:00
|
|
|
|
|
|
|
./services/dbus.nix
|
2024-12-05 10:08:52 +01:00
|
|
|
./services/fwupd.nix
|
2024-12-03 13:30:24 +01:00
|
|
|
./services/irqbalance.nix
|
2024-12-02 08:23:17 +01:00
|
|
|
./services/journald.nix
|
2024-12-03 13:32:15 +01:00
|
|
|
./services/libinput.nix
|
2024-12-04 23:00:57 +01:00
|
|
|
./services/logind.nix
|
2024-08-12 17:36:13 +02:00
|
|
|
./services/openssh.nix
|
|
|
|
./services/pcscd.nix
|
|
|
|
./services/pipewire.nix
|
|
|
|
./services/printing.nix
|
|
|
|
./services/resolved.nix
|
|
|
|
./services/smartd.nix
|
|
|
|
./services/systemd-lock-handler.nix
|
2024-12-03 13:21:59 +01:00
|
|
|
./services/thermald.nix
|
2024-12-02 08:20:57 +01:00
|
|
|
./services/uptimed.nix
|
2024-12-02 08:22:14 +01:00
|
|
|
./services/userborn.nix
|
2024-08-12 17:36:13 +02:00
|
|
|
./services/xserver.nix
|
2024-06-29 14:02:04 +02:00
|
|
|
];
|
|
|
|
|
2024-11-29 01:36:34 +01:00
|
|
|
# systemd.enableStrictShellChecks = true;
|
2024-11-18 14:28:44 +01:00
|
|
|
|
2024-06-29 12:46:20 +02:00
|
|
|
sops.defaultSopsFile = ./../.. + "/secrets/${config.networking.hostName}.yaml";
|
2023-03-07 23:08:39 +01:00
|
|
|
|
2022-06-02 16:33:21 +02:00
|
|
|
time.timeZone = "Europe/Oslo";
|
|
|
|
|
|
|
|
console = {
|
2024-12-04 20:06:57 +01:00
|
|
|
font = lib.mkDefault "Lat2-Terminus16";
|
|
|
|
keyMap = lib.mkDefault "us";
|
2022-06-02 16:33:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
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"
|
2024-08-02 17:45:15 +02:00
|
|
|
"lp"
|
2023-01-16 16:06:34 +01:00
|
|
|
"media"
|
|
|
|
"minecraft"
|
|
|
|
"networkmanager"
|
2024-12-03 13:20:09 +01:00
|
|
|
"rtkit"
|
2024-08-02 17:45:15 +02:00
|
|
|
"scanner"
|
2023-01-16 16:06:34 +01:00
|
|
|
"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
|
|
|
gnome.gnome-keyring.enable = !config.machineVars.headless;
|
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
|
|
|
];
|
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
|
|
|
};
|
|
|
|
|
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-12-03 13:20:09 +01:00
|
|
|
# Realtime scheduling for pipewire and mpd
|
2024-06-26 20:29:25 +02:00
|
|
|
security.rtkit.enable = !config.machineVars.headless;
|
2022-06-12 00:07:40 +02:00
|
|
|
|
2024-12-02 08:24:39 +01:00
|
|
|
security.tpm2.enable = lib.mkDefault true;
|
|
|
|
security.tpm2.abrmd.enable = lib.mkDefault config.security.tpm2.enable;
|
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
|
|
|
'';
|
2024-12-02 08:25:20 +01:00
|
|
|
|
2024-12-05 10:09:18 +01:00
|
|
|
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
|
|
|
|
2024-12-02 08:25:20 +01:00
|
|
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/profiles/hardened.nix
|
|
|
|
boot.blacklistedKernelModules = [
|
|
|
|
# Obscure network protocols
|
|
|
|
"ax25"
|
|
|
|
"netrom"
|
|
|
|
"rose"
|
|
|
|
|
|
|
|
# Old or rare or insufficiently audited filesystems
|
|
|
|
"adfs"
|
|
|
|
"affs"
|
|
|
|
"bfs"
|
|
|
|
"befs"
|
|
|
|
"cramfs"
|
|
|
|
"efs"
|
|
|
|
# "erofs" // used by systemd
|
|
|
|
"exofs"
|
|
|
|
"freevxfs"
|
|
|
|
"f2fs"
|
|
|
|
"hfs"
|
|
|
|
"hpfs"
|
|
|
|
"jfs"
|
|
|
|
"minix"
|
|
|
|
"nilfs2"
|
|
|
|
"ntfs"
|
|
|
|
"omfs"
|
|
|
|
"qnx4"
|
|
|
|
"qnx6"
|
|
|
|
"sysv"
|
|
|
|
"ufs"
|
|
|
|
];
|
2022-04-03 18:03:55 +02:00
|
|
|
}
|