it finally happened

This commit is contained in:
atagen 2023-04-19 16:41:56 +10:00
parent 2ea78bdd47
commit 56d55e1659
190 changed files with 843 additions and 9368 deletions

View file

@ -1,87 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
nixpkgs.overlays = [
(self: super: {
system76-scheduler = pkgs.callPackage ./syspkgs/system76-scheduler.nix {};
kwin-system76-scheduler-integration = pkgs.libsForQt5.callPackage ./syspkgs/kwin-system76-scheduler-integration.nix {};
})
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1C5C-8FF4";
fsType = "vfat";
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
networking.hostName = "adrift"; # Define your hostname.
services.xserver.videoDrivers = [ "i915" ];
services.power-profiles-daemon.enable = false;
services.tlp.enable = true;
users.users.plank = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
fileSystems."/" = {
device = "/dev/mapper/nix-os";
fsType = "ext4";
};
fileSystems."/home" = {
device = "/dev/mapper/nix-home";
fsType = "ext4";
};
environment.systemPackages = with pkgs;
[
wl-clipboard
wl-clipboard-x11
xclip
system76-scheduler
kwin-system76-scheduler-integration
];
systemd.services."com.system76.Scheduler" = {
wantedBy = [ "multi-user.target" ];
description = "the system76 process scheduler";
serviceConfig = {
Type = "dbus";
ExecStart = ''${pkgs.system76-scheduler}/bin/system76-scheduler daemon'';
ExecReload = ''${pkgs.system76-scheduler}/bin/system76-scheduler daemon reload'';
BusName = "com.system76.Scheduler";
};
};
services.dbus.packages = [
pkgs.kwin-system76-scheduler-integration
pkgs.system76-scheduler
];
systemd.packages = [
pkgs.kwin-system76-scheduler-integration
pkgs.system76-scheduler
];
environment.etc = {
"system76-scheduler".source = "${pkgs.system76-scheduler}/etc/system76-scheduler";
};
}

View file

@ -1,13 +0,0 @@
# WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }:
let
folder = ./cachix;
toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
in {
inherit imports;
nix.settings.substituters = ["https://cache.nixos.org/"];
}

View file

@ -1,11 +0,0 @@
{
nix = {
settings.substituters = [
"https://cuda-maintainers.cachix.org"
];
settings.trusted-public-keys = [
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
};
}

View file

@ -1,11 +0,0 @@
{
nix = {
settings.substituters = [
"https://nix-community.cachix.org"
];
settings.trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
}

52
system/configuration.nix Executable file → Normal file
View file

@ -1,5 +1,5 @@
{ config, pkgs, ... }:
{ inputs, outputs, lib, config, pkgs, ... }:
# let
# lemurs = callPackage ./system/syspkgs/lemurs.nix {};
@ -7,28 +7,31 @@
# in
{
imports = [
# where are we ?
#./wollomi.nix
# ./adrift.nix
./quiver.nix
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.unstable-pkgs
];
};
# home manager should exist for users
<home-manager/nixos>
./cachix.nix
nix = {
registry = lib.mapAttrs(_: value: { flake = value; }) inputs;
settings = {
experimental-features = "nix-command flakes";
};
};
# declarative cachix
(import (builtins.fetchTarball "https://github.com/jonascarpay/declarative-cachix/archive/master.tar.gz"))
# imports = [
];
# # (import (builtins.fetchTarball "https://github.com/jonascarpay/declarative-cachix/archive/master.tar.gz"))
# ];
cachix = [
"nix-community"
];
# cachix = [
# "nix-community"
# ];
nix.extraOptions = ''
experimental-features = nix-command flakes
keep-outputs = true
keep-derivations = true
'';
@ -37,13 +40,11 @@
systemd.services.NetworkManager-wait-online.enable = false;
environment.pathsToLink = [ "/share/zsh" ];
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 5;
boot.loader.systemd-boot.consoleMode = "max";
boot.loader.systemd-boot.consoleMode = "keep";
boot.loader.timeout = 3;
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
boot.loader.systemd-boot.enable = true;
boot.tmpOnTmpfs = true;
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
@ -133,6 +134,7 @@
nix-index
comma
cachix
];
networking.wg-quick.interfaces = {
@ -142,9 +144,9 @@
privateKey = "WD0CNYazB8D19SJvwz/TdPqoWgWCGfTwA7mim16q7UM=";
peers = [
{
publicKey = "QhE7I5TnUuc3gLqSeF9KhOr0oew5v03bpj0EHrEOR2M=";
publicKey = "pu22RCPeJCeiDIE7a1XtWvmv3BdgPp8ugF6AyntW8xU=";
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "89.44.10.66:51820";
endpoint = "89.44.10.114:51820";
persistentKeepalive = 25;
}
];
@ -176,7 +178,7 @@
};
system.stateVersion = "22.05"; # Did you read the comment?
system.stateVersion = "23.05"; # Did you read the comment? # lol no
}

View file

@ -1,13 +0,0 @@
{ config, lib, pkgs, ... }:
{
virtualisation.docker.enable = true;
# virtualisation.docker.enableOnBoot = true;
# Nvidia Docker
virtualisation.docker.enableNvidia = true;
# libnvidia-container does not support cgroups v2 (prior to 1.8.0)
# https://github.com/NVIDIA/nvidia-docker/issues/1447
systemd.enableUnifiedCgroupHierarchy = false;
}

View file

@ -1,40 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbcore" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/06f59431-d939-4b48-9d91-e23606dd3ce0";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5008-1946";
fsType = "vfat";
};
fileSystems."/data" = {
device = "/dev/sdb1";
fsType = "ntfs";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

13
system/overlay.nix Normal file
View file

@ -0,0 +1,13 @@
{ inputs, ... }:
{
additions = final: _prev: import ./pkgs { pkgs = final; };
unstable-pkgs = final: _prev: {
unstable = import inputs.nixpkgs {
system = final.system;
config.allowUnfree = true;
};
};
}
# inputs: _: prev: {
# system76-scheduler = prev.callPackage ./syspkgs/system76-scheduler.nix {};
# }

65
system/quiver.nix Executable file → Normal file
View file

@ -1,34 +1,36 @@
{ config, lib, pkgs, modulesPath, ... }:
{ inputs, outputs, config, lib, pkgs, overlays, modulesPath, ... }:
let
flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz";
hyprland = (import flake-compat {
src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz";
}).defaultNix;
in {
nixpkgs.overlays = [
(self: super: {
system76-scheduler = pkgs.callPackage ./syspkgs/system76-scheduler.nix {};
kwin-system76-scheduler-integration = pkgs.libsForQt5.callPackage ./syspkgs/kwin-system76-scheduler-integration.nix {};
})
];
{
nix.settings = {
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
imports =
[ hyprland.nixosModules.default ];
imports = [
./configuration.nix
inputs.hyprland.nixosModules.default
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbcore" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "i2c-dev" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "nvidia_drm.modeset=1" "mitigations=off" "acpi_enforce_resources=lax" "preempt=full" ];
boot.kernelParams = [
"nvidia_drm.modeset=1"
"mitigations=off"
"acpi_enforce_resources=lax"
"preempt=full"
"quiet"
"loglevel=3"
"systemd.show_status=auto"
"rd.udev.log_level=3"
"vt.global_cursor_default=0"
];
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
boot.loader.systemd-boot.configurationLimit = 5;
boot.loader.efi.canTouchEfiVariables = true;
# boot.plymouth.enable = true;
@ -68,14 +70,14 @@ in {
};
};
# programs.hyprland = {
# enable = true;
# xwayland = {
# enable = true;
# hidpi = false;
# };
# nvidiaPatches = true;
# };
programs.hyprland = {
enable = true;
xwayland = {
enable = true;
hidpi = false;
};
nvidiaPatches = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
@ -104,12 +106,10 @@ in {
};
services.dbus.packages = [
pkgs.kwin-system76-scheduler-integration
pkgs.system76-scheduler
];
systemd.packages = [
pkgs.kwin-system76-scheduler-integration
pkgs.system76-scheduler
];
@ -149,8 +149,7 @@ in {
wl-clipboard
wl-clipboard-x11
xclip
system76-scheduler
kwin-system76-scheduler-integration
# system76-scheduler
];
networking.hostName = "quiver"; # Define your hostname.
@ -175,12 +174,6 @@ in {
options = [ "rw" "uid=1000" "gid=100" ];
};
# swapDevices = [ {
# device = "/dev/disk/by-uuid/7fde28ec-80f9-4228-8597-c3a57bfbf619";
# size = 4096;
# }
# ];
networking.firewall = {
allowedUDPPorts = [ 1900 ];
allowedTCPPorts = [ 8200 2234 ];

View file

@ -1,23 +0,0 @@
{ lib, stdenv, fetchurl, unzip }:
stdenv.mkDerivation rec {
pname = "headscale-ui";
version = "2022.12.23.2-beta";
src = fetchurl {
url = "https://github.com/gurucomputing/headscale-ui/releases/download/${version}/headscale-ui.zip";
sha256 = "sha256-QF10la68Rl2t0K53CH63Qiq54ynkySQACdELorZF/cY=";
};
nativeBuildInputs = [ unzip ];
unpackCmd = "unzip headscale-ui.zip";
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir $out/
cp -R . $out
'';
}

View file

@ -1,13 +0,0 @@
#!/usr/bin/env bash
socat - UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock |
while read line
do
if [[ "$line" == activewindow* ]]; then
pid="$(hyprctl activewindow | rg pid | cut -d' ' -f2)"
if [[ -n $pid ]]; then
dbus-send --system --dest=com.system76.Scheduler --type=method_call /com/system76/Scheduler com.system76.Scheduler.SetForegroundProcess uint32:$pid
fi
pid=""
fi
done

View file

@ -1,47 +0,0 @@
{ lib, pkgs, stdenv, hyprland, ripgrep, socat, dbus, ... }:
stdenv.mkDerivation rec {
pname = "hyprland-system76-scheduler-integration";
version = "0.1.0";
nativeBuildInputs = [
socat
dbus
hyprland
ripgrep
];
dontUnpack = "true";
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cat <<EOF > $out/bin/hyprland-system76-scheduler-hook.sh
#!${pkgs.bash}/bin/bash
echo "opening socket.."
${pkgs.socat}/bin/socat -u UNIX-CLIENT:/tmp/hypr/\''$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock STDOUT |
while read line; do
if [[ "\''$line" == activewindow* ]]; then
echo "got \''$line."
pid="\''$(${pkgs.hyprland}/bin/hyprctl activewindow | ${pkgs.ripgrep}/bin/rg pid | ${pkgs.coreutils}/bin/cut -d' ' -f2)"
if [[ -n \''$pid ]]; then
echo "sending \''$pid!"
${pkgs.dbus}/bin/dbus-send --system --dest=com.system76.Scheduler --type=method_call /com/system76/Scheduler com.system76.Scheduler.SetForegroundProcess uint32:\''$pid
fi
pid=""
fi
echo "continuing.."
done
echo "finished."
EOF
chmod +x $out/bin/hyprland-system76-scheduler-hook.sh
runHook postInstall
'';
}

View file

@ -1,54 +0,0 @@
{ lib, pkgs, stdenv, fetchFromGitHub, dbus, qt5, qtbase, wrapQtAppsHook, kpackage, kcoreaddons, ... }:
stdenv.mkDerivation rec {
pname = "kwin-system76-scheduler-integration";
version = "0.1";
src = fetchFromGitHub {
owner = "maxiberta";
repo = pname;
rev = version;
sha256 = "sha256-HX0nK1p97kqt+ZZuECm7Mg9aAXaFDnsJDkbcLUEU+p0=";
};
nativeBuildInputs = [
wrapQtAppsHook
kpackage
];
buildInputs = [
dbus
qt5.qttools.bin
];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
kpackagetool5 --type=KWin/Script -i . -p $out/share/kwin/scripts
cat <<EOF > $out/bin/kwin-system76-scheduler-dbus-proxy.sh
#!${pkgs.bash}/bin/bash
DBUS_SERVICE="com.system76.Scheduler"
DBUS_PATH="/com/system76/Scheduler"
DBUS_INTERFACE="com.system76.Scheduler"
DBUS_METHOD="SetForegroundProcess"
echo "starting dbus proxy.."
echo \''$DBUS_SERVICE \''$DBUS_PATH \''$DBUS_INTERFACE \''$DBUS_METHOD
${pkgs.dbus}/bin/dbus-monitor --session "destination=\''$DBUS_SERVICE,path=\''$DBUS_PATH,interface=\''$DBUS_INTERFACE,member=\''$DBUS_METHOD" |
while true; do
read method call time sender _ dest serial path interface member
read type pid
[ "\''$member" = "member=\''$DBUS_METHOD" ] && ${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus --system \''$DBUS_SERVICE \''$DBUS_PATH \''$DBUS_INTERFACE.\''$DBUS_METHOD \''$pid && echo "new foreground process: \''$pid"
done
EOF
chmod +x $out/bin/kwin-system76-scheduler-dbus-proxy.sh
runHook postInstall
'';
}

View file

@ -1,26 +0,0 @@
{ lib, fetchFromGitHub, rustPlatform, linux-pam, pkg-config }:
rustPlatform.buildRustPackage rec {
pname = "lemurs";
version = "0.3.1";
src = fetchFromGitHub {
owner = "coastalwhite";
repo = pname;
rev = "60fda2a";
sha256 = "sha256-mQXavJULD5iyOnzj72xTV0EQ1HQvj25SHsbDgfRg4lQ=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ linux-pam ];
cargoSha256 = "sha256-OCaIeQB8reK0089vbC+4IvQt5pKdZ2SCyyGuQEYWzjo=";
meta = with lib; {
description = "A customizable TUI display/login manager written in Rust";
homepage = "https://git.atagen.co/coastalwhite/lemurs";
license = licenses.mit;
maintainers = [ ];
};
}

View file

@ -1,41 +0,0 @@
{ stdenv, lib, fetchFromGitHub, linux-pam, libxcb, git }:
stdenv.mkDerivation rec {
pname = "ly";
version = "0.5.0+";
src = fetchFromGitHub {
owner = "fairyglade";
repo = pname;
rev = "c64f806a68af225cc95623971b5e464abb55b879";
sha256 = "sha256-orCqjKlK6U1q7NDoMwxZZE44cyG8yuxdCCk1cQAalP0=";
fetchSubmodules = true;
};
nativeBuildInputs = [ git ];
buildInputs = [ linux-pam libxcb ];
makeFlags = [ "FLAGS=-Wno-error=unused-result" ];
preBuildPhase = ''
mkdir -p ./data
export DESTDIR="$PWD"
export DATADIR="$PWD/data"
'';
buildPhase = ''
make -j16
'';
installPhase = ''
mkdir -p $out/bin
cp bin/ly $out/bin
mkdir -p $out/etc/ly
cp -R ./data/* $out/etc/ly
'';
meta = with lib; {
description = "TUI display manager";
license = licenses.wtfpl;
homepage = "https://github.com/fairyglade/ly";
maintainers = [ ];
};
}

View file

@ -1,34 +0,0 @@
{ pkgs, lib, rustPlatform, fetchFromGitHub, ... }:
rustPlatform.buildRustPackage rec {
pname = "system76-scheduler";
version = "1.2.2";
src = fetchFromGitHub {
owner = "pop-os";
repo = pname;
rev = version;
sha256 = "sha256-uFFJkuMxqcGj6OQShF0zh/FGwX4/ln1l6NwGonkUsNI=";
};
nativeBuildInputs = with pkgs; [
bcc
];
EXECSNOOP_PATH = "${pkgs.bcc}/bin/execsnoop";
cargoSha256 = "sha256-s91T/Ttr7G8sjyf0Mp5suep4IA+l/r4118B+ue33yfQ=";
postInstall = ''
mkdir -p $out/etc/system76-scheduler/assignments \
$out/etc/system76-scheduler/exceptions \
$out/lib/systemd/system \
$out/etc/dbus-1/system.d
install -Dm0644 data/config.ron $out/etc/system76-scheduler/config.ron
install -Dm0644 data/assignments.ron $out/etc/system76-scheduler/assignments/default.ron
install -Dm0644 data/exceptions.ron $out/etc/system76-scheduler/exceptions/default.ron
# install -Dm0644 data/com.system76.Scheduler.service $out/lib/systemd/system/com.system76.Scheduler.service
install -Dm0644 data/com.system76.Scheduler.conf $out/etc/dbus-1/system.d/com.system76.Scheduler.conf
'';
}

View file

@ -1,63 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbcore" "sd_mod" ];
boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.supportedFilesystems = [ "ntfs" ];
networking.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# dlna
services.minidlna = {
enable = true;
announceInterval = 120;
friendlyName = "PC";
mediaDirs = [ "A,/data/Music/Slsk" ];
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
hardware.ckb-next.enable = true;
environment.systemPackages = with pkgs; [
ckb-next
];
networking.hostName = "quiver"; # Define your hostname.
users.users.bolt = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/06f59431-d939-4b48-9d91-e23606dd3ce0";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5008-1946";
fsType = "vfat";
};
fileSystems."/data" = {
device = "/dev/disk/by-uuid/39D4F78C658E8B56";
fsType = "ntfs";
options = [ "rw" "uid=1000" "gid=100" ];
};
swapDevices = [ ];
networking.firewall = {
allowedUDPPorts = [ 1900 ];
allowedTCPPorts = [ 8200 ];
};
}