diff --git a/flake.lock b/flake.lock index 1276e79..2436ed5 100644 --- a/flake.lock +++ b/flake.lock @@ -257,29 +257,6 @@ "type": "github" } }, - "nur": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1751894474, - "narHash": "sha256-0TIIRikLAi042jNgd+gLKYCji1p4uetlmm4gROjrlEw=", - "owner": "nix-community", - "repo": "NUR", - "rev": "85c0c20851e9250e587c33023b788f66b608ca36", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, "nvf": { "inputs": { "flake-parts": [ @@ -328,7 +305,6 @@ "make-shell": "make-shell", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs", - "nur": "nur", "nvf": "nvf", "sops-nix": "sops-nix", "systems": "systems", diff --git a/flake.nix b/flake.nix index bdb24b8..19d392c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,40 +1,34 @@ { - outputs = - inputs: - inputs.flake-parts.lib.mkFlake { inherit inputs; } ( - (inputs.import-tree ./nix) - // { - systems = import inputs.systems; - flake.paths.root = ./.; - } - ); inputs = { - ### SYSTEM ### - - # systems provides a list of supported nix systems. - systems.url = "github:nix-systems/default"; # nixos-unstable provides a binary cache for all packages. nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - # impermanence provides a nice abstraction over linking files from /persist - impermanence.url = "github:nix-community/impermanence"; + # systems provides a list of supported nix systems. + systems.url = "github:nix-systems/default"; # flake-parts lets us define flake modules. flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; + # home-manager manages our user packages and dotfiles + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # disko provides declarative drive partitioning disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; + # impermanence provides a nice abstraction over linking files from /persist + impermanence.url = "github:nix-community/impermanence"; + + ### FLAKE PARTS MODULES ### + # sops-nix lets us version control secrets like passwords and api keys sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - - ### FLAKE PARTS MODULES ### - # import-tree imports all nix files in a given directory. import-tree.url = "github:vic/import-tree"; # files lets us write text files and automatically add checks for them @@ -56,24 +50,12 @@ }; }; - ### HOME-MANAGER ### - - # home-manager manages our user packages and dotfiles - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + ### PROGRAMS ### # nix-index-database indexes the nixpkgs binaries for use with comma nix-index-database = { url = "github:nix-community/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; - # the nix user repository for mainly firefox extensions - nur = { - url = "github:nix-community/NUR"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-parts.follows = "flake-parts"; - }; # nvf provides modules to wrap neovim nvf = { url = "github:notashelf/nvf"; @@ -87,7 +69,7 @@ }; ### DEDUPE ### - + # The following are not used in the flake dedupe_flake-compat.url = "github:edolstra/flake-compat"; dedupe_flake-utils = { url = "github:numtide/flake-utils"; @@ -99,4 +81,14 @@ inputs.nixpkgs.follows = "nixpkgs"; }; }; + + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } ( + (inputs.import-tree ./nix) + // { + systems = import inputs.systems; + flake.paths.root = ./.; + } + ); } diff --git a/nix/configurations.nix b/nix/configurations.nix index aeb2592..9375b15 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -22,10 +22,7 @@ let name: value: if class == "nixos" then nixosSystem { - specialArgs = { - inherit (value) graphical; - hostName = name; - }; + specialArgs.hostName = name; modules = [ cfg.modules.nixos.default inputs.home-manager.nixosModules.home-manager diff --git a/nix/homes/rafiq/desktop/_hyprland/decoration.nix b/nix/homes/rafiq/desktop/_hyprland/decoration.nix deleted file mode 100644 index ee3d444..0000000 --- a/nix/homes/rafiq/desktop/_hyprland/decoration.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - animation = [ "workspaces, 1, 1, default" ]; - general = { - border_size = 2; - gaps_in = 0; - gaps_out = 0; - resize_on_border = true; - }; - decoration = { - rounding = 10; - rounding_power = 2; - inactive_opacity = 0.9; - }; -} diff --git a/nix/homes/rafiq/desktop/_hyprland/keybinds.nix b/nix/homes/rafiq/desktop/_hyprland/keybinds.nix deleted file mode 100644 index 9e75db1..0000000 --- a/nix/homes/rafiq/desktop/_hyprland/keybinds.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ pkgs, ... }: -{ - "$hypr" = "CTRL_SUPER_ALT_SHIFT"; - "$meh" = "CONTROL_SHIFT_ALT"; - bind = [ - "$hypr, Q, exec, uwsm stop" - "SUPER, W, killactive" - - "SUPER, return, exec, uwsm app -- $TERMINAL" - "SUPER, O, exec, uwsm app -- $BROWSER" - "SUPER, Escape, exec, uwsm app -- $LOCKSCREEN" - #TODO:add file browser - - #TODO: make it directional - "SUPER, H, cyclenext, visible" - "SUPER, L, cyclenext, visible prev" - "SUPER_ALT, H, movewindow, l" - "SUPER_ALT, J, movewindow, d" - "SUPER_ALT, K, movewindow, u" - "SUPER_ALT, L, movewindow, r" - "ALT_SHIFT, H, resizeactive, -10% 0" - "ALT_SHIFT, J, resizeactive, 0 -10%" - "ALT_SHIFT, K, resizeactive, 0 10%" - "ALT_SHIFT, L, resizeactive, 10% 0" - "SUPER_CTRL, H, workspace, r-1" - "SUPER_CTRL, L, workspace, r+1" - "$hypr, H, movetoworkspace, r-1" - "$hypr, L, movetoworkspace, r+1" - - "$hypr, V, togglefloating" - ]; - - bindr = [ - # Activates on SUPER without any other modifier - "SUPER, Super_L, exec, uwsm app -- $($LAUNCHER --launch-prefix=\"uwsm app -- \")" - ]; - - bindle = [ - "SUPER, 6, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-" - "SUPER, 7, exec, ${pkgs.playerctl}/bin/playerctl previous" - "SUPER, 8, exec, ${pkgs.playerctl}/bin/playerctl -a play-pause" - "SUPER, 9, exec, ${pkgs.playerctl}/bin/playerctl next" - "SUPER, 0, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" - - "ALT, mouse_up, resizeactive, 10% 10%" - "ALT, mouse_down, resizeactive, -10% -10%" - ]; - - bindm = [ - "ALT, mouse:272, movewindow" - "ALT, mouse:273, resizeactive" - ]; - bindc = [ - "ALT, mouse:272, togglefloating" - ]; -} diff --git a/nix/homes/rafiq/desktop/default.nix b/nix/homes/rafiq/desktop/default.nix deleted file mode 100644 index 0e4bf07..0000000 --- a/nix/homes/rafiq/desktop/default.nix +++ /dev/null @@ -1,200 +0,0 @@ -{ lib, inputs, ... }: -{ - allowedUnfreePackages = [ - "stremio-shell" - "stremio-server" - ]; - flake.homes.rafiq = - { pkgs, config, ... }: - let - inherit (lib.modules) mkMerge mkIf; - inherit (builtins) map listToAttrs; - inherit (lib.lists) findFirstIndex; - inherit (inputs.nur.legacyPackages.${pkgs.stdenv.hostPlatform.system}.repos.rycee) firefox-addons; - profiles = listToAttrs ( - map (name: { - inherit name; - # If there are duplicate profile names, findFirstIndex will cause issues. - value = profileCfg (findFirstIndex (x: x == name) null syncedProfiles); - }) syncedProfiles - ); - syncedProfiles = [ - "rafiq" - "test" - ]; - profileCfg = id: { - inherit id; - settings."extensions.autoDisableScopes" = 0; # Auto enable extensions - extensions = { - force = true; - packages = with firefox-addons; [ - darkreader - gesturefy - sponsorblock - ublock-origin - ]; - }; - }; - in - mkIf config.graphical { - persistDirs = [ - "docs" - "repos" - "vids" - "tmp" - ".cache/Smart Code ltd/Stremio" - ".local/share/Smart Code ltd/Stremio" - ".mozilla/firefox" - ".tor project" - ]; - home = { - packages = with pkgs; [ - stremio - tor-browser - vlc - wl-clipboard-rs - ]; - sessionVariables = { - BROWSER = "firefox"; - LAUNCHER = "fuzzel"; - LOCKSCREEN = "hyprlock"; - NOTIFICATION_DAEMON = "mako"; - TERMINAL = "ghostty"; - STATUS_BAR = "waybar"; - }; - }; - programs = { - fuzzel.enable = true; - obs-studio.enable = true; - vesktop.enable = true; - thunderbird.enable = true; - thunderbird.profiles.rafiq.isDefault = true; - firefox = { - enable = true; - inherit profiles; - }; - hyprlock.settings = { - general.hide_cursor = true; - general.ignore_empty_input = true; - background.blur_passes = 5; - background.blur_size = 5; - label = { - text = ''hi, $USER.''; - font_size = 32; - position = "0, 0"; - halign = "center"; - valign = "center"; - zindex = 1; - shadow_passes = 5; - shadow_size = 5; - }; - input-field = { - placeholder_text = ""; - fade_on_empty = true; - size = "200, 45"; - position = "0, -5%"; - halign = "center"; - valign = "center"; - zindex = 1; - shadow_passes = 5; - shadow_size = 5; - }; - }; - ghostty = { - enable = true; - settings = { - confirm-close-surface = false; - }; - }; - waybar = { - enable = true; - settings = [ - { - layer = "top"; - modules-left = [ - "pulseaudio" - ]; - modules-right = [ - "battery" - "clock" - ]; - "pulseaudio" = { - format = "{icon} {volume}%"; - format-muted = ""; - format-icons.default = [ - "" - "" - ]; - on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - }; - "clock" = { - interval = 1; - format = "{:%F %T}"; - }; - "battery" = { - interval = 1; - bat-compatibility = true; - }; - } - ]; - style = # css - '' - window#waybar { - background-color: rgba(0, 0, 0, 0); - } - - #pulseaudio, - #battery, - #clock { - padding-top: 5px; - padding-bottom: 5px; - padding-right: 5px; - color: #ffffff; - } - ''; - }; - - }; - services = { - mako.enable = true; - mako.settings.default-timeout = 10000; - }; - wayland.windowManager.hyprland = { - enable = true; - # This is needed for UWSM - systemd.enable = false; - # Null the packages since we use them system wide - package = null; - portalPackage = null; - # settings.monitor = [ - # "${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}" - # ]; - - settings = mkMerge [ - (import ./_hyprland/decoration.nix) - (import ./_hyprland/keybinds.nix { inherit pkgs; }) - { - ecosystem.no_update_news = true; - xwayland.force_zero_scaling = true; - monitor = [ ", preferred, auto, 1" ]; - exec-once = [ - "uwsm app -- $LOCKSCREEN" - "uwsm app -- $NOTIFICATION_DAEMON" - "uwsm app -- $STATUS_BAR" - ]; - } - ]; - }; - # xdg.configFile."uwsm/env".text = # sh - # '' - # # Force apps to scale right with Wayland - # export GDK_SCALE=${mainMonitor.scale} - # export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale} - # ''; - # xdg.configFile."uwsm/env-hyprland".text = # sh - # '' - # export GDK_SCALE=${mainMonitor.scale} - # export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale} - # ''; - }; -} diff --git a/nix/manifest.nix b/nix/manifest.nix index 3f4af3e..eb26d1f 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -1,3 +1,15 @@ +let + testCfg = { + machine = { + bluetooth.enable = true; + usb.automount = true; + virtualisation.podman = { + enable = true; + distrobox.enable = true; + }; + }; + }; +in { flake.manifest = { users.rafiq = { @@ -9,7 +21,6 @@ }; hosts.nixos = { nemesis = { - graphical = true; machine = { platform = "amd"; gpu = "nvidia"; @@ -23,13 +34,14 @@ } ]; }; + extraCfg = testCfg; }; apollo = { - graphical = false; machine = { platform = "intel"; root.drive = "/dev/disk/by-id/nvme-eui.002538d221b47b01"; }; + extraCfg = testCfg; }; }; }; diff --git a/nix/modules/graphical/default.nix b/nix/modules/graphical/default.nix deleted file mode 100644 index 78874bf..0000000 --- a/nix/modules/graphical/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ lib, ... }: -let - inherit (lib.modules) mkIf; - inherit (lib.options) mkEnableOption; -in -{ - flake.modules.nixos.default = - { graphical, ... }: - { - config = mkIf graphical { - home-manager.sharedModules = [ { graphical = true; } ]; - services.pipewire = { - enable = true; - pulse.enable = true; - }; - }; - }; - flake.modules.homeManager.default.options.graphical = mkEnableOption ""; -} diff --git a/nix/modules/machine/default.nix b/nix/modules/machine/default.nix index 8ad3f7a..e657fa2 100644 --- a/nix/modules/machine/default.nix +++ b/nix/modules/machine/default.nix @@ -11,10 +11,8 @@ in in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - options.machine = { - bluetooth.enable = mkEnableOption ""; - usb.automount = mkEnableOption ""; - }; + options.machine.bluetooth.enable = mkEnableOption ""; + options.machine.usb.automount = mkEnableOption ""; config = mkMerge [ (mkIf cfg.usb.automount { services.udisks2.enable = true;