nixos/system/default.nix

259 lines
5.9 KiB
Nix

{
config,
lib,
pkgs,
inputs,
username,
hostName,
...
}:
{
imports = [
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
./${hostName}.nix
./hardware-configuration/${hostName}.nix
];
nix = {
enable = true;
package = pkgs.nixVersions.latest;
settings = {
trusted-users = [ username ];
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
channel.enable = true;
gc = {
automatic = true;
options = "--delete-older-than 3d";
};
optimise.automatic = true;
extraOptions = ''
keep-outputs = false
keep-derivations = false
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"steam"
"steam-unwrapped"
"steam-original"
"steam-run"
"steamcmd"
"nomachine-client"
];
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
networking = {
inherit hostName;
firewall.enable = true;
nameservers = [ "9.9.9.9" ];
};
users.users =
let
authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINI1dWlS16Keil0MGPWmMsBzx8F9ylfz+fRwxUr8/tZ/ ion"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC4M1zV3yLMMI1tYwdY9QDXJDlOBugm7UXKC+Xk89yHq pixelifytica@Vanguard"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICPypUUGVAdpl0SHrUDVw0RureuFNsljrXQvrf0uc055 pixelifytica@Northstar"
];
in
{
root.openssh = {
inherit authorizedKeys;
};
${username} = {
isNormalUser = true;
group = "users";
description = "Evie Litherland-Smith";
shell = pkgs.zsh;
extraGroups = [
"networkmanager"
"wheel"
"video"
"input"
"uinput"
"dialout"
"podman"
];
initialHashedPassword = "$y$j9T$tHIPQt09Kf3KH2eIRze3g/$2mwSlcq27DTGvHNPJ5EP9/1CfL3bXP0F6oS/Vuffmn3";
openssh = {
inherit authorizedKeys;
};
};
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.${username} = {
imports = [
./home/shell/default.nix
./home/scripts/default.nix
./home/gpg/default.nix
];
home = {
inherit username;
homeDirectory = "/home/${username}";
};
programs.home-manager.enable = true;
fonts.fontconfig = {
enable = true;
defaultFonts =
with config.stylix.fonts;
let
symbols = [
emoji.name
"Symbols Nerd Font"
];
in
{
emoji = symbols;
monospace = [ monospace.name ] ++ symbols;
sansSerif = [ sansSerif.name ] ++ symbols;
serif = [ serif.name ] ++ symbols;
};
};
};
extraSpecialArgs = {
inherit inputs;
};
};
environment = {
sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_STATE_HOME = "$HOME/.local/state";
};
systemPackages = with pkgs; [
coreutils-full
gnumake
git
file
zip
unzip
p7zip
curl
wget
dig
wireguard-tools
librespeed-cli
dust
quickemu
distrobox
];
localBinInPath = true;
};
programs = {
zsh.enable = true;
command-not-found.enable = false;
ssh.startAgent = true;
nano = {
enable = true;
syntaxHighlight = true;
nanorc = ''
set nowrap
set tabstospaces
set tabsize 2
'';
};
nix-ld = {
enable = true;
libraries = with pkgs; [
stdenv.cc.cc
glib
glibc
zlib
zstd
];
};
};
services = {
upower.enable = true;
power-profiles-daemon.enable = true;
system76-scheduler = {
enable = true;
useStockConfig = true;
};
};
security.rtkit.enable = true;
virtualisation = {
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
location = {
latitude = 51.7;
longitude = -1.2;
provider = "manual";
};
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_GB.UTF-8";
console.useXkbConfig = true;
stylix = {
enable = true;
image = ./wallpapers/default.png;
base16Scheme = lib.mkDefault "${pkgs.base16-schemes}/share/themes/onedark.yaml";
polarity = config.lib.stylix.scheme.variant;
opacity = {
applications = 1.0;
terminal = 0.8125; # 0x0.D
desktop = 0.75; # 0x0.C
popups = 0.6875; # 0x0.B
};
cursor = {
package = pkgs.volantes-cursors;
name = "volantes_cursors";
size = 32;
};
fonts =
let
fpkgs = pkgs.callPackage ./fonts.nix { };
in
{
serif = {
package = fpkgs.iosevka-custom-etoile;
name = "Iosevka Custom Etoile";
};
sansSerif = {
package = fpkgs.iosevka-custom-aile;
name = "Iosevka Custom Aile";
};
monospace = {
package = fpkgs.iosevka-custom-nerdfont;
name = "IosevkaCustom Nerd Font Propo";
};
sizes = {
applications = 12;
desktop = 14;
popups = 16;
terminal = 12;
};
};
};
fonts = {
packages = with pkgs; [
dejavu_fonts # Compatibility
liberation_ttf # Documents
lmodern # LaTeX
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
];
fontconfig = {
enable = true;
useEmbeddedBitmaps = true;
};
};
}