nixos-configs/nixos/default.nix

206 lines
4.5 KiB
Nix
Raw Normal View History

2024-10-26 18:33:47 +00:00
{
pkgs,
config,
lib,
inputs,
2024-11-11 19:43:36 +00:00
self,
2024-12-01 00:03:21 +00:00
name,
2024-10-26 18:33:47 +00:00
...
}: {
2024-10-26 18:24:13 +00:00
imports = [
inputs.home-manager.nixosModules.home-manager
inputs.nixos-facter-modules.nixosModules.facter
2024-11-07 19:47:40 +00:00
inputs.disko.nixosModules.disko
2024-11-17 20:04:03 +00:00
inputs.sops-nix.nixosModules.sops
2024-12-01 13:33:24 +00:00
inputs.nix-snapshotter.nixosModules.nix-snapshotter
2024-10-26 18:24:13 +00:00
./lanzaboote.nix
./tidal.nix
./stylix.nix
./wireguard.nix
./gnome.nix
./compliance.nix
2024-11-07 19:47:40 +00:00
./cinnamon.nix
2024-11-09 15:54:33 +00:00
./ssh.nix
2024-11-19 21:08:41 +00:00
./desktop.nix
2024-11-30 21:48:30 +00:00
./server.nix
./prometheus.nix
2024-12-01 14:05:01 +00:00
./kubernetes
2024-10-26 18:24:13 +00:00
];
options = {
2024-12-01 00:03:21 +00:00
pim.sops-nix = {
colmenaSopsFile = lib.mkOption {
type = lib.types.path;
default = "${self}/secrets/${name}/colmena.yaml";
};
usersWithSopsKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
};
};
};
config = {
time.timeZone = "Europe/Amsterdam";
hardware.pulseaudio.enable = false;
2024-11-30 21:48:30 +00:00
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = let
extraLocale = "nl_NL.UTF-8";
in {
LC_ADDRESS = extraLocale;
LC_IDENTIFICATION = extraLocale;
LC_MEASUREMENT = extraLocale;
LC_MONETARY = extraLocale;
LC_NAME = extraLocale;
LC_NUMERIC = extraLocale;
LC_PAPER = extraLocale;
LC_TELEPHONE = extraLocale;
LC_TIME = extraLocale;
};
};
2024-12-01 00:03:21 +00:00
deployment.keys = lib.pipe config.pim.sops-nix.usersWithSopsKeys [
(lib.map (
user: let
homeDirectory =
if user == "root"
then "/root"
else "/home/${user}";
sopsFile = config.pim.sops-nix.colmenaSopsFile;
in {
name = "${user}-sops-age";
value = {
keyCommand = ["nix" "run" "nixpkgs#sops" "--" "--extract" "[\"sops_nix_keys\"][\"${user}\"]" "-d" (builtins.toString sopsFile)];
name = "keys.txt";
destDir = "${homeDirectory}/.config/sops/age";
inherit user;
group = "users";
};
}
))
builtins.listToAttrs
];
systemd = {
services.NetworkManager-wait-online.enable = lib.mkForce false;
network.wait-online.enable = lib.mkForce false;
};
services = {
2024-11-19 21:08:41 +00:00
xserver.excludePackages = [pkgs.xterm];
printing.drivers = [pkgs.hplip pkgs.gutenprint];
2024-11-30 12:14:46 +00:00
tailscale.enable = true;
pipewire = {
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
2024-11-11 20:00:51 +00:00
};
environment = {
systemPackages = with pkgs; [
age
btop
btrfs-progs
curl
dig
exfat
f3
fastfetch
file
git
jq
ripgrep
sbctl
tree
vim
wget
yq
ncdu
lshw
sops
];
2024-10-26 18:24:13 +00:00
};
2024-11-30 12:14:46 +00:00
system.activationScripts.diff = ''
if [[ -e /run/current-system ]]; then
${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig"
fi
'';
2024-10-26 18:24:13 +00:00
security = {
rtkit.enable = true;
2024-10-26 18:24:13 +00:00
sudo.extraConfig = ''
Defaults timestamp_timeout=30
'';
2024-10-26 18:24:13 +00:00
};
nix = {
2024-11-30 12:14:46 +00:00
package = pkgs.nixVersions.stable;
2024-10-26 18:24:13 +00:00
extraOptions = ''
experimental-features = nix-command flakes
'';
2024-10-26 18:24:13 +00:00
gc = {
automatic = true;
persistent = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
2024-10-26 18:24:13 +00:00
};
networking = {
useDHCP = lib.mkDefault true;
networkmanager.unmanaged = lib.mkIf config.services.tailscale.enable ["tailscale0"];
wireless.extraConfig = ''
p2p_disabled=1
'';
};
2024-10-26 18:24:13 +00:00
nixpkgs = {
2024-11-30 21:48:30 +00:00
# hostPlatform = lib.mkDefault "x86_64-linux";
config = {
allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"libfprint-2-tod1-goodix"
"steam"
"steam-original"
"steam-run"
2024-11-30 12:14:46 +00:00
"steam-unwrapped"
];
};
overlays = [
inputs.nur.overlay
(final: _prev: {
unstable = import inputs.nixpkgs-unstable {
inherit (pkgs) system;
config.allowUnfree = true;
};
})
];
2024-10-26 18:24:13 +00:00
};
boot.kernel.sysctl = {
2024-10-26 18:24:13 +00:00
"net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr";
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {inherit self inputs;};
sharedModules = ["${self}/home-manager"];
};
2024-10-26 18:24:13 +00:00
};
}