nix-dotfiles/hosts/common/default.nix

193 lines
4.1 KiB
Nix
Raw Permalink Normal View History

{ config, pkgs, lib, extendedLib, ... }:
let
2022-08-16 03:24:06 +02:00
inherit (config) machineVars;
in {
imports = [
./fonts.nix
./nix.nix
./programs/gnupg.nix
./programs/neovim.nix
./programs/nix-ld.nix
./programs/ssh.nix
./programs/usbtop.nix
2024-08-27 14:54:16 +02:00
./services/cups.nix
./services/dbus.nix
2024-08-27 14:54:33 +02:00
./services/logrotate.nix
./services/openssh.nix
./services/pcscd.nix
./services/pipewire.nix
./services/printing.nix
./services/resolved.nix
./services/smartd.nix
./services/systemd-lock-handler.nix
./services/xserver.nix
];
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 = {
font = "Lat2-Terminus16";
keyMap = "us";
};
networking = {
useDHCP = false;
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
};
i18n.defaultLocale = "en_US.UTF-8";
environment = {
variables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
systemPackages = with pkgs; ([
wget
2022-06-22 20:16:57 +02:00
] ++ (lib.optionals (!config.machineVars.headless) [
haskellPackages.xmobar
]));
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
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
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)
(if screenArgs != null
2022-08-16 03:24:06 +02:00
then "xrandr ${screenArgs}"
else (lib.mkIf (fixDisplayCommand != null) fixDisplayCommand));
};
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"
"lp"
2023-01-16 16:06:34 +01:00
"media"
"minecraft"
"networkmanager"
"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" ];
};
};
services = {
gnome.gnome-keyring.enable = !config.machineVars.headless;
2022-09-22 04:08:38 +02:00
udev.packages = with pkgs; [
yubikey-personalization
android-udev-rules
light
2022-09-22 04:08:38 +02:00
];
libinput = {
enable = !config.machineVars.headless;
touchpad.disableWhileTyping = true;
};
2024-08-24 01:45:02 +02:00
irqbalance.enable = true;
};
programs = {
dconf.enable = !config.machineVars.headless;
git.enable = true;
tmux.enable = true;
zsh.enable = true;
2024-06-29 02:28:20 +02:00
hyprland.enable = true;
};
system.extraDependencies =
lib.optionals (config.machineVars.development) (with pkgs; [
asciidoc
asciidoctor
cabal2nix
clang
dart
dotnet-sdk
# dotnet-sdk_3
# dotnet-sdk_5
dotnetPackages.Nuget
elm2nix
elmPackages.elm
flutter
gcc
ghc
ghcid
# haskellPackages.Cabal_3_6_3_0
maven
nixfmt-rfc-style
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
]);
security.rtkit.enable = !config.machineVars.headless;
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 ''
Defaults lecture = always
2024-06-02 16:29:48 +02:00
Defaults lecture_file = ${sudoLecture}
'';
}