refactor nix a bit
Some checks failed
installer / build (push) Failing after 37m49s

This commit is contained in:
Murphy 2025-01-03 09:21:31 -05:00
parent 43f4c0539d
commit 1c632d6245
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17
6 changed files with 118 additions and 64 deletions

View file

@ -15,31 +15,31 @@
};
outputs = {
self,
nixpkgs,
home-manager,
nixgl,
...
} @ inputs: let
inherit (self) outputs;
}:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
overlays = [
nixgl.overlay
];
username = "freya";
in {
homeConfigurations."freya" =
homeConfigurations.${username} =
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {inherit inputs outputs;};
pkgs = nixpkgs.legacyPackages.${system};
modules = [
{nixpkgs.overlays = overlays;}
./home.nix
{
({
_module.args = {
inherit nixgl;
};
}
nixpkgs.overlays = [ nixgl.overlay ];
home = {
inherit username;
homeDirectory = "/home/${username}";
stateVersion = "25.05";
};
})
];
};
};

View file

@ -1,19 +1,17 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
imports = [
./programs
./programs/firefox.nix
./programs/home-manager.nix
];
news.display = "silent";
fonts.fontconfig.enable = true;
nixpkgs.config.allowUnfree = true;
programs.home-manager.enable = true;
home = {
username = "freya";
homeDirectory = "/home/freya";
stateVersion = "25.05";
packages = with pkgs; [
# shell
starship
@ -27,13 +25,7 @@
rust-analyzer
cargo
clippy
# unity
unityhub
# libs
openssl
libgcc
];
};
}

View file

@ -1,5 +0,0 @@
{
imports = [
./firefox.nix
];
}

View file

@ -1,5 +1,7 @@
{ pkgs, nixgl, ... }:
let
# quick variables to specify
# locked true/false
lock-false = {
Value = false;
Status = "locked";
@ -8,39 +10,60 @@
Value = true;
Status = "locked";
};
# path to nixGL binary (needed for webGL)
nixGL = "${nixgl.packages.${pkgs.system}.nixGLIntel}/bin/nixGLIntel";
my-firefox = (pkgs.firefox.override {
extraPrefs = ''
//
// Automatically click cookiebanners although uBlock Origin might block them
lockPref("cookiebanners.bannerClicking.enabled", true);
lockPref("cookiebanners.service.mode", 2);
lockPref("cookiebanners.service.mode.privateBrowsing", 2);
# modify firefox base package AND wrapper
# - set user prefs
# - fix webGL
my-firefox = (pkgs.firefox.override { # start wrapper override
// DNT although PrivacyBadger from policy handles this
lockPref("privacy.donottrackheader.enabled", true);
lockPref("privacy.donottrackheader.value", 1);
# file: mozilla.cfg
# modifies user prefs that firefox would normally not
# let me hardcode. i want to hardcode them.
extraPrefs = ''//
// New sidebar
lockPref("sidebar.revamp", true);
lockPref("sidebar.verticalTabs", true);
lockPref("sidebar.visibility", "always-show");
lockPref("sidebar.main.tools", "");
// Automatically click cookiebanners although uBlock Origin might block them
lockPref("cookiebanners.bannerClicking.enabled", true);
lockPref("cookiebanners.service.mode", 2);
lockPref("cookiebanners.service.mode.privateBrowsing", 2);
//
'';
}).overrideAttrs (old: {
// DNT although PrivacyBadger from policy handles this
lockPref("privacy.donottrackheader.enabled", true);
lockPref("privacy.donottrackheader.value", 1);
// New sidebar
lockPref("sidebar.revamp", true);
lockPref("sidebar.verticalTabs", true);
lockPref("sidebar.visibility", "always-show");
lockPref("sidebar.main.tools", "history,bookmarks");
//'';
}) # end wrapper override
.overrideAttrs (old: { # start base package override
# modify run (build) command for firefox so that
# we can always have nixGL be called first before firefox
# ... this fixes webGL on GNU/Guix. this is likely not needed if you
# are just running nixOS
buildCommand = old.buildCommand + ''
sed -i "s#firefox-wrapped\"#firefox-wrapped\" \"${nixGL}\"#1" "$out/bin/firefox"
'';
});
}); # end base package override
in
{
programs.firefox = {
# enable firefox and
# pass in our custom (modified) package from above
enable = true;
package = my-firefox;
# set firefox policies that i want
# (all that can be modified by firefox policy templates)
# see: https://mozilla.github.io/policy-templates/
policies = {
EnableTrackingProtection = {
Value = true;
@ -208,12 +231,19 @@
install_url = "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi";
installation_mode = "force_installed";
};
# Redirector
"redirector@einaregilsson.com" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/redirector/latest.xpi";
installation_mode = "force_installed";
};
};
# about:config Preferences
# ... set policies that cannot be set using policies.json directly
Preferences = {
# theme
# allow userChrom.css
"toolkit.legacyUserProfileCustomizations.stylesheets" = lock-true;
# dark theme
"extensions.activeThemeID" = {
Value = "firefox-compact-dark@mozilla.org";
Status = "locked";
@ -224,12 +254,12 @@
};
# homepage
"browser.startup.homepage" = {
Value = " about:home";
Value = "about:home";
Status = "locked";
};
"browser.newtabpage.enabed" = lock-true;
"browser.newtabpage.url" = {
Value = " about:home";
Value = "about:home";
Status = "locked";
};
# autofill
@ -270,6 +300,7 @@
"dom.webgpu.enabled" = lock-true;
"media.eme.enabled" = lock-true;
# user messaging
# ... disable shit that is annoying
"browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
"browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
@ -313,6 +344,7 @@
};
};
# create profile for me :3
profiles = {
"freya" = {
search = {
@ -326,18 +358,31 @@
"Twitter".metaData.hidden = true;
};
};
# firefox doesnt make styling the toolbar easy using about:config
# since its just a massive json string. so i did it here in css.
userChrome = ''
#sidebar-header { display:none !important; }
#sidebar-search-container { display:none !important; }
#firefox-view-button {
visibility: collapse;
}
#alltabs-button {
visibility: collapse;
}
#tabbrowser-tabs {
border-inline-start: none !important;
}
/* sidebar hack to flip contents the way i want them (arrows on the left) */
#nav-bar-customization-target {
flex-direction: row-reverse;
}
/* remove broken padding from sidebar hack */
#unified-extensions-button {
padding-left: 0 !important;
}
/* remove padding beside search bar */
toolbarspring {
display: none !important;
}
/* remove overflow menu and everything in it */
#nav-bar-overflow-button,
#firefox-view-button,
#alltabs-button {
visibility: collapse;
}
'';
};
};

View file

@ -0,0 +1,7 @@
{ ... }:
{
programs.home-manager = {
enable = true;
};
}

View file

@ -0,0 +1,15 @@
{ pkgs , ... }:
{
programs.nix-ld = {
# Enable Nix ld to allow precompiled executables not set for NixOS to run
enable = true;
# Sets up all the libraries to load
libraries = with pkgs; [
stdenv.cc.cc
zlib
openssl
];
};
}