treewide: yet another restructure
modules, overlays, and packages have their own default.nix re-exporting things instead of reading file paths. slightly improves declarativeness. wine-osu is removed; we're just using nix-gaming (for now). our custom packages will now have to be accessed via pkgs.me instead of just pkgs. helps know where it came from future goals: get rid of our overlays completely, or at least not make it replace anything from nixpkgs
This commit is contained in:
parent
eb0f2cb733
commit
8c75ba2a2d
14 changed files with 96 additions and 11552 deletions
68
flake.nix
68
flake.nix
|
|
@ -48,66 +48,32 @@
|
|||
|
||||
outputs = { self, agenix, nixpkgs, home-manager, ... } @ inputs:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
getPaths = root: builtins.map
|
||||
(path: root + ("/" + path)) # Prepends root path
|
||||
(builtins.attrNames (builtins.readDir root)); # Reads root path
|
||||
|
||||
modules =
|
||||
let
|
||||
getName = path: lib.removeSuffix ".nix" ( # Strip extension
|
||||
lib.last ( # Gets the last part (filename)
|
||||
lib.splitString "/" ( # Splits the path into components
|
||||
builtins.toString path # Converts the path into a string
|
||||
)
|
||||
)
|
||||
);
|
||||
genModulePaths = basePath: builtins.listToAttrs (
|
||||
builtins.map (path: {
|
||||
name = getName path;
|
||||
value = path;
|
||||
}) (getPaths basePath)
|
||||
);
|
||||
in {
|
||||
user = genModulePaths ./modules/user;
|
||||
system = genModulePaths ./modules/system;
|
||||
};
|
||||
|
||||
customPackages = pkgs:
|
||||
let
|
||||
callPackage = pkgs.callPackage;
|
||||
in {
|
||||
discord-tokyonight = callPackage ./packages/discord-tokyonight { inherit inputs; };
|
||||
discover-overlay = callPackage ./packages/discover { inherit inputs; };
|
||||
linux-lava = callPackage ./packages/linux-lava { inherit inputs; };
|
||||
packwiz = callPackage ./packages/packwiz { inherit inputs; };
|
||||
spotify-adblock = callPackage ./packages/spotify-adblock { inherit inputs; };
|
||||
tree-sitter-glimmer = callPackage ./packages/tree-sitter-glimmer { inherit inputs; };
|
||||
tree-sitter-jsonc = callPackage ./packages/tree-sitter-jsonc { inherit inputs; };
|
||||
wine-osu = callPackage ./packages/wine-osu { inherit getPaths; };
|
||||
};
|
||||
|
||||
overlays = [ (self: super: { inherit inputs; }) ] ++ (builtins.map
|
||||
(path: import path) # Imports path
|
||||
(builtins.filter
|
||||
(path: lib.hasSuffix ".nix" path) # Checks file extension
|
||||
(getPaths ./overlays)
|
||||
)
|
||||
) ++ [(self: super: customPackages super)]
|
||||
overlays = (import ./overlays)
|
||||
++ [inputs.neovim-nightly.overlay]
|
||||
++ [inputs.powercord-overlay.overlay];
|
||||
++ [inputs.powercord-overlay.overlay]
|
||||
++ [(final: prev: {
|
||||
me = prev.callPackage ./packages { inherit inputs; } // { inherit inputs; };
|
||||
})];
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit overlays;
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
|
||||
lib = pkgs.lib;
|
||||
modules = import ./modules { inherit lib; };
|
||||
|
||||
mkSystem =
|
||||
if !(self ? rev) then throw "Dirty git tree detected." else
|
||||
name: arch: enableGUI: lib.nixosSystem {
|
||||
name: arch: enableGUI: nixpkgs.lib.nixosSystem {
|
||||
system = arch;
|
||||
modules = [
|
||||
{ nixpkgs.overlays = overlays; }
|
||||
home-manager.nixosModules.home-manager
|
||||
agenix.nixosModules.age
|
||||
(./hosts + "/${name}")
|
||||
];
|
||||
specialArgs = { inherit inputs modules overlays enableGUI; };
|
||||
specialArgs = { inherit inputs modules enableGUI; };
|
||||
};
|
||||
in
|
||||
{
|
||||
|
|
@ -115,6 +81,6 @@
|
|||
nixosConfigurations."blossom" = mkSystem "blossom" "x86_64-linux" true;
|
||||
nixosConfigurations."fondue" = mkSystem "fondue" "x86_64-linux" false;
|
||||
|
||||
packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux;
|
||||
packages.x86_64-linux = pkgs.me;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@
|
|||
"intel_pstate=passive"
|
||||
"msr.allow_writes=on"
|
||||
];
|
||||
kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.linux-lava);
|
||||
kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.me.linux-lava);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
51
modules/default.nix
Normal file
51
modules/default.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{ lib }:
|
||||
let
|
||||
getName = path: lib.removeSuffix ".nix" ( # Strip extension
|
||||
lib.last ( # Gets the last part (filename)
|
||||
lib.splitString "/" ( # Splits the path into components
|
||||
builtins.toString path # Converts the path into a string
|
||||
)
|
||||
)
|
||||
);
|
||||
mkAttrsFromPaths = paths: builtins.listToAttrs (
|
||||
builtins.map (path: {
|
||||
name = getName path;
|
||||
value = path;
|
||||
}) paths
|
||||
);
|
||||
in {
|
||||
system = mkAttrsFromPaths [
|
||||
./system/audio.nix
|
||||
./system/base.nix
|
||||
./system/gui.nix
|
||||
./system/input.nix
|
||||
./system/kernel.nix
|
||||
./system/nix.nix
|
||||
./system/packages.nix
|
||||
./system/security.nix
|
||||
./system/snapper.nix
|
||||
./system/transmission.nix
|
||||
./system/wireguard.nix
|
||||
];
|
||||
user = mkAttrsFromPaths [
|
||||
./user/bspwm.nix
|
||||
./user/direnv.nix
|
||||
./user/dunst.nix
|
||||
./user/git.nix
|
||||
./user/gpg.nix
|
||||
./user/kitty.nix
|
||||
./user/mpv.nix
|
||||
./user/neovim.nix
|
||||
./user/npm.nix
|
||||
./user/packages-rin.nix
|
||||
./user/picom.nix
|
||||
./user/polybar.nix
|
||||
./user/rofi.nix
|
||||
./user/sessionVariables.nix
|
||||
./user/sxhkd.nix
|
||||
./user/theming.nix
|
||||
./user/xdg.nix
|
||||
./user/xorg.nix
|
||||
./user/zsh.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -20,7 +20,6 @@
|
|||
};
|
||||
nix.registry.config.flake = inputs.self;
|
||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
nixpkgs.overlays = overlays;
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ in {
|
|||
(nvim-treesitter.withPlugins (p: with p; [
|
||||
tree-sitter-comment
|
||||
tree-sitter-c-sharp
|
||||
pkgs.tree-sitter-glimmer
|
||||
pkgs.me.tree-sitter-glimmer
|
||||
tree-sitter-html
|
||||
tree-sitter-javascript
|
||||
tree-sitter-jsdoc
|
||||
tree-sitter-json
|
||||
pkgs.tree-sitter-jsonc
|
||||
pkgs.me.tree-sitter-jsonc
|
||||
tree-sitter-lua
|
||||
tree-sitter-nix
|
||||
tree-sitter-php
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
inputs.who-reacted
|
||||
];
|
||||
themes = [
|
||||
pkgs.discord-tokyonight
|
||||
pkgs.me.discord-tokyonight
|
||||
inputs.radialstatus
|
||||
inputs.tokyonight
|
||||
inputs.zelk
|
||||
|
|
|
|||
12
overlays/default.nix
Normal file
12
overlays/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
builtins.map (path: import path) [
|
||||
./discord.nix
|
||||
./material-icons.nix
|
||||
./mps-youtube.nix
|
||||
./osu-lazer.nix
|
||||
./picom.nix
|
||||
./polybar.nix
|
||||
./transcrypt.nix
|
||||
./tree-sitter.nix
|
||||
./winetricks.nix
|
||||
./xinit.nix
|
||||
]
|
||||
12
packages/default.nix
Normal file
12
packages/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
callPackage,
|
||||
inputs
|
||||
}: {
|
||||
discord-tokyonight = callPackage ./discord-tokyonight { inherit inputs; };
|
||||
discover-overlay = callPackage ./discover { inherit inputs; };
|
||||
linux-lava = callPackage ./linux-lava { inherit inputs; };
|
||||
packwiz = callPackage ./packwiz { inherit inputs; };
|
||||
spotify-adblock = callPackage ./spotify-adblock { inherit inputs; };
|
||||
tree-sitter-glimmer = callPackage ./tree-sitter-glimmer { inherit inputs; };
|
||||
tree-sitter-jsonc = callPackage ./tree-sitter-jsonc { inherit inputs; };
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
{ callPackage
|
||||
, getPaths
|
||||
, lib
|
||||
, winePackages
|
||||
, wineUnstable
|
||||
, wineStaging
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
sources = callPackage ./sources.nix {};
|
||||
in
|
||||
# TODO: Use winePackages.callPackage
|
||||
(wineStaging.override {
|
||||
wineRelease = "staging";
|
||||
wineBuild = "wineWow";
|
||||
|
||||
pngSupport = true;
|
||||
jpegSupport = true;
|
||||
tiffSupport = true;
|
||||
gettextSupport = true;
|
||||
fontconfigSupport = true;
|
||||
alsaSupport = true;
|
||||
gtkSupport = true;
|
||||
openglSupport = true;
|
||||
tlsSupport = true;
|
||||
gstreamerSupport = true;
|
||||
#cupsSupport = true;
|
||||
colorManagementSupport = true;
|
||||
dbusSupport = true;
|
||||
mpg123Support = true;
|
||||
#openalSupport = true;
|
||||
#openclSupport = true;
|
||||
#cairoSupport = true;
|
||||
#odbcSupport = true;
|
||||
netapiSupport = true;
|
||||
cursesSupport = true;
|
||||
vaSupport = true;
|
||||
pcapSupport = true;
|
||||
#v4lSupport = true;
|
||||
#saneSupport = true;
|
||||
gsmSupport = true;
|
||||
#gphoto2Support = true;
|
||||
#ldapSupport = true;
|
||||
pulseaudioSupport = true;
|
||||
udevSupport = true;
|
||||
xineramaSupport = true;
|
||||
xmlSupport = true;
|
||||
vulkanSupport = true;
|
||||
sdlSupport = true;
|
||||
faudioSupport = true;
|
||||
vkd3dSupport = true;
|
||||
mingwSupport = true;
|
||||
}).overrideDerivation (old: {
|
||||
inherit (sources) src;
|
||||
name = "wine-osu-${sources.version}-staging";
|
||||
patches = (old.patches or []) ++ getPaths ./patches;
|
||||
postPatch = wineUnstable.postPatch or "" + ''
|
||||
patchShebangs tools
|
||||
cp -r ${sources.staging}/patches .
|
||||
chmod +w patches
|
||||
cd patches
|
||||
patchShebangs gitapply.sh
|
||||
./patchinstall.sh DESTDIR="$PWD/.." --all ${lib.concatMapStringsSep " " (ps: "-W ${ps}") []}
|
||||
cd ..
|
||||
'';
|
||||
})
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,59 +0,0 @@
|
|||
From 4a2c23db4eddd827ac81513af43bc92475ad7d3a Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian 'gonX' Jensen <gonx@gonx.dk>
|
||||
Date: Sun, 20 Jun 2021 17:02:15 +0200
|
||||
Subject: [PATCH 2/4] 5.14 Latency Fix
|
||||
|
||||
---
|
||||
dlls/winepulse.drv/mmdevdrv.c | 22 ++++++++++++++--------
|
||||
1 file changed, 14 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
|
||||
index 07407089ac5af65eb13d6e00b6d0969a61ec5589..3ed47e38c830987e4bcc2e9f5c59c7773fe686f1 100644
|
||||
--- a/dlls/winepulse.drv/mmdevdrv.c
|
||||
+++ b/dlls/winepulse.drv/mmdevdrv.c
|
||||
@@ -68,9 +68,6 @@ enum DriverPriority {
|
||||
Priority_Preferred
|
||||
};
|
||||
|
||||
-static const REFERENCE_TIME MinimumPeriod = 30000;
|
||||
-static const REFERENCE_TIME DefaultPeriod = 100000;
|
||||
-
|
||||
static pa_context *pulse_ctx;
|
||||
static pa_mainloop *pulse_ml;
|
||||
|
||||
@@ -510,11 +507,12 @@ static void pulse_probe_settings(int render, WAVEFORMATEXTENSIBLE *fmt) {
|
||||
if (length)
|
||||
pulse_def_period[!render] = pulse_min_period[!render] = pa_bytes_to_usec(10 * length, &ss);
|
||||
|
||||
- if (pulse_min_period[!render] < MinimumPeriod)
|
||||
- pulse_min_period[!render] = MinimumPeriod;
|
||||
-
|
||||
- if (pulse_def_period[!render] < DefaultPeriod)
|
||||
- pulse_def_period[!render] = DefaultPeriod;
|
||||
+ const char* penv = getenv("STAGING_AUDIO_PERIOD");
|
||||
+ if (penv) {
|
||||
+ int val = atoi(penv);
|
||||
+ pulse_def_period[!render] = pulse_min_period[!render] = val;
|
||||
+ printf("Staging audio period set to %d.\n", val);
|
||||
+ }
|
||||
|
||||
wfx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
wfx->cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
|
||||
@@ -1640,6 +1638,14 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient2 *iface,
|
||||
if (duration <= 2 * period)
|
||||
period /= 2;
|
||||
}
|
||||
+
|
||||
+ const char* denv = getenv("STAGING_AUDIO_DURATION");
|
||||
+ if (denv) {
|
||||
+ int val = atoi(denv);
|
||||
+ duration = val;
|
||||
+ printf("Staging audio duration set to %d.\n", val);
|
||||
+ }
|
||||
+
|
||||
period_bytes = pa_frame_size(&This->ss) * MulDiv(period, This->ss.rate, 10000000);
|
||||
|
||||
if (duration < 20000000)
|
||||
--
|
||||
2.32.0
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
From e17fb0bda3c042beec05b918e2d171211742e01c Mon Sep 17 00:00:00 2001
|
||||
From: Torge Matthies <openglfreak@googlemail.com>
|
||||
Date: Fri, 12 Feb 2021 13:58:35 +0100
|
||||
Subject: [PATCH 3/4] secur32: Fix crash from invalid context in
|
||||
InitializeSecurityContextW.
|
||||
|
||||
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
|
||||
---
|
||||
dlls/secur32/schannel.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
|
||||
index 9c7e98b32a4c55588a78ac6c3811b89db9e09db7..b2baefbc8caaf370c9c0ec31b7daf4cc9bb7fbb8 100644
|
||||
--- a/dlls/secur32/schannel.c
|
||||
+++ b/dlls/secur32/schannel.c
|
||||
@@ -983,6 +983,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
|
||||
unsigned char *ptr;
|
||||
|
||||
ctx = schan_get_object(phContext->dwLower, SCHAN_HANDLE_CTX);
|
||||
+ if (!ctx) return SEC_E_INVALID_HANDLE;
|
||||
if (pInput)
|
||||
{
|
||||
idx = schan_find_sec_buffer_idx(pInput, 0, SECBUFFER_TOKEN);
|
||||
--
|
||||
2.32.0
|
||||
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
From b1ac42097f6f6e038a2e1fac773bc31e829fb891 Mon Sep 17 00:00:00 2001
|
||||
From: Torge Matthies <openglfreak@googlemail.com>
|
||||
Date: Mon, 5 Apr 2021 05:48:28 +0200
|
||||
Subject: [PATCH 4/4] kernelbase: Cache last used locale->sortguid mapping.
|
||||
|
||||
get_language_sort reads from the registry, which is not particularly fast.
|
||||
Staging's implementation of CompareStringEx calls this function, and if
|
||||
CompareStringEx is used in a loop over many elements, it will slow down the
|
||||
application by a lot (> 30 seconds vs a few hundred ms in osu!, depends
|
||||
on the CPU and the number of installed beatmaps).
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50923
|
||||
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
|
||||
---
|
||||
dlls/kernelbase/locale.c | 42 +++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 41 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
|
||||
index 89b3577505348a001577ba3549b8af2d1e6cb456..db97383f2858455f8c329f326d4b3f9f3ec606cb 100644
|
||||
--- a/dlls/kernelbase/locale.c
|
||||
+++ b/dlls/kernelbase/locale.c
|
||||
@@ -619,6 +619,21 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
};
|
||||
static CRITICAL_SECTION locale_section = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
+static struct
|
||||
+{
|
||||
+ WCHAR locale[LOCALE_NAME_MAX_LENGTH]; /* The locale name */
|
||||
+ const struct sortguid *guid; /* The cached associated GUID */
|
||||
+} sortguid_cache;
|
||||
+
|
||||
+static CRITICAL_SECTION sortguid_cache_section;
|
||||
+static CRITICAL_SECTION_DEBUG sortguid_cache_section_debug =
|
||||
+{
|
||||
+ 0, 0, &sortguid_cache_section,
|
||||
+ { &sortguid_cache_section_debug.ProcessLocksList, &sortguid_cache_section_debug.ProcessLocksList },
|
||||
+ 0, 0, { (DWORD_PTR)(__FILE__ ": sortguid_cache_section") }
|
||||
+};
|
||||
+static CRITICAL_SECTION sortguid_cache_section = { &sortguid_cache_section_debug, -1, 0, 0, 0, 0 };
|
||||
+
|
||||
|
||||
static void init_sortkeys( DWORD *ptr )
|
||||
{
|
||||
@@ -656,7 +671,7 @@ static const struct sortguid *find_sortguid( const GUID *guid )
|
||||
}
|
||||
|
||||
|
||||
-static const struct sortguid *get_language_sort( const WCHAR *locale )
|
||||
+static const struct sortguid *get_language_sort_uncached( const WCHAR *locale )
|
||||
{
|
||||
WCHAR *p, *end, buffer[LOCALE_NAME_MAX_LENGTH], guidstr[39];
|
||||
const struct sortguid *ret;
|
||||
@@ -699,6 +714,31 @@ done:
|
||||
}
|
||||
|
||||
|
||||
+static const struct sortguid *get_language_sort( const WCHAR *locale )
|
||||
+{
|
||||
+ const struct sortguid *ret = NULL;
|
||||
+
|
||||
+ if (!locale) return get_language_sort_uncached( locale );
|
||||
+
|
||||
+ RtlEnterCriticalSection( &sortguid_cache_section );
|
||||
+
|
||||
+ if (sortguid_cache.guid && !wcsncmp( sortguid_cache.locale, locale, LOCALE_NAME_MAX_LENGTH ))
|
||||
+ {
|
||||
+ ret = sortguid_cache.guid;
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ ret = get_language_sort_uncached( locale );
|
||||
+
|
||||
+ lstrcpynW( sortguid_cache.locale, locale, LOCALE_NAME_MAX_LENGTH );
|
||||
+ sortguid_cache.guid = ret;
|
||||
+
|
||||
+done:
|
||||
+ RtlLeaveCriticalSection( &sortguid_cache_section );
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static LCID locale_to_lcid( WCHAR *win_name )
|
||||
{
|
||||
WCHAR *p;
|
||||
--
|
||||
2.32.0
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
{ fetchFromGitHub, lib }:
|
||||
let
|
||||
version = "6.14";
|
||||
in {
|
||||
inherit version;
|
||||
src = builtins.fetchurl {
|
||||
url = "https://dl.winehq.org/wine/source/6.x/wine-${version}.tar.xz";
|
||||
sha256 = "sha256-ZLRxk5lDvAjjUQJ9tvvCRlwTllCjv/65Flf/DujCUgI=";
|
||||
};
|
||||
|
||||
staging = fetchFromGitHub {
|
||||
sha256 = "sha256-yzpRWNx/e3BDCh1dyf8VdjLgvu6yZ/CXre/cb1roaVs=";
|
||||
owner = "wine-staging";
|
||||
repo = "wine-staging";
|
||||
rev = "v${version}";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue