From 16c071c9a319941881b9349e26956e7a19e5cba7 Mon Sep 17 00:00:00 2001 From: randomuser Date: Sun, 9 Jul 2023 17:21:27 -0500 Subject: [PATCH] misc changes --- .gitignore | 29 +------ builds/pash.nix | 26 ++++++ builds/st.nix | 39 +++++++++ builds/utils/sh/regenerate | 18 ++++ config/nvim/init.lua | 1 + configuration.nix | 1 + desktop.nix | 168 +++++++++++++++++++++++++++++++++++++ virtbox.nix | 110 +----------------------- 8 files changed, 256 insertions(+), 136 deletions(-) create mode 100644 builds/pash.nix create mode 100644 builds/st.nix create mode 100755 builds/utils/sh/regenerate create mode 100644 desktop.nix diff --git a/.gitignore b/.gitignore index ab5a87b..af4639f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,3 @@ .environment .firefox_env -bash/hist -nvim/.netrwhist -bash/bash -bspwm/bspwm -git/git -nvim/nvim -simplestatus/simplestatus -ssh/ssh -sx/sx -sxhkd/sxhkd -zathura/zathura -python/python -firefox/ -htop/htop -tridactyl/tridactyl -nvim/autoload/plug.vim.old -nvim/spell/ -nvim/plugin -utils/*.swp -utils/*.tmp -utils/c/scream -utils/c/xgetnewwindow -utils/c/timer -utils/c/boid -utils/c/a.out -utils/c/anaconda -utils/c/colors -utils/c/tmessage +hardware-configuration.nix diff --git a/builds/pash.nix b/builds/pash.nix new file mode 100644 index 0000000..fc8181c --- /dev/null +++ b/builds/pash.nix @@ -0,0 +1,26 @@ +{ stdenv +, lib +, bash +, makeWrapper +, fetchgit +}: + +stdenv.mkDerivation rec { + pname = "pash"; + version = "1.00"; + + src = fetchgit { + url = "https://git.beepboop.systems/rndusr/pash"; + sha256 = "sha256-0L3N7F4BwVdu4rR5xpUEIHcX/x64Gni8JTUki5kGH24="; + }; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/bin + cp $src/pash $out/bin/pash + wrapProgram $out/bin/pash --prefix PATH : ${lib.makeBinPath [ bash ]} + ''; + + phases = [ "installPhase" ]; +} diff --git a/builds/st.nix b/builds/st.nix new file mode 100644 index 0000000..fefa83b --- /dev/null +++ b/builds/st.nix @@ -0,0 +1,39 @@ +{ stdenv +, lib +, fetchgit +, pkg-config +, libX11 +, libXft +, fontconfig +, freetype +, ncurses +, extraLibs ? [ ] +}: + +stdenv.mkDerivation rec { + pname = "st"; + version = "69.19"; + + src = fetchgit { + url = "https://git.beepboop.systems/rndusr/st"; + sha256 = "sha256-zdID1SUnTO/zl90EG8TguBNYYCnrnqFnSLz32kQZbng="; + }; + + nativeBuildInputs = [ pkg-config fontconfig freetype ncurses]; + buildInputs = [ libX11 libXft ] ++ extraLibs; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/bin + cp ${pname} $out/bin + ''; + + meta = with lib; { + description = "Customized builds of the st terminal emulator"; + homepage = "https://git.beepboop.systems/rndusr/st"; + license = licenses.mit; + }; +} diff --git a/builds/utils/sh/regenerate b/builds/utils/sh/regenerate new file mode 100755 index 0000000..695e6b5 --- /dev/null +++ b/builds/utils/sh/regenerate @@ -0,0 +1,18 @@ +#!/bin/sh + +tmenu_path () { + IFS=" :" + for i in $PATH; do + for j in "$i"/*; do + [ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j" | xargs basename + done + done +} + +if [ "$1" = "-g" ] || [ "$(basename $0)" = "regenerate" ]; then + mkdir -p $HOME/.local/share + tmenu_path > $HOME/.local/share/tmenu_cache + xmessage "regeneration complete" +else + cat $HOME/.local/share/tmenu_cache | tmenu | ${SHELL:-"/bin/sh"} & +fi diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 6c00a18..d15f654 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -124,6 +124,7 @@ setTabbing("python", 4) setTabbing("javascript", 4) setTabbing("css", 4) setTabbing("html", 4) +setTabbing("nix", 2) vim.api.nvim_create_autocmd({"TermOpen"}, { pattern = {"*"}, diff --git a/configuration.nix b/configuration.nix index 33d1955..fc18c5a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -24,6 +24,7 @@ tree dig htop + gnumake ]; system.copySystemConfiguration = true; diff --git a/desktop.nix b/desktop.nix new file mode 100644 index 0000000..762ce32 --- /dev/null +++ b/desktop.nix @@ -0,0 +1,168 @@ +{ lib, config, pkgs, ...}: + +let + home-manager = builtins.fetchTarball { + url = "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"; + sha256 = "0dfshsgj93ikfkcihf4c5z876h4dwjds998kvgv7sqbfv0z6a4bc"; + }; +in { + imports = [ + (import "${home-manager}/nixos") + ./configuration.nix + ]; + + services.xserver = { + enable = true; + libinput.enable = true; + layout = "us"; + + # we're going to be pulling a sneaky + # we don't actually use startx, it just gets lightdm out of the way + displayManager.startx.enable = true; + }; + + sound.enable = true; + hardware.pulseaudio.enable = true; + + environment.systemPackages = with pkgs; [ + sx + lynx + fzy + gnupg + xclip + + (pkgs.callPackage ./builds/utils.nix {}) + (pkgs.callPackage ./builds/st.nix {}) + (pkgs.callPackage ./builds/pash.nix {}) + ]; + + fonts.fonts = with pkgs; [ + fantasque-sans-mono + ]; + + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "curses"; + enableSSHSupport = true; + }; + + programs.firefox = { + enable = true; + policies = { + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = { + Cryptomining = true; + Fingerprinting = true; + EmailTracking = true; + }; + DisableFirefoxAccounts = true; + DisableFirefoxScreenshots = true; + DisableSetDesktopBackground = true; + DisplayBookmarksToolbar = "never"; + DontCheckDefaultBrowser = true; + Extensions = { + Install = [ + "https://addons.mozilla.org/firefox/downloads/file/3812704/umatrix-1.4.4.xpi" + "https://addons.mozilla.org/firefox/downloads/file/3824639/gruvbox_true_dark-2.0.xpi" + "https://addons.mozilla.org/firefox/downloads/file/4128489/darkreader-4.9.64.xpi" + "https://addons.mozilla.org/firefox/downloads/file/4036604/tridactyl_vim-1.23.0.xpi" + "https://addons.mozilla.org/firefox/downloads/file/4098688/user_agent_string_switcher-0.5.0.xpi" + ]; + }; + FirefoxHome = { + Pocket = false; + Snippets = false; + TopSites = false; + SponsoredTopSites = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + MoreFromMozilla = false; + UrlbarInterventions = false; + WhatsNew = false; + }; + EnableTrackingProtection = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + PasswordManagerEnabled = false; + SearchSuggestEnabled = false; + }; + nativeMessagingHosts.tridactyl = true; + }; + + users.users.usr = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + packages = with pkgs; [ + firefox + tree + bspwm + sxhkd + ]; + }; + + + # honking impure, but who's counting anyway? + system.activationScripts.test-script.text = '' + #!${pkgs.bash}/bin/bash + + if [ "$(${pkgs.coreutils}/bin/whoami)" = "usr"]; then + ${pkgs.coreutils}/bin/mkdir -p /home/usr/git + ${pkgs.git}/bin/git https://git.beepboop.systems/rndusr/dot /home/usr/git/dot + ${pkgs.git}/bin/git https://git.beepboop.systems/rndusr/privdata /home/usr/git/privdata + fi + ''; + + home-manager.users.usr.home = { + stateVersion = "23.05"; + + file = { + ".config/bash" = { + source = ./config/bash; + recursive = true; + }; + ".config/bspwm" = { + source = ./config/bspwm; + recursive = true; + }; + ".config/git" = { + source = ./config/git; + recursive = true; + }; + ".config/htop" = { + source = ./config/htop; + recursive = true; + }; + ".config/nvim" = { + source = ./config/nvim; + recursive = true; + }; + ".config/python" = { + source = ./config/python; + recursive = true; + }; + ".config/sx" = { + source = ./config/sx; + recursive = true; + }; + ".config/sxhkd" = { + source = ./config/sxhkd; + recursive = true; + }; + ".config/tridactyl" = { + source = ./config/tridactyl; + recursive = true; + }; + ".config/zathura" = { + source = ./config/zathura; + recursive = true; + }; + ".local/share/wallpapers" = { + source = ./wallpapers; + recursive = true; + }; + }; + }; +} diff --git a/virtbox.nix b/virtbox.nix index 6ea7414..073b1ac 100644 --- a/virtbox.nix +++ b/virtbox.nix @@ -1,118 +1,12 @@ { lib, config, pkgs, ...}: -let - home-manager = builtins.fetchTarball { - url = "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"; - sha256 = "0dfshsgj93ikfkcihf4c5z876h4dwjds998kvgv7sqbfv0z6a4bc"; - }; -in { +{ imports = [ - (import "${home-manager}/nixos") - ./configuration.nix + ./desktop.nix ]; boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/vda"; networking.hostName = "virtbox"; - - services.xserver = { - enable = true; - libinput.enable = true; - layout = "us"; - - # we're going to be pulling a sneaky - # we don't actually use startx, it just gets lightdm out of the way - displayManager.startx.enable = true; - }; - - sound.enable = true; - hardware.pulseaudio.enable = true; - - environment.systemPackages = with pkgs; [ - sx - lynx - firefox - fzy - - (pkgs.callPackage ./builds/utils.nix {}) - (pkgs.callPackage ./builds/st.nix {}) - ]; - - fonts.fonts = with pkgs; [ - fantasque-sans-mono - ]; - - users.users.usr = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ - firefox - tree - bspwm - sxhkd - ]; - }; - - - # honking impure, but who's counting anyway? - system.activationScripts.test-script.text = '' - #!${pkgs.bash}/bin/bash - - if [ "$(${pkgs.coreutils}/bin/whoami)" = "usr"]; then - ${pkgs.coreutils}/bin/mkdir -p /home/usr/git - ${pkgs.git}/bin/git https://git.beepboop.systems/rndusr/dot /home/usr/git/dot - fi - ''; - - home-manager.users.usr.home = { - stateVersion = "23.05"; - - file = { - ".config/bash" = { - source = ./config/bash; - recursive = true; - }; - ".config/bspwm" = { - source = ./config/bspwm; - recursive = true; - }; - ".config/git" = { - source = ./config/git; - recursive = true; - }; - ".config/htop" = { - source = ./config/htop; - recursive = true; - }; - ".config/nvim" = { - source = ./config/nvim; - recursive = true; - }; - ".config/python" = { - source = ./config/python; - recursive = true; - }; - ".config/sx" = { - source = ./config/sx; - recursive = true; - }; - ".config/sxhkd" = { - source = ./config/sxhkd; - recursive = true; - }; - ".config/tridactyl" = { - source = ./config/tridactyl; - recursive = true; - }; - ".config/zathura" = { - source = ./config/zathura; - recursive = true; - }; - ".local/share/wallpapers" = { - source = ./wallpapers; - recursive = true; - }; - }; - }; }