[nix] Messing around with how to override desktop files

This commit is contained in:
2025-04-17 20:03:18 -07:00
parent 828aaa5d40
commit c2a5e0a709
6 changed files with 138 additions and 84 deletions

View File

@@ -32,12 +32,36 @@
outputs = outputs =
{ self, nixpkgs, ... }@inputs: { self, nixpkgs, ... }@inputs:
let
local = import ./lib;
mkNixosConfig =
{
path,
system ? "x86_64-linux",
nixpkgs ? inputs.nixpkgs-unstable,
}:
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit inputs local;
};
}
path
];
specialArgs = {
inherit inputs local;
};
};
in
{ {
nixosConfigurations = { nixosConfigurations = {
altair = (import ./system/hosts/altair) { altair = mkNixosConfig {
inherit inputs; path = ./system/hosts/altair;
inherit self;
nixpkgs = inputs.nixpkgs-unstable;
}; };
mcp = (import ./system/hosts/mcp) { mcp = (import ./system/hosts/mcp) {
inherit inputs; inherit inputs;

View File

@@ -1,4 +1,16 @@
{ pkgs, ... }: { pkgs, local, ... }:
# let
# patched-desktop =
# pkgs.runCommand "patched-wowup-cf-desktop"
# {
# desktop = "${pkgs.wowup-cf}/share/applications/wowup-cf.desktop";
# }
# ''
# mkdir -p $out
# substitute "$desktop" "$out/wowup-cf.desktop" \
# --replace-fail 'Exec=wowup-cf' 'Exec=wowup-cf --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu'
# '';
# in
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
# Gaming # Gaming
@@ -16,12 +28,15 @@
wowup-cf wowup-cf
]; ];
xdg.desktopEntries = { # xdg.dataFile."applications/wowup-cf.desktop" = {
# force = true;
# source = "${patched-desktop}/wowup-cf.desktop";
# };
# wowup needs options to work under wayland. # wowup needs options to work under wayland.
wowup-cf = { xdg.desktopEntries.wowup-cf = local.electronDesktopEntry {
name = "WowUp"; name = "WowUp";
# Custom options to reduce flickering under wayland. exec = "wowup-cf --no-sandbox";
exec = "wowup-cf --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu %U";
terminal = false; terminal = false;
type = "Application"; type = "Application";
icon = "wowup-cf"; icon = "wowup-cf";
@@ -30,5 +45,4 @@
"Game" "Game"
]; ];
}; };
};
} }

3
lib/default.nix Normal file
View File

@@ -0,0 +1,3 @@
{
inherit (import ./electron.nix) electronDesktopEntry;
}

9
lib/electron.nix Normal file
View File

@@ -0,0 +1,9 @@
{
# Adds extra arguments to avoid flickering under wayland.
electronDesktopEntry =
desktop:
desktop
// {
exec = "${desktop.exec} --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu";
};
}

View File

@@ -1,13 +1,15 @@
{ nixpkgs, inputs, ... }: {
nixpkgs.lib.nixosSystem { ...
system = "x86_64-linux"; }:
modules = [ {
imports = [
./configuration.nix ./configuration.nix
./hardware-configuration.nix ./hardware-configuration.nix
../../authorized-keys.nix ../../authorized-keys.nix
inputs.home-manager.nixosModules.home-manager ];
{
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
home-manager.users.drew = home-manager.users.drew =
{ ... }: { ... }:
{ {
@@ -15,14 +17,4 @@ nixpkgs.lib.nixosSystem {
./drew.nix ./drew.nix
]; ];
}; };
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit inputs;
};
}
];
specialArgs = {
inherit inputs;
};
} }

View File

@@ -17,10 +17,11 @@ in
hostRuleHavenisms hostRuleHavenisms
localHostRuleHavenisms localHostRuleHavenisms
havenisms havenisms
blazestar; blazestar
;
mkContainer =
mkContainer = { {
image, image,
hostName, hostName,
port, port,
@@ -33,10 +34,18 @@ in
environmentFiles ? [ ], environmentFiles ? [ ],
public ? false, public ? false,
}: }:
let routerRule = if public then hostRule hostName domain else localHostRule hostName domain; let
routerRule = if public then hostRule hostName domain else localHostRule hostName domain;
in in
{ {
inherit image dependsOn volumes environment environmentFiles ports; inherit
image
dependsOn
volumes
environment
environmentFiles
ports
;
hostname = "${hostName}.${domain}"; hostname = "${hostName}.${domain}";
autoStart = true; autoStart = true;
extraOptions = [ extraOptions = [
@@ -57,13 +66,16 @@ in
# user. # user.
# #
# Note that this returns a _module_ so that it can be imported and provide many different config values. # Note that this returns a _module_ so that it can be imported and provide many different config values.
mkMariaDbContainer = { mkMariaDbContainer =
{
name, name,
uid, uid,
gid, gid,
passwordSecret, passwordSecret,
directory, directory,
}: { config, ... }: { }:
{ config, ... }:
{
virtualisation.oci-containers.containers."${name}-mariadb" = { virtualisation.oci-containers.containers."${name}-mariadb" = {
image = "lscr.io/linuxserver/mariadb:latest"; image = "lscr.io/linuxserver/mariadb:latest";
autoStart = true; autoStart = true;