nix/nixos/default.nix
2025-03-03 22:54:32 -06:00

127 lines
3.1 KiB
Nix

{
inputs,
lib,
config,
pkgs,
system,
...
}: {
imports = [
./1password.nix
./displaymanager.nix
./keyd.nix
];
# nixpkgs = {
# # You can add overlays here
# overlays = [
# # If you want to use overlays exported from other flakes:
# # neovim-nightly-overlay.overlays.default
#
# # Or define it inline, for example:
# # (final: prev: {
# # hi = final.hello.overrideAttrs (oldAttrs: {
# # patches = [ ./change-hello-to-hi.patch ];
# # });
# # })
# ];
# # Configure your nixpkgs instance
# config = {
# # Disable if you don't want unfree packages
# allowUnfree = true;
# };
# };
nix = let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in {
settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Opinionated: disable global registry
flake-registry = "";
# Workaround for https://github.com/NixOS/nix/issues/9574
nix-path = config.nix.nixPath;
};
# Opinionated: disable channels
channel.enable = false;
# Opinionated: make flake registry and nix path match flake inputs
registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
# networking
networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName);
networking.networkmanager.enable = true;
programs.dconf.enable = true;
services.pulseaudio.enable = false;
services.libinput = {
enable = true;
touchpad = {
disableWhileTyping = true;
naturalScrolling = true;
};
};
# bluetooth
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
# pipewire
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
# disable camera to save battery
# https://reddit.com/r/linux/comments/1em8biv/psa_pipewire_has_been_halving_your_battery_life/
wireplumber = {
enable = true;
extraConfig = {
"10-disable-camera" = {
"wireplumber.profiles" = {
main."monitor.libcamera" = "disabled";
};
};
"10-bluez" = {
"monitor.bluez.properties" = {
"bluez5.enable-sbc-xq" = true;
"bluez5.enable-msbc" = true;
"bluez5.enable-hw-volume" = true;
"bluez5.roles" = [
"hsp_hs"
"hsp_ag"
"hfp_hf"
"hfp_ag"
];
};
};
};
};
};
services.openssh = {
enable = true;
settings = {
# Opinionated: forbid root login through SSH.
PermitRootLogin = "no";
# Opinionated: use keys only.
# Remove if you want to SSH using passwords
PasswordAuthentication = false;
};
};
environment.systemPackages = with pkgs; [
vim
htop
pwvucontrol
];
}