nixconf/modules/nixos/core/default.nix

151 lines
4 KiB
Nix
Raw Normal View History

2024-01-15 22:30:41 +00:00
{
config,
pkgs,
lib,
2024-01-18 02:31:04 +00:00
inputs,
...
}:
let
inherit (lib) types;
cfg = config.mtxyz;
in
{
options.mtxyz = {
private = lib.mkOption {
type = types.bool;
default = false;
};
portable = lib.mkOption {
type = types.bool;
default = false;
};
graphical= lib.mkOption {
type = types.bool;
default = true;
};
minimal = lib.mkOption {
type = types.bool;
default = false;
};
};
2024-01-15 22:30:41 +00:00
config = {
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = 5;
2024-01-15 22:30:41 +00:00
boot.kernelPackages = pkgs.linuxKernel.packages.linux_zen;
2024-01-15 22:30:41 +00:00
environment.systemPackages = with pkgs; [
2024-02-19 03:30:10 +00:00
nvd nixpkgs-fmt nix-output-monitor
coreutils mime-types file
2024-03-04 23:01:26 +00:00
usbutils pciutils gitFull git-crypt
];
2024-01-15 22:30:41 +00:00
# Set your time zone.
time.timeZone = "US/Eastern";
2024-01-15 22:30:41 +00:00
console = {
font = "Lat2-Terminus16";
useXkbConfig = true; # use xkbOptions in tty.
};
2024-01-15 22:30:41 +00:00
nix = let
users = [ "root" config.mtxyz.user.name ];
in
{
gc = {
automatic = true;
options = "--delete-older-than 30d";
dates = "weekly";
};
2024-01-15 22:30:41 +00:00
settings = {
allowed-users = users;
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
http-connections = 50;
keep-derivations = true;
keep-outputs = true;
log-lines = 50;
trusted-users = users;
warn-dirty = false;
};
2024-01-18 02:31:04 +00:00
registry = {
nixpkgs.flake = inputs.nixpkgs;
2024-02-19 03:30:10 +00:00
nixconf.to = {
type = "git";
2024-02-19 05:06:22 +00:00
url = "https://git.solarpunk.moe/mtxyz/nixconf";
2024-02-19 03:30:10 +00:00
};
2024-01-18 02:31:04 +00:00
};
nixPath = [
"nixpkgs=flake:nixpkgs"
2024-02-19 03:30:10 +00:00
"nixconf=flake:nixconf"
2024-01-18 02:31:04 +00:00
];
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-bak";
2024-01-15 22:30:41 +00:00
};
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
configure = {
packages.myVimPackage = with pkgs.vimPlugins; {
start = [ vim-nix vim-lastplace vim-airline ];
opt = [];
};
customRC = ''
" custom vimrc
set nocompatible
set backspace=indent,eol,start
" Turn on syntax highlighting by default
syntax on
set mouse=a
set number
" ...
'';
};
};
# Run appimages normally
boot.binfmt.registrations.appimage = {
wrapInterpreterInShell = false;
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
magicOrExtension = ''\x7fELF....AI\x02'';
};
services.udev.packages = with pkgs; [
android-udev-rules
platformio
];
2024-01-15 22:30:41 +00:00
services.tailscale.enable = lib.mkDefault cfg.private;
services.syncthing.openDefaultPorts = lib.mkDefault cfg.private;
2024-01-15 22:30:41 +00:00
boot.binfmt.emulatedSystems = lib.optionals (!cfg.minimal) [ "aarch64-linux" "riscv64-linux" ];
2024-02-19 03:30:10 +00:00
# Inserts flake.nix shim on install.
environment.etc."nixos/flake.nix" = {
source = inputs.self + "/templates/shim/flake.nix";
mode = "0440";
};
# Disable these cuz they cause problems. see: https://github.com/NixOS/nixpkgs/issues/180175
systemd.services.NetworkManager-wait-online.enable = lib.mkForce false;
systemd.services.systemd-networkd-wait-online.enable = lib.mkForce false;
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
};
}