Merge branch 'native-rog' into edge

This commit is contained in:
2025-09-21 08:20:15 +08:00
8 changed files with 35 additions and 43 deletions

View File

@@ -5,7 +5,7 @@
let pkgs = import inputs.nixpkgs (localLib.buildNixpkgsConfig
{
inputs = { inherit (inputs.nixpkgs) lib; topInputs = inputs; };
nixpkgs = { march = "haswell"; cuda = null; nixRoot = "/data/gpfs01/jykang/.nix"; nixos = false; };
nixpkgs = { march = "haswell"; nixRoot = "/data/gpfs01/jykang/.nix"; nixos = false; };
});
in pkgs.symlinkJoin
{

View File

@@ -30,11 +30,11 @@ inputs:
# SERIALIZE SGX WAITPKG WIDEKL XSAVE XSAVEOPT
"alderlake"
];
# nixpkgs.march = "znver4";
nixpkgs = { march = "znver5"; rocm = false; };
sysctl.laptop-mode = 5;
kernel.variant = "xanmod-latest";
};
hardware = { gpu.type = "amd"; cpu = "amd"; asus = {};};
hardware = { gpu.type = "amd"; asus = {};};
services =
{
samba =
@@ -85,7 +85,7 @@ inputs:
lumericalLicenseManager.macAddress = "10:5f:ad:10:3e:ca";
};
bugs = [ "xmunet" "amdpstate" "iwlwifi" ];
# packages = { mathematica = {}; vasp = {}; lumerical = {}; };
packages = { mathematica = {}; vasp = {}; lumerical = {}; };
user.users = [ "chn" "xly" ];
};
# 允许kvm读取物理硬盘

View File

@@ -3,7 +3,7 @@ let
pkgs = import inputs.nixpkgs (localLib.buildNixpkgsConfig
{
inputs = { inherit (inputs.nixpkgs) lib; topInputs = inputs; };
nixpkgs = { march = null; cuda = null; nixRoot = "/public/home/xmuhk/.nix"; nixos = false; };
nixpkgs = { march = null; nixRoot = "/public/home/xmuhk/.nix"; nixos = false; };
});
lumericalLicenseManager =
let

View File

@@ -1,4 +1,4 @@
# inputs = { lib, topInputs, ...}; nixpkgs = { march, cuda, nixRoot, nixos, arch };
# inputs = { lib, topInputs, ...}; nixpkgs = { march, cuda, nixRoot, nixos, arch, rocm };
{ inputs, nixpkgs }:
let
platformConfig =
@@ -8,7 +8,7 @@ let
${if nixpkgs.nixos then "hostPlatform" else "localSystem"} =
{ system = "${nixpkgs.arch or "x86_64"}-linux"; gcc = { arch = nixpkgs.march; tune = nixpkgs.march; }; };
};
cudaConfig = inputs.lib.optionalAttrs (nixpkgs.cuda != null)
cudaConfig = inputs.lib.optionalAttrs (nixpkgs.cuda or null != null)
(
{ cudaSupport = true; }
// (inputs.lib.optionalAttrs (nixpkgs.cuda.capabilities != null)
@@ -16,8 +16,9 @@ let
// (inputs.lib.optionalAttrs (nixpkgs.cuda.forwardCompat != null)
{ cudaForwardCompat = nixpkgs.cuda.forwardCompat; })
);
rocmConfig = inputs.lib.optionalAttrs (nixpkgs.rocm or false) { rocmSupport = true; };
allowInsecurePredicate = p: inputs.lib.warn "Allowing insecure package ${p.name or "${p.pname}-${p.version}"}" true;
config = cudaConfig
config = cudaConfig // rocmConfig
// {
inherit allowInsecurePredicate;
allowUnfree = true;
@@ -26,11 +27,11 @@ let
}
// (inputs.lib.optionalAttrs (nixpkgs.march != null)
{
oneapiArch = let match = {}; in match.${nixpkgs.march} or nixpkgs.march;
oneapiArch = let match.znver5 = "znver4"; in match.${nixpkgs.march} or nixpkgs.march;
nvhpcArch = nixpkgs.march;
# contentAddressedByDefault = true;
})
// (inputs.lib.optionalAttrs (nixpkgs.nixRoot != null)
// (inputs.lib.optionalAttrs (nixpkgs.nixRoot or null != null)
{ nix = { storeDir = "${nixpkgs.nixRoot}/store"; stateDir = "${nixpkgs.nixRoot}/state"; }; });
in platformConfig //
{

View File

@@ -3,7 +3,7 @@
pkgs = import inputs.nixpkgs (localLib.buildNixpkgsConfig
{
inputs = { inherit (inputs.nixpkgs) lib; topInputs = inputs; };
nixpkgs = { march = null; cuda = null; nixRoot = null; nixos = false; };
nixpkgs = { march = null; nixos = false; };
});
hpcstat =
let

View File

@@ -22,7 +22,7 @@ inputs: let inherit (inputs) topInputs; in
{
home-manager.sharedModules =
[
topInputs.plasma-manager.homeManagerModules.plasma-manager
topInputs.plasma-manager.homeModules.plasma-manager
topInputs.catppuccin.homeModules.catppuccin
];
};

View File

@@ -67,19 +67,15 @@ inputs:
{
hibernate-progress = [{ name = "hibernate-progress"; patch = ./hibernate-progress.patch; }];
btrfs =
let configName =
if inputs.config.nixos.system.kernel.variant == "xanmod-unstable" then "structuredExtraConfig"
else "extraStructuredConfig";
in
[{
name = "btrfs";
patch = inputs.pkgs.fetchurl
{
url = "https://github.com/kakra/linux/pull/36.patch";
sha256 = "0wimihsvrxib6g23jcqdbvqlkqk6nbqjswfx9bzmpm1vlvzxj8m0";
};
${configName}.BTRFS_EXPERIMENTAL = inputs.lib.kernel.yes;
}];
[{
name = "btrfs";
patch = inputs.pkgs.fetchurl
{
url = "https://github.com/kakra/linux/pull/36.patch";
sha256 = "0wimihsvrxib6g23jcqdbvqlkqk6nbqjswfx9bzmpm1vlvzxj8m0";
};
structuredExtraConfig.BTRFS_EXPERIMENTAL = inputs.lib.kernel.yes;
}];
};
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
};

View File

@@ -12,31 +12,26 @@ inputs:
};});
default = null;
};
rocm = mkOption { type = types.bool; default = false; };
};
config = let inherit (inputs.config.nixos.system) nixpkgs; in
{
nixpkgs = inputs.localLib.buildNixpkgsConfig
{
inherit inputs;
nixpkgs = nixpkgs // { nixRoot = null; nixos = true; inherit (inputs.config.nixos.model) arch; };
nixpkgs = nixpkgs // { nixos = true; inherit (inputs.config.nixos.model) arch; };
};
boot.kernelPatches = inputs.lib.mkIf (nixpkgs.march != null)
(
let configName =
if inputs.config.nixos.system.kernel.variant == "xanmod-unstable" then "structuredExtraConfig"
else "extraStructuredConfig";
in
[{
name = "native kernel";
patch = null;
${configName} =
let kernelConfig = { znver2 = "MZEN2"; znver3 = "MZEN3"; znver4 = "MZEN4"; znver5 = "MZEN5"; };
in
{
GENERIC_CPU = inputs.lib.kernel.no;
${kernelConfig.${nixpkgs.march} or "M${inputs.lib.toUpper nixpkgs.march}"} = inputs.lib.kernel.yes;
};
}]
);
[{
name = "native kernel";
patch = null;
structuredExtraConfig =
let kernelConfig = { znver2 = "MZEN2"; znver3 = "MZEN3"; znver4 = "MZEN4"; znver5 = "MZEN5"; };
in
{
GENERIC_CPU = inputs.lib.kernel.no;
${kernelConfig.${nixpkgs.march} or "M${inputs.lib.toUpper nixpkgs.march}"} = inputs.lib.kernel.yes;
};
}];
};
}