diff --git a/flake.lock b/flake.lock index d67915c4..5c1f83ea 100644 --- a/flake.lock +++ b/flake.lock @@ -389,39 +389,18 @@ "type": "github" } }, - "home-manager-stable": { - "inputs": { - "nixpkgs": [ - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1726989464, - "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-24.05", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager-unstable": { + "home-manager_2": { "inputs": { "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1738275749, - "narHash": "sha256-PM+cGduJ05EZ+YXulqAwUFjvfKpPmW080mcuN6R1POw=", + "lastModified": 1739044880, + "narHash": "sha256-l+bzq9rsBIQQnBtGayJeOS30L53+mYPjgfQALi20XDg=", "owner": "nix-community", "repo": "home-manager", - "rev": "a8159195bfaef3c64df75d3b1e6a68d49d392be9", + "rev": "bf9a1a068919ccdfa7d130873936c5fd4c826e85", "type": "github" }, "original": { @@ -431,7 +410,7 @@ "type": "github" } }, - "home-manager_2": { + "home-manager_3": { "inputs": { "nixpkgs": [ "stylix", @@ -749,32 +728,6 @@ "type": "github" } }, - "nix-formatter-pack": { - "inputs": { - "nixpkgs": [ - "nix-on-droid", - "nixpkgs" - ], - "nmd": [ - "nix-on-droid", - "nmd" - ], - "nmt": "nmt" - }, - "locked": { - "lastModified": 1705252799, - "narHash": "sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c=", - "owner": "Gerschtli", - "repo": "nix-formatter-pack", - "rev": "2de39dedd79aab14c01b9e2934842051a160ffa5", - "type": "github" - }, - "original": { - "owner": "Gerschtli", - "repo": "nix-formatter-pack", - "type": "github" - } - }, "nix-github-actions": { "inputs": { "nixpkgs": [ @@ -798,34 +751,6 @@ "type": "github" } }, - "nix-on-droid": { - "inputs": { - "home-manager": [ - "home-manager-unstable" - ], - "nix-formatter-pack": "nix-formatter-pack", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-docs": "nixpkgs-docs", - "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap", - "nmd": "nmd" - }, - "locked": { - "lastModified": 1725658585, - "narHash": "sha256-P29z4Gt89n5ps1U7+qmIrj0BuRXGZQSIaOe2+tsPgfw=", - "owner": "nix-community", - "repo": "nix-on-droid", - "rev": "5d88ff2519e4952f8d22472b52c531bb5f1635fc", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "master", - "repo": "nix-on-droid", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1737929020, @@ -842,38 +767,6 @@ "type": "github" } }, - "nixpkgs-docs": { - "locked": { - "lastModified": 1705957679, - "narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9a333eaa80901efe01df07eade2c16d183761fa3", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-for-bootstrap": { - "locked": { - "lastModified": 1720244366, - "narHash": "sha256-WrDV0FPMVd2Sq9hkR5LNHudS3OSMmUrs90JUTN+MXpA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "49ee0e94463abada1de470c9c07bfc12b36dcf40", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "49ee0e94463abada1de470c9c07bfc12b36dcf40", - "type": "github" - } - }, "nixpkgs-stable": { "locked": { "lastModified": 1738163270, @@ -953,6 +846,18 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 0, + "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "path": "/nix/store/pgg4vm83q0kr4hxzcwhdgdiv2yfnh3dw-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1736798957, "narHash": "sha256-qwpCtZhSsSNQtK4xYGzMiyEDhkNzOCz/Vfu4oL2ETsQ=", @@ -968,44 +873,6 @@ "type": "github" } }, - "nmd": { - "inputs": { - "nixpkgs": [ - "nix-on-droid", - "nixpkgs-docs" - ], - "scss-reset": "scss-reset" - }, - "locked": { - "lastModified": 1705050560, - "narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=", - "owner": "~rycee", - "repo": "nmd", - "rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3", - "type": "sourcehut" - }, - "original": { - "owner": "~rycee", - "repo": "nmd", - "type": "sourcehut" - } - }, - "nmt": { - "flake": false, - "locked": { - "lastModified": 1648075362, - "narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=", - "owner": "rycee", - "repo": "nmt", - "rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae", - "type": "gitlab" - }, - "original": { - "owner": "rycee", - "repo": "nmt", - "type": "gitlab" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -1035,15 +902,14 @@ "blocklist-hosts": "blocklist-hosts", "chaotic": "chaotic", "emacs-overlay": "emacs-overlay", - "home-manager-stable": "home-manager-stable", - "home-manager-unstable": "home-manager-unstable", + "home-manager": "home-manager_2", "hyprland": "hyprland", "hyprlock": "hyprlock", "hyprutils": "hyprutils", - "nix-on-droid": "nix-on-droid", "nixpkgs": "nixpkgs_2", "nixpkgs-stable": "nixpkgs-stable_3", "rust-overlay": "rust-overlay", + "secrets": "secrets", "stylix": "stylix" } }, @@ -1082,20 +948,19 @@ "type": "github" } }, - "scss-reset": { - "flake": false, + "secrets": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, "locked": { - "lastModified": 1631450058, - "narHash": "sha256-muDlZJPtXDIGevSEWkicPP0HQ6VtucbkMNygpGlBEUM=", - "owner": "andreymatin", - "repo": "scss-reset", - "rev": "0cf50e27a4e95e9bb5b1715eedf9c54dee1a5a91", - "type": "github" + "lastModified": 1739133600, + "narHash": "sha256-5xe63u5z/+yauwl/e++ZTDelVK0CBF32GborYfCuBl8=", + "path": "/etc/nixos.secrets", + "type": "path" }, "original": { - "owner": "andreymatin", - "repo": "scss-reset", - "type": "github" + "path": "/etc/nixos.secrets", + "type": "path" } }, "stylix": { @@ -1109,8 +974,8 @@ "flake-utils": "flake-utils", "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", - "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs_4", + "home-manager": "home-manager_3", + "nixpkgs": "nixpkgs_5", "systems": "systems_4", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", diff --git a/flake.nix b/flake.nix index 50754623..947263f5 100644 --- a/flake.nix +++ b/flake.nix @@ -3,57 +3,11 @@ outputs = inputs@{ self, ... }: let - # ---- SYSTEM SETTINGS ---- # - systemSettings = { - system = "x86_64-linux"; # system arch - hostname = "snowfire"; # hostname - profile = "personal"; # select a profile defined from my profiles directory - timezone = "America/Chicago"; # select timezone - locale = "en_US.UTF-8"; # select locale - bootMode = "uefi"; # uefi or bios - bootMountPath = "/boot"; # mount path for efi boot partition; only used for uefi boot mode - grubDevice = ""; # device identifier for grub; only used for legacy (bios) boot mode - gpuType = "amd"; # amd, intel or nvidia; only makes some slight mods for amd at the moment - }; - - # ----- USER SETTINGS ----- # - userSettings = rec { - username = "emmet"; # username - name = "Emmet"; # name/identifier - email = "emmet@librephoenix.com"; # email (used for certain configurations) - dotfilesDir = "~/.dotfiles"; # absolute path of the local repo - theme = "io"; # selcted theme from my themes directory (./themes/) - wm = "hyprland"; # Selected window manager or desktop environment; must select one in both ./user/wm/ and ./system/wm/ - # window manager type (hyprland or x11) translator - wmType = if (wm == "hyprland") then "wayland" else "x11"; - browser = "qutebrowser"; # Default browser; must select one from ./user/app/browser/ - spawnBrowser = if ((browser == "qutebrowser") && (wm == "hyprland")) then "qutebrowser-hyprprofile" else (if (browser == "qutebrowser") then "qutebrowser --qt-flag ignore-gpu-blacklist --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag enable-accelerated-2d-canvas --qt-flag num-raster-threads=4" else browser); # Browser spawn command must be specail for qb, since it doesn't gpu accelerate by default (why?) - defaultRoamDir = "Personal.p"; # Default org roam directory relative to ~/Org - term = "alacritty"; # Default terminal command; - font = "Intel One Mono"; # Selected font - fontPkg = pkgs.intel-one-mono; # Font package - editor = "emacsclient"; # Default editor; - # editor spawning translator - # generates a command that can be used to spawn editor inside a gui - # EDITOR and TERM session variables must be set in home.nix or other module - # I set the session variable SPAWNEDITOR to this in my home.nix for convenience - spawnEditor = if (editor == "emacsclient") then - "emacsclient -c -a 'emacs'" - else - (if ((editor == "vim") || - (editor == "nvim") || - (editor == "nano")) then - "exec " + term + " -e " + editor - else - (if (editor == "neovide") then - "neovide -- --listen /tmp/nvimsocket" - else - editor)); - }; + system = "x86_64-linux"; # create patched nixpkgs nixpkgs-patched = - (import inputs.nixpkgs { system = systemSettings.system; }).applyPatches { + (import inputs.nixpkgs { inherit system; }).applyPatches { name = "nixpkgs-patched"; src = inputs.nixpkgs; patches = [ ]; @@ -62,135 +16,63 @@ # configure pkgs # use nixpkgs if running a server (homelab or worklab profile) # otherwise use patched nixos-unstable nixpkgs - pkgs = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) - then - pkgs-stable - else - (import nixpkgs-patched { - system = systemSettings.system; - config = { - allowUnfree = true; - allowUnfreePredicate = (_: true); - }; - overlays = [ inputs.rust-overlay.overlays.default - inputs.emacs-overlay.overlays.default - ]; - })); - - pkgs-stable = import inputs.nixpkgs-stable { - system = systemSettings.system; + pkgs = import nixpkgs-patched { + inherit system; config = { allowUnfree = true; allowUnfreePredicate = (_: true); }; + overlays = [ inputs.rust-overlay.overlays.default inputs.emacs-overlay.overlays.default ]; }; - pkgs-unstable = import inputs.nixpkgs-patched { - system = systemSettings.system; + pkgs-stable = import inputs.nixpkgs-stable { + inherit system; config = { allowUnfree = true; allowUnfreePredicate = (_: true); }; - overlays = [ inputs.rust-overlay.overlays.default ]; }; # configure lib - # use nixpkgs if running a server (homelab or worklab profile) - # otherwise use patched nixos-unstable nixpkgs - lib = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) - then - inputs.nixpkgs-stable.lib - else - inputs.nixpkgs.lib); + lib = inputs.nixpkgs.lib; - # use home-manager-stable if running a server (homelab or worklab profile) - # otherwise use home-manager-unstable - home-manager = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) - then - inputs.home-manager-stable - else - inputs.home-manager-unstable); - - # Systems that can run tests: - supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; - - # Function to generate a set based on supported systems: - forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems; - - # Attribute set of nixpkgs for each system: - nixpkgsFor = - forAllSystems (system: import inputs.nixpkgs { inherit system; }); + # create a list of all directories inside of ./hosts + # every directory in ./hosts has config for that machine + hosts = builtins.filter (x: x != null) (lib.mapAttrsToList (name: value: if (value == "directory") then name else null) (builtins.readDir ./hosts)); in { - homeConfigurations = { - user = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - (./. + "/profiles" + ("/" + systemSettings.profile) + "/home.nix") # load home.nix from selected PROFILE - inputs.chaotic.homeManagerModules.default - ]; - extraSpecialArgs = { - # pass config variables from above - inherit pkgs-stable; - inherit pkgs-unstable; - inherit systemSettings; - inherit userSettings; - inherit inputs; + # generate a nixos configuration for every host in ./hosts + nixosConfigurations = builtins.listToAttrs + (map (host: { + name = host; + value = lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + # host specific config + { config.networking.hostName = host; } + (./hosts + "/${host}") + + # my modules + ./modules/system + + # home manager + inputs.home-manager.nixosModules.home-manager + { home-manager.extraSpecialArgs = { + inherit pkgs; + inherit pkgs-stable; + inherit inputs; + }; + } + + # chaos... control! + inputs.chaotic.nixosModules.default + ]; + specialArgs = { + inherit pkgs-stable; + inherit inputs; + }; }; - }; - }; - nixosConfigurations = { - system = lib.nixosSystem { - system = systemSettings.system; - modules = [ - (./. + "/profiles" + ("/" + systemSettings.profile) + "/configuration.nix") - ./system/bin/phoenix.nix - inputs.chaotic.nixosModules.default - ]; # load configuration.nix from selected PROFILE - specialArgs = { - # pass config variables from above - inherit pkgs-stable; - inherit pkgs-unstable; - inherit systemSettings; - inherit userSettings; - inherit inputs; - }; - }; - }; - nixOnDroidConfigurations = { - inherit pkgs; - default = inputs.nix-on-droid.lib.nixOnDroidConfiguration { - modules = [ ./profiles/nix-on-droid/configuration.nix ]; - }; - extraSpecialArgs = { - # pass config variables from above - inherit pkgs-stable; - inherit systemSettings; - inherit userSettings; - inherit inputs; - }; - }; - - packages = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; - in { - default = self.packages.${system}.install; - - install = pkgs.writeShellApplication { - name = "install"; - runtimeInputs = with pkgs; [ git ]; # I could make this fancier by adding other deps - text = ''${./install.sh} "$@"''; - }; - }); - - apps = forAllSystems (system: { - default = self.apps.${system}.install; - - install = { - type = "app"; - program = "${self.packages.${system}.install}/bin/install"; - }; - }); + }) hosts); }; inputs = { @@ -198,17 +80,8 @@ nixpkgs-stable.url = "nixpkgs/nixos-24.11"; chaotic.url = "github:chaotic-cx/nyx/5071a4037c634d41a57926521fef2e179abe3bd9"; - home-manager-unstable.url = "github:nix-community/home-manager/master"; - home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs"; - - home-manager-stable.url = "github:nix-community/home-manager/release-24.05"; - home-manager-stable.inputs.nixpkgs.follows = "nixpkgs-stable"; - - nix-on-droid = { - url = "github:nix-community/nix-on-droid/master"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.home-manager.follows = "home-manager-unstable"; - }; + home-manager.url = "github:nix-community/home-manager/master"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; hyprland = { type = "git"; @@ -247,5 +120,9 @@ url = "github:StevenBlack/hosts"; flake = false; }; + + secrets = { + url = "path:/etc/nixos.secrets"; + }; }; } diff --git a/profiles/README.org b/hosts/README.org similarity index 100% rename from profiles/README.org rename to hosts/README.org diff --git a/profiles/personal/README.org b/hosts/snowfire/README.org similarity index 100% rename from profiles/personal/README.org rename to hosts/snowfire/README.org diff --git a/hosts/snowfire/configuration.nix b/hosts/snowfire/configuration.nix new file mode 100644 index 00000000..d286b9a5 --- /dev/null +++ b/hosts/snowfire/configuration.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + systemSettings = { + # users + users = [ "emmet" ]; + adminUsers = [ "emmet" ]; + + # hardware + cachy.enable = true; + bluetooth.enable = true; + tlp.enable = true; + printing.enable = true; + + # software + flatpak.enable = false; + gaming.enable = true; + virtualization = { + docker.enable = true; + virtualMachines.enable = true; + }; + + # wm + hyprland.enable = true; + + # dotfiles + dotfilesDir = "/etc/nixos"; + + # security + security = { + automount.enable = true; + blocklist.enable = true; + doas.enable = true; + firejail.enable = false; # TODO setup firejail profiles + firewall.enable = true; + gpg.enable = true; + openvpn.enable = true; + sshd.enable = false; + }; + + # style + stylix = { + enable = true; + theme = "io"; + }; + }; + }; + +} diff --git a/hosts/snowfire/default.nix b/hosts/snowfire/default.nix new file mode 100644 index 00000000..b29cc697 --- /dev/null +++ b/hosts/snowfire/default.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./configuration.nix + ./hardware-configuration.nix + ]; + + config = { + home-manager.users = builtins.listToAttrs + (map (user: { name = user; value = + ({ imports = [ ./home.nix ../../modules/user ]; });}) config.systemSettings.users); + }; +} diff --git a/system/hardware-configuration.nix b/hosts/snowfire/hardware-configuration.nix similarity index 99% rename from system/hardware-configuration.nix rename to hosts/snowfire/hardware-configuration.nix index e990e025..7cb01af7 100644 --- a/system/hardware-configuration.nix +++ b/hosts/snowfire/hardware-configuration.nix @@ -16,6 +16,7 @@ boot.blacklistedKernelModules = [ "k10temp" ]; boot.kernelParams = [ "amd_pstate=active" "acpi_osi=Linux" "acpi_wake=USB0" ]; boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower rtl8812au ]; + hardware.opengl.enable = true; hardware.opengl.extraPackages = [ pkgs.rocmPackages.clr.icd ]; hardware.opengl.extraPackages32 = [ ]; diff --git a/hosts/snowfire/home.nix b/hosts/snowfire/home.nix new file mode 100644 index 00000000..612addd0 --- /dev/null +++ b/hosts/snowfire/home.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + + userSettings = { + # setup + shell = { + enable = true; + apps.enable = true; + extraApps.enable = true; + }; + xdg.enable = true; + + # programs + browser = "qutebrowser"; + brave.enable = true; + editor = "emacs"; + ranger.enable = true; + git.enable = true; + engineering.enable = true; + art.enable = true; + flatpak.enable = false; + godot.enable = true; + keepass.enable = true; + media.enable = true; + music.enable = true; + office.enable = true; + recording.enable = true; + virtualization = { + virtualMachines.enable = true; + }; + + # wm + hyprland.enable = true; + + # style + stylix.enable = true; + + # hardware + bluetooth.enable = true; + }; + }; +} diff --git a/system/README.org b/modules/system/README.org similarity index 100% rename from system/README.org rename to modules/system/README.org diff --git a/modules/system/bluetooth/default.nix b/modules/system/bluetooth/default.nix new file mode 100644 index 00000000..13694c07 --- /dev/null +++ b/modules/system/bluetooth/default.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: + +let + cfg = config.systemSettings.bluetooth; +in { + options = { + systemSettings.bluetooth = { + enable = lib.mkEnableOption "Enable bluetooth"; + }; + }; + + config = lib.mkIf cfg.enable { + hardware.bluetooth.enable = true; + services.blueman.enable = true; + }; +} diff --git a/modules/system/configuration.nix b/modules/system/configuration.nix new file mode 100644 index 00000000..59421195 --- /dev/null +++ b/modules/system/configuration.nix @@ -0,0 +1,85 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + # Journal + services.journald.extraConfig = "SystemMaxUse=50M\nSystemMaxFiles=5"; + services.journald.rateLimitBurst = 500; + services.journald.rateLimitInterval = "30s"; + + # Locale and TZ + time.timeZone = "America/Chicago"; + services.timesyncd.enable = true; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = config.i18n.defaultLocale; + LC_IDENTIFICATION = config.i18n.defaultLocale; + LC_MEASUREMENT = config.i18n.defaultLocale; + LC_MONETARY = config.i18n.defaultLocale; + LC_NAME = config.i18n.defaultLocale; + LC_NUMERIC = config.i18n.defaultLocale; + LC_PAPER = config.i18n.defaultLocale; + LC_TELEPHONE = config.i18n.defaultLocale; + LC_TIME = config.i18n.defaultLocale; + }; + + # Use zsh + programs.zsh.enable = true; + environment.shells = with pkgs; [ zsh ]; + users.defaultUserShell = pkgs.zsh; + + # Fix nix path + nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" + "nixos-config=$HOME/dotfiles/system/configuration.nix" + "/nix/var/nix/profiles/per-user/root/channels" + ]; + + # Ensure nix flakes are enabled + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + # Substituters + nix.settings = { + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + # wheel group gets trusted access to nix daemon + nix.settings.trusted-users = [ "@wheel" ]; + + # Bootloader + # Use systemd-boot if uefi, default to grub otherwise + boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.editor = false; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot"; + + # Silent Boot + # https://wiki.archlinux.org/title/Silent_boot + boot.kernelParams = [ + "quiet" + "splash" + "vga=current" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.log_priority=3" + ]; + boot.initrd.systemd.enable = true; + boot.initrd.verbose = false; + boot.plymouth.enable = true; + + # Networking + networking.networkmanager.enable = true; # Use networkmanager + + # Remove bloat + programs.nano.enable = lib.mkForce false; + }; + +} diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 00000000..0567ef85 --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,29 @@ +{ lib, ... }: + +with lib; +let + # Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype + getDir = dir: mapAttrs + (file: type: + if type == "directory" then getDir "${dir}/${file}" else type + ) + (builtins.readDir dir); + + # Collects all files of a directory as a list of strings of paths + files = dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir)); + + # Filters out directories that don't end with .nix or are this file, also makes the strings absolute + importAll = dir: map + (file: ./. + "/${file}") + (filter + (file: hasSuffix ".nix" file && file != "default.nix" && + ! lib.hasPrefix "x/taffybar/" file && + ! lib.hasSuffix "-hm.nix" file) + (files dir)); + +in +{ + + imports = importAll ./.; + +} diff --git a/modules/system/flatpak/default.nix b/modules/system/flatpak/default.nix new file mode 100644 index 00000000..17f1e1f4 --- /dev/null +++ b/modules/system/flatpak/default.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: + +let + cfg = config.systemSettings.flatpak; +in { + options = { + systemSettings.flatpak = { + enable = lib.mkEnableOption "Enable flatpaks"; + }; + }; + + config = lib.mkIf cfg.enable { + services.flatpak.enable = true; + xdg.portal.enable = true; + }; +} diff --git a/modules/system/gaming/default.nix b/modules/system/gaming/default.nix new file mode 100644 index 00000000..ae6d4b15 --- /dev/null +++ b/modules/system/gaming/default.nix @@ -0,0 +1,20 @@ +{ lib, config, pkgs, ... }: + +let + cfg = config.systemSettings.gaming; +in { + + options = { + systemSettings.gaming = { + enable = lib.mkEnableOption "Enable Steam and games"; + }; + }; + + config = lib.mkIf cfg.enable { + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam" "steam-unwrapped" ]; + hardware.opengl.driSupport32Bit = true; + programs.steam.enable = true; + environment.systemPackages = with pkgs; [ pkgs.steam gamemode prismlauncher ]; + programs.gamemode.enable = true; + }; +} diff --git a/modules/system/hyprland/default.nix b/modules/system/hyprland/default.nix new file mode 100644 index 00000000..5d1011c6 --- /dev/null +++ b/modules/system/hyprland/default.nix @@ -0,0 +1,98 @@ +{ inputs, pkgs, pkgs-stable, config, lib, ... }: + +let + cfg = config.systemSettings.hyprland; +in +{ + options = { + systemSettings.hyprland = { + enable = lib.mkEnableOption "Enable hyprland"; + }; + }; + + config = lib.mkIf cfg.enable { + # Hyprland + programs = { + hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + xwayland = { + enable = true; + }; + portalPackage = pkgs.xdg-desktop-portal-hyprland; + }; + }; + + # Necessary packages + environment.systemPackages = with pkgs; [ + jq + (sddm-chili-theme.override { + themeConfig = { + background = config.stylix.image; + ScreenWidth = 1920; + ScreenHeight = 1080; + blur = true; + recursiveBlurLoops = 3; + recursiveBlurRadius = 5; + # TODO fix icons with svgs patched from stylix colors + };}) + ]; + + # Display manager + services.xserver.displayManager.sddm = { + enable = true; + wayland.enable = true; + enableHidpi = true; + theme = "chili"; + package = pkgs.sddm; + }; + + # xwayland + services.xserver = { + enable = true; + xkb = { + layout = "us"; + variant = ""; + options = "caps:escape"; + }; + excludePackages = [ pkgs.xterm ]; + }; + + # Keyring + security.pam.services.login.enableGnomeKeyring = true; + services.gnome.gnome-keyring.enable = true; + + # Dbus + services.dbus = { + enable = true; + packages = [ pkgs.dconf ]; + }; + + programs.dconf.enable = true; + + # Pipewire + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + # Some fancy fonts + fonts.packages = with pkgs-stable; [ + # Fonts + nerdfonts + powerline + ]; + + # Auto rotate screen + programs.iio-hyprland = { + enable = true; + package = pkgs.iio-hyprland.overrideAttrs { + patches = [ ./iio-hyprland-hyprpaper.patch ]; + }; + }; + }; +} diff --git a/system/wm/iio-hyprland-hyprpaper.patch b/modules/system/hyprland/iio-hyprland-hyprpaper.patch similarity index 100% rename from system/wm/iio-hyprland-hyprpaper.patch rename to modules/system/hyprland/iio-hyprland-hyprpaper.patch diff --git a/modules/system/kernel/default.nix b/modules/system/kernel/default.nix new file mode 100644 index 00000000..ac579a7b --- /dev/null +++ b/modules/system/kernel/default.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.systemSettings.cachy; +in +{ + options = { + systemSettings.cachy = { + enable = lib.mkEnableOption "Enable cachyos kernel"; + variant = lib.mkOption { + default = null; + type = lib.types.nullOr (lib.types.enum ["lto" "server" "hardened"]); + description = '' + This option determines the CachyOS kernel variant to use. + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + boot.kernelPackages = lib.mkMerge [ + (lib.mkIf (cfg.variant == null) pkgs.linuxPackages_cachyos) + (lib.mkIf (cfg.variant == "lto") pkgs.linuxPackages_cachyos-lto) + (lib.mkIf (cfg.variant == "server") pkgs.linuxPackages_cachyos-server) + (lib.mkIf (cfg.variant == "hardened") pkgs.linuxPackages_cachyos-hardened) + ]; + boot.consoleLogLevel = 0; + }; +} diff --git a/modules/system/nix/default.nix b/modules/system/nix/default.nix new file mode 100644 index 00000000..a17e1de5 --- /dev/null +++ b/modules/system/nix/default.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, inputs, ... }: + +let + caches = import inputs.secrets.caches; +in { + config = { + nix = { + package = pkgs.nix; + settings = { + substituters = + (lib.optionals (caches ? urls) caches.urls) ++ + [ + "https://cache.nixos.org" + "https://hyprland.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = + (lib.optionals (caches ? publicKeys) caches.publicKeys) ++ + [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-users = config.systemSettings.adminUsers ++ [ "@wheel" ]; + auto-optimise-store = true; + download-buffer-size = 500000000; + }; + }; + system.stateVersion = "22.11"; + }; +} diff --git a/modules/system/phoenix/default.nix b/modules/system/phoenix/default.nix new file mode 100644 index 00000000..c7ac8895 --- /dev/null +++ b/modules/system/phoenix/default.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: + +{ + options = { + systemSettings.dotfilesDir = lib.mkOption { + default = "/etc/nixos"; + description = "Absolute path to the dotfiles directory"; + type = lib.types.path; + }; + }; +# TODO disabled for debugging +# config = { +# environment.systemPackages = [ +# # TODO update script for config schema change +# (pkgs.writeScriptBin "phoenix" '' +# if [ "$1" = "sync" ]; then +# if [ "$#" = 1 ]; then +# ''+config.systemSettings.dotfilesDir+''/scripts/sync.sh; +# exit 0; +# elif [ "$2" = "user" ]; then +# ''+config.systemSettings.dotfilesDir+''/scripts/sync-user.sh; +# exit 0; +# elif [ "$2" = "system" ]; then +# ''+config.systemSettings.dotfilesDir+''/scripts/sync-system.sh; +# exit 0; +# else +# echo "Please pass 'system' or 'user' if supplying a second argument" +# fi +# elif [ "$1" = "refresh" ]; then +# if [ "$#" -gt 1 ]; then +# echo "Warning: The 'refresh' command has no subcommands (no $2 subcommand)"; +# fi +# ''+config.systemSettings.dotfilesDir+''/scripts/sync-posthook.sh; +# exit 0; +# elif [ "$1" = "update" ]; then +# ''+config.systemSettings.dotfilesDir+''/scripts/update.sh "''${@:2}"; +# exit 0; +# elif [ "$1" = "upgrade" ]; then +# if [ "$#" -gt 1 ]; then +# echo "Warning: The 'upgrade' command has no subcommands (no $2 subcommand)"; +# fi +# ''+config.systemSettings.dotfilesDir+''/scripts/upgrade.sh; +# exit 0; +# elif [ "$1" = "pull" ]; then +# if [ "$#" -gt 1 ]; then +# echo "Warning: The 'pull' command has no subcommands (no $2 subcommand)"; +# fi +# ''+config.systemSettings.dotfilesDir+''/scripts/pull.sh; +# exit 0; +# elif [ "$1" = "harden" ]; then +# if [ "$#" -gt 1 ]; then +# echo "Warning: The 'harden' command has no subcommands (no $2 subcommand)"; +# fi +# ''+config.systemSettings.dotfilesDir+''/scripts/harden.sh; +# exit 0; +# elif [ "$1" = "soften" ]; then +# if [ "$#" -gt 1 ]; then +# echo "Warning: The 'soften' command has no subcommands (no $2 subcommand)"; +# fi +# ''+config.systemSettings.dotfilesDir+''/scripts/soften.sh; +# exit 0; +# elif [ "$1" = "gc" ]; then +# if [ "$#" -gt 2 ]; then +# echo "Warning: The 'gc' command only accepts one argument (collect_older_than)"; +# fi +# if [ "$2" = "full" ]; then +# sudo nix-collect-garbage --delete-old; +# nix-collect-garbage --delete-old; +# elif [ "$2" ]; then +# sudo nix-collect-garbage --delete-older-than $2; +# nix-collect-garbage --delete-older-than $2; +# else +# sudo nix-collect-garbage --delete-older-than 30d; +# nix-collect-garbage --delete-older-than 30d; +# fi +# fi +# '') +# ]; +# }; +} diff --git a/modules/system/printing/default.nix b/modules/system/printing/default.nix new file mode 100644 index 00000000..d8ca9d77 --- /dev/null +++ b/modules/system/printing/default.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, config, ... }: + +let + cfg = config.systemSettings.printing; +in { + options = { + systemSettings.printing = { + enable = lib.mkEnableOption "Enable printing"; + }; + }; + + config = lib.mkIf cfg.enable { + # Enable printing + services.printing.enable = true; + services.avahi.enable = true; + services.avahi.nssmdns4 = true; + services.avahi.openFirewall = true; + environment.systemPackages = [ pkgs.cups-filters ]; + }; +} diff --git a/modules/system/security/automount/default.nix b/modules/system/security/automount/default.nix new file mode 100644 index 00000000..1707bdb5 --- /dev/null +++ b/modules/system/security/automount/default.nix @@ -0,0 +1,17 @@ +{ config, lib, ... }: + +let + cfg = config.systemSettings.security.automount; +in { + options = { + systemSettings.security.automount = { + enable = lib.mkEnableOption "Enable automount"; + }; + }; + + config = lib.mkIf cfg.enable { + services.devmon.enable = true; + services.gvfs.enable = true; + services.udisks2.enable = true; + }; +} diff --git a/modules/system/security/blocklist/default.nix b/modules/system/security/blocklist/default.nix new file mode 100644 index 00000000..ee9b216e --- /dev/null +++ b/modules/system/security/blocklist/default.nix @@ -0,0 +1,18 @@ +{ config, lib, inputs, ... }: + +let + blocklist = builtins.readFile "${inputs.blocklist-hosts}/alternates/gambling-porn/hosts"; + cfg = config.systemSettings.security.blocklist; +in { + options = { + systemSettings.security.blocklist = { + enable = lib.mkEnableOption "Enable basic host blocking for bad websites"; + }; + }; + + config = lib.mkIf cfg.enable { + networking.extraHosts = '' + "${blocklist}" + ''; + }; +} diff --git a/modules/system/security/doas/default.nix b/modules/system/security/doas/default.nix new file mode 100644 index 00000000..0d6e3427 --- /dev/null +++ b/modules/system/security/doas/default.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.systemSettings.security.doas; + adminUsers = config.systemSettings.adminUsers; +in { + options = { + systemSettings.security.doas = { + enable = lib.mkEnableOption "Replace sudo with doas"; + }; + }; + + config = lib.mkIf cfg.enable { + # Doas instead of sudo + security.doas.enable = true; + security.sudo.enable = false; + security.doas.extraRules = [ + { + users = adminUsers; + cmd = "nix"; + noPass = true; + keepEnv = true; + } + { + users = adminUsers; + cmd = "nixos-rebuild"; + noPass = true; + keepEnv = true; + } + { + users = adminUsers; + cmd = "nix-collect-garbage"; + noPass = true; + keepEnv = true; + } + ]; + + environment.systemPackages = [ + pkgs.doas-sudo-shim + ]; + }; +} diff --git a/modules/system/security/firejail/default.nix b/modules/system/security/firejail/default.nix new file mode 100644 index 00000000..35e3fb06 --- /dev/null +++ b/modules/system/security/firejail/default.nix @@ -0,0 +1,30 @@ +{ lib, config, pkgs, ... }: + +let + cfg = config.systemSettings.security.firejail; +in { + options = { + systemSettings.security.firejail = { + enable = lib.mkEnableOption "Use firejail on some apps for extra security"; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ firejail ]; + programs.firejail.enable = true; + programs.firejail.wrappedBinaries = { + #prismlauncher = { + # executable = "${pkgs.prismlauncher}/bin/prismlauncher"; + # profile = ./firejail-profiles/prismlauncher.profile; + #}; + #steam = { + # executable = "${pkgs.steam}/bin/steam"; + # profile = "${pkgs.firejail}/etc/firejail/steam.profile"; + #}; + #steam-run = { + # executable = "${pkgs.steam}/bin/steam-run"; + # profile = "${pkgs.firejail}/etc/firejail/steam.profile"; + #}; + }; + }; +} diff --git a/system/security/firejail-profiles/prismlauncher.profile b/modules/system/security/firejail/profiles/prismlauncher.profile similarity index 100% rename from system/security/firejail-profiles/prismlauncher.profile rename to modules/system/security/firejail/profiles/prismlauncher.profile diff --git a/modules/system/security/firewall/default.nix b/modules/system/security/firewall/default.nix new file mode 100644 index 00000000..ed6cc3a4 --- /dev/null +++ b/modules/system/security/firewall/default.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: + +let + cfg = config.systemSettings.security.firewall; +in { + options = { + systemSettings.security.firewall = { + # TODO make this more granular and better :| + enable = lib.mkEnableOption "Actvate firewall with ports open only for syncthing"; + }; + }; + + config = lib.mkIf cfg.enable { + # Firewall + networking.firewall.enable = true; + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 22000 21027 ]; # syncthing + networking.firewall.allowedUDPPorts = [ 22000 21027 ]; # syncthing + # Or disable the firewall altogether. + # networking.firewall.enable = false; + }; +} diff --git a/modules/system/security/gpg/default.nix b/modules/system/security/gpg/default.nix new file mode 100644 index 00000000..0c036d13 --- /dev/null +++ b/modules/system/security/gpg/default.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: + +let + cfg = config.systemSettings.security.gpg; +in { + options = { + systemSettings.security.gpg = { + enable = lib.mkEnableOption "Enable gpg"; + }; + }; + + config = lib.mkIf cfg.enable { + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; +} diff --git a/modules/system/security/openvpn/default.nix b/modules/system/security/openvpn/default.nix new file mode 100644 index 00000000..a777447f --- /dev/null +++ b/modules/system/security/openvpn/default.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.systemSettings.security.openvpn; +in { + options = { + systemSettings.security.openvpn = { + enable = lib.mkEnableOption "Enable openvpn"; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ pkgs.openvpn ]; + environment.etc.openvpn.source = "${pkgs.update-resolv-conf}/libexec/openvpn"; + }; +} diff --git a/modules/system/security/sshd/default.nix b/modules/system/security/sshd/default.nix new file mode 100644 index 00000000..2c1cd9d2 --- /dev/null +++ b/modules/system/security/sshd/default.nix @@ -0,0 +1,25 @@ +{ config, lib, ... }: + +let + cfg = config.systemSettings.security.sshd; +in { + options = { + systemSettings.security.sshd = { + enable = lib.mkEnableOption "Enable incoming ssh connections"; + }; + }; + + config = lib.mkIf cfg.enable { + # Enable incoming ssh + services.openssh = { + enable = true; + openFirewall = true; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "no"; + }; + }; + # Don't forget to set: + # users.users.${username}.openssh.authorizedKeys.keys = "myAuthorizedKey"; + }; +} diff --git a/modules/system/stylix/default.nix b/modules/system/stylix/default.nix new file mode 100644 index 00000000..18863442 --- /dev/null +++ b/modules/system/stylix/default.nix @@ -0,0 +1,56 @@ +{ lib, config, pkgs, inputs, ... }: + +let + cfg = config.systemSettings.stylix; + theme = import (./. + "../../../themes"+("/"+config.systemSettings.stylix.theme)); +in +{ + options = { + systemSettings.stylix = { + enable = lib.mkEnableOption "Enable stylix theming"; + }; + systemSettings.stylix.theme = lib.mkOption { + default = "io"; + type = lib.types.enum (builtins.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir ../../themes))); + description = "Theme for stylix to use system wide. A list of themes can be found in the `themes` directory."; + }; + }; + + imports = [ inputs.stylix.nixosModules.stylix ]; + + config = lib.mkIf cfg.enable { + stylix.enable = true; + stylix.autoEnable = false; + stylix.polarity = theme.polarity; + stylix.image = pkgs.fetchurl { + url = theme.backgroundUrl; + sha256 = theme.backgroundSha256; + }; + stylix.base16Scheme = theme; + stylix.fonts = { + # TODO abstract fonts into an option + monospace = { + name = "FiraCode Nerd Font"; + package = pkgs.nerd-fonts.fira-code; + }; + serif = { + name = "FiraCode Nerd Font"; + package = pkgs.nerd-fonts.fira-code; + }; + sansSerif = { + name = "FiraCode Nerd Font"; + package = pkgs.nerd-fonts.fira-code; + }; + emoji = { + name = "Noto Color Emoji"; + package = pkgs.noto-fonts-emoji-blob-bin; + }; + }; + + stylix.targets.console.enable = true; + + environment.sessionVariables = { + QT_QPA_PLATFORMTHEME = "qt5ct"; + }; + }; +} diff --git a/modules/system/tlp/default.nix b/modules/system/tlp/default.nix new file mode 100644 index 00000000..4fadaccc --- /dev/null +++ b/modules/system/tlp/default.nix @@ -0,0 +1,58 @@ +{ config, lib, ... }: + +let + cfg = config.systemSettings.tlp; +in { + options = { + systemSettings.tlp = { + enable = lib.mkEnableOption "Enable tlp power management"; + }; + }; + + config = lib.mkIf cfg.enable { + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "balance"; + CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance"; + CPU_DRIVER_OPMODE_ON_AC = "active"; + CPU_DRIVER_OPMODE_ON_BAT = "active"; + + WIFI_PWR_ON_AC = "on"; + WIFI_PWR_ON_BAT = "on"; + RUNTIME_PM_ON_AC = "auto"; + RUNTIME_PM_ON_BAT = "auto"; + + CPU_MIN_PERF_ON_AC = 10; + CPU_MAX_PERF_ON_AC = 90; + CPU_MIN_PERF_ON_BAT = 10; + CPU_MAX_PERF_ON_BAT = 50; + + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + CPU_HWP_DYN_BOOST_ON_AC = 1; + CPU_HWP_DYN_BOOST_ON_BAT = 0; + + START_CHARGE_THRESH_BAT0 = 75; + STOP_CHARGE_THRESH_BAT0 = 80; + + MEM_SLEEP_ON_AC = "deep"; + MEM_SLEEP_ON_BAT = "deep"; + + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + + RADEON_DPM_STATE_ON_AC = "performance"; + RADEON_DPM_STATE_ON_BAT = "battery"; + RADEON_POWER_PROFILE_ON_AC = "high"; + RADEON_POWER_PROFILE_ON_BAT = "low"; + + INTEL_GPU_MIN_FREQ_ON_AC = 600; + INTEL_GPU_MIN_FREQ_ON_BAT = 600; + }; + }; + }; + +} diff --git a/modules/system/users/default.nix b/modules/system/users/default.nix new file mode 100644 index 00000000..41a8088f --- /dev/null +++ b/modules/system/users/default.nix @@ -0,0 +1,41 @@ +{ config, lib, inputs, ... }: +let + userInfo = import inputs.secrets.userInfo; +in { + options = { + systemSettings = { + users = lib.mkOption { + description = "List of desktop users to create on the system"; + type = lib.types.listOf lib.types.str; + }; + adminUsers = lib.mkOption { + description = "List of desktop users to grant admin (sudo) access on the system"; + type = lib.types.listOf lib.types.str; + }; + }; + }; + config = { + + users.users = builtins.listToAttrs + (map (user: { + name = user; + value = { + description = userInfo.${user}.name; + isNormalUser = true; + extraGroups = [ "networkmanager" "input" "dialout" "video" "render" ] ++ (lib.optionals (lib.any (x: x == user) config.systemSettings.adminUsers) [ "wheel" ]); + createHome = true; + }; + }) config.systemSettings.users); + + home-manager.users = builtins.listToAttrs + (map (user: { + name = user; + value = { + home.username = user; + home.homeDirectory = "/home/"+user; + userSettings.name = lib.mkIf (userInfo.${user} ? name) userInfo.${user}.name; + userSettings.email = lib.mkIf (userInfo.${user} ? email ) userInfo.${user}.email; + }; + }) config.systemSettings.users); + }; +} diff --git a/modules/system/virtualization/docker/default.nix b/modules/system/virtualization/docker/default.nix new file mode 100644 index 00000000..b153f1ab --- /dev/null +++ b/modules/system/virtualization/docker/default.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.systemSettings.virtualization.docker; + adminUsers = config.systemSettings.adminUsers; +in { + options = { + systemSettings.virtualization.docker = { + enable = lib.mkEnableOption "Enable docker"; + }; + }; + + config = { + virtualisation.docker = { + enable = true; + enableOnBoot = true; + autoPrune.enable = true; + }; + users.users = builtins.listToAttrs (map (user: { name = user; value = { extraGroups = [ "docker" ];};}) adminUsers); + environment.systemPackages = with pkgs; [ + docker + docker-compose + lazydocker + ]; + }; +} diff --git a/modules/system/virtualization/virtual-machines/default.nix b/modules/system/virtualization/virtual-machines/default.nix new file mode 100644 index 00000000..150988c9 --- /dev/null +++ b/modules/system/virtualization/virtual-machines/default.nix @@ -0,0 +1,23 @@ +{ lib, config, pkgs, ... }: + +let cfg = config.systemSettings.virtualization.virtualMachines; +in { + options = { + systemSettings.virtualization.virtualMachines = { + enable = lib.mkEnableOption "Enable qemu virtual machines, distrobox, and waydroid"; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ virt-manager distrobox ]; + virtualisation.libvirtd = { + allowedBridges = [ + "nm-bridge" + "virbr0" + ]; + enable = true; + qemu.runAsRoot = false; + }; + virtualisation.waydroid.enable = true; + }; +} diff --git a/themes/README.org b/modules/themes/README.org similarity index 100% rename from themes/README.org rename to modules/themes/README.org diff --git a/themes/alph/README.org b/modules/themes/alph/README.org similarity index 100% rename from themes/alph/README.org rename to modules/themes/alph/README.org diff --git a/themes/alph/default.nix b/modules/themes/alph/default.nix similarity index 100% rename from themes/alph/default.nix rename to modules/themes/alph/default.nix diff --git a/themes/ashes/README.org b/modules/themes/ashes/README.org similarity index 100% rename from themes/ashes/README.org rename to modules/themes/ashes/README.org diff --git a/themes/ashes/default.nix b/modules/themes/ashes/default.nix similarity index 100% rename from themes/ashes/default.nix rename to modules/themes/ashes/default.nix diff --git a/themes/atelier-cave/README.org b/modules/themes/atelier-cave/README.org similarity index 100% rename from themes/atelier-cave/README.org rename to modules/themes/atelier-cave/README.org diff --git a/themes/atelier-cave/default.nix b/modules/themes/atelier-cave/default.nix similarity index 100% rename from themes/atelier-cave/default.nix rename to modules/themes/atelier-cave/default.nix diff --git a/themes/atelier-dune/README.org b/modules/themes/atelier-dune/README.org similarity index 100% rename from themes/atelier-dune/README.org rename to modules/themes/atelier-dune/README.org diff --git a/themes/atelier-dune/default.nix b/modules/themes/atelier-dune/default.nix similarity index 100% rename from themes/atelier-dune/default.nix rename to modules/themes/atelier-dune/default.nix diff --git a/themes/atelier-estuary/README.org b/modules/themes/atelier-estuary/README.org similarity index 100% rename from themes/atelier-estuary/README.org rename to modules/themes/atelier-estuary/README.org diff --git a/themes/atelier-estuary/default.nix b/modules/themes/atelier-estuary/default.nix similarity index 100% rename from themes/atelier-estuary/default.nix rename to modules/themes/atelier-estuary/default.nix diff --git a/themes/atelier-forest/README.org b/modules/themes/atelier-forest/README.org similarity index 100% rename from themes/atelier-forest/README.org rename to modules/themes/atelier-forest/README.org diff --git a/themes/atelier-forest/default.nix b/modules/themes/atelier-forest/default.nix similarity index 100% rename from themes/atelier-forest/default.nix rename to modules/themes/atelier-forest/default.nix diff --git a/themes/atelier-heath/README.org b/modules/themes/atelier-heath/README.org similarity index 100% rename from themes/atelier-heath/README.org rename to modules/themes/atelier-heath/README.org diff --git a/themes/atelier-heath/default.nix b/modules/themes/atelier-heath/default.nix similarity index 100% rename from themes/atelier-heath/default.nix rename to modules/themes/atelier-heath/default.nix diff --git a/themes/atelier-lakeside/README.org b/modules/themes/atelier-lakeside/README.org similarity index 100% rename from themes/atelier-lakeside/README.org rename to modules/themes/atelier-lakeside/README.org diff --git a/themes/atelier-lakeside/default.nix b/modules/themes/atelier-lakeside/default.nix similarity index 100% rename from themes/atelier-lakeside/default.nix rename to modules/themes/atelier-lakeside/default.nix diff --git a/themes/atelier-plateau/README.org b/modules/themes/atelier-plateau/README.org similarity index 100% rename from themes/atelier-plateau/README.org rename to modules/themes/atelier-plateau/README.org diff --git a/themes/atelier-plateau/default.nix b/modules/themes/atelier-plateau/default.nix similarity index 100% rename from themes/atelier-plateau/default.nix rename to modules/themes/atelier-plateau/default.nix diff --git a/themes/atelier-savanna/README.org b/modules/themes/atelier-savanna/README.org similarity index 100% rename from themes/atelier-savanna/README.org rename to modules/themes/atelier-savanna/README.org diff --git a/themes/atelier-savanna/default.nix b/modules/themes/atelier-savanna/default.nix similarity index 100% rename from themes/atelier-savanna/default.nix rename to modules/themes/atelier-savanna/default.nix diff --git a/themes/atelier-seaside/README.org b/modules/themes/atelier-seaside/README.org similarity index 100% rename from themes/atelier-seaside/README.org rename to modules/themes/atelier-seaside/README.org diff --git a/themes/atelier-seaside/default.nix b/modules/themes/atelier-seaside/default.nix similarity index 100% rename from themes/atelier-seaside/default.nix rename to modules/themes/atelier-seaside/default.nix diff --git a/themes/atelier-sulphurpool/README.org b/modules/themes/atelier-sulphurpool/README.org similarity index 100% rename from themes/atelier-sulphurpool/README.org rename to modules/themes/atelier-sulphurpool/README.org diff --git a/themes/atelier-sulphurpool/default.nix b/modules/themes/atelier-sulphurpool/default.nix similarity index 100% rename from themes/atelier-sulphurpool/default.nix rename to modules/themes/atelier-sulphurpool/default.nix diff --git a/themes/ayu-dark/README.org b/modules/themes/ayu-dark/README.org similarity index 100% rename from themes/ayu-dark/README.org rename to modules/themes/ayu-dark/README.org diff --git a/themes/ayu-dark/default.nix b/modules/themes/ayu-dark/default.nix similarity index 100% rename from themes/ayu-dark/default.nix rename to modules/themes/ayu-dark/default.nix diff --git a/themes/background-test.sh b/modules/themes/background-test.sh similarity index 100% rename from themes/background-test.sh rename to modules/themes/background-test.sh diff --git a/themes/bespin/README.org b/modules/themes/bespin/README.org similarity index 100% rename from themes/bespin/README.org rename to modules/themes/bespin/README.org diff --git a/themes/bespin/default.nix b/modules/themes/bespin/default.nix similarity index 100% rename from themes/bespin/default.nix rename to modules/themes/bespin/default.nix diff --git a/themes/caret/README.org b/modules/themes/caret/README.org similarity index 100% rename from themes/caret/README.org rename to modules/themes/caret/README.org diff --git a/themes/caret/default.nix b/modules/themes/caret/default.nix similarity index 100% rename from themes/caret/default.nix rename to modules/themes/caret/default.nix diff --git a/themes/catppuccin-frappe/README.org b/modules/themes/catppuccin-frappe/README.org similarity index 100% rename from themes/catppuccin-frappe/README.org rename to modules/themes/catppuccin-frappe/README.org diff --git a/themes/catppuccin-frappe/default.nix b/modules/themes/catppuccin-frappe/default.nix similarity index 100% rename from themes/catppuccin-frappe/default.nix rename to modules/themes/catppuccin-frappe/default.nix diff --git a/themes/catppuccin-mocha/README.org b/modules/themes/catppuccin-mocha/README.org similarity index 100% rename from themes/catppuccin-mocha/README.org rename to modules/themes/catppuccin-mocha/README.org diff --git a/themes/catppuccin-mocha/default.nix b/modules/themes/catppuccin-mocha/default.nix similarity index 100% rename from themes/catppuccin-mocha/default.nix rename to modules/themes/catppuccin-mocha/default.nix diff --git a/themes/darkmoss/README.org b/modules/themes/darkmoss/README.org similarity index 100% rename from themes/darkmoss/README.org rename to modules/themes/darkmoss/README.org diff --git a/themes/darkmoss/default.nix b/modules/themes/darkmoss/default.nix similarity index 100% rename from themes/darkmoss/default.nix rename to modules/themes/darkmoss/default.nix diff --git a/themes/doom-one/README.org b/modules/themes/doom-one/README.org similarity index 100% rename from themes/doom-one/README.org rename to modules/themes/doom-one/README.org diff --git a/themes/doom-one/default.nix b/modules/themes/doom-one/default.nix similarity index 100% rename from themes/doom-one/default.nix rename to modules/themes/doom-one/default.nix diff --git a/themes/dracula/README.org b/modules/themes/dracula/README.org similarity index 100% rename from themes/dracula/README.org rename to modules/themes/dracula/README.org diff --git a/themes/dracula/default.nix b/modules/themes/dracula/default.nix similarity index 100% rename from themes/dracula/default.nix rename to modules/themes/dracula/default.nix diff --git a/themes/ember/README.org b/modules/themes/ember/README.org similarity index 100% rename from themes/ember/README.org rename to modules/themes/ember/README.org diff --git a/themes/ember/default.nix b/modules/themes/ember/default.nix similarity index 100% rename from themes/ember/default.nix rename to modules/themes/ember/default.nix diff --git a/themes/emil/README.org b/modules/themes/emil/README.org similarity index 100% rename from themes/emil/README.org rename to modules/themes/emil/README.org diff --git a/themes/emil/default.nix b/modules/themes/emil/default.nix similarity index 100% rename from themes/emil/default.nix rename to modules/themes/emil/default.nix diff --git a/themes/eris/README.org b/modules/themes/eris/README.org similarity index 100% rename from themes/eris/README.org rename to modules/themes/eris/README.org diff --git a/themes/eris/default.nix b/modules/themes/eris/default.nix similarity index 100% rename from themes/eris/default.nix rename to modules/themes/eris/default.nix diff --git a/themes/eva/README.org b/modules/themes/eva/README.org similarity index 100% rename from themes/eva/README.org rename to modules/themes/eva/README.org diff --git a/themes/eva/default.nix b/modules/themes/eva/default.nix similarity index 100% rename from themes/eva/default.nix rename to modules/themes/eva/default.nix diff --git a/themes/everforest/README.org b/modules/themes/everforest/README.org similarity index 100% rename from themes/everforest/README.org rename to modules/themes/everforest/README.org diff --git a/themes/everforest/default.nix b/modules/themes/everforest/default.nix similarity index 100% rename from themes/everforest/default.nix rename to modules/themes/everforest/default.nix diff --git a/themes/fairy-floss/README.org b/modules/themes/fairy-floss/README.org similarity index 100% rename from themes/fairy-floss/README.org rename to modules/themes/fairy-floss/README.org diff --git a/themes/fairy-floss/default.nix b/modules/themes/fairy-floss/default.nix similarity index 100% rename from themes/fairy-floss/default.nix rename to modules/themes/fairy-floss/default.nix diff --git a/themes/gigavolt/README.org b/modules/themes/gigavolt/README.org similarity index 100% rename from themes/gigavolt/README.org rename to modules/themes/gigavolt/README.org diff --git a/themes/gigavolt/default.nix b/modules/themes/gigavolt/default.nix similarity index 100% rename from themes/gigavolt/default.nix rename to modules/themes/gigavolt/default.nix diff --git a/themes/gruvbox-dark-hard/README.org b/modules/themes/gruvbox-dark-hard/README.org similarity index 100% rename from themes/gruvbox-dark-hard/README.org rename to modules/themes/gruvbox-dark-hard/README.org diff --git a/themes/gruvbox-dark-hard/default.nix b/modules/themes/gruvbox-dark-hard/default.nix similarity index 100% rename from themes/gruvbox-dark-hard/default.nix rename to modules/themes/gruvbox-dark-hard/default.nix diff --git a/themes/gruvbox-dark-medium/README.org b/modules/themes/gruvbox-dark-medium/README.org similarity index 100% rename from themes/gruvbox-dark-medium/README.org rename to modules/themes/gruvbox-dark-medium/README.org diff --git a/themes/gruvbox-dark-medium/default.nix b/modules/themes/gruvbox-dark-medium/default.nix similarity index 100% rename from themes/gruvbox-dark-medium/default.nix rename to modules/themes/gruvbox-dark-medium/default.nix diff --git a/themes/gruvbox-light-hard/README.org b/modules/themes/gruvbox-light-hard/README.org similarity index 100% rename from themes/gruvbox-light-hard/README.org rename to modules/themes/gruvbox-light-hard/README.org diff --git a/themes/gruvbox-light-hard/default.nix b/modules/themes/gruvbox-light-hard/default.nix similarity index 100% rename from themes/gruvbox-light-hard/default.nix rename to modules/themes/gruvbox-light-hard/default.nix diff --git a/themes/gruvbox-light-medium/README.org b/modules/themes/gruvbox-light-medium/README.org similarity index 100% rename from themes/gruvbox-light-medium/README.org rename to modules/themes/gruvbox-light-medium/README.org diff --git a/themes/gruvbox-light-medium/default.nix b/modules/themes/gruvbox-light-medium/default.nix similarity index 100% rename from themes/gruvbox-light-medium/default.nix rename to modules/themes/gruvbox-light-medium/default.nix diff --git a/themes/helios/README.org b/modules/themes/helios/README.org similarity index 100% rename from themes/helios/README.org rename to modules/themes/helios/README.org diff --git a/themes/helios/default.nix b/modules/themes/helios/default.nix similarity index 100% rename from themes/helios/default.nix rename to modules/themes/helios/default.nix diff --git a/themes/henna/README.org b/modules/themes/henna/README.org similarity index 100% rename from themes/henna/README.org rename to modules/themes/henna/README.org diff --git a/themes/henna/default.nix b/modules/themes/henna/default.nix similarity index 100% rename from themes/henna/default.nix rename to modules/themes/henna/default.nix diff --git a/themes/horizon-dark/README.org b/modules/themes/horizon-dark/README.org similarity index 100% rename from themes/horizon-dark/README.org rename to modules/themes/horizon-dark/README.org diff --git a/themes/horizon-dark/default.nix b/modules/themes/horizon-dark/default.nix similarity index 100% rename from themes/horizon-dark/default.nix rename to modules/themes/horizon-dark/default.nix diff --git a/themes/io/README.org b/modules/themes/io/README.org similarity index 100% rename from themes/io/README.org rename to modules/themes/io/README.org diff --git a/themes/io/default.nix b/modules/themes/io/default.nix similarity index 100% rename from themes/io/default.nix rename to modules/themes/io/default.nix diff --git a/themes/isotope/README.org b/modules/themes/isotope/README.org similarity index 100% rename from themes/isotope/README.org rename to modules/themes/isotope/README.org diff --git a/themes/isotope/default.nix b/modules/themes/isotope/default.nix similarity index 100% rename from themes/isotope/default.nix rename to modules/themes/isotope/default.nix diff --git a/themes/manegarm/README.org b/modules/themes/manegarm/README.org similarity index 100% rename from themes/manegarm/README.org rename to modules/themes/manegarm/README.org diff --git a/themes/manegarm/default.nix b/modules/themes/manegarm/default.nix similarity index 100% rename from themes/manegarm/default.nix rename to modules/themes/manegarm/default.nix diff --git a/themes/material-vivid/README.org b/modules/themes/material-vivid/README.org similarity index 100% rename from themes/material-vivid/README.org rename to modules/themes/material-vivid/README.org diff --git a/themes/material-vivid/default.nix b/modules/themes/material-vivid/default.nix similarity index 100% rename from themes/material-vivid/default.nix rename to modules/themes/material-vivid/default.nix diff --git a/themes/miramare/README.org b/modules/themes/miramare/README.org similarity index 100% rename from themes/miramare/README.org rename to modules/themes/miramare/README.org diff --git a/themes/miramare/default.nix b/modules/themes/miramare/default.nix similarity index 100% rename from themes/miramare/default.nix rename to modules/themes/miramare/default.nix diff --git a/themes/monokai/README.org b/modules/themes/monokai/README.org similarity index 100% rename from themes/monokai/README.org rename to modules/themes/monokai/README.org diff --git a/themes/monokai/default.nix b/modules/themes/monokai/default.nix similarity index 100% rename from themes/monokai/default.nix rename to modules/themes/monokai/default.nix diff --git a/themes/nord/README.org b/modules/themes/nord/README.org similarity index 100% rename from themes/nord/README.org rename to modules/themes/nord/README.org diff --git a/themes/nord/default.nix b/modules/themes/nord/default.nix similarity index 100% rename from themes/nord/default.nix rename to modules/themes/nord/default.nix diff --git a/themes/oceanic-next/README.org b/modules/themes/oceanic-next/README.org similarity index 100% rename from themes/oceanic-next/README.org rename to modules/themes/oceanic-next/README.org diff --git a/themes/oceanic-next/default.nix b/modules/themes/oceanic-next/default.nix similarity index 100% rename from themes/oceanic-next/default.nix rename to modules/themes/oceanic-next/default.nix diff --git a/themes/old-hope/README.org b/modules/themes/old-hope/README.org similarity index 100% rename from themes/old-hope/README.org rename to modules/themes/old-hope/README.org diff --git a/themes/old-hope/default.nix b/modules/themes/old-hope/default.nix similarity index 100% rename from themes/old-hope/default.nix rename to modules/themes/old-hope/default.nix diff --git a/themes/outrun-dark/README.org b/modules/themes/outrun-dark/README.org similarity index 100% rename from themes/outrun-dark/README.org rename to modules/themes/outrun-dark/README.org diff --git a/themes/outrun-dark/default.nix b/modules/themes/outrun-dark/default.nix similarity index 100% rename from themes/outrun-dark/default.nix rename to modules/themes/outrun-dark/default.nix diff --git a/themes/selenized-dark/README.org b/modules/themes/selenized-dark/README.org similarity index 100% rename from themes/selenized-dark/README.org rename to modules/themes/selenized-dark/README.org diff --git a/themes/selenized-dark/default.nix b/modules/themes/selenized-dark/default.nix similarity index 100% rename from themes/selenized-dark/default.nix rename to modules/themes/selenized-dark/default.nix diff --git a/themes/selenized-light/README.org b/modules/themes/selenized-light/README.org similarity index 100% rename from themes/selenized-light/README.org rename to modules/themes/selenized-light/README.org diff --git a/themes/selenized-light/default.nix b/modules/themes/selenized-light/default.nix similarity index 100% rename from themes/selenized-light/default.nix rename to modules/themes/selenized-light/default.nix diff --git a/themes/solarized-dark/README.org b/modules/themes/solarized-dark/README.org similarity index 100% rename from themes/solarized-dark/README.org rename to modules/themes/solarized-dark/README.org diff --git a/themes/solarized-dark/default.nix b/modules/themes/solarized-dark/default.nix similarity index 100% rename from themes/solarized-dark/default.nix rename to modules/themes/solarized-dark/default.nix diff --git a/themes/solarized-light/README.org b/modules/themes/solarized-light/README.org similarity index 100% rename from themes/solarized-light/README.org rename to modules/themes/solarized-light/README.org diff --git a/themes/solarized-light/default.nix b/modules/themes/solarized-light/default.nix similarity index 100% rename from themes/solarized-light/default.nix rename to modules/themes/solarized-light/default.nix diff --git a/themes/spaceduck/README.org b/modules/themes/spaceduck/README.org similarity index 100% rename from themes/spaceduck/README.org rename to modules/themes/spaceduck/README.org diff --git a/themes/spaceduck/default.nix b/modules/themes/spaceduck/default.nix similarity index 100% rename from themes/spaceduck/default.nix rename to modules/themes/spaceduck/default.nix diff --git a/themes/stella/README.org b/modules/themes/stella/README.org similarity index 100% rename from themes/stella/README.org rename to modules/themes/stella/README.org diff --git a/themes/stella/default.nix b/modules/themes/stella/default.nix similarity index 100% rename from themes/stella/default.nix rename to modules/themes/stella/default.nix diff --git a/themes/summerfruit-dark/README.org b/modules/themes/summerfruit-dark/README.org similarity index 100% rename from themes/summerfruit-dark/README.org rename to modules/themes/summerfruit-dark/README.org diff --git a/themes/summerfruit-dark/default.nix b/modules/themes/summerfruit-dark/default.nix similarity index 100% rename from themes/summerfruit-dark/default.nix rename to modules/themes/summerfruit-dark/default.nix diff --git a/themes/tomorrow-night/README.org b/modules/themes/tomorrow-night/README.org similarity index 100% rename from themes/tomorrow-night/README.org rename to modules/themes/tomorrow-night/README.org diff --git a/themes/tomorrow-night/default.nix b/modules/themes/tomorrow-night/default.nix similarity index 100% rename from themes/tomorrow-night/default.nix rename to modules/themes/tomorrow-night/default.nix diff --git a/themes/twilight/README.org b/modules/themes/twilight/README.org similarity index 100% rename from themes/twilight/README.org rename to modules/themes/twilight/README.org diff --git a/themes/twilight/default.nix b/modules/themes/twilight/default.nix similarity index 100% rename from themes/twilight/default.nix rename to modules/themes/twilight/default.nix diff --git a/themes/ubuntu/README.org b/modules/themes/ubuntu/README.org similarity index 100% rename from themes/ubuntu/README.org rename to modules/themes/ubuntu/README.org diff --git a/themes/ubuntu/default.nix b/modules/themes/ubuntu/default.nix similarity index 100% rename from themes/ubuntu/default.nix rename to modules/themes/ubuntu/default.nix diff --git a/themes/uwunicorn/README.org b/modules/themes/uwunicorn/README.org similarity index 100% rename from themes/uwunicorn/README.org rename to modules/themes/uwunicorn/README.org diff --git a/themes/uwunicorn/default.nix b/modules/themes/uwunicorn/default.nix similarity index 100% rename from themes/uwunicorn/default.nix rename to modules/themes/uwunicorn/default.nix diff --git a/themes/windows-95/README.org b/modules/themes/windows-95/README.org similarity index 100% rename from themes/windows-95/README.org rename to modules/themes/windows-95/README.org diff --git a/themes/windows-95/default.nix b/modules/themes/windows-95/default.nix similarity index 100% rename from themes/windows-95/default.nix rename to modules/themes/windows-95/default.nix diff --git a/themes/woodland/README.org b/modules/themes/woodland/README.org similarity index 100% rename from themes/woodland/README.org rename to modules/themes/woodland/README.org diff --git a/themes/woodland/default.nix b/modules/themes/woodland/default.nix similarity index 100% rename from themes/woodland/default.nix rename to modules/themes/woodland/default.nix diff --git a/themes/xcode-dusk/README.org b/modules/themes/xcode-dusk/README.org similarity index 100% rename from themes/xcode-dusk/README.org rename to modules/themes/xcode-dusk/README.org diff --git a/themes/xcode-dusk/default.nix b/modules/themes/xcode-dusk/default.nix similarity index 100% rename from themes/xcode-dusk/default.nix rename to modules/themes/xcode-dusk/default.nix diff --git a/user/README.org b/modules/user/README.org similarity index 100% rename from user/README.org rename to modules/user/README.org diff --git a/modules/user/art/default.nix b/modules/user/art/default.nix new file mode 100644 index 00000000..02d8158d --- /dev/null +++ b/modules/user/art/default.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.art; +in { + options = { + userSettings.art = { + enable = lib.mkEnableOption "Enable art apps"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + gimp + krita + pinta + inkscape + libresprite + ]; + userSettings.blender.enable = true; + }; +} diff --git a/user/app/blender/applyprefs.py b/modules/user/blender/applyprefs.py similarity index 100% rename from user/app/blender/applyprefs.py rename to modules/user/blender/applyprefs.py diff --git a/modules/user/blender/default.nix b/modules/user/blender/default.nix new file mode 100644 index 00000000..c6a6c898 --- /dev/null +++ b/modules/user/blender/default.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.blender; +in { + options = { + userSettings.blender = { + enable = lib.mkEnableOption "Enable blender"; + }; + }; + + config = { + home.packages = [ pkgs.blender-hip ]; + home.file.".config/blender/extensions/node_pie.zip".source = builtins.fetchurl { + url = "https://github.com/strike-digital/node_pie/releases/download/1.2.38/node_pie_1_2_38.zip"; + sha256 = "sha256:00kscj7dkl80kc482jg3kcw9vhr1n64n44ld2xncr6gxil679fk2"; + }; + home.file.".config/blender/extensions/bool_tool.zip".source = builtins.fetchurl { + name = "bool_tool"; + url = "https://extensions.blender.org/download/sha256:74ecd752ec3eda67153c74ea5a6b22709da2669a6da43264bfa291fc784306b3/add-on-bool-tool-v1.1.2.zip?repository=%2Fapi%2Fv1%2Fextensions%2F&blender_version_min=4.2.0"; + sha256 = "sha256:1cq68dwgr4d2pxj3593dk9ka57bh49mmmskl7hangniyxi9dgv3l"; + }; + }; +} diff --git a/modules/user/bluetooth/default.nix b/modules/user/bluetooth/default.nix new file mode 100644 index 00000000..bbff4111 --- /dev/null +++ b/modules/user/bluetooth/default.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.bluetooth; +in { + options = { + userSettings.bluetooth = { + enable = lib.mkEnableOption "Enable bluetooth"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + blueman + ]; + services = { + blueman-applet.enable = true; + }; + }; +} diff --git a/modules/user/browser/brave.nix b/modules/user/browser/brave.nix new file mode 100644 index 00000000..3e40b6bf --- /dev/null +++ b/modules/user/browser/brave.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.brave; +in { + options = { + userSettings.brave = { + enable = lib.mkEnableOption "Enable brave browser"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.brave ]; + + nixpkgs.config.overlays = [ + (self: super: { + brave = super.brave.override { + commandLineArgs = [ + "--password-store=gnome-libsecret" + "--ignore-gpu-blocklist" + "--enable-gpu-rasterization" + "--enable-accelerated-video-decode" + "--enable-quic" + "--enable-zero-copy" + "--enable-native-gpu-memory-buffers" + "--num-raster-threads=4" + ]; + }; + }) + ]; + + xdg.mimeApps.defaultApplications = lib.mkIf (config.userSettings.browser == "brave" ) { + "text/html" = "brave-browser.desktop"; + "x-scheme-handler/http" = "brave-browser.desktop"; + "x-scheme-handler/https" = "brave-browser.desktop"; + "x-scheme-handler/about" = "brave-browser.desktop"; + "x-scheme-handler/unknown" = "brave-browser.desktop"; + }; + + home.sessionVariables = lib.mkIf (config.userSettings.browser == "brave") { + DEFAULT_BROWSER = "${pkgs.brave}/bin/brave"; + }; + }; +} diff --git a/modules/user/browser/default.nix b/modules/user/browser/default.nix new file mode 100644 index 00000000..f15343a8 --- /dev/null +++ b/modules/user/browser/default.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: + +let + browser = config.userSettings.browser; +in { + options = { + userSettings.browser = lib.mkOption { + default = "brave"; + description = "Default browser"; + type = lib.types.enum [ "brave" "qutebrowser" "librewolf" ]; + }; + userSettings.spawnBrowser = lib.mkOption { + default = "brave"; + description = "Default browser spawn command"; + type = lib.types.str; + }; + }; + + config = { + userSettings.brave.enable = lib.mkIf (browser == "brave") true; + userSettings.librewolf.enable = lib.mkIf (browser == "librewolf") true; + userSettings.qutebrowser.enable = lib.mkIf (browser == "qutebrowser") true; + + userSettings.spawnBrowser = lib.mkMerge [ + (lib.mkIf ((browser == "brave") || (browser == "librewolf")) browser) + (lib.mkIf (!(config.userSettings.hyprland.hyprprofiles.enable) && (browser == "qutebrowser")) "qutebrowser --qt-flag ignore-gpu-blacklist --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag enable-accelerated-2d-canvas --qt-flag num-raster-threads=4") + (lib.mkIf config.userSettings.hyprland.hyprprofiles.enable "qutebrowser-hyprprofile") + ]; + }; +} diff --git a/modules/user/browser/librewolf.nix b/modules/user/browser/librewolf.nix new file mode 100644 index 00000000..1c5804ab --- /dev/null +++ b/modules/user/browser/librewolf.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.librewolf; +in { + options = { + userSettings.librewolf = { + enable = lib.mkEnableOption "Enable librewolf browser"; + }; + }; + + config = lib.mkIf cfg.enable { + # Module installing librewolf as default browser + home.packages = [ pkgs.librewolf ]; + + home.file.".librewolf/librewolf.overrides.cfg".text = '' + defaultPref("font.size.variable.x-western",20); + defaultPref("browser.toolbars.bookmarks.visibility","always"); + defaultPref("privacy.resisttFingerprinting.letterboxing", true); + defaultPref("network.http.referer.XOriginPolicy",2); + defaultPref("privacy.clearOnShutdown.history",true); + defaultPref("privacy.clearOnShutdown.downloads",true); + defaultPref("privacy.clearOnShutdown.cookies",true); + defaultPref("gfx.webrender.software.opengl",false); + defaultPref("webgl.disabled",true); + + pref("font.size.variable.x-western",20); + pref("browser.toolbars.bookmarks.visibility","always"); + pref("privacy.resisttFingerprinting.letterboxing", true); + pref("network.http.referer.XOriginPolicy",2); + pref("privacy.clearOnShutdown.history",true); + pref("privacy.clearOnShutdown.downloads",true); + pref("privacy.clearOnShutdown.cookies",true); + pref("gfx.webrender.software.opengl",false); + pref("webgl.disabled",true); + ''; + + xdg.mimeApps.defaultApplications = lib.mkIf (config.userSettings.browser == "librewolf") { + "text/html" = "librewolf.desktop"; + "x-scheme-handler/http" = "librewolf.desktop"; + "x-scheme-handler/https" = "librewolf.desktop"; + "x-scheme-handler/about" = "librewolf.desktop"; + "x-scheme-handler/unknown" = "librewolf.desktop"; + }; + + home.sessionVariables = lib.mkIf (config.userSettings.browser == "librewolf") { + DEFAULT_BROWSER = "${pkgs.librewolf}/bin/librewolf"; + }; + }; + +} diff --git a/user/app/browser/qutebrowser-logo.png b/modules/user/browser/qutebrowser-logo.png similarity index 100% rename from user/app/browser/qutebrowser-logo.png rename to modules/user/browser/qutebrowser-logo.png diff --git a/user/app/browser/qutebrowser.nix b/modules/user/browser/qutebrowser.nix similarity index 59% rename from user/app/browser/qutebrowser.nix rename to modules/user/browser/qutebrowser.nix index bab16348..b9205e0d 100644 --- a/user/app/browser/qutebrowser.nix +++ b/modules/user/browser/qutebrowser.nix @@ -1,129 +1,163 @@ -{ config, pkgs, userSettings, ... }: -let generateHomepage = name: font: config: - '' - +{ config, lib, pkgs, ... }: +let + cfg = config.userSettings.qutebrowser; + font = config.stylix.fonts.monospace.name; + generateHomepage = name: font: config: + '' + - - My Local Dashboard Awesome Homepage - - - + /*div*/ + div { + margin:auto; + width:50%; + text-align:center; + } + /*class made for ascii art icon*/ + .icon { + line-height:10% + } + + - - -
-
-
-
- -
-
-
-
- -

Welcome to Qutebrowser

-
-

''+name+" "+''Profile

-
- -
- [o] [Search]

-
[b] [Quickmarks]

-
[t] [New tab]

-
[x] [Close tab]

-
- + + +
+
+
+
+ +
+
+
+
+ +

Welcome to Qutebrowser

+
+

''+name+" "+''Profile

+
+ +
+ [o] [Search]

+
[b] [Quickmarks]

+
[t] [New tab]

+
[x] [Close tab]

+
+ - - ''; -in -{ - - home.packages = [ pkgs.qutebrowser - (pkgs.callPackage ./qute-containers.nix { dmenuCmd = "fuzzel -d"; }) - ]; - home.sessionVariables = { DEFAULT_BROWSER = "${pkgs.qutebrowser}/bin/qutebrowser"; }; - xdg.mimeApps.defaultApplications = { - "text/html" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop"; - "x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop"; + + ''; + qute-containers = (pkgs.callPackage ({ lib, stdenv, fetchFromGitHub, dmenuCmd ? config.userSettings.dmenuScripts.dmenuCmd, ... }: + let name = "qute-containers"; + version = "unstable"; + dmenu = dmenuCmd; + in + stdenv.mkDerivation { + inherit name version; + + src = fetchFromGitHub { + owner = "s-praveen-kumar"; + repo = "qute-containers"; + rev = "c6164b94104fa8565200b87bfc87a2e08ca15ac7"; + sha256 = "sha256-g684sPSEJTRSk2V8LVrQsNeRIYtaQueRpZeREWtmQKw="; + }; + + phases = "installPhase"; + + postPatch = ''sed -i "s/qutebrowser/qutebrowser --qt-flag ignore-gpu-blacklist --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag enable-accelerated-2d-canvas --qt-flag num-raster-threads=4/g" container-open''; + + installPhase = '' + mkdir -p $out $out/bin + cp $src/* $out/bin + sed -i 's/DMENU=\"rofi -dmenu\"/DMENU=\"''+dmenu+''\"/g' $out/bin/containers_config + sed -i 's/DMENU_FLAGS//g' $out/bin/container-open + ''; + + meta = { + homepage = "https://github.com/s-praveen-kumar/qute-containers"; + description = "Browser Containers for Qutebrowser"; + license = lib.licenses.mit; + maintainers = []; + }; + })); +in { + options = { + userSettings.qutebrowser = { + enable = lib.mkEnableOption "Enable qutebrowser with my settings"; + }; }; - home.file.".config/qutebrowser/userscripts/container-open".source = "${(pkgs.callPackage ./qute-containers.nix { dmenuCmd = "fuzzel -d"; })}/bin/container-open"; - home.file.".config/qutebrowser/userscripts/containers_config".source = "${(pkgs.callPackage ./qute-containers.nix { dmenuCmd = "fuzzel -d"; })}/bin/containers_config"; - programs.qutebrowser.enable = true; - programs.qutebrowser.extraConfig = '' + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.qutebrowser + #qute-containers # TODO disabled for debugging + ]; + +# home.file.".config/qutebrowser/userscripts/container-open".source = "${qute-containers}/bin/container-open"; +# home.file.".config/qutebrowser/userscripts/containers_config".source = "${qute-containers}/bin/containers_config"; + + programs.qutebrowser.enable = true; + programs.qutebrowser.extraConfig = '' import sys import os.path secretsExists = False @@ -137,7 +171,7 @@ if (os.path.isfile(secretFile)): quickmarksFile = os.path.join(os.path.dirname(__file__),'quickmarks') quickmarksHtmlFilePath = os.path.join(os.path.dirname(__file__),'quickmarks.html') quickmarksHtmlFile = open(quickmarksHtmlFilePath,"w") -quickmarksHtmlFileText = 'My Local Dashboard Awesome Homepage



Quickmarks


' +quickmarksHtmlFileText = 'My Local Dashboard Awesome Homepage



Quickmarks


' with open(quickmarksFile) as myQuickmarks: for line in myQuickmarks: quickmarkData = line.split() @@ -372,7 +406,7 @@ c.colors.tabs.selected.odd.bg = base02 c.colors.tabs.selected.even.fg = base05 c.colors.tabs.selected.even.bg = base02 -font = "''+userSettings.font+''" +font = "''+font+''" c.fonts.default_family = font c.fonts.default_size = '14pt' @@ -383,21 +417,34 @@ c.fonts.web.family.sans_serif = font c.fonts.web.family.fixed = font c.fonts.web.family.fantasy = font c.fonts.web.family.cursive = font - ''; - - home.file.".config/qutebrowser/containers".text = '' + ''; + + home.file.".config/qutebrowser/containers".text = '' Gamedev Teaching Youtube - ''; + ''; + + home.file.".config/qutebrowser/qute-home.html".text = generateHomepage "Default" font config; + home.file.".config/qutebrowser/logo.png".source = ./qutebrowser-logo.png; + home.file.".browser/Gamedev/config/qute-home.html".text = generateHomepage "Gamedev" font config; + home.file.".browser/Gamedev/config/logo.png".source = ./qutebrowser-logo.png; + home.file.".browser/Teaching/config/qute-home.html".text = generateHomepage "Teaching" font config; + home.file.".browser/Teaching/config/logo.png".source = ./qutebrowser-logo.png; + home.file.".browser/Youtube/config/qute-home.html".text = generateHomepage "Youtube" font config; + home.file.".browser/Youtube/config/logo.png".source = ./qutebrowser-logo.png; - home.file.".config/qutebrowser/qute-home.html".text = generateHomepage "Default" userSettings.font config; - home.file.".config/qutebrowser/logo.png".source = ./qutebrowser-logo.png; - home.file.".browser/Gamedev/config/qute-home.html".text = generateHomepage "Gamedev" userSettings.font config; - home.file.".browser/Gamedev/config/logo.png".source = ./qutebrowser-logo.png; - home.file.".browser/Teaching/config/qute-home.html".text = generateHomepage "Teaching" userSettings.font config; - home.file.".browser/Teaching/config/logo.png".source = ./qutebrowser-logo.png; - home.file.".browser/Youtube/config/qute-home.html".text = generateHomepage "Youtube" userSettings.font config; - home.file.".browser/Youtube/config/logo.png".source = ./qutebrowser-logo.png; + xdg.mimeApps.defaultApplications = lib.mkIf (config.userSettings.browser == "qutebrowser" ) { + "text/html" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop"; + "x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop"; + }; + home.sessionVariables = lib.mkIf (config.userSettings.browser == "qutebrowser") { + DEFAULT_BROWSER = "${pkgs.qutebrowser}/bin/qutebrowser"; + }; + + }; } diff --git a/modules/user/default.nix b/modules/user/default.nix new file mode 100644 index 00000000..0567ef85 --- /dev/null +++ b/modules/user/default.nix @@ -0,0 +1,29 @@ +{ lib, ... }: + +with lib; +let + # Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype + getDir = dir: mapAttrs + (file: type: + if type == "directory" then getDir "${dir}/${file}" else type + ) + (builtins.readDir dir); + + # Collects all files of a directory as a list of strings of paths + files = dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir)); + + # Filters out directories that don't end with .nix or are this file, also makes the strings absolute + importAll = dir: map + (file: ./. + "/${file}") + (filter + (file: hasSuffix ".nix" file && file != "default.nix" && + ! lib.hasPrefix "x/taffybar/" file && + ! lib.hasSuffix "-hm.nix" file) + (files dir)); + +in +{ + + imports = importAll ./.; + +} diff --git a/modules/user/dmenu-scripts/default.nix b/modules/user/dmenu-scripts/default.nix new file mode 100644 index 00000000..f7de2bb8 --- /dev/null +++ b/modules/user/dmenu-scripts/default.nix @@ -0,0 +1,14 @@ +{ config, lib, ...}: + +{ + options = { + userSettings.dmenuScripts = { + enable = lib.mkEnableOption "Enable collection of dmenu scripts"; + dmenuCmd = lib.mkOption { + default = "rofi -show dmenu"; + description = "dmenu command"; + type = lib.types.str; + }; + }; + }; +} diff --git a/modules/user/dmenu-scripts/networkmanager-dmenu.nix b/modules/user/dmenu-scripts/networkmanager-dmenu.nix new file mode 100644 index 00000000..3c1716c5 --- /dev/null +++ b/modules/user/dmenu-scripts/networkmanager-dmenu.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.dmenuScripts; + dmenuCmd = cfg.dmenuCmd; +in { + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ networkmanager_dmenu networkmanagerapplet ]; + + home.file.".config/networkmanager-dmenu/config.ini".text = '' + [dmenu] + dmenu_command = ''+dmenuCmd+'' + + compact = True + wifi_chars = ▂▄▆█ + list_saved = True + + [editor] + terminal = alacritty + # gui_if_available = (Default: True) + ''; + }; +} diff --git a/modules/user/editor/default.nix b/modules/user/editor/default.nix new file mode 100644 index 00000000..c8223af3 --- /dev/null +++ b/modules/user/editor/default.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: + +let + editor = config.userSettings.editor; + term = config.userSettings.terminal; +in { + options = { + userSettings.editor = lib.mkOption { + default = "emacs"; + description = "Default editor"; + type = lib.types.enum [ "emacs" ]; + # TODO add more editors + #type = lib.types.enum [ "emacs" "vim" "nvim" "neovide" "nano" "micro" "vscodium" "kate" "pulsar" ]; + }; + userSettings.spawnEditor = lib.mkOption { + default = ""; + description = "Command to spawn editor"; + }; + }; + + config = { + userSettings.emacs.enable = lib.mkIf (config.userSettings.editor == "emacs") true; + userSettings.spawnEditor = lib.mkMerge [ + (lib.mkIf (editor == "emacs") "emacsclient -c -a 'emacs'") + (lib.mkIf (editor == "neovide") "neovide -- --listen /tmp/nvimsocket") + (lib.mkIf (builtins.elem editor [ "vim" "nvim" "nano" "micro" ]) ("exec " + term + " -e " + editor)) + (lib.mkIf (!(builtins.elem editor [ "emacs" "vim" "nvim" "neovide" "nano" "micro"])) editor) + ]; + }; +} diff --git a/modules/user/emacs/default.nix b/modules/user/emacs/default.nix new file mode 100644 index 00000000..d2c03ef9 --- /dev/null +++ b/modules/user/emacs/default.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.emacs; +in { + options = { + userSettings.emacs = { + enable = lib.mkEnableOption "Enable emacs"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + (pkgs.emacsWithPackagesFromUsePackage { + config = ./init.el; + package = pkgs.emacs-pgtk; + alwaysEnsure = false; + extraEmacsPackages = epkgs: with epkgs; [ + org-modern olivetti + command-log-mode + vertico corfu hotfuzz orderless + evil evil-collection evil-snipe evil-owl evil-vimish-fold + dashboard doom-themes doom-modeline + nerd-icons nerd-icons-dired nerd-icons-corfu + nerd-icons-ibuffer nerd-icons-completion + yasnippet shackle + projectile treemacs treemacs-projectile + treemacs-evil treemacs-nerd-icons + treesit-grammars.with-all-grammars + git-timemachine wgrep + magit magit-file-icons magit-todos + undo-fu undo-fu-session + org-roam org-node org-node-fakeroam + vterm vterm-toggle sudo-edit + direnv + gdscript-mode + nix-mode + python python-mode + lsp-mode flycheck lsp-ui lsp-treemacs + # fix ultra-scroll + (epkgs.callPackage ( + { lib, fetchurl, trivialBuild }: + + trivialBuild { + pname = "ultra-scroll"; + version = "0.2.0"; + + src = fetchGit { + url = "https://github.com/jdtsmith/ultra-scroll.git"; + rev = "64ad7be02e11317576498dabb15c92cf31e2c04c"; + ref = "main"; + }; + + meta = with lib; { + description = "scroll Emacs like lightning"; + homepage = "https://github.com/jdtsmith/ultra-scroll"; + license = licenses.gpl3; + platforms = platforms.all; + }; + } + ) {}) + ]; + }) + fira-code + nerd-fonts.fira-code + nil + ]; + home.file.".config/emacs/init.el".source = ./init.el; + home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors { + template = builtins.readFile ./lib/doom-stylix-theme.el.mustache; + extension = ".el"; + }; + }; +} diff --git a/user/app/emacs/init.el b/modules/user/emacs/init.el similarity index 99% rename from user/app/emacs/init.el rename to modules/user/emacs/init.el index 4813f445..18eb1875 100644 --- a/user/app/emacs/init.el +++ b/modules/user/emacs/init.el @@ -142,7 +142,6 @@ :after (org markdown git-timemachine)) (use-package ultra-scroll - :defer t :init (setq scroll-step 1 scroll-margin 0 diff --git a/user/app/emacs/doom-stylix-theme.el.mustache b/modules/user/emacs/lib/doom-stylix-theme.el.mustache similarity index 100% rename from user/app/emacs/doom-stylix-theme.el.mustache rename to modules/user/emacs/lib/doom-stylix-theme.el.mustache diff --git a/user/app/emacs/lib/line-wrapping-and-numbers.el b/modules/user/emacs/lib/line-wrapping-and-numbers.el similarity index 100% rename from user/app/emacs/lib/line-wrapping-and-numbers.el rename to modules/user/emacs/lib/line-wrapping-and-numbers.el diff --git a/modules/user/engineering/default.nix b/modules/user/engineering/default.nix new file mode 100644 index 00000000..e76158f9 --- /dev/null +++ b/modules/user/engineering/default.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.engineering; +in { + options = { + userSettings.engineering = { + enable = lib.mkEnableOption "Enable engineering programs"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + freecad + openscad + kicad + cura-appimage + ]; + }; +} diff --git a/modules/user/flatpak/default.nix b/modules/user/flatpak/default.nix new file mode 100644 index 00000000..66a8e2df --- /dev/null +++ b/modules/user/flatpak/default.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.flatpak; +in { + options = { + userSettings.flatpak = { + enable = lib.mkEnableOption "Enable flatpak support"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.flatpak ]; + home.sessionVariables = { + XDG_DATA_DIRS = "$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share"; # lets flatpak work + }; + + #services.flatpak.enable = true; + #services.flatpak.packages = [ { appId = "com.kde.kdenlive"; origin = "flathub"; } ]; + #services.flatpak.update.onActivation = true; + }; +} diff --git a/modules/user/git/git.nix b/modules/user/git/git.nix new file mode 100644 index 00000000..e8b723c6 --- /dev/null +++ b/modules/user/git/git.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, osConfig, ... }: + +let + cfg = config.userSettings.git; +in { + options = { + userSettings.git = { + enable = lib.mkEnableOption "Enable git"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.git ]; + programs.git.enable = true; + programs.git.userName = config.userSettings.name; + programs.git.userEmail = config.userSettings.email; + programs.git.extraConfig = { + init.defaultBranch = "main"; + safe.directory = [ osConfig.systemSettings.dotfilesDir (config.home.homeDirectory + "/.cache/nix/tarball-cache") ]; + }; + }; +} diff --git a/modules/user/godot/default.nix b/modules/user/godot/default.nix new file mode 100644 index 00000000..467604c6 --- /dev/null +++ b/modules/user/godot/default.nix @@ -0,0 +1,197 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.godot; +in { + options = { + userSettings.godot = { + enable = lib.mkEnableOption "Enable godot"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + godot_4 + ]; + + # ~/.config/godot must be owned by another user in order for this to work + # does not need to be recursively owned, however + + # TODO fix other colors + home.file.".config/godot/editor_settings-4.3.tres".text = '' + [gd_resource type="EditorSettings" format=3] + + [resource] + interface/editor/separate_distraction_mode = true + interface/theme/preset = "Custom" + interface/theme/spacing_preset = "Custom" + interface/theme/base_color = Color(''+config.lib.stylix.colors.base00-dec-r+'',''+config.lib.stylix.colors.base00-dec-g+'', ''+config.lib.stylix.colors.base00-dec-b+'', 0.8) + + interface/theme/accent_color = Color(''+config.lib.stylix.colors.base08-dec-r+'',''+config.lib.stylix.colors.base08-dec-g+'', ''+config.lib.stylix.colors.base08-dec-b+'', 1) + + interface/theme/contrast = 0.3 + interface/theme/icon_saturation = 1.55 + interface/theme/relationship_line_opacity = 0.35 + interface/theme/border_size = 1 + interface/theme/corner_radius = 6 + interface/theme/additional_spacing = 1 + interface/touchscreen/enable_pan_and_scale_gestures = true + interface/touchscreen/scale_gizmo_handles = 2.0 + interface/multi_window/enable = false + interface/multi_window/restore_windows_on_load = false + filesystem/external_programs/raster_image_editor = "krita" + filesystem/external_programs/vector_image_editor = "inkscape" + filesystem/external_programs/3d_model_editor = "blender" + filesystem/external_programs/terminal_emulator = "''+config.userSettings.terminal+''" + + filesystem/directories/default_project_path = "/home/''+config.home.username+''/Projects" + + text_editor/theme/highlighting/symbol_color = Color(0.67, 0.79, 1, 1) + text_editor/theme/highlighting/keyword_color = Color(1, 0.44, 0.52, 1) + text_editor/theme/highlighting/control_flow_keyword_color = Color(1, 0.55, 0.8, 1) + text_editor/theme/highlighting/base_type_color = Color(0.26, 1, 0.76, 1) + text_editor/theme/highlighting/engine_type_color = Color(0.56, 1, 0.86, 1) + text_editor/theme/highlighting/user_type_color = Color(0.78, 1, 0.93, 1) + text_editor/theme/highlighting/comment_color = Color(0.764706, 0.769608, 0.77451, 0.5) + text_editor/theme/highlighting/doc_comment_color = Color(0.6, 0.7, 0.8, 0.8) + text_editor/theme/highlighting/string_color = Color(1, 0.93, 0.63, 1) + text_editor/theme/highlighting/background_color = Color(0.0323529, 0.0431373, 0.0539216, 1) + text_editor/theme/highlighting/completion_background_color = Color(0.0588235, 0.0784314, 0.0980392, 1) + text_editor/theme/highlighting/completion_selected_color = Color(1, 1, 1, 0.07) + text_editor/theme/highlighting/completion_existing_color = Color(1, 1, 1, 0.14) + text_editor/theme/highlighting/completion_font_color = Color(0.764706, 0.769608, 0.77451, 1) + text_editor/theme/highlighting/text_color = Color(0.764706, 0.769608, 0.77451, 1) + text_editor/theme/highlighting/line_number_color = Color(0.764706, 0.769608, 0.77451, 0.5) + text_editor/theme/highlighting/safe_line_number_color = Color(0.764706, 0.923529, 0.77451, 0.75) + text_editor/theme/highlighting/caret_color = Color(1, 1, 1, 1) + text_editor/theme/highlighting/selection_color = Color(0.941176, 0.443137, 0.470588, 0.4) + text_editor/theme/highlighting/brace_mismatch_color = Color(1, 0.47, 0.42, 1) + text_editor/theme/highlighting/current_line_color = Color(1, 1, 1, 0.07) + text_editor/theme/highlighting/line_length_guideline_color = Color(0.0588235, 0.0784314, 0.0980392, 1) + text_editor/theme/highlighting/word_highlighted_color = Color(1, 1, 1, 0.07) + text_editor/theme/highlighting/number_color = Color(0.63, 1, 0.88, 1) + text_editor/theme/highlighting/function_color = Color(0.34, 0.7, 1, 1) + text_editor/theme/highlighting/member_variable_color = Color(0.736, 0.88, 1, 1) + text_editor/theme/highlighting/mark_color = Color(1, 0.47, 0.42, 0.3) + text_editor/theme/highlighting/breakpoint_color = Color(1, 0.47, 0.42, 1) + text_editor/theme/highlighting/code_folding_color = Color(1, 1, 1, 0.27) + text_editor/theme/highlighting/search_result_color = Color(1, 1, 1, 0.07) + text_editor/appearance/whitespace/draw_tabs = false + text_editor/behavior/indent/type = 1 + text_editor/behavior/indent/size = 2 + text_editor/behavior/files/trim_trailing_whitespace_on_save = true + editors/panning/2d_editor_panning_scheme = 1 + editors/panning/sub_editors_panning_scheme = 1 + editors/panning/simple_panning = true + project_manager/directory_naming_convention = 3 + asset_library/available_urls = { + "godotengine.org (Official)": "https://godotengine.org/asset-library/api" + } + asset_library/use_threads = true + export/android/java_sdk_path = "" + export/android/android_sdk_path = "" + export/android/debug_keystore = "/home/emmet/.local/share/godot/keystores/debug.keystore" + export/android/debug_keystore_user = "androiddebugkey" + export/android/debug_keystore_pass = "android" + export/android/force_system_user = false + export/android/shutdown_adb_on_exit = true + export/android/one_click_deploy_clear_previous_install = false + export/android/use_wifi_for_remote_debug = false + export/android/wifi_remote_debug_host = "localhost" + export/macos/rcodesign = "" + export/web/http_host = "localhost" + export/web/http_port = 8060 + export/web/use_tls = false + export/web/tls_key = "" + export/web/tls_certificate = "" + export/windows/rcedit = "" + export/windows/osslsigncode = "" + export/windows/wine = "/home/emmet/.nix-profile/bin/wine64" + _default_feature_profile = "" + interface/editors/show_scene_tree_root_selection = true + interface/editors/derive_script_globals_by_name = true + docks/scene_tree/ask_before_deleting_related_animation_tracks = true + _use_favorites_root_selection = false + filesystem/file_server/port = 6010 + filesystem/file_server/password = "" + editors/3d/manipulator_gizmo_size = 80 + editors/3d/manipulator_gizmo_opacity = 0.9 + editors/3d/navigation/show_viewport_rotation_gizmo = true + editors/3d/navigation/show_viewport_navigation_gizmo = false + text_editor/behavior/files/auto_reload_and_parse_scripts_on_save = true + text_editor/behavior/files/open_dominant_script_on_scene_change = false + text_editor/external/use_external_editor = false + text_editor/external/exec_path = "" + text_editor/script_list/script_temperature_enabled = true + text_editor/script_list/script_temperature_history_size = 15 + text_editor/script_list/group_help_pages = true + text_editor/script_list/sort_scripts_by = 0 + text_editor/script_list/list_script_names_as = 0 + text_editor/external/exec_flags = "{file}" + version_control/username = "" + version_control/ssh_public_key_path = "" + version_control/ssh_private_key_path = "" + editors/bone_mapper/handle_colors/unset = Color(0.3, 0.3, 0.3, 1) + editors/bone_mapper/handle_colors/set = Color(0.1, 0.6, 0.25, 1) + editors/bone_mapper/handle_colors/missing = Color(0.8, 0.2, 0.8, 1) + editors/bone_mapper/handle_colors/error = Color(0.8, 0.2, 0.2, 1) + network/debug_adapter/remote_port = 6006 + network/debug_adapter/request_timeout = 1000 + network/debug_adapter/sync_breakpoints = false + editors/3d_gizmos/gizmo_settings/path3d_tilt_disk_size = 0.8 + editors/3d_gizmos/gizmo_colors/path_tilt = Color(1, 1, 0.4, 0.9) + editors/3d_gizmos/gizmo_colors/skeleton = Color(1, 0.8, 0.4, 1) + editors/3d_gizmos/gizmo_colors/selected_bone = Color(0.8, 0.3, 0, 1) + editors/3d_gizmos/gizmo_settings/bone_axis_length = 0.1 + editors/3d_gizmos/gizmo_settings/bone_shape = 1 + editors/3d_gizmos/gizmo_colors/csg = Color(0, 0.4, 1, 0.15) + editors/grid_map/editor_side = 1 + editors/grid_map/palette_min_width = 230 + editors/grid_map/preview_size = 64 + export/ssh/ssh = "" + export/ssh/scp = "" + network/language_server/remote_host = "127.0.0.1" + network/language_server/remote_port = 6005 + network/language_server/enable_smart_resolve = true + network/language_server/show_native_symbols_in_editor = false + network/language_server/use_thread = false + network/language_server/poll_limit_usec = 100000 + text_editor/theme/highlighting/gdscript/function_definition_color = Color(0.4, 0.9, 1, 1) + text_editor/theme/highlighting/gdscript/global_function_color = Color(0.64, 0.64, 0.96, 1) + text_editor/theme/highlighting/gdscript/node_path_color = Color(0.72, 0.77, 0.49, 1) + text_editor/theme/highlighting/gdscript/node_reference_color = Color(0.39, 0.76, 0.35, 1) + text_editor/theme/highlighting/gdscript/annotation_color = Color(1, 0.7, 0.45, 1) + text_editor/theme/highlighting/gdscript/string_name_color = Color(1, 0.76, 0.65, 1) + text_editor/theme/highlighting/comment_markers/critical_color = Color(0.77, 0.35, 0.35, 1) + text_editor/theme/highlighting/comment_markers/warning_color = Color(0.72, 0.61, 0.48, 1) + text_editor/theme/highlighting/comment_markers/notice_color = Color(0.56, 0.67, 0.51, 1) + text_editor/theme/highlighting/comment_markers/critical_list = "ALERT,ATTENTION,CAUTION,CRITICAL,DANGER,SECURITY" + text_editor/theme/highlighting/comment_markers/warning_list = "BUG,DEPRECATED,FIXME,HACK,TASK,TBD,TODO,WARNING" + text_editor/theme/highlighting/comment_markers/notice_list = "INFO,NOTE,NOTICE,TEST,TESTING" + editors/3d_gizmos/gizmo_colors/camera = Color(0.8, 0.4, 0.8, 1) + editors/3d_gizmos/gizmo_colors/stream_player_3d = Color(0.4, 0.8, 1, 1) + editors/3d_gizmos/gizmo_colors/occluder = Color(0.8, 0.5, 1, 1) + editors/3d_gizmos/gizmo_colors/visibility_notifier = Color(0.8, 0.5, 0.7, 1) + editors/3d_gizmos/gizmo_colors/particles = Color(0.8, 0.7, 0.4, 1) + editors/3d_gizmos/gizmo_colors/particle_attractor = Color(1, 0.7, 0.5, 1) + editors/3d_gizmos/gizmo_colors/particle_collision = Color(0.5, 0.7, 1, 1) + editors/3d_gizmos/gizmo_colors/reflection_probe = Color(0.6, 1, 0.5, 1) + editors/3d_gizmos/gizmo_colors/decal = Color(0.6, 0.5, 1, 1) + editors/3d_gizmos/gizmo_colors/voxel_gi = Color(0.5, 1, 0.6, 1) + editors/3d_gizmos/gizmo_colors/lightmap_lines = Color(0.5, 0.6, 1, 1) + editors/3d_gizmos/gizmo_colors/lightprobe_lines = Color(0.5, 0.6, 1, 1) + editors/3d_gizmos/gizmo_colors/joint_body_a = Color(0.6, 0.8, 1, 1) + editors/3d_gizmos/gizmo_colors/joint_body_b = Color(0.6, 0.9, 1, 1) + editors/3d_gizmos/gizmo_colors/fog_volume = Color(0.5, 0.7, 1, 1) + text_editor/help/sort_functions_alphabetically = true + metadata/script_setup_templates_dictionary = { + "AnimatedSprite2D": "0NodeDefault", + "Area2D": "0NodeDefault", + "CanvasLayer": "0NodeDefault", + "Node": "0NodeDefault", + "Node2D": "0NodeDefault" + } + metadata/export_template_download_directory = "/home/emmet/.cache/godot" + ''; + }; +} diff --git a/modules/user/home.nix b/modules/user/home.nix new file mode 100644 index 00000000..b8aa3cc7 --- /dev/null +++ b/modules/user/home.nix @@ -0,0 +1,6 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + imports = [ inputs.chaotic.homeManagerModules.default ]; + +} diff --git a/modules/user/hyprland/default.nix b/modules/user/hyprland/default.nix new file mode 100644 index 00000000..7e3bcb2c --- /dev/null +++ b/modules/user/hyprland/default.nix @@ -0,0 +1,786 @@ +{ config, lib, pkgs, inputs, ... }: +let + cfg = config.userSettings.hyprland; + font = config.stylix.fonts.monospace.name; + term = config.userSettings.terminal; + spawnEditor = config.userSettings.spawnEditor; + spawnBrowser = config.userSettings.spawnBrowser; +in +{ + options = { + userSettings.hyprland = { + enable = lib.mkEnableOption "Enable hyprland"; + }; + }; + + config = { + userSettings.alacritty.enable = true; + userSettings.kitty.enable = true; + userSettings.japanese.enable = true; + userSettings.dmenuScripts = { + enable = true; + dmenuCmd = "fuzzel -d"; + }; + userSettings.hyprland.hyprprofiles.enable = lib.mkDefault true; + userSettings.stylix.enable = true; + + home.sessionVariables = { + NIXOS_OZONE_WL = 1; + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + WLR_DRM_DEVICES = "/dev/dri/card2:/dev/dri/card1"; + GDK_BACKEND = "wayland,x11,*"; + QT_QPA_PLATFORM = "wayland;xcb"; + QT_QPA_PLATFORMTHEME = lib.mkForce "qt5ct"; + QT_AUTO_SCREEN_SCALE_FACTOR = 1; + QT_WAYLAND_DISABLE_WINDOWDECORATION = 1; + CLUTTER_BACKEND = "wayland"; + GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; + GSK_RENDERER = "gl"; + }; + + gtk.cursorTheme = { + package = pkgs.quintom-cursor-theme; + name = if (config.stylix.polarity == "light") then "Quintom_Ink" else "Quintom_Snow"; + size = 36; + }; + + wayland.windowManager.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + plugins = [ ]; + settings = { }; + systemd.variables = ["--all"]; + extraConfig = '' + + exec-once = hyprctl setcursor ${config.gtk.cursorTheme.name} ${builtins.toString config.gtk.cursorTheme.size} + exec-once = sleep 10 && nextcloud + exec-once = iio-hyprland + exec-once = hyprprofile Default + + exec-once = ydotoold + exec-once = sleep 10 && caffeine + #exec-once = STEAM_FRAME_FORCE_CLOSE=1 steam -silent + exec-once = nm-applet + exec-once = blueman-applet + exec-once = GOMAXPROCS=1 syncthing --no-browser + exec-once = protonmail-bridge --noninteractive + exec-once = eww open-many bar:first bar:second bar:third --arg first:monitor=0 --arg second:monitor=1 --arg third:monitor=2 + exec-once = hyprland-monitor-attached ~/.local/bin/eww-reload-bars.sh + exec-once = emacs --daemon + + exec-once = hypridle + exec-once = sleep 5 && libinput-gestures + exec-once = obs-notification-mute-daemon + + exec-once = hyprpaper + + bezier = wind, 0.05, 0.9, 0.1, 1.05 + bezier = winIn, 0.1, 1.1, 0.1, 1.0 + bezier = winOut, 0.3, -0.3, 0, 1 + bezier = liner, 1, 1, 1, 1 + bezier = linear, 0.0, 0.0, 1.0, 1.0 + + animations { + enabled = yes + animation = windowsIn, 1, 6, winIn, popin + animation = windowsOut, 1, 5, winOut, popin + animation = windowsMove, 1, 5, wind, slide + animation = border, 1, 10, default + animation = borderangle, 1, 100, linear, loop + animation = fade, 1, 10, default + animation = workspaces, 1, 5, wind + animation = windows, 1, 6, wind, slide + animation = specialWorkspace, 1, 6, default, slidefadevert -50% + } + + general { + layout = master + border_size = 5 + col.active_border = 0xff'' + config.lib.stylix.colors.base08 + " " + ''0xff'' + config.lib.stylix.colors.base09 + " " + ''0xff'' + config.lib.stylix.colors.base0A + " " + ''0xff'' + config.lib.stylix.colors.base0B + " " + ''0xff'' + config.lib.stylix.colors.base0C + " " + ''0xff'' + config.lib.stylix.colors.base0D + " " + ''0xff'' + config.lib.stylix.colors.base0E + " " + ''0xff'' + config.lib.stylix.colors.base0F + " " + ''270deg + + col.inactive_border = 0xff'' + config.lib.stylix.colors.base02 + '' + + resize_on_border = true + gaps_in = 7 + gaps_out = 7 + } + + cursor { + no_warps = false + inactive_timeout = 30 + } + + bind=SUPER,code:9,exec,nwggrid-wrapper + bind=SUPER,code:66,exec,nwggrid-wrapper + bind=SUPER,SPACE,fullscreen,1 + bind=SUPERSHIFT,F,fullscreen,0 + bind=SUPER,Y,workspaceopt,allfloat + bind=ALT,TAB,cyclenext + bind=ALT,TAB,bringactivetotop + bind=ALTSHIFT,TAB,cyclenext,prev + bind=ALTSHIFT,TAB,bringactivetotop + bind=SUPER,V,exec,wl-copy $(wl-paste | tr '\n' ' ') + bind=SUPERSHIFT,T,exec,screenshot-ocr + bind=CTRLALT,Delete,exec,hyprctl kill + bind=SUPERSHIFT,K,exec,hyprctl kill + + bind=,code:172,exec,mpc toggle + bind=,code:208,exec,mpc toggle + bind=,code:209,exec,mpc toggle + bind=,code:174,exec,mpc stop + bind=,code:171,exec,mpc next + bind=,code:173,exec,mpc prev + + bind = SUPER,R,pass,^(com\.obsproject\.Studio)$ + bind = SUPERSHIFT,R,pass,^(com\.obsproject\.Studio)$ + + bind=SUPER,RETURN,exec,'' + term + '' + + bind=SUPERSHIFT,RETURN,exec,'' + term + " " + '' --class float_term + + bind=SUPER,A,exec,'' + spawnEditor + '' + + bind=SUPER,S,exec,'' + spawnBrowser + '' + + bind=SUPERCTRL,S,exec,container-open # qutebrowser only + + bind=SUPERCTRL,P,pin + + bind=SUPER,code:47,exec,fuzzel + bind=SUPER,X,exec,fnottctl dismiss + bind=SUPERSHIFT,X,exec,fnottctl dismiss all + bind=SUPER,Q,killactive + bind=SUPERSHIFT,Q,exit + bindm=SUPER,mouse:272,movewindow + bindm=SUPER,mouse:273,resizewindow + bind=SUPER,T,togglefloating + bind=,code:148,exec,''+ term + " "+''-e numbat + + bind=,code:107,exec,grim -g "$(slurp)" + bind=SHIFT,code:107,exec,grim -g "$(slurp -o)" + bind=SUPER,code:107,exec,grim + bind=CTRL,code:107,exec,grim -g "$(slurp)" - | wl-copy + bind=SHIFTCTRL,code:107,exec,grim -g "$(slurp -o)" - | wl-copy + bind=SUPERCTRL,code:107,exec,grim - | wl-copy + + bind=,code:122,exec,swayosd-client --output-volume lower + bind=,code:123,exec,swayosd-client --output-volume raise + bind=,code:121,exec,swayosd-client --output-volume mute-toggle + bind=,code:256,exec,swayosd-client --output-volume mute-toggle + bind=SHIFT,code:122,exec,swayosd-client --output-volume lower + bind=SHIFT,code:123,exec,swayosd-client --output-volume raise + bind=,code:232,exec,swayosd-client --brightness lower + bind=,code:233,exec,swayosd-client --brightness raise + bind=,code:237,exec,brightnessctl --device='asus::kbd_backlight' set 1- + bind=,code:238,exec,brightnessctl --device='asus::kbd_backlight' set +1 + bind=,code:255,exec,airplane-mode + bind=SUPER,C,exec,wl-copy $(hyprpicker) + + bind=SUPERSHIFT,S,exec,systemctl suspend + bindl=,switch:on:Lid Switch,exec,loginctl lock-session + bind=SUPERCTRL,L,exec,loginctl lock-session + + bind=SUPER,H,movefocus,l + bind=SUPER,J,movefocus,d + bind=SUPER,K,movefocus,u + bind=SUPER,L,movefocus,r + + bind=SUPERSHIFT,H,movewindow,l + bind=SUPERSHIFT,J,movewindow,d + bind=SUPERSHIFT,K,movewindow,u + bind=SUPERSHIFT,L,movewindow,r + + bind=SUPER,1,focusworkspaceoncurrentmonitor,1 + bind=SUPER,2,focusworkspaceoncurrentmonitor,2 + bind=SUPER,3,focusworkspaceoncurrentmonitor,3 + bind=SUPER,4,focusworkspaceoncurrentmonitor,4 + bind=SUPER,5,focusworkspaceoncurrentmonitor,5 + bind=SUPER,6,focusworkspaceoncurrentmonitor,6 + bind=SUPER,7,focusworkspaceoncurrentmonitor,7 + bind=SUPER,8,focusworkspaceoncurrentmonitor,8 + bind=SUPER,9,focusworkspaceoncurrentmonitor,9 + + bind=SUPERCTRL,right,exec,hyprnome + bind=SUPERCTRL,left,exec,hyprnome --previous + bind=SUPERSHIFT,right,exec,hyprnome --move + bind=SUPERSHIFT,left,exec,hyprnome --previous --move + + bind=SUPERSHIFT,1,movetoworkspace,1 + bind=SUPERSHIFT,2,movetoworkspace,2 + bind=SUPERSHIFT,3,movetoworkspace,3 + bind=SUPERSHIFT,4,movetoworkspace,4 + bind=SUPERSHIFT,5,movetoworkspace,5 + bind=SUPERSHIFT,6,movetoworkspace,6 + bind=SUPERSHIFT,7,movetoworkspace,7 + bind=SUPERSHIFT,8,movetoworkspace,8 + bind=SUPERSHIFT,9,movetoworkspace,9 + + exec-once = alacritty --class scratch_term + exec-once = kitty --class scratch_ranger -e ranger + exec-once = alacritty --class scratch_numbat -e numbat + exec-once = kitty --class scratch_music -e ncmpcpp + exec-once = alacritty --class scratch_btm -e btm + exec-once = element-desktop + exec-once = pavucontrol + + bind=SUPER,Z,exec,if hyprctl clients | grep scratch_term; then echo "scratch_term respawn not needed"; else alacritty --class scratch_term; fi + bind=SUPER,Z,togglespecialworkspace,scratch_term + bind=SUPER,F,exec,if hyprctl clients | grep scratch_ranger; then echo "scratch_ranger respawn not needed"; else kitty --class scratch_ranger -e ranger; fi + bind=SUPER,F,togglespecialworkspace,scratch_ranger + bind=SUPER,N,exec,if hyprctl clients | grep scratch_numbat; then echo "scratch_ranger respawn not needed"; else alacritty --class scratch_numbat -e numbat; fi + bind=SUPER,N,togglespecialworkspace,scratch_numbat + bind=SUPER,M,exec,if hyprctl clients | grep scratch_music; then echo "scratch_music respawn not needed"; else kitty --class scratch_music -e ncmpcpp; fi + bind=SUPER,M,togglespecialworkspace,scratch_music + bind=SUPER,B,exec,if hyprctl clients | grep scratch_btm; then echo "scratch_ranger respawn not needed"; else alacritty --class scratch_btm -e btm; fi + bind=SUPER,B,togglespecialworkspace,scratch_btm + bind=SUPER,D,exec,if hyprctl clients | grep Element; then echo "scratch_ranger respawn not needed"; else element-desktop; fi + bind=SUPER,D,togglespecialworkspace,scratch_element + bind=SUPER,code:172,exec,togglespecialworkspace,scratch_pavucontrol + bind=SUPER,code:172,exec,if hyprctl clients | grep pavucontrol; then echo "scratch_ranger respawn not needed"; else pavucontrol; fi + + $scratchpadsize = size 80% 85% + + $scratch_term = class:^(scratch_term)$ + windowrulev2 = float,$scratch_term + windowrulev2 = $scratchpadsize,$scratch_term + windowrulev2 = workspace special:scratch_term silent ,$scratch_term + windowrulev2 = center,$scratch_term + + $float_term = class:^(float_term)$ + windowrulev2 = float,$float_term + windowrulev2 = center,$float_term + + $scratch_ranger = class:^(scratch_ranger)$ + windowrulev2 = float,$scratch_ranger + windowrulev2 = $scratchpadsize,$scratch_ranger + windowrulev2 = workspace special:scratch_ranger silent,$scratch_ranger + windowrulev2 = center,$scratch_ranger + + $scratch_numbat = class:^(scratch_numbat)$ + windowrulev2 = float,$scratch_numbat + windowrulev2 = $scratchpadsize,$scratch_numbat + windowrulev2 = workspace special:scratch_numbat silent,$scratch_numbat + windowrulev2 = center,$scratch_numbat + + $scratch_btm = class:^(scratch_btm)$ + windowrulev2 = float,$scratch_btm + windowrulev2 = $scratchpadsize,$scratch_btm + windowrulev2 = workspace special:scratch_btm silent,$scratch_btm + windowrulev2 = center,$scratch_btm + + windowrulev2 = float,class:^(Element)$ + windowrulev2 = size 85% 90%,class:^(Element)$ + windowrulev2 = workspace special:scratch_element silent,class:^(Element)$ + windowrulev2 = center,class:^(Element)$ + + $scratch_music = class:^(scratch_music)$ + windowrulev2 = float,$scratch_music + windowrulev2 = $scratchpadsize,$scratch_music + windowrulev2 = workspace special:scratch_music silent,$scratch_music + windowrulev2 = center,$scratch_music + + $savetodisk = title:^(Save to Disk)$ + windowrulev2 = float,$savetodisk + windowrulev2 = size 70% 75%,$savetodisk + windowrulev2 = center,$savetodisk + + $pavucontrol = class:^(org.pulseaudio.pavucontrol)$ + windowrulev2 = float,$pavucontrol + windowrulev2 = size 86% 40%,$pavucontrol + windowrulev2 = move 50% 6%,$pavucontrol + windowrulev2 = workspace special silent,$pavucontrol + windowrulev2 = opacity 0.80,$pavucontrol + + $miniframe = title:\*Minibuf.* + windowrulev2 = float,$miniframe + windowrulev2 = size 64% 50%,$miniframe + windowrulev2 = move 18% 25%,$miniframe + windowrulev2 = animation popin 1 20,$miniframe + + windowrulev2 = float,class:^(pokefinder)$ + windowrulev2 = float,class:^(Waydroid)$ + + windowrulev2 = float,title:(Blender Render) + windowrulev2 = size 86% 85%,title:(Blender Render) + windowrulev2 = center,title:(Blender Render) + windowrulev2 = float,class:^(org.inkscape.Inkscape)$ + windowrulev2 = float,class:^(pinta)$ + windowrulev2 = float,class:^(krita)$ + windowrulev2 = float,class:^(Gimp) + windowrulev2 = float,class:^(Gimp) + windowrulev2 = float,class:^(libresprite)$ + windowrulev2 = float,title:(Open Images) + windowrulev2 = size 86% 85%,title:(Open Images) + windowrulev2 = center,title:(Open Images) + windowrulev2 = float,title:(Create new document) + windowrulev2 = size 86% 85%,title:(Create new document) + windowrulev2 = center,title:(Create new document) + windowrulev2 = size 86% 85%,title:(Create new document) + windowrulev2 = float,title:(Create New Node) + windowrulev2 = size 70% 70%,title:(Create New Node) + windowrulev2 = center,title:(Create New Node) + windowrulev2 = float,title:(Resource) + windowrulev2 = size 70% 70%,title:(Resource) + windowrulev2 = center,title:(Resource) + windowrulev2 = tile,title:(Godot) + + windowrulev2 = opacity 0.80,title:ORUI + + windowrulev2 = opacity 1.0,class:^(org.qutebrowser.qutebrowser),fullscreen:1 + windowrulev2 = opacity 0.85,class:^(Element)$ + windowrulev2 = opacity 0.85,class:^(Logseq)$ + windowrulev2 = opacity 1.0,class:^(Brave-browser),fullscreen:1 + windowrulev2 = opacity 1.0,class:^(librewolf),fullscreen:1 + windowrulev2 = opacity 0.85,title:^(My Local Dashboard Awesome Homepage - qutebrowser)$ + windowrulev2 = opacity 0.85,title:\[.*\] - My Local Dashboard Awesome Homepage + windowrulev2 = opacity 0.85,class:^(org.keepassxc.KeePassXC)$ + windowrulev2 = opacity 0.85,class:^(org.gnome.Nautilus)$ + windowrulev2 = opacity 0.85,class:^(org.gnome.Nautilus)$ + + windowrulev2 = opacity 0.85,initialTitle:^(Notes)$,initialClass:^(Brave-browser)$ + + layerrule = blur,waybar + layerrule = xray 1,waybar + blurls = waybar + layerrule = ignorezero, eww + layerrule = xray 1,eww + layerrule = blur,launcher # fuzzel + blurls = launcher # fuzzel + layerrule = blur,gtk-layer-shell + layerrule = xray 1,gtk-layer-shell + layerrule = ignorezero, gtk-layer-shell + layerrule = blur,eww + layerrule = xray 1,eww + layerrule = ignorezero, eww + layerrule = animation popin 80%, eww + blurls = gtk-layer-shell + layerrule = blur,~nwggrid + layerrule = xray 1,~nwggrid + layerrule = animation fade,~nwggrid + blurls = ~nwggrid + + bind=SUPER,equal, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | grep float | awk '{print $2 + 0.5}')" + bind=SUPER,minus, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | grep float | awk '{print $2 - 0.5}')" + + bind=SUPER,I,exec,networkmanager_dmenu + bind=SUPER,P,exec,keepmenu + bind=SUPERSHIFT,P,exec,hyprprofile-dmenu + bind=SUPERCTRL,R,exec,phoenix refresh + + # 3 monitor setup + monitor=eDP-1,1920x1080@300,900x1080,1 + monitor=HDMI-A-1,1920x1080,1920x0,1 + monitor=DP-1,1920x1080,0x0,1 + + # hdmi tv + #monitor=eDP-1,1920x1080,1920x0,1 + #monitor=HDMI-A-1,1920x1080,0x0,1 + + # hdmi work projector + #monitor=eDP-1,1920x1080,1920x0,1 + #monitor=HDMI-A-1,1920x1200,0x0,1 + + xwayland { + force_zero_scaling = true + } + + binds { + movefocus_cycles_fullscreen = false + } + + input { + kb_layout = us + kb_options = caps:escape + repeat_delay = 450 + repeat_rate = 50 + accel_profile = adaptive + follow_mouse = 2 + float_switch_override_focus = 0 + } + + misc { + disable_hyprland_logo = true + mouse_move_enables_dpms = true + enable_swallow = true + swallow_regex = (scratch_term)|(Alacritty)|(kitty) + font_family = '' + font + '' + + } + decoration { + rounding = 8 + dim_special = 0.0 + blur { + enabled = true + size = 5 + passes = 2 + ignore_opacity = true + contrast = 1.17 + brightness = '' + (if (config.stylix.polarity == "dark") then "0.65" else "1.45") + '' + + xray = true + special = true + popups = true + } + } + + ''; + xwayland = { enable = true; }; + systemd.enable = true; + }; + + home.packages = (with pkgs; [ + hyprland-monitor-attached + caffeine-ng + alacritty + kitty + killall + polkit_gnome + eww + nwg-launchers + papirus-icon-theme + (pkgs.writeScriptBin "nwggrid-wrapper" '' + #!/bin/sh + if pgrep -x "nwggrid-server" > /dev/null + then + nwggrid -client + else + GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache nwggrid-server -layer-shell-exclusive-zone -1 -g adw-gtk3 -o 0.55 -b ${config.lib.stylix.colors.base00} + fi + '') + libva-utils + libinput-gestures + gsettings-desktop-schemas + (pkgs.makeDesktopItem { + name = "nwggrid"; + desktopName = "Application Launcher"; + exec = "nwggrid-wrapper"; + terminal = false; + type = "Application"; + noDisplay = true; + icon = "${config.home.homeDirectory}/.local/share/pixmaps/hyprland-logo-stylix.svg"; + }) + hyprnome + wlr-randr + wtype + ydotool + wl-clipboard + hyprland-protocols + hyprpicker + inputs.hyprlock.packages.${pkgs.system}.default + hypridle + hyprpaper + fnott + keepmenu + pinentry-gnome3 + wev + grim + slurp + libsForQt5.qt5.qtwayland + qt6.qtwayland + xdg-utils + wlsunset + pavucontrol + pamixer + tesseract4 + (pkgs.writeScriptBin "workspace-on-monitor" '' + #!/bin/sh + hyprctl monitors -j | jq ".[$1] | .activeWorkspace.id" + '') + (pkgs.writeScriptBin "open-under-ranger" '' + #!/bin/sh + command="$1" + echo $command + file="''${*:2}" + file=''${file// /\\ } + echo $file + workspace=$(hyprctl monitors -j | jq ".[] | select(.specialWorkspace.name == \"special:scratch_ranger\") | .activeWorkspace.id") + if [ -z "''${workspace}" ]; then + hyprctl dispatch exec -- "$command"; + else + hyprctl dispatch exec "[workspace $workspace]" -- "$command" "$file"; + fi + hyprctl dispatch togglespecialworkspace scratch_ranger + '') + (pkgs.writeScriptBin "screenshot-ocr" '' + #!/bin/sh + imgname="/tmp/screenshot-ocr-$(date +%Y%m%d%H%M%S).png" + txtname="/tmp/screenshot-ocr-$(date +%Y%m%d%H%M%S)" + txtfname=$txtname.txt + grim -g "$(slurp)" $imgname; + tesseract $imgname $txtname; + wl-copy -n < $txtfname + '') + (pkgs.writeScriptBin "sct" '' + #!/bin/sh + killall wlsunset &> /dev/null; + if [ $# -eq 1 ]; then + temphigh=$(( $1 + 1 )) + templow=$1 + wlsunset -t $templow -T $temphigh &> /dev/null & + else + killall wlsunset &> /dev/null; + fi + '') + (pkgs.writeScriptBin "obs-notification-mute-daemon" '' + #!/bin/sh + while true; do + if pgrep -x .obs-wrapped > /dev/null; + then + pkill -STOP fnott; + else + pkill -CONT fnott; + fi + sleep 10; + done + '') + (pkgs.writeScriptBin "suspend-unless-render" '' + #!/bin/sh + if pgrep -x nixos-rebuild > /dev/null || pgrep -x home-manager > /dev/null || pgrep -x kdenlive > /dev/null || pgrep -x FL64.exe > /dev/null || pgrep -x blender > /dev/null || pgrep -x flatpak > /dev/null; + then echo "Shouldn't suspend"; sleep 10; else echo "Should suspend"; systemctl suspend; fi + '') + ]); + home.file.".local/bin/eww-reload-bars.sh" = { + text = ''#!/bin/sh + eww open-many bar:first bar:second bar:third --arg first:monitor=0 --arg second:monitor=1 --arg third:monitor=2;''; + executable = true; + }; + home.file.".config/hypr/hypridle.conf".text = '' + general { + lock_cmd = pgrep hyprlock || hyprlock + before_sleep_cmd = loginctl lock-session + ignore_dbus_inhibit = false + } + + #listener { + # timeout = 150 # in seconds + # on-timeout = hyprctl dispatch dpms off + # on-resume = hyprctl dispatch dpms on + #} + listener { + timeout = 165 # in seconds + on-timeout = loginctl lock-session + } + listener { + timeout = 180 # in seconds + #timeout = 5400 # in seconds + on-timeout = systemctl suspend + on-resume = hyprctl dispatch dpms on + } + ''; + home.file.".config/hypr/hyprlock.conf".text = '' + background { + monitor = + path = screenshot + + # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations + blur_passes = 4 + blur_size = 5 + noise = 0.0117 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 + } + + input-field { + monitor = + size = 200, 50 + outline_thickness = 3 + dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = false + dots_rounding = -1 # -1 default circle, -2 follow input-field rounding + outer_color = rgb(${config.lib.stylix.colors.base07-rgb-r},${config.lib.stylix.colors.base07-rgb-g},${config.lib.stylix.colors.base07-rgb-b}) + inner_color = rgb(${config.lib.stylix.colors.base00-rgb-r},${config.lib.stylix.colors.base00-rgb-g},${config.lib.stylix.colors.base00-rgb-b}) + font_color = rgb(${config.lib.stylix.colors.base07-rgb-r},${config.lib.stylix.colors.base07-rgb-g},${config.lib.stylix.colors.base07-rgb-b}) + fade_on_empty = true + fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered. + placeholder_text = Input Password... # Text rendered in the input box when it's empty. + hide_input = false + rounding = -1 # -1 means complete rounding (circle/oval) + check_color = rgb(${config.lib.stylix.colors.base0A-rgb-r},${config.lib.stylix.colors.base0A-rgb-g},${config.lib.stylix.colors.base0A-rgb-b}) + fail_color = rgb(${config.lib.stylix.colors.base08-rgb-r},${config.lib.stylix.colors.base08-rgb-g},${config.lib.stylix.colors.base08-rgb-b}) + fail_text = $FAIL ($ATTEMPTS) # can be set to empty + fail_transition = 300 # transition time in ms between normal outer_color and fail_color + capslock_color = -1 + numlock_color = -1 + bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above) + invert_numlock = false # change color if numlock is off + swap_font_color = false # see below + + position = 0, -20 + halign = center + valign = center + } + + label { + monitor = + text = Screen Locked + color = rgb(${config.lib.stylix.colors.base07-rgb-r},${config.lib.stylix.colors.base07-rgb-g},${config.lib.stylix.colors.base07-rgb-b}) + font_size = 25 + font_family = ${font} + + rotate = 0 # degrees, counter-clockwise + + position = 0, 160 + halign = center + valign = center + } + + label { + monitor = + text = $TIME12 + color = rgb(${config.lib.stylix.colors.base07-rgb-r},${config.lib.stylix.colors.base07-rgb-g},${config.lib.stylix.colors.base07-rgb-b}) + font_size = 20 + font_family = ${font} + rotate = 0 # degrees, counter-clockwise + + position = 0, 80 + halign = center + valign = center + } + ''; + services.swayosd.enable = true; + services.swayosd.topMargin = 0.5; + services.cbatticon = { + enable = true; + iconType = "symbolic"; + }; + home.file.".config/eww/eww.yuck".source = ./eww/eww.yuck; + home.file = { + ".config/eww/eww.scss".source = config.lib.stylix.colors { + template = builtins.readFile ./eww/eww.scss.mustache; + extension = ".scss"; + }; + }; + home.file.".config/nwg-launchers/nwggrid/style.css".text = '' + button, label, image { + background: none; + border-style: none; + box-shadow: none; + color: #'' + config.lib.stylix.colors.base07 + ''; + + font-size: 20px; + } + + button { + padding: 5px; + margin: 5px; + text-shadow: none; + } + + button:hover { + background-color: rgba('' + config.lib.stylix.colors.base07-rgb-r + "," + config.lib.stylix.colors.base07-rgb-g + "," + config.lib.stylix.colors.base07-rgb-b + "," + ''0.15); + } + + button:focus { + box-shadow: 0 0 10px; + } + + button:checked { + background-color: rgba('' + config.lib.stylix.colors.base07-rgb-r + "," + config.lib.stylix.colors.base07-rgb-g + "," + config.lib.stylix.colors.base07-rgb-b + "," + ''0.15); + } + + #searchbox { + background: none; + border-color: #'' + config.lib.stylix.colors.base07 + ''; + + color: #'' + config.lib.stylix.colors.base07 + ''; + + margin-top: 20px; + margin-bottom: 20px; + + font-size: 20px; + } + + #separator { + background-color: rgba('' + config.lib.stylix.colors.base00-rgb-r + "," + config.lib.stylix.colors.base00-rgb-g + "," + config.lib.stylix.colors.base00-rgb-b + "," + ''0.55); + + color: #'' + config.lib.stylix.colors.base07 + ''; + margin-left: 500px; + margin-right: 500px; + margin-top: 10px; + margin-bottom: 10px + } + + #description { + margin-bottom: 20px + } + ''; + home.file.".config/nwg-launchers/nwggrid/terminal".text = "alacritty -e"; + + services.udiskie.enable = true; + services.udiskie.tray = "always"; + programs.fuzzel.enable = true; + programs.fuzzel.package = pkgs.fuzzel; + programs.fuzzel.settings = { + main = { + font = font + ":size=20"; + dpi-aware = "no"; + show-actions = "yes"; + terminal = "${pkgs.alacritty}/bin/alacritty"; + }; + colors = { + background = config.lib.stylix.colors.base00 + "bf"; + text = config.lib.stylix.colors.base07 + "ff"; + match = config.lib.stylix.colors.base05 + "ff"; + selection = config.lib.stylix.colors.base08 + "ff"; + selection-text = config.lib.stylix.colors.base00 + "ff"; + selection-match = config.lib.stylix.colors.base05 + "ff"; + border = config.lib.stylix.colors.base08 + "ff"; + }; + border = { + width = 3; + radius = 7; + }; + }; + services.fnott.enable = true; + services.fnott.settings = { + main = { + anchor = "bottom-right"; + stacking-order = "top-down"; + min-width = 400; + title-font = font + ":size=14"; + summary-font = font + ":size=12"; + body-font = font + ":size=11"; + border-size = 0; + }; + low = { + background = config.lib.stylix.colors.base00 + "e6"; + title-color = config.lib.stylix.colors.base03 + "ff"; + summary-color = config.lib.stylix.colors.base03 + "ff"; + body-color = config.lib.stylix.colors.base03 + "ff"; + idle-timeout = 150; + max-timeout = 30; + default-timeout = 8; + }; + normal = { + background = config.lib.stylix.colors.base00 + "e6"; + title-color = config.lib.stylix.colors.base07 + "ff"; + summary-color = config.lib.stylix.colors.base07 + "ff"; + body-color = config.lib.stylix.colors.base07 + "ff"; + idle-timeout = 150; + max-timeout = 30; + default-timeout = 8; + }; + critical = { + background = config.lib.stylix.colors.base00 + "e6"; + title-color = config.lib.stylix.colors.base08 + "ff"; + summary-color = config.lib.stylix.colors.base08 + "ff"; + body-color = config.lib.stylix.colors.base08 + "ff"; + idle-timeout = 0; + max-timeout = 0; + default-timeout = 0; + }; + }; + home.file.".config/hypr/hyprpaper.conf".text = '' + preload = ''+config.stylix.image+'' + + wallpaper = ,''+config.stylix.image+'' + + ''; + + }; +} diff --git a/user/wm/hyprland/eww/eww.scss.mustache b/modules/user/hyprland/eww/eww.scss.mustache similarity index 100% rename from user/wm/hyprland/eww/eww.scss.mustache rename to modules/user/hyprland/eww/eww.scss.mustache diff --git a/user/wm/hyprland/eww/eww.yuck b/modules/user/hyprland/eww/eww.yuck similarity index 100% rename from user/wm/hyprland/eww/eww.yuck rename to modules/user/hyprland/eww/eww.yuck diff --git a/modules/user/hyprland/hyprprofiles/default.nix b/modules/user/hyprland/hyprprofiles/default.nix new file mode 100644 index 00000000..e672d72a --- /dev/null +++ b/modules/user/hyprland/hyprprofiles/default.nix @@ -0,0 +1,76 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.userSettings.hyprland.hyprprofiles; + dmenuCmd = config.userSettings.dmenuScripts.dmenuCmd; + qutebrowserEnabled = config.userSettings.qutebrowser.enable; + qutebrowserDefault = (config.userSettings.browser == "qutebrowser"); +in +{ + options = { + userSettings.hyprland.hyprprofiles = { + enable = lib.mkEnableOption "Enable hyprprofile profile switcher"; + # TODO make option for list of profiles + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ + (pkgs.writeScriptBin "hyprprofile" '' + #!/bin/sh + prevprofile="$(cat ~/.hyprprofile)" + newprofile="$1" + if [ $# -eq 1 ]; then + if [ $newprofile = "Default" ]; then + echo "" > ~/.hyprprofile; + else + echo $newprofile > ~/.hyprprofile; + fi + if [ -f ~/.config/hyprprofiles/$prevprofile/exit-hook.sh ]; then + ~/.config/hyprprofiles/$prevprofile/exit-hook.sh; + fi + if [ -f ~/.config/hyprprofiles/$newprofile/start-hook.sh ]; then + ~/.config/hyprprofiles/$newprofile/start-hook.sh; + fi + fi + '') + (pkgs.writeScriptBin "hyprprofile-dmenu" '' + #!/bin/sh + choice="$(\ls ~/.config/hyprprofiles | ''+dmenuCmd+'')"; + hyprprofile $choice; + '')] ++ + lib.optionals qutebrowserEnabled [ + (pkgs.writeScriptBin "qutebrowser-hyprprofile" '' + #!/bin/sh + profile="$(cat ~/.hyprprofile)" + if [[ $profile ]]; then + container-open $profile $1; + else + qutebrowser --qt-flag ignore-gpu-blacklist --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag enable-accelerated-2d-canvas --qt-flag num-raster-threads=4 $1; + fi + '') + (pkgs.makeDesktopItem { + name = "qutebrowser-hyprprofile"; + desktopName = "Qutebrowser Hyprprofile"; + exec = "qutebrowser-hyprprofile %u"; + categories = ["Network" "WebBrowser"]; + keywords = ["Browser"]; + terminal = false; + type = "Application"; + noDisplay = false; + icon = "qutebrowser"; + }) + ]; + xdg.mimeApps.defaultApplications = lib.optionals qutebrowserDefault (lib.mkForce { + "text/html" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/http" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/https" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/about" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/unknown" = "qutebrowser-hyprprofile.desktop"; + }); + home.file.".config/hyprprofiles/" = { + source = ./profiles; + recursive = true; + executable = true; + }; + }; +} diff --git a/user/wm/hyprland/hyprprofiles/profiles/Default/start-hook.sh b/modules/user/hyprland/hyprprofiles/profiles/Default/start-hook.sh similarity index 100% rename from user/wm/hyprland/hyprprofiles/profiles/Default/start-hook.sh rename to modules/user/hyprland/hyprprofiles/profiles/Default/start-hook.sh diff --git a/user/wm/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh b/modules/user/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh similarity index 100% rename from user/wm/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh rename to modules/user/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh diff --git a/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh b/modules/user/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh similarity index 100% rename from user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh rename to modules/user/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh diff --git a/user/wm/hyprland/hyprprofiles/profiles/Tech/start-hook.sh b/modules/user/hyprland/hyprprofiles/profiles/Tech/start-hook.sh similarity index 100% rename from user/wm/hyprland/hyprprofiles/profiles/Tech/start-hook.sh rename to modules/user/hyprland/hyprprofiles/profiles/Tech/start-hook.sh diff --git a/modules/user/japanese/default.nix b/modules/user/japanese/default.nix new file mode 100644 index 00000000..d9163797 --- /dev/null +++ b/modules/user/japanese/default.nix @@ -0,0 +1,121 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.japanese; +in { + options = { + userSettings.japanese = { + enable = lib.mkEnableOption "Enable Japanese input"; + }; + }; + + config = lib.mkIf cfg.enable { + i18n.inputMethod = { + enabled = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-mozc + fcitx5-gtk + ]; + }; + home.file.".config/fcitx5/config".text = '' + [Hotkey] + # Enumerate when press trigger key repeatedly + EnumerateWithTriggerKeys=True + # Temporally switch between first and current Input Method + AltTriggerKeys= + # Enumerate Input Method Forward + EnumerateForwardKeys= + # Enumerate Input Method Backward + EnumerateBackwardKeys= + # Skip first input method while enumerating + EnumerateSkipFirst=False + # Toggle embedded preedit + TogglePreedit= + + [Hotkey/TriggerKeys] + 0=Super+comma + + [Hotkey/EnumerateGroupForwardKeys] + 0=Super+space + + [Hotkey/EnumerateGroupBackwardKeys] + 0=Shift+Super+space + + [Hotkey/ActivateKeys] + 0=Hangul_Hanja + + [Hotkey/DeactivateKeys] + 0=Hangul_Romaja + + [Hotkey/PrevPage] + 0=Up + + [Hotkey/NextPage] + 0=Down + + [Hotkey/PrevCandidate] + 0=Shift+Tab + + [Hotkey/NextCandidate] + 0=Tab + + [Behavior] + # Active By Default + ActiveByDefault=False + # Share Input State + ShareInputState=No + # Show preedit in application + PreeditEnabledByDefault=True + # Show Input Method Information when switch input method + ShowInputMethodInformation=True + # Show Input Method Information when changing focus + showInputMethodInformationWhenFocusIn=False + # Show compact input method information + CompactInputMethodInformation=True + # Show first input method information + ShowFirstInputMethodInformation=True + # Default page size + DefaultPageSize=5 + # Override Xkb Option + OverrideXkbOption=False + # Custom Xkb Option + CustomXkbOption= + # Force Enabled Addons + EnabledAddons= + # Force Disabled Addons + DisabledAddons= + # Preload input method to be used by default + PreloadInputMethod=True + # Allow input method in the password field + AllowInputMethodForPassword=False + # Show preedit text when typing password + ShowPreeditForPassword=False + # Interval of saving user data in minutes + AutoSavePeriod=30 + ''; +# home.file.".config/fcitx5/profile".text = '' +# [Groups/0] +# # Group Name +# Name=Default +# # Layout +# Default Layout=us +# # Default Input Method +# DefaultIM=mozc +# +# [Groups/0/Items/0] +# # Name +# Name=keyboard-us +# # Layout +# Layout= +# +# [Groups/0/Items/1] +# # Name +# Name=mozc +# # Layout +# Layout= +# +# [GroupOrder] +# 0=Default +# ''; + }; +} diff --git a/modules/user/keepass/default.nix b/modules/user/keepass/default.nix new file mode 100644 index 00000000..77119990 --- /dev/null +++ b/modules/user/keepass/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.keepass; +in { + options = { + userSettings.keepass = { + enable = lib.mkEnableOption "Enable keepass password manager"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + keepassxc + keepmenu + ]; + }; +} diff --git a/modules/user/media/default.nix b/modules/user/media/default.nix new file mode 100644 index 00000000..4729d216 --- /dev/null +++ b/modules/user/media/default.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.media; +in { + options = { + userSettings.media = { + enable = lib.mkEnableOption "Enable media playback apps"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + vlc + #yt-dlp_git # TODO disabled for debugging + mpv mpc + ncmpcpp + ffmpeg + ]; + + services.mpd = rec { + enable = true; + musicDirectory = config.xdg.userDirs.music+"/Songs"; + playlistDirectory = config.xdg.userDirs.music+"/Playlists"; + dbFile = musicDirectory+"/mpd.db"; + extraConfig = '' + audio_output { + type "pipewire" + name "PipeWire Sound Server" + } + ''; + }; + + programs.ncmpcpp.bindings = [ + { key = "j"; command = "scroll_down"; } + { key = "k"; command = "scroll_up"; } + { key = "J"; command = [ "select_item" "scroll_down" ]; } + { key = "K"; command = [ "select_item" "scroll_up" ]; } + ]; + + }; +} diff --git a/modules/user/music/default.nix b/modules/user/music/default.nix new file mode 100644 index 00000000..97cba874 --- /dev/null +++ b/modules/user/music/default.nix @@ -0,0 +1,69 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.music; +in { + options = { + userSettings.music = { + enable = lib.mkEnableOption "Enable apps for making music"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + ardour + rosegarden + tenacity + mediainfo + easytag + bottles + # The following requires 64-bit FL Studio (FL64) to be installed to a bottle + # With a bottle name of "FL Studio" + (pkgs.writeShellScriptBin "flstudio" '' + #!/bin/sh + if [ -z "$1" ] + then + bottles-cli run -b "FL Studio" -p FL64 + #flatpak run --command=bottles-cli com.usebottles.bottles run -b FL\ Studio -p FL64 + else + filepath=$(winepath --windows "$1") + echo \'"$filepath"\' + bottles-cli run -b "FL Studio" -p "FL64" --args \'"$filepath"\' + #flatpak run --command=bottles-cli com.usebottles.bottles run -b FL\ Studio -p FL64 -args "$filepath" + fi + '') + (pkgs.makeDesktopItem { + name = "flstudio"; + desktopName = "FL Studio 64"; + exec = "flstudio %U"; + terminal = false; + type = "Application"; + icon = "flstudio"; + mimeTypes = ["application/octet-stream"]; + }) + (stdenv.mkDerivation { + name = "flstudio-icon"; + # icon from https://www.reddit.com/r/MacOS/comments/jtmp7z/i_made_icons_for_discord_spotify_and_fl_studio_in/ + src = [ ./flstudio.png ]; + + unpackPhase = '' + for srcFile in $src; do + # Copy file into build dir + cp $srcFile ./ + done + ''; + + installPhase = '' + mkdir -p $out $out/share $out/share/pixmaps + ls $src + ls + cp $src $out/share/pixmaps/flstudio.png + ''; + }) + ]; + + xdg.mimeApps.associations.added = { + "application/octet-stream" = "flstudio.desktop;"; + }; + }; +} diff --git a/user/pkgs/flstudio.png b/modules/user/music/flstudio.png similarity index 100% rename from user/pkgs/flstudio.png rename to modules/user/music/flstudio.png diff --git a/modules/user/nix/default.nix b/modules/user/nix/default.nix new file mode 100644 index 00000000..aeb4fd55 --- /dev/null +++ b/modules/user/nix/default.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, inputs, ... }: + +let + caches = import inputs.secrets.caches; +in { + config = { + nix = { + package = lib.mkForce pkgs.nix; + settings = { + substituters = + (lib.optionals (caches ? urls) caches.urls) ++ + [ + "https://cache.nixos.org" + "https://hyprland.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = + (lib.optionals (caches ? publicKeys) caches.publicKeys) ++ + [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-users = [ "@wheel" ]; + auto-optimise-store = true; + download-buffer-size = 500000000; + }; + }; + home.stateVersion = "22.11"; + }; +} diff --git a/modules/user/office/default.nix b/modules/user/office/default.nix new file mode 100644 index 00000000..b266d818 --- /dev/null +++ b/modules/user/office/default.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.office; +in { + options = { + userSettings.office = { + enable = lib.mkEnableOption "Enable my office programs"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + shared-mime-info + nautilus + libreoffice-still + mate.atril + xournalpp + adwaita-icon-theme + newsflash + foliate + gnome-maps + seahorse + element-desktop + openvpn + ]; + services.syncthing.enable = true; + services.nextcloud-client = { + enable = true; + startInBackground = true; + }; + }; +} diff --git a/user/app/ranger/README.org b/modules/user/ranger/README.org similarity index 100% rename from user/app/ranger/README.org rename to modules/user/ranger/README.org diff --git a/user/app/ranger/colorschemes/hail.py b/modules/user/ranger/colorschemes/hail.py similarity index 100% rename from user/app/ranger/colorschemes/hail.py rename to modules/user/ranger/colorschemes/hail.py diff --git a/user/app/ranger/commands.py b/modules/user/ranger/commands.py similarity index 100% rename from user/app/ranger/commands.py rename to modules/user/ranger/commands.py diff --git a/user/app/ranger/commands_full.py b/modules/user/ranger/commands_full.py similarity index 100% rename from user/app/ranger/commands_full.py rename to modules/user/ranger/commands_full.py diff --git a/modules/user/ranger/ranger.nix b/modules/user/ranger/ranger.nix new file mode 100644 index 00000000..cbf5df61 --- /dev/null +++ b/modules/user/ranger/ranger.nix @@ -0,0 +1,88 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.ranger; +in { + options = { + userSettings.ranger = { + enable = lib.mkEnableOption "Enable ranger file manager"; + }; + }; + + config = lib.mkIf cfg.enable { + nixpkgs.overlays = [ + (self: super: + { + ranger = super.ranger.overrideAttrs (oldAttrs: rec { + preConfigure = '' + substituteInPlace ranger/__init__.py \ + --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${lib.getBin pkgs.bat}/bin/bat'" + + # give image previews out of the box when building with w3m + substituteInPlace ranger/config/rc.conf \ + --replace "set preview_images false" "set preview_images true" + + # adds this patch: https://github.com/ranger/ranger/pull/1758 + # fixes a bug for kitty users that use image previews + substituteInPlace ranger/ext/img_display.py \ + --replace "self.image_id -= 1" "self.image_id = max(0, self.image_id - 1)" + + # fixes the .desktop file + substituteInPlace doc/ranger.desktop \ + --replace "Icon=utilities-terminal" "Icon=user-desktop" + substituteInPlace doc/ranger.desktop \ + --replace "Terminal=true" "Terminal=false" + substituteInPlace doc/ranger.desktop \ + --replace "Exec=ranger" "Exec=kitty -e ranger %U" + ''; + }); + } + ) + ]; + + home.packages = with pkgs; [ + ranger + ripdrag + highlight + poppler_utils + librsvg + ffmpegthumbnailer + # TODO fix cbx script + (pkgs.writeScriptBin "cbx" '' + # this lets my copy and paste images and/or plaintext of files directly out of ranger + if [ "$#" -le "2" ]; then + if [ "$1" = "copy" -o "$1" = "cut" ]; then + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + wl-copy < $2; + else + # xclip -selection clipboard -t $(file -b --mime-type $2) -i $2; + xclip -selection clipboard -t image/png -i $2; + fi + fi + fi + '') + ]; + + xdg.mimeApps.associations.added = { + "inode/directory" = "ranger.desktop"; + }; + home.file.".config/ranger/rc.conf".source = ./rc.conf; + home.file.".config/ranger/rifle.conf".source = ./rifle.conf; + home.file.".config/ranger/scope.sh" = { + source = ./scope.sh; + executable = true; + }; + home.file.".config/ranger/commands.py" = { + source = ./commands.py; + executable = true; + }; + home.file.".config/ranger/commands_full.py" = { + source = ./commands_full.py; + executable = true; + }; + home.file.".config/ranger/colorschemes/hail.py" = { + source = ./colorschemes/hail.py; + executable = true; + }; + }; +} diff --git a/user/app/ranger/rc.conf b/modules/user/ranger/rc.conf similarity index 100% rename from user/app/ranger/rc.conf rename to modules/user/ranger/rc.conf diff --git a/user/app/ranger/rifle.conf b/modules/user/ranger/rifle.conf similarity index 99% rename from user/app/ranger/rifle.conf rename to modules/user/ranger/rifle.conf index 092ab3d8..3fa8c4d6 100644 --- a/user/app/ranger/rifle.conf +++ b/modules/user/ranger/rifle.conf @@ -86,7 +86,7 @@ ext blend~, has blender, X, flag f = open-under-ranger blender "$@" &>/dev/null ext xopp, has xournalpp, X, flag f = open-under-ranger xournalpp "$@" &>/dev/null ext xopp~, has blender, X, flag f = open-under-ranger xournalpp "$@" &>/dev/null ext helio, has helio, X, flag f = open-under-ranger helio "$@" &>/dev/null -ext kdenlive, has kdenlive-accel, X, flag f = open-under-ranger kdenlive-accel "$@" &>/dev/null +ext kdenlive, has kdenlive, X, flag f = open-under-ranger kdenlive "$@" &>/dev/null ext flp, has flstudio, X, flag f = open-under-ranger flstudio "$@" &>/dev/null ext 3mf, has Cura, X, flag f = open-under-ranger Cura "$@" &>/dev/null ext 3mf, has curax, X, flag f = open-under-ranger curax "$@" &>/dev/null diff --git a/user/app/ranger/scope.sh b/modules/user/ranger/scope.sh similarity index 100% rename from user/app/ranger/scope.sh rename to modules/user/ranger/scope.sh diff --git a/modules/user/recording/default.nix b/modules/user/recording/default.nix new file mode 100644 index 00000000..240dfcff --- /dev/null +++ b/modules/user/recording/default.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.recording; +in { + options = { + userSettings.recording = { + enable = lib.mkEnableOption "Enable studio recording and editing programs"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + obs-studio + kdenlive + tenacity + ardour + ]; + }; +} diff --git a/modules/user/remote/default.nix b/modules/user/remote/default.nix new file mode 100644 index 00000000..f28a671f --- /dev/null +++ b/modules/user/remote/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.remote; +in { + options = { + userSettings.remote = { + enable = lib.mkEnableOption "Enable programs for controlling remote machines"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + remmina + sshfs + ]; + }; +} diff --git a/modules/user/shell/default.nix b/modules/user/shell/default.nix new file mode 100644 index 00000000..1caf9465 --- /dev/null +++ b/modules/user/shell/default.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.shell; +in { + options = { + userSettings.shell = { + enable = lib.mkEnableOption "Enable fancy zsh with some necessary CLI utilities"; + }; + }; + + config = lib.mkIf cfg.enable { + programs.zsh = { + enable = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + enableCompletion = true; + shellAliases = { + ls = "eza --icons -l -T -L=1"; + cat = "bat"; + htop = "btm"; + fd = "fd -Lu"; + w3m = "w3m -no-cookie -v"; + neofetch = "disfetch"; + fetch = "disfetch"; + gitfetch = "onefetch"; + "," = "comma"; + ",," = "comma-shell"; + }; + initExtra = '' + PROMPT=" ◉ %U%F{magenta}%n%f%u@%U%F{blue}%m%f%u:%F{yellow}%~%f + %F{green}→%f " + RPROMPT="%F{red}▂%f%F{yellow}▄%f%F{green}▆%f%F{cyan}█%f%F{blue}▆%f%F{magenta}▄%f%F{white}▂%f" + [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' + bindkey '^P' history-beginning-search-backward + bindkey '^N' history-beginning-search-forward + ''; + }; + + programs.bash = { + enable = true; + enableCompletion = true; + shellAliases = config.programs.zsh.shellAliases; + }; + + home.packages = with pkgs; [ + gnugrep gnused w3m + bat eza bottom fd bc + direnv nix-direnv + ]; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + }; + + programs.direnv.enable = true; + programs.direnv.enableZshIntegration = true; + programs.direnv.nix-direnv.enable = true; + programs.direnv.nix-direnv.package = pkgs.nix-direnv-flakes; + }; +} diff --git a/modules/user/shell/term-apps-extra.nix b/modules/user/shell/term-apps-extra.nix new file mode 100644 index 00000000..d85ef9e4 --- /dev/null +++ b/modules/user/shell/term-apps-extra.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.shell.extraApps; +in { + options = { + userSettings.shell.extraApps = { + enable = lib.mkEnableOption "Add some fun but mostly useless CLI apps"; + }; + }; + + config = lib.mkIf cfg.enable { + # Fun CLI apps that aren't necessary + home.packages = with pkgs; [ + # Command Line + disfetch lolcat cowsay + starfetch + (stdenv.mkDerivation { + name = "pokemon-colorscripts"; + version = "unstable"; + + src = fetchFromGitLab { + owner = "phoneybadger"; + repo = "pokemon-colorscripts"; + rev = "0483c85b93362637bdd0632056ff986c07f30868"; + sha256 = "sha256-rj0qKYHCu9SyNsj1PZn1g7arjcHuIDGHwubZg/yJt7A="; + }; + + installPhase = '' + mkdir -p $out $out/bin $out/opt + cp -rf $src/colorscripts $out/opt + cp $src/pokemon-colorscripts.py $out/opt + cp $src/pokemon.json $out/opt + ln -s $out/opt/pokemon-colorscripts.py $out/bin/pokemon-colorscripts + ''; + + meta = { + homepage = "https://github.com/Admiral-Fish/PokeFinder"; + description = "CLI utility to print out images of pokemon to terminal"; + license = lib.licenses.mit; + maintainers = []; + }; + }) + ]; + }; +} diff --git a/modules/user/shell/term-apps.nix b/modules/user/shell/term-apps.nix new file mode 100644 index 00000000..8b9b8d3c --- /dev/null +++ b/modules/user/shell/term-apps.nix @@ -0,0 +1,66 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.shell.apps; +in { + options = { + userSettings.shell.apps = { + enable = lib.mkEnableOption "Enable a collection of additional useful CLI apps"; + }; + }; + + config = lib.mkIf cfg.enable { + # Collection of useful CLI apps + home.packages = with pkgs; [ + # Command Line + killall + libnotify + timer + brightnessctl + gnugrep + bat eza fd bottom ripgrep + rsync + zip unzip + w3m + pandoc + hwinfo + pciutils + numbat + (pkgs.writeShellScriptBin "airplane-mode" '' + #!/bin/sh + connectivity="$(nmcli n connectivity)" + if [ "$connectivity" == "full" ] + then + nmcli n off + else + nmcli n on + fi + '') + (pkgs.writeScriptBin "comma" '' + if [ "$#" = 0 ]; then + echo "usage: comma PKGNAME... [EXECUTABLE]"; + elif [ "$#" = 1 ]; then + nix-shell -p $1 --run $1; + elif [ "$#" = 2 ]; then + nix-shell -p $1 --run $2; + else + echo "error: too many arguments"; + echo "usage: comma PKGNAME... [EXECUTABLE]"; + fi + '') + (pkgs.writeScriptBin "comma-shell" '' + if [ "$#" = 0 ]; then + echo "usage: comma-shell PKGNAME1 [PKGNAME2 PKGNAME3...]"; + else + nix-shell -p $@ + fi + '') + ]; + + programs.zsh.shellAliases = { + w3m = "w3m -no-cookie -v"; + "," = "comma"; + ",," = "comma-shell"; + }; + }; +} diff --git a/user/style/Trolltech.conf.mustache b/modules/user/stylix/Trolltech.conf.mustache similarity index 100% rename from user/style/Trolltech.conf.mustache rename to modules/user/stylix/Trolltech.conf.mustache diff --git a/modules/user/stylix/default.nix b/modules/user/stylix/default.nix new file mode 100644 index 00000000..05dc088c --- /dev/null +++ b/modules/user/stylix/default.nix @@ -0,0 +1,127 @@ +{ config, lib, pkgs, inputs, osConfig, ... }: + +let + cfg = config.userSettings.stylix; + theme = import (./. + "../../../themes"+("/"+config.userSettings.stylix.theme)); +in +{ + options = { + userSettings.stylix = { + enable = lib.mkEnableOption "Enable stylix theming"; + }; + userSettings.stylix.theme = lib.mkOption { + default = if (osConfig.stylix.enable) then osConfig.systemSettings.stylix.theme else "io"; + type = lib.types.enum (builtins.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir ../../themes))); + description = "Theme for stylix to use for the user. A list of themes can be found in the `themes` directory."; + }; + }; + + # for whatever reason, I can't import stylix hmModule if the nixosModule is imported + imports = lib.optionals (!osConfig.stylix.enable) [ inputs.stylix.homeManagerModules.stylix ]; + + config = lib.mkIf cfg.enable { + stylix.enable = true; + home.file.".currenttheme".text = config.userSettings.stylix.theme; + stylix.autoEnable = false; + stylix.polarity = theme.polarity; + stylix.image = pkgs.fetchurl { + url = theme.backgroundUrl; + sha256 = theme.backgroundSha256; + }; + stylix.base16Scheme = theme; + + stylix.fonts = { + # TODO abstract fonts into an option + monospace = { + name = "FiraCode Nerd Font"; + package = pkgs.nerd-fonts.fira-code; + }; + serif = { + name = "FiraCode Nerd Font"; + package = pkgs.nerd-fonts.fira-code; + }; + sansSerif = { + name = "FiraCode Nerd Font"; + package = pkgs.nerd-fonts.fira-code; + }; + emoji = { + name = "Noto Color Emoji"; + package = pkgs.noto-fonts-emoji-blob-bin; + }; + sizes = { + terminal = 18; + applications = 12; + popups = 12; + desktop = 12; + }; + }; + + # move into alacritty config + stylix.targets.alacritty.enable = false; + programs.alacritty.settings = { + colors = { + # TODO revisit these color mappings + # these are just the default provided from stylix + # but declared directly due to alacritty v3.0 breakage + primary.background = "#"+config.lib.stylix.colors.base00; + primary.foreground = "#"+config.lib.stylix.colors.base07; + cursor.text = "#"+config.lib.stylix.colors.base00; + cursor.cursor = "#"+config.lib.stylix.colors.base07; + normal.black = "#"+config.lib.stylix.colors.base00; + normal.red = "#"+config.lib.stylix.colors.base08; + normal.green = "#"+config.lib.stylix.colors.base0B; + normal.yellow = "#"+config.lib.stylix.colors.base0A; + normal.blue = "#"+config.lib.stylix.colors.base0D; + normal.magenta = "#"+config.lib.stylix.colors.base0E; + normal.cyan = "#"+config.lib.stylix.colors.base0B; + normal.white = "#"+config.lib.stylix.colors.base05; + bright.black = "#"+config.lib.stylix.colors.base03; + bright.red = "#"+config.lib.stylix.colors.base09; + bright.green = "#"+config.lib.stylix.colors.base01; + bright.yellow = "#"+config.lib.stylix.colors.base02; + bright.blue = "#"+config.lib.stylix.colors.base04; + bright.magenta = "#"+config.lib.stylix.colors.base06; + bright.cyan = "#"+config.lib.stylix.colors.base0F; + bright.white = "#"+config.lib.stylix.colors.base07; + }; + font.size = config.stylix.fonts.sizes.terminal; + font.normal.family = config.stylix.fonts.monospace.name; + }; + + # move into kitty config + stylix.targets.kitty.enable = true; + + stylix.targets.gtk.enable = true; + + home.file = { + ".config/qt5ct/colors/oomox-current.conf".source = config.lib.stylix.colors { + template = builtins.readFile ./oomox-current.conf.mustache; + extension = ".conf"; + }; + ".config/Trolltech.conf".source = config.lib.stylix.colors { + template = builtins.readFile ./Trolltech.conf.mustache; + extension = ".conf"; + }; + ".config/kdeglobals".source = config.lib.stylix.colors { + template = builtins.readFile ./Trolltech.conf.mustache; + extension = ""; + }; + ".config/qt5ct/qt5ct.conf".text = pkgs.lib.mkBefore (builtins.readFile ./qt5ct.conf); + }; + home.packages = with pkgs; [ + libsForQt5.qt5ct pkgs.libsForQt5.breeze-qt5 libsForQt5.breeze-icons pkgs.noto-fonts-monochrome-emoji + ]; + qt = { + enable = true; + style.package = pkgs.libsForQt5.breeze-qt5; + style.name = "breeze-dark"; + platformTheme = "kde"; + }; + + fonts.fontconfig.defaultFonts = { + monospace = [ config.stylix.fonts.monospace.name ]; + sansSerif = [ config.stylix.fonts.sansSerif.name ]; + serif = [ config.stylix.fonts.serif.name ]; + }; + }; +} diff --git a/user/style/oomox-current.conf.mustache b/modules/user/stylix/oomox-current.conf.mustache similarity index 100% rename from user/style/oomox-current.conf.mustache rename to modules/user/stylix/oomox-current.conf.mustache diff --git a/user/style/qt5ct.conf b/modules/user/stylix/qt5ct.conf similarity index 100% rename from user/style/qt5ct.conf rename to modules/user/stylix/qt5ct.conf diff --git a/modules/user/terminal/alacritty.nix b/modules/user/terminal/alacritty.nix new file mode 100644 index 00000000..4bc00bff --- /dev/null +++ b/modules/user/terminal/alacritty.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.alacritty; +in { + options = { + userSettings.alacritty = { + enable = lib.mkEnableOption "Enable alacritty"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.alacritty ]; + programs.alacritty.enable = true; + programs.alacritty.settings = { + window.opacity = lib.mkForce 0.85; + }; + }; +} diff --git a/modules/user/terminal/default.nix b/modules/user/terminal/default.nix new file mode 100644 index 00000000..426beac7 --- /dev/null +++ b/modules/user/terminal/default.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +{ + options = { + userSettings.terminal = lib.mkOption { + default = "alacritty"; + description = "Default terminal"; + type = lib.types.enum [ "alacritty" "kitty" ]; + }; + }; + + config = { + userSettings.alacritty.enable = lib.mkDefault (config.userSettings.browser == "brave"); + userSettings.kitty.enable = lib.mkDefault (config.userSettings.browser == "librewolf"); + }; +} diff --git a/modules/user/terminal/kitty.nix b/modules/user/terminal/kitty.nix new file mode 100644 index 00000000..93d6a3e2 --- /dev/null +++ b/modules/user/terminal/kitty.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.kitty; +in { + options = { + userSettings.kitty = { + enable = lib.mkEnableOption "Enable kitty"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.kitty ]; + programs.kitty.enable = true; + programs.kitty.settings = { + background_opacity = lib.mkForce "0.85"; + modify_font = "cell_width 90%"; + }; + }; +} diff --git a/modules/user/userInfo/default.nix b/modules/user/userInfo/default.nix new file mode 100644 index 00000000..c36cdb0e --- /dev/null +++ b/modules/user/userInfo/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +{ + options = { + userSettings = { + name = lib.mkOption { + default = ""; + description = "User full name"; + type = lib.types.str; + }; + email = lib.mkOption { + default = ""; + description = "User email"; + type = lib.types.str; + }; + }; + }; +} diff --git a/modules/user/virtualization/virtual-machines/default.nix b/modules/user/virtualization/virtual-machines/default.nix new file mode 100644 index 00000000..df1da32b --- /dev/null +++ b/modules/user/virtualization/virtual-machines/default.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.userSettings.virtualization.virtualMachines; +in { + options = { + userSettings.virtualization.virtualMachines = { + enable = lib.mkEnableOption "Enable helpful VM apps"; + }; + }; + + config = lib.mkIf cfg.enable { + # Various packages related to virtualization, compatability and sandboxing + home.packages = with pkgs; [ + # Virtual Machines and wine + libvirt + virt-manager + qemu + uefi-run + lxc + swtpm + bottles + + # Filesystems + dosfstools + ]; + + home.file.".config/libvirt/qemu.conf".text = '' + nvram = ["/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd"] + ''; + }; +} diff --git a/modules/user/xdg/default.nix b/modules/user/xdg/default.nix new file mode 100644 index 00000000..1d75a343 --- /dev/null +++ b/modules/user/xdg/default.nix @@ -0,0 +1,39 @@ +{config, lib, pkgs, ... }: + +let + cfg = config.userSettings.xdg; +in { + options = { + userSettings.xdg = { + enable = lib.mkEnableOption "Enable xdg user dirs with my xdg directory structure"; + }; + }; + + config = lib.mkIf cfg.enable { + # TODO fix mime associations, most of them are totally broken :( + xdg.enable = true; + xdg.userDirs = { + enable = true; + createDirectories = true; + music = "${config.home.homeDirectory}/Media/Music"; + videos = "${config.home.homeDirectory}/Media/Videos"; + pictures = "${config.home.homeDirectory}/Media/Pictures"; + templates = "${config.home.homeDirectory}/Templates"; + download = "${config.home.homeDirectory}/Downloads"; + documents = "${config.home.homeDirectory}/Documents"; + desktop = null; + publicShare = null; + extraConfig = { + XDG_DOTFILES_DIR = "${config.home.homeDirectory}/.dotfiles"; + XDG_ARCHIVE_DIR = "${config.home.homeDirectory}/Archive"; + XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects"; + XDG_CLOUD_DIR = "${config.home.homeDirectory}/Drive"; + XDG_BOOK_DIR = "${config.home.homeDirectory}/Media/Books"; + XDG_VM_DIR = "${config.home.homeDirectory}/Machines"; + XDG_NOTES_DIR = "${config.home.homeDirectory}/Notes"; + }; + }; + xdg.mime.enable = true; + xdg.mimeApps.enable = true; + }; +} diff --git a/patches/README.org b/patches/README.org index e91c04d2..182f5654 100644 --- a/patches/README.org +++ b/patches/README.org @@ -5,9 +5,10 @@ Since I use =nixpkgs-unstable= (I am an Arch user by heart), there are some case With Nix, I /could/ just rollback everything and wait to update until an upstream patch fixes things, but if it's a quick fix, I'd rather just patch it in immediately so that everything else can stay up to date. +Patches end up in and out of this directory. Ideally, there shouldn't be any patches here! + ** List of Patches Here is a list of patches in this directory, along with a more detailed description of why it's necessary: | Patch | Reason | |------------------------------+----------------------------------------------------------------------------------------------| -| [[./emacs-no-version-check.patch][emacs-no-version-check.patch]] | [[https://github.com/NixOS/nixpkgs/commit/35ccb9db3f4f0872f05d175cf53d0e1f87ff09ea][35ccb9d]] breaks my nix-doom-emacs install by preventing home-manager from building. This patches undoes this commit. | diff --git a/profiles/homelab/README.org b/profiles/homelab/README.org deleted file mode 100644 index 0e0a4ba3..00000000 --- a/profiles/homelab/README.org +++ /dev/null @@ -1,3 +0,0 @@ -#+title: Homelab Template - -This is a template system configuration to be installed as a homelab/server! diff --git a/profiles/homelab/base.nix b/profiles/homelab/base.nix deleted file mode 100644 index 4666e514..00000000 --- a/profiles/homelab/base.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ lib, pkgs, systemSettings, userSettings, ... }: - -{ - imports = - [ ../../system/hardware-configuration.nix - ../../system/hardware/time.nix # Network time sync - ../../system/security/firewall.nix - ../../system/security/doas.nix - ../../system/security/gpg.nix - ( import ../../system/app/docker.nix {storageDriver = null; inherit pkgs userSettings lib;} ) - ]; - - # Fix nix path - nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" - "nixos-config=$HOME/dotfiles/system/configuration.nix" - "/nix/var/nix/profiles/per-user/root/channels" - ]; - - # Ensure nix flakes are enabled - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - - # I'm sorry Stallman-taichou - nixpkgs.config.allowUnfree = true; - - # Kernel modules - boot.kernelModules = [ "i2c-dev" "i2c-piix4" ]; - - # Bootloader - # Use systemd-boot if uefi, default to grub otherwise - boot.loader.systemd-boot.enable = if (systemSettings.bootMode == "uefi") then true else false; - boot.loader.efi.canTouchEfiVariables = if (systemSettings.bootMode == "uefi") then true else false; - boot.loader.efi.efiSysMountPoint = systemSettings.bootMountPath; # does nothing if running bios rather than uefi - boot.loader.grub.enable = if (systemSettings.bootMode == "uefi") then false else true; - boot.loader.grub.device = systemSettings.grubDevice; # does nothing if running uefi rather than bios - - # Networking - networking.hostName = systemSettings.hostname; # Define your hostname. - networking.networkmanager.enable = true; # Use networkmanager - - # Timezone and locale - time.timeZone = systemSettings.timezone; # time zone - i18n.defaultLocale = systemSettings.locale; - i18n.extraLocaleSettings = { - LC_ADDRESS = systemSettings.locale; - LC_IDENTIFICATION = systemSettings.locale; - LC_MEASUREMENT = systemSettings.locale; - LC_MONETARY = systemSettings.locale; - LC_NAME = systemSettings.locale; - LC_NUMERIC = systemSettings.locale; - LC_PAPER = systemSettings.locale; - LC_TELEPHONE = systemSettings.locale; - LC_TIME = systemSettings.locale; - }; - - # User account - users.users.${userSettings.username} = { - isNormalUser = true; - description = userSettings.name; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - uid = 1000; - }; - - # System packages - environment.systemPackages = with pkgs; [ - vim - wget - zsh - git - rclone - rdiff-backup - rsnapshot - cryptsetup - gocryptfs - attic-client - ]; - - programs.fuse.userAllowOther = true; - - services.haveged.enable = true; - - # I use zsh btw - environment.shells = with pkgs; [ zsh ]; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - # It is ok to leave this unchanged for compatibility purposes - system.stateVersion = "22.11"; - -} diff --git a/profiles/homelab/configuration.nix b/profiles/homelab/configuration.nix deleted file mode 100644 index f589ee84..00000000 --- a/profiles/homelab/configuration.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ userSettings, ... }: - -{ - imports = [ ./base.nix - ( import ../../system/security/sshd.nix { - authorizedKeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDaeejVJwUVrIZSo1isbu+gkQ7+8ftCgCsczy3OclkEVWHyRTqlG6yp74hr3j8ZNsOhov7c2Q6RqC8oy669hlxi/y9BsvtlI7sBr94oAKFOmkCS4RiK72ngJjBvI0vbk89wQQjmAd3r8B7ZcedpNOC8CkHu8SebKdYPRIUvAbPc3fTEt7DsJkazAepZCB8LEhUp57FAqQ/Ezlt3X/1uwNq5S0EbE9Zm+nUpEfSqR9apY2neKWLyGiCxpK3dzyNOuulCxvtVz+ie2sTk/6SxM+qWEoVVxhdwyxPihEjgC0EvtG0S5mVh5JmcjRkJOzzBHJuw+6r8yWn/AxGdIsoJ4rKNxH1XH1iLHgCraOLOUjUNlmejTcQPu6o92a79fdz2gCHT/BuIjfCW7MErAC3YSmF45TSur/kiWCBaTqYo06pgbQ3w1vKg7fievQlQzsutmg47RvJp6fb74yxuOdVg39cShQu/l8r6zqm21JAeUaaIp4P/0MrAIMOOVUhbK0QgsNElO4yn0ZKH8wGIF8xORh7ikxUIAyq8C41gjJiO2sAFJc3M8DhduQU3X0lHB7U0Qyu+8ZXn05+zdFPXJ73LKc7DCcLkppRXJsdHLSDEFdWqFnV7o08B4qZkPMT4pmvhwhY0Pf1fwavOqxuTstzw18gUGyQzl0foQi0Qrmdazsp2Qw== emmet@snowfire"]; - inherit userSettings; }) - ]; -} diff --git a/profiles/homelab/home.nix b/profiles/homelab/home.nix deleted file mode 100644 index cb76da8e..00000000 --- a/profiles/homelab/home.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs, userSettings, ... }: - -{ - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/home/"+userSettings.username; - - programs.home-manager.enable = true; - - imports = [ - ../../user/shell/sh.nix # My zsh and bash config - ../../user/app/ranger/ranger.nix # My ranger file manager config - ../../user/app/git/git.nix # My git config - ]; - - home.stateVersion = "22.11"; # Please read the comment before changing. - - home.packages = with pkgs; [ - # Core - zsh - git - ]; - -} diff --git a/profiles/nix-on-droid/README.org b/profiles/nix-on-droid/README.org deleted file mode 100644 index eed6617d..00000000 --- a/profiles/nix-on-droid/README.org +++ /dev/null @@ -1,3 +0,0 @@ -#+title: I need Emacs on the go! - -This is my =Nix on Droid= profile, which is a minimal installation I use on Android. This (obviously) requires [[https://github.com/nix-community/nix-on-droid][nix-on-droid]] to be installed. I essentially just use this for Emacs and some CLI apps. diff --git a/profiles/nix-on-droid/configuration.nix b/profiles/nix-on-droid/configuration.nix deleted file mode 100644 index ad9ed926..00000000 --- a/profiles/nix-on-droid/configuration.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ config, lib, pkgs, pkgs-stable, systemSettings, userSettings, inputs, ... }: - -{ - # Simply install just the packages - environment.packages = with pkgs; [ - # User-facing stuff that you really really want to have - vim # or some other editor, e.g. nano or neovim - - # Some common stuff that people expect to have - procps - killall - diffutils - findutils - utillinux - tzdata - hostname - man - gnugrep - gnupg - gnused - gnutar - bzip2 - gzip - xz - zip - unzip - git - ]; - - # Backup etc files instead of failing to activate generation if a file already exists in /etc - environment.etcBackupExtension = ".bak"; - - # Read the changelog before changing this value - system.stateVersion = "23.11"; - - # Set up nix for flakes - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - - # Set your time zone - #time.timeZone = "Europe/Berlin"; - - # Configure home-manager - home-manager = { - backupFileExtension = "hm-bak"; - useGlobalPkgs = true; - - config = ./home.nix; - - extraSpecialArgs = { - # pass config variables from above - inherit pkgs-stable; - inherit systemSettings; - inherit userSettings; - inherit inputs; - }; - }; -} diff --git a/profiles/nix-on-droid/home.nix b/profiles/nix-on-droid/home.nix deleted file mode 100644 index c2f896c0..00000000 --- a/profiles/nix-on-droid/home.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ config, pkgs, userSettings, ... }: - -{ - programs.home-manager.enable = true; - - imports = [ - ../../user/shell/sh.nix # My zsh and bash config - ../../user/shell/cli-collection.nix # Useful CLI apps - ../../user/app/ranger/ranger.nix # My ranger file manager config - ../../user/app/git/git.nix # My git config - ../../user/style/stylix.nix # Styling and themes for my apps - ]; - - home.stateVersion = "22.11"; # Please read the comment before changing. - - home.packages = with pkgs; [ - # Core - zsh - git - ]; - - xdg.enable = true; - xdg.userDirs = { - enable = true; - createDirectories = true; - music = "${config.home.homeDirectory}/Media/Music"; - videos = "${config.home.homeDirectory}/Media/Videos"; - pictures = "${config.home.homeDirectory}/Media/Pictures"; - templates = "${config.home.homeDirectory}/Templates"; - download = "${config.home.homeDirectory}/Downloads"; - documents = "${config.home.homeDirectory}/Documents"; - desktop = null; - publicShare = null; - extraConfig = { - XDG_DOTFILES_DIR = "${config.home.homeDirectory}/.dotfiles"; - XDG_ARCHIVE_DIR = "${config.home.homeDirectory}/Archive"; - XDG_ORG_DIR = "${config.home.homeDirectory}/Org"; - XDG_BOOK_DIR = "${config.home.homeDirectory}/Media/Books"; - }; - }; - xdg.mime.enable = true; - xdg.mimeApps.enable = true; - - home.sessionVariables = { - EDITOR = userSettings.editor; - }; - - news.display = "silent"; - -} diff --git a/profiles/personal/configuration.nix b/profiles/personal/configuration.nix deleted file mode 100644 index 9aff188b..00000000 --- a/profiles/personal/configuration.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: -{ - imports = - [ ../work/configuration.nix # Personal is essentially work system + games - ../../system/hardware-configuration.nix - ../../system/app/gamemode.nix - ../../system/app/prismlauncher.nix - ]; -} diff --git a/profiles/personal/home.nix b/profiles/personal/home.nix deleted file mode 100644 index cacd0db7..00000000 --- a/profiles/personal/home.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, pkgs, userSettings, ... }: - -{ - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/home/"+userSettings.username; - - programs.home-manager.enable = true; - - imports = [ ../work/home.nix # Personal is essentially work system + games - ]; - - home.stateVersion = "22.11"; # Please read the comment before changing. - - home.packages = with pkgs; [ - # Core - zsh - alacritty - brave - git - syncthing - ]; - - xdg.enable = true; - -} diff --git a/profiles/work/README.org b/profiles/work/README.org deleted file mode 100644 index 3f6d8af1..00000000 --- a/profiles/work/README.org +++ /dev/null @@ -1,3 +0,0 @@ -#+title: No time for games! - -This is my =Work= profile, including all the things I need to be efficient for the various hats I wear, and /not/ including distracting things such as games and social apps! diff --git a/profiles/work/configuration.nix b/profiles/work/configuration.nix deleted file mode 100644 index 383eda13..00000000 --- a/profiles/work/configuration.nix +++ /dev/null @@ -1,166 +0,0 @@ -{ pkgs, lib, systemSettings, userSettings, ... }: -{ - imports = - [ ../../system/hardware-configuration.nix - ../../system/hardware/systemd.nix # systemd config - ../../system/hardware/kernel.nix # Kernel config - ../../system/hardware/power.nix # Power management - ../../system/hardware/time.nix # Network time sync - ../../system/hardware/opengl.nix - ../../system/hardware/printing.nix - ../../system/hardware/bluetooth.nix - (./. + "../../../system/wm"+("/"+userSettings.wm)+".nix") # My window manager - #../../system/app/flatpak.nix - ../../system/app/virtualization.nix - ( import ../../system/app/docker.nix {storageDriver = null; inherit pkgs userSettings lib;} ) - ../../system/security/doas.nix - ../../system/security/gpg.nix - ../../system/security/blocklist.nix - ../../system/security/firewall.nix - ../../system/security/firejail.nix - ../../system/security/openvpn.nix - ../../system/security/automount.nix - ../../system/style/stylix.nix - ]; - - # Fix nix path - nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" - "nixos-config=$HOME/dotfiles/system/configuration.nix" - "/nix/var/nix/profiles/per-user/root/channels" - ]; - - # Ensure nix flakes are enabled - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - - # Substituters - nix.settings = { - substituters = [ - "https://cache.nixos.org" - "https://hyprland.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - - # wheel group gets trusted access to nix daemon - nix.settings.trusted-users = [ "@wheel" ]; - - # I'm sorry Stallman-taichou - nixpkgs.config.allowUnfree = true; - - # Kernel modules - boot.kernelModules = [ "i2c-dev" "i2c-piix4" "cpufreq_powersave" ]; - - # Bootloader - # Use systemd-boot if uefi, default to grub otherwise - boot.loader.systemd-boot.enable = if (systemSettings.bootMode == "uefi") then true else false; - boot.loader.systemd-boot.editor = false; - boot.loader.efi.canTouchEfiVariables = if (systemSettings.bootMode == "uefi") then true else false; - boot.loader.efi.efiSysMountPoint = systemSettings.bootMountPath; # does nothing if running bios rather than uefi - boot.loader.grub.enable = if (systemSettings.bootMode == "uefi") then false else true; - boot.loader.grub.device = systemSettings.grubDevice; # does nothing if running uefi rather than bios - - # Silent Boot - # https://wiki.archlinux.org/title/Silent_boot - boot.kernelParams = [ - "quiet" - "splash" - "vga=current" - "rd.systemd.show_status=false" - "rd.udev.log_level=3" - "udev.log_priority=3" - ]; - boot.consoleLogLevel = 0; - boot.initrd.systemd.enable = true; - # https://github.com/NixOS/nixpkgs/pull/108294 - boot.initrd.verbose = false; - - boot.plymouth.enable = true; - #boot.plymouth.themePackages = with pkgs; [ nixos-bgrt-plymouth ]; - #boot.plymouth.theme = "NixOS BGRT"; - - # Networking - networking.hostName = systemSettings.hostname; # Define your hostname. - networking.networkmanager.enable = true; # Use networkmanager - - # Timezone and locale - time.timeZone = systemSettings.timezone; # time zone - i18n.defaultLocale = systemSettings.locale; - i18n.extraLocaleSettings = { - LC_ADDRESS = systemSettings.locale; - LC_IDENTIFICATION = systemSettings.locale; - LC_MEASUREMENT = systemSettings.locale; - LC_MONETARY = systemSettings.locale; - LC_NAME = systemSettings.locale; - LC_NUMERIC = systemSettings.locale; - LC_PAPER = systemSettings.locale; - LC_TELEPHONE = systemSettings.locale; - LC_TIME = systemSettings.locale; - }; - - # User account - users.users.${userSettings.username} = { - isNormalUser = true; - description = userSettings.name; - extraGroups = [ "networkmanager" "wheel" "input" "dialout" "video" "render" ]; - packages = []; - uid = 1000; - }; - - # System packages - environment.systemPackages = with pkgs; [ - vim - wget - zsh - git - cryptsetup - home-manager - wpa_supplicant - attic-client - (pkgs.writeScriptBin "comma" '' - if [ "$#" = 0 ]; then - echo "usage: comma PKGNAME... [EXECUTABLE]"; - elif [ "$#" = 1 ]; then - nix-shell -p $1 --run $1; - elif [ "$#" = 2 ]; then - nix-shell -p $1 --run $2; - else - echo "error: too many arguments"; - echo "usage: comma PKGNAME... [EXECUTABLE]"; - fi - '') - (pkgs.writeScriptBin "comma-shell" '' - if [ "$#" = 0 ]; then - echo "usage: comma-shell PKGNAME1 [PKGNAME2 PKGNAME3...]"; - else - nix-shell -p $@ - fi - '') - - ]; - - # I use zsh btw - environment.shells = with pkgs; [ zsh ]; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - fonts.fontDir.enable = true; - - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal - pkgs.xdg-desktop-portal-gtk - ]; - }; - - # It is ok to leave this unchanged for compatibility purposes - system.stateVersion = "22.11"; - -} diff --git a/profiles/work/home.nix b/profiles/work/home.nix deleted file mode 100644 index 55dc5537..00000000 --- a/profiles/work/home.nix +++ /dev/null @@ -1,276 +0,0 @@ -{ config, pkgs, pkgs-stable, userSettings, ... }: - -{ - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/home/"+userSettings.username; - - programs.home-manager.enable = true; - - imports = [ - (./. + "../../../user/wm"+("/"+userSettings.wm+"/"+userSettings.wm)+".nix") # My window manager selected from flake - ../../user/shell/sh.nix # My zsh and bash config - ../../user/shell/cli-collection.nix # Useful CLI apps - ../../user/app/emacs # Emacs config that I'm currently rebuilding - ../../user/app/ranger/ranger.nix # My ranger file manager config - ../../user/app/git/git.nix # My git config - ../../user/app/blender # My blender config - ../../user/app/keepass/keepass.nix # My password manager - (./. + "../../../user/app/browser"+("/"+userSettings.browser)+".nix") # My default browser selected from flake - ../../user/app/virtualization/virtualization.nix # Virtual machines - #../../user/app/flatpak/flatpak.nix # Flatpaks - ../../user/style/stylix.nix # Styling and themes for my apps - ../../user/hardware/bluetooth.nix # Bluetooth - ]; - - # TODO make nix path follow flakes - - nix.package = pkgs.nix; - nix.settings = { - substituters = [ - "https://cache.nixos.org" - "https://hyprland.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - - home.stateVersion = "22.11"; # Please read the comment before changing. - - home.packages = (with pkgs; [ - # Core - zsh - alacritty - brave - qutebrowser - git - syncthing - - # Office - nextcloud-client - (pkgs-stable.libreoffice-fresh) - geary - mate.atril - openboard - xournalpp - adwaita-icon-theme - shared-mime-info - glib - newsflash - foliate - nautilus - gnome-calendar - seahorse - gnome-maps - openvpn - protonmail-bridge - texliveSmall - numbat - element-desktop - - openai-whisper-cpp - - wine64 - bottles - # The following requires 64-bit FL Studio (FL64) to be installed to a bottle - # With a bottle name of "FL Studio" - (pkgs.writeShellScriptBin "flstudio" '' - #!/bin/sh - if [ -z "$1" ] - then - bottles-cli run -b "FL Studio" -p FL64 - #flatpak run --command=bottles-cli com.usebottles.bottles run -b FL\ Studio -p FL64 - else - filepath=$(winepath --windows "$1") - echo \'"$filepath"\' - bottles-cli run -b "FL Studio" -p "FL64" --args \'"$filepath"\' - #flatpak run --command=bottles-cli com.usebottles.bottles run -b FL\ Studio -p FL64 -args "$filepath" - fi - '') - (pkgs.makeDesktopItem { - name = "flstudio"; - desktopName = "FL Studio 64"; - exec = "flstudio %U"; - terminal = false; - type = "Application"; - icon = "flstudio"; - mimeTypes = ["application/octet-stream"]; - }) - (stdenv.mkDerivation { - name = "flstudio-icon"; - # icon from https://www.reddit.com/r/MacOS/comments/jtmp7z/i_made_icons_for_discord_spotify_and_fl_studio_in/ - src = [ ../../user/pkgs/flstudio.png ]; - - unpackPhase = '' - for srcFile in $src; do - # Copy file into build dir - cp $srcFile ./ - done - ''; - - installPhase = '' - mkdir -p $out $out/share $out/share/pixmaps - ls $src - ls - cp $src $out/share/pixmaps/flstudio.png - ''; - }) - - # Media - gimp - krita - pinta - inkscape - godot_4 - vlc - mpv - ncmpcpp - mpc - yt-dlp_git - blender-hip - freecad - libresprite - (pkgs.appimageTools.wrapType2 { - name = "Cura"; - pname = "Cura"; - version = "5.9.0"; - src = fetchurl { - url = "https://github.com/Ultimaker/Cura/releases/download/5.9.0/UltiMaker-Cura-5.9.0-linux-X64.AppImage"; - hash = "sha256-STtVeM4Zs+PVSRO3cI0LxnjRDhOxSlttZF+2RIXnAp4="; - }; - extraPkgs = pkgs: with pkgs; []; - }) - (pkgs.makeDesktopItem { - name = "Cura"; - desktopName = "Cura"; - exec = "env QT_QPA_PLATFORM=xcb Cura %i"; - terminal = false; - type = "Application"; - }) - (pkgs-stable.curaengine_stable) - openscad - (stdenv.mkDerivation { - name = "cura-slicer"; - version = "0.0.7"; - src = fetchFromGitHub { - owner = "Spiritdude"; - repo = "Cura-CLI-Wrapper"; - rev = "ff076db33cfefb770e1824461a6336288f9459c7"; - sha256 = "sha256-BkvdlqUqoTYEJpCCT3Utq+ZBU7g45JZFJjGhFEXPXi4="; - }; - phases = "installPhase"; - installPhase = '' - mkdir -p $out $out/bin $out/share $out/share/cura-slicer - cp $src/cura-slicer $out/bin - cp $src/settings/fdmprinter.def.json $out/share/cura-slicer - cp $src/settings/base.ini $out/share/cura-slicer - sed -i 's+#!/usr/bin/perl+#! /usr/bin/env nix-shell\n#! nix-shell -i perl -p perl538 perl538Packages.JSON+g' $out/bin/cura-slicer - sed -i 's+/usr/share+/home/${userSettings.username}/.nix-profile/share+g' $out/bin/cura-slicer - ''; - propagatedBuildInputs = with pkgs-stable; [ - curaengine_stable - ]; - }) - obs-studio - ffmpeg - (pkgs.writeScriptBin "kdenlive-accel" '' - #!/bin/sh - DRI_PRIME=0 kdenlive "$1" - '') - movit - mediainfo - libmediainfo - audio-recorder - cheese - #ardour - #rosegarden - tenacity - - # Various dev packages - remmina - sshfs - texinfo - libffi zlib - nodePackages.ungit - ventoy - kdenlive - ]); - - services.syncthing.enable = true; - services.nextcloud-client = { - enable = true; - startInBackground = true; - }; - - services.mpd = rec { - enable = true; - musicDirectory = config.xdg.userDirs.music+"/Songs"; - playlistDirectory = config.xdg.userDirs.music+"/Playlists"; - dbFile = musicDirectory+"/mpd.db"; - extraConfig = '' - audio_output { - type "pipewire" - name "PipeWire Sound Server" - } - ''; - }; - - programs.ncmpcpp.bindings = [ - { key = "j"; command = "scroll_down"; } - { key = "k"; command = "scroll_up"; } - { key = "J"; command = [ "select_item" "scroll_down" ]; } - { key = "K"; command = [ "select_item" "scroll_up" ]; } - ]; - - xdg.enable = true; - xdg.userDirs = { - enable = true; - createDirectories = true; - music = "${config.home.homeDirectory}/Media/Music"; - videos = "${config.home.homeDirectory}/Media/Videos"; - pictures = "${config.home.homeDirectory}/Media/Pictures"; - templates = "${config.home.homeDirectory}/Templates"; - download = "${config.home.homeDirectory}/Downloads"; - documents = "${config.home.homeDirectory}/Documents"; - desktop = null; - publicShare = null; - extraConfig = { - XDG_DOTFILES_DIR = "${config.home.homeDirectory}/.dotfiles"; - XDG_ARCHIVE_DIR = "${config.home.homeDirectory}/Archive"; - XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects"; - XDG_CLOUD_DIR = "${config.home.homeDirectory}/Drive"; - XDG_BOOK_DIR = "${config.home.homeDirectory}/Media/Books"; - XDG_VM_DIR = "${config.home.homeDirectory}/Machines"; - XDG_NOTES_DIR = "${config.home.homeDirectory}/Notes"; - }; - }; - xdg.mime.enable = true; - xdg.mimeApps.enable = true; - xdg.mimeApps.associations.added = { - # TODO fix mime associations, most of them are totally broken :( - "application/octet-stream" = "flstudio.desktop;"; - }; - - home.sessionVariables = { - EDITOR = userSettings.editor; - SPAWNEDITOR = userSettings.spawnEditor; - TERM = userSettings.term; - BROWSER = userSettings.browser; - }; - - news.display = "silent"; - - gtk.iconTheme = { - package = pkgs.papirus-icon-theme; - name = if (config.stylix.polarity == "dark") then "Papirus-Dark" else "Papirus-Light"; - }; - - services.pasystray.enable = true; - services.pasystray.extraOptions = [ "--no-notify" ]; - -} diff --git a/profiles/worklab/README.org b/profiles/worklab/README.org deleted file mode 100644 index b1c5ff7c..00000000 --- a/profiles/worklab/README.org +++ /dev/null @@ -1,3 +0,0 @@ -#+title: Worklab Template - -This is literally just my homelab configuration, but setup to work with the ssh keys on my work computer. Used for small servers at work. diff --git a/profiles/worklab/configuration.nix b/profiles/worklab/configuration.nix deleted file mode 100644 index 91b51795..00000000 --- a/profiles/worklab/configuration.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ userSettings, ... }: - -{ - imports = [ ../homelab/base.nix - ( import ../../system/security/sshd.nix { - authorizedKeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDBW6X3nd54sLK5UOvkyxBZ0dC57+xXKsAkr6XyP3k64gsFNahIYZGyZ+E9DdGIP1SZPDkwlcnGfFTPo/dPq5QjxtBmAOd/q4hIb5mqojNfOwqZQVwHjzLYSiGBaMVe4XAGCoNxTwXTimVU8wtyvlmBJzuOLmxZq9tRBpN3g+PT5HT1S9mrrQ4l5Y+2CNTwfga6/+/H1g4hpYG6H9qdIWOrel1hWvGUH3A1d/5mJIx3GkOAl7WBReQNbwlTm/8mkIcNBMtp3JQg5yuTQ6dLGwMOspMB5sGSCnaDx6CrelQglRihxkunW9ktA2MYaIn3l5fNwaHilW63d0sb9Y/Rr/bFKybmGYVY4PR9+tQg4D4YqofkSfRKmB98dtxUZg4yduXjxCYrhDTDseCjXACncItdD9TmxabaBQtWiWIGmX3bhx31SoctwdpS+mzbB5WVIVb/Fo/cOvPj6ugB5ZQf2uH+U5nsGVYsSsNGS1zVDybeILr1z2ne2AcaqwB5Z7iz/E0=" ]; - inherit userSettings; }) - ]; -} diff --git a/profiles/worklab/home.nix b/profiles/worklab/home.nix deleted file mode 100644 index 96bcc748..00000000 --- a/profiles/worklab/home.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - imports = [ ../homelab/home.nix ]; -} diff --git a/profiles/wsl/README.org b/profiles/wsl/README.org deleted file mode 100644 index cce6367a..00000000 --- a/profiles/wsl/README.org +++ /dev/null @@ -1,7 +0,0 @@ -#+title: Trying to use a computer without Linux is hard - -WARNING: I haven't used Windows for a very long time, so this profile is unmaintained. - -This is my =WSL= profile, which is a minimal installation I use on Windows underneath WSL. This (obviously) requires [[https://github.com/nix-community/NixOS-WSL][NixOS-WSL]] to be installed. I essentially just use this for Emacs, some useful CLI apps I can't live without (namely ranger), and LibreOffice, which runs strangely slow on Windows (hmm, I wonder why? It's not like Microsoft has a competing office suite or anything...) - -The [[./nixos-wsl][nixos-wsl]] directory is taken directly from [[https://github.com/nix-community/NixOS-WSL][NixOS-WSL]] and merely patched slightly to allow it to run with the unstable channel of nixpkgs. diff --git a/profiles/wsl/configuration.nix b/profiles/wsl/configuration.nix deleted file mode 100644 index f09bfead..00000000 --- a/profiles/wsl/configuration.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ lib, pkgs, systemSettings, userSettings, ... }: - -with lib; -let - nixos-wsl = import ./nixos-wsl; -in -{ - imports = - [ nixos-wsl.nixosModules.wsl - ../../system/hardware/kernel.nix # Kernel config - ../../system/hardware/systemd.nix # systemd config - ../../system/hardware/time.nix # Network time sync - ../../system/hardware/opengl.nix - ../../system/hardware/printing.nix - ../../system/hardware/bluetooth.nix - ../../system/security/doas.nix - ../../system/security/gpg.nix - ../../system/security/blocklist.nix - ../../system/security/firewall.nix - ../../system/security/firejail.nix - ../../system/style/stylix.nix - ]; - - wsl = { - enable = true; - automountPath = "/mnt"; - defaultUser = userSettings.username; - startMenuLaunchers = true; - - # Enable native Docker support - # docker-native.enable = true; - - # Enable integration with Docker Desktop (needs to be installed) - # docker-desktop.enable = true; - - }; - - # Fix nix path - nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" - "nixos-config=$HOME/dotfiles/system/configuration.nix" - "/nix/var/nix/profiles/per-user/root/channels" - ]; - - # Experimental features - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - # Ensure nix flakes are enabled - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - - # I'm sorry Stallman-taichou - nixpkgs.config.allowUnfree = true; - - # Kernel modules - boot.kernelModules = [ "i2c-dev" "i2c-piix4" "cpufreq_powersave" ]; - - # Networking - networking.hostName = systemSettings.hostname; # Define your hostname. - - # Timezone and locale - time.timeZone = systemSettings.timezone; # time zone - i18n.defaultLocale = systemSettings.locale; - i18n.extraLocaleSettings = { - LC_ADDRESS = systemSettings.locale; - LC_IDENTIFICATION = systemSettings.locale; - LC_MEASUREMENT = systemSettings.locale; - LC_MONETARY = systemSettings.locale; - LC_NAME = systemSettings.locale; - LC_NUMERIC = systemSettings.locale; - LC_PAPER = systemSettings.locale; - LC_TELEPHONE = systemSettings.locale; - LC_TIME = systemSettings.locale; - }; - - # User account - users.users.${userSettings.username} = { - isNormalUser = true; - description = userSettings.name; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - uid = 1000; - }; - - # System packages - environment.systemPackages = with pkgs; [ - vim - wget - zsh - git - home-manager - ]; - - # I use zsh btw - environment.shells = with pkgs; [ zsh ]; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal - pkgs.xdg-desktop-portal-gtk - ]; - }; - - # It is ok to leave this unchanged for compatibility purposes - system.stateVersion = "22.05"; - -} diff --git a/profiles/wsl/home.nix b/profiles/wsl/home.nix deleted file mode 100644 index 164b89fa..00000000 --- a/profiles/wsl/home.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ config, pkgs, userSettings, ... }: - -{ - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/home/"+userSettings.username; - - programs.home-manager.enable = true; - - imports = [ - ../../user/shell/sh.nix # My zsh and bash config - ../../user/shell/cli-collection.nix # Useful CLI apps - ../../user/app/doom-emacs/doom.nix # My doom emacs config - ../../user/app/ranger/ranger.nix # My ranger file manager config - ../../user/app/git/git.nix # My git config - ../../user/style/stylix.nix # Styling and themes for my apps - ]; - - home.stateVersion = "22.11"; # Please read the comment before changing. - - home.packages = with pkgs; [ - # Core - zsh - git - syncthing - - # Office - libreoffice-fresh - - # Various dev packages - texinfo - libffi zlib - nodePackages.ungit - ]; - - services.syncthing.enable = true; - - xdg.enable = true; - xdg.userDirs = { - enable = true; - createDirectories = true; - music = "${config.home.homeDirectory}/Media/Music"; - videos = "${config.home.homeDirectory}/Media/Videos"; - pictures = "${config.home.homeDirectory}/Media/Pictures"; - templates = "${config.home.homeDirectory}/Templates"; - download = "${config.home.homeDirectory}/Downloads"; - documents = "${config.home.homeDirectory}/Documents"; - desktop = null; - publicShare = null; - extraConfig = { - XDG_DOTFILES_DIR = "${config.home.homeDirectory}/.dotfiles"; - XDG_ARCHIVE_DIR = "${config.home.homeDirectory}/Archive"; - XDG_ORG_DIR = "${config.home.homeDirectory}/Org"; - XDG_BOOK_DIR = "${config.home.homeDirectory}/Media/Books"; - }; - }; - xdg.mime.enable = true; - xdg.mimeApps.enable = true; - - home.sessionVariables = { - EDITOR = userSettings.editor; - }; - - news.display = "silent"; - -} diff --git a/profiles/wsl/nixos-wsl/LICENSE b/profiles/wsl/nixos-wsl/LICENSE deleted file mode 100755 index ef51da2b..00000000 --- a/profiles/wsl/nixos-wsl/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/profiles/wsl/nixos-wsl/README.md b/profiles/wsl/nixos-wsl/README.md deleted file mode 100755 index b3a4ff94..00000000 --- a/profiles/wsl/nixos-wsl/README.md +++ /dev/null @@ -1,112 +0,0 @@ -

- NixOS on WSL
-
Matrix Chat - nixpkgs 22.05 - Downloads -

- -A minimal root filesystem for running NixOS on WSL. It can be used with -[DistroLauncher](https://github.com/microsoft/WSL-DistroLauncher) as -`install.tar.gz` or as input to `wsl --import --version 2`. - -## Quick start - -First, [download the latest release\'s installer](https://github.com/nix-community/NixOS-WSL/releases/latest). - -Then open up a Terminal, PowerShell or Command Prompt and run: - -```sh -wsl --import NixOS .\NixOS\ nixos-wsl-installer.tar.gz --version 2 -``` - -This sets up a new WSL distribution `NixOS` that is installed under -`.\NixOS`. `nixos-wsl-installer.tar.gz` is the path to the file you -downloaded earlier. You might need to change this path or change to the download directory first. - -You can now run NixOS: - -```sh -wsl -d NixOS -``` - -The installer will unpack the file system and subsequently start NixOS. -A few warnings about file systems and locales will pop up. You can -safely ignore them. After systemd has started, you should be greeted -with a bash prompt inside your fresh NixOS installation. - -If you want to make NixOS your default distribution, you can do so with - -```sh -wsl -s NixOS -``` - -## Building your own system tarball - -This requires access to a system that already has Nix installed. Please refer to the [Nix installation guide](https://nixos.org/guides/install-nix.html) if that\'s not the case. - -If you have a flakes-enabled Nix, you can use the following command to -build your own tarball instead of relying on a prebuilt one: - -```cmd -nix build github:nix-community/NixOS-WSL#nixosConfigurations.mysystem.config.system.build.installer -``` - -Or, if you want to build with local changes, run inside your checkout: - -```cmd -nix build .#nixosConfigurations.mysystem.config.system.build.installer -``` - -Without a flakes-enabled Nix, you can build a tarball using: - -```cmd -nix-build -A nixosConfigurations.mysystem.config.system.build.installer -``` - -The resulting installer tarball can then be found under -`./result/tarball/nixos-wsl-installer.tar.gz`. - -You can also build a rootfs tarball without wrapping it in the installer -by replacing `installer` with `tarball` in the above commands. The -rootfs tarball can then be found under -`./result/tarball/nixos-wsl-x86_64-linux.tar.gz`. - -## Design - -Getting NixOS to run under WSL requires some workarounds: - -### systemd support - -WSL comes with its own (non-substitutable) init system while NixOS uses -systemd. Simply starting systemd later on does not work out of the box, -because systemd as system instance refuses to start if it is not PID 1. -This unfortunate combination is resolved in two ways: - -- the user\'s default shell is replaced by a wrapper script that acts - is init system and then drops to the actual shell -- systemd is started in its own PID namespace; therefore, it is PID 1. - The shell wrapper (see above) enters the systemd namespace before - dropping to the shell. - -### Installer - -Usually WSL distributions ship as a tarball of their root file system. -These tarballs however, can not contain any hard-links due to the way -they are unpacked by WSL, resulting in an \"Unspecified Error\". By -default some Nix-derivations will contain hard-links when they are -built. This results in system tarballs that can not be imported into -WSL. To circumvent this problem, the rootfs tarball is wrapped in that -of a minimal distribution (the installer), that is packaged without any -hard-links. When the installer system is started for the first time, it -overwrites itself with the contents of the rootfs tarball. - -## License - -Apache License, Version 2.0. See `LICENSE` or for details. - -## Further links - -- [DistroLauncher](https://github.com/microsoft/WSL-DistroLauncher) -- [A quick way into a systemd \"bottle\" for WSL](https://github.com/arkane-systems/genie) -- [NixOS in Windows Store for Windows Subsystem for Linux](https://github.com/NixOS/nixpkgs/issues/30391) -- [wsl2-hacks](https://github.com/shayne/wsl2-hacks) diff --git a/profiles/wsl/nixos-wsl/default.nix b/profiles/wsl/nixos-wsl/default.nix deleted file mode 100755 index 873ece49..00000000 --- a/profiles/wsl/nixos-wsl/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -(import - ( - let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); - in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { - src = ./.; - }).defaultNix diff --git a/profiles/wsl/nixos-wsl/flake.lock b/profiles/wsl/nixos-wsl/flake.lock deleted file mode 100755 index ba649f60..00000000 --- a/profiles/wsl/nixos-wsl/flake.lock +++ /dev/null @@ -1,59 +0,0 @@ -{ - "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1660318005, - "narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5c211b47aeadcc178c5320afd4e74c7eed5c389f", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-22.05", - "type": "indirect" - } - }, - "root": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/profiles/wsl/nixos-wsl/flake.nix b/profiles/wsl/nixos-wsl/flake.nix deleted file mode 100755 index 8a62b472..00000000 --- a/profiles/wsl/nixos-wsl/flake.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - description = "NixOS WSL"; - - inputs = { - nixpkgs.url = "nixpkgs/nixos-22.05"; - flake-utils.url = "github:numtide/flake-utils"; - - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; - }; - - outputs = { self, nixpkgs, flake-utils, ... }: - { - - nixosModules.wsl = { - imports = [ - ./modules/build-tarball.nix - ./modules/docker-desktop.nix - ./modules/docker-native.nix - ./modules/installer.nix - ./modules/interop.nix - ./modules/wsl-distro.nix - ]; - }; - - nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - ]; - }; - - } // - flake-utils.lib.eachSystem - (with flake-utils.lib.system; [ "x86_64-linux" "aarch64-linux" ]) - (system: - let - pkgs = import nixpkgs { inherit system; }; - in - { - checks.check-format = pkgs.runCommand "check-format" - { - buildInputs = with pkgs; [ nixpkgs-fmt ]; - } '' - nixpkgs-fmt --check ${./.} - mkdir $out # success - ''; - - devShell = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ nixpkgs-fmt ]; - }; - } - ); -} diff --git a/profiles/wsl/nixos-wsl/modules/build-tarball.nix b/profiles/wsl/nixos-wsl/modules/build-tarball.nix deleted file mode 100755 index feba78d4..00000000 --- a/profiles/wsl/nixos-wsl/modules/build-tarball.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ config, pkgs, lib, ... }: -with builtins; with lib; -let - pkgs2storeContents = l: map (x: { object = x; symlink = "none"; }) l; - - nixpkgs = lib.cleanSource pkgs.path; - - channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" - { preferLocalBuild = true; } - '' - mkdir -p $out - cp -prd ${nixpkgs.outPath} $out/nixos - chmod -R u+w $out/nixos - if [ ! -e $out/nixos/nixpkgs ]; then - ln -s . $out/nixos/nixpkgs - fi - echo -n ${toString config.system.nixos.revision} > $out/nixos/.git-revision - echo -n ${toString config.system.nixos.versionSuffix} > $out/nixos/.version-suffix - echo ${toString config.system.nixos.versionSuffix} | sed -e s/pre// > $out/nixos/svn-revision - ''; - - preparer = pkgs.writeShellScriptBin "wsl-prepare" '' - set -e - - mkdir -m 0755 ./bin ./etc - mkdir -m 1777 ./tmp - - # WSL requires a /bin/sh - only temporary, NixOS's activate will overwrite - ln -s ${config.users.users.root.shell} ./bin/sh - - # WSL also requires a /bin/mount, otherwise the host fs isn't accessible - ln -s /nix/var/nix/profiles/system/sw/bin/mount ./bin/mount - - # Set system profile - system=${config.system.build.toplevel} - ./$system/sw/bin/nix-store --store `pwd` --load-db < ./nix-path-registration - rm ./nix-path-registration - ./$system/sw/bin/nix-env --store `pwd` -p ./nix/var/nix/profiles/system --set $system - - # Set channel - mkdir -p ./nix/var/nix/profiles/per-user/root - ./$system/sw/bin/nix-env --store `pwd` -p ./nix/var/nix/profiles/per-user/root/channels --set ${channelSources} - mkdir -m 0700 -p ./root/.nix-defexpr - ln -s /nix/var/nix/profiles/per-user/root/channels ./root/.nix-defexpr/channels - - # It's now a NixOS! - touch ./etc/NIXOS - - # Write wsl.conf so that it is present when NixOS is started for the first time - cp ${config.environment.etc."wsl.conf".source} ./etc/wsl.conf - - ${lib.optionalString config.wsl.tarball.includeConfig '' - # Copy the system configuration - mkdir -p ./etc/nixos/nixos-wsl - cp -R ${lib.cleanSource ../.}/. ./etc/nixos/nixos-wsl - mv ./etc/nixos/nixos-wsl/configuration.nix ./etc/nixos/configuration.nix - # Patch the import path to avoid having a flake.nix in /etc/nixos - sed -i 's|import \./default\.nix|import \./nixos-wsl|' ./etc/nixos/configuration.nix - ''} - ''; - -in -{ - - options.wsl.tarball = { - includeConfig = mkOption { - type = types.bool; - default = true; - description = "Whether or not to copy the system configuration into the tarball"; - }; - }; - - - config = mkIf config.wsl.enable { - # These options make no sense without the wsl-distro module anyway - - system.build.tarball = pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" { - # No contents, structure will be added by prepare script - contents = [ ]; - - fileName = "nixos-wsl-${pkgs.hostPlatform.system}"; - - storeContents = pkgs2storeContents [ - config.system.build.toplevel - channelSources - preparer - ]; - - extraCommands = "${preparer}/bin/wsl-prepare"; - - # Use gzip - compressCommand = "gzip"; - compressionExtension = ".gz"; - }; - - }; -} diff --git a/profiles/wsl/nixos-wsl/modules/docker-desktop.nix b/profiles/wsl/nixos-wsl/modules/docker-desktop.nix deleted file mode 100755 index ade86e9d..00000000 --- a/profiles/wsl/nixos-wsl/modules/docker-desktop.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, lib, pkgs, ... }: -with builtins; with lib; { - - imports = [ - (mkRenamedOptionModule [ "wsl" "docker" ] [ "wsl" "docker-desktop" ]) - ]; - - options.wsl.docker-desktop = with types; { - enable = mkEnableOption "Docker Desktop integration"; - }; - - config = - let - cfg = config.wsl.docker-desktop; - in - mkIf (config.wsl.enable && cfg.enable) { - - environment.systemPackages = with pkgs; [ - docker - docker-compose - ]; - - systemd.services.docker-desktop-proxy = { - description = "Docker Desktop proxy"; - script = '' - ${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop - ''; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = "30s"; - }; - }; - - users.groups.docker.members = [ - config.wsl.defaultUser - ]; - - }; - -} diff --git a/profiles/wsl/nixos-wsl/modules/docker-native.nix b/profiles/wsl/nixos-wsl/modules/docker-native.nix deleted file mode 100755 index 35d10ef4..00000000 --- a/profiles/wsl/nixos-wsl/modules/docker-native.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, lib, pkgs, ... }: -with builtins; with lib; { - - options.wsl.docker-native = with types; { - enable = mkEnableOption "Native Docker integration in NixOS."; - - addToDockerGroup = mkOption { - type = bool; - default = config.security.sudo.wheelNeedsPassword; - description = '' - Wether to add the default user to the docker group. - - This is not recommended, if you have a password, because it essentially permits unauthenticated root access. - ''; - }; - }; - - config = - let - cfg = config.wsl.docker-native; - in - mkIf (config.wsl.enable && cfg.enable) { - nixpkgs.overlays = [ - (self: super: { - docker = super.docker.override { iptables = pkgs.iptables-legacy; }; - }) - ]; - - environment.systemPackages = with pkgs; [ - docker - docker-compose - ]; - - virtualisation.docker.enable = true; - - users.groups.docker.members = lib.mkIf cfg.addToDockerGroup [ - config.wsl.defaultUser - ]; - }; -} diff --git a/profiles/wsl/nixos-wsl/modules/installer.nix b/profiles/wsl/nixos-wsl/modules/installer.nix deleted file mode 100755 index 45d191ac..00000000 --- a/profiles/wsl/nixos-wsl/modules/installer.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ config, lib, pkgs, ... }: -with builtins; with lib; { - - config = mkIf config.wsl.enable ( - let - mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix"; - - pkgs2storeContents = map (x: { object = x; symlink = "none"; }); - - rootfs = let tarball = config.system.build.tarball; in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}"; - - installer = pkgs.writeScript "installer.sh" '' - #!${pkgs.busybox}/bin/sh - BASEPATH=$PATH - export PATH=$BASEPATH:${pkgs.busybox}/bin # Add busybox to path - - set -e - cd / - - echo "Unpacking root file system..." - ${pkgs.pv}/bin/pv ${rootfs} | tar xz - - echo "Activating nix configuration..." - /nix/var/nix/profiles/system/activate - PATH=$BASEPATH:/run/current-system/sw/bin # Use packages from target system - - echo "Cleaning up installer files..." - nix-collect-garbage - rm /nix-path-registration - - echo "Optimizing store..." - nix-store --optimize - - # Don't package the shell here, it's contained in the rootfs - exec ${builtins.unsafeDiscardStringContext config.users.users.root.shell} "$@" - ''; - - # Set installer.sh as the root shell - passwd = pkgs.writeText "passwd" '' - root:x:0:0:System administrator:/root:${installer} - ''; - in - { - - system.build.installer = mkTarball { - fileName = "nixos-wsl-installer"; - compressCommand = "gzip"; - compressionExtension = ".gz"; - extraArgs = "--hard-dereference"; - - storeContents = with pkgs; pkgs2storeContents [ - installer - ]; - - contents = [ - { source = config.environment.etc."wsl.conf".source; target = "/etc/wsl.conf"; } - { source = config.environment.etc."fstab".source; target = "/etc/fstab"; } - { source = passwd; target = "/etc/passwd"; } - { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/sh"; } - { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/mount"; } - ]; - - extraCommands = pkgs.writeShellScript "prepare" '' - export PATH=$PATH:${pkgs.coreutils}/bin - mkdir -p bin - ln -s /init bin/wslpath - ''; - }; - - } - ); - -} diff --git a/profiles/wsl/nixos-wsl/modules/interop.nix b/profiles/wsl/nixos-wsl/modules/interop.nix deleted file mode 100755 index b7babfb8..00000000 --- a/profiles/wsl/nixos-wsl/modules/interop.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ lib, pkgs, config, ... }: - -with builtins; with lib; -{ - imports = [ - (mkRenamedOptionModule [ "wsl" "compatibility" "interopPreserveArgvZero" ] [ "wsl" "interop" "preserveArgvZero" ]) - ]; - - options.wsl.interop = with types; { - register = mkOption { - type = bool; - default = false; # Use the existing registration by default - description = "Explicitly register the binfmt_misc handler for Windows executables"; - }; - - includePath = mkOption { - type = bool; - default = true; - description = "Include Windows PATH in WSL PATH"; - }; - - preserveArgvZero = mkOption { - type = nullOr bool; - default = null; - description = '' - Register binfmt interpreter for Windows executables with 'preserves argv[0]' flag. - - Default (null): autodetect, at some performance cost. - To avoid the performance cost, set this to true for WSL Preview 0.58 and up, - or to false for any older versions, including pre-Microsoft Store and Windows 10. - ''; - }; - }; - - config = - let - cfg = config.wsl.interop; - in - mkIf config.wsl.enable { - - boot.binfmt.registrations = mkIf cfg.register { - WSLInterop = - let - compat = cfg.preserveArgvZero; - - # WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable - # with the "preserve argv[0]" flag, so if you run `./foo.exe`, the interp gets invoked - # as `/init foo.exe ./foo.exe`. - # argv[0] --^ ^-- actual path - # - # Older versions expect to be called without the argv[0] bit, simply as `/init ./foo.exe`. - # - # We detect that by running `/init /known-not-existing-path.exe` and checking the exit code: - # the new style interp expects at least two arguments, so exits with exit code 1, - # presumably meaning "parsing error"; the old style interp attempts to actually run - # the executable, fails to find it, and exits with 255. - compatWrapper = pkgs.writeShellScript "nixos-wsl-binfmt-hack" '' - /init /nixos-wsl-does-not-exist.exe - [ $? -eq 255 ] && shift - exec /init "$@" - ''; - - # use the autodetect hack if unset, otherwise call /init directly - interpreter = if compat == null then compatWrapper else "/init"; - - # enable for the wrapper and autodetect hack - preserveArgvZero = if compat == false then false else true; - in - { - magicOrExtension = "MZ"; - fixBinary = true; - wrapInterpreterInShell = false; - inherit interpreter preserveArgvZero; - }; - }; - - # Include Windows %PATH% in Linux $PATH. - environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"''; - - warnings = - let - registrations = config.boot.binfmt.registrations; - in - optional (!(registrations ? WSLInterop) && (length (attrNames config.boot.binfmt.registrations)) != 0) "Having any binfmt registrations without re-registering WSLInterop (wsl.interop.register) will break running .exe files from WSL2"; - }; - - -} diff --git a/profiles/wsl/nixos-wsl/modules/wsl-distro.nix b/profiles/wsl/nixos-wsl/modules/wsl-distro.nix deleted file mode 100755 index 6b95c3d9..00000000 --- a/profiles/wsl/nixos-wsl/modules/wsl-distro.nix +++ /dev/null @@ -1,139 +0,0 @@ -{ lib, pkgs, config, ... }: - -with builtins; with lib; -{ - options.wsl = with types; - let - coercedToStr = coercedTo (oneOf [ bool path int ]) (toString) str; - in - { - enable = mkEnableOption "support for running NixOS as a WSL distribution"; - automountPath = mkOption { - type = str; - default = "/mnt"; - description = "The path where windows drives are mounted (e.g. /mnt/c)"; - }; - automountOptions = mkOption { - type = str; - default = "metadata,uid=1000,gid=100"; - description = "Options to use when mounting windows drives"; - }; - defaultUser = mkOption { - type = str; - default = "nixos"; - description = "The name of the default user"; - }; - startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu"; - wslConf = mkOption { - type = attrsOf (attrsOf (oneOf [ str int bool ])); - description = "Entries that are added to /etc/wsl.conf"; - }; - }; - - config = - let - cfg = config.wsl; - syschdemd = import ../syschdemd.nix { inherit lib pkgs config; inherit (cfg) automountPath defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; }; - in - mkIf cfg.enable { - - wsl.wslConf = { - automount = { - enabled = true; - mountFsTab = true; - root = "${cfg.automountPath}/"; - options = cfg.automountOptions; - }; - network = { - generateResolvConf = mkDefault true; - generateHosts = mkDefault true; - }; - }; - - # WSL is closer to a container than anything else - boot.isContainer = true; - - environment.noXlibs = lib.mkForce false; # override xlibs not being installed (due to isContainer) to enable the use of GUI apps - hardware.opengl.enable = true; # Enable GPU acceleration - - environment = { - - etc = { - "wsl.conf".text = generators.toINI { } cfg.wslConf; - - # DNS settings are managed by WSL - hosts.enable = !config.wsl.wslConf.network.generateHosts; - "resolv.conf".enable = !config.wsl.wslConf.network.generateResolvConf; - }; - - systemPackages = [ - (pkgs.runCommand "wslpath" { } '' - mkdir -p $out/bin - ln -s /init $out/bin/wslpath - '') - ]; - }; - - networking.dhcpcd.enable = false; - - users.users.${cfg.defaultUser} = { - isNormalUser = true; - uid = 1000; - extraGroups = [ "wheel" ]; # Allow the default user to use sudo - }; - - users.users.root = { - shell = "${syschdemd}/bin/syschdemd"; - # Otherwise WSL fails to login as root with "initgroups failed 5" - extraGroups = [ "root" ]; - }; - - security.sudo = { - extraConfig = '' - Defaults env_keep+=INSIDE_NAMESPACE - ''; - wheelNeedsPassword = mkDefault false; # The default user will not have a password by default - }; - - system.activationScripts = { - copy-launchers = mkIf cfg.startMenuLaunchers ( - stringAfter [ ] '' - for x in applications icons; do - echo "Copying /usr/share/$x" - mkdir -p /usr/share/$x - ${pkgs.rsync}/bin/rsync -ar --delete $systemConfig/sw/share/$x/. /usr/share/$x - done - '' - ); - populateBin = stringAfter [ ] '' - echo "setting up /bin..." - ln -sf /init /bin/wslpath - ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh - ln -sf ${pkgs.util-linux}/bin/mount /bin/mount - ''; - }; - - systemd = { - # Disable systemd units that don't make sense on WSL - services = { - "serial-getty@ttyS0".enable = false; - "serial-getty@hvc0".enable = false; - "getty@tty1".enable = false; - "autovt@".enable = false; - firewall.enable = false; - systemd-resolved.enable = false; - systemd-udevd.enable = false; - }; - - tmpfiles.rules = [ - # Don't remove the X11 socket - "d /tmp/.X11-unix 1777 root root" - ]; - - # Don't allow emergency mode, because we don't have a console. - enableEmergencyMode = false; - }; - - warnings = (optional (config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf) "systemd-resolved is enabled, but resolv.conf is managed by WSL"); - }; -} diff --git a/profiles/wsl/nixos-wsl/syschdemd.nix b/profiles/wsl/nixos-wsl/syschdemd.nix deleted file mode 100755 index 406dd861..00000000 --- a/profiles/wsl/nixos-wsl/syschdemd.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ lib -, pkgs -, config -, automountPath -, defaultUser -, defaultUserHome ? "/home/${defaultUser}" -, ... -}: - -pkgs.substituteAll { - name = "syschdemd"; - src = ./syschdemd.sh; - dir = "bin"; - isExecutable = true; - - buildInputs = with pkgs; [ daemonize ]; - - inherit defaultUser defaultUserHome; - inherit (pkgs) daemonize; - inherit (config.security) wrapperDir; - fsPackagesPath = lib.makeBinPath config.system.fsPackages; - - systemdWrapper = pkgs.writeShellScript "systemd-wrapper.sh" '' - mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc || true - mount --make-rshared ${automountPath} - exec systemd - ''; -} diff --git a/profiles/wsl/nixos-wsl/syschdemd.sh b/profiles/wsl/nixos-wsl/syschdemd.sh deleted file mode 100755 index 6223cdac..00000000 --- a/profiles/wsl/nixos-wsl/syschdemd.sh +++ /dev/null @@ -1,78 +0,0 @@ -#! @shell@ - -set -e - -sw="/nix/var/nix/profiles/system/sw/bin" -systemPath=$(${sw}/readlink -f /nix/var/nix/profiles/system) - -function start_systemd { - echo "Starting systemd..." >&2 - - PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \ - LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive \ - @daemonize@/bin/daemonize /run/current-system/sw/bin/unshare -fp --mount-proc @systemdWrapper@ - - # Wait until systemd has been started to prevent a race condition from occuring - while ! $sw/pgrep -xf systemd | $sw/tail -n1 >/run/systemd.pid; do - $sw/sleep 1s - done - - # Wait for systemd to start services - status=1 - while [[ $status -gt 0 ]]; do - $sw/sleep 1 - status=0 - $sw/nsenter -t $(/dev/null || - status=$? - done -} - -# Needs root to work -if [[ $EUID -ne 0 ]]; then - echo "[ERROR] Requires root! :( Make sure the WSL default user is set to root" >&2 - exit 1 -fi - -if [ ! -e "/run/current-system" ]; then - LANG="C.UTF-8" /nix/var/nix/profiles/system/activate -fi - -if [ ! -e "/run/systemd.pid" ]; then - start_systemd -fi - -userShell=$($sw/getent passwd @defaultUser@ | $sw/cut -d: -f7) -if [[ $# -gt 0 ]]; then - # wsl seems to prefix with "-c" - shift - cmd="$@" -else - cmd="$userShell" -fi - -# Pass external environment but filter variables specific to root user. -exportCmd="$(export -p | $sw/grep -vE ' (HOME|LOGNAME|SHELL|USER)='); export WSLPATH=\"$PATH\"; export INSIDE_NAMESPACE=true" - -if [[ -z "${INSIDE_NAMESPACE:-}" ]]; then - - # Test whether systemd is still alive if it was started previously - if ! [ -d "/proc/$( (Default: True) - ''; -} diff --git a/user/app/emacs/default.nix b/user/app/emacs/default.nix deleted file mode 100644 index b330d83e..00000000 --- a/user/app/emacs/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, pkgs, ... }: -{ - home.packages = with pkgs; [ - (pkgs.emacsWithPackagesFromUsePackage { - config = ./init.el; - package = pkgs.emacs-pgtk; - alwaysEnsure = false; - extraEmacsPackages = epkgs: with epkgs; [ - org-modern olivetti - command-log-mode - vertico corfu hotfuzz orderless - evil evil-collection evil-snipe evil-owl evil-vimish-fold - dashboard doom-themes doom-modeline - nerd-icons nerd-icons-dired nerd-icons-corfu - nerd-icons-ibuffer nerd-icons-completion - yasnippet shackle - projectile treemacs treemacs-projectile - treemacs-evil treemacs-nerd-icons - treesit-grammars.with-all-grammars - git-timemachine wgrep - magit magit-file-icons magit-todos - undo-fu undo-fu-session - org-roam org-node org-node-fakeroam - vterm vterm-toggle sudo-edit - direnv - gdscript-mode - nix-mode - python python-mode - lsp-mode flycheck lsp-ui lsp-treemacs - (epkgs.callPackage ./ultra-scroll.nix {}) - ]; - }) - fira-code - nerd-fonts.fira-code - nil - ]; - home.file.".config/emacs/init.el".source = ./init.el; - home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors { - template = builtins.readFile ./doom-stylix-theme.el.mustache; - extension = ".el"; - }; -} diff --git a/user/app/emacs/ultra-scroll.nix b/user/app/emacs/ultra-scroll.nix deleted file mode 100644 index 113351d8..00000000 --- a/user/app/emacs/ultra-scroll.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ lib, fetchurl, trivialBuild }: - -trivialBuild { - pname = "ultra-scroll"; - version = "0.2.0"; - - src = fetchGit { - url = "https://github.com/jdtsmith/ultra-scroll.git"; - rev = "64ad7be02e11317576498dabb15c92cf31e2c04c"; - ref = "main"; - }; - - meta = with lib; { - description = "scroll Emacs like lightning"; - homepage = "https://github.com/jdtsmith/ultra-scroll"; - license = licenses.gpl3; - platforms = platforms.all; - }; -} diff --git a/user/app/flatpak/flatpak.nix b/user/app/flatpak/flatpak.nix deleted file mode 100644 index 45d92381..00000000 --- a/user/app/flatpak/flatpak.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = [ pkgs.flatpak ]; - home.sessionVariables = { - XDG_DATA_DIRS = "$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share"; # lets flatpak work - }; - - #services.flatpak.enable = true; - #services.flatpak.packages = [ { appId = "com.kde.kdenlive"; origin = "flathub"; } ]; - #services.flatpak.update.onActivation = true; -} diff --git a/user/app/git/git.nix b/user/app/git/git.nix deleted file mode 100644 index 20600cd3..00000000 --- a/user/app/git/git.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, pkgs, userSettings, ... }: - -{ - home.packages = [ pkgs.git ]; - programs.git.enable = true; - programs.git.userName = userSettings.name; - programs.git.userEmail = userSettings.email; - programs.git.extraConfig = { - init.defaultBranch = "main"; - safe.directory = [ ("/home/" + userSettings.username + "/.dotfiles") - ("/home/" + userSettings.username + "/.dotfiles/.git") - ("/home/" + userSettings.username + "/.cache/nix/tarball-cache") ]; - }; -} diff --git a/user/app/godot/default.nix b/user/app/godot/default.nix deleted file mode 100644 index 06cf97d9..00000000 --- a/user/app/godot/default.nix +++ /dev/null @@ -1,186 +0,0 @@ -{ config, pkgs, userSettings, ... }: -{ - home.packages = with pkgs; [ - godot_4 - ]; - - # ~/.config/godot must be owned by another user in order for this to work - # does not need to be recursively owned, however - - # TODO fix other colors - home.file.".config/godot/editor_settings-4.3.tres".text = '' - [gd_resource type="EditorSettings" format=3] - - [resource] - interface/editor/separate_distraction_mode = true - interface/theme/preset = "Custom" - interface/theme/spacing_preset = "Custom" - interface/theme/base_color = Color(''+config.lib.stylix.colors.base00-dec-r+'',''+config.lib.stylix.colors.base00-dec-g+'', ''+config.lib.stylix.colors.base00-dec-b+'', 0.8) - - interface/theme/accent_color = Color(''+config.lib.stylix.colors.base08-dec-r+'',''+config.lib.stylix.colors.base08-dec-g+'', ''+config.lib.stylix.colors.base08-dec-b+'', 1) - - interface/theme/contrast = 0.3 - interface/theme/icon_saturation = 1.55 - interface/theme/relationship_line_opacity = 0.35 - interface/theme/border_size = 1 - interface/theme/corner_radius = 6 - interface/theme/additional_spacing = 1 - interface/touchscreen/enable_pan_and_scale_gestures = true - interface/touchscreen/scale_gizmo_handles = 2.0 - interface/multi_window/enable = false - interface/multi_window/restore_windows_on_load = false - filesystem/external_programs/raster_image_editor = "krita" - filesystem/external_programs/vector_image_editor = "inkscape" - filesystem/external_programs/3d_model_editor = "blender" - filesystem/external_programs/terminal_emulator = "''+userSettings.term+''" - - filesystem/directories/default_project_path = "/home/''+userSettings.username+''/Projects" - - text_editor/theme/highlighting/symbol_color = Color(0.67, 0.79, 1, 1) - text_editor/theme/highlighting/keyword_color = Color(1, 0.44, 0.52, 1) - text_editor/theme/highlighting/control_flow_keyword_color = Color(1, 0.55, 0.8, 1) - text_editor/theme/highlighting/base_type_color = Color(0.26, 1, 0.76, 1) - text_editor/theme/highlighting/engine_type_color = Color(0.56, 1, 0.86, 1) - text_editor/theme/highlighting/user_type_color = Color(0.78, 1, 0.93, 1) - text_editor/theme/highlighting/comment_color = Color(0.764706, 0.769608, 0.77451, 0.5) - text_editor/theme/highlighting/doc_comment_color = Color(0.6, 0.7, 0.8, 0.8) - text_editor/theme/highlighting/string_color = Color(1, 0.93, 0.63, 1) - text_editor/theme/highlighting/background_color = Color(0.0323529, 0.0431373, 0.0539216, 1) - text_editor/theme/highlighting/completion_background_color = Color(0.0588235, 0.0784314, 0.0980392, 1) - text_editor/theme/highlighting/completion_selected_color = Color(1, 1, 1, 0.07) - text_editor/theme/highlighting/completion_existing_color = Color(1, 1, 1, 0.14) - text_editor/theme/highlighting/completion_font_color = Color(0.764706, 0.769608, 0.77451, 1) - text_editor/theme/highlighting/text_color = Color(0.764706, 0.769608, 0.77451, 1) - text_editor/theme/highlighting/line_number_color = Color(0.764706, 0.769608, 0.77451, 0.5) - text_editor/theme/highlighting/safe_line_number_color = Color(0.764706, 0.923529, 0.77451, 0.75) - text_editor/theme/highlighting/caret_color = Color(1, 1, 1, 1) - text_editor/theme/highlighting/selection_color = Color(0.941176, 0.443137, 0.470588, 0.4) - text_editor/theme/highlighting/brace_mismatch_color = Color(1, 0.47, 0.42, 1) - text_editor/theme/highlighting/current_line_color = Color(1, 1, 1, 0.07) - text_editor/theme/highlighting/line_length_guideline_color = Color(0.0588235, 0.0784314, 0.0980392, 1) - text_editor/theme/highlighting/word_highlighted_color = Color(1, 1, 1, 0.07) - text_editor/theme/highlighting/number_color = Color(0.63, 1, 0.88, 1) - text_editor/theme/highlighting/function_color = Color(0.34, 0.7, 1, 1) - text_editor/theme/highlighting/member_variable_color = Color(0.736, 0.88, 1, 1) - text_editor/theme/highlighting/mark_color = Color(1, 0.47, 0.42, 0.3) - text_editor/theme/highlighting/breakpoint_color = Color(1, 0.47, 0.42, 1) - text_editor/theme/highlighting/code_folding_color = Color(1, 1, 1, 0.27) - text_editor/theme/highlighting/search_result_color = Color(1, 1, 1, 0.07) - text_editor/appearance/whitespace/draw_tabs = false - text_editor/behavior/indent/type = 1 - text_editor/behavior/indent/size = 2 - text_editor/behavior/files/trim_trailing_whitespace_on_save = true - editors/panning/2d_editor_panning_scheme = 1 - editors/panning/sub_editors_panning_scheme = 1 - editors/panning/simple_panning = true - project_manager/directory_naming_convention = 3 - asset_library/available_urls = { - "godotengine.org (Official)": "https://godotengine.org/asset-library/api" - } - asset_library/use_threads = true - export/android/java_sdk_path = "" - export/android/android_sdk_path = "" - export/android/debug_keystore = "/home/emmet/.local/share/godot/keystores/debug.keystore" - export/android/debug_keystore_user = "androiddebugkey" - export/android/debug_keystore_pass = "android" - export/android/force_system_user = false - export/android/shutdown_adb_on_exit = true - export/android/one_click_deploy_clear_previous_install = false - export/android/use_wifi_for_remote_debug = false - export/android/wifi_remote_debug_host = "localhost" - export/macos/rcodesign = "" - export/web/http_host = "localhost" - export/web/http_port = 8060 - export/web/use_tls = false - export/web/tls_key = "" - export/web/tls_certificate = "" - export/windows/rcedit = "" - export/windows/osslsigncode = "" - export/windows/wine = "/home/emmet/.nix-profile/bin/wine64" - _default_feature_profile = "" - interface/editors/show_scene_tree_root_selection = true - interface/editors/derive_script_globals_by_name = true - docks/scene_tree/ask_before_deleting_related_animation_tracks = true - _use_favorites_root_selection = false - filesystem/file_server/port = 6010 - filesystem/file_server/password = "" - editors/3d/manipulator_gizmo_size = 80 - editors/3d/manipulator_gizmo_opacity = 0.9 - editors/3d/navigation/show_viewport_rotation_gizmo = true - editors/3d/navigation/show_viewport_navigation_gizmo = false - text_editor/behavior/files/auto_reload_and_parse_scripts_on_save = true - text_editor/behavior/files/open_dominant_script_on_scene_change = false - text_editor/external/use_external_editor = false - text_editor/external/exec_path = "" - text_editor/script_list/script_temperature_enabled = true - text_editor/script_list/script_temperature_history_size = 15 - text_editor/script_list/group_help_pages = true - text_editor/script_list/sort_scripts_by = 0 - text_editor/script_list/list_script_names_as = 0 - text_editor/external/exec_flags = "{file}" - version_control/username = "" - version_control/ssh_public_key_path = "" - version_control/ssh_private_key_path = "" - editors/bone_mapper/handle_colors/unset = Color(0.3, 0.3, 0.3, 1) - editors/bone_mapper/handle_colors/set = Color(0.1, 0.6, 0.25, 1) - editors/bone_mapper/handle_colors/missing = Color(0.8, 0.2, 0.8, 1) - editors/bone_mapper/handle_colors/error = Color(0.8, 0.2, 0.2, 1) - network/debug_adapter/remote_port = 6006 - network/debug_adapter/request_timeout = 1000 - network/debug_adapter/sync_breakpoints = false - editors/3d_gizmos/gizmo_settings/path3d_tilt_disk_size = 0.8 - editors/3d_gizmos/gizmo_colors/path_tilt = Color(1, 1, 0.4, 0.9) - editors/3d_gizmos/gizmo_colors/skeleton = Color(1, 0.8, 0.4, 1) - editors/3d_gizmos/gizmo_colors/selected_bone = Color(0.8, 0.3, 0, 1) - editors/3d_gizmos/gizmo_settings/bone_axis_length = 0.1 - editors/3d_gizmos/gizmo_settings/bone_shape = 1 - editors/3d_gizmos/gizmo_colors/csg = Color(0, 0.4, 1, 0.15) - editors/grid_map/editor_side = 1 - editors/grid_map/palette_min_width = 230 - editors/grid_map/preview_size = 64 - export/ssh/ssh = "" - export/ssh/scp = "" - network/language_server/remote_host = "127.0.0.1" - network/language_server/remote_port = 6005 - network/language_server/enable_smart_resolve = true - network/language_server/show_native_symbols_in_editor = false - network/language_server/use_thread = false - network/language_server/poll_limit_usec = 100000 - text_editor/theme/highlighting/gdscript/function_definition_color = Color(0.4, 0.9, 1, 1) - text_editor/theme/highlighting/gdscript/global_function_color = Color(0.64, 0.64, 0.96, 1) - text_editor/theme/highlighting/gdscript/node_path_color = Color(0.72, 0.77, 0.49, 1) - text_editor/theme/highlighting/gdscript/node_reference_color = Color(0.39, 0.76, 0.35, 1) - text_editor/theme/highlighting/gdscript/annotation_color = Color(1, 0.7, 0.45, 1) - text_editor/theme/highlighting/gdscript/string_name_color = Color(1, 0.76, 0.65, 1) - text_editor/theme/highlighting/comment_markers/critical_color = Color(0.77, 0.35, 0.35, 1) - text_editor/theme/highlighting/comment_markers/warning_color = Color(0.72, 0.61, 0.48, 1) - text_editor/theme/highlighting/comment_markers/notice_color = Color(0.56, 0.67, 0.51, 1) - text_editor/theme/highlighting/comment_markers/critical_list = "ALERT,ATTENTION,CAUTION,CRITICAL,DANGER,SECURITY" - text_editor/theme/highlighting/comment_markers/warning_list = "BUG,DEPRECATED,FIXME,HACK,TASK,TBD,TODO,WARNING" - text_editor/theme/highlighting/comment_markers/notice_list = "INFO,NOTE,NOTICE,TEST,TESTING" - editors/3d_gizmos/gizmo_colors/camera = Color(0.8, 0.4, 0.8, 1) - editors/3d_gizmos/gizmo_colors/stream_player_3d = Color(0.4, 0.8, 1, 1) - editors/3d_gizmos/gizmo_colors/occluder = Color(0.8, 0.5, 1, 1) - editors/3d_gizmos/gizmo_colors/visibility_notifier = Color(0.8, 0.5, 0.7, 1) - editors/3d_gizmos/gizmo_colors/particles = Color(0.8, 0.7, 0.4, 1) - editors/3d_gizmos/gizmo_colors/particle_attractor = Color(1, 0.7, 0.5, 1) - editors/3d_gizmos/gizmo_colors/particle_collision = Color(0.5, 0.7, 1, 1) - editors/3d_gizmos/gizmo_colors/reflection_probe = Color(0.6, 1, 0.5, 1) - editors/3d_gizmos/gizmo_colors/decal = Color(0.6, 0.5, 1, 1) - editors/3d_gizmos/gizmo_colors/voxel_gi = Color(0.5, 1, 0.6, 1) - editors/3d_gizmos/gizmo_colors/lightmap_lines = Color(0.5, 0.6, 1, 1) - editors/3d_gizmos/gizmo_colors/lightprobe_lines = Color(0.5, 0.6, 1, 1) - editors/3d_gizmos/gizmo_colors/joint_body_a = Color(0.6, 0.8, 1, 1) - editors/3d_gizmos/gizmo_colors/joint_body_b = Color(0.6, 0.9, 1, 1) - editors/3d_gizmos/gizmo_colors/fog_volume = Color(0.5, 0.7, 1, 1) - text_editor/help/sort_functions_alphabetically = true - metadata/script_setup_templates_dictionary = { - "AnimatedSprite2D": "0NodeDefault", - "Area2D": "0NodeDefault", - "CanvasLayer": "0NodeDefault", - "Node": "0NodeDefault", - "Node2D": "0NodeDefault" - } - metadata/export_template_download_directory = "/home/emmet/.cache/godot" - ''; -} diff --git a/user/app/keepass/keepass.nix b/user/app/keepass/keepass.nix deleted file mode 100644 index 89358c68..00000000 --- a/user/app/keepass/keepass.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, pkgs, ... }: - -{ -# nixpkgs.overlays = [ -# (self: super: -# { -# keepmenu = super.keepmenu.overrideAttrs (oldAttrs: rec { -# pname = "keepmenu"; -# version = "1.3.1"; -# src = super.python3Packages.fetchPypi { -# inherit pname version; -# sha256 = "sha256-AGuJY7IirzIjcu/nY9CzeOqU1liwcRijYLi8hGN/pRg="; -# }; -# }); -# } -# ) -# ]; - - home.packages = with pkgs; [ - keepassxc - keepmenu - ]; -} diff --git a/user/app/ranger/ranger.nix b/user/app/ranger/ranger.nix deleted file mode 100644 index 52c44762..00000000 --- a/user/app/ranger/ranger.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, pkgs, ... }: -let myCbxScript = '' - #!/bin/sh - - # this lets my copy and paste images and/or plaintext of files directly out of ranger - if [ "$#" -le "2" ]; then - if [ "$1" = "copy" -o "$1" = "cut" ]; then - if [ "$XDG_SESSION_TYPE" = "wayland" ]; then - wl-copy < $2; - else - # xclip -selection clipboard -t $(file -b --mime-type $2) -i $2; - xclip -selection clipboard -t image/png -i $2; - fi - fi - fi - ''; -in -{ - imports = [ ../../pkgs/ranger.nix ]; - - home.packages = with pkgs; [ - ranger - ripdrag - highlight - (pkgs.writeScriptBin "cbx" myCbxScript) - ]; - xdg.mimeApps.associations.added = { - "inode/directory" = "ranger.desktop"; - }; - home.file.".config/ranger/rc.conf".source = ./rc.conf; - home.file.".config/ranger/rifle.conf".source = ./rifle.conf; - home.file.".config/ranger/scope.sh" = { - source = ./scope.sh; - executable = true; - }; - home.file.".config/ranger/commands.py" = { - source = ./commands.py; - executable = true; - }; - home.file.".config/ranger/commands_full.py" = { - source = ./commands_full.py; - executable = true; - }; - home.file.".config/ranger/colorschemes/hail.py" = { - source = ./colorschemes/hail.py; - executable = true; - }; -} diff --git a/user/app/terminal/alacritty.nix b/user/app/terminal/alacritty.nix deleted file mode 100644 index 8dd7a185..00000000 --- a/user/app/terminal/alacritty.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, lib, ... }: - -{ - home.packages = with pkgs; [ - alacritty - ]; - programs.alacritty.enable = true; - programs.alacritty.settings = { - window.opacity = lib.mkForce 0.85; - }; -} diff --git a/user/app/terminal/kitty.nix b/user/app/terminal/kitty.nix deleted file mode 100644 index a2d0b515..00000000 --- a/user/app/terminal/kitty.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, lib, ... }: - -{ - home.packages = with pkgs; [ - kitty - ]; - programs.kitty.enable = true; - programs.kitty.settings = { - background_opacity = lib.mkForce "0.85"; - modify_font = "cell_width 90%"; - }; -} diff --git a/user/app/virtualization/virtualization.nix b/user/app/virtualization/virtualization.nix deleted file mode 100644 index f1fb7bd7..00000000 --- a/user/app/virtualization/virtualization.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Various packages related to virtualization, compatability and sandboxing - home.packages = with pkgs; [ - # Virtual Machines and wine - libvirt - virt-manager - qemu - uefi-run - lxc - swtpm - bottles - - # Filesystems - dosfstools - ]; - - home.file.".config/libvirt/qemu.conf".text = '' -nvram = ["/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd"] - ''; - -} diff --git a/user/hardware/bluetooth.nix b/user/hardware/bluetooth.nix deleted file mode 100644 index a6b6cd84..00000000 --- a/user/hardware/bluetooth.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ - blueman - ]; - services = { - blueman-applet.enable = true; - }; -} diff --git a/user/pkgs/pokemon-colorscripts.nix b/user/pkgs/pokemon-colorscripts.nix deleted file mode 100644 index ed6f4c39..00000000 --- a/user/pkgs/pokemon-colorscripts.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ lib, stdenv, fetchFromGitLab, pkgs, ... }: - -let name = "pokemon-colorscripts"; - version = "unstable"; -in - stdenv.mkDerivation { - inherit name version; - - src = fetchFromGitLab { - owner = "phoneybadger"; - repo = name; - rev = "0483c85b93362637bdd0632056ff986c07f30868"; - sha256 = "sha256-rj0qKYHCu9SyNsj1PZn1g7arjcHuIDGHwubZg/yJt7A="; - }; - - installPhase = '' - mkdir -p $out $out/bin $out/opt - cp -rf $src/colorscripts $out/opt - cp $src/pokemon-colorscripts.py $out/opt - cp $src/pokemon.json $out/opt - ln -s $out/opt/pokemon-colorscripts.py $out/bin/pokemon-colorscripts - ''; - - meta = { - homepage = "https://github.com/Admiral-Fish/PokeFinder"; - description = "CLI utility to print out images of pokemon to terminal"; - license = lib.licenses.mit; - maintainers = []; - }; - } diff --git a/user/pkgs/ranger.nix b/user/pkgs/ranger.nix deleted file mode 100644 index feade745..00000000 --- a/user/pkgs/ranger.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ lib, pkgs, ... }: - -{ - nixpkgs.overlays = [ - (self: super: - { - ranger = super.ranger.overrideAttrs (oldAttrs: rec { - preConfigure = '' - substituteInPlace ranger/__init__.py \ - --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${lib.getBin pkgs.bat}/bin/bat'" - - # give image previews out of the box when building with w3m - substituteInPlace ranger/config/rc.conf \ - --replace "set preview_images false" "set preview_images true" - - # adds this patch: https://github.com/ranger/ranger/pull/1758 - # fixes a bug for kitty users that use image previews - substituteInPlace ranger/ext/img_display.py \ - --replace "self.image_id -= 1" "self.image_id = max(0, self.image_id - 1)" - - # fixes the .desktop file - substituteInPlace doc/ranger.desktop \ - --replace "Icon=utilities-terminal" "Icon=user-desktop" - substituteInPlace doc/ranger.desktop \ - --replace "Terminal=true" "Terminal=false" - substituteInPlace doc/ranger.desktop \ - --replace "Exec=ranger" "Exec=kitty -e ranger %U" - ''; - }); - } - ) - ]; - home.packages = with pkgs; [ - poppler_utils - librsvg - ffmpegthumbnailer - ]; - -} diff --git a/user/shell/cli-collection.nix b/user/shell/cli-collection.nix deleted file mode 100644 index 1934fd54..00000000 --- a/user/shell/cli-collection.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ pkgs, ... }: -{ - # Collection of useful CLI apps - home.packages = with pkgs; [ - # Command Line - disfetch lolcat cowsay - starfetch - killall - libnotify - timer - brightnessctl - gnugrep - bat eza fd bottom ripgrep - rsync - unzip - w3m - pandoc - hwinfo - pciutils - numbat - (pkgs.callPackage ../pkgs/pokemon-colorscripts.nix { }) - (pkgs.writeShellScriptBin "airplane-mode" '' - #!/bin/sh - connectivity="$(nmcli n connectivity)" - if [ "$connectivity" == "full" ] - then - nmcli n off - else - nmcli n on - fi - '') - vim neovim - ]; -} diff --git a/user/shell/sh.nix b/user/shell/sh.nix deleted file mode 100644 index 435718fb..00000000 --- a/user/shell/sh.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ pkgs, ... }: -let - - # My shell aliases - myAliases = { - ls = "eza --icons -l -T -L=1"; - cat = "bat"; - htop = "btm"; - fd = "fd -Lu"; - w3m = "w3m -no-cookie -v"; - neofetch = "disfetch"; - fetch = "disfetch"; - gitfetch = "onefetch"; - "," = "comma"; - ",," = "comma-shell"; - }; -in -{ - programs.zsh = { - enable = true; - enableAutosuggestions = true; - syntaxHighlighting.enable = true; - enableCompletion = true; - shellAliases = myAliases; - initExtra = '' - PROMPT=" ◉ %U%F{magenta}%n%f%u@%U%F{blue}%m%f%u:%F{yellow}%~%f - %F{green}→%f " - RPROMPT="%F{red}▂%f%F{yellow}▄%f%F{green}▆%f%F{cyan}█%f%F{blue}▆%f%F{magenta}▄%f%F{white}▂%f" - [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' - bindkey '^P' history-beginning-search-backward - bindkey '^N' history-beginning-search-forward - ''; - }; - - programs.bash = { - enable = true; - enableCompletion = true; - shellAliases = myAliases; - }; - - home.packages = with pkgs; [ - disfetch lolcat cowsay onefetch - gnugrep gnused - bat eza bottom fd bc - direnv nix-direnv - ]; - - programs.direnv.enable = true; - programs.direnv.enableZshIntegration = true; - programs.direnv.nix-direnv.enable = true; - programs.direnv.nix-direnv.package = pkgs.nix-direnv-flakes; -} diff --git a/user/style/stylix.nix b/user/style/stylix.nix deleted file mode 100644 index 8559fa9c..00000000 --- a/user/style/stylix.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ config, lib, pkgs, inputs, userSettings, ... }: - -let - theme = import (./. + "../../../themes"+("/"+userSettings.theme)); -in -{ - imports = [ inputs.stylix.homeManagerModules.stylix ]; - - home.file.".currenttheme".text = userSettings.theme; - stylix.autoEnable = false; - stylix.polarity = theme.polarity; - stylix.image = pkgs.fetchurl { - url = theme.backgroundUrl; - sha256 = theme.backgroundSha256; - }; - stylix.base16Scheme = theme; - - stylix.fonts = { - monospace = { - name = userSettings.font; - package = userSettings.fontPkg; - }; - serif = { - name = userSettings.font; - package = userSettings.fontPkg; - }; - sansSerif = { - name = userSettings.font; - package = userSettings.fontPkg; - }; - emoji = { - name = "Noto Emoji"; - package = pkgs.noto-fonts-monochrome-emoji; - }; - sizes = { - terminal = 18; - applications = 12; - popups = 12; - desktop = 12; - }; - }; - - stylix.targets.alacritty.enable = false; - programs.alacritty.settings = { - colors = { - # TODO revisit these color mappings - # these are just the default provided from stylix - # but declared directly due to alacritty v3.0 breakage - primary.background = "#"+config.lib.stylix.colors.base00; - primary.foreground = "#"+config.lib.stylix.colors.base07; - cursor.text = "#"+config.lib.stylix.colors.base00; - cursor.cursor = "#"+config.lib.stylix.colors.base07; - normal.black = "#"+config.lib.stylix.colors.base00; - normal.red = "#"+config.lib.stylix.colors.base08; - normal.green = "#"+config.lib.stylix.colors.base0B; - normal.yellow = "#"+config.lib.stylix.colors.base0A; - normal.blue = "#"+config.lib.stylix.colors.base0D; - normal.magenta = "#"+config.lib.stylix.colors.base0E; - normal.cyan = "#"+config.lib.stylix.colors.base0B; - normal.white = "#"+config.lib.stylix.colors.base05; - bright.black = "#"+config.lib.stylix.colors.base03; - bright.red = "#"+config.lib.stylix.colors.base09; - bright.green = "#"+config.lib.stylix.colors.base01; - bright.yellow = "#"+config.lib.stylix.colors.base02; - bright.blue = "#"+config.lib.stylix.colors.base04; - bright.magenta = "#"+config.lib.stylix.colors.base06; - bright.cyan = "#"+config.lib.stylix.colors.base0F; - bright.white = "#"+config.lib.stylix.colors.base07; - }; - font.size = config.stylix.fonts.sizes.terminal; - font.normal.family = userSettings.font; - }; - stylix.targets.kitty.enable = true; - stylix.targets.gtk.enable = true; - stylix.targets.rofi.enable = if (userSettings.wmType == "x11") then true else false; - stylix.targets.feh.enable = if (userSettings.wmType == "x11") then true else false; - programs.feh.enable = true; - home.file.".fehbg-stylix".text = '' - #!/bin/sh - feh --no-fehbg --bg-fill ''+config.stylix.image+''; - ''; - home.file.".fehbg-stylix".executable = true; - home.file = { - ".config/qt5ct/colors/oomox-current.conf".source = config.lib.stylix.colors { - template = builtins.readFile ./oomox-current.conf.mustache; - extension = ".conf"; - }; - ".config/Trolltech.conf".source = config.lib.stylix.colors { - template = builtins.readFile ./Trolltech.conf.mustache; - extension = ".conf"; - }; - ".config/kdeglobals".source = config.lib.stylix.colors { - template = builtins.readFile ./Trolltech.conf.mustache; - extension = ""; - }; - ".config/qt5ct/qt5ct.conf".text = pkgs.lib.mkBefore (builtins.readFile ./qt5ct.conf); - }; - home.file.".config/hypr/hyprpaper.conf".text = '' - preload = ''+config.stylix.image+'' - - wallpaper = ,''+config.stylix.image+'' - - ''; - home.packages = with pkgs; [ - libsForQt5.qt5ct pkgs.libsForQt5.breeze-qt5 libsForQt5.breeze-icons pkgs.noto-fonts-monochrome-emoji - ]; - qt = { - enable = true; - style.package = pkgs.libsForQt5.breeze-qt5; - style.name = "breeze-dark"; - platformTheme = "kde"; - }; - fonts.fontconfig.defaultFonts = { - monospace = [ userSettings.font ]; - sansSerif = [ userSettings.font ]; - serif = [ userSettings.font ]; - }; -} diff --git a/user/wm/hyprland/hyprland.nix b/user/wm/hyprland/hyprland.nix deleted file mode 100644 index 78bdf5a7..00000000 --- a/user/wm/hyprland/hyprland.nix +++ /dev/null @@ -1,1309 +0,0 @@ -{ inputs, config, lib, pkgs, userSettings, systemSettings, ... }: let - pkgs-hyprland = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}; -in -{ - imports = [ - ../../app/terminal/alacritty.nix - ../../app/terminal/kitty.nix - (import ../../app/dmenu-scripts/networkmanager-dmenu.nix { - dmenu_command = "fuzzel -d"; inherit config lib pkgs; - }) - ../input/nihongo.nix - ] ++ - (if ((systemSettings.profile == "personal") || (systemSettings.profile == "work")) then - [ (import ./hyprprofiles/hyprprofiles.nix { - dmenuCmd = "fuzzel -d"; inherit config lib pkgs; })] - else - []); - - home.sessionVariables = { - - }; - - gtk.cursorTheme = { - package = pkgs.quintom-cursor-theme; - name = if (config.stylix.polarity == "light") then "Quintom_Ink" else "Quintom_Snow"; - size = 36; - }; - - wayland.windowManager.hyprland = { - enable = true; - package = inputs.hyprland.packages.${pkgs.system}.hyprland; - plugins = [ ]; - settings = { }; - extraConfig = '' - exec-once = dbus-update-activation-environment --systemd DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_SESSION_DESKTOP=Hyprland XDG_CURRENT_DESKTOP=Hyprland XDG_SESSION_TYPE=wayland - exec-once = hyprctl setcursor '' + config.gtk.cursorTheme.name + " " + builtins.toString config.gtk.cursorTheme.size + '' - - exec-once = sleep 10 && nextcloud - exec-once = iio-hyprland - env = NIXOS_OZONE_WL,1 - env = XDG_CURRENT_DESKTOP,Hyprland - env = XDG_SESSION_DESKTOP,Hyprland - env = XDG_SESSION_TYPE,wayland - env = WLR_DRM_DEVICES,/dev/dri/card2:/dev/dri/card1 - env = GDK_BACKEND,wayland,x11,* - env = QT_QPA_PLATFORM,wayland;xcb - env = QT_QPA_PLATFORMTHEME,qt5ct - env = QT_AUTO_SCREEN_SCALE_FACTOR,1 - env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 - env = CLUTTER_BACKEND,wayland - env = GDK_PIXBUF_MODULE_FILE,${pkgs.librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - env = GSK_RENDERER,gl - - exec-once = hyprprofile Default - - exec-once = ydotoold - exec-once = sleep 10 && caffeine - #exec-once = STEAM_FRAME_FORCE_CLOSE=1 steam -silent - exec-once = nm-applet - exec-once = blueman-applet - exec-once = GOMAXPROCS=1 syncthing --no-browser - exec-once = protonmail-bridge --noninteractive - #exec-once = waybar - exec-once = eww open-many bar:first bar:second bar:third --arg first:monitor=0 --arg second:monitor=1 --arg third:monitor=2 - exec-once = hyprland-monitor-attached ~/.local/bin/eww-reload-bars.sh - exec-once = emacs --daemon - - exec-once = hypridle - exec-once = sleep 5 && libinput-gestures - exec-once = obs-notification-mute-daemon - - exec-once = hyprpaper - - bezier = wind, 0.05, 0.9, 0.1, 1.05 - bezier = winIn, 0.1, 1.1, 0.1, 1.0 - bezier = winOut, 0.3, -0.3, 0, 1 - bezier = liner, 1, 1, 1, 1 - bezier = linear, 0.0, 0.0, 1.0, 1.0 - - animations { - enabled = yes - animation = windowsIn, 1, 6, winIn, popin - animation = windowsOut, 1, 5, winOut, popin - animation = windowsMove, 1, 5, wind, slide - animation = border, 1, 10, default - animation = borderangle, 1, 100, linear, loop - animation = fade, 1, 10, default - animation = workspaces, 1, 5, wind - animation = windows, 1, 6, wind, slide - animation = specialWorkspace, 1, 6, default, slidefadevert -50% - } - - general { - layout = master - border_size = 5 - col.active_border = 0xff'' + config.lib.stylix.colors.base08 + " " + ''0xff'' + config.lib.stylix.colors.base09 + " " + ''0xff'' + config.lib.stylix.colors.base0A + " " + ''0xff'' + config.lib.stylix.colors.base0B + " " + ''0xff'' + config.lib.stylix.colors.base0C + " " + ''0xff'' + config.lib.stylix.colors.base0D + " " + ''0xff'' + config.lib.stylix.colors.base0E + " " + ''0xff'' + config.lib.stylix.colors.base0F + " " + ''270deg - - col.inactive_border = 0xaa'' + config.lib.stylix.colors.base02 + '' - - resize_on_border = true - gaps_in = 7 - gaps_out = 7 - } - - cursor { - no_warps = false - inactive_timeout = 30 - } - - bind=SUPER,code:9,exec,nwggrid-wrapper - bind=SUPER,code:66,exec,nwggrid-wrapper - bind=SUPER,SPACE,fullscreen,1 - bind=SUPERSHIFT,F,fullscreen,0 - bind=SUPER,Y,workspaceopt,allfloat - bind=ALT,TAB,cyclenext - bind=ALT,TAB,bringactivetotop - bind=ALTSHIFT,TAB,cyclenext,prev - bind=ALTSHIFT,TAB,bringactivetotop - bind=SUPER,V,exec,wl-copy $(wl-paste | tr '\n' ' ') - bind=SUPERSHIFT,T,exec,screenshot-ocr - bind=CTRLALT,Delete,exec,hyprctl kill - bind=SUPERSHIFT,K,exec,hyprctl kill - - bind=,code:172,exec,mpc toggle - bind=,code:208,exec,mpc toggle - bind=,code:209,exec,mpc toggle - bind=,code:174,exec,mpc stop - bind=,code:171,exec,mpc next - bind=,code:173,exec,mpc prev - - bind = SUPER,R,pass,^(com\.obsproject\.Studio)$ - bind = SUPERSHIFT,R,pass,^(com\.obsproject\.Studio)$ - - bind=SUPER,RETURN,exec,'' + userSettings.term + '' - - bind=SUPERSHIFT,RETURN,exec,'' + userSettings.term + " " + '' --class float_term - - bind=SUPER,A,exec,'' + userSettings.spawnEditor + '' - - bind=SUPER,S,exec,'' + userSettings.spawnBrowser + '' - - bind=SUPERCTRL,S,exec,container-open # qutebrowser only - - bind=SUPERCTRL,P,pin - - bind=SUPER,code:47,exec,fuzzel - bind=SUPER,X,exec,fnottctl dismiss - bind=SUPERSHIFT,X,exec,fnottctl dismiss all - bind=SUPER,Q,killactive - bind=SUPERSHIFT,Q,exit - bindm=SUPER,mouse:272,movewindow - bindm=SUPER,mouse:273,resizewindow - bind=SUPER,T,togglefloating - bind=,code:148,exec,''+ userSettings.term + " "+''-e numbat - - bind=,code:107,exec,grim -g "$(slurp)" - bind=SHIFT,code:107,exec,grim -g "$(slurp -o)" - bind=SUPER,code:107,exec,grim - bind=CTRL,code:107,exec,grim -g "$(slurp)" - | wl-copy - bind=SHIFTCTRL,code:107,exec,grim -g "$(slurp -o)" - | wl-copy - bind=SUPERCTRL,code:107,exec,grim - | wl-copy - - bind=,code:122,exec,swayosd-client --output-volume lower - bind=,code:123,exec,swayosd-client --output-volume raise - bind=,code:121,exec,swayosd-client --output-volume mute-toggle - bind=,code:256,exec,swayosd-client --output-volume mute-toggle - bind=SHIFT,code:122,exec,swayosd-client --output-volume lower - bind=SHIFT,code:123,exec,swayosd-client --output-volume raise - bind=,code:232,exec,swayosd-client --brightness lower - bind=,code:233,exec,swayosd-client --brightness raise - bind=,code:237,exec,brightnessctl --device='asus::kbd_backlight' set 1- - bind=,code:238,exec,brightnessctl --device='asus::kbd_backlight' set +1 - bind=,code:255,exec,airplane-mode - bind=SUPER,C,exec,wl-copy $(hyprpicker) - - bind=SUPERSHIFT,S,exec,systemctl suspend - bindl=,switch:on:Lid Switch,exec,loginctl lock-session - bind=SUPERCTRL,L,exec,loginctl lock-session - - bind=SUPER,H,movefocus,l - bind=SUPER,J,movefocus,d - bind=SUPER,K,movefocus,u - bind=SUPER,L,movefocus,r - - bind=SUPERSHIFT,H,movewindow,l - bind=SUPERSHIFT,J,movewindow,d - bind=SUPERSHIFT,K,movewindow,u - bind=SUPERSHIFT,L,movewindow,r - - bind=SUPER,1,focusworkspaceoncurrentmonitor,1 - bind=SUPER,2,focusworkspaceoncurrentmonitor,2 - bind=SUPER,3,focusworkspaceoncurrentmonitor,3 - bind=SUPER,4,focusworkspaceoncurrentmonitor,4 - bind=SUPER,5,focusworkspaceoncurrentmonitor,5 - bind=SUPER,6,focusworkspaceoncurrentmonitor,6 - bind=SUPER,7,focusworkspaceoncurrentmonitor,7 - bind=SUPER,8,focusworkspaceoncurrentmonitor,8 - bind=SUPER,9,focusworkspaceoncurrentmonitor,9 - - bind=SUPERCTRL,right,exec,hyprnome - bind=SUPERCTRL,left,exec,hyprnome --previous - bind=SUPERSHIFT,right,exec,hyprnome --move - bind=SUPERSHIFT,left,exec,hyprnome --previous --move - - bind=SUPERSHIFT,1,movetoworkspace,1 - bind=SUPERSHIFT,2,movetoworkspace,2 - bind=SUPERSHIFT,3,movetoworkspace,3 - bind=SUPERSHIFT,4,movetoworkspace,4 - bind=SUPERSHIFT,5,movetoworkspace,5 - bind=SUPERSHIFT,6,movetoworkspace,6 - bind=SUPERSHIFT,7,movetoworkspace,7 - bind=SUPERSHIFT,8,movetoworkspace,8 - bind=SUPERSHIFT,9,movetoworkspace,9 - - exec-once = alacritty --class scratch_term - exec-once = kitty --class scratch_ranger -e ranger - exec-once = alacritty --class scratch_numbat -e numbat - exec-once = kitty --class scratch_music -e ncmpcpp - exec-once = alacritty --class scratch_btm -e btm - exec-once = element-desktop - exec-once = pavucontrol - - bind=SUPER,Z,exec,if hyprctl clients | grep scratch_term; then echo "scratch_term respawn not needed"; else alacritty --class scratch_term; fi - bind=SUPER,Z,togglespecialworkspace,scratch_term - bind=SUPER,F,exec,if hyprctl clients | grep scratch_ranger; then echo "scratch_ranger respawn not needed"; else kitty --class scratch_ranger -e ranger; fi - bind=SUPER,F,togglespecialworkspace,scratch_ranger - bind=SUPER,N,exec,if hyprctl clients | grep scratch_numbat; then echo "scratch_ranger respawn not needed"; else alacritty --class scratch_numbat -e numbat; fi - bind=SUPER,N,togglespecialworkspace,scratch_numbat - bind=SUPER,M,exec,if hyprctl clients | grep scratch_music; then echo "scratch_music respawn not needed"; else kitty --class scratch_music -e ncmpcpp; fi - bind=SUPER,M,togglespecialworkspace,scratch_music - bind=SUPER,B,exec,if hyprctl clients | grep scratch_btm; then echo "scratch_ranger respawn not needed"; else alacritty --class scratch_btm -e btm; fi - bind=SUPER,B,togglespecialworkspace,scratch_btm - bind=SUPER,D,exec,if hyprctl clients | grep Element; then echo "scratch_ranger respawn not needed"; else element-desktop; fi - bind=SUPER,D,togglespecialworkspace,scratch_element - bind=SUPER,code:172,exec,togglespecialworkspace,scratch_pavucontrol - bind=SUPER,code:172,exec,if hyprctl clients | grep pavucontrol; then echo "scratch_ranger respawn not needed"; else pavucontrol; fi - - $scratchpadsize = size 80% 85% - - $scratch_term = class:^(scratch_term)$ - windowrulev2 = float,$scratch_term - windowrulev2 = $scratchpadsize,$scratch_term - windowrulev2 = workspace special:scratch_term silent ,$scratch_term - windowrulev2 = center,$scratch_term - - $float_term = class:^(float_term)$ - windowrulev2 = float,$float_term - windowrulev2 = center,$float_term - - $scratch_ranger = class:^(scratch_ranger)$ - windowrulev2 = float,$scratch_ranger - windowrulev2 = $scratchpadsize,$scratch_ranger - windowrulev2 = workspace special:scratch_ranger silent,$scratch_ranger - windowrulev2 = center,$scratch_ranger - - $scratch_numbat = class:^(scratch_numbat)$ - windowrulev2 = float,$scratch_numbat - windowrulev2 = $scratchpadsize,$scratch_numbat - windowrulev2 = workspace special:scratch_numbat silent,$scratch_numbat - windowrulev2 = center,$scratch_numbat - - $scratch_btm = class:^(scratch_btm)$ - windowrulev2 = float,$scratch_btm - windowrulev2 = $scratchpadsize,$scratch_btm - windowrulev2 = workspace special:scratch_btm silent,$scratch_btm - windowrulev2 = center,$scratch_btm - - windowrulev2 = float,class:^(Element)$ - windowrulev2 = size 85% 90%,class:^(Element)$ - windowrulev2 = workspace special:scratch_element silent,class:^(Element)$ - windowrulev2 = center,class:^(Element)$ - - $scratch_music = class:^(scratch_music)$ - windowrulev2 = float,$scratch_music - windowrulev2 = $scratchpadsize,$scratch_music - windowrulev2 = workspace special:scratch_music silent,$scratch_music - windowrulev2 = center,$scratch_music - - $savetodisk = title:^(Save to Disk)$ - windowrulev2 = float,$savetodisk - windowrulev2 = size 70% 75%,$savetodisk - windowrulev2 = center,$savetodisk - - $pavucontrol = class:^(org.pulseaudio.pavucontrol)$ - windowrulev2 = float,$pavucontrol - windowrulev2 = size 86% 40%,$pavucontrol - windowrulev2 = move 50% 6%,$pavucontrol - windowrulev2 = workspace special silent,$pavucontrol - windowrulev2 = opacity 0.80,$pavucontrol - - $miniframe = title:\*Minibuf.* - windowrulev2 = float,$miniframe - windowrulev2 = size 64% 50%,$miniframe - windowrulev2 = move 18% 25%,$miniframe - windowrulev2 = animation popin 1 20,$miniframe - - windowrulev2 = float,class:^(pokefinder)$ - windowrulev2 = float,class:^(Waydroid)$ - - windowrulev2 = float,title:(Blender Render) - windowrulev2 = size 86% 85%,title:(Blender Render) - windowrulev2 = center,title:(Blender Render) - windowrulev2 = float,class:^(org.inkscape.Inkscape)$ - windowrulev2 = float,class:^(pinta)$ - windowrulev2 = float,class:^(krita)$ - windowrulev2 = float,class:^(Gimp) - windowrulev2 = float,class:^(Gimp) - windowrulev2 = float,class:^(libresprite)$ - windowrulev2 = float,title:(Open Images) - windowrulev2 = size 86% 85%,title:(Open Images) - windowrulev2 = center,title:(Open Images) - windowrulev2 = float,title:(Create new document) - windowrulev2 = size 86% 85%,title:(Create new document) - windowrulev2 = center,title:(Create new document) - windowrulev2 = size 86% 85%,title:(Create new document) - windowrulev2 = float,title:(Create New Node) - windowrulev2 = size 70% 70%,title:(Create New Node) - windowrulev2 = center,title:(Create New Node) - windowrulev2 = float,title:(Resource) - windowrulev2 = size 70% 70%,title:(Resource) - windowrulev2 = center,title:(Resource) - windowrulev2 = tile,title:(Godot) - - windowrulev2 = opacity 0.80,title:ORUI - - windowrulev2 = opacity 1.0,class:^(org.qutebrowser.qutebrowser),fullscreen:1 - windowrulev2 = opacity 0.85,class:^(Element)$ - windowrulev2 = opacity 0.85,class:^(Logseq)$ - windowrulev2 = opacity 1.0,class:^(Brave-browser),fullscreen:1 - windowrulev2 = opacity 1.0,class:^(librewolf),fullscreen:1 - windowrulev2 = opacity 0.85,title:^(My Local Dashboard Awesome Homepage - qutebrowser)$ - windowrulev2 = opacity 0.85,title:\[.*\] - My Local Dashboard Awesome Homepage - windowrulev2 = opacity 0.85,class:^(org.keepassxc.KeePassXC)$ - windowrulev2 = opacity 0.85,class:^(org.gnome.Nautilus)$ - windowrulev2 = opacity 0.85,class:^(org.gnome.Nautilus)$ - - windowrulev2 = opacity 0.85,initialTitle:^(Notes)$,initialClass:^(Brave-browser)$ - - layerrule = blur,waybar - layerrule = xray 1,waybar - blurls = waybar - layerrule = ignorezero, eww - layerrule = xray 1,eww - layerrule = blur,launcher # fuzzel - blurls = launcher # fuzzel - layerrule = blur,gtk-layer-shell - layerrule = xray 1,gtk-layer-shell - layerrule = ignorezero, gtk-layer-shell - layerrule = blur,eww - layerrule = xray 1,eww - layerrule = ignorezero, eww - layerrule = animation popin 80%, eww - blurls = gtk-layer-shell - layerrule = blur,~nwggrid - layerrule = xray 1,~nwggrid - layerrule = animation fade,~nwggrid - blurls = ~nwggrid - - bind=SUPER,equal, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | grep float | awk '{print $2 + 0.5}')" - bind=SUPER,minus, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | grep float | awk '{print $2 - 0.5}')" - - bind=SUPER,I,exec,networkmanager_dmenu - bind=SUPER,P,exec,keepmenu - bind=SUPERSHIFT,P,exec,hyprprofile-dmenu - bind=SUPERCTRL,R,exec,phoenix refresh - - # 3 monitor setup - monitor=eDP-1,1920x1080@300,900x1080,1 - monitor=HDMI-A-1,1920x1080,1920x0,1 - monitor=DP-1,1920x1080,0x0,1 - - # hdmi tv - #monitor=eDP-1,1920x1080,1920x0,1 - #monitor=HDMI-A-1,1920x1080,0x0,1 - - # hdmi work projector - #monitor=eDP-1,1920x1080,1920x0,1 - #monitor=HDMI-A-1,1920x1200,0x0,1 - - xwayland { - force_zero_scaling = true - } - - binds { - movefocus_cycles_fullscreen = false - } - - input { - kb_layout = us - kb_options = caps:escape - repeat_delay = 450 - repeat_rate = 50 - accel_profile = adaptive - follow_mouse = 2 - float_switch_override_focus = 0 - } - - misc { - disable_hyprland_logo = true - mouse_move_enables_dpms = true - enable_swallow = true - swallow_regex = (scratch_term)|(Alacritty)|(kitty) - font_family = '' + userSettings.font + '' - - } - decoration { - rounding = 8 - dim_special = 0.0 - blur { - enabled = true - size = 5 - passes = 2 - ignore_opacity = true - contrast = 1.17 - brightness = '' + (if (config.stylix.polarity == "dark") then "0.8" else "1.25") + '' - - xray = true - special = true - popups = true - } - } - - ''; - xwayland = { enable = true; }; - systemd.enable = true; - }; - - home.packages = (with pkgs; [ - hyprland-monitor-attached - caffeine-ng - alacritty - kitty - feh - killall - polkit_gnome - eww - nwg-launchers - papirus-icon-theme - (pkgs.writeScriptBin "nwggrid-wrapper" '' - #!/bin/sh - if pgrep -x "nwggrid-server" > /dev/null - then - nwggrid -client - else - GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache nwggrid-server -layer-shell-exclusive-zone -1 -g adw-gtk3 -o 0.55 -b ${config.lib.stylix.colors.base00} - fi - '') - libva-utils - libinput-gestures - gsettings-desktop-schemas - (pkgs.makeDesktopItem { - name = "nwggrid"; - desktopName = "Application Launcher"; - exec = "nwggrid-wrapper"; - terminal = false; - type = "Application"; - noDisplay = true; - icon = "/home/"+userSettings.username+"/.local/share/pixmaps/hyprland-logo-stylix.svg"; - }) - hyprnome - wlr-randr - wtype - ydotool - wl-clipboard - hyprland-protocols - hyprpicker - inputs.hyprlock.packages.${pkgs.system}.default - hypridle - hyprpaper - fnott - keepmenu - pinentry-gnome3 - wev - grim - slurp - libsForQt5.qt5.qtwayland - qt6.qtwayland - xdg-utils - wlsunset - pavucontrol - pamixer - tesseract4 - (pkgs.writeScriptBin "workspace-on-monitor" '' - #!/bin/sh - hyprctl monitors -j | jq ".[$1] | .activeWorkspace.id" - '') - (pkgs.writeScriptBin "open-under-ranger" '' - #!/bin/sh - command="$1" - echo $command - file="''${*:2}" - file=''${file// /\\ } - echo $file - workspace=$(hyprctl monitors -j | jq ".[] | select(.specialWorkspace.name == \"special:scratch_ranger\") | .activeWorkspace.id") - if [ -z "''${workspace}" ]; then - hyprctl dispatch exec -- "$command"; - else - hyprctl dispatch exec "[workspace $workspace]" -- "$command" "$file"; - fi - hyprctl dispatch togglespecialworkspace scratch_ranger - '') - (pkgs.writeScriptBin "screenshot-ocr" '' - #!/bin/sh - imgname="/tmp/screenshot-ocr-$(date +%Y%m%d%H%M%S).png" - txtname="/tmp/screenshot-ocr-$(date +%Y%m%d%H%M%S)" - txtfname=$txtname.txt - grim -g "$(slurp)" $imgname; - tesseract $imgname $txtname; - wl-copy -n < $txtfname - '') - (pkgs.writeScriptBin "sct" '' - #!/bin/sh - killall wlsunset &> /dev/null; - if [ $# -eq 1 ]; then - temphigh=$(( $1 + 1 )) - templow=$1 - wlsunset -t $templow -T $temphigh &> /dev/null & - else - killall wlsunset &> /dev/null; - fi - '') - (pkgs.writeScriptBin "obs-notification-mute-daemon" '' - #!/bin/sh - while true; do - if pgrep -x .obs-wrapped > /dev/null; - then - pkill -STOP fnott; - else - pkill -CONT fnott; - fi - sleep 10; - done - '') - (pkgs.writeScriptBin "suspend-unless-render" '' - #!/bin/sh - if pgrep -x nixos-rebuild > /dev/null || pgrep -x home-manager > /dev/null || pgrep -x kdenlive > /dev/null || pgrep -x FL64.exe > /dev/null || pgrep -x blender > /dev/null || pgrep -x flatpak > /dev/null; - then echo "Shouldn't suspend"; sleep 10; else echo "Should suspend"; systemctl suspend; fi - '') - ]); - home.file.".local/bin/eww-reload-bars.sh" = { - text = ''#!/bin/sh - eww open-many bar:first bar:second bar:third --arg first:monitor=0 --arg second:monitor=1 --arg third:monitor=2;''; - executable = true; - }; - home.file.".config/hypr/hypridle.conf".text = '' - general { - lock_cmd = pgrep hyprlock || hyprlock - before_sleep_cmd = loginctl lock-session - ignore_dbus_inhibit = false - } - - #listener { - # timeout = 150 # in seconds - # on-timeout = hyprctl dispatch dpms off - # on-resume = hyprctl dispatch dpms on - #} - listener { - timeout = 165 # in seconds - on-timeout = loginctl lock-session - } - listener { - timeout = 180 # in seconds - #timeout = 5400 # in seconds - on-timeout = systemctl suspend - on-resume = hyprctl dispatch dpms on - } - ''; - home.file.".config/hypr/hyprlock.conf".text = '' - background { - monitor = - path = screenshot - - # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations - blur_passes = 4 - blur_size = 5 - noise = 0.0117 - contrast = 0.8916 - brightness = 0.8172 - vibrancy = 0.1696 - vibrancy_darkness = 0.0 - } - - # doesn't work yet - image { - monitor = - path = /home/emmet/.dotfiles/user/wm/hyprland/nix-dark.png - size = 150 # lesser side if not 1:1 ratio - rounding = -1 # negative values mean circle - border_size = 0 - rotate = 0 # degrees, counter-clockwise - - position = 0, 200 - halign = center - valign = center - } - - input-field { - monitor = - size = 200, 50 - outline_thickness = 3 - dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8 - dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 - dots_center = false - dots_rounding = -1 # -1 default circle, -2 follow input-field rounding - outer_color = rgb(''+config.lib.stylix.colors.base07-rgb-r+'',''+config.lib.stylix.colors.base07-rgb-g+'', ''+config.lib.stylix.colors.base07-rgb-b+'') - inner_color = rgb(''+config.lib.stylix.colors.base00-rgb-r+'',''+config.lib.stylix.colors.base00-rgb-g+'', ''+config.lib.stylix.colors.base00-rgb-b+'') - font_color = rgb(''+config.lib.stylix.colors.base07-rgb-r+'',''+config.lib.stylix.colors.base07-rgb-g+'', ''+config.lib.stylix.colors.base07-rgb-b+'') - fade_on_empty = true - fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered. - placeholder_text = Input Password... # Text rendered in the input box when it's empty. - hide_input = false - rounding = -1 # -1 means complete rounding (circle/oval) - check_color = rgb(''+config.lib.stylix.colors.base0A-rgb-r+'',''+config.lib.stylix.colors.base0A-rgb-g+'', ''+config.lib.stylix.colors.base0A-rgb-b+'') - fail_color = rgb(''+config.lib.stylix.colors.base08-rgb-r+'',''+config.lib.stylix.colors.base08-rgb-g+'', ''+config.lib.stylix.colors.base08-rgb-b+'') - fail_text = $FAIL ($ATTEMPTS) # can be set to empty - fail_transition = 300 # transition time in ms between normal outer_color and fail_color - capslock_color = -1 - numlock_color = -1 - bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above) - invert_numlock = false # change color if numlock is off - swap_font_color = false # see below - - position = 0, -20 - halign = center - valign = center - } - - label { - monitor = - text = Hello, Emmet - color = rgb(''+config.lib.stylix.colors.base07-rgb-r+'',''+config.lib.stylix.colors.base07-rgb-g+'', ''+config.lib.stylix.colors.base07-rgb-b+'') - font_size = 25 - font_family = ''+userSettings.font+'' - - rotate = 0 # degrees, counter-clockwise - - position = 0, 160 - halign = center - valign = center - } - - label { - monitor = - text = $TIME - color = rgb(''+config.lib.stylix.colors.base07-rgb-r+'',''+config.lib.stylix.colors.base07-rgb-g+'', ''+config.lib.stylix.colors.base07-rgb-b+'') - font_size = 20 - font_family = Intel One Mono - rotate = 0 # degrees, counter-clockwise - - position = 0, 80 - halign = center - valign = center - } - ''; - services.swayosd.enable = true; - services.swayosd.topMargin = 0.5; - services.cbatticon = { - enable = true; - iconType = "symbolic"; - }; - home.file.".config/eww/eww.yuck".source = ./eww/eww.yuck; - home.file = { - ".config/eww/eww.scss".source = config.lib.stylix.colors { - template = builtins.readFile ./eww/eww.scss.mustache; - extension = ".scss"; - }; - }; - programs.waybar = { - enable = false; - package = pkgs.waybar.overrideAttrs (oldAttrs: { - postPatch = '' - # use hyprctl to switch workspaces - sed -i 's/zext_workspace_handle_v1_activate(workspace_handle_);/const std::string command = "hyprctl dispatch focusworkspaceoncurrentmonitor " + std::to_string(id());\n\tsystem(command.c_str());/g' src/modules/wlr/workspace_manager.cpp - sed -i 's/gIPC->getSocket1Reply("dispatch workspace " + std::to_string(id()));/gIPC->getSocket1Reply("dispatch focusworkspaceoncurrentmonitor " + std::to_string(id()));/g' src/modules/hyprland/workspaces.cpp - ''; - patches = [./patches/waybarpaupdate.patch ./patches/waybarbatupdate.patch]; - }); - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 35; - margin = "7 7 3 7"; - spacing = 2; - - modules-left = [ "group/power" "group/battery" "group/backlight" "group/cpu" "group/memory" "group/pulseaudio" "keyboard-state" ]; - modules-center = [ "custom/hyprprofile" "hyprland/workspaces" ]; - modules-right = [ "group/time" "idle_inhibitor" "tray" ]; - - "custom/os" = { - "format" = " {} "; - "exec" = ''echo "" ''; - "interval" = "once"; - "on-click" = "nwggrid-wrapper"; - "tooltip" = false; - }; - "group/power" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "children-class" = "not-power"; - "transition-left-to-right" = true; - }; - "modules" = [ - "custom/os" - "custom/hyprprofileicon" - "custom/lock" - "custom/quit" - "custom/power" - "custom/reboot" - ]; - }; - "custom/quit" = { - "format" = "󰍃"; - "tooltip" = false; - "on-click" = "hyprctl dispatch exit"; - }; - "custom/lock" = { - "format" = "󰍁"; - "tooltip" = false; - "on-click" = "hyprlock"; - }; - "custom/reboot" = { - "format" = "󰜉"; - "tooltip" = false; - "on-click" = "reboot"; - }; - "custom/power" = { - "format" = "󰐥"; - "tooltip" = false; - "on-click" = "shutdown now"; - }; - "custom/hyprprofileicon" = { - "format" = "󱙋"; - "on-click" = "hyprprofile-dmenu"; - "tooltip" = false; - }; - "custom/hyprprofile" = { - "format" = " {}"; - "exec" = ''cat ~/.hyprprofile''; - "interval" = 3; - "on-click" = "hyprprofile-dmenu"; - }; - "keyboard-state" = { - "numlock" = true; - "format" = "{icon}"; - "format-icons" = { - "locked" = "󰎠 "; - "unlocked" = "󱧓 "; - }; - }; - "hyprland/workspaces" = { - "format" = "{icon}"; - "format-icons" = { - "1" = "󱚌"; - "2" = "󰖟"; - "3" = ""; - "4" = "󰎄"; - "5" = "󰋩"; - "6" = ""; - "7" = "󰄖"; - "8" = "󰑴"; - "9" = "󱎓"; - "scratch_term" = "_"; - "scratch_ranger" = "_󰴉"; - "scratch_music" = "_"; - "scratch_btm" = "_"; - "scratch_pavucontrol" = "_󰍰"; - }; - "on-click" = "activate"; - "on-scroll-up" = "hyprnome"; - "on-scroll-down" = "hyprnome --previous"; - "all-outputs" = false; - "active-only" = false; - "ignore-workspaces" = ["scratch" "-"]; - "show-special" = false; - }; - - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = "󰅶"; - deactivated = "󰾪"; - }; - }; - tray = { - #"icon-size" = 21; - "spacing" = 10; - }; - "clock#time" = { - "interval" = 1; - "format" = "{:%I:%M:%S %p}"; - "timezone" = "America/Chicago"; - "tooltip-format" = '' - {:%Y %B} - {calendar}''; - }; - "clock#date" = { - "interval" = 1; - "format" = "{:%a %Y-%m-%d}"; - "timezone" = "America/Chicago"; - "tooltip-format" = '' - {:%Y %B} - {calendar}''; - }; - "group/time" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "transition-left-to-right" = false; - }; - "modules" = [ "clock#time" "clock#date" ]; - }; - - cpu = { "format" = "󰍛"; }; - "cpu#text" = { "format" = "{usage}%"; }; - "group/cpu" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "transition-left-to-right" = true; - }; - "modules" = [ "cpu" "cpu#text" ]; - }; - - memory = { "format" = ""; }; - "memory#text" = { "format" = "{}%"; }; - "group/memory" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "transition-left-to-right" = true; - }; - "modules" = [ "memory" "memory#text" ]; - }; - - backlight = { - "format" = "{icon}"; - "format-icons" = [ "" "" "" "" "" "" "" "" "" ]; - }; - "backlight#text" = { "format" = "{percent}%"; }; - "group/backlight" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "transition-left-to-right" = true; - }; - "modules" = [ "backlight" "backlight#text" ]; - }; - - battery = { - "states" = { - "good" = 75; - "warning" = 30; - "critical" = 15; - }; - "fullat" = 80; - "format" = "{icon}"; - "format-charging" = "󰂄"; - "format-plugged" = "󰂄"; - "format-full" = "󰁹"; - "format-icons" = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; - "interval" = 10; - }; - "battery#text" = { - "states" = { - "good" = 75; - "warning" = 30; - "critical" = 15; - }; - "fullat" = 80; - "format" = "{capacity}%"; - }; - "group/battery" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "transition-left-to-right" = true; - }; - "modules" = [ "battery" "battery#text" ]; - }; - pulseaudio = { - "scroll-step" = 1; - "format" = "{icon}"; - "format-bluetooth" = "{icon}"; - "format-bluetooth-muted" = "󰸈"; - "format-muted" = "󰸈"; - "format-source" = ""; - "format-source-muted" = ""; - "format-icons" = { - "headphone" = ""; - "hands-free" = ""; - "headset" = ""; - "phone" = ""; - "portable" = ""; - "car" = ""; - "default" = [ "" "" "" ]; - }; - "on-click" = "hyprctl dispatch togglespecialworkspace scratch_pavucontrol; if hyprctl clients | grep pavucontrol; then echo 'scratch_ranger respawn not needed'; else pavucontrol; fi"; - }; - "pulseaudio#text" = { - "scroll-step" = 1; - "format" = "{volume}%"; - "format-bluetooth" = "{volume}%"; - "format-bluetooth-muted" = ""; - "format-muted" = ""; - "format-source" = "{volume}%"; - "format-source-muted" = ""; - "on-click" = "hyprctl dispatch togglespecialworkspace scratch_pavucontrol; if hyprctl clients | grep pavucontrol; then echo 'scratch_ranger respawn not needed'; else pavucontrol; fi"; - }; - "group/pulseaudio" = { - "orientation" = "horizontal"; - "drawer" = { - "transition-duration" = 500; - "transition-left-to-right" = true; - }; - "modules" = [ "pulseaudio" "pulseaudio#text" ]; - }; - }; - }; - style = '' - * { - /* `otf-font-awesome` is required to be installed for icons */ - font-family: FontAwesome, ''+userSettings.font+''; - - font-size: 20px; - } - - window#waybar { - background-color: rgba('' + config.lib.stylix.colors.base00-rgb-r + "," + config.lib.stylix.colors.base00-rgb-g + "," + config.lib.stylix.colors.base00-rgb-b + "," + ''0.55); - border-radius: 8px; - color: #'' + config.lib.stylix.colors.base07 + ''; - transition-property: background-color; - transition-duration: .2s; - } - - tooltip { - color: #'' + config.lib.stylix.colors.base07 + ''; - background-color: rgba('' + config.lib.stylix.colors.base00-rgb-r + "," + config.lib.stylix.colors.base00-rgb-g + "," + config.lib.stylix.colors.base00-rgb-b + "," + ''0.9); - border-style: solid; - border-width: 3px; - border-radius: 8px; - border-color: #'' + config.lib.stylix.colors.base08 + ''; - } - - tooltip * { - color: #'' + config.lib.stylix.colors.base07 + ''; - background-color: rgba('' + config.lib.stylix.colors.base00-rgb-r + "," + config.lib.stylix.colors.base00-rgb-g + "," + config.lib.stylix.colors.base00-rgb-b + "," + ''0.0); - } - - window > box { - border-radius: 8px; - opacity: 0.94; - } - - window#waybar.hidden { - opacity: 0.2; - } - - button { - border: none; - } - - #custom-hyprprofile { - color: #'' + config.lib.stylix.colors.base0D + ''; - } - - /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ - button:hover { - background: inherit; - } - - #workspaces button { - padding: 0px 6px; - background-color: transparent; - color: #'' + config.lib.stylix.colors.base04 + ''; - } - - #workspaces button:hover { - color: #'' + config.lib.stylix.colors.base07 + ''; - } - - #workspaces button.active { - color: #'' + config.lib.stylix.colors.base08 + ''; - } - - #workspaces button.focused { - color: #'' + config.lib.stylix.colors.base0A + ''; - } - - #workspaces button.visible { - color: #'' + config.lib.stylix.colors.base05 + ''; - } - - #workspaces button.urgent { - color: #'' + config.lib.stylix.colors.base09 + ''; - } - - #battery, - #cpu, - #memory, - #disk, - #temperature, - #backlight, - #network, - #pulseaudio, - #wireplumber, - #custom-media, - #tray, - #mode, - #idle_inhibitor, - #scratchpad, - #custom-hyprprofileicon, - #custom-quit, - #custom-lock, - #custom-reboot, - #custom-power, - #mpd { - padding: 0 3px; - color: #'' + config.lib.stylix.colors.base07 + ''; - border: none; - border-radius: 8px; - } - - #custom-hyprprofileicon, - #custom-quit, - #custom-lock, - #custom-reboot, - #custom-power, - #idle_inhibitor { - background-color: transparent; - color: #'' + config.lib.stylix.colors.base04 + ''; - } - - #custom-hyprprofileicon:hover, - #custom-quit:hover, - #custom-lock:hover, - #custom-reboot:hover, - #custom-power:hover, - #idle_inhibitor:hover { - color: #'' + config.lib.stylix.colors.base07 + ''; - } - - #clock, #tray, #idle_inhibitor { - padding: 0 5px; - } - - #window, - #workspaces { - margin: 0 6px; - } - - /* If workspaces is the leftmost module, omit left margin */ - .modules-left > widget:first-child > #workspaces { - margin-left: 0; - } - - /* If workspaces is the rightmost module, omit right margin */ - .modules-right > widget:last-child > #workspaces { - margin-right: 0; - } - - #clock { - color: #'' + config.lib.stylix.colors.base0D + ''; - } - - #battery { - color: #'' + config.lib.stylix.colors.base0B + ''; - } - - #battery.charging, #battery.plugged { - color: #'' + config.lib.stylix.colors.base0C + ''; - } - - @keyframes blink { - to { - background-color: #'' + config.lib.stylix.colors.base07 + ''; - color: #'' + config.lib.stylix.colors.base00 + ''; - } - } - - #battery.critical:not(.charging) { - background-color: #'' + config.lib.stylix.colors.base08 + ''; - color: #'' + config.lib.stylix.colors.base07 + ''; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - label:focus { - background-color: #'' + config.lib.stylix.colors.base00 + ''; - } - - #cpu { - color: #'' + config.lib.stylix.colors.base0D + ''; - } - - #memory { - color: #'' + config.lib.stylix.colors.base0E + ''; - } - - #disk { - color: #'' + config.lib.stylix.colors.base0F + ''; - } - - #backlight { - color: #'' + config.lib.stylix.colors.base0A + ''; - } - - label.numlock { - color: #'' + config.lib.stylix.colors.base04 + ''; - } - - label.numlock.locked { - color: #'' + config.lib.stylix.colors.base0F + ''; - } - - #pulseaudio { - color: #'' + config.lib.stylix.colors.base0C + ''; - } - - #pulseaudio.muted { - color: #'' + config.lib.stylix.colors.base04 + ''; - } - - #tray > .passive { - -gtk-icon-effect: dim; - } - - #tray > .needs-attention { - -gtk-icon-effect: highlight; - } - - #idle_inhibitor { - color: #'' + config.lib.stylix.colors.base04 + ''; - } - - #idle_inhibitor.activated { - color: #'' + config.lib.stylix.colors.base0F + ''; - } - ''; - }; - home.file.".config/gtklock/style.css".text = '' - window { - background-image: url("''+config.stylix.image+''"); - background-size: auto 100%; - } - ''; - home.file.".config/nwg-launchers/nwggrid/style.css".text = '' - button, label, image { - background: none; - border-style: none; - box-shadow: none; - color: #'' + config.lib.stylix.colors.base07 + ''; - - font-size: 20px; - } - - button { - padding: 5px; - margin: 5px; - text-shadow: none; - } - - button:hover { - background-color: rgba('' + config.lib.stylix.colors.base07-rgb-r + "," + config.lib.stylix.colors.base07-rgb-g + "," + config.lib.stylix.colors.base07-rgb-b + "," + ''0.15); - } - - button:focus { - box-shadow: 0 0 10px; - } - - button:checked { - background-color: rgba('' + config.lib.stylix.colors.base07-rgb-r + "," + config.lib.stylix.colors.base07-rgb-g + "," + config.lib.stylix.colors.base07-rgb-b + "," + ''0.15); - } - - #searchbox { - background: none; - border-color: #'' + config.lib.stylix.colors.base07 + ''; - - color: #'' + config.lib.stylix.colors.base07 + ''; - - margin-top: 20px; - margin-bottom: 20px; - - font-size: 20px; - } - - #separator { - background-color: rgba('' + config.lib.stylix.colors.base00-rgb-r + "," + config.lib.stylix.colors.base00-rgb-g + "," + config.lib.stylix.colors.base00-rgb-b + "," + ''0.55); - - color: #'' + config.lib.stylix.colors.base07 + ''; - margin-left: 500px; - margin-right: 500px; - margin-top: 10px; - margin-bottom: 10px - } - - #description { - margin-bottom: 20px - } - ''; - home.file.".config/nwg-launchers/nwggrid/terminal".text = "alacritty -e"; - home.file.".config/nwg-drawer/drawer.css".text = '' - window { - background-color: rgba('' + config.lib.stylix.colors.base00-rgb-r + "," + config.lib.stylix.colors.base00-rgb-g + "," + config.lib.stylix.colors.base00-rgb-b + "," + ''0.55); - color: #'' + config.lib.stylix.colors.base07 + '' - } - - /* search entry */ - entry { - background-color: rgba('' + config.lib.stylix.colors.base01-rgb-r + "," + config.lib.stylix.colors.base01-rgb-g + "," + config.lib.stylix.colors.base01-rgb-b + "," + ''0.45); - } - - button, image { - background: none; - border: none - } - - button:hover { - background-color: rgba('' + config.lib.stylix.colors.base02-rgb-r + "," + config.lib.stylix.colors.base02-rgb-g + "," + config.lib.stylix.colors.base02-rgb-b + "," + ''0.45); - } - - /* in case you wanted to give category buttons a different look */ - #category-button { - margin: 0 10px 0 10px - } - - #pinned-box { - padding-bottom: 5px; - border-bottom: 1px dotted; - border-color: #'' + config.lib.stylix.colors.base07 + ''; - } - - #files-box { - padding: 5px; - border: 1px dotted gray; - border-radius: 15px - border-color: #'' + config.lib.stylix.colors.base07 + ''; - } - ''; - - services.udiskie.enable = true; - services.udiskie.tray = "always"; - programs.fuzzel.enable = true; - programs.fuzzel.package = pkgs.fuzzel; - programs.fuzzel.settings = { - main = { - font = userSettings.font + ":size=20"; - dpi-aware = "no"; - show-actions = "yes"; - terminal = "${pkgs.alacritty}/bin/alacritty"; - }; - colors = { - background = config.lib.stylix.colors.base00 + "bf"; - text = config.lib.stylix.colors.base07 + "ff"; - match = config.lib.stylix.colors.base05 + "ff"; - selection = config.lib.stylix.colors.base08 + "ff"; - selection-text = config.lib.stylix.colors.base00 + "ff"; - selection-match = config.lib.stylix.colors.base05 + "ff"; - border = config.lib.stylix.colors.base08 + "ff"; - }; - border = { - width = 3; - radius = 7; - }; - }; - services.fnott.enable = true; - services.fnott.settings = { - main = { - anchor = "bottom-right"; - stacking-order = "top-down"; - min-width = 400; - title-font = userSettings.font + ":size=14"; - summary-font = userSettings.font + ":size=12"; - body-font = userSettings.font + ":size=11"; - border-size = 0; - }; - low = { - background = config.lib.stylix.colors.base00 + "e6"; - title-color = config.lib.stylix.colors.base03 + "ff"; - summary-color = config.lib.stylix.colors.base03 + "ff"; - body-color = config.lib.stylix.colors.base03 + "ff"; - idle-timeout = 150; - max-timeout = 30; - default-timeout = 8; - }; - normal = { - background = config.lib.stylix.colors.base00 + "e6"; - title-color = config.lib.stylix.colors.base07 + "ff"; - summary-color = config.lib.stylix.colors.base07 + "ff"; - body-color = config.lib.stylix.colors.base07 + "ff"; - idle-timeout = 150; - max-timeout = 30; - default-timeout = 8; - }; - critical = { - background = config.lib.stylix.colors.base00 + "e6"; - title-color = config.lib.stylix.colors.base08 + "ff"; - summary-color = config.lib.stylix.colors.base08 + "ff"; - body-color = config.lib.stylix.colors.base08 + "ff"; - idle-timeout = 0; - max-timeout = 0; - default-timeout = 0; - }; - }; -} diff --git a/user/wm/hyprland/hyprprofiles/hyprprofiles.nix b/user/wm/hyprland/hyprprofiles/hyprprofiles.nix deleted file mode 100644 index e73b4025..00000000 --- a/user/wm/hyprland/hyprprofiles/hyprprofiles.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ config, lib, pkgs, dmenuCmd ? "rofi -dmenu", ... }: -let - dmenuScript = '' - #!/bin/sh - choice="$(\ls ~/.config/hyprprofiles | ''+dmenuCmd+'')"; - hyprprofile $choice; - ''; -in -{ - home.packages = [ - (pkgs.writeScriptBin "hyprprofile" '' - #!/bin/sh - prevprofile="$(cat ~/.hyprprofile)" - newprofile="$1" - if [ $# -eq 1 ]; then - if [ $newprofile = "Default" ]; then - echo "" > ~/.hyprprofile; - else - echo $newprofile > ~/.hyprprofile; - fi - if [ -f ~/.config/hyprprofiles/$prevprofile/exit-hook.sh ]; then - ~/.config/hyprprofiles/$prevprofile/exit-hook.sh; - fi - if [ -f ~/.config/hyprprofiles/$newprofile/start-hook.sh ]; then - ~/.config/hyprprofiles/$newprofile/start-hook.sh; - fi - fi - '') - (pkgs.writeScriptBin "qutebrowser-hyprprofile" '' - #!/bin/sh - profile="$(cat ~/.hyprprofile)" - if [[ $profile ]]; then - container-open $profile $1; - else - qutebrowser --qt-flag ignore-gpu-blacklist --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag enable-accelerated-2d-canvas --qt-flag num-raster-threads=4 $1; - fi - '') - (pkgs.makeDesktopItem { - name = "qutebrowser-hyprprofile"; - desktopName = "Qutebrowser Hyprprofile"; - exec = "qutebrowser-hyprprofile %u"; - categories = ["Network" "WebBrowser"]; - keywords = ["Browser"]; - terminal = false; - type = "Application"; - noDisplay = false; - icon = "qutebrowser"; - }) - (pkgs.writeScriptBin "hyprprofile-dmenu" dmenuScript) - ]; - xdg.mimeApps.defaultApplications = lib.mkForce { - "text/html" = "qutebrowser-hyprprofile.desktop"; - "x-scheme-handler/http" = "qutebrowser-hyprprofile.desktop"; - "x-scheme-handler/https" = "qutebrowser-hyprprofile.desktop"; - "x-scheme-handler/about" = "qutebrowser-hyprprofile.desktop"; - "x-scheme-handler/unknown" = "qutebrowser-hyprprofile.desktop"; - }; - home.file.".config/hyprprofiles/" = { - source = ./profiles; - recursive = true; - executable = true; - }; -} diff --git a/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh deleted file mode 100755 index 5af5b69a..00000000 --- a/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -hyprctl keyword unbind SUPER,S; -hyprctl keyword bind SUPER,S,exec,qutebrowser-hyprprofile; -emacsclient --eval '(org-roam-switch-db "Bard.p" t)' diff --git a/user/wm/hyprland/patches/noactiveclients.patch b/user/wm/hyprland/patches/noactiveclients.patch deleted file mode 100644 index 8f8c458f..00000000 --- a/user/wm/hyprland/patches/noactiveclients.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/main.go b/main.go -index 0c980c9..4e6dfbf 100644 ---- a/main.go -+++ b/main.go -@@ -103,11 +103,6 @@ func buildMainBox(vbox *gtk.Box) { - allItems = append(allItems, cntPin) - } - } -- for _, cntTask := range clients { -- if !isIn(allItems, cntTask.Class) && !strings.Contains(*launcherCmd, cntTask.Class) && cntTask.Class != "" { -- allItems = append(allItems, cntTask.Class) -- } -- } - - divider := 1 - if len(allItems) > 0 { -@@ -155,34 +150,6 @@ func buildMainBox(vbox *gtk.Box) { - } - - alreadyAdded = nil -- for _, t := range clients { -- // For some time after killing a client, it's still being returned by 'j/clients', however w/o the Class value. -- // Let's filter the ghosts out. -- if !inPinned(t.Class) && t.Class != "" { -- instances := taskInstances(t.Class) -- if len(instances) == 1 { -- button := taskButton(t, instances) -- mainBox.PackStart(button, false, false, 0) -- if t.Class == activeClient.Class && !*autohide { -- button.SetProperty("name", "active") -- } else { -- button.SetProperty("name", "") -- } -- } else if !isIn(alreadyAdded, t.Class) { -- button := taskButton(t, instances) -- mainBox.PackStart(button, false, false, 0) -- if t.Class == activeClient.Class && !*autohide { -- button.SetProperty("name", "active") -- } else { -- button.SetProperty("name", "") -- } -- alreadyAdded = append(alreadyAdded, t.Class) -- clientMenu(t.Class, instances) -- } else { -- continue -- } -- } -- } - - if !*noLauncher && *launcherCmd != "" { - button, _ := gtk.ButtonNew() diff --git a/user/wm/hyprland/patches/waybarbatupdate.patch b/user/wm/hyprland/patches/waybarbatupdate.patch deleted file mode 100644 index 364c92eb..00000000 --- a/user/wm/hyprland/patches/waybarbatupdate.patch +++ /dev/null @@ -1,192 +0,0 @@ -From f4608b3e312448b37a8f9d6351154026e67c680a Mon Sep 17 00:00:00 2001 -From: schmop -Date: Thu, 25 Jul 2024 01:40:49 +0200 -Subject: [PATCH] Fix battery status changes not being detected - -Historically we listened to /sys/class/poewr_supply inotify events, -which does not seem to work anymore. -We switched now to udev netlink kernel events. ---- - include/modules/battery.hpp | 8 +++++-- - include/util/udev_deleter.hpp | 21 ++++++++++++++++++ - src/modules/battery.cpp | 40 +++++++++++++++++++--------------- - src/util/backlight_backend.cpp | 17 +-------------- - 4 files changed, 51 insertions(+), 35 deletions(-) - create mode 100644 include/util/udev_deleter.hpp - -diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp -index 8e1a2ad2b..fc403be05 100644 ---- a/include/modules/battery.hpp -+++ b/include/modules/battery.hpp -@@ -5,8 +5,11 @@ - #include - #if defined(__linux__) - #include -+#include "util/udev_deleter.hpp" - #endif - -+#include -+ - #include - #include - #include -@@ -36,11 +39,12 @@ class Battery : public ALabel { - const std::string formatTimeRemaining(float hoursRemaining); - void setBarClass(std::string&); - -- int global_watch; - std::map batteries_; -+ std::unique_ptr udev_; -+ std::array poll_fds_; -+ std::unique_ptr mon_; - fs::path adapter_; - int battery_watch_fd_; -- int global_watch_fd_; - std::mutex battery_list_mutex_; - std::string old_status_; - bool warnFirstTime_{true}; -diff --git a/include/util/udev_deleter.hpp b/include/util/udev_deleter.hpp -new file mode 100644 -index 000000000..b2f1e538b ---- /dev/null -+++ b/include/util/udev_deleter.hpp -@@ -0,0 +1,21 @@ -+#pragma once -+ -+#include -+ -+namespace waybar::util { -+struct UdevDeleter { -+ void operator()(udev *ptr) const { udev_unref(ptr); } -+}; -+ -+struct UdevDeviceDeleter { -+ void operator()(udev_device *ptr) const { udev_device_unref(ptr); } -+}; -+ -+struct UdevEnumerateDeleter { -+ void operator()(udev_enumerate *ptr) const { udev_enumerate_unref(ptr); } -+}; -+ -+struct UdevMonitorDeleter { -+ void operator()(udev_monitor *ptr) const { udev_monitor_unref(ptr); } -+}; -+} // namespace waybar::util -\ No newline at end of file -diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp -index d87cc6129..bad72e6b0 100644 ---- a/src/modules/battery.cpp -+++ b/src/modules/battery.cpp -@@ -5,6 +5,9 @@ - #include - #endif - #include -+#include -+#include -+#include - - #include - waybar::modules::Battery::Battery(const std::string& id, const Bar& bar, const Json::Value& config) -@@ -14,17 +17,18 @@ waybar::modules::Battery::Battery(const std::string& id, const Bar& bar, const J - if (battery_watch_fd_ == -1) { - throw std::runtime_error("Unable to listen batteries."); - } -- -- global_watch_fd_ = inotify_init1(IN_CLOEXEC); -- if (global_watch_fd_ == -1) { -- throw std::runtime_error("Unable to listen batteries."); -+ udev_ = std::unique_ptr(udev_new()); -+ if (udev_ == nullptr) { -+ throw std::runtime_error("udev_new failed"); - } -- -- // Watch the directory for any added or removed batteries -- global_watch = inotify_add_watch(global_watch_fd_, data_dir_.c_str(), IN_CREATE | IN_DELETE); -- if (global_watch < 0) { -- throw std::runtime_error("Could not watch for battery plug/unplug"); -+ mon_ = std::unique_ptr(udev_monitor_new_from_netlink(udev_.get(), "kernel")); -+ if (mon_ == nullptr) { -+ throw std::runtime_error("udev monitor new failed"); - } -+ if (udev_monitor_filter_add_match_subsystem_devtype(mon_.get(), "power_supply", nullptr) < 0) { -+ throw std::runtime_error("udev failed to add monitor filter"); -+ } -+ udev_monitor_enable_receiving(mon_.get()); - #endif - worker(); - } -@@ -33,11 +37,6 @@ waybar::modules::Battery::~Battery() { - #if defined(__linux__) - std::lock_guard guard(battery_list_mutex_); - -- if (global_watch >= 0) { -- inotify_rm_watch(global_watch_fd_, global_watch); -- } -- close(global_watch_fd_); -- - for (auto it = batteries_.cbegin(), next_it = it; it != batteries_.cend(); it = next_it) { - ++next_it; - auto watch_id = (*it).second; -@@ -74,12 +73,18 @@ void waybar::modules::Battery::worker() { - dp.emit(); - }; - thread_battery_update_ = [this] { -- struct inotify_event event = {0}; -- int nbytes = read(global_watch_fd_, &event, sizeof(event)); -- if (nbytes != sizeof(event) || event.mask & IN_IGNORED) { -+ poll_fds_[0].revents = 0; -+ poll_fds_[0].events = POLLIN; -+ poll_fds_[0].fd = udev_monitor_get_fd(mon_.get()); -+ int ret = poll(poll_fds_.data(), poll_fds_.size(), -1); -+ if (ret < 0) { - thread_.stop(); - return; - } -+ if ((poll_fds_[0].revents & POLLIN) != 0) { -+ signalfd_siginfo signal_info; -+ read(poll_fds_[0].fd, &signal_info, sizeof(signal_info)); -+ } - refreshBatteries(); - dp.emit(); - }; -@@ -668,6 +673,7 @@ auto waybar::modules::Battery::update() -> void { - status = getAdapterStatus(capacity); - } - auto status_pretty = status; -+ puts(status.c_str()); - // Transform to lowercase and replace space with dash - std::transform(status.begin(), status.end(), status.begin(), - [](char ch) { return ch == ' ' ? '-' : std::tolower(ch); }); -diff --git a/src/util/backlight_backend.cpp b/src/util/backlight_backend.cpp -index bb102cd93..df6afd564 100644 ---- a/src/util/backlight_backend.cpp -+++ b/src/util/backlight_backend.cpp -@@ -1,4 +1,5 @@ - #include "util/backlight_backend.hpp" -+#include "util/udev_deleter.hpp" - - #include - #include -@@ -29,22 +30,6 @@ class FileDescriptor { - int fd_; - }; - --struct UdevDeleter { -- void operator()(udev *ptr) { udev_unref(ptr); } --}; -- --struct UdevDeviceDeleter { -- void operator()(udev_device *ptr) { udev_device_unref(ptr); } --}; -- --struct UdevEnumerateDeleter { -- void operator()(udev_enumerate *ptr) { udev_enumerate_unref(ptr); } --}; -- --struct UdevMonitorDeleter { -- void operator()(udev_monitor *ptr) { udev_monitor_unref(ptr); } --}; -- - void check_eq(int rc, int expected, const char *message = "eq, rc was: ") { - if (rc != expected) { - throw std::runtime_error(fmt::format(fmt::runtime(message), rc)); diff --git a/user/wm/hyprland/patches/waybarpaupdate.patch b/user/wm/hyprland/patches/waybarpaupdate.patch deleted file mode 100644 index f1c22cd2..00000000 --- a/user/wm/hyprland/patches/waybarpaupdate.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/include/util/audio_backend.hpp b/include/util/audio_backend.hpp -index 2f53103e5..3737ae264 100644 ---- a/include/util/audio_backend.hpp -+++ b/include/util/audio_backend.hpp -@@ -38,6 +38,8 @@ class AudioBackend { - std::string desc_; - std::string monitor_; - std::string current_sink_name_; -+ std::string default_sink_name; -+ bool default_sink_running_; - bool current_sink_running_; - // SOURCE - uint32_t source_idx_{0}; -diff --git a/src/util/audio_backend.cpp b/src/util/audio_backend.cpp -index 3d90b6d5a..73aac148b 100644 ---- a/src/util/audio_backend.cpp -+++ b/src/util/audio_backend.cpp -@@ -1,9 +1,12 @@ - #include "util/audio_backend.hpp" - - #include -+#include - #include -+#include - #include - #include -+#include - - #include - #include -@@ -139,6 +142,10 @@ void AudioBackend::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, i - void *data) { - if (i == nullptr) return; - -+ auto running = i->state == PA_SINK_RUNNING; -+ auto idle = i->state == PA_SINK_IDLE; -+ spdlog::trace("Sink name {} Running:[{}] Idle:[{}]", i->name, running, idle); -+ - auto *backend = static_cast(data); - - if (!backend->ignored_sinks_.empty()) { -@@ -155,11 +162,19 @@ void AudioBackend::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, i - } - } - -+ backend->default_sink_running_ = backend->default_sink_name == i->name && -+ (i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE); -+ -+ if (i->name != backend->default_sink_name && !backend->default_sink_running_) { -+ return; -+ } -+ - if (backend->current_sink_name_ == i->name) { -- backend->current_sink_running_ = i->state == PA_SINK_RUNNING; -+ backend->current_sink_running_ = (i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE); - } - -- if (!backend->current_sink_running_ && i->state == PA_SINK_RUNNING) { -+ if (!backend->current_sink_running_ && -+ (i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE)) { - backend->current_sink_name_ = i->name; - backend->current_sink_running_ = true; - } -@@ -207,5 +222,6 @@ void AudioBackend::sourceInfoCb(pa_context * /*context*/, const pa_source_info * - void AudioBackend::serverInfoCb(pa_context *context, const pa_server_info *i, void *data) { - auto *backend = static_cast(data); - backend->current_sink_name_ = i->default_sink_name; -+ backend->default_sink_name = i->default_sink_name; - backend->default_source_name_ = i->default_source_name; - - pa_context_get_sink_info_list(context, sinkInfoCb, data); diff --git a/user/wm/input/nihongo.nix b/user/wm/input/nihongo.nix deleted file mode 100644 index b496532c..00000000 --- a/user/wm/input/nihongo.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ pkgs, ... }: - -{ - i18n.inputMethod = { - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-mozc - fcitx5-gtk - ]; - }; - home.file.".config/fcitx5/config".text = '' - [Hotkey] - # Enumerate when press trigger key repeatedly - EnumerateWithTriggerKeys=True - # Temporally switch between first and current Input Method - AltTriggerKeys= - # Enumerate Input Method Forward - EnumerateForwardKeys= - # Enumerate Input Method Backward - EnumerateBackwardKeys= - # Skip first input method while enumerating - EnumerateSkipFirst=False - # Toggle embedded preedit - TogglePreedit= - - [Hotkey/TriggerKeys] - 0=Super+comma - - [Hotkey/EnumerateGroupForwardKeys] - 0=Super+space - - [Hotkey/EnumerateGroupBackwardKeys] - 0=Shift+Super+space - - [Hotkey/ActivateKeys] - 0=Hangul_Hanja - - [Hotkey/DeactivateKeys] - 0=Hangul_Romaja - - [Hotkey/PrevPage] - 0=Up - - [Hotkey/NextPage] - 0=Down - - [Hotkey/PrevCandidate] - 0=Shift+Tab - - [Hotkey/NextCandidate] - 0=Tab - - [Behavior] - # Active By Default - ActiveByDefault=False - # Share Input State - ShareInputState=No - # Show preedit in application - PreeditEnabledByDefault=True - # Show Input Method Information when switch input method - ShowInputMethodInformation=True - # Show Input Method Information when changing focus - showInputMethodInformationWhenFocusIn=False - # Show compact input method information - CompactInputMethodInformation=True - # Show first input method information - ShowFirstInputMethodInformation=True - # Default page size - DefaultPageSize=5 - # Override Xkb Option - OverrideXkbOption=False - # Custom Xkb Option - CustomXkbOption= - # Force Enabled Addons - EnabledAddons= - # Force Disabled Addons - DisabledAddons= - # Preload input method to be used by default - PreloadInputMethod=True - # Allow input method in the password field - AllowInputMethodForPassword=False - # Show preedit text when typing password - ShowPreeditForPassword=False - # Interval of saving user data in minutes - AutoSavePeriod=30 - ''; -# home.file.".config/fcitx5/profile".text = '' -# [Groups/0] -# # Group Name -# Name=Default -# # Layout -# Default Layout=us -# # Default Input Method -# DefaultIM=mozc -# -# [Groups/0/Items/0] -# # Name -# Name=keyboard-us -# # Layout -# Layout= -# -# [Groups/0/Items/1] -# # Name -# Name=mozc -# # Layout -# Layout= -# -# [GroupOrder] -# 0=Default -# ''; -}