nix/modules/system.nix

92 lines
2 KiB
Nix
Raw Normal View History

2024-10-16 14:07:58 +02:00
{ lib, pkgs, config, hostname, ... } @ args: let
2024-08-01 21:22:47 +02:00
inherit (lib) mkOption types;
cfg = config.chuj.system;
in {
options.chuj.system = {
user = mkOption {
type = types.str;
};
host = mkOption {
type = types.str;
};
platform = mkOption {
type = types.str;
};
groups = mkOption {
type = types.listOf types.str;
default = [];
};
stateVersion = mkOption {
type = types.str;
default = "23.11";
};
};
config = {
networking.hostName = cfg.host;
users.users.${cfg.user} = {
isNormalUser = true;
extraGroups = [ "wheel" ] ++ cfg.groups;
};
nixpkgs.hostPlatform = cfg.platform;
system.stateVersion = cfg.stateVersion;
time.timeZone = "Europe/Warsaw";
hardware.pulseaudio.enable = true;
2024-09-14 19:50:47 +02:00
services.pipewire.enable = false;
2024-10-16 11:40:24 +02:00
2024-08-04 15:11:52 +02:00
networking = {
nameservers = [ "9.9.9.9" ];
networkmanager = {
enable = true;
insertNameservers = [ "9.9.9.9" ];
};
2024-08-04 00:16:29 +02:00
};
2024-09-14 20:08:05 +02:00
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
2024-08-01 21:22:47 +02:00
nixpkgs.overlays = import ../pkgs args;
nixpkgs.config.allowUnfree = true;
security.sudo = {
package = pkgs.sudo.override { withInsults = true; };
extraConfig = ''
Defaults pwfeedback
'';
};
2024-10-16 14:07:58 +02:00
environment.systemPackages = with pkgs; let
nixos-rebuild = lib.getExe pkgs.nixos-rebuild;
sudo = "/run/wrappers/bin/sudo"; # is this correct
in [
2024-08-01 21:22:47 +02:00
ed # is the standard text editor.
ripgrep
file
tree
btop
wget
2024-10-16 14:07:58 +02:00
eza
2024-08-01 21:22:47 +02:00
zip
unzip
2024-08-10 01:03:29 +02:00
# rar
2024-08-01 21:22:47 +02:00
unrar
p7zip
p7zip-rar
gcc
gnumake
python311
2024-10-16 14:07:58 +02:00
(writeShellScriptBin "rebuild" ''
set -e
ulimit -n 4096 # this fixes the "too many open files" error
${sudo} ${nixos-rebuild} switch --flake ~/nix#${hostname} -v
'')
2024-08-01 21:22:47 +02:00
];
};
2024-08-04 00:16:29 +02:00
}