Skip to content

Commit

Permalink
tb14: use ideapad-thinkbook14 module
Browse files Browse the repository at this point in the history
- show-battery-percentage
- remove fixed MAC address
- change dcompass caching policy
  • Loading branch information
LEXUGE committed Dec 18, 2024
1 parent adca871 commit 2419266
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 11 deletions.
1 change: 1 addition & 0 deletions cfgs/tb14/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
bless
dnsutils
smartmontools
powertop
# Steam scaling seems to be broken, doing it manually
# (runCommand "steam-hidpi"
# {
Expand Down
36 changes: 34 additions & 2 deletions cfgs/tb14/hardware.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ modulesPath, ... }:
{
config,
modulesPath,
pkgs,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];

Expand All @@ -12,7 +17,25 @@
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
# customized ideapad-laptop module
boot.extraModulePackages =
let
sources = (import ../../pkgs/_sources/generated.nix) {
inherit (pkgs)
fetchurl
fetchgit
fetchFromGitHub
dockerTools
;
};
in
[
(config.boot.kernelPackages.callPackage ../../pkgs/drivers/ideapad-thinkbook14/default.nix {
source = sources.ideapad-thinkbook14;
})
];
boot.blacklistedKernelModules = [ "ideapad-laptop" ];
# boot.resumeDevice = "/dev/mapper/cryptswap";

hardware.enableRedistributableFirmware = true;

Expand All @@ -23,4 +46,13 @@
enable = true;
enable32Bit = true;
};

# TODO: TLP doesn't play well with GNOME. Try figure out how to do the charge threshold thing with UPower later.
# services.tlp = {
# enable = true;
# settings = {
# START_CHARGE_THRESH_BAT0 = 40; # 40 and bellow it starts to charge
# STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
# };
# };
}
5 changes: 0 additions & 5 deletions cfgs/tb14/networking.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
enable = true;
# Don't use DNS advertised by connected network. Use local configuration
dns = "none";
# Use the MAC Address same as my iPad
wifi = {
macAddress = "3c:7d:0a:be:5c:98";
scanRandMacAddress = true;
};
};

my.sing-box = {
Expand Down
2 changes: 1 addition & 1 deletion misc/dcompass_settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
// query.push_opt(ClientSubnet::new(u8(15), u8(0), IpAddr::from_str("58.220.0.0")?).to_opt_data())?;
upstreams.send_default("domestic", query).await
} else {
upstreams.send("secure", CacheMode::Disabled, query).await
upstreams.send("secure", CacheMode::Standard, query).await
}
}
'';
Expand Down
4 changes: 4 additions & 0 deletions modules/home/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ in
# Timezone and location
# "org/gnome/desktop/datetime".automatic-timezone = true;
"org/gnome/system/location".enabled = true;
# Show battery percentage
"org/gnome/desktop/interface" = {
show-battery-percentage = true;
};
} c.extraDconf
);

Expand Down
23 changes: 22 additions & 1 deletion pkgs/_sources/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@
},
"version": "c2b64540aef8260d53e15b42f16961a57486ba85"
},
"ideapad-thinkbook14": {
"cargoLocks": null,
"date": "2024-07-17",
"extract": null,
"name": "ideapad-thinkbook14",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "ty2",
"repo": "ideapad-laptop-tb2024g6plus",
"rev": "6d934407981294d05a6a4e4ed0e59d3c6c964990",
"sha256": "sha256-PzgfAxVrp4rhP6d/pQlzwIyXdi5FcoLLrqoETldGdqU=",
"sparseCheckout": [],
"type": "github"
},
"version": "6d934407981294d05a6a4e4ed0e59d3c6c964990"
},
"maxmind-geoip": {
"cargoLocks": null,
"date": null,
Expand Down Expand Up @@ -58,7 +79,7 @@
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-r0BAoJy+UHVE0kHsY0WJYAOwNoFTza0pVkEKpvkZbCI=",
"sha256": "sha256-j9noPsz3taJRN3cc8bYb+IAHcwHjzfF3uuSrcUAYHYQ=",
"type": "url",
"url": "https://upnote.sfo3.cdn.digitaloceanspaces.com/UpNote.AppImage"
},
Expand Down
14 changes: 13 additions & 1 deletion pkgs/_sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
};
date = "2024-12-16";
};
ideapad-thinkbook14 = {
pname = "ideapad-thinkbook14";
version = "6d934407981294d05a6a4e4ed0e59d3c6c964990";
src = fetchFromGitHub {
owner = "ty2";
repo = "ideapad-laptop-tb2024g6plus";
rev = "6d934407981294d05a6a4e4ed0e59d3c6c964990";
fetchSubmodules = false;
sha256 = "sha256-PzgfAxVrp4rhP6d/pQlzwIyXdi5FcoLLrqoETldGdqU=";
};
date = "2024-07-17";
};
maxmind-geoip = {
pname = "maxmind-geoip";
version = "20241212";
Expand All @@ -39,7 +51,7 @@
version = "9.7.2";
src = fetchurl {
url = "https://upnote.sfo3.cdn.digitaloceanspaces.com/UpNote.AppImage";
sha256 = "sha256-r0BAoJy+UHVE0kHsY0WJYAOwNoFTza0pVkEKpvkZbCI=";
sha256 = "sha256-j9noPsz3taJRN3cc8bYb+IAHcwHjzfF3uuSrcUAYHYQ=";
};
};
yacd = {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ let
};
ignoredPkgs = [
"proton-ge"
"ideapad-thinkbook14"
];
listPackageRecursive =
with builtins;
dir:
(lib.lists.foldr (n: col: col // n) { } (
lib.attrsets.mapAttrsToList (
Expand Down
23 changes: 23 additions & 0 deletions pkgs/drivers/ideapad-thinkbook14/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
source,
lib,
stdenv,
kernel,
}:
stdenv.mkDerivation {
inherit (source) pname version src;

passthru.moduleName = source.pname;

# hardeningDisable = [ "pic" ];

nativeBuildInputs = kernel.moduleBuildDependencies;

buildFlags = [
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
];

installPhase = ''
install -D ideapad-laptop-tb2024g6plus.ko $out/lib/modules/${kernel.modDirVersion}/misc/ideapad-laptop-tb2024g6plus.ko
'';
}
4 changes: 4 additions & 0 deletions pkgs/nvfetcher.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ fetch.tarball = "https://github.com/haishanh/yacd/releases/download/$ver/yacd.ta
fetch.url = "https://upnote.sfo3.cdn.digitaloceanspaces.com/UpNote.AppImage"
src.webpage = "https://snapcraft.io/upnote"
src.regex = "latest\\/stable (\\d+.\\d+.\\d+)"

[ideapad-thinkbook14]
src.git = "https://github.com/ty2/ideapad-laptop-tb2024g6plus"
fetch.github = "ty2/ideapad-laptop-tb2024g6plus"

0 comments on commit 2419266

Please sign in to comment.