Compare commits

..

1 commit

Author SHA1 Message Date
Fabian Montero 2bfcb22a22
add firefox module 2025-02-07 13:43:01 -06:00
6 changed files with 77 additions and 86 deletions

View file

@ -16,12 +16,6 @@
in
flake-utils.lib.eachDefaultSystem (system: {
formatter = (import nixpkgs {inherit system;}).alejandra;
packages =
(import nixpkgs {
inherit system;
overlays = [(mapOverlayOverride "local" (import ./pkgs))];
}).local;
})
// {
templates = let

View file

@ -1 +1,10 @@
{}
{
config,
lib,
pkgs,
...
}: {
imports = [
./programs
];
}

10
hm/programs/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./firefox
];
}

View file

@ -0,0 +1,57 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.options.trivium.programs.firefox;
in {
options.options.trivium.programs.firefox = {
enable = mkEnableOption "firefox settings";
workspace = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
i3 Workspace in which Firefox should open. If not set, Firefox will not open at startup
'';
};
makeDefaultBrowser = mkOption {
type = types.bool;
default = true;
description = ''
Take a guess
'';
};
};
config = mkIf cfg.enable (mkMerge [
{
programs.firefox.enable = true;
xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) {
command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'";
};
}
(mkIf cfg.makeDefaultBrowser {
xdg = {
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = ["firefox"];
"text/uri-list" = ["firefox"];
"x-scheme-handler/http" = ["firefox"];
"x-scheme-handler/https" = ["firefox"];
"x-scheme-handler/about" = ["firefox"];
"x-scheme-handler/unknown" = ["firefox"];
};
};
};
home.sessionVariables.DEFAULT_BROWSER = "${lib.getExe pkgs.firefox}";
})
]);
}

View file

@ -5,6 +5,4 @@ in {
lib = callPackage ./lib {};
override = {};
spliit = callPackage ./spliit {};
}

View file

@ -1,77 +0,0 @@
{
buildNpmPackage,
fetchFromGitHub,
nodePackages,
lib,
writeShellScriptBin,
pkgs
}:
let
schemaEngine = "${pkgs.prisma-engines}/bin/schema-engine";
queryEngineBin = "${pkgs.prisma-engines}/bin/query-engine";
queryEngineLib = "${pkgs.prisma-engines}/lib/libquery_engine.node";
buildFlags = [ "--ignore-scripts" ];
in
buildNpmPackage {
pname = "spliit2";
version = "master-20250420";
src = fetchFromGitHub {
repo = "spliit";
owner = "spliit-app";
rev = "a11efc79c13298c0d282e47496d132538752405f";
hash = "sha256-v4gaPzLzBbbqw/LDYxe1fiyficcrqcGOop23YPiTrdc=";
};
npmDepsHash = "sha256-sd0/7ruNUFxUKTeTwx/v8Vc/G3llkXP6RSDE78h3qVU=";
nativeBuildInputs = [ pkgs.openssl ];
npmRebuildFlags = buildFlags;
PRISMA_SCHEMA_ENGINE_BINARY = schemaEngine;
PRISMA_QUERY_ENGINE_BINARY = queryEngineBin;
PRISMA_QUERY_ENGINE_LIBRARY = queryEngineLib;
preBuild = ''
cp -v scripts/build.env .env
npx prisma generate
'';
npmBuildFlags = buildFlags;
postInstall = ''
cp -r .next public package.json next.config.mjs $out/lib/node_modules/spliit2
install -Dvm755 -t $out/bin ${lib.getExe (writeShellScriptBin "spliit2" ''
set -euxo pipefail
cd @out@/lib/node_modules/spliit2
export PATH="$PWD/node_modules/.bin:$PATH"
export NEXT_TELEMETRY_DISABLED=1
export PRISMA_SCHEMA_ENGINE_BINARY="${schemaEngine}"
export PRISMA_QUERY_ENGINE_BINARY="${queryEngineBin}"
export PRISMA_QUERY_ENGINE_LIBRARY="${queryEngineLib}"
prisma migrate deploy
next start
'')}
substituteInPlace $out/bin/spliit2 \
--replace @out@ $out
wrapProgram $out/bin/spliit2 \
--prefix PATH : ${lib.makeBinPath [ pkgs.openssl ]}
'';
meta = {
description = "Free and Open Source Alternative to Splitwise. Share expenses with your friends and family.";
homepage = "https://spliit.app";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [];
};
}