refactor
This commit is contained in:
parent
f6483d21e9
commit
f296a8c337
73
home/common/firefox.nix
Normal file
73
home/common/firefox.nix
Normal file
|
@ -0,0 +1,73 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
/*let firefoxWithCcache = ({ useSccache, firefox-unwrapped }:
|
||||
(firefox-unwrapped.override {
|
||||
buildMozillaMach = (x: (pkgs.buildMozillaMach (x // {
|
||||
extraConfigureFlags = x.extraConfigureFlags ++ [
|
||||
(if useSccache then "--with-ccache=sccache" else "--with-ccache")
|
||||
];
|
||||
})));
|
||||
}).overrideAttrs (prev: if useSccache then {
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.sccache ];
|
||||
SCCACHE_DIR = "/var/cache/sccache";
|
||||
SCCACHE_MAX_FRAME_LENGTH = "104857600";
|
||||
RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
|
||||
} else {
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.ccache ];
|
||||
CCACHE_CPP2 = "yes";
|
||||
CCACHE_COMPRESS = "1";
|
||||
CCACHE_UMASK = "007";
|
||||
CCACHE_DIR = "/var/cache/ccache";
|
||||
})
|
||||
); in*/
|
||||
|
||||
{
|
||||
imports = [
|
||||
./gui.nix
|
||||
];
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package =
|
||||
let
|
||||
# TODO: remove this override soon (it's already upstreamed)
|
||||
librewolf-unwrapped = pkgs.librewolf-unwrapped.overrideAttrs (prev: {
|
||||
MOZ_REQUIRE_SIGNING = "";
|
||||
});
|
||||
in pkgs.wrapFirefox librewolf-unwrapped {
|
||||
inherit (librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles;
|
||||
wmClass = "LibreWolf";
|
||||
libName = "librewolf";
|
||||
# TODO: keepass in extraNativeMessagingHosts?
|
||||
};
|
||||
profiles = {
|
||||
chayleaf = {
|
||||
extensions = with config.nur.repos.rycee.firefox-addons; [
|
||||
cookies-txt
|
||||
don-t-fuck-with-paste
|
||||
greasemonkey
|
||||
i-dont-care-about-cookies
|
||||
keepassxc-browser
|
||||
libredirect
|
||||
localcdn
|
||||
noscript
|
||||
privacy-pass
|
||||
protondb-for-steam
|
||||
return-youtube-dislikes
|
||||
rust-search-extension
|
||||
search-by-image
|
||||
sponsorblock
|
||||
steam-database
|
||||
ublock-origin
|
||||
unpaywall
|
||||
vimium-c
|
||||
youtube-shorts-block
|
||||
] ++ (with pkgs.firefox-addons; [
|
||||
fastforward
|
||||
middle-mouse-button-scroll
|
||||
yomichan
|
||||
youtube-nonstop
|
||||
]);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let firefoxWithCcache = ({ useSccache, firefox-unwrapped }:
|
||||
(firefox-unwrapped.override {
|
||||
buildMozillaMach = (x: (pkgs.buildMozillaMach (x // {
|
||||
extraConfigureFlags = x.extraConfigureFlags ++ [
|
||||
(if useSccache then "--with-ccache=sccache" else "--with-ccache")
|
||||
];
|
||||
})));
|
||||
}).overrideAttrs (prev: if useSccache then {
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.sccache ];
|
||||
SCCACHE_DIR = "/var/cache/sccache";
|
||||
SCCACHE_MAX_FRAME_LENGTH = "104857600";
|
||||
RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
|
||||
} else {
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.ccache ];
|
||||
CCACHE_CPP2 = "yes";
|
||||
CCACHE_COMPRESS = "1";
|
||||
CCACHE_UMASK = "007";
|
||||
CCACHE_DIR = "/var/cache/ccache";
|
||||
})
|
||||
); in {
|
||||
imports = [
|
||||
../gui.nix
|
||||
];
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package =
|
||||
let librewolf-unwrapped = firefoxWithCcache {
|
||||
useSccache = true;
|
||||
firefox-unwrapped = pkgs.librewolf-unwrapped.overrideAttrs (prev: {
|
||||
MOZ_REQUIRE_SIGNING = "";
|
||||
});
|
||||
};
|
||||
in pkgs.wrapFirefox librewolf-unwrapped {
|
||||
inherit (librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles;
|
||||
wmClass = "LibreWolf";
|
||||
libName = "librewolf";
|
||||
# TODO: keepass in extraNativeMessagingHosts?
|
||||
};
|
||||
profiles = {
|
||||
chayleaf = {
|
||||
extensions =
|
||||
with config.nur.repos.rycee.firefox-addons;
|
||||
let sources = (import ../../_sources/generated.nix {
|
||||
inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools;
|
||||
});
|
||||
# addons.mozilla.org's version is horribly outdated for whatever reason
|
||||
# I guess the extension normally autoupdates by itself?
|
||||
# this is an unsigned build
|
||||
yomichan = pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit (sources.yomichan) pname version src;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = true;
|
||||
buildCommand = ''
|
||||
dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||
mkdir -p "$dst"
|
||||
install -v -m644 "$src" "$dst/alex.testing@foosoft.net.xpi"
|
||||
'';
|
||||
meta = with lib; {
|
||||
homepage = "https://foosoft.net/projects/yomichan";
|
||||
description = "Yomichan turns your browser into a tool for building Japanese language literacy by helping you to decipher texts which would be otherwise too difficult tackle. It features a robust dictionary with EPWING and flashcard creation support.";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
fastforward = pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit (sources.fastforward) pname version src;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = true;
|
||||
buildCommand = ''
|
||||
dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||
mkdir -p "$dst"
|
||||
install -v -m644 "$src" "$dst/addon@fastforward.team"
|
||||
'';
|
||||
meta = with lib; {
|
||||
homepage = "https://fastforward.team";
|
||||
description = "Don't waste time with compliance. Use FastForward to skip annoying URL \"shorteners\"";
|
||||
license = licenses.unlicense;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
in with (import ./generated.nix {
|
||||
inherit lib stdenv fetchurl buildFirefoxXpiAddon;
|
||||
});
|
||||
[
|
||||
# from rycee's repo
|
||||
youtube-shorts-block
|
||||
vimium-c
|
||||
search-by-image
|
||||
unpaywall
|
||||
ublock-origin
|
||||
steam-database
|
||||
sponsorblock
|
||||
rust-search-extension
|
||||
return-youtube-dislikes
|
||||
protondb-for-steam
|
||||
libredirect
|
||||
privacy-pass
|
||||
noscript
|
||||
localcdn
|
||||
keepassxc-browser
|
||||
i-dont-care-about-cookies
|
||||
greasemonkey
|
||||
don-t-fuck-with-paste
|
||||
cookies-txt
|
||||
fastforward
|
||||
|
||||
# my packages
|
||||
yomichan
|
||||
youtube-nonstop
|
||||
middle-mouse-button-scroll
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -20,11 +20,11 @@
|
|||
# SDL 3
|
||||
SDL_AUDIO_DRIVER = "pipewire,pulseaudio,dsound";
|
||||
ALSOFT_CONF = "${config.xdg.configHome}/.config/alsoft.conf";
|
||||
# TODO: set to sdl3 compat when SDL3 releases
|
||||
# TODO: set to sdl3 compat when SDL3 releases?
|
||||
# this is for steam games, I set the launch options to:
|
||||
# `SDL_DYNAMIC_API=$SDL2_DYNAMIC_API %command%`
|
||||
# Steam itself doesn't work with SDL_DYNAMIC_API set, so it's
|
||||
# a bad idea to set SDL_DYNAMIC_API globally
|
||||
# Steam itself doesn't work with SDL2_DYNAMIC_API set, so it's
|
||||
# a bad idea to set SDL2_DYNAMIC_API globally
|
||||
SDL2_DYNAMIC_API = "${pkgs.SDL2}/lib/libSDL2.so";
|
||||
};
|
||||
programs.nnn.extraPackages = with pkgs; [
|
||||
|
@ -181,42 +181,11 @@
|
|||
# webp support
|
||||
ffmpeg_5 = pkgs.ffmpeg_5-full;
|
||||
}) {
|
||||
scripts =
|
||||
let subserv = (port: secondary:
|
||||
(pkgs.stdenv.mkDerivation {
|
||||
pname = "subserv-mpv-plugin";
|
||||
version = "0.1";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "kaervin";
|
||||
repo = "subserv-mpv-plugin";
|
||||
rev = "08e312f02f3d3608d61944247d39148c34215f75";
|
||||
sha256 = "sha256-CXyp+AAgyocAEbhuMMPVDlAiocozPe8tm/dIUofCRL8=";
|
||||
};
|
||||
buildInputs = with pkgs; [ mpv-unwrapped ];
|
||||
installFlags = [ "SCRIPTS_DIR=$(out)/share/mpv/scripts" ];
|
||||
stripDebugList = [ "share/mpv/scripts" ];
|
||||
passthru.scriptName = "subserv.so";
|
||||
patchPhase = ''
|
||||
sed -i 's%<client.h>%<mpv/client.h>%' subserv.c
|
||||
sed -i 's%printf("Hello%// printf("Hello%' subserv.c
|
||||
sed -i 's%printf("Got event%// printf("Got event%' subserv.c
|
||||
sed -i 's/PORT 8080/PORT ${builtins.toString port}/' subserv.c
|
||||
'' + (if secondary then ''
|
||||
sed -i 's/sub-text/secondary-sub-text/g' subserv.c
|
||||
'' else "");
|
||||
buildPhase = ''
|
||||
gcc -o subserv.so subserv.c -shared -fPIC
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/mpv/scripts
|
||||
cp subserv.so $out/share/mpv/scripts
|
||||
'';
|
||||
}));
|
||||
in with pkgs.mpvScripts; [
|
||||
scripts = with pkgs.mpvScripts; [
|
||||
thumbnail
|
||||
mpris
|
||||
(subserv 1337 false)
|
||||
(subserv 1338 true)
|
||||
(subserv.override { port = 1337; secondary = false; })
|
||||
(subserv.override { port = 1338; secondary = true; })
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -39,7 +39,13 @@
|
|||
];
|
||||
overlays = [
|
||||
(self: super: import ./pkgs {
|
||||
# can't use callPackage here, idk why
|
||||
pkgs = super;
|
||||
lib = super.lib;
|
||||
nur = import nur {
|
||||
pkgs = super;
|
||||
nurpkgs = super;
|
||||
};
|
||||
})
|
||||
nix-gaming.overlays.default
|
||||
];
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ config, pkgs, lib, pkgs-wayland, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
../common/general.nix
|
||||
../common/firefox
|
||||
../common/firefox.nix
|
||||
../common/i3-sway.nix
|
||||
../common/nvim.nix
|
||||
../common/helix.nix
|
||||
|
@ -37,18 +37,8 @@
|
|||
"steamcmd"
|
||||
"osu-lazer-bin"
|
||||
];
|
||||
home.sessionVariables = let sources = (import ../_sources/generated.nix {
|
||||
inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools;
|
||||
});
|
||||
proton-ge = pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit (sources.proton-ge) pname version src;
|
||||
nativeBuildInputs = [];
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
tar -C $out --strip=1 -x -f $src
|
||||
'';
|
||||
}; in {
|
||||
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${proton-ge}";
|
||||
home.sessionVariables = {
|
||||
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${pkgs.proton-ge}";
|
||||
CARGO_PROFILE_DEV_INCREMENTAL = "true";
|
||||
RUSTC_LINKER = "${pkgs.clang_latest}/bin/clang";
|
||||
RUSTFLAGS = "-C link-arg=--ld-path=${pkgs.mold}/bin/mold";
|
||||
|
@ -57,9 +47,7 @@
|
|||
};
|
||||
home.packages = with pkgs; [
|
||||
mold
|
||||
(ghidra.overrideAttrs (old: {
|
||||
patches = old.patches ++ [ ../common/ghidra-stdcall.patch ];
|
||||
})) cutter
|
||||
ghidra cutter
|
||||
openrgb piper
|
||||
steam-run steam
|
||||
((osu-lazer-bin.override {
|
||||
|
@ -104,19 +92,7 @@
|
|||
mediainfo
|
||||
glaxnimate
|
||||
lalrpop
|
||||
# waiting until the PR gets merged
|
||||
(looking-glass-client.overrideAttrs (old: {
|
||||
version = "B6";
|
||||
src = fetchFromGitHub {
|
||||
owner = "gnif";
|
||||
repo = "LookingGlass";
|
||||
rev = "B6";
|
||||
sha256 = "sha256-6vYbNmNJBCoU23nVculac24tHqH7F4AZVftIjL93WJU=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
buildInputs = old.buildInputs ++ (with pkgs; [ pipewire libsamplerate ]);
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DENABLE_PULSEAUDIO=no" ];
|
||||
}))
|
||||
looking-glass-client
|
||||
];
|
||||
xdg.configFile."looking-glass/client.ini".text = ''
|
||||
[app]
|
||||
|
|
|
@ -1,8 +1,43 @@
|
|||
{ pkgs, ... }: let inherit (pkgs) callPackage; in {
|
||||
{ pkgs
|
||||
, lib
|
||||
, nur
|
||||
, ... }:
|
||||
let
|
||||
inherit (pkgs) callPackage;
|
||||
sources = import ../_sources/generated.nix {
|
||||
inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools;
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
clang-tools_latest = pkgs.clang-tools_15;
|
||||
clang_latest = pkgs.clang_15;
|
||||
home-daemon = callPackage ./home-daemon { };
|
||||
ghidra = pkgs.ghidra.overrideAttrs (old: {
|
||||
patches = old.patches ++ [ ./ghidra-stdcall.patch ];
|
||||
});
|
||||
lalrpop = callPackage ./lalrpop { };
|
||||
# pin version
|
||||
looking-glass-client = pkgs.looking-glass-client.overrideAttrs (old: {
|
||||
version = "B6";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "gnif";
|
||||
repo = "LookingGlass";
|
||||
rev = "B6";
|
||||
sha256 = "sha256-6vYbNmNJBCoU23nVculac24tHqH7F4AZVftIjL93WJU=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
});
|
||||
proton-ge = pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit (sources.proton-ge) pname version src;
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
tar -C $out --strip=1 -x -f $src
|
||||
'';
|
||||
};
|
||||
rofi-steam-game-list = callPackage ./rofi-steam-game-list { };
|
||||
techmino = callPackage ./techmino { };
|
||||
|
||||
firefox-addons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; });
|
||||
mpvScripts = pkgs.mpvScripts // (callPackage ./mpv-scripts { });
|
||||
}
|
||||
|
|
48
home/pkgs/firefox-addons/default.nix
Normal file
48
home/pkgs/firefox-addons/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, nur
|
||||
, sources
|
||||
, ... }:
|
||||
|
||||
let
|
||||
buildExtension = { pname, version, src, id, meta ? { } }: pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit pname version src meta;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = true;
|
||||
buildCommand = ''
|
||||
dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||
mkdir -p "$dst"
|
||||
install -v -m644 "$src" "$dst/"'${id}'
|
||||
'';
|
||||
};
|
||||
in
|
||||
(import ./generated.nix {
|
||||
inherit lib stdenv fetchurl;
|
||||
inherit (nur.repos.rycee.firefox-addons) buildFirefoxXpiAddon;
|
||||
}) // {
|
||||
# addons.mozilla.org's version is horribly outdated for whatever reason
|
||||
# I guess the extension normally autoupdates by itself?
|
||||
# this is an unsigned build
|
||||
yomichan = buildExtension {
|
||||
inherit (sources.yomichan) pname version src;
|
||||
id = "alex.testing@foosoft.net.xpi";
|
||||
meta = with lib; {
|
||||
homepage = "https://foosoft.net/projects/yomichan";
|
||||
description = "Yomichan turns your browser into a tool for building Japanese language literacy by helping you to decipher texts which would be otherwise too difficult tackle. It features a robust dictionary with EPWING and flashcard creation support";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
fastforward = buildExtension {
|
||||
inherit (sources.fastforward) pname version src;
|
||||
id = "addon@fastforward.team";
|
||||
meta = with lib; {
|
||||
homepage = "https://fastforward.team";
|
||||
description = "Don't waste time with compliance. Use FastForward to skip annoying URL \"shorteners\"";
|
||||
license = licenses.unlicense;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
}
|
6
home/pkgs/mpv-scripts/default.nix
Normal file
6
home/pkgs/mpv-scripts/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ callPackage
|
||||
, ... }:
|
||||
|
||||
{
|
||||
subserv = callPackage ./subserv.nix { };
|
||||
}
|
36
home/pkgs/mpv-scripts/subserv.nix
Normal file
36
home/pkgs/mpv-scripts/subserv.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ stdenv
|
||||
, fetchFromGitHub
|
||||
, mpv-unwrapped
|
||||
, port ? 1337
|
||||
, secondary ? false
|
||||
, ... }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "subserv-mpv-plugin";
|
||||
version = "0.1";
|
||||
src = fetchFromGitHub {
|
||||
owner = "kaervin";
|
||||
repo = "subserv-mpv-plugin";
|
||||
rev = "08e312f02f3d3608d61944247d39148c34215f75";
|
||||
sha256 = "sha256-CXyp+AAgyocAEbhuMMPVDlAiocozPe8tm/dIUofCRL8=";
|
||||
};
|
||||
buildInputs = [ mpv-unwrapped ];
|
||||
installFlags = [ "SCRIPTS_DIR=$(out)/share/mpv/scripts" ];
|
||||
stripDebugList = [ "share/mpv/scripts" ];
|
||||
passthru.scriptName = "subserv.so";
|
||||
patchPhase = ''
|
||||
sed -i 's%<client.h>%<mpv/client.h>%' subserv.c
|
||||
sed -i 's%printf("Hello%// printf("Hello%' subserv.c
|
||||
sed -i 's%printf("Got event%// printf("Got event%' subserv.c
|
||||
sed -i 's/PORT 8080/PORT ${builtins.toString port}/' subserv.c
|
||||
'' + (if secondary then ''
|
||||
sed -i 's/sub-text/secondary-sub-text/g' subserv.c
|
||||
'' else "");
|
||||
buildPhase = ''
|
||||
gcc -o subserv.so subserv.c -shared -fPIC
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/mpv/scripts
|
||||
cp subserv.so $out/share/mpv/scripts
|
||||
'';
|
||||
}
|
|
@ -1,16 +1,18 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
let
|
||||
cfg = config.vfio;
|
||||
in {
|
||||
options.vfio = with lib; mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable AMD GPU passthrough config (no intel/nvidia support since I can't test it)";
|
||||
description = "Enable GPU passthrough config (probably no intel/nvidia support since I can't test it)";
|
||||
};
|
||||
libvirtdGroup = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = ["user"];
|
||||
default = [ ];
|
||||
description = "Users to add to libvirtd group";
|
||||
};
|
||||
intelCpu = mkOption {
|
||||
|
@ -18,6 +20,11 @@
|
|||
default = false;
|
||||
description = "Whether the CPU is Intel (untested)";
|
||||
};
|
||||
nvidiaGpu = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether the GPU is Nvidia (disables AMD-specific workarounds)";
|
||||
};
|
||||
passGpuAtBoot = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
@ -50,28 +57,43 @@
|
|||
};
|
||||
};
|
||||
});
|
||||
default = [];
|
||||
default = if builtins.length cfg.libvirtdGroup == 1 then [
|
||||
{ owner = builtins.head cfg.libvirtdGroup; }
|
||||
] else [ ];
|
||||
example = [ { size = 32; owner = "user"; } ];
|
||||
description = "IVSHMEM/kvmfr config (multiple devices can be created: /dev/kvmfr0, /dev/kvmfr1, and so on)";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
description = "Looking glass config";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
description = "VFIO settings";
|
||||
};
|
||||
config = lib.mkIf config.vfio.enable
|
||||
(let
|
||||
cfg = config.vfio;
|
||||
gpuIDs = lib.concatStringsSep "," cfg.pciIDs;
|
||||
enableIvshmem = config.vfio.lookingGlass.enable && (builtins.length config.vfio.lookingGlass.ivshmem) > 0;
|
||||
in {
|
||||
# add a custom kernel param for early loading vfio drivers
|
||||
# because if we change boot.initrd options in a specialization, two initrds will be built
|
||||
# and we don't want to build two initrds
|
||||
specialisation.vfio.configuration = lib.mkIf (!cfg.passGpuAtBoot) {
|
||||
boot.kernelParams = [ "early_load_vfio" ];
|
||||
|
||||
# I can't enable early KMS with VFIO, so this will have to do
|
||||
# (amdgpu resets the font upon being loaded)
|
||||
systemd.services."systemd-vconsole-setup2" = lib.mkIf (!cfg.nvidiaGpu) {
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${pkgs.systemd}/lib/systemd/systemd-vconsole-setup";
|
||||
};
|
||||
wantedBy = [ "graphical.target" ];
|
||||
wants = [ "multi-user.target" ];
|
||||
after = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
boot = {
|
||||
initrd.postDeviceCommands = lib.mkIf (!cfg.passGpuAtBoot) ''
|
||||
|
@ -86,6 +108,9 @@
|
|||
modprobe vfio
|
||||
modprobe vfio_iommu_type1
|
||||
modprobe vfio_pci
|
||||
${if cfg.nvidiaGpu then "" else ''
|
||||
else
|
||||
modprobe amdgpu''}
|
||||
fi
|
||||
'';
|
||||
initrd.kernelModules = [
|
||||
|
@ -103,12 +128,12 @@
|
|||
extraModulePackages =
|
||||
with config.boot.kernelPackages;
|
||||
lib.mkIf enableIvshmem [ kvmfr ];
|
||||
extraModprobeConfig = let ivshmemConfig = if enableIvshmem then ''
|
||||
options kvmfr static_size_mb=${lib.concatStringsSep "," (map (x: toString x.size) cfg.lookingGlass.ivshmem)}
|
||||
'' else ""; in ''
|
||||
extraModprobeConfig = ''
|
||||
options vfio-pci ids=${gpuIDs} disable_idle_d3=1
|
||||
options kvm ignore_msrs=1
|
||||
${ivshmemConfig}
|
||||
${if enableIvshmem then ''
|
||||
options kvmfr static_size_mb=${lib.concatStringsSep "," (map (x: toString x.size) cfg.lookingGlass.ivshmem)}''
|
||||
else ""}
|
||||
'';
|
||||
kernelParams = [
|
||||
(if cfg.intelCpu then "intel_iommu=on" else "amd_iommu=on")
|
||||
|
@ -119,7 +144,7 @@
|
|||
] ++ (if enableIvshmem then [ "kvmfr" ] else []);
|
||||
};
|
||||
services.udev.extraRules = lib.mkIf enableIvshmem
|
||||
(lib.concatStringsSep
|
||||
(builtins.concatStringsSep
|
||||
"\n"
|
||||
(lib.imap0
|
||||
(i: ivshmem: ''
|
||||
|
@ -127,7 +152,7 @@
|
|||
'')
|
||||
cfg.lookingGlass.ivshmem));
|
||||
# disable early KMS so GPU can be properly unbound
|
||||
hardware.amdgpu.loadInInitrd = false;
|
||||
hardware.amdgpu.loadInInitrd = lib.mkIf (!cfg.nvidiaGpu) false;
|
||||
hardware.opengl.enable = true;
|
||||
# needed for virt-manager
|
||||
programs.dconf.enable = true;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
generateRegistryFromInputs = true;
|
||||
linkInputs = true;
|
||||
};
|
||||
nixpkgs.overlays = [(self: super: import ./pkgs { pkgs = super; })];
|
||||
}
|
||||
];
|
||||
hosts = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, nixpkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
efiPart = "/dev/disk/by-uuid/D77D-8CE0";
|
||||
|
||||
|
@ -13,6 +13,7 @@ in {
|
|||
system.stateVersion = "22.11";
|
||||
|
||||
### SECTION 1: HARDWARE/BOOT PARAMETERS ###
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [ "nvme" "xhci_pci" ];
|
||||
|
@ -66,6 +67,8 @@ in {
|
|||
};
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_zen;
|
||||
};
|
||||
|
||||
# for testing different zen kernel versions:
|
||||
# specialisation = let
|
||||
# zenKernels = pkgs.callPackage "${nixpkgs}/pkgs/os-specific/linux/kernel/zen-kernels.nix";
|
||||
# zenKernel = (version: sha256: (zenKernels {
|
||||
|
@ -87,28 +90,28 @@ in {
|
|||
# in {
|
||||
# zen619.configuration.boot.kernelPackages = pkgs.linuxPackagesFor (zenKernel "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv");
|
||||
# };
|
||||
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: (lib.getName pkg) == "steam-original";
|
||||
console.font = "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz";
|
||||
hardware = {
|
||||
steam-hardware.enable = true;
|
||||
enableRedistributableFirmware = true;
|
||||
opengl.driSupport32Bit = true;
|
||||
# sway WLR_RENDERER=vulkan
|
||||
# needed for sway WLR_RENDERER=vulkan
|
||||
opengl.extraPackages = with pkgs; [ vulkan-validation-layers ];
|
||||
};
|
||||
|
||||
services.tlp.settings = {
|
||||
USB_DENYLIST = "0bda:8156";
|
||||
USB_EXCLUDE_PHONE = 1;
|
||||
START_CHARGE_THRESH_BAT0 = 75;
|
||||
STOP_CHARGE_THRESH_BAT0 = 80;
|
||||
# fix for my realtek usb ethernet adapter
|
||||
USB_DENYLIST = "0bda:8156";
|
||||
};
|
||||
|
||||
# see common/vfio.nix
|
||||
vfio.enable = true;
|
||||
vfio.pciIDs = [ "1002:73df" "1002:ab28" ];
|
||||
vfio.libvirtdGroup = [ "user" ];
|
||||
vfio.lookingGlass.ivshmem = [{ owner = "user"; }];
|
||||
|
||||
fileSystems = let
|
||||
device = cryptroot;
|
||||
|
@ -130,6 +133,7 @@ in {
|
|||
options = [ discard "subvol=@swap" "noatime" ]; };
|
||||
"/home" = { inherit device fsType;
|
||||
options = [ discard compress "subvol=@home" ]; };
|
||||
# why am I even bothering with creating this subvolume every time if I don't use snapshots anyway?
|
||||
"/.snapshots" =
|
||||
{ inherit device fsType;
|
||||
options = [ discard compress "subvol=@snapshots" ]; };
|
||||
|
@ -181,23 +185,75 @@ in {
|
|||
|
||||
swapDevices = [ { device = "/swap/swapfile"; } ];
|
||||
|
||||
services.ratbagd.enable = true;
|
||||
# dedupe
|
||||
services.beesd = {
|
||||
# i have a lot of ram :tonystark:
|
||||
filesystems.cryptroot = {
|
||||
spec = "UUID=${cryptrootUuid}";
|
||||
hashTableSizeMB = 128;
|
||||
extraOptions = [ "--loadavg-target" "8.0" ];
|
||||
};
|
||||
filesystems.dataroot = {
|
||||
spec = "UUID=${datarootUuid}";
|
||||
hashTableSizeMB = 256;
|
||||
extraOptions = [ "--loadavg-target" "8.0" ];
|
||||
};
|
||||
};
|
||||
|
||||
### SECTION 2: SYSTEM CONFIG/ENVIRONMENT ###
|
||||
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
|
||||
i18n.supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ];
|
||||
i18n.supportedLocales = lib.mkDefault [
|
||||
"C.UTF-8/UTF-8"
|
||||
"en_US.UTF-8/UTF-8"
|
||||
"en_DK.UTF-8/UTF-8"
|
||||
];
|
||||
# ISO-8601
|
||||
i18n.extraLocaleSettings.LC_TIME = "en_DK.UTF-8";
|
||||
|
||||
console.font = "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz";
|
||||
|
||||
networking.useDHCP = true;
|
||||
# networking.firewall.enable = false;
|
||||
# KDE connect: 1714-1764
|
||||
networking.firewall.allowedTCPPorts = [ 27015 25565 7777 ] ++ (builtins.genList (x: 1714 + x) (1764 - 1714 + 1));
|
||||
networking.firewall.allowedUDPPorts = (builtins.genList (x: 1714 + x) (1764 - 1714 + 1));
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
27015
|
||||
25565
|
||||
7777
|
||||
]
|
||||
# kde connect
|
||||
++ (lib.range 1714 1764);
|
||||
networking.firewall.allowedUDPPorts = lib.range 1714 1764;
|
||||
# networking.hostName = "nixmsi";
|
||||
networking.wireless.iwd.enable = true;
|
||||
#networking.networkmanager.enable = true;
|
||||
|
||||
services.ratbagd.enable = true;
|
||||
|
||||
services.mullvad-vpn.enable = true;
|
||||
services.mullvad-vpn.package = pkgs.mullvad-vpn;
|
||||
|
||||
# System76 scheduler (not actually a scheduler, just a renice daemon) for improved responsiveness
|
||||
services.dbus.packages = [ pkgs.system76-scheduler ];
|
||||
systemd.services."system76-scheduler" = {
|
||||
description = "Automatically configure CPU scheduler for responsiveness on AC";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "dbus";
|
||||
BusName= "com.system76.Scheduler";
|
||||
ExecStart = "${pkgs.system76-scheduler}/bin/system76-scheduler daemon";
|
||||
ExecReload = "${pkgs.system76-scheduler}/bin/system76-scheduler daemon reload";
|
||||
};
|
||||
};
|
||||
environment.etc."system76-scheduler/assignments.ron".source =
|
||||
"${pkgs.system76-scheduler}/etc/system76-scheduler/assignments.ron";
|
||||
environment.etc."system76-scheduler/config.ron".source =
|
||||
"${pkgs.system76-scheduler}/etc/system76-scheduler/config.ron";
|
||||
environment.etc."system76-scheduler/exceptions.ron".source =
|
||||
"${pkgs.system76-scheduler}/etc/system76-scheduler/exceptions.ron";
|
||||
|
||||
# i wanted to be able to use both x and wayland... but honestly wayland is enough for me
|
||||
services.xserver.libinput.enable = true;
|
||||
/*
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
libinput.enable = true;
|
||||
|
@ -205,7 +261,7 @@ in {
|
|||
# I couldn't get lightdm to start sway, so let's just do this
|
||||
displayManager.startx.enable = true;
|
||||
windowManager.i3.enable = true;
|
||||
};
|
||||
};*/
|
||||
programs.sway.enable = true;
|
||||
programs.firejail.enable = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@ -215,8 +271,11 @@ in {
|
|||
man-pages man-pages-posix
|
||||
];
|
||||
services.dbus.enable = true;
|
||||
# I don't remember whether I really need this...
|
||||
security.polkit.enable = true;
|
||||
services.printing.enable = true;
|
||||
|
||||
# pipewire:
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
|
@ -289,57 +348,7 @@ in {
|
|||
# why is this not part of base NixOS?
|
||||
systemd.tmpfiles.rules = [ "d /var/lib/systemd/pstore 0755 root root 14d" ];
|
||||
|
||||
# dedupe
|
||||
|
||||
services.beesd = {
|
||||
# i have a lot of ram :tonystark:
|
||||
filesystems.cryptroot = {
|
||||
spec = "UUID=${cryptrootUuid}";
|
||||
hashTableSizeMB = 128;
|
||||
extraOptions = [ "--loadavg-target" "8.0" ];
|
||||
};
|
||||
filesystems.dataroot = {
|
||||
spec = "UUID=${datarootUuid}";
|
||||
hashTableSizeMB = 256;
|
||||
extraOptions = [ "--loadavg-target" "8.0" ];
|
||||
};
|
||||
};
|
||||
|
||||
# System76 scheduler (not actually a scheduler, just a renice daemon) for improved responsiveness
|
||||
|
||||
services.dbus.packages = [ pkgs.system76-scheduler ];
|
||||
systemd.services."system76-scheduler" = {
|
||||
description = "Automatically configure CPU scheduler for responsiveness on AC";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "dbus";
|
||||
BusName= "com.system76.Scheduler";
|
||||
ExecStart = "${pkgs.system76-scheduler}/bin/system76-scheduler daemon";
|
||||
ExecReload = "${pkgs.system76-scheduler}/bin/system76-scheduler daemon reload";
|
||||
};
|
||||
};
|
||||
environment.etc."system76-scheduler/assignments.ron".source =
|
||||
lib.mkOptionDefault "${pkgs.system76-scheduler}/etc/system76-scheduler/assignments.ron";
|
||||
environment.etc."system76-scheduler/config.ron".source =
|
||||
lib.mkOptionDefault "${pkgs.system76-scheduler}/etc/system76-scheduler/config.ron";
|
||||
environment.etc."system76-scheduler/exceptions.ron".source =
|
||||
lib.mkOptionDefault "${pkgs.system76-scheduler}/etc/system76-scheduler/exceptions.ron";
|
||||
|
||||
# I can't enable early KMS with VFIO, so this will have to do
|
||||
# (amdgpu resets the font upon being loaded)
|
||||
systemd.services."systemd-vconsole-setup2" = {
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${pkgs.systemd}/lib/systemd/systemd-vconsole-setup";
|
||||
};
|
||||
wantedBy = ["graphical.target"];
|
||||
wants = ["multi-user.target"];
|
||||
after = ["multi-user.target"];
|
||||
};
|
||||
|
||||
# autologin once after boot
|
||||
|
||||
# --skip-login means directly call login instead of first asking for username
|
||||
# (normally login asks for username too, but getty prefers to do it by itself for whatever reason)
|
||||
services.getty.extraArgs = ["--skip-login"];
|
||||
|
@ -354,10 +363,5 @@ in {
|
|||
exec ${shadow}/bin/login -f user
|
||||
fi
|
||||
'';
|
||||
|
||||
# overlays
|
||||
nixpkgs.overlays = [(self: super: {
|
||||
system76-scheduler = super.callPackage ../pkgs/system76-scheduler.nix { };
|
||||
})];
|
||||
}
|
||||
|
||||
|
|
3
system/pkgs/default.nix
Normal file
3
system/pkgs/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{ pkgs, ... }: let inherit (pkgs) callPackage; in {
|
||||
system76-scheduler = callPackage ../pkgs/system76-scheduler.nix { };
|
||||
}
|
Loading…
Reference in a new issue