Revert "devices: remove surface, add steamdeck"

This reverts commit fba6519bc6.
This commit is contained in:
2024-08-17 08:29:51 +08:00
parent a293326f9d
commit 38f600277c
14 changed files with 98 additions and 108 deletions

View File

@@ -4,7 +4,7 @@ keys: # cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age
- &vps4 age1nnd6u8l20julg4jz4l6kw5gmj6h2tsngpm7n8dx59umgw2s66y4shq6jv4
- &vps6 age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
- &vps7 age137x7csalutwvfygvvzpemlsywvdxj3j4z93a50z2sjx03w6zau8q3r5902
- &steamdeck age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
- &surface age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
- &nas age19lhcwk37jmvn6z0v4dpdfh0k4u23f76twdjknc0p7atktf37rd7s4t4wj3
- &xmupc1 age1hnarptkze0ujpp05dqr8uma04cxg9zqcx68qgpks5uf5l6rpk5gqhh8wxg
- &xmupc2 age1l4stuz0vr7gs7pqwjrmezam44702jp2vmqaqyxw0l0r42kf9updq4dfhrw
@@ -36,11 +36,11 @@ creation_rules:
- age:
- *chn
- *nas
- path_regex: devices/steamdeck/.*$
- path_regex: devices/surface/.*$
key_groups:
- age:
- *chn
- *steamdeck
- *surface
- path_regex: devices/xmupc1/.*$
key_groups:
- age:

View File

@@ -1,5 +1,6 @@
inputs:
{
imports = inputs.localLib.mkModules [ inputs.topInputs.nixos-hardware.nixosModules.microsoft-surface-pro-intel ];
config =
{
nixos =
@@ -22,16 +23,15 @@ inputs:
resume = { device = "/dev/mapper/root"; offset = 533760; };
rollingRootfs = {};
};
nixpkgs.march = "znver2";
nixpkgs.march = "skylake";
grub.installDevice = "efi";
nix = { substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ]; githubToken.enable = true; };
kernel.variant = "steamos";
networking.hostname = "steamdeck";
kernel = { variant = "xanmod-lts"; patches = [ "surface" "hibernate-progress" ]; };
networking.hostname = "surface";
gui.enable = true;
initrd.unl0kr = {};
};
hardware = { cpus = [ "amd" ]; gpu.type = "amd"; steamdeck = {}; };
packages.vasp = null;
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
virtualization = { docker.enable = true; waydroid.enable = true; };
services =
{
@@ -57,12 +57,13 @@ inputs:
};
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
};
bugs = [ "xmunet" ];
bugs = [ "xmunet" "suspend-hibernate-no-platform" ];
};
specialisation.debug.configuration =
powerManagement.resumeCommands = ''${inputs.pkgs.systemd}/bin/systemctl restart iptsd'';
services.iptsd.config =
{
nixos.system.initrd.unl0kr = inputs.lib.mkForce null;
system.nixos.tags = [ "no-unl0kr" ];
Touch = { DisableOnPalm = true; DisableOnStylus = true; Overshoot = 0.5; };
Contacts = { Neutral = "Average"; NeutralValue = 10; };
};
};
}

View File

@@ -72,7 +72,7 @@ inputs:
wireguard =
{
enable = true;
peers = [ "pc" "nas" "vps7" "steamdeck" "xmupc1" "xmupc2" "pi3b" ];
peers = [ "pc" "nas" "vps7" "surface" "xmupc1" "xmupc2" "pi3b" ];
publicKey = "AVOsYUKQQCvo3ctst3vNi8XSVWo1Wh15066aHh+KpF4=";
wireguardIp = "192.168.83.1";
listenIp = "74.211.99.69";

77
flake.lock generated
View File

@@ -597,27 +597,6 @@
"type": "github"
}
},
"jovian_2": {
"inputs": {
"nix-github-actions": "nix-github-actions_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1723695386,
"narHash": "sha256-nZ5ue5VGb7ZLfYT3ob4TwBDcA9dY6gOgGDQ5ad2nu6g=",
"owner": "CHN-beta",
"repo": "Jovian-NixOS",
"rev": "5715c891a73d81a11c2eba359359aa1919c5fb16",
"type": "github"
},
"original": {
"owner": "CHN-beta",
"repo": "Jovian-NixOS",
"type": "github"
}
},
"kylin-virtual-keyboard": {
"flake": false,
"locked": {
@@ -650,6 +629,22 @@
"type": "github"
}
},
"linux-surface": {
"flake": false,
"locked": {
"lastModified": 1723804050,
"narHash": "sha256-MYwEgnw3KjEm6oh39XUmCq12tKdH+0QZj9SZlWbwyxo=",
"owner": "linux-surface",
"repo": "linux-surface",
"rev": "4439a5efb6516c443df5f52173cb55aef01560d1",
"type": "github"
},
"original": {
"owner": "linux-surface",
"repo": "linux-surface",
"type": "github"
}
},
"lmod": {
"flake": false,
"locked": {
@@ -792,28 +787,6 @@
"type": "github"
}
},
"nix-github-actions_2": {
"inputs": {
"nixpkgs": [
"jovian",
"nixpkgs"
]
},
"locked": {
"lastModified": 1690328911,
"narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=",
"owner": "zhaofengli",
"repo": "nix-github-actions",
"rev": "96df4a39c52f53cb7098b923224d8ce941b64747",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"ref": "matrix-name",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": [
@@ -877,6 +850,21 @@
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1723854545,
"narHash": "sha256-3CE8MTrYLMNzPr90Y09Js3EI9D0MR3JnQtYENVcdKB4=",
"owner": "CHN-beta",
"repo": "nixos-hardware",
"rev": "0b3a6ecaa0be2e528b6a5619cf29aea77b61e5bc",
"type": "github"
},
"original": {
"owner": "CHN-beta",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixos-stable": {
"locked": {
"lastModified": 1720535198,
@@ -1251,9 +1239,9 @@
"gricad": "gricad",
"home-manager": "home-manager",
"impermanence": "impermanence",
"jovian": "jovian_2",
"kylin-virtual-keyboard": "kylin-virtual-keyboard",
"lepton": "lepton",
"linux-surface": "linux-surface",
"lmod": "lmod",
"matplotplusplus": "matplotplusplus",
"misskey": "misskey",
@@ -1263,6 +1251,7 @@
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nixpkgs-22.05": "nixpkgs-22.05",
"nixpkgs-22.11": "nixpkgs-22.11",

View File

@@ -26,6 +26,7 @@
inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; };
};
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"; };
nix-flatpak.url = "github:gmodena/nix-flatpak";
@@ -37,7 +38,6 @@
gricad = { url = "github:Gricad/nur-packages"; flake = false; };
catppuccin.url = "github:catppuccin/nix";
bscpkgs = { url = "git+https://pm.bsc.es/gitlab/rarias/bscpkgs.git"; inputs.nixpkgs.follows = "nixpkgs"; };
jovian = { url = "github:CHN-beta/Jovian-NixOS"; inputs.nixpkgs.follows = "nixpkgs"; };
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };
@@ -54,6 +54,7 @@
rycee = { url = "gitlab:rycee/nur-expressions"; flake = false; };
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; };
lmod = { url = "github:TACC/Lmod"; flake = false; };
mumax = { url = "github:CHN-beta/mumax"; flake = false; };

View File

@@ -16,15 +16,6 @@ inputs:
topInputs.chaotic.nixosModules.default
{ config.chaotic.nyx.overlay.onTopOf = "user-pkgs"; }
topInputs.catppuccin.nixosModules.catppuccin
topInputs.jovian.nixosModules.default
{
config.jovian =
{
steamos.useSteamOSConfig = inputs.lib.mkDefault false;
devices.steamdeck.enableKernelPatches = inputs.lib.mkDefault false;
overlay.enable = inputs.lib.mkDefault false;
};
}
(inputs:
{
config =

View File

@@ -1,24 +0,0 @@
inputs:
{
options.nixos.hardware.steamdeck = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = null; };
config = let inherit (inputs.config.nixos.hardware) steamdeck; in inputs.lib.mkIf (steamdeck != null)
{
jovian =
{
steam = { enable = true; autoStart = true; user = "chn"; desktopSession = "plasma"; };
steamos.useSteamOSConfig = true;
decky-loader = { enable = true; package = inputs.pkgs.decky-loader-prerelease; };
devices.steamdeck.enable = true;
overlay.enable = true;
};
services.displayManager.sddm.enable = false;
systemd.services.display-manager.enable = false;
boot.initrd.kernelModules =
[
"hid_generic" "hid_multitouch" "i2c_designware_core" "i2c_designware_platform" "i2c_hid_acpi" "evdev"
"i2c_hid_api"
];
nixos.packages.packages._packages = [ inputs.pkgs.steamdeck-firmware ];
};
}

View File

@@ -47,10 +47,10 @@ inputs:
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIAoMu0HEaFQsnlJL0L6isnkNZdRq0OiDXyaX3+fl3NjT";
hostnames = [ "initrd.nas.chn.moe" "192.168.1.2" ];
};
steamdeck =
surface =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIFdm3DcfHdcLP0oSpVrWwIZ/b9lZuakBSPwCFz2BdTJ7";
hostnames = [ "192.168.1.4" "wireguard.steamdeck.chn.moe" "192.168.83.5" ];
hostnames = [ "192.168.1.4" "wireguard.surface.chn.moe" "192.168.83.5" ];
};
pc =
{
@@ -112,7 +112,7 @@ inputs:
[ "vps4" "vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.nas" ])
++ (builtins.map
(host: { name = host; value = { inherit host; hostname = "${host}.chn.moe"; forwardX11 = true; }; })
[ "wireguard.pc" "wireguard.steamdeck" "wireguard.xmupc1" "wireguard.xmupc2" ])
[ "wireguard.pc" "wireguard.surface" "wireguard.xmupc1" "wireguard.xmupc2" ])
++ (builtins.map
(host:
{
@@ -132,7 +132,7 @@ inputs:
xmupc2 = { host = "xmupc2"; hostname = "xmupc2.chn.moe"; port = 6394; forwardX11 = true; };
nas = { host = "nas"; hostname = "192.168.1.2"; forwardX11 = true; };
pc = { host = "pc"; hostname = "192.168.1.3"; forwardX11 = true; };
steamdeck = { host = "steamdeck"; hostname = "192.168.1.4"; forwardX11 = true; };
surface = { host = "surface"; hostname = "192.168.1.4"; forwardX11 = true; };
gitea = { host = "gitea"; hostname = "ssh.git.chn.moe"; };
jykang =
{

View File

@@ -10,7 +10,7 @@ inputs:
programs.steam =
{
enable = true;
package = inputs.lib.mkIf (inputs.config.nixos.hardware.steamdeck == null) (inputs.pkgs.steam.override (prev:
package = inputs.pkgs.steam.override (prev:
{
steam = prev.steam.overrideAttrs (prev:
{
@@ -19,7 +19,7 @@ inputs:
sed -i 's#Comment\[zh_CN\]=.*$#Comment\[zh_CN\]=®#' $out/share/applications/steam.desktop
'';
});
}));
});
extraPackages = [ inputs.pkgs.openssl_1_1 ];
extraCompatPackages = [ inputs.pkgs.proton-ge-bin ];
remotePlay.openFirewall = true;
@@ -27,11 +27,5 @@ inputs:
localNetworkGameTransfers.openFirewall = true;
dedicatedServer.openFirewall = true;
};
# not easy to override steamdeck's steam package env, just write env vars to global
environment.sessionVariables = inputs.lib.mkIf (inputs.config.nixos.hardware.steamdeck != null)
{
STEAM_EXTRA_COMPAT_TOOLS_PATHS =
inputs.lib.makeSearchPathOutput "steamcompattool" "" inputs.config.programs.steam.extraCompatPackages;
};
};
}

View File

@@ -47,7 +47,6 @@ inputs:
cachyos-lto = inputs.pkgs.linuxPackages_cachyos-lto;
cachyos-server = inputs.pkgs.linuxPackages_cachyos-server;
rpi3 = inputs.pkgs.linuxPackages_rpi3;
steamos = inputs.pkgs.linuxPackages_jovian;
}.${kernel.variant};
kernelPatches =
let
@@ -82,6 +81,45 @@ inputs:
HZ = inputs.lib.mkForce (freeform "1000");
};
}];
surface =
let
version =
let versionArray = builtins.splitVersion inputs.config.boot.kernelPackages.kernel.version;
in "${builtins.elemAt versionArray 0}.${builtins.elemAt versionArray 1}";
kernelPatches = builtins.map
(file:
{
name = "surface-${file.name}";
patch = "${inputs.topInputs.linux-surface}/patches/${version}/${file.name}";
})
(builtins.filter
(file: file.value == "regular")
(inputs.localLib.attrsToList (builtins.readDir
"${inputs.topInputs.linux-surface}/patches/${version}")));
kernelConfig = builtins.removeAttrs
(builtins.listToAttrs (builtins.concatLists (builtins.map
(configString:
if builtins.match "CONFIG_.*=." configString == [] then
(
let match = builtins.match "CONFIG_(.*)=(.)" configString; in with inputs.lib.kernel;
[{
name = builtins.elemAt match 0;
value = { m = module; y = yes; }.${builtins.elemAt match 1};
}]
)
else if builtins.match "# CONFIG_.* is not set" configString == [] then
[{
name = builtins.elemAt (builtins.match "# CONFIG_(.*) is not set" configString) 0;
value = inputs.lib.kernel.unset;
}]
else if builtins.match "#.*" configString == [] then []
else if configString == "" then []
else throw "could not parse: ${configString}"
)
(inputs.lib.strings.splitString "\n"
(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";

View File

@@ -32,10 +32,10 @@ inputs:
(system: { name = system; value = { forwardAgent = true; extraOptions.AddKeysToAgent = "yes"; }; })
[
"vps4" "vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.pc" "nas" "wireguard.nas" "pc"
"wireguard.steamdeck" "xmupc1" "wireguard.xmupc1" "xmupc2" "wireguard.xmupc2"
"wireguard.surface" "xmupc1" "wireguard.xmupc1" "xmupc2" "wireguard.xmupc2"
]));
extraConfig =
inputs.lib.mkIf (builtins.elem inputs.config.nixos.system.networking.hostname [ "pc" "steamdeck" ])
inputs.lib.mkIf (builtins.elem inputs.config.nixos.system.networking.hostname [ "pc" "surface" ])
''
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_ed25519_sk

View File

@@ -56,7 +56,7 @@ inputs:
devices =
{
pc = [ "nheko" "kclockd" "yakuake" "telegram" "element" "kmail" "discord" "crow-translate" ];
steamdeck = [ "kclockd" "yakuake" "telegram" "element" "crow-translate" ];
surface = [ "kclockd" "yakuake" "telegram" "element" "crow-translate" ];
};
in builtins.listToAttrs (builtins.map
(file:

View File

@@ -12,7 +12,7 @@ inputs:
wallpaper =
{
pc = "${nixos-wallpaper}/pixiv-117612023.png";
steamdeck = "${nixos-wallpaper}/fanbox-6682738.png";
surface = "${nixos-wallpaper}/fanbox-6682738.png";
}.${inputs.config.nixos.system.networking.hostname} or "${nixos-wallpaper}/pixiv-96734339-x2.png";
in
{