From 4730b215fdc4095800fedfdf690c12fec994bb6b Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Wed, 2 Oct 2024 22:07:10 -0500 Subject: more reorganizing and modularizing --- configuration.nix | 74 -------- flake.nix | 10 +- hardware-configuration.nix | 33 ---- home-config/activation-scripts/clone-repos.sh | 19 -- home-config/firefox/uiCustomization.json | 1 - home-config/firefox/userChrome.css | 195 --------------------- home.nix | 119 ------------- modules/awesome.nix | 9 - modules/cups.nix | 9 - modules/default.nix | 32 ---- modules/doas.nix | 16 -- modules/docker.nix | 17 -- modules/grub.nix | 26 --- modules/home/default.nix | 16 ++ modules/home/firefox.nix | 63 +++++++ modules/home/git.nix | 7 + modules/home/initial-home-setup.nix | 18 ++ .../resources/activation-scripts/clone-repos.sh | 19 ++ .../home/resources/firefox/uiCustomization.json | 1 + modules/home/resources/firefox/userChrome.css | 195 +++++++++++++++++++++ modules/home/theme.nix | 46 +++++ modules/hosts.nix | 5 - modules/hosts/T430/configuration.nix | 27 +++ modules/hosts/T430/hardware-configuration.nix | 33 ++++ modules/localization.nix | 5 - modules/nix.nix | 11 -- modules/pipewire.nix | 12 -- modules/root/awesome.nix | 9 + modules/root/cups.nix | 9 + modules/root/default.nix | 36 ++++ modules/root/doas.nix | 16 ++ modules/root/docker.nix | 17 ++ modules/root/grub.nix | 26 +++ modules/root/home-manager.nix | 11 ++ modules/root/hosts.nix | 5 + modules/root/localization.nix | 5 + modules/root/nix.nix | 11 ++ modules/root/pipewire.nix | 12 ++ modules/root/software/default.nix | 23 +++ modules/root/software/desktop-extra.nix | 16 ++ modules/root/software/desktop.nix | 22 +++ modules/root/software/dev-extra.nix | 16 ++ modules/root/software/dev.nix | 23 +++ modules/root/software/utils.nix | 30 ++++ modules/root/virtualisation.nix | 10 ++ modules/root/wifi.nix | 10 ++ modules/root/x11/default.nix | 30 ++++ modules/root/x11/xinit-startx-xdg.patch | 14 ++ modules/software/default.nix | 23 --- modules/software/desktop-extra.nix | 17 -- modules/software/desktop.nix | 22 --- modules/software/dev-extra.nix | 16 -- modules/software/dev.nix | 23 --- modules/software/utils.nix | 30 ---- modules/wifi.nix | 10 -- modules/x11/default.nix | 30 ---- modules/x11/xinit-startx-xdg.patch | 14 -- 57 files changed, 780 insertions(+), 774 deletions(-) delete mode 100644 configuration.nix delete mode 100644 hardware-configuration.nix delete mode 100644 home-config/activation-scripts/clone-repos.sh delete mode 100644 home-config/firefox/uiCustomization.json delete mode 100644 home-config/firefox/userChrome.css delete mode 100644 home.nix delete mode 100644 modules/awesome.nix delete mode 100644 modules/cups.nix delete mode 100644 modules/default.nix delete mode 100644 modules/doas.nix delete mode 100644 modules/docker.nix delete mode 100644 modules/grub.nix create mode 100644 modules/home/default.nix create mode 100644 modules/home/firefox.nix create mode 100644 modules/home/git.nix create mode 100644 modules/home/initial-home-setup.nix create mode 100644 modules/home/resources/activation-scripts/clone-repos.sh create mode 100644 modules/home/resources/firefox/uiCustomization.json create mode 100644 modules/home/resources/firefox/userChrome.css create mode 100644 modules/home/theme.nix delete mode 100644 modules/hosts.nix create mode 100644 modules/hosts/T430/configuration.nix create mode 100644 modules/hosts/T430/hardware-configuration.nix delete mode 100644 modules/localization.nix delete mode 100644 modules/nix.nix delete mode 100644 modules/pipewire.nix create mode 100644 modules/root/awesome.nix create mode 100644 modules/root/cups.nix create mode 100644 modules/root/default.nix create mode 100644 modules/root/doas.nix create mode 100644 modules/root/docker.nix create mode 100644 modules/root/grub.nix create mode 100644 modules/root/home-manager.nix create mode 100644 modules/root/hosts.nix create mode 100644 modules/root/localization.nix create mode 100644 modules/root/nix.nix create mode 100644 modules/root/pipewire.nix create mode 100644 modules/root/software/default.nix create mode 100644 modules/root/software/desktop-extra.nix create mode 100644 modules/root/software/desktop.nix create mode 100644 modules/root/software/dev-extra.nix create mode 100644 modules/root/software/dev.nix create mode 100644 modules/root/software/utils.nix create mode 100644 modules/root/virtualisation.nix create mode 100644 modules/root/wifi.nix create mode 100644 modules/root/x11/default.nix create mode 100644 modules/root/x11/xinit-startx-xdg.patch delete mode 100644 modules/software/default.nix delete mode 100644 modules/software/desktop-extra.nix delete mode 100644 modules/software/desktop.nix delete mode 100644 modules/software/dev-extra.nix delete mode 100644 modules/software/dev.nix delete mode 100644 modules/software/utils.nix delete mode 100644 modules/wifi.nix delete mode 100644 modules/x11/default.nix delete mode 100644 modules/x11/xinit-startx-xdg.patch diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index fecb7e6..0000000 --- a/configuration.nix +++ /dev/null @@ -1,74 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - # networking.hostName = "nixos"; # Define your hostname. - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.timmy = { - description = "Tim Keller"; - isNormalUser = true; - extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user. - packages = with pkgs; [ - ]; - }; - - - # TODO this does not function - boot.initrd.systemd.extraBin = { - sh = "${pkgs.dash}/bin/dash"; - vim = "${pkgs.neovim}/bin/nvim"; - }; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - #programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - - # This option defines the first version of NixOS you have installed on this particular machine, - # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. - # - # Most users should NEVER change this value after the initial install, for any reason, - # even if you've upgraded your system to a new NixOS release. - # - # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, - # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how - # to actually do that. - # - # This value being lower than the current NixOS release does NOT mean your system is - # out of date, out of support, or vulnerable. - # - # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, - # and migrated your data accordingly. - # - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "24.05"; # Did you read the comment? - -} - diff --git a/flake.nix b/flake.nix index 1108ba0..e69a67b 100644 --- a/flake.nix +++ b/flake.nix @@ -12,29 +12,27 @@ arkenfox = { url = "github:dwarfmaster/arkenfox-nixos"; inputs.nixpkgs.follows = "nixpkgs"; - #inputs.home-manager.follows = "home-manager"; }; }; outputs = { nixpkgs, home-manager, arkenfox, ... }@inputs : - # HOSTNAME NIXOS let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; in { - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + nixosConfigurations.T430 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs; }; modules = [ - ./configuration.nix - ./modules + ./modules/hosts/T430/configuration.nix + ./modules/root ]; }; homeConfigurations.timmy = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ - ./home.nix + ./modules/home inputs.arkenfox.hmModules.arkenfox ]; }; diff --git a/hardware-configuration.nix b/hardware-configuration.nix deleted file mode 100644 index 206a525..0000000 --- a/hardware-configuration.nix +++ /dev/null @@ -1,33 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/b991914b-3a4c-4248-9472-b5403729601a"; - fsType = "btrfs"; - }; - - swapDevices = [ ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s25.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/home-config/activation-scripts/clone-repos.sh b/home-config/activation-scripts/clone-repos.sh deleted file mode 100644 index 8ebdbe4..0000000 --- a/home-config/activation-scripts/clone-repos.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -server="https://git.tjkeller.xyz/" - -clonemissing() { - # clone to $2 - [ -d "$2"/.git ] && return - run mkdir -p $VERBOSE_ARG "$2" - run git clone $VERBOSE_ARG "$server$1" "$2" - - # link to $3 - [ -z "$3" ] && return - run mkdir -p $VERBOSE_ARG "$3" - run ln -sf $VERBOSE_ARG "$2"/.* "$2"/* "$3" -} - -# # repo # clone to # link to -clonemissing scripts.git $HOME/docs/src/scripts $HOME/.local/bin -clonemissing dotconfig.git $HOME/docs/src/config $HOME/.config diff --git a/home-config/firefox/uiCustomization.json b/home-config/firefox/uiCustomization.json deleted file mode 100644 index 339b716..0000000 --- a/home-config/firefox/uiCustomization.json +++ /dev/null @@ -1 +0,0 @@ -{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["ublock0_raymondhill_net-browser-action","sponsorblocker_ajay_app-browser-action","_e6e36c9a-8323-446c-b720-a176017e38ff_-browser-action","dearrow_ajay_app-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","idcac-pub_guus_ninja-browser-action","addon_darkreader_org-browser-action","_74145f27-f039-47ce-a470-a662b129930a_-browser-action","_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action","jid1-bofifl9vbdl2zq_jetpack-browser-action","addon_fastforward_team-browser-action","jid1-tsgsxbhncspbwq_jetpack-browser-action","_aecec67f-0d10-4fa7-b7c7-609a2db280cf_-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","home-button","urlbar-container","downloads-button","unified-extensions-button"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","developer-button","dearrow_ajay_app-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","_e6e36c9a-8323-446c-b720-a176017e38ff_-browser-action","sponsorblocker_ajay_app-browser-action","ublock0_raymondhill_net-browser-action","idcac-pub_guus_ninja-browser-action","addon_darkreader_org-browser-action","_74145f27-f039-47ce-a470-a662b129930a_-browser-action","_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action","jid1-bofifl9vbdl2zq_jetpack-browser-action","addon_fastforward_team-browser-action","jid1-tsgsxbhncspbwq_jetpack-browser-action","_aecec67f-0d10-4fa7-b7c7-609a2db280cf_-browser-action"],"dirtyAreaCache":["nav-bar","PersonalToolbar","unified-extensions-area","toolbar-menubar","TabsToolbar"],"currentVersion":20,"newElementCount":5} diff --git a/home-config/firefox/userChrome.css b/home-config/firefox/userChrome.css deleted file mode 100644 index af302c5..0000000 --- a/home-config/firefox/userChrome.css +++ /dev/null @@ -1,195 +0,0 @@ -/* TOP BAR */ -#navigator-toolbox { - --uc-navigationbar-width: 40vw; -} - -/* Remove overflow button */ -#nav-bar-overflow-button { display: none; } - -/* remove alltabs button */ -#alltabs-button { display: none; } - -/* Change background color of toolbar */ -#navigator-toolbox-background { - background: var(--toolbar-field-border-color) !important; -} - -/* Fix vertical spacing of tabs */ -#TabsToolbar { - margin-top: -1px; -} - -/* Move new tab to far right */ -#tabbrowser-arrowscrollbox-periphery { - margin-left: auto; -} - -/* Fix spacing around tabs by removing nav bar top border */ -#nav-bar { - border: none !important; -} - -/* Media queries for width of nav bar */ -@media screen and (max-width: 1000px) { - #navigator-toolbox { - --uc-navigationbar-width: 50vw; - } -} -@media screen and (max-width: 800px) { - #navigator-toolbox { - --uc-navigationbar-width: 60vw; - } -} - -/* Change look of tabs in smaller view */ -@media screen and (max-width: 800px) { - .tab-background { - margin-block: .2em !important; - } - #TabsToolbar { - margin-left: 5px; - } -} - - -/* COMBINE TOP BAR */ -/* Combine top bar into single line if width >= 800px */ -@media screen and (min-width: 800px) { - :root { - --uc-toolbar-height: 36px; /* Half height bar */ - } - - /* Modify these to change relative widths or default height */ - #navigator-toolbox { - margin-bottom: 0px; - } - - #titlebar { - margin-top: 2px; - } - - #TabsToolbar { - margin-left: calc(var(--uc-navigationbar-width) + 2px); /* Resize tab bar */ - margin-top: -4px; - margin-bottom: 2px; - } - - /* Tabs extend to bottom of bar */ - .tab-background { - margin-bottom: 0 !important; - margin-top: 2px !important; /* See above navbox rule */ - } - - /* Center tab buttons */ - #tabs-newtab-button, - #alltabs-button - { - margin-top: 4px !important; - } - - /* Integrate url / nav bar */ - #nav-bar { - margin-right:calc(100vw - var(--uc-navigationbar-width)); - margin-top: calc(0px - var(--uc-toolbar-height)); - border-radius: 0 var(--tab-border-radius) var(--tab-border-radius) 0; - border-right: 1px solid ThreeDShadow !important; - box-shadow: 0 0 4px rgba(0,0,0,.4) !important; - } - - /* 1px margin on touch density causes tabs to be too high */ - .tab-close-button { - margin-top: 0 !important - } - - /* Make opened urlbar overlay the toolbar */ - #urlbar[open]:focus-within { - min-width: 50vw !important; - } - - /* Remove min and max width of urlbar */ - #urlbar-container { - width: 0 !important; - } - - /* Fix customization view */ - #customization-panelWrapper .panel-arrowbox .panel-arrow { - margin-inline-end: initial !important; - } - - /* Shorten findbar */ - findbar { - width: 600px !important; - border-radius: 0 0 0 5px; - border-bottom: none !important; - box-shadow: 0 2px 4px rgba(0,0,0,.4); /* Move down 2px so it doesn't go over the tab bar */ - } -} - - -/* FINDBAR */ -findbar { - width: 100vw; - position: absolute; - top: 0; - right: 0; - padding: 0 !important; - padding-top: 1px !important; - background: -moz-headerbar Field !important; - border-top-width: 0px !important; - border-bottom: 1px solid ThreeDShadow; -} - -findbar .findbar-container { - padding-bottom: 5px !important; /* Move search bar closer to left edge */ - padding-top: 2px !important; /* Move search bar closer to left edge */ - height: max-content !important; - gap: 2px; - justify-content: space-between; - flex-wrap: wrap; -} - -/* Force textbox to fill up first line */ -findbar .findbar-textbox { - width: 100% !important; - background: Field !important; /* Set the background color to be consistent with found-matches label when unfocused */ -} - -/* Hide description showing wrap conditions etc. */ -findbar description { - display: none; -} - -/* Move found matches label (roughly) into the textbox */ -findbar label.found-matches, -findbar description { - position: absolute; - top: 6.5px; - right: 110px; - color: color-mix(in srgb, -moz-headerbartext, transparent 46%) !important; - /* So this text overrides the text below, TODO find a more elegant solution */ - padding-inline: 1ex; - background: Field; -} - -/* Show description when it says "Phrase Not Found" */ -findbar description[status=notfound] { - display: inline-block; -} - -/* Force checkboxes onto second line */ -findbar .findbar-container hbox { - width: 100%; -} - - -/* BOOKMARK BAR */ -@-moz-document url(chrome://browser/content/browser.xhtml) { - #PersonalToolbar { - background: -moz-headerbar Field !important; - border-top: 1px solid ThreeDShadow !important; - } - /* Space out bookmark items */ - .bookmark-item .toolbarbutton-text { - padding: 2.5px 4px; - } -} diff --git a/home.nix b/home.nix deleted file mode 100644 index f34d6c0..0000000 --- a/home.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ config, lib, pkgs, ... }: { - home = { - username = "timmy"; - homeDirectory = "/home/timmy"; - stateVersion = "24.05"; - activation = { - cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] '' - export PATH="${config.home.path}/bin:$PATH" - ${builtins.readFile ./home-config/activation-scripts/clone-repos.sh} - ''; - linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] '' - run ln -sf $VERBOSE_ARG $HOME/.config/zsh/zprofile $HOME/.zprofile - ''; - cleanupHome = lib.hm.dag.entryAfter ["writeBoundary"] '' - run rm -f $VERBOSE_ARG $HOME/{.zcompdump,.zshrc,.zsh_history,.bash_history} - ''; - mimewiz = lib.hm.dag.entryAfter ["writeBoundary"] '' - export PATH="$HOME/.local/bin/misc:$PATH" - run mimewiz # already verbose - ''; - }; - }; - - programs = { - git = { - enable = true; - userName = "Tim Keller"; # TODO set to user description - userEmail = "tjk@tjkeller.xyz"; # TODO set to user email - }; - firefox = { - # TODO see if there is way to login to moz account in profile - enable = true; - arkenfox = { - enable = true; - }; - profiles = let - search = { - engines = { - "Timmy Search" = { - urls = [{ template = "https://search.tjkeller.xyz/search?q={searchTerms}"; }]; # Don't know how to do w/ POST but I prefer GET anyways - iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work - }; - }; - default = "Timmy Search"; - privateDefault = "Timmy Search"; - }; - userChrome = builtins.readFile ./home-config/firefox/userChrome.css; - arkenfox = { - enable = true; - enableAllSections = true; - "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session - "0100"."0103"."browser.startup.homepage".enable = false; - "0100"."0104"."browser.newtabpage.enabled".enable = false; - }; - settings = { - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "browser.compactmode.show" = true; - "browser.uidensity" = 1; # Compact - "browser.download.dir" = /home/timmy/dls; # FF will create this dir if it doesn't exist - "browser.aboutConfig.showWarning" = false; # arkenfox does - "app.normandy.first_run" = false; - "browser.uiCustomization.state" = builtins.readFile ./home-config/firefox/uiCustomization.json; # Toolbar etc. - "browser.newtabpage.activity-stream.feeds.section.topstories" = false; - "browser.newtabpage.activity-stream.feeds.topsites" = false; - "general.smoothScroll" = false; - "devtools.toolbox.host" = "window"; - #identity.fxaccounts.account.device.name = "timmy’s Firefox on nixos"; # HOSTNAME - }; - in { - Personal = { - id = 0; - isDefault = true; - inherit search; - inherit userChrome; - inherit arkenfox; - inherit settings; - }; - Work = { - id = 1; - inherit search; - }; - Test = { - id = 2; - inherit search; - inherit arkenfox; - inherit userChrome; - inherit settings; - }; - }; - }; - }; - - gtk = { - enable = true; - theme = { - package = pkgs.cinnamon.mint-themes; - name = "Mint-Y-Dark-Aqua"; - }; - iconTheme = { - package = pkgs.cinnamon.mint-y-icons; - name = "Mint-Y-Aqua"; - }; - cursorTheme = { - name = "Adwaita"; - }; - gtk3.bookmarks = [ - "file:///home/timmy/dls Downloads" - "file:///home/timmy/docs Documents" - "file:///home/timmy/docs/src/sites sites" - "file:///home/timmy/docs/src/scripts scripts" - "file:///home/timmy/docs/src/programs programs" - ]; - gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; - }; - qt = { - enable = true; - platformTheme.name = "gtk3"; - }; -} diff --git a/modules/awesome.nix b/modules/awesome.nix deleted file mode 100644 index 4db5230..0000000 --- a/modules/awesome.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, config, ... }: { - options = { - xserver.awesome.enable = lib.mkEnableOption "enables awesomewm"; - }; - - config = lib.mkIf config.xserver.awesome.enable { - services.xserver.windowManager.awesome.enable = true; - }; -} diff --git a/modules/cups.nix b/modules/cups.nix deleted file mode 100644 index 39f8434..0000000 --- a/modules/cups.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, config, ... }: { - options = { - cups.enable = lib.mkEnableOption "enables printing"; - }; - - config = lib.mkIf config.cups.enable { - services.printing.enable = true; - }; -} diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index 1f878d9..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib, ... }: { - imports = [ - ./awesome.nix - ./cups.nix - ./doas.nix - ./docker.nix - ./grub.nix - ./hosts.nix - ./localization.nix - ./nix.nix - ./pipewire.nix - ./software.nix - ./wifi.nix - ./x11 - ]; - - cups.enable = lib.mkDefault true; - doas.enable = lib.mkDefault true; - docker = { - enable = lib.mkDefault true; - btrfsSupport = lib.mkDefault true; - }; - grub = { - enable = lib.mkDefault true; - mode = lib.mkDefault "bios"; - biosDevice = lib.mkDefault "/dev/sda"; - }; - pipewire.enable = lib.mkDefault true; - wifi.enable = lib.mkDefault true; - xserver.awesome.enable = lib.mkDefault true; - xserver.enable = lib.mkDefault true; -} diff --git a/modules/doas.nix b/modules/doas.nix deleted file mode 100644 index 2af324e..0000000 --- a/modules/doas.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ lib, config, ... }: { - options = { - doas.enable = lib.mkEnableOption "enables doas"; - sudo.enable = lib.mkEnableOption "enables sudo"; - }; - - config = lib.mkIf config.doas.enable { - security.doas.enable = true; - security.sudo.enable = config.sudo.enable; - security.doas.extraRules = [{ - groups = ["wheel"]; - keepEnv = true; - noPass = true; - }]; - }; -} diff --git a/modules/docker.nix b/modules/docker.nix deleted file mode 100644 index d4b6272..0000000 --- a/modules/docker.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - docker.enable = lib.mkEnableOption "enables docker"; - docker.btrfsSupport = lib.mkEnableOption "changes docker storageDriver to btrfs"; - }; - - config = lib.mkIf config.docker.enable { - virtualisation.docker = { - enable = true; - storageDriver = lib.mkIf config.docker.btrfsSupport "btrfs"; - }; - - environment.systemPackages = with pkgs; [ - docker-compose - ]; - }; -} diff --git a/modules/grub.nix b/modules/grub.nix deleted file mode 100644 index 47227d1..0000000 --- a/modules/grub.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, config, ... }: { - options = { - grub.enable = lib.mkEnableOption "enables docker"; - grub.mode = lib.mkOption { - type = lib.types.enum [ "efi" "bios" ]; - default = "efi"; - description = "grub mode efi or bios"; - }; - grub.biosDevice = lib.mkOption { - type = lib.types.str; - description = "device to install grub on"; - }; - }; - - config = lib.mkIf config.grub.enable { - boot.loader = { - grub = { - enable = true; - efiSupport = config.grub.mode == "efi"; - efiInstallAsRemovable = config.grub.mode == "efi"; - device = if config.grub.mode == "bios" then config.grub.biosDevice else "nodev"; - }; - efi.efiSysMountPoint = "/boot/efi"; - }; - }; -} diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..bce93ba --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,16 @@ +{ lib, ... }: { + home = { + username = "timmy"; + homeDirectory = "/home/timmy"; + stateVersion = "24.05"; + }; + + imports = [ + ./firefox.nix + ./git.nix + ./initial-home-setup.nix + ./theme.nix + ]; + + theme.mint.enable = lib.mkDefault true; +} diff --git a/modules/home/firefox.nix b/modules/home/firefox.nix new file mode 100644 index 0000000..3ae1278 --- /dev/null +++ b/modules/home/firefox.nix @@ -0,0 +1,63 @@ +{ + programs.firefox = { + # TODO see if there is way to login to moz account in profile + enable = true; + arkenfox = { + enable = true; + }; + profiles = let + search = { + engines = { + "Timmy Search" = { + urls = [{ template = "https://search.tjkeller.xyz/search?q={searchTerms}"; }]; # Don't know how to do w/ POST but I prefer GET anyways + iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work + }; + }; + default = "Timmy Search"; + privateDefault = "Timmy Search"; + }; + userChrome = builtins.readFile ./resources/firefox/userChrome.css; + arkenfox = { + enable = true; + enableAllSections = true; + "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session + "0100"."0103"."browser.startup.homepage".enable = false; + "0100"."0104"."browser.newtabpage.enabled".enable = false; + }; + settings = { + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.compactmode.show" = true; + "browser.uidensity" = 1; # Compact + "browser.download.dir" = /home/timmy/dls; # FF will create this dir if it doesn't exist + "browser.aboutConfig.showWarning" = false; # arkenfox does + "app.normandy.first_run" = false; + "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc. + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "general.smoothScroll" = false; + "devtools.toolbox.host" = "window"; + #identity.fxaccounts.account.device.name = "timmy’s Firefox on nixos"; # HOSTNAME + }; + in { + Personal = { + id = 0; + isDefault = true; + inherit search; + inherit userChrome; + inherit arkenfox; + inherit settings; + }; + Work = { + id = 1; + inherit search; + }; + Test = { + id = 2; + inherit search; + inherit arkenfox; + inherit userChrome; + inherit settings; + }; + }; + }; +} diff --git a/modules/home/git.nix b/modules/home/git.nix new file mode 100644 index 0000000..e1a36c3 --- /dev/null +++ b/modules/home/git.nix @@ -0,0 +1,7 @@ +{ + programs.git = { + enable = true; + userName = "Tim Keller"; # TODO set to user description + userEmail = "tjk@tjkeller.xyz"; # TODO set to user email + }; +} diff --git a/modules/home/initial-home-setup.nix b/modules/home/initial-home-setup.nix new file mode 100644 index 0000000..a7119b9 --- /dev/null +++ b/modules/home/initial-home-setup.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: { + home.activation = { + cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] '' + export PATH="${config.home.path}/bin:$PATH" + ${builtins.readFile ./resources/activation-scripts/clone-repos.sh} + ''; + linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] '' + run ln -sf $VERBOSE_ARG $HOME/.config/zsh/zprofile $HOME/.zprofile + ''; + cleanupHome = lib.hm.dag.entryAfter ["writeBoundary"] '' + run rm -f $VERBOSE_ARG $HOME/{.zcompdump,.zshrc,.zsh_history,.bash_history} + ''; + mimewiz = lib.hm.dag.entryAfter ["writeBoundary"] '' + export PATH="$HOME/.local/bin/misc:$PATH" + run mimewiz # already verbose + ''; + }; +} diff --git a/modules/home/resources/activation-scripts/clone-repos.sh b/modules/home/resources/activation-scripts/clone-repos.sh new file mode 100644 index 0000000..8ebdbe4 --- /dev/null +++ b/modules/home/resources/activation-scripts/clone-repos.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +server="https://git.tjkeller.xyz/" + +clonemissing() { + # clone to $2 + [ -d "$2"/.git ] && return + run mkdir -p $VERBOSE_ARG "$2" + run git clone $VERBOSE_ARG "$server$1" "$2" + + # link to $3 + [ -z "$3" ] && return + run mkdir -p $VERBOSE_ARG "$3" + run ln -sf $VERBOSE_ARG "$2"/.* "$2"/* "$3" +} + +# # repo # clone to # link to +clonemissing scripts.git $HOME/docs/src/scripts $HOME/.local/bin +clonemissing dotconfig.git $HOME/docs/src/config $HOME/.config diff --git a/modules/home/resources/firefox/uiCustomization.json b/modules/home/resources/firefox/uiCustomization.json new file mode 100644 index 0000000..339b716 --- /dev/null +++ b/modules/home/resources/firefox/uiCustomization.json @@ -0,0 +1 @@ +{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["ublock0_raymondhill_net-browser-action","sponsorblocker_ajay_app-browser-action","_e6e36c9a-8323-446c-b720-a176017e38ff_-browser-action","dearrow_ajay_app-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","idcac-pub_guus_ninja-browser-action","addon_darkreader_org-browser-action","_74145f27-f039-47ce-a470-a662b129930a_-browser-action","_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action","jid1-bofifl9vbdl2zq_jetpack-browser-action","addon_fastforward_team-browser-action","jid1-tsgsxbhncspbwq_jetpack-browser-action","_aecec67f-0d10-4fa7-b7c7-609a2db280cf_-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","home-button","urlbar-container","downloads-button","unified-extensions-button"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","developer-button","dearrow_ajay_app-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","_e6e36c9a-8323-446c-b720-a176017e38ff_-browser-action","sponsorblocker_ajay_app-browser-action","ublock0_raymondhill_net-browser-action","idcac-pub_guus_ninja-browser-action","addon_darkreader_org-browser-action","_74145f27-f039-47ce-a470-a662b129930a_-browser-action","_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action","jid1-bofifl9vbdl2zq_jetpack-browser-action","addon_fastforward_team-browser-action","jid1-tsgsxbhncspbwq_jetpack-browser-action","_aecec67f-0d10-4fa7-b7c7-609a2db280cf_-browser-action"],"dirtyAreaCache":["nav-bar","PersonalToolbar","unified-extensions-area","toolbar-menubar","TabsToolbar"],"currentVersion":20,"newElementCount":5} diff --git a/modules/home/resources/firefox/userChrome.css b/modules/home/resources/firefox/userChrome.css new file mode 100644 index 0000000..af302c5 --- /dev/null +++ b/modules/home/resources/firefox/userChrome.css @@ -0,0 +1,195 @@ +/* TOP BAR */ +#navigator-toolbox { + --uc-navigationbar-width: 40vw; +} + +/* Remove overflow button */ +#nav-bar-overflow-button { display: none; } + +/* remove alltabs button */ +#alltabs-button { display: none; } + +/* Change background color of toolbar */ +#navigator-toolbox-background { + background: var(--toolbar-field-border-color) !important; +} + +/* Fix vertical spacing of tabs */ +#TabsToolbar { + margin-top: -1px; +} + +/* Move new tab to far right */ +#tabbrowser-arrowscrollbox-periphery { + margin-left: auto; +} + +/* Fix spacing around tabs by removing nav bar top border */ +#nav-bar { + border: none !important; +} + +/* Media queries for width of nav bar */ +@media screen and (max-width: 1000px) { + #navigator-toolbox { + --uc-navigationbar-width: 50vw; + } +} +@media screen and (max-width: 800px) { + #navigator-toolbox { + --uc-navigationbar-width: 60vw; + } +} + +/* Change look of tabs in smaller view */ +@media screen and (max-width: 800px) { + .tab-background { + margin-block: .2em !important; + } + #TabsToolbar { + margin-left: 5px; + } +} + + +/* COMBINE TOP BAR */ +/* Combine top bar into single line if width >= 800px */ +@media screen and (min-width: 800px) { + :root { + --uc-toolbar-height: 36px; /* Half height bar */ + } + + /* Modify these to change relative widths or default height */ + #navigator-toolbox { + margin-bottom: 0px; + } + + #titlebar { + margin-top: 2px; + } + + #TabsToolbar { + margin-left: calc(var(--uc-navigationbar-width) + 2px); /* Resize tab bar */ + margin-top: -4px; + margin-bottom: 2px; + } + + /* Tabs extend to bottom of bar */ + .tab-background { + margin-bottom: 0 !important; + margin-top: 2px !important; /* See above navbox rule */ + } + + /* Center tab buttons */ + #tabs-newtab-button, + #alltabs-button + { + margin-top: 4px !important; + } + + /* Integrate url / nav bar */ + #nav-bar { + margin-right:calc(100vw - var(--uc-navigationbar-width)); + margin-top: calc(0px - var(--uc-toolbar-height)); + border-radius: 0 var(--tab-border-radius) var(--tab-border-radius) 0; + border-right: 1px solid ThreeDShadow !important; + box-shadow: 0 0 4px rgba(0,0,0,.4) !important; + } + + /* 1px margin on touch density causes tabs to be too high */ + .tab-close-button { + margin-top: 0 !important + } + + /* Make opened urlbar overlay the toolbar */ + #urlbar[open]:focus-within { + min-width: 50vw !important; + } + + /* Remove min and max width of urlbar */ + #urlbar-container { + width: 0 !important; + } + + /* Fix customization view */ + #customization-panelWrapper .panel-arrowbox .panel-arrow { + margin-inline-end: initial !important; + } + + /* Shorten findbar */ + findbar { + width: 600px !important; + border-radius: 0 0 0 5px; + border-bottom: none !important; + box-shadow: 0 2px 4px rgba(0,0,0,.4); /* Move down 2px so it doesn't go over the tab bar */ + } +} + + +/* FINDBAR */ +findbar { + width: 100vw; + position: absolute; + top: 0; + right: 0; + padding: 0 !important; + padding-top: 1px !important; + background: -moz-headerbar Field !important; + border-top-width: 0px !important; + border-bottom: 1px solid ThreeDShadow; +} + +findbar .findbar-container { + padding-bottom: 5px !important; /* Move search bar closer to left edge */ + padding-top: 2px !important; /* Move search bar closer to left edge */ + height: max-content !important; + gap: 2px; + justify-content: space-between; + flex-wrap: wrap; +} + +/* Force textbox to fill up first line */ +findbar .findbar-textbox { + width: 100% !important; + background: Field !important; /* Set the background color to be consistent with found-matches label when unfocused */ +} + +/* Hide description showing wrap conditions etc. */ +findbar description { + display: none; +} + +/* Move found matches label (roughly) into the textbox */ +findbar label.found-matches, +findbar description { + position: absolute; + top: 6.5px; + right: 110px; + color: color-mix(in srgb, -moz-headerbartext, transparent 46%) !important; + /* So this text overrides the text below, TODO find a more elegant solution */ + padding-inline: 1ex; + background: Field; +} + +/* Show description when it says "Phrase Not Found" */ +findbar description[status=notfound] { + display: inline-block; +} + +/* Force checkboxes onto second line */ +findbar .findbar-container hbox { + width: 100%; +} + + +/* BOOKMARK BAR */ +@-moz-document url(chrome://browser/content/browser.xhtml) { + #PersonalToolbar { + background: -moz-headerbar Field !important; + border-top: 1px solid ThreeDShadow !important; + } + /* Space out bookmark items */ + .bookmark-item .toolbarbutton-text { + padding: 2.5px 4px; + } +} diff --git a/modules/home/theme.nix b/modules/home/theme.nix new file mode 100644 index 0000000..c49b8f5 --- /dev/null +++ b/modules/home/theme.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: { + options = { + theme.mint = { + enable = lib.mkEnableOption "enables mint theme"; + theme.color = lib.mkOption { + type = lib.types.str; + default = "Dark-Aqua"; + description = "mint-y theme color eg. 'Dark-Aqua' or 'Red'"; + }; + icons.color = lib.mkOption { + type = lib.types.str; + default = "Aqua"; + description = "mint-y icons color eg. 'Aqua' or 'Red'"; + }; + }; + }; + + config = { + gtk = { + enable = true; + theme = lib.mkIf config.theme.mint.enable { + package = pkgs.cinnamon.mint-themes; + name = "Mint-Y-${config.theme.mint.theme.color}"; + }; + iconTheme = lib.mkIf config.theme.mint.enable { + package = pkgs.cinnamon.mint-y-icons; + name = "Mint-Y-${config.theme.mint.icons.color}"; + }; + cursorTheme = { + name = "Adwaita"; + }; + gtk3.bookmarks = [ + "file:///home/timmy/dls Downloads" + "file:///home/timmy/docs Documents" + "file:///home/timmy/docs/src/sites sites" + "file:///home/timmy/docs/src/scripts scripts" + "file:///home/timmy/docs/src/programs programs" + ]; + gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + }; + qt = { + enable = true; + platformTheme.name = "gtk3"; + }; + }; +} diff --git a/modules/hosts.nix b/modules/hosts.nix deleted file mode 100644 index 17e9cac..0000000 --- a/modules/hosts.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - networking.extraHosts = '' - 192.168.1.30 localgit - ''; -} diff --git a/modules/hosts/T430/configuration.nix b/modules/hosts/T430/configuration.nix new file mode 100644 index 0000000..a8744ba --- /dev/null +++ b/modules/hosts/T430/configuration.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: { + imports = [ ./hardware-configuration.nix ]; + networking.hostName = "T430"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.timmy = { + description = "Tim Keller"; + isNormalUser = true; + extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + ]; + }; + + # TODO this does not function + boot.initrd.systemd.extraBin = { + sh = "${pkgs.dash}/bin/dash"; + vim = "${pkgs.neovim}/bin/nvim"; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + system.stateVersion = "24.05"; +} diff --git a/modules/hosts/T430/hardware-configuration.nix b/modules/hosts/T430/hardware-configuration.nix new file mode 100644 index 0000000..206a525 --- /dev/null +++ b/modules/hosts/T430/hardware-configuration.nix @@ -0,0 +1,33 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/b991914b-3a4c-4248-9472-b5403729601a"; + fsType = "btrfs"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s25.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/localization.nix b/modules/localization.nix deleted file mode 100644 index 8313f07..0000000 --- a/modules/localization.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - time.timeZone = "America/Chicago"; - i18n.defaultLocale = "en_US.UTF-8"; - services.xserver.xkb.layout = "us"; -} diff --git a/modules/nix.nix b/modules/nix.nix deleted file mode 100644 index ff8dd28..0000000 --- a/modules/nix.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; - use-xdg-base-directories = true; - }; - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; -} diff --git a/modules/pipewire.nix b/modules/pipewire.nix deleted file mode 100644 index fd97d42..0000000 --- a/modules/pipewire.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, config, ... }: { - options = { - pipewire.enable = lib.mkEnableOption "enables pipewire"; - }; - - config = lib.mkIf config.pipewire.enable { - services.pipewire = { - enable = true; - pulse.enable = true; - }; - }; -} diff --git a/modules/root/awesome.nix b/modules/root/awesome.nix new file mode 100644 index 0000000..4db5230 --- /dev/null +++ b/modules/root/awesome.nix @@ -0,0 +1,9 @@ +{ lib, config, ... }: { + options = { + xserver.awesome.enable = lib.mkEnableOption "enables awesomewm"; + }; + + config = lib.mkIf config.xserver.awesome.enable { + services.xserver.windowManager.awesome.enable = true; + }; +} diff --git a/modules/root/cups.nix b/modules/root/cups.nix new file mode 100644 index 0000000..39f8434 --- /dev/null +++ b/modules/root/cups.nix @@ -0,0 +1,9 @@ +{ lib, config, ... }: { + options = { + cups.enable = lib.mkEnableOption "enables printing"; + }; + + config = lib.mkIf config.cups.enable { + services.printing.enable = true; + }; +} diff --git a/modules/root/default.nix b/modules/root/default.nix new file mode 100644 index 0000000..dd518d2 --- /dev/null +++ b/modules/root/default.nix @@ -0,0 +1,36 @@ +{ lib, ... }: { + imports = [ + ./awesome.nix + ./cups.nix + ./doas.nix + ./docker.nix + ./grub.nix + ./home-manager.nix + ./hosts.nix + ./localization.nix + ./nix.nix + ./pipewire.nix + ./software + ./virtualisation.nix + ./wifi.nix + ./x11 + ]; + + cups.enable = lib.mkDefault true; + doas.enable = lib.mkDefault true; + docker = { + enable = lib.mkDefault false; + btrfsSupport = lib.mkDefault true; + }; + grub = { + enable = lib.mkDefault true; + mode = lib.mkDefault "bios"; + biosDevice = lib.mkDefault "/dev/sda"; + }; + home-manager.enable = lib.mkDefault true; + pipewire.enable = lib.mkDefault true; + virtualisation.enable = lib.mkDefault false; + wifi.enable = lib.mkDefault true; + xserver.awesome.enable = lib.mkDefault true; + xserver.enable = lib.mkDefault true; +} diff --git a/modules/root/doas.nix b/modules/root/doas.nix new file mode 100644 index 0000000..2af324e --- /dev/null +++ b/modules/root/doas.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: { + options = { + doas.enable = lib.mkEnableOption "enables doas"; + sudo.enable = lib.mkEnableOption "enables sudo"; + }; + + config = lib.mkIf config.doas.enable { + security.doas.enable = true; + security.sudo.enable = config.sudo.enable; + security.doas.extraRules = [{ + groups = ["wheel"]; + keepEnv = true; + noPass = true; + }]; + }; +} diff --git a/modules/root/docker.nix b/modules/root/docker.nix new file mode 100644 index 0000000..d4b6272 --- /dev/null +++ b/modules/root/docker.nix @@ -0,0 +1,17 @@ +{ pkgs, lib, config, ... }: { + options = { + docker.enable = lib.mkEnableOption "enables docker"; + docker.btrfsSupport = lib.mkEnableOption "changes docker storageDriver to btrfs"; + }; + + config = lib.mkIf config.docker.enable { + virtualisation.docker = { + enable = true; + storageDriver = lib.mkIf config.docker.btrfsSupport "btrfs"; + }; + + environment.systemPackages = with pkgs; [ + docker-compose + ]; + }; +} diff --git a/modules/root/grub.nix b/modules/root/grub.nix new file mode 100644 index 0000000..47227d1 --- /dev/null +++ b/modules/root/grub.nix @@ -0,0 +1,26 @@ +{ lib, config, ... }: { + options = { + grub.enable = lib.mkEnableOption "enables docker"; + grub.mode = lib.mkOption { + type = lib.types.enum [ "efi" "bios" ]; + default = "efi"; + description = "grub mode efi or bios"; + }; + grub.biosDevice = lib.mkOption { + type = lib.types.str; + description = "device to install grub on"; + }; + }; + + config = lib.mkIf config.grub.enable { + boot.loader = { + grub = { + enable = true; + efiSupport = config.grub.mode == "efi"; + efiInstallAsRemovable = config.grub.mode == "efi"; + device = if config.grub.mode == "bios" then config.grub.biosDevice else "nodev"; + }; + efi.efiSysMountPoint = "/boot/efi"; + }; + }; +} diff --git a/modules/root/home-manager.nix b/modules/root/home-manager.nix new file mode 100644 index 0000000..d271523 --- /dev/null +++ b/modules/root/home-manager.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, ... }: { + options = { + home-manager.enable = lib.mkEnableOption "enables home-manager"; + }; + + config = lib.mkIf config.home-manager.enable { + environment.systemPackages = with pkgs; [ + home-manager + ]; + }; +} diff --git a/modules/root/hosts.nix b/modules/root/hosts.nix new file mode 100644 index 0000000..17e9cac --- /dev/null +++ b/modules/root/hosts.nix @@ -0,0 +1,5 @@ +{ + networking.extraHosts = '' + 192.168.1.30 localgit + ''; +} diff --git a/modules/root/localization.nix b/modules/root/localization.nix new file mode 100644 index 0000000..8313f07 --- /dev/null +++ b/modules/root/localization.nix @@ -0,0 +1,5 @@ +{ + time.timeZone = "America/Chicago"; + i18n.defaultLocale = "en_US.UTF-8"; + services.xserver.xkb.layout = "us"; +} diff --git a/modules/root/nix.nix b/modules/root/nix.nix new file mode 100644 index 0000000..ff8dd28 --- /dev/null +++ b/modules/root/nix.nix @@ -0,0 +1,11 @@ +{ + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + use-xdg-base-directories = true; + }; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; +} diff --git a/modules/root/pipewire.nix b/modules/root/pipewire.nix new file mode 100644 index 0000000..fd97d42 --- /dev/null +++ b/modules/root/pipewire.nix @@ -0,0 +1,12 @@ +{ lib, config, ... }: { + options = { + pipewire.enable = lib.mkEnableOption "enables pipewire"; + }; + + config = lib.mkIf config.pipewire.enable { + services.pipewire = { + enable = true; + pulse.enable = true; + }; + }; +} diff --git a/modules/root/software/default.nix b/modules/root/software/default.nix new file mode 100644 index 0000000..0ceef7f --- /dev/null +++ b/modules/root/software/default.nix @@ -0,0 +1,23 @@ +{ lib, ... }: { + imports = [ + ./desktop.nix + ./desktop-extra.nix + ./dev.nix + ./dev-extra.nix + ./utils.nix + ]; + + software = { + desktop = { + enable = lib.mkDefault true; + extra.enable = lib.mkDefault false; + }; + dev = { + enable = lib.mkDefault true; + extra.enable = lib.mkDefault false; + }; + utils = { + enable = lib.mkDefault true; + }; + }; +} diff --git a/modules/root/software/desktop-extra.nix b/modules/root/software/desktop-extra.nix new file mode 100644 index 0000000..a3bf8fb --- /dev/null +++ b/modules/root/software/desktop-extra.nix @@ -0,0 +1,16 @@ +{ pkgs, lib, config, ... }: { + options = { + software.desktop.extra.enable = lib.mkEnableOption "enables extra desktop apps"; + }; + + config = lib.mkIf config.software.desktop.extra.enable { + environment.systemPackages = with pkgs; [ + geeqie + gimp + inkscape + qbittorrent + qdirstat + ungoogled-chromium + ]; + }; +} diff --git a/modules/root/software/desktop.nix b/modules/root/software/desktop.nix new file mode 100644 index 0000000..195d742 --- /dev/null +++ b/modules/root/software/desktop.nix @@ -0,0 +1,22 @@ +{ pkgs, lib, config, ... }: { + options = { + software.desktop.enable = lib.mkEnableOption "enables desktop apps"; + }; + + config = lib.mkIf config.software.desktop.enable { + programs.dconf.enable = true; # For home-manager to configure gtk + + environment.systemPackages = with pkgs; [ + alacritty + arandr + dmenu + firefox + mpv + pavucontrol + pcmanfm + redshift + sxiv + zathura + ]; + }; +} diff --git a/modules/root/software/dev-extra.nix b/modules/root/software/dev-extra.nix new file mode 100644 index 0000000..b027b37 --- /dev/null +++ b/modules/root/software/dev-extra.nix @@ -0,0 +1,16 @@ +{ pkgs, lib, config, ... }: { + options = { + software.dev.extra.enable = lib.mkEnableOption "enables extra dev apps"; + }; + + config = lib.mkIf config.software.dev.extra.enable { + environment.systemPackages = with pkgs; [ + android-tools + cargo + hugo + #python-pip + uhubctl + wireguard-tools + ]; + }; +} diff --git a/modules/root/software/dev.nix b/modules/root/software/dev.nix new file mode 100644 index 0000000..b0dabcc --- /dev/null +++ b/modules/root/software/dev.nix @@ -0,0 +1,23 @@ +{ pkgs, lib, config, ... }: { + options = { + software.dev.enable = lib.mkEnableOption "enables dev apps"; + }; + + config = lib.mkIf config.software.dev.enable { + environment.systemPackages = with pkgs; [ + dash # TODO should be default /bin/sh + entr + gcc + git + gnumake + jq + lm_sensors + nmap + openssl + python3 + sassc + sslscan + wget + ]; + }; +} diff --git a/modules/root/software/utils.nix b/modules/root/software/utils.nix new file mode 100644 index 0000000..1efdb18 --- /dev/null +++ b/modules/root/software/utils.nix @@ -0,0 +1,30 @@ +{ pkgs, lib, config, ... }: { + options = { + software.utils.enable = lib.mkEnableOption "enables dev apps"; + }; + + config = lib.mkIf config.software.utils.enable { + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + services.openssh.enable = true; + + environment.systemPackages = with pkgs; [ + ddcutil # TODO + fastfetch + htop + light + neovim + p7zip + powertop + pv + rsync + screen + scrot + smartmontools + stress + testdisk + tmux + xxHash + ]; + }; +} diff --git a/modules/root/virtualisation.nix b/modules/root/virtualisation.nix new file mode 100644 index 0000000..d57d43e --- /dev/null +++ b/modules/root/virtualisation.nix @@ -0,0 +1,10 @@ +{ lib, config, ... }: { + options = { + virtualisation.enable = lib.mkEnableOption "enables virtualisation and virt-manager"; + }; + + config = lib.mkIf config.virtualisation.enable { + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + }; +} diff --git a/modules/root/wifi.nix b/modules/root/wifi.nix new file mode 100644 index 0000000..54f9089 --- /dev/null +++ b/modules/root/wifi.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, config, ... }: { + options = { + wifi.enable = lib.mkEnableOption "enables wifi"; + }; + + config = lib.mkIf config.wifi.enable { + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + }; +} diff --git a/modules/root/x11/default.nix b/modules/root/x11/default.nix new file mode 100644 index 0000000..8fa1d27 --- /dev/null +++ b/modules/root/x11/default.nix @@ -0,0 +1,30 @@ +{ pkgs, lib, config, ... }: { + options = { + xserver.enable = lib.mkEnableOption "enables xserver"; + }; + + config = lib.mkIf config.xserver.enable { + services.xserver.enable = true; + services.xserver.displayManager.startx.enable = true; + services.libinput.enable = true; # Enable touchpad support + + environment.systemPackages = with pkgs; [ + unclutter + xcape + xclip + xdotool + xorg.setxkbmap + xorg.xinput + xorg.xkill + xorg.xrandr + xorg.xset + xwallpaper + # Patch startx to be compliant with xdg base dir spec + (xorg.xinit.overrideAttrs (old: rec { + patches = [ + ./xinit-startx-xdg.patch + ]; + })) + ]; + }; +} diff --git a/modules/root/x11/xinit-startx-xdg.patch b/modules/root/x11/xinit-startx-xdg.patch new file mode 100644 index 0000000..c1bca97 --- /dev/null +++ b/modules/root/x11/xinit-startx-xdg.patch @@ -0,0 +1,14 @@ +diff --git a/startx.cpp b/startx.cpp +index dfbebe1..472a1b0 100644 +--- a/startx.cpp ++++ b/startx.cpp +@@ -272,7 +272,7 @@ if [ x"$enable_xauth" = x1 ] ; then + dummy=0 + + XCOMM create a file with auth information for the server. ':0' is a dummy. +- xserverauthfile=$HOME/.serverauth.$$ ++ xserverauthfile="${XAUTHORITY:-$HOME/.Xauthority}" + trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM + xauth -q -f "$xserverauthfile" << EOF + add :$dummy . $mcookie + diff --git a/modules/software/default.nix b/modules/software/default.nix deleted file mode 100644 index 0ceef7f..0000000 --- a/modules/software/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ lib, ... }: { - imports = [ - ./desktop.nix - ./desktop-extra.nix - ./dev.nix - ./dev-extra.nix - ./utils.nix - ]; - - software = { - desktop = { - enable = lib.mkDefault true; - extra.enable = lib.mkDefault false; - }; - dev = { - enable = lib.mkDefault true; - extra.enable = lib.mkDefault false; - }; - utils = { - enable = lib.mkDefault true; - }; - }; -} diff --git a/modules/software/desktop-extra.nix b/modules/software/desktop-extra.nix deleted file mode 100644 index 5347696..0000000 --- a/modules/software/desktop-extra.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.desktop.extra.enable = lib.mkEnableOption "enables extra desktop apps"; - }; - - config = lib.mkIf config.software.desktop.extra.enable { - environment.systemPackages = with pkgs; [ - geeqie - gimp - inkscape - qbittorrent - qdirstat - ungoogled-chromium - virt-manager - ]; - }; -} diff --git a/modules/software/desktop.nix b/modules/software/desktop.nix deleted file mode 100644 index 195d742..0000000 --- a/modules/software/desktop.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.desktop.enable = lib.mkEnableOption "enables desktop apps"; - }; - - config = lib.mkIf config.software.desktop.enable { - programs.dconf.enable = true; # For home-manager to configure gtk - - environment.systemPackages = with pkgs; [ - alacritty - arandr - dmenu - firefox - mpv - pavucontrol - pcmanfm - redshift - sxiv - zathura - ]; - }; -} diff --git a/modules/software/dev-extra.nix b/modules/software/dev-extra.nix deleted file mode 100644 index 259ae98..0000000 --- a/modules/software/dev-extra.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.dev.enable = lib.mkEnableOption "enables dev apps"; - }; - - config = lib.mkIf config.software.dev.extra.enable { - environment.systemPackages = with pkgs; [ - android-tools - cargo - hugo - #python-pip - uhubctl - wireguard-tools - ]; - }; -} diff --git a/modules/software/dev.nix b/modules/software/dev.nix deleted file mode 100644 index b0dabcc..0000000 --- a/modules/software/dev.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.dev.enable = lib.mkEnableOption "enables dev apps"; - }; - - config = lib.mkIf config.software.dev.enable { - environment.systemPackages = with pkgs; [ - dash # TODO should be default /bin/sh - entr - gcc - git - gnumake - jq - lm_sensors - nmap - openssl - python3 - sassc - sslscan - wget - ]; - }; -} diff --git a/modules/software/utils.nix b/modules/software/utils.nix deleted file mode 100644 index 1efdb18..0000000 --- a/modules/software/utils.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.utils.enable = lib.mkEnableOption "enables dev apps"; - }; - - config = lib.mkIf config.software.utils.enable { - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - services.openssh.enable = true; - - environment.systemPackages = with pkgs; [ - ddcutil # TODO - fastfetch - htop - light - neovim - p7zip - powertop - pv - rsync - screen - scrot - smartmontools - stress - testdisk - tmux - xxHash - ]; - }; -} diff --git a/modules/wifi.nix b/modules/wifi.nix deleted file mode 100644 index 54f9089..0000000 --- a/modules/wifi.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - wifi.enable = lib.mkEnableOption "enables wifi"; - }; - - config = lib.mkIf config.wifi.enable { - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - }; -} diff --git a/modules/x11/default.nix b/modules/x11/default.nix deleted file mode 100644 index 8fa1d27..0000000 --- a/modules/x11/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - xserver.enable = lib.mkEnableOption "enables xserver"; - }; - - config = lib.mkIf config.xserver.enable { - services.xserver.enable = true; - services.xserver.displayManager.startx.enable = true; - services.libinput.enable = true; # Enable touchpad support - - environment.systemPackages = with pkgs; [ - unclutter - xcape - xclip - xdotool - xorg.setxkbmap - xorg.xinput - xorg.xkill - xorg.xrandr - xorg.xset - xwallpaper - # Patch startx to be compliant with xdg base dir spec - (xorg.xinit.overrideAttrs (old: rec { - patches = [ - ./xinit-startx-xdg.patch - ]; - })) - ]; - }; -} diff --git a/modules/x11/xinit-startx-xdg.patch b/modules/x11/xinit-startx-xdg.patch deleted file mode 100644 index c1bca97..0000000 --- a/modules/x11/xinit-startx-xdg.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/startx.cpp b/startx.cpp -index dfbebe1..472a1b0 100644 ---- a/startx.cpp -+++ b/startx.cpp -@@ -272,7 +272,7 @@ if [ x"$enable_xauth" = x1 ] ; then - dummy=0 - - XCOMM create a file with auth information for the server. ':0' is a dummy. -- xserverauthfile=$HOME/.serverauth.$$ -+ xserverauthfile="${XAUTHORITY:-$HOME/.Xauthority}" - trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM - xauth -q -f "$xserverauthfile" << EOF - add :$dummy . $mcookie - -- cgit v1.2.3