flake: use nixos-sensible

This commit is contained in:
Guanran Wang 2024-03-26 22:24:51 +08:00
parent 1d6adde578
commit 0afa535473
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
9 changed files with 23 additions and 34 deletions

View file

@ -378,6 +378,21 @@
"type": "github" "type": "github"
} }
}, },
"nixos-sensible": {
"locked": {
"lastModified": 1711449784,
"narHash": "sha256-DEMOWReMJ3gCi/0czu9hCJH716dmofhtDc2FWfbB0ew=",
"owner": "Guanran928",
"repo": "nixos-sensible",
"rev": "f278a4775e668760a6f2da5f9de6bc512f507871",
"type": "github"
},
"original": {
"owner": "Guanran928",
"repo": "nixos-sensible",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1711106783, "lastModified": 1711106783,
@ -557,6 +572,7 @@
"nix-on-droid": "nix-on-droid", "nix-on-droid": "nix-on-droid",
"nixcasks": "nixcasks", "nixcasks": "nixcasks",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixos-sensible": "nixos-sensible",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nmd": "nmd", "nmd": "nmd",

View file

@ -59,6 +59,9 @@
nixos-hardware = { nixos-hardware = {
url = "github:NixOS/nixos-hardware"; url = "github:NixOS/nixos-hardware";
}; };
nixos-sensible = {
url = "github:Guanran928/nixos-sensible";
};
nix-on-droid = { nix-on-droid = {
url = "github:nix-community/nix-on-droid/release-23.11"; url = "github:nix-community/nix-on-droid/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View file

@ -2,7 +2,6 @@
imports = [ imports = [
# OS # OS
../../nixos/profiles/laptop ../../nixos/profiles/laptop
../../nixos/profiles/common/opt-in/zram-generator.nix
../../nixos/profiles/common/opt-in/clash-meta-client ../../nixos/profiles/common/opt-in/clash-meta-client
../../nixos/profiles/common/opt-in/gaming ../../nixos/profiles/common/opt-in/gaming

View file

@ -2,6 +2,7 @@
imports = [ imports = [
inputs.nixpkgs.nixosModules.notDetected inputs.nixpkgs.nixosModules.notDetected
inputs.nixos-hardware.nixosModules.lenovo-legion-y530-15ich inputs.nixos-hardware.nixosModules.lenovo-legion-y530-15ich
inputs.nixos-sensible.nixosModules.zram
]; ];
services.hdapsd.enable = false; services.hdapsd.enable = false;

View file

@ -6,7 +6,6 @@
imports = [ imports = [
# OS # OS
../../nixos/profiles/laptop ../../nixos/profiles/laptop
../../nixos/profiles/common/opt-in/zram-generator.nix
../../nixos/profiles/common/opt-in/clash-meta-client ../../nixos/profiles/common/opt-in/clash-meta-client
# Hardware # Hardware

View file

@ -12,6 +12,7 @@
inputs.nixos-hardware.nixosModules.common-hidpi inputs.nixos-hardware.nixosModules.common-hidpi
inputs.nixos-hardware.nixosModules.common-pc-laptop inputs.nixos-hardware.nixosModules.common-pc-laptop
inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
inputs.nixos-sensible.nixosModules.zram
]; ];
myFlake.hardware.components = { myFlake.hardware.components = {

View file

@ -19,6 +19,7 @@
inputs.nur.nixosModules.nur inputs.nur.nixosModules.nur
inputs.self.nixosModules.default inputs.self.nixosModules.default
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.nixos-sensible.nixosModules.default
]; ];
nixpkgs.overlays = [ nixpkgs.overlays = [
@ -30,7 +31,6 @@
### home-manager ### home-manager
home-manager.users.guanranwang = import ../../../../home; home-manager.users.guanranwang = import ../../../../home;
users.mutableUsers = false;
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
@ -38,7 +38,6 @@
}; };
### Boot ### Boot
boot.initrd.systemd.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = lib.mkDefault true; # mkDefault for Lanzaboote boot.loader.systemd-boot.enable = lib.mkDefault true; # mkDefault for Lanzaboote
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_zen; # mkDefault for server boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_zen; # mkDefault for server
@ -61,14 +60,6 @@
usbutils usbutils
]; ];
programs.nano.enable = false;
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
defaultEditor = true; # important!
};
services.openssh = { services.openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "no"; settings.PermitRootLogin = "no";
@ -85,9 +76,6 @@
"[ 5.996722] amdgpu 0000:67:00.0: Fatal error during GPU init"} "[ 5.996722] amdgpu 0000:67:00.0: Fatal error during GPU init"}
''; '';
# https://archlinux.org/news/making-dbus-broker-our-default-d-bus-daemon/
services.dbus.implementation = "broker";
### WORKAROUND: Use NVIDIA beta version 550.40.07 due to performance issues introduced in version 545.29.06, ### WORKAROUND: Use NVIDIA beta version 550.40.07 due to performance issues introduced in version 545.29.06,
# this shouldn't affect non-nvidia machines. # this shouldn't affect non-nvidia machines.
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta; hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;

View file

@ -1,3 +1,4 @@
# ref: https://github.com/Misterio77/nix-config/blob/main/hosts/common/global/nix.nix
{ {
pkgs, pkgs,
inputs, inputs,
@ -11,12 +12,10 @@
nix.channel.enable = false; nix.channel.enable = false;
# Disable flake-registry # Disable flake-registry
# https://nixos-and-flakes.thiscute.world/best-practices/nix-path-and-flake-registry
nix.settings.flake-registry = ""; nix.settings.flake-registry = "";
# Add each flake input as a registry # Add each flake input as a registry
# To make nix3 commands consistent with the flake # To make nix3 commands consistent with the flake
# https://github.com/Misterio77/nix-config/blob/main/hosts/common/global/nix.nix
nix.registry = lib.mapAttrs (_: value: {flake = value;}) inputs; nix.registry = lib.mapAttrs (_: value: {flake = value;}) inputs;
# Install Git # Install Git

View file

@ -1,17 +0,0 @@
{
services.zram-generator = {
enable = true;
settings.zram0 = {
compression-algorithm = "zstd";
zram-size = "ram";
};
};
# https://wiki.archlinux.org/title/Zram#Optimizing_swap_on_zram
boot.kernel.sysctl = {
"vm.swappiness" = 180;
"vm.watermark_boost_factor" = 0;
"vm.watermark_scale_factor" = 125;
"vm.page-cluster" = 0;
};
}