[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 =
{ 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 = {
altair = (import ./system/hosts/altair) {
inherit inputs;
inherit self;
nixpkgs = inputs.nixpkgs-unstable;
altair = mkNixosConfig {
path = ./system/hosts/altair;
};
mcp = (import ./system/hosts/mcp) {
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; [
# Gaming
@@ -16,12 +28,15 @@
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-cf = {
xdg.desktopEntries.wowup-cf = local.electronDesktopEntry {
name = "WowUp";
# Custom options to reduce flickering under wayland.
exec = "wowup-cf --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu %U";
exec = "wowup-cf --no-sandbox";
terminal = false;
type = "Application";
icon = "wowup-cf";
@@ -30,5 +45,4 @@
"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
./hardware-configuration.nix
../../authorized-keys.nix
inputs.home-manager.nixosModules.home-manager
{
];
nixpkgs.config.allowUnfree = true;
home-manager.users.drew =
{ ... }:
{
@@ -15,14 +17,4 @@ nixpkgs.lib.nixosSystem {
./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
localHostRuleHavenisms
havenisms
blazestar;
blazestar
;
mkContainer = {
mkContainer =
{
image,
hostName,
port,
@@ -33,10 +34,18 @@ in
environmentFiles ? [ ],
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
{
inherit image dependsOn volumes environment environmentFiles ports;
inherit
image
dependsOn
volumes
environment
environmentFiles
ports
;
hostname = "${hostName}.${domain}";
autoStart = true;
extraOptions = [
@@ -57,13 +66,16 @@ in
# user.
#
# Note that this returns a _module_ so that it can be imported and provide many different config values.
mkMariaDbContainer = {
mkMariaDbContainer =
{
name,
uid,
gid,
passwordSecret,
directory,
}: { config, ... }: {
}:
{ config, ... }:
{
virtualisation.oci-containers.containers."${name}-mariadb" = {
image = "lscr.io/linuxserver/mariadb:latest";
autoStart = true;