Initial legion desktop

This commit is contained in:
Nikodem Rabuliński 2023-10-02 20:02:08 +02:00
parent eb7b2a57b2
commit 49b0d48a66
5 changed files with 215 additions and 0 deletions

107
flake.lock generated
View file

@ -172,6 +172,22 @@
"type": "github" "type": "github"
} }
}, },
"fl-config": {
"locked": {
"lastModified": 1653159448,
"narHash": "sha256-PvB9ha0r4w6p412MBPP71kS/ZTBnOjxL0brlmyucPBA=",
"owner": "flakelib",
"repo": "fl",
"rev": "fcefb9738d5995308a24cda018a083ccb6b0f460",
"type": "github"
},
"original": {
"owner": "flakelib",
"ref": "config",
"repo": "fl",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -242,6 +258,25 @@
"type": "github" "type": "github"
} }
}, },
"flakelib": {
"inputs": {
"fl-config": "fl-config",
"std": "std"
},
"locked": {
"lastModified": 1683326042,
"narHash": "sha256-PRjFKmEzzoE0BeDM8zRdwMcUkMq4Ue340O4jv71PzBw=",
"owner": "flakelib",
"repo": "fl",
"rev": "d4be0a0007aeae09b8faced2e297b1062dc05b1e",
"type": "github"
},
"original": {
"owner": "flakelib",
"repo": "fl",
"type": "github"
}
},
"haskell-flake": { "haskell-flake": {
"locked": { "locked": {
"lastModified": 1684780604, "lastModified": 1684780604,
@ -406,6 +441,21 @@
"type": "github" "type": "github"
} }
}, },
"nix-std": {
"locked": {
"lastModified": 1671170529,
"narHash": "sha256-015C6x3tZMEd83Vd2rpfLC86PSRJrbUca1U3Rysranw=",
"owner": "chessai",
"repo": "nix-std",
"rev": "3b307d64ef7d7e8769d36b8c8bf33983efd1415a",
"type": "github"
},
"original": {
"owner": "chessai",
"repo": "nix-std",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1689444953, "lastModified": 1689444953,
@ -529,6 +579,44 @@
"type": "github" "type": "github"
} }
}, },
"nvidia-patch": {
"inputs": {
"flakelib": "flakelib",
"nixpkgs": [
"nixpkgs"
],
"nvidia-patch-src": "nvidia-patch-src"
},
"locked": {
"lastModified": 1698914831,
"narHash": "sha256-7mCMio2bIzBZoiofOfrq6C/hYAAodtiDlYn7VVqb0pc=",
"owner": "arcnmx",
"repo": "nvidia-patch.nix",
"rev": "9b853953f3a134c17a43bc4261f3f3e3e833afb0",
"type": "github"
},
"original": {
"owner": "arcnmx",
"repo": "nvidia-patch.nix",
"type": "github"
}
},
"nvidia-patch-src": {
"flake": false,
"locked": {
"lastModified": 1698896513,
"narHash": "sha256-HqY8JrVRdCzG872SESJO5OyiBmr09vCN8j5aPz4Ba+U=",
"owner": "keylase",
"repo": "nvidia-patch",
"rev": "1d856fbab568f261859741b0c408b718a4e0d9b8",
"type": "github"
},
"original": {
"owner": "keylase",
"repo": "nvidia-patch",
"type": "github"
}
},
"racket": { "racket": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -564,6 +652,7 @@
"nh": "nh", "nh": "nh",
"niko-nur": "niko-nur", "niko-nur": "niko-nur",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_6",
"nvidia-patch": "nvidia-patch",
"racket": "racket", "racket": "racket",
"wrapper-manager": "wrapper-manager", "wrapper-manager": "wrapper-manager",
"wrapper-manager-hm-compat": "wrapper-manager-hm-compat" "wrapper-manager-hm-compat": "wrapper-manager-hm-compat"
@ -613,6 +702,24 @@
"type": "github" "type": "github"
} }
}, },
"std": {
"inputs": {
"nix-std": "nix-std"
},
"locked": {
"lastModified": 1671225084,
"narHash": "sha256-EzqxFHRifPyjUXQY4B8GJH75fTmWqFnQdj10Q984bR8=",
"owner": "flakelib",
"repo": "std",
"rev": "8546115941a5498ddb03a239aacdba151d433f09",
"type": "github"
},
"original": {
"owner": "flakelib",
"repo": "std",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

@ -108,6 +108,10 @@
conduit = { conduit = {
url = "gitlab:famedly/conduit?ref=next"; url = "gitlab:famedly/conduit?ref=next";
}; };
nvidia-patch = {
url = "github:arcnmx/nvidia-patch.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
nixConfig = { nixConfig = {

View file

@ -59,6 +59,7 @@
inputs.mailserver.nixosModules.default inputs.mailserver.nixosModules.default
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.hercules-ci-agent.nixosModules.agent-service inputs.hercules-ci-agent.nixosModules.agent-service
# inputs.nvidia-patch.nixosModules.nvidia-patch
self.nixosModules.settei self.nixosModules.settei
self.nixosModules.common self.nixosModules.common
sharedOptions sharedOptions

View file

@ -9,6 +9,7 @@
./hardware.nix ./hardware.nix
# ./disks.nix # ./disks.nix
./msmtp.nix ./msmtp.nix
./desktop.nix
]; ];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";

102
hosts/legion/desktop.nix Normal file
View file

@ -0,0 +1,102 @@
# TODO: Proper desktop module
{
config,
pkgs,
lib,
username,
...
}: {
# Needed for nvidia and steam
nixpkgs.config.allowUnfree = true;
settei.user.config = {pkgs, ...}: {
home.packages = with pkgs; [alacritty brightnessctl dmenu];
xsession.windowManager.i3 = {
enable = true;
config = {
terminal = "alacritty";
modifier = "Mod4";
};
};
home.file.".xinitrc".source = pkgs.writeShellScript "xinitrc" ''
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec dbus-run-session i3
'';
};
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
gamescopeSession = {};
};
hardware.steam-hardware.enable = true;
services.logind =
lib.genAttrs
["lidSwitch" "lidSwitchDocked" "lidSwitchExternalPower"]
(_: "ignore");
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
programs.dconf.enable = true;
services.dbus.enable = true;
users.users.${username}.extraGroups = ["video" "input"];
# NVIDIA stuff
services.xserver = {
enable = true;
excludePackages = [pkgs.xterm];
videoDrivers = ["nvidia"];
layout = "pl";
displayManager.startx.enable = true;
config = lib.mkForce ''
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
EndSection
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "${config.hardware.nvidia.package.bin}/lib/xorg/modules"
ModulePath "${pkgs.xorg.xorgserver}/lib/xorg/modules"
EndSection
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "TappingButtonMap" "lrm"
Option "NaturalScrolling" "true"
EndSection
'';
exportConfiguration = true;
libinput.enable = true;
};
hardware.nvidia = {
# TODO: Makes the build spiral out of control?
# patch.enable = true;
modesetting.enable = true;
};
hardware.opengl = {
enable = true;
driSupport32Bit = true;
};
}