From 00b3e60c6cc86bc43ff66f61c23a07057ec3bc87 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Mon, 8 Jan 2024 14:15:27 +0300 Subject: [PATCH] massive refactor!! done!! --- default.nix | 76 +++++++ flake.lock | 34 ++-- flake.nix | 88 ++++---- home-manager/editors.nix | 72 ------- home-manager/home.nix | 190 ------------------ hosts/goop-drive/default.nix | 82 ++++++++ .../goop-drive/hardware.nix | 13 +- .../lenovo-thinkpad-x1-1st-gen.nix | 4 +- lib/attrs.nix | 25 +++ lib/default.nix | 23 +++ lib/generators.nix | 32 +++ lib/modules.nix | 43 ++++ lib/nixos.nix | 35 ++++ lib/options.nix | 8 + modules/_template.nix | 16 -- modules/desktop/default.nix | 44 ++++ modules/desktop/fonts.nix | 101 ++++++++++ modules/desktop/gnome.nix | 104 ++++++++++ modules/desktop/themes/catppuccin/default.nix | 50 +++++ modules/desktop/themes/default.nix | 60 ++++++ modules/env.nix | 22 ++ modules/home-manager/alacritty.nix | 28 --- modules/home-manager/default.nix | 9 - modules/home-manager/disable-news.nix | 13 -- modules/home-manager/gnome-bindings.nix | 66 ------ modules/home-manager/gtk-config.nix | 50 ----- modules/home-manager/opinions.nix | 66 ------ modules/home-manager/shell-colors.nix | 23 --- modules/nixos/default.nix | 3 - modules/nixos/gnome.nix | 24 --- modules/security.nix | 78 +++++++ modules/software/dev/git.nix | 64 ++++++ modules/software/distractions/discord.nix | 37 ++++ modules/software/distractions/steam.nix | 20 ++ .../editors/micro.nix} | 32 ++- modules/software/editors/vscode.nix | 60 ++++++ modules/software/hardware/pipewire.nix | 24 +++ modules/software/system/alacritty.nix | 26 +++ modules/software/system/fish.nix | 27 +++ modules/software/system/syncthing.nix | 16 ++ .../software/system}/wireguard.nix | 0 modules/software/tools/noisetorch.nix | 14 ++ modules/software/tools/rbw.nix | 48 +++++ modules/user.nix | 44 ++++ modules/xdg.nix | 19 ++ nixos/configuration.nix | 84 -------- nixos/security.nix | 13 -- nixos/software.nix | 57 ------ nixos/users.nix | 15 -- overlays/default.nix | 26 --- overlays/mutter-dynamic-triple-buffering.nix | 12 ++ pkgs/default.nix | 5 - 52 files changed, 1283 insertions(+), 842 deletions(-) create mode 100644 default.nix delete mode 100644 home-manager/editors.nix delete mode 100644 home-manager/home.nix create mode 100644 hosts/goop-drive/default.nix rename nixos/hardware-configuration.nix => hosts/goop-drive/hardware.nix (79%) rename {nixos => hosts/goop-drive}/lenovo-thinkpad-x1-1st-gen.nix (88%) create mode 100644 lib/attrs.nix create mode 100644 lib/default.nix create mode 100644 lib/generators.nix create mode 100644 lib/modules.nix create mode 100644 lib/nixos.nix create mode 100644 lib/options.nix delete mode 100644 modules/_template.nix create mode 100644 modules/desktop/default.nix create mode 100644 modules/desktop/fonts.nix create mode 100644 modules/desktop/gnome.nix create mode 100644 modules/desktop/themes/catppuccin/default.nix create mode 100644 modules/desktop/themes/default.nix create mode 100644 modules/env.nix delete mode 100644 modules/home-manager/alacritty.nix delete mode 100644 modules/home-manager/default.nix delete mode 100644 modules/home-manager/disable-news.nix delete mode 100644 modules/home-manager/gnome-bindings.nix delete mode 100644 modules/home-manager/gtk-config.nix delete mode 100644 modules/home-manager/opinions.nix delete mode 100644 modules/home-manager/shell-colors.nix delete mode 100644 modules/nixos/default.nix delete mode 100644 modules/nixos/gnome.nix create mode 100644 modules/security.nix create mode 100644 modules/software/dev/git.nix create mode 100644 modules/software/distractions/discord.nix create mode 100644 modules/software/distractions/steam.nix rename modules/{home-manager/micro-colors.nix => software/editors/micro.nix} (68%) create mode 100644 modules/software/editors/vscode.nix create mode 100644 modules/software/hardware/pipewire.nix create mode 100644 modules/software/system/alacritty.nix create mode 100644 modules/software/system/fish.nix create mode 100644 modules/software/system/syncthing.nix rename {nixos => modules/software/system}/wireguard.nix (100%) create mode 100644 modules/software/tools/noisetorch.nix create mode 100644 modules/software/tools/rbw.nix create mode 100644 modules/user.nix create mode 100644 modules/xdg.nix delete mode 100644 nixos/configuration.nix delete mode 100644 nixos/security.nix delete mode 100644 nixos/software.nix delete mode 100644 nixos/users.nix delete mode 100644 overlays/default.nix create mode 100644 overlays/mutter-dynamic-triple-buffering.nix delete mode 100644 pkgs/default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..52e6d6a --- /dev/null +++ b/default.nix @@ -0,0 +1,76 @@ +{ + inputs, + config, + lib, + pkgs, + ... +}: let + inherit (builtins) toString; + inherit (lib.modules) mkAliasOptionModule mkDefault mkIf; + inherit (lib.my) mapModulesRec'; +in { + imports = + [ + inputs.home-manager.nixosModules.home-manager + inputs.nix-colors.homeManagerModules.default + (mkAliasOptionModule ["hm"] ["home-manager" "users" config.user.name]) + ] + ++ (mapModulesRec' (toString ./modules) import); + + # Common config for all nixos machines; + environment.variables = { + NIXPKGS_ALLOW_UNFREE = "1"; + }; + + nix = { + package = pkgs.nixVersions.stable; + + nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # Enables use of `nix-shell -p ...` etc + registry.nixpkgs.flake = inputs.nixpkgs; # Make `nix shell` etc use pinned nixpkgs + + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + substituters = ["https://nix-community.cachix.org"]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + }; + + system = { + stateVersion = "23.11"; + configurationRevision = with inputs; mkIf (self ? rev) self.rev; + }; + hm.home.stateVersion = config.system.stateVersion; + + boot = { + kernelPackages = mkDefault pkgs.unstable.linuxPackages_latest; + kernelParams = ["pcie_aspm.policy=performance"]; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = "workman"; + }; + console = { + useXkbConfig = mkDefault true; + }; + + time.timeZone = mkDefault "Europe/Moscow"; + + i18n.defaultLocale = mkDefault "en_GB.UTF-8"; + + hardware.enableRedistributableFirmware = true; + + environment.systemPackages = with pkgs; [ + unrar unzip + micro + curl wget + desktop-file-utils + shared-mime-info + xdg-user-dirs + xdg-utils + ]; +} diff --git a/flake.lock b/flake.lock index f797d49..eeac050 100644 --- a/flake.lock +++ b/flake.lock @@ -36,11 +36,11 @@ }, "hardware": { "locked": { - "lastModified": 1704458188, - "narHash": "sha256-f6BYEuIqnbrs6J/9m1/1VdkJ6d63hO9kUC09kTPuOqE=", + "lastModified": 1704632650, + "narHash": "sha256-83J/nd/NoLqo3vj0S0Ppqe8L+ijIFiGL6HNDfCCUD/Q=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "172385318068519900a7d71c1024242fa6af75f0", + "rev": "c478b3d56969006e015e55aaece4931f3600c1b2", "type": "github" }, "original": { @@ -122,34 +122,32 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1704194953, - "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=", - "owner": "nixos", + "lastModified": 1704161960, + "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6", + "rev": "63143ac2c9186be6d9da6035fa22620018c85932", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" } }, "nixpkgs_2": { "locked": { - "lastModified": 1704295289, - "narHash": "sha256-9WZDRfpMqCYL6g/HNWVvXF0hxdaAgwgIGeLYiOhmes8=", - "owner": "nixos", + "lastModified": 1704420045, + "narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "b0b2c5445c64191fd8d0b31f2b1a34e45a64547d", + "rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d", "type": "github" }, "original": { - "owner": "nixos", + "id": "nixpkgs", "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" + "type": "indirect" } }, "root": { diff --git a/flake.nix b/flake.nix index c1519d7..2022c3c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,9 @@ { - description = "goop-drive config"; + description = "λ simple and configureable Nix-Flake repository!"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "nixpkgs/nixos-23.11"; + nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable"; home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -14,59 +14,47 @@ catppuccin-vsc.url = "github:catppuccin/vscode"; }; - outputs = { + outputs = inputs @ { self, nixpkgs, - home-manager, - catppuccin-vsc, + nixpkgs-unstable, ... - } @ inputs: let - inherit (self) outputs; - # Supported systems for your flake packages, shell, etc. - systems = [ - "x86_64-linux" - ]; - # This is a function that generates an attribute by calling a function you - # pass to it, with each system as an argument - forAllSystems = nixpkgs.lib.genAttrs systems; + }: let + inherit (lib.my) mapModules mapModulesRec mapHosts; + system = "x86_64-linux"; + + mkPkgs = pkgs: extraOverlays: + import pkgs { + inherit system; + config.allowUnfree = true; + config.allowAliases = false; + overlays = extraOverlays ++ (lib.attrValues self.overlays); + }; + pkgs = mkPkgs nixpkgs [ self.overlays.default inputs.catppuccin-vsc.overlays.default ]; + pkgs-unstable = mkPkgs nixpkgs-unstable []; + + lib = nixpkgs.lib.extend (final: prev: { + my = import ./lib { + inherit pkgs inputs; + lib = final; + }; + }); in { - # Your custom packages - # Accessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); - # Formatter for your nix files, available through 'nix fmt' - # Other options beside 'alejandra' include 'nixpkgs-fmt' - formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + lib = lib.my; - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays {inherit inputs;}; - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; - - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - goop-drive = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./nixos/configuration.nix - ]; + overlays = + (mapModules ./overlays import) + // { + default = final: prev: { + unstable = pkgs-unstable; + my = self.packages.${system}; + }; }; - }; - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - "oatmealine@goop-drive" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home-manager/home.nix - ]; - }; - }; + packages."${system}" = mapModules ./packages (p: pkgs.callPackage p {}); + + nixosModules = mapModulesRec ./modules import; + + nixosConfigurations = mapHosts ./hosts {}; }; } diff --git a/home-manager/editors.nix b/home-manager/editors.nix deleted file mode 100644 index 3d38345..0000000 --- a/home-manager/editors.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ pkgs, config, lib, ... }: -{ - programs.vscode = { - enable = true; - extensions = with pkgs.vscode-extensions; [ - jnoortheen.nix-ide - sumneko.lua - ms-vsliveshare.vsliveshare - (catppuccin.catppuccin-vsc.override { - accent = "pink"; - boldKeywords = false; - italicComments = false; - italicKeywords = false; - extraBordersEnabled = false; - workbenchMode = "flat"; - #bracketMode = "rainbow"; - }) - ]; - mutableExtensionsDir = false; - enableExtensionUpdateCheck = false; - enableUpdateCheck = false; - userSettings = with config.opinions.fonts; { - "telemetry.enableTelemetry" = false; - - "editor.tabSize" = 2; - "editor.cursorSmoothCaretAnimation" = "on"; - - "editor.fontFamily" = "'${monospace.family}', monospace"; - "editor.fontSize" = monospace.size + 3; # no clue why i have to do this - - "terminal.integrated.fontFamily" = "\"${monospace.family}\""; - "terminal.integrated.fontSize" = monospace.size + 3; - - "window.dialogStyle" = "custom"; - "window.titleBarStyle" = "custom"; - - "workbench.tips.enabled" = false; - "workbench.colorTheme" = "Catppuccin Mocha"; - - "nix.enableLanguageServer" = true; - "nix.serverPath" = "${lib.getExe pkgs.nil}"; - - "security.workspace.trust.untrustedFiles" = "open"; - - "explorer.confirmDelete" = false; - "explorer.confirmDragAndDrop" = false; - - "editor.bracketPairColorization.enabled" = false; - "editor.smoothScrolling" = true; - "editor.wordWrap" = "on"; - "editor.wrappingStrategy" = "advanced"; - "editor.fontWeight" = "normal"; - "editor.semanticHighlighting.enabled" = true; - - # prevent VSCode from modifying the terminal colors - "terminal.integrated.minimumContrastRatio" = 1; - }; - }; - - programs.micro = { - enable = true; - settings = { - autosu = true; - clipboard = "terminal"; - savecursor = true; - scrollbar = true; - tabsize = 2; - tabstospaces = true; - }; - }; - microColors.enable = true; -} \ No newline at end of file diff --git a/home-manager/home.nix b/home-manager/home.nix deleted file mode 100644 index 060d83d..0000000 --- a/home-manager/home.nix +++ /dev/null @@ -1,190 +0,0 @@ -{ inputs, outputs, pkgs, lib, config, ... }: - -{ - imports = [ - inputs.nix-colors.homeManagerModules.default - outputs.homeManagerModules.alacritty - outputs.homeManagerModules.opinions - outputs.homeManagerModules.gtkConfig - outputs.homeManagerModules.shellColors - outputs.homeManagerModules.microColors - outputs.homeManagerModules.gnomeBindings - outputs.homeManagerModules.disableNews - ./editors.nix - ]; - - home.username = "oatmealine"; - home.homeDirectory = "/home/oatmealine"; - - nixpkgs.overlays = [ - outputs.overlays.additions - outputs.overlays.unstable-packages - inputs.catppuccin-vsc.overlays.default - ]; - - nixpkgs.config.allowUnfree = true; - - # Packages that should be installed to the user profile. - home.packages = with pkgs; let - discord = unstable.discord-canary.override { - withOpenASAR = true; - withVencord = true; - }; - in [ - # archives - zip xz unzip p7zip - # utils - ripgrep jq - # nix - nix-output-monitor - # dev - sqlitebrowser sqlite-interactive - # system - btop sysstat lm_sensors ethtool pciutils usbutils powertop killall - # debug - strace ltrace lsof - # apps - vivaldi telegram-desktop onlyoffice-bin gnome.gnome-tweaks discord mpv - # compatilibility - wine - # misc - cowsay file which tree gnused grc - # um - doas-sudo-shim gnome.dconf-editor rbw - ]; - - colorScheme = inputs.nix-colors.colorSchemes.catppuccin-mocha; - - opinions = { - fonts = { - regular = { - package = pkgs.atkinson-hyperlegible; - family = "Atkinson Hyperlegible"; - size = 11; - }; - monospace = { - package = pkgs.cozette; - family = "CozetteVector"; - size = 10; - }; - monospaceBitmap = { - package = pkgs.cozette; - family = "Cozette"; - size = 10; - }; - }; - - lowercaseXdgDirs = true; - }; - - programs.git = { - enable = true; - userName = ''Jill "oatmealine" Monoids''; - userEmail = "oatmealine@disroot.org"; - - extraConfig = { - push.autoSetupRemote = true; - pull.rebase = true; - init.defaultBranch = "main"; - }; - }; - - gtkConfig = { - enable = true; - preferDark = true; - cursor = { - package = pkgs.graphite-cursors; - name = "graphite-dark"; - }; - icon = { - package = pkgs.papirus-nord; - name = "Papirus-Dark"; - }; - }; - - alacritty.enable = true; - shellColors.enable = true; - programs.fish.enable = true; - programs.fish.plugins = [ { name = "grc"; src = pkgs.fishPlugins.grc.src; } ]; - services.syncthing.enable = true; - services.syncthing.tray.enable = true; - gnomeBindings.enable = true; - gnomeBindings.shell = { - # disable defaults - "screenshot" = []; - "screenshot-window" = []; - "show-screenshot-ui" = []; - }; - gnomeBindings.wm = { - #"panel-run-dialog" = [ "Launch1" ]; - }; - gnomeBindings.custom = { - "take-screenshot" = { - binding = "Print"; - command = "${lib.getExe pkgs.flameshot} gui"; - }; - "take-screen-recording" = { - binding = "Print"; - command = "${lib.getExe pkgs.peek}"; - }; - "grab-password" = let - grabScript = pkgs.writeScript "grab-password" '' - ${lib.getExe pkgs.rbw} get $(${lib.getExe pkgs.gnome.zenity} --entry --text="" --title="") | ${lib.getExe pkgs.xclip} -selection clipboard - ''; - in { - binding = "Launch1"; - command = ''${grabScript}''; - }; - }; - # usually you don't need to do this, but this is a workaround for https://github.com/flameshot-org/flameshot/issues/3328 - services.flameshot.enable = true; - - programs.rbw = let - passwordPath = "/home/oatmealine/sync/secrets/bitwardenpass-raw"; - # thank you, random site i found with google - # https://fossies.org/linux/gnupg/tests/fake-pinentries/fake-pinentry.sh - getPassword = pkgs.writeShellScriptBin "get-bw-password" '' - echo "OK ready" - while read cmd rest; do - cmd=$(printf "%s" "$cmd" | tr 'A-Z' 'a-z') - if [ -z "$cmd" ]; then - continue; - fi - case "$cmd" in - \#*) - ;; - getpin) - echo "D $(cat ${passwordPath})" - echo "OK" - ;; - bye) - echo "OK" - exit 0 - ;; - *) - echo "OK" - ;; - esac - done - ''; - in { - enable = true; - settings.base_url = "https://bitwarden.lavatech.top"; - settings.email = "oatmealine@disroot.org"; - settings.lock_timeout = 60 * 60 * 24 * 7; # 1 week - settings.pinentry = getPassword.overrideAttrs (old: { binaryPath = "bin/get-bw-password"; }); - }; - - # This value determines the home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new home Manager release introduces backwards - # incompatible changes. - # - # You can update home Manager without changing this value. See - # the home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "23.11"; - - # Let home Manager install and manage itself. - programs.home-manager.enable = true; -} diff --git a/hosts/goop-drive/default.nix b/hosts/goop-drive/default.nix new file mode 100644 index 0000000..2637aea --- /dev/null +++ b/hosts/goop-drive/default.nix @@ -0,0 +1,82 @@ +{ pkgs, lib, ... }: +{ + imports = [ ./hardware.nix ]; + + hm.home.packages = with pkgs; [ + # archives + zip xz unzip p7zip + # utils + ripgrep jq + # nix + nix-output-monitor + # dev + sqlitebrowser sqlite-interactive + # system + btop sysstat lm_sensors ethtool pciutils usbutils powertop killall + # debug + strace ltrace lsof + # apps + vivaldi telegram-desktop onlyoffice-bin mpv + # compatilibility + wine + # misc + cowsay file which tree gnused yt-dlp + ]; + + # usually you don't need to do this, but this is a workaround for https://github.com/flameshot-org/flameshot/issues/3328 + hm.services.flameshot.enable = true; + + modules = { + security.useDoas = true; + + hardware = { + pipewire.enable = true; + }; + desktop = { + envProto = "x11"; + gnome.enable = true; + gnome.keybinds.shell = { + # disable defaults + "screenshot" = []; + "screenshot-window" = []; + "show-screenshot-ui" = []; + }; + gnome.keybinds.custom = { + "take-screenshot" = { + binding = "Print"; + command = "${lib.getExe pkgs.flameshot} gui"; + }; + "take-screen-recording" = { + binding = "Print"; + command = "${lib.getExe pkgs.peek}"; + }; + "grab-password" = let + grabScript = pkgs.writeScript "grab-password" '' + ${lib.getExe pkgs.rbw} get $(${lib.getExe pkgs.gnome.zenity} --entry --text="" --title="") | ${lib.getExe pkgs.xclip} -selection clipboard + ''; + in { + binding = "Launch1"; + command = ''${grabScript}''; + }; + }; + themes.active = "catppuccin"; + }; + software = { + # system + system.alacritty.enable = true; + system.fish.enable = true; + system.syncthing.enable = true; + # dev + dev.git.enable = true; + # editors + editors.vscode.enable = true; + editors.micro.enable = true; + # tools + tools.rbw.enable = true; + tools.noisetorch.enable = true; + # distractions + distractions.steam.enable = true; + distractions.discord.enable = true; + }; + }; +} diff --git a/nixos/hardware-configuration.nix b/hosts/goop-drive/hardware.nix similarity index 79% rename from nixos/hardware-configuration.nix rename to hosts/goop-drive/hardware.nix index 6343a39..050082b 100644 --- a/nixos/hardware-configuration.nix +++ b/hosts/goop-drive/hardware.nix @@ -1,9 +1,14 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ inputs, config, lib, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + inputs.hardware.nixosModules.common-cpu-intel + inputs.hardware.nixosModules.common-pc-laptop-ssd + inputs.hardware.nixosModules.common-pc-laptop + + (modulesPath + "/installer/scan/not-detected.nix") + ./lenovo-thinkpad-x1-1st-gen.nix + ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; diff --git a/nixos/lenovo-thinkpad-x1-1st-gen.nix b/hosts/goop-drive/lenovo-thinkpad-x1-1st-gen.nix similarity index 88% rename from nixos/lenovo-thinkpad-x1-1st-gen.nix rename to hosts/goop-drive/lenovo-thinkpad-x1-1st-gen.nix index 4680de1..ef6a792 100644 --- a/nixos/lenovo-thinkpad-x1-1st-gen.nix +++ b/hosts/goop-drive/lenovo-thinkpad-x1-1st-gen.nix @@ -1,11 +1,11 @@ # Largely based upon https://www.thinkwiki.org/wiki/X1_Linux_Tweaks -{ config, ... }: +{ ... }: { # Laptop-specific battery usage tuning powerManagement.enable = true; # Tune power saving options on boot - #powerManagement.powertop.enable = true; + powerManagement.powertop.enable = true; # Thermald proactively prevents overheating on Intel CPUs and works well with other tools. services.thermald.enable = true; diff --git a/lib/attrs.nix b/lib/attrs.nix new file mode 100644 index 0000000..e5890b4 --- /dev/null +++ b/lib/attrs.nix @@ -0,0 +1,25 @@ +{lib, ...}: let + inherit (lib.lists) any count; + inherit (lib.attrsets) filterAttrs listToAttrs mapAttrs' mapAttrsToList; +in rec { + # attrsToList + attrsToList = attrs: + mapAttrsToList (name: value: {inherit name value;}) attrs; + + # mapFilterAttrs :: + # (name -> value -> bool) + # (name -> value -> { name = any; value = any; }) + # attrs + mapFilterAttrs = pred: f: attrs: filterAttrs pred (mapAttrs' f attrs); + + # Generate an attribute set by mapping a function over a list of values. + genAttrs' = values: f: listToAttrs (map f values); + + # anyAttrs :: (name -> value -> bool) attrs + anyAttrs = pred: attrs: + any (attr: pred attr.name attr.value) (attrsToList attrs); + + # countAttrs :: (name -> value -> bool) attrs + countAttrs = pred: attrs: + count (attr: pred attr.name attr.value) (attrsToList attrs); +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..b5c813b --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,23 @@ +{ + inputs, + lib, + pkgs, + ... +}: let + inherit (lib.attrsets) attrValues; + inherit (lib.fixedPoints) makeExtensible; + inherit (lib.lists) foldr; + inherit (modules) mapModules; + + modules = import ./modules.nix { + inherit lib; + self.attrs = import ./attrs.nix { + inherit lib; + self = {}; + }; + }; + mylib = + makeExtensible (self: + mapModules ./. (file: import file {inherit self lib pkgs inputs;})); +in + mylib.extend (self: super: foldr (a: b: a // b) {} (attrValues super)) diff --git a/lib/generators.nix b/lib/generators.nix new file mode 100644 index 0000000..55eec63 --- /dev/null +++ b/lib/generators.nix @@ -0,0 +1,32 @@ +{ + lib, + pkgs, + ... +}: let + inherit (builtins) baseNameOf; + inherit (lib.strings) removeSuffix; +in { + toCSSFile = file: let + fileName = removeSuffix ".scss" (baseNameOf file); + compiledStyles = pkgs.runCommand "compileScssFile" {buildInputs = [pkgs.sass];} '' + mkdir "$out" + scss --sourcemap=none \ + --no-cache \ + --style compressed \ + --default-encoding utf-8 \ + "${file}" \ + >>"$out/${fileName}.css" + ''; + in "${compiledStyles}/${fileName}.css"; + + toFilteredImage = imageFile: options: let + result = "result.png"; + filteredImage = + pkgs.runCommand "filterWallpaper" { + buildInputs = [pkgs.imagemagick]; + } '' + mkdir "$out" + convert ${options} ${imageFile} $out/${result} + ''; + in "${filteredImage}/${result}"; +} diff --git a/lib/modules.nix b/lib/modules.nix new file mode 100644 index 0000000..bb30ed5 --- /dev/null +++ b/lib/modules.nix @@ -0,0 +1,43 @@ +{ + lib, + self, + ... +}: let + inherit (builtins) attrValues readDir pathExists concatLists; + inherit (lib.attrsets) mapAttrsToList filterAttrs nameValuePair; + inherit (lib.strings) hasPrefix hasSuffix removeSuffix; + inherit (lib.trivial) id; + inherit (self.attrs) mapFilterAttrs; +in rec { + mapModules = dir: fn: + mapFilterAttrs (n: v: v != null && !(hasPrefix "_" n)) (n: v: let + path = "${toString dir}/${n}"; + in + if v == "directory" && pathExists "${path}/default.nix" + then nameValuePair n (fn path) + else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n + then nameValuePair (removeSuffix ".nix" n) (fn path) + else nameValuePair "" null) (readDir dir); + + mapModules' = dir: fn: attrValues (mapModules dir fn); + + mapModulesRec = dir: fn: + mapFilterAttrs (n: v: v != null && !(hasPrefix "_" n)) (n: v: let + path = "${toString dir}/${n}"; + in + if v == "directory" + then nameValuePair n (mapModulesRec path fn) + else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n + then nameValuePair (removeSuffix ".nix" n) (fn path) + else nameValuePair "" null) (readDir dir); + + mapModulesRec' = dir: fn: let + dirs = + mapAttrsToList (k: _: "${dir}/${k}") + (filterAttrs (n: v: v == "directory" && !(hasPrefix "_" n)) + (readDir dir)); + files = attrValues (mapModules dir id); + paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs); + in + map fn paths; +} diff --git a/lib/nixos.nix b/lib/nixos.nix new file mode 100644 index 0000000..40c0032 --- /dev/null +++ b/lib/nixos.nix @@ -0,0 +1,35 @@ +{ + inputs, + lib, + pkgs, + self, + ... +}: let + inherit (inputs.nixpkgs.lib) nixosSystem; + inherit (builtins) baseNameOf elem; + inherit (lib.attrsets) filterAttrs; + inherit (lib.modules) mkDefault; + inherit (lib.strings) removeSuffix; + inherit (self.modules) mapModules; +in rec { + mkHost = path: attrs @ {system ? "x86_64-linux", ...}: + nixosSystem { + inherit system; + + specialArgs = {inherit lib inputs system;}; + + modules = [ + { + nixpkgs.pkgs = pkgs; + networking.hostName = + mkDefault (removeSuffix ".nix" (baseNameOf path)); + } + (filterAttrs (n: v: !elem n ["system"]) attrs) + ../. # /default.nix + (import path) + ]; + }; + + mapHosts = dir: attrs @ {system ? system, ...}: + mapModules dir (hostPath: mkHost hostPath attrs); +} diff --git a/lib/options.nix b/lib/options.nix new file mode 100644 index 0000000..ca175d6 --- /dev/null +++ b/lib/options.nix @@ -0,0 +1,8 @@ +{lib, ...}: let + inherit (lib.options) mkOption; +in { + mkOpt = type: default: mkOption {inherit type default;}; + + mkOpt' = type: default: description: + mkOption {inherit type default description;}; +} diff --git a/modules/_template.nix b/modules/_template.nix deleted file mode 100644 index b5c105c..0000000 --- a/modules/_template.nix +++ /dev/null @@ -1,16 +0,0 @@ -# Module template - -{ lib, config, inputs, ... }: - -with lib; -let - cfg = config.thing; -in { - options.thing = { - enable = mkEnableOption "TODO"; - }; - - config = mkIf cfg.enable { - - }; -} \ No newline at end of file diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..241de25 --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.desktop; +in { + options.modules.desktop = { + envProto = mkOption { + type = types.nullOr (types.enum ["x11" "wayland"]); + description = "What display protocol to use."; + default = null; + }; + }; + + config = { + env = { + QT_QPA_PLATFORMTHEME = "gnome"; + QT_STYLE_OVERRIDE = "Adwaita"; + }; + + modules.desktop.fonts.enable = true; + modules.desktop.fonts.baseFonts = true; + + #xdg.portal = { + # enable = true; + # extraPortals = [pkgs.xdg-desktop-portal-gtk]; + # config.common.default = "*"; + #}; + + services.gnome.gnome-keyring.enable = true; + + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable networking + networking.networkmanager.enable = true; + + # Speed up boot + # https://discourse.nixos.org/t/boot-faster-by-disabling-udev-settle-and-nm-wait-online/6339 + systemd.services.systemd-udev-settle.enable = false; + systemd.services.NetworkManager-wait-online.enable = false; + }; +} \ No newline at end of file diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix new file mode 100644 index 0000000..aee87fb --- /dev/null +++ b/modules/desktop/fonts.nix @@ -0,0 +1,101 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + # ty https://github.com/Misterio77/nix-config/blob/main/modules/home-manager/fonts.nix + mkFontOption = kind: default: { + family = mkOption { + type = types.str; + default = default.family; + description = "Family name for ${kind} font profile"; + example = "Fira Code"; + }; + package = mkOption { + type = types.package; + default = default.package; + description = "Package for ${kind} font profile"; + example = "pkgs.fira-code"; + }; + size = mkOption { + type = types.number; + default = default.size; + description = "${kind} font profile size, px"; + example = "11"; + }; + }; + cfg = config.modules.desktop.fonts; +in { + options.modules.desktop.fonts = { + enable = mkEnableOption "Enable the font configuration module"; + baseFonts = mkEnableOption "Add a set of extra base fonts"; + + fonts = { + sans = mkFontOption "sans" { + package = pkgs.atkinson-hyperlegible; + family = "Atkinson Hyperlegible"; + size = 11; + }; + sansSerif = mkFontOption "sans-serif" { + package = pkgs.atkinson-hyperlegible; + family = "Atkinson Hyperlegible"; + size = 11; + }; + monospace = mkFontOption "monospace" { + package = pkgs.cozette; + family = "CozetteVector"; + size = 10; + }; + monospaceBitmap = mkFontOption "bitmap monospace" { + package = pkgs.cozette; + family = "Cozette"; + size = 10; + }; + emoji = mkFontOption "emoji" { + package = pkgs.twitter-color-emoji; + family = "Twitter Color Emoji"; + size = 10; # not applicable, but whatever + }; + }; + }; + + config = mkIf cfg.enable { + fonts = { + fontDir.enable = true; + fontconfig.enable = true; + fontconfig.defaultFonts = { + sans = [ cfg.fonts.sans.family ]; + sansSerif = [ cfg.fonts.sansSerif.family ]; + monospace = [ cfg.fonts.monospace.family ]; + emoji = [ cfg.fonts.emoji.family ]; + }; + enableGhostscriptFonts = true; + packages = with pkgs; [ + corefonts + noto-fonts + noto-fonts-cjk-sans + liberation_ttf + ] ++ [ + cfg.fonts.sans.package + cfg.fonts.sansSerif.package + cfg.fonts.monospace.package + cfg.fonts.monospaceBitmap.package + cfg.fonts.emoji.package + ]; + }; + + hm.gtk.enable = true; + hm.gtk.font = { + inherit (cfg.fonts.sans) package name size; + }; + } // (mkIf cfg.baseFonts { + fonts.packages = with pkgs; [ + fira-code + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + proggyfonts + atkinson-hyperlegible + cozette + ]; + }); +} \ No newline at end of file diff --git a/modules/desktop/gnome.nix b/modules/desktop/gnome.nix new file mode 100644 index 0000000..6728298 --- /dev/null +++ b/modules/desktop/gnome.nix @@ -0,0 +1,104 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.desktop.gnome; +in { + options.modules.desktop.gnome = { + enable = mkEnableOption "Enable the Gnome desktop environment"; + keybinds = { + shell = mkOption { + description = ''Override Gnome shell keybindings (org/gnome/shell/keybindings/...)''; + type = types.attrsOf (types.listOf types.str); + example = ''{ screenshot = [ "Print" ]; }''; + default = {}; + }; + + wm = mkOption { + description = ''Override Gnome window manager keybindings (org/gnome/desktop/wm/keybindings/...)''; + type = types.attrsOf (types.listOf types.str); + example = ''{ panel-run-dialog = [ "r" ]; }''; + default = {}; + }; + + mutter = mkOption { + description = ''Override Mutter keybindings (org/gnome/mutter/keybindings/...)''; + type = types.attrsOf (types.listOf types.str); + example = ''{ rotate-monitor = [ "l" ] }''; + default = {}; + }; + + custom = mkOption { + type = types.attrsOf (types.submodule { + options = { + binding = mkOption { + description = "The keybind combination to activate this binding"; + example = ''"t"''; + }; + command = mkOption { + description = "The command to execute upon activation"; + example = ''"alacritty"''; + }; + }; + }); + default = {}; + }; + }; + }; + + config = mkIf cfg.enable { + programs.dconf.enable = true; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.desktopManager.gnome.enable = true; + + services.xserver.displayManager.gdm = { + enable = true; + wayland = mkForce (config.modules.desktop.envProto == "wayland"); + }; + + services.gnome.sushi.enable = true; + + hm.home.packages = with pkgs; [ + dconf2nix + gnome.gnome-disk-utility + gnome.dconf-editor + gnome.gnome-tweaks + ] ++ (with pkgs.gnomeExtensions; [ + appindicator + clipboard-indicator + espresso + user-themes + + # just out of curiosity + aylurs-widgets + blur-my-shell + dash-to-dock + just-perfection + rounded-window-corners + space-bar + ]); + + hm.dconf = let + # [ binding ] + customBindings = attrValues (mapAttrs (name: value: { name = name; binding = value.binding; command = value.command; }) cfg.keybinds.custom); + # [ { key, binding } ] + customBindingSets = imap0 (i: v: { name = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}"; value = v; }) customBindings; + # { key = binding } + customBindingsAttr = listToAttrs customBindingSets; + in { + settings = { + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = map (n: "/${n}/") (attrNames customBindingsAttr); + }; + + "org/gnome/shell/keybindings" = cfg.keybinds.shell; + "org/gnome/desktop/wm/keybindings" = cfg.keybinds.wm; + "org/gnome/mutter/keybindings" = cfg.keybinds.mutter; + } // customBindingsAttr; + }; + }; +} \ No newline at end of file diff --git a/modules/desktop/themes/catppuccin/default.nix b/modules/desktop/themes/catppuccin/default.nix new file mode 100644 index 0000000..1edf194 --- /dev/null +++ b/modules/desktop/themes/catppuccin/default.nix @@ -0,0 +1,50 @@ +{ inputs, config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.desktop.themes; + #accent = "pink"; # TODO? +in { + config = mkIf (cfg.active == "catppuccin") { + colorScheme = inputs.nix-colors.colorSchemes.catppuccin-mocha; + + modules.desktop.themes = { + dark = true; + + gtkTheme = { + name = "Catppuccin-Mocha-Compact-Pink-Dark"; + package = pkgs.catppuccin-gtk.override { + variant = "mocha"; + accents = ["pink"]; + tweaks = ["rimless"]; + size = "compact"; + }; + }; + + iconTheme = { + name = "WhiteSur-dark"; + package = pkgs.whitesur-icon-theme; + }; + + cursor = { + package = pkgs.graphite-cursors; + name = "graphite-dark"; + }; + + editor = { + vscode = { + name = "Catppuccin Mocha"; + extension = (pkgs.vscode-extensions.catppuccin.catppuccin-vsc.override { + accent = "pink"; + boldKeywords = false; + italicComments = false; + italicKeywords = false; + extraBordersEnabled = false; + workbenchMode = "flat"; + #bracketMode = "rainbow"; + }); + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/desktop/themes/default.nix b/modules/desktop/themes/default.nix new file mode 100644 index 0000000..ba2a287 --- /dev/null +++ b/modules/desktop/themes/default.nix @@ -0,0 +1,60 @@ +{ lib, config, ... }: + +with lib; +with lib.my; +let + cfg = config.modules.desktop.themes; +in { + options.modules.desktop.themes = with types; { + active = mkOption { + type = types.nullOr types.str; + default = null; + description = "Name of the theme to apply; see modules/desktop/themes for a list of valid options"; + }; + + dark = mkOpt bool false; + + gtkTheme = { + name = mkOpt str ""; + package = mkPackageOption pkgs "gtk" {}; + }; + iconTheme = { + name = mkOpt str ""; + package = mkPackageOption pkgs "icon" {}; + }; + cursor = { + name = mkOpt str ""; + package = mkPackageOption pkgs "cursor" {}; + }; + + editor = { + vscode = { + name = mkOpt str ""; + extension = mkPackageOption pkgs "extension" {}; + }; + }; + }; + + config = mkIf (cfg.active != null) { + programs.dconf.enable = true; + + hm.dconf = { + enable = true; + settings."org/gnome/desktop/interface".color-scheme = mkIf cfg.dark "prefer-dark"; + }; + + hm.gtk = { + enable = true; + cursorTheme = cfg.cursor; + iconTheme = cfg.iconTheme; + theme = cfg.gtkTheme; + }; + + hm.programs.vscode = { + extensions = [ cfg.editor.vscode.extension ]; + userSettings = { + "workbench.colorTheme" = cfg.editor.vscode.name; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/env.nix b/modules/env.nix new file mode 100644 index 0000000..36c38b6 --- /dev/null +++ b/modules/env.nix @@ -0,0 +1,22 @@ +{ lib, config, ... }: + +with lib; +{ + options = { + env = mkOption { + type = with types; attrsOf (oneOf [str path (listOf (either str path))]); + apply = mapAttrs (n: v: + if isList v + then concatMapStringsSep ":" (x: toString x) v + else (toString v)); + default = {}; + description = "Provides easy-access to `environment.extraInit`"; + }; + }; + + config = { + environment.extraInit = + concatStringsSep "\n" + (mapAttrsToList (n: v: ''export ${n}="${v}"'') config.env); + }; +} \ No newline at end of file diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix deleted file mode 100644 index e1a9461..0000000 --- a/modules/home-manager/alacritty.nix +++ /dev/null @@ -1,28 +0,0 @@ -# alacritty - a cross-platform, GPU-accelerated terminal emulator - -{ lib, config, inputs, ... }: - -with lib; -let - cfg = config.alacritty; -in { - options.alacritty = { - enable = mkEnableOption "Enable Alacritty config"; - }; - - config = mkIf cfg.enable { - programs.alacritty = { - enable = true; - # custom settings - settings = { - env.TERM = "xterm-256color"; - window.resize_increments = true; - colors.draw_bold_text_with_bright_colors = true; - font = { - normal = { family = config.opinions.fonts.monospaceBitmap.family; }; - size = config.opinions.fonts.monospaceBitmap.size; - }; - }; - }; - }; -} \ No newline at end of file diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix deleted file mode 100644 index 281c474..0000000 --- a/modules/home-manager/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - alacritty = import ./alacritty.nix; - opinions = import ./opinions.nix; - gtkConfig = import ./gtk-config.nix; - shellColors = import ./shell-colors.nix; - microColors = import ./micro-colors.nix; - gnomeBindings = import ./gnome-bindings.nix; - disableNews = import ./disable-news.nix; -} diff --git a/modules/home-manager/disable-news.nix b/modules/home-manager/disable-news.nix deleted file mode 100644 index 35c7329..0000000 --- a/modules/home-manager/disable-news.nix +++ /dev/null @@ -1,13 +0,0 @@ -# It doesn't even work out of the box with flakes... -# -# -# Include this in the `modules` passed to -# `inputs.home-manager.lib.homeManagerConfiguration`. -{ lib, ... }: { - # disabledModules = [ "misc/news.nix" ]; - config = { - news.display = "silent"; - news.json = lib.mkForce { }; - news.entries = lib.mkForce [ ]; - }; -} \ No newline at end of file diff --git a/modules/home-manager/gnome-bindings.nix b/modules/home-manager/gnome-bindings.nix deleted file mode 100644 index 172b5a9..0000000 --- a/modules/home-manager/gnome-bindings.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ config, lib, ... }: - -with lib; -let - cfg = config.gnomeBindings; -in { - options.gnomeBindings = { - enable = mkEnableOption "Enable Gnome bindings"; - - shell = mkOption { - description = ''Override Gnome shell keybindings (org/gnome/shell/keybindings/...)''; - type = types.attrsOf (types.listOf types.str); - example = ''{ screenshot = [ "Print" ]; }''; - default = {}; - }; - - wm = mkOption { - description = ''Override Gnome window manager keybindings (org/gnome/desktop/wm/keybindings/...)''; - type = types.attrsOf (types.listOf types.str); - example = ''{ panel-run-dialog = [ "r" ]; }''; - default = {}; - }; - - mutter = mkOption { - description = ''Override Mutter keybindings (org/gnome/mutter/keybindings/...)''; - type = types.attrsOf (types.listOf types.str); - example = ''{ rotate-monitor = [ "l" ] }''; - default = {}; - }; - - custom = mkOption { - type = types.attrsOf (types.submodule { - options = { - binding = mkOption { - description = "The keybind combination to activate this binding"; - example = ''"t"''; - }; - command = mkOption { - description = "The command to execute upon activation"; - example = ''"alacritty"''; - }; - }; - }); - default = {}; - }; - }; - - config = mkIf cfg.enable (let - # [ binding ] - customBindings = attrValues (mapAttrs (name: value: { name = name; binding = value.binding; command = value.command; }) cfg.custom); - # [ { key, binding } ] - customBindingSets = imap0 (i: v: { name = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}"; value = v; }) customBindings; - # { key = binding } - customBindingsAttr = listToAttrs customBindingSets; - in { - dconf.settings = { - "org/gnome/settings-daemon/plugins/media-keys" = { - custom-keybindings = map (n: "/${n}/") (attrNames customBindingsAttr); - }; - - "org/gnome/shell/keybindings" = cfg.shell; - "org/gnome/desktop/wm/keybindings" = cfg.wm; - "org/gnome/mutter/keybindings" = cfg.mutter; - } // customBindingsAttr; - }); -} \ No newline at end of file diff --git a/modules/home-manager/gtk-config.nix b/modules/home-manager/gtk-config.nix deleted file mode 100644 index 1d3d98f..0000000 --- a/modules/home-manager/gtk-config.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ lib, config, inputs, pkgs, ... }: - -with lib; -let - cfg = config.gtkConfig; - nix-colors-lib = inputs.nix-colors.lib.contrib { inherit pkgs; }; -in { - options.gtkConfig = { - enable = mkEnableOption "Enable GTK configuration"; - preferDark = mkEnableOption "Prefer dark themes"; - cursor = mkOption { - type = types.submodule { - options = { - package = mkOption { type = types.package; }; - name = mkOption { type = types.str; }; - }; - }; - }; - icon = mkOption { - type = types.submodule { - options = { - package = mkOption { type = types.package; }; - name = mkOption { type = types.str; }; - }; - }; - }; - }; - - config = mkIf cfg.enable { - dconf = { - enable = true; - settings."org/gnome/desktop/interface".color-scheme = mkIf cfg.preferDark "prefer-dark"; - }; - - gtk = { - enable = true; - cursorTheme = cfg.cursor; - iconTheme = cfg.icon; - font = { - package = config.opinions.fonts.regular.package; - name = config.opinions.fonts.regular.family; - size = config.opinions.fonts.regular.size; - }; - theme = { - package = nix-colors-lib.gtkThemeFromScheme { scheme = config.colorScheme; }; - name = config.colorScheme.slug; - }; - }; - }; -} \ No newline at end of file diff --git a/modules/home-manager/opinions.nix b/modules/home-manager/opinions.nix deleted file mode 100644 index acbd844..0000000 --- a/modules/home-manager/opinions.nix +++ /dev/null @@ -1,66 +0,0 @@ -# Opinionated tweaks and values. Mostly configurable! - -{ lib, config, inputs, ... }: - -with lib; -let - # ty https://github.com/Misterio77/nix-config/blob/main/modules/home-manager/fonts.nix - mkFontOption = kind: { - family = mkOption { - type = types.str; - default = null; - description = "Family name for ${kind} font profile"; - example = "Fira Code"; - }; - package = mkOption { - type = types.package; - default = null; - description = "Package for ${kind} font profile"; - example = "pkgs.fira-code"; - }; - size = mkOption { - type = types.number; - default = 11; - description = "${kind} font profile size, px"; - example = "11"; - }; - }; - cfg = config.opinions; -in { - options.opinions = { - enable = mkEnableOption "Whether to enable opinionated tweaks"; - - fonts = mkOption { - type = types.submodule { - options = { - regular = mkFontOption "regular"; - monospace = mkFontOption "monospace"; - monospaceBitmap = mkFontOption "bitmap monospace"; - }; - }; - }; - - lowercaseXdgDirs = mkEnableOption "Make XDG folder names all lowercase"; - }; - - config = mkIf cfg.enable { - # fonts - fonts.fontconfig.enable = true; - home.packages = [ cfg.fonts.monospace.package cfg.regular.package ]; - - # xdg dirs - xdg.userDirs = mkIf cfg.lowercaseXdgDirs { - enable = true; - createDirectories = true; - - desktop = "$HOME/desktop"; - documents = "$HOME/documents"; - download = "$HOME/downloads"; - music = "$HOME/music"; - pictures = "$HOME/pictures"; - publicShare = "$HOME/public"; - templates = "$HOME/templates"; - videos = "$HOME/videos"; - }; - }; -} \ No newline at end of file diff --git a/modules/home-manager/shell-colors.nix b/modules/home-manager/shell-colors.nix deleted file mode 100644 index 875883a..0000000 --- a/modules/home-manager/shell-colors.nix +++ /dev/null @@ -1,23 +0,0 @@ -# Sets up shell colors - -{ lib, config, inputs, pkgs, ... }: - -with lib; -let - cfg = config.shellColors; - nix-colors-lib = inputs.nix-colors.lib.contrib { inherit pkgs; }; -in { - options.shellColors = { - enable = mkEnableOption "Enable shell color config"; - }; - - config = mkIf cfg.enable { - programs.fish = let - colorScript = nix-colors-lib.shellThemeFromScheme { scheme = config.colorScheme; }; - in { - interactiveShellInit = '' - sh ${colorScript} - ''; - }; - }; -} \ No newline at end of file diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix deleted file mode 100644 index f86b276..0000000 --- a/modules/nixos/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - gnome = ./gnome.nix; -} diff --git a/modules/nixos/gnome.nix b/modules/nixos/gnome.nix deleted file mode 100644 index 4c719d8..0000000 --- a/modules/nixos/gnome.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, config, inputs, pkgs, ... }: - -with lib; -let - cfg = config.gnome; -in { - options.gnome = { - enable = mkEnableOption "Use GNOME as the desktop manager"; - wayland = mkEnableOption "Use Wayland"; - }; - - config = mkIf cfg.enable { - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - services.xserver.desktopManager.gnome.enable = true; - - services.xserver.displayManager.gdm = { - enable = true; - wayland = mkForce cfg.wayland; - }; - }; -} diff --git a/modules/security.nix b/modules/security.nix new file mode 100644 index 0000000..40419f8 --- /dev/null +++ b/modules/security.nix @@ -0,0 +1,78 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.security; +in { + options.modules.security = { + useDoas = mkEnableOption "Use opendoas instead of sudo"; + }; + + config = { + boot = { + tmp.useTmpfs = lib.mkDefault true; + tmp.cleanOnBoot = lib.mkDefault (!config.boot.tmp.useTmpfs); + + # Disable kernel-param editing on boot + loader.systemd-boot.editor = false; + + kernel.sysctl = { + # Magic SysRq key -> allows performing low-level commands. + "kernel.sysrq" = 0; + + ## TCP hardening + # Prevent bogus ICMP errors from filling up logs. + "net.ipv4.icmp_ignore_bogus_error_responses" = 1; + # Reverse path filtering causes the kernel to do source validation of + # packets received from all interfaces. This can mitigate IP spoofing. + "net.ipv4.conf.default.rp_filter" = 1; + "net.ipv4.conf.all.rp_filter" = 1; + # Do not accept IP source route packets (we're not a router) + "net.ipv4.conf.all.accept_source_route" = 0; + "net.ipv6.conf.all.accept_source_route" = 0; + # Don't send ICMP redirects (again, we're on a router) + "net.ipv4.conf.all.send_redirects" = 0; + "net.ipv4.conf.default.send_redirects" = 0; + # Refuse ICMP redirects (MITM mitigations) + "net.ipv4.conf.all.accept_redirects" = 0; + "net.ipv4.conf.default.accept_redirects" = 0; + "net.ipv4.conf.all.secure_redirects" = 0; + "net.ipv4.conf.default.secure_redirects" = 0; + "net.ipv6.conf.all.accept_redirects" = 0; + "net.ipv6.conf.default.accept_redirects" = 0; + # Protects against SYN flood attacks + "net.ipv4.tcp_syncookies" = 1; + # Incomplete protection again TIME-WAIT assassination + "net.ipv4.tcp_rfc1337" = 1; + + ## TCP optimization + # Enable TCP Fast Open for incoming and outgoing connections + "net.ipv4.tcp_fastopen" = 3; + # Bufferbloat mitigations + slight improvement in throughput & latency + "net.ipv4.tcp_congestion_control" = "bbr"; + "net.core.default_qdisc" = "cake"; + }; + kernelModules = ["tcp_bbr"]; + }; + + user.initialPassword = "nixos"; + users.users.root.initialPassword = "nixos"; + + security = { + # Prevent replacing the running kernel w/o reboot + protectKernelImage = true; + # Allows unautherized applications -> send unautherization request + polkit.enable = true; + rtkit.enable = true; + }; + + networking.firewall.enable = false; + } // (mkIf cfg.useDoas { + security.sudo.enable = false; + security.doas.enable = true; + security.doas.extraRules = [ + { users = [ config.user.name ]; noPass = true; persist = false; keepEnv = true; } + ]; + environment.systemPackages = with pkgs; [ doas-sudo-shim ]; + }); +} diff --git a/modules/software/dev/git.nix b/modules/software/dev/git.nix new file mode 100644 index 0000000..a1428ce --- /dev/null +++ b/modules/software/dev/git.nix @@ -0,0 +1,64 @@ +{ pkgs, config, lib, ... }: + +with lib; +let + cfg = config.modules.software.dev.git; +in { + options.modules.software.dev.git = { + enable = mkEnableOption "Enable git. You know what git is"; + }; + + config = mkIf cfg.enable { + hm.programs.git = { + enable = true; + package = pkgs.gitFull; + + userName = ''Jill "oatmealine" Monoids''; + userEmail = "oatmealine@disroot.org"; + + ignores = [ + # General: + "*.bloop" + "*.bsp" + "*.metals" + "*.metals.sbt" + "*metals.sbt" + "*.direnv" + "*.envrc" + "*hie.yaml" + "*.mill-version" + "*.jvmopts" + + # OS-related: + ".DS_Store?" + ".DS_Store" + ".CFUserTextEncoding" + ".Trash" + ".Xauthority" + "thumbs.db" + "Thumbs.db" + "Icon?" + ]; + + aliases = { + # Data Analysis: + ranked-authors = "!git authors | sort | uniq -c | sort -n"; + emails = '' + !git log --format="%aE" | sort -u + ''; + email-domains = '' + !git log --format="%aE" | awk -F'@' '{print $2}' | sort -u + ''; + graph = '' + log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n" + ''; + }; + + extraConfig = { + push.autoSetupRemote = true; + pull.rebase = true; + init.defaultBranch = "main"; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/software/distractions/discord.nix b/modules/software/distractions/discord.nix new file mode 100644 index 0000000..4da6e6b --- /dev/null +++ b/modules/software/distractions/discord.nix @@ -0,0 +1,37 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.software.distractions.discord; +in { + options.modules.software.distractions.discord = { + enable = mkEnableOption "Enable Discord, a social messaging app"; + }; + + config = mkIf cfg.enable { + user.packages = let + flags = + [ + "--flag-switches-begin" + "--flag-switches-end" + "--disable-gpu-memory-buffer-video-frames" + "--enable-accelerated-mjpeg-decode" + "--enable-accelerated-video" + "--enable-gpu-rasterization" + "--enable-native-gpu-memory-buffers" + "--enable-zero-copy" + "--ignore-gpu-blocklist" + "--disable-features=UseOzonePlatform" + "--enable-features=VaapiVideoDecoder" + ]; + discord = (pkgs.unstable.discord-canary.override { + withOpenASAR = true; + withVencord = true; + }).overrideAttrs (old: { + preInstall = '' + gappsWrapperArgs+=("--add-flags" "${concatStringsSep " " flags}") + ''; + }); + in [ discord ]; + }; +} \ No newline at end of file diff --git a/modules/software/distractions/steam.nix b/modules/software/distractions/steam.nix new file mode 100644 index 0000000..055bbb8 --- /dev/null +++ b/modules/software/distractions/steam.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: + +with lib; +let + cfg = config.modules.software.distractions.steam; +in { + options.modules.software.distractions.steam = { + enable = mkEnableOption "Enable Steam, the game distribution software"; + }; + + config = mkIf cfg.enable { + programs.steam.enable = true; + # https://github.com/FeralInteractive/gamemode + programs.gamemode = { + enable = true; + enableRenice = true; + settings = {}; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/micro-colors.nix b/modules/software/editors/micro.nix similarity index 68% rename from modules/home-manager/micro-colors.nix rename to modules/software/editors/micro.nix index 8e91311..f06225e 100644 --- a/modules/home-manager/micro-colors.nix +++ b/modules/software/editors/micro.nix @@ -1,17 +1,33 @@ -{ lib, config, ... }: +{ config, lib, ... }: with lib; let - cfg = config.microColors; - name = "generated"; + cfg = config.modules.software.editors.micro; in { - options.microColors = { - enable = mkEnableOption "Enable shell color config"; + options.modules.software.editors.micro = { + enable = mkEnableOption "Enable micro, the simple command-line code editor"; }; - config = mkIf cfg.enable { - programs.micro.settings.colorScheme = name; - home.file.".config/micro/colorschemes/${name}.micro".text = with config.colorScheme.colors; '' + config = let + schemeName = "generated"; + in mkIf cfg.enable { + environment.variables.EDITOR = "micro"; + + hm.programs.micro = { + enable = true; + settings = { + autosu = true; + clipboard = "terminal"; + savecursor = true; + scrollbar = true; + tabsize = 2; + tabstospaces = true; + + colorScheme = schemeName; + }; + }; + + hm.home.file.".config/micro/colorschemes/${schemeName}.micro".text = with config.colorScheme.colors; '' color-link default "#${base05},#${base00}" color-link comment "#${base03},#${base00}" color-link identifier "#${base0D},#${base00}" diff --git a/modules/software/editors/vscode.nix b/modules/software/editors/vscode.nix new file mode 100644 index 0000000..63d111d --- /dev/null +++ b/modules/software/editors/vscode.nix @@ -0,0 +1,60 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.software.editors.vscode; +in { + options.modules.software.editors.vscode = { + enable = mkEnableOption "Enable VSCode, Microsoft's GUI code editor"; + }; + + config = mkIf cfg.enable { + hm.programs.vscode = { + enable = true; + extensions = with pkgs.vscode-extensions; [ + jnoortheen.nix-ide + sumneko.lua + ms-vsliveshare.vsliveshare + ]; + mutableExtensionsDir = false; + enableExtensionUpdateCheck = false; + enableUpdateCheck = false; + userSettings = with config.modules.desktop.fonts.fonts; { + "editor.fontFamily" = "'${monospace.family}', monospace"; + "editor.fontSize" = monospace.size + 3; # no clue why i have to do this + + "terminal.integrated.fontFamily" = "\"${monospace.family}\""; + "terminal.integrated.fontSize" = monospace.size + 3; + + "telemetry.enableTelemetry" = false; + + "editor.tabSize" = 2; + "editor.cursorSmoothCaretAnimation" = "on"; + + "window.dialogStyle" = "custom"; + "window.titleBarStyle" = "custom"; + + "workbench.tips.enabled" = false; + "workbench.colorTheme" = "Catppuccin Mocha"; + + "nix.enableLanguageServer" = true; + "nix.serverPath" = "${lib.getExe pkgs.nil}"; + + "security.workspace.trust.untrustedFiles" = "open"; + + "explorer.confirmDelete" = false; + "explorer.confirmDragAndDrop" = false; + + "editor.bracketPairColorization.enabled" = false; + "editor.smoothScrolling" = true; + "editor.wordWrap" = "on"; + "editor.wrappingStrategy" = "advanced"; + "editor.fontWeight" = "normal"; + "editor.semanticHighlighting.enabled" = true; + + # prevent VSCode from modifying the terminal colors + "terminal.integrated.minimumContrastRatio" = 1; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/software/hardware/pipewire.nix b/modules/software/hardware/pipewire.nix new file mode 100644 index 0000000..22bc383 --- /dev/null +++ b/modules/software/hardware/pipewire.nix @@ -0,0 +1,24 @@ +{ config, lib, ... }: + +with lib; +let + cfg = config.modules.hardware.pipewire; +in { + options.modules.hardware.pipewire = { + enable = mkEnableOption "Enable pipewire, a modern audio server"; + }; + + config = mkIf cfg.enable { + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + }; +} \ No newline at end of file diff --git a/modules/software/system/alacritty.nix b/modules/software/system/alacritty.nix new file mode 100644 index 0000000..ee3f0f1 --- /dev/null +++ b/modules/software/system/alacritty.nix @@ -0,0 +1,26 @@ +{ lib, config, ... }: + +with lib; +let + cfg = config.modules.software.system.alacritty; +in { + options.modules.software.system.alacritty = { + enable = mkEnableOption "Enable Alacritty, an OpenGL terminal emulator"; + }; + + config = mkIf cfg.enable { + hm.programs.alacritty = { + enable = true; + # custom settings + settings = { + env.TERM = "xterm-256color"; + window.resize_increments = true; + colors.draw_bold_text_with_bright_colors = true; + font = with config.modules.desktop.fonts.fonts.monospaceBitmap; { + normal = { inherit family; }; + inherit size; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/software/system/fish.nix b/modules/software/system/fish.nix new file mode 100644 index 0000000..90455b6 --- /dev/null +++ b/modules/software/system/fish.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, inputs, ... }: + +with lib; +let + cfg = config.modules.software.system.fish; + nix-colors-lib = inputs.nix-colors.lib.contrib { inherit pkgs; }; +in { + options.modules.software.system.fish = { + enable = mkEnableOption "Enable fish, the friendly interpreted shell"; + }; + + config = mkIf cfg.enable { + user.packages = [ pkgs.grc ]; + + users.defaultUserShell = pkgs.fish; + programs.fish.enable = true; + hm.programs.fish = let + colorScript = nix-colors-lib.shellThemeFromScheme { scheme = config.colorScheme; }; + in { + enable = true; + plugins = [ { name = "grc"; src = pkgs.fishPlugins.grc.src; } ]; + interactiveShellInit = '' + sh ${colorScript} + ''; + }; + }; +} \ No newline at end of file diff --git a/modules/software/system/syncthing.nix b/modules/software/system/syncthing.nix new file mode 100644 index 0000000..84db940 --- /dev/null +++ b/modules/software/system/syncthing.nix @@ -0,0 +1,16 @@ +{ config, lib, ... }: + +with lib; +let + cfg = config.modules.software.system.syncthing; +in { + options.modules.software.system.syncthing = { + enable = mkEnableOption "Enable Syncthing, a file synchronization server"; + }; + + config = mkIf cfg.enable { + # todo: declare sync folders & devices here + hm.services.syncthing.enable = true; + hm.services.syncthing.tray.enable = true; + }; +} \ No newline at end of file diff --git a/nixos/wireguard.nix b/modules/software/system/wireguard.nix similarity index 100% rename from nixos/wireguard.nix rename to modules/software/system/wireguard.nix diff --git a/modules/software/tools/noisetorch.nix b/modules/software/tools/noisetorch.nix new file mode 100644 index 0000000..a21196a --- /dev/null +++ b/modules/software/tools/noisetorch.nix @@ -0,0 +1,14 @@ +{ config, lib, ... }: + +with lib; +let + cfg = config.modules.software.tools.noisetorch; +in { + options.modules.software.tools.noisetorch = { + enable = mkEnableOption "Enable noisetorch, a microphone noise supression tool"; + }; + + config = mkIf cfg.enable { + programs.noisetorch.enable = true; + }; +} \ No newline at end of file diff --git a/modules/software/tools/rbw.nix b/modules/software/tools/rbw.nix new file mode 100644 index 0000000..17ed206 --- /dev/null +++ b/modules/software/tools/rbw.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.software.tools.rbw; +in { + options.modules.software.tools.rbw = { + enable = mkEnableOption "Enable rbw, a Bitwarden CLI password manager"; + }; + + config = mkIf cfg.enable { + hm.programs.rbw = let + passwordPath = "/home/oatmealine/sync/secrets/bitwardenpass-raw"; + # thank you, random site i found with google + # https://fossies.org/linux/gnupg/tests/fake-pinentries/fake-pinentry.sh + getPassword = pkgs.writeShellScriptBin "get-bw-password" '' + echo "OK ready" + while read cmd rest; do + cmd=$(printf "%s" "$cmd" | tr 'A-Z' 'a-z') + if [ -z "$cmd" ]; then + continue; + fi + case "$cmd" in + \#*) + ;; + getpin) + echo "D $(cat ${passwordPath})" + echo "OK" + ;; + bye) + echo "OK" + exit 0 + ;; + *) + echo "OK" + ;; + esac + done + ''; + in { + enable = true; + settings.base_url = "https://bitwarden.lavatech.top"; + settings.email = "oatmealine@disroot.org"; + settings.lock_timeout = 60 * 60 * 24 * 7; # 1 week + settings.pinentry = getPassword.overrideAttrs (old: { binaryPath = "bin/get-bw-password"; }); + }; + }; +} \ No newline at end of file diff --git a/modules/user.nix b/modules/user.nix new file mode 100644 index 0000000..40f7cd2 --- /dev/null +++ b/modules/user.nix @@ -0,0 +1,44 @@ +# Assumes a single-user setup + +{ config, pkgs, lib, options, ... }: + +with lib; +with lib.my; +{ + options = { + user = mkOpt types.attrs {}; + }; + + config = { + user = rec { + name = "oatmealine"; + description = "Primary user account"; + extraGroups = ["wheel" "input" "audio" "video" "storage"]; + isNormalUser = true; + home = "/home/${name}"; + group = name; + uid = 1000; + }; + users.groups.${config.user.group} = {}; + + users.users.${config.user.name} = mkAliasDefinitions options.user; + + home-manager.useUserPackages = true; + + hm.home.username = config.user.name; + hm.home.homeDirectory = lib.mkForce config.user.home; + + nix.settings = let + users = ["root" config.user.name]; + in { + trusted-users = users; + allowed-users = users; + }; + + users.users.root = { + packages = [ pkgs.shadow ]; + shell = pkgs.shadow; + hashedPassword = "!"; + }; + }; +} \ No newline at end of file diff --git a/modules/xdg.nix b/modules/xdg.nix new file mode 100644 index 0000000..e0644bd --- /dev/null +++ b/modules/xdg.nix @@ -0,0 +1,19 @@ +{ ... }: +{ + config = { + hm.xdg.enable = true; + hm.xdg.userDirs = { + enable = true; + createDirectories = true; + + desktop = "$HOME/desktop"; + documents = "$HOME/documents"; + download = "$HOME/downloads"; + music = "$HOME/music"; + pictures = "$HOME/pictures"; + publicShare = "$HOME/public"; + templates = "$HOME/templates"; + videos = "$HOME/videos"; + }; + }; +} \ No newline at end of file diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index af0ca95..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ config, pkgs, inputs, outputs, ... }: - -{ - imports = - [ - inputs.hardware.nixosModules.common-cpu-intel - inputs.hardware.nixosModules.common-pc-laptop-ssd - inputs.hardware.nixosModules.common-pc-laptop - ./lenovo-thinkpad-x1-1st-gen.nix - - ./hardware-configuration.nix - - outputs.nixosModules.gnome - - ./security.nix - ./users.nix - ./software.nix - ./wireguard.nix - ]; - - nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowAliases = false; - nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; - substituters = - [ "https://nix-community.cachix.org" "https://devenv.cachix.org" ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - ]; - }; - nixpkgs.overlays = [ - outputs.overlays.additions - outputs.overlays.unstable-packages - outputs.overlays.dynamic-triple-buffering - ]; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "goop-drive"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Moscow"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - # Configure keymap in X11 - services.xserver = { - layout = "us"; - xkbVariant = "workman"; - }; - console.useXkbConfig = true; - - # Prefer tlp over Gnome's power-profiles-daemon - #services.power-profiles-daemon.enable = false; - #services.tlp.enable = true; - - # Enable CUPS to print documents. - #services.printing.enable = false; - - # 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; - # }; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/nixos/security.nix b/nixos/security.nix deleted file mode 100644 index 067e3d3..0000000 --- a/nixos/security.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - security.sudo.enable = false; - security.doas.enable = true; - security.doas.extraRules = [ - { users = [ "oatmealine" ]; noPass = true; persist = false; keepEnv = true; } - ]; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - networking.firewall.enable = false; -} \ No newline at end of file diff --git a/nixos/software.nix b/nixos/software.nix deleted file mode 100644 index a24eb44..0000000 --- a/nixos/software.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ pkgs, ... }: - -{ - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - - gnome = { - enable = true; - wayland = false; - }; - - programs.fish.enable = true; - users.defaultUserShell = pkgs.fish; - programs.steam.enable = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - micro - git - curl - wget - doas - catppuccin-gtk - home-manager - wireguard-tools - ]; - - environment.variables.EDITOR = "micro"; - - fonts.packages = with pkgs; [ - corefonts - noto-fonts - noto-fonts-cjk-sans - twitter-color-emoji - liberation_ttf - fira-code - fira-code-symbols - mplus-outline-fonts.githubRelease - dina-font - proggyfonts - atkinson-hyperlegible - cozette - ]; - - services.flatpak.enable = true; - programs.noisetorch.enable = true; -} diff --git a/nixos/users.nix b/nixos/users.nix deleted file mode 100644 index 0c41302..0000000 --- a/nixos/users.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -{ - users.users.oatmealine = { - isNormalUser = true; - description = "jill"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - - users.users.root = { - packages = [ pkgs.shadow ]; - shell = pkgs.shadow; - hashedPassword = "!"; - }; -} \ No newline at end of file diff --git a/overlays/default.nix b/overlays/default.nix deleted file mode 100644 index 17b0be8..0000000 --- a/overlays/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{inputs, ...}: { - # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs {pkgs = final;}; - - # When applied, the unstable nixpkgs set (declared in the flake inputs) will - # be accessible through 'pkgs.unstable' - unstable-packages = final: _prev: { - unstable = import inputs.nixpkgs-unstable { - system = final.system; - config.allowUnfree = true; - }; - }; - - dynamic-triple-buffering = (final: prev: { - gnome = prev.gnome.overrideScope' (gnomeFinal: gnomePrev: { - mutter = gnomePrev.mutter.overrideAttrs ( old: { - src = prev.fetchgit { - url = "https://gitlab.gnome.org/vanvugt/mutter.git"; - # GNOME 45: triple-buffering-v4-45 - rev = "0b896518b2028d9c4d6ea44806d093fd33793689"; - sha256 = "sha256-mzNy5GPlB2qkI2KEAErJQzO//uo8yO0kPQUwvGDwR4w="; - }; - } ); - }); - }); -} diff --git a/overlays/mutter-dynamic-triple-buffering.nix b/overlays/mutter-dynamic-triple-buffering.nix new file mode 100644 index 0000000..4adf308 --- /dev/null +++ b/overlays/mutter-dynamic-triple-buffering.nix @@ -0,0 +1,12 @@ +final: prev: { + gnome = prev.gnome.overrideScope' (gnomeFinal: gnomePrev: { + mutter = gnomePrev.mutter.overrideAttrs ( old: { + src = prev.fetchgit { + url = "https://gitlab.gnome.org/vanvugt/mutter.git"; + # GNOME 45: triple-buffering-v4-45 + rev = "0b896518b2028d9c4d6ea44806d093fd33793689"; + sha256 = "sha256-mzNy5GPlB2qkI2KEAErJQzO//uo8yO0kPQUwvGDwR4w="; + }; + } ); + }); +} \ No newline at end of file diff --git a/pkgs/default.nix b/pkgs/default.nix deleted file mode 100644 index 3d9e23c..0000000 --- a/pkgs/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -# Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' -pkgs: { - # example = pkgs.callPackage ./example { }; -}