Compare commits

...

15 Commits
gpu ... blas

11 changed files with 260 additions and 24 deletions

View File

@@ -53,7 +53,7 @@ inputs:
};
nixpkgs =
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
kernel.patches = [ "cjktty" "lantian" ];
kernel.patches = [ "cjktty" "lantian" "hibernate-progress" ];
networking.hostname = "pc";
sysctl.laptop-mode = 5;
};
@@ -138,11 +138,25 @@ inputs:
};
bugs = [ "xmunet" "backlight" "amdpstate" ];
};
# use plasma-x11 as default, instead of plasma-wayland
# services.xserver.displayManager.defaultSession = inputs.lib.mkForce "plasma";
virtualisation.virtualbox.host = { enable = true; enableExtensionPack = true; };
# hardware.nvidia.forceFullCompositionPipeline = true;
home-manager.users.chn.config.programs.plasma.startup.autoStartScript.xcalib.text =
"${inputs.pkgs.xcalib}/bin/xcalib -d :0 ${./color/TPLCD_161B_Default.icm}";
nixpkgs.overlays = [(final: prev: rec
{
blas = prev.blas.override { blasProvider = final.amd-blis; };
lapack = prev.lapack.override { lapackProvider = final.amd-libflame; };
})];
services.xserver.displayManager.defaultSession = inputs.lib.mkForce "plasma";
powerManagement.resumeCommands =
''
${inputs.pkgs.kmod}/bin/modprobe -r mt7921e
${inputs.pkgs.kmod}/bin/modprobe mt7921e
'';
specialisation.nvidia.configuration =
{
system.nixos.tags = [ "discreate-graphic" ];
nixos.hardware.gpu.type = inputs.lib.mkForce "nvidia";
hardware.nvidia.forceFullCompositionPipeline = true;
};
};
}

115
flake.lock generated
View File

@@ -622,6 +622,24 @@
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1698882062,
"narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_3"
},
"locked": {
"lastModified": 1701473968,
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
@@ -636,7 +654,7 @@
"type": "github"
}
},
"flake-parts_4": {
"flake-parts_5": {
"inputs": {
"nixpkgs-lib": [
"nixpak",
@@ -657,7 +675,7 @@
"type": "github"
}
},
"flake-parts_5": {
"flake-parts_6": {
"inputs": {
"nixpkgs-lib": [
"nur-linyinfeng",
@@ -970,6 +988,22 @@
"type": "github"
}
},
"lepton": {
"flake": false,
"locked": {
"lastModified": 1707757295,
"narHash": "sha256-KvwLiJFbe+YHjuEz9c/NV/eTMiQamRUQ2fAGY6piw8Y=",
"owner": "black7375",
"repo": "Firefox-UI-Fix",
"rev": "a25a08819ad36b3601a23123458edded0d849f7e",
"type": "github"
},
"original": {
"owner": "black7375",
"repo": "Firefox-UI-Fix",
"type": "github"
}
},
"linux-surface": {
"flake": false,
"locked": {
@@ -1207,6 +1241,28 @@
"type": "github"
}
},
"nix-fast-build": {
"inputs": {
"flake-parts": "flake-parts_3",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1703607026,
"narHash": "sha256-Emh0BPoqlS4ntp2UJrwydXfIP4qIMF0VBB2FUE3/M/E=",
"owner": "Mic92",
"repo": "nix-fast-build",
"rev": "4376b8a33b217ee2f78ba3dcff01a3e464d13a46",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "nix-fast-build",
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1701697642,
@@ -1282,7 +1338,7 @@
},
"nixd": {
"inputs": {
"flake-parts": "flake-parts_3",
"flake-parts": "flake-parts_4",
"nixpkgs": [
"nixpkgs"
]
@@ -1355,7 +1411,7 @@
},
"nixpak": {
"inputs": {
"flake-parts": "flake-parts_4",
"flake-parts": "flake-parts_5",
"hercules-ci-effects": "hercules-ci-effects",
"nixpkgs": [
"nixpkgs"
@@ -1426,6 +1482,24 @@
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1698611440,
"narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib_3": {
"locked": {
"dir": "lib",
"lastModified": 1701253981,
@@ -1558,14 +1632,14 @@
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_7",
"flake-parts": "flake-parts_5",
"flake-parts": "flake-parts_6",
"flake-utils": "flake-utils_8",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
],
"nvfetcher": "nvfetcher",
"treefmt-nix": "treefmt-nix_2"
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1705926964,
@@ -1854,6 +1928,7 @@
"fluent-kde": "fluent-kde",
"home-manager": "home-manager",
"impermanence": "impermanence",
"lepton": "lepton",
"linux-surface": "linux-surface",
"lmix": "lmix",
"matplotplusplus": "matplotplusplus",
@@ -1862,6 +1937,7 @@
"napalm": "napalm",
"nix-alien": "nix-alien",
"nix-doom-emacs": "nix-doom-emacs",
"nix-fast-build": "nix-fast-build",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixd": "nixd",
@@ -1923,11 +1999,11 @@
"rycee": {
"flake": false,
"locked": {
"lastModified": 1707673696,
"narHash": "sha256-3+IgVATpdUFJ33QLIuK8mIzg5rSWA/wX0IoBMfPKzWo=",
"lastModified": 1708056242,
"narHash": "sha256-HaqzfC+WhWPgm3ISCdcB/TWJ/JaE9GJ+dF2GpntkxHU=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "22f2d8e0cbb3a8490a104ca5cb7bbc8ba10d262c",
"rev": "170daec97818f490559fc8c807bcef4848fb8142",
"type": "gitlab"
},
"original": {
@@ -2211,6 +2287,27 @@
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"nix-fast-build",
"nixpkgs"
]
},
"locked": {
"lastModified": 1698438538,
"narHash": "sha256-AWxaKTDL3MtxaVTVU5lYBvSnlspOS0Fjt8GxBgnU0Do=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "5deb8dc125a9f83b65ca86cf0c8167c46593e0b1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_3": {
"inputs": {
"nixpkgs": [
"nur-linyinfeng",

View File

@@ -43,6 +43,7 @@
nur-linyinfeng = { url = "github:linyinfeng/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
nixos-hardware.url = "github:CHN-beta/nixos-hardware";
envfs = { url = "github:Mic92/envfs"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-fast-build = { url = "github:/Mic92/nix-fast-build"; inputs.nixpkgs.follows = "nixpkgs"; };
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };
@@ -64,6 +65,7 @@
blurred-wallpaper = { url = "github:bouteillerAlan/blurredwallpaper"; flake = false; };
slate = { url = "github:TheBigWazz/Slate"; flake = false; };
linux-surface = { url = "github:linux-surface/linux-surface"; flake = false; };
lepton = { url = "github:black7375/Firefox-UI-Fix"; flake = false; };
};
outputs = inputs:

View File

@@ -25,7 +25,7 @@ inputs:
let modules =
{
intel = [ "i915" ];
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" ];
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" ]; # nvidia-uvm should not be loaded
amd = [ "amdgpu" ];
};
in builtins.concatLists (builtins.map (gpu: modules.${gpu}) gpus);
@@ -57,8 +57,12 @@ inputs:
# package = inputs.config.boot.kernelPackages.nvidiaPackages.production;
};
};
boot.kernelParams = inputs.lib.mkIf (builtins.elem "amd" gpus)
[ "radeon.cik_support=0" "amdgpu.cik_support=1" "radeon.si_support=0" "amdgpu.si_support=1" "iommu=pt" ];
boot =
{
kernelParams = inputs.lib.mkIf (builtins.elem "amd" gpus)
[ "radeon.cik_support=0" "amdgpu.cik_support=1" "radeon.si_support=0" "amdgpu.si_support=1" "iommu=pt" ];
blacklistedKernelModules = [ "nouveau" ];
};
environment.variables.VDPAU_DRIVER = inputs.lib.mkIf (builtins.elem "intel" gpus) "va_gl";
services.xserver.videoDrivers =
let driver = { intel = "modesetting"; amd = "amdgpu"; nvidia = "nvidia"; };

View File

@@ -31,9 +31,9 @@ inputs:
)
];
search = { default = "Google"; force = true; };
userChrome = builtins.concatStringsSep "\n" (builtins.map
(file: builtins.readFile "${inputs.topInputs.cascade}/chrome/includes/cascade-${file}.css")
[ "config-mouse" "colours" "layout" "responsive" "floating-panel" "nav-bar" "tabs" ]);
userChrome = builtins.readFile "${inputs.topInputs.lepton}/userChrome.css";
userContent = builtins.readFile "${inputs.topInputs.lepton}/userContent.css";
extraConfig = builtins.readFile "${inputs.topInputs.lepton}/user.js";
settings =
{
# general

View File

@@ -45,7 +45,7 @@ inputs:
# networking
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
# nix tools
nix-output-monitor nix-tree ssh-to-age
nix-output-monitor nix-tree ssh-to-age (callPackage "${inputs.topInputs.nix-fast-build}" {})
# office
todo-txt-cli
# development

View File

@@ -6,7 +6,7 @@ inputs:
./fileSystems
./grub.nix
./initrd.nix
./kernel.nix
./kernel
./impermanence.nix
./gui.nix
./nixpkgs.nix

View File

@@ -121,6 +121,7 @@ inputs:
(builtins.readFile "${inputs.topInputs.linux-surface}/configs/surface-${version}.config")))))
[ "VIDEO_IPU3_IMGU" ];
in kernelPatches ++ [{ name = "surface-config"; patch = null; extraStructuredConfig = kernelConfig; }];
hibernate-progress = [{ name = "hibernate-progress"; patch = ./hibernate-progress.patch; }];
};
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
};};

View File

@@ -0,0 +1,116 @@
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index d44f5937f1e5..8905c0438b64 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -552,7 +552,7 @@ static int save_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
- pr_info("Saving image data pages (%u pages)...\n",
+ pr_err("Saving image data pages (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -567,7 +567,7 @@ static int save_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -577,7 +577,7 @@ static int save_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
return ret;
}
@@ -767,8 +767,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
*/
handle->reqd_free_pages = reqd_free_pages();
- pr_info("Using %u thread(s) for compression\n", nr_threads);
- pr_info("Compressing and saving image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for compression\n", nr_threads);
+ pr_err("Compressing and saving image data (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -789,7 +789,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
data_of(*snapshot), PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -860,7 +860,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
out_clean:
hib_finish_batch(&hb);
@@ -1071,7 +1071,7 @@ static int load_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
clean_pages_on_read = true;
- pr_info("Loading image data pages (%u pages)...\n", nr_to_read);
+ pr_err("Loading image data pages (%u pages)...\n", nr_to_read);
m = nr_to_read / 10;
if (!m)
m = 1;
@@ -1089,7 +1089,7 @@ static int load_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -1099,7 +1099,7 @@ static int load_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
snapshot_write_finalize(snapshot);
if (!snapshot_image_loaded(snapshot))
ret = -ENODATA;
@@ -1283,8 +1283,8 @@ static int load_image_lzo(struct swap_map_handle *handle,
}
want = ring_size = i;
- pr_info("Using %u thread(s) for decompression\n", nr_threads);
- pr_info("Loading and decompressing image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for decompression\n", nr_threads);
+ pr_err("Loading and decompressing image data (%u pages)...\n",
nr_to_read);
m = nr_to_read / 10;
if (!m)
@@ -1414,7 +1414,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
data[thr].unc + off, PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
@@ -1440,7 +1440,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
}
stop = ktime_get();
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
snapshot_write_finalize(snapshot);
if (!snapshot_image_loaded(snapshot))
ret = -ENODATA;

View File

@@ -17,10 +17,10 @@ inputs:
system-features = [ "big-parallel" "nixos-test" "benchmark" ];
experimental-features = [ "nix-command" "flakes" ];
keep-failed = true;
max-substitution-jobs = 1;
max-substitution-jobs = 4;
trusted-public-keys = [ "chn:Cc+nowW1LIpe1kyXOZmNaznFDiH1glXmpb4A+WD/DTE=" ];
show-trace = true;
max-jobs = 1;
max-jobs = 4;
cores = 0;
keep-going = true;
};

View File

@@ -37,7 +37,9 @@ inputs:
setSocketVariable = true;
daemon.settings = { features.buildkit = true; dns = [ "1.1.1.1" ]; storage-driver = "overlay2"; };
};
enableNvidia = inputs.lib.strings.hasInfix "nvidia" inputs.config.nixos.hardware.gpu.type;
enableNvidia =
let gpu = inputs.config.nixos.hardware.gpu.type;
in inputs.lib.mkIf (gpu != null && inputs.lib.strings.hasInfix "nvidia" gpu) true;
storageDriver = "overlay2";
};
nixos.services.firewall.trustedInterfaces = [ "docker0" ];