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 = { outputs = {
self,
nixpkgs, nixpkgs,
home-manager, home-manager,
nixgl, nixgl,
... ...
} @ inputs: let }:
inherit (self) outputs; let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; username = "freya";
overlays = [
nixgl.overlay
];
in { in {
homeConfigurations."freya" = homeConfigurations.${username} =
home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration {
inherit pkgs; pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs;};
modules = [ modules = [
{nixpkgs.overlays = overlays;}
./home.nix ./home.nix
{ ({
_module.args = { _module.args = {
inherit nixgl; 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 = [ imports = [
./programs ./programs/firefox.nix
./programs/home-manager.nix
]; ];
news.display = "silent"; news.display = "silent";
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
programs.home-manager.enable = true;
home = { home = {
username = "freya";
homeDirectory = "/home/freya";
stateVersion = "25.05";
packages = with pkgs; [ packages = with pkgs; [
# shell # shell
starship starship
@ -27,13 +25,7 @@
rust-analyzer rust-analyzer
cargo cargo
clippy clippy
# unity
unityhub
# libs
openssl
libgcc
]; ];
}; };
} }

View file

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

View file

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