From 4a914da23e26337985402420d8ff20fd0b566f83 Mon Sep 17 00:00:00 2001 From: Ethan Simmons Date: Fri, 7 Jun 2024 18:47:10 -0500 Subject: [PATCH] Update sway config and flake.nix --- features/common.nix | 26 -------------------- features/gaming.nix | 13 ---------- features/gui.nix | 33 ------------------------- features/laptop.nix | 5 ---- features/networking.nix | 8 ------ flake.lock | 38 +++++++++++++++++++++++++++-- flake.nix | 35 +++++++++++++++++--------- hosts/ankaa/system.nix | 11 +++------ modules/home/sway.nix | 27 ++++++++++++++------ modules/nix/common.nix | 20 +++++++++++++++ modules/nix/games.nix | 2 +- modules/nix/networking.nix | 7 +++--- overlays/default.nix | 3 +++ overlays/gamescope-last-working.nix | 11 +++++++++ 14 files changed, 122 insertions(+), 117 deletions(-) delete mode 100644 features/common.nix delete mode 100644 features/gaming.nix delete mode 100644 features/gui.nix delete mode 100644 features/laptop.nix delete mode 100644 features/networking.nix create mode 100644 overlays/default.nix create mode 100644 overlays/gamescope-last-working.nix diff --git a/features/common.nix b/features/common.nix deleted file mode 100644 index 1a06b89..0000000 --- a/features/common.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, pkgs, localPackages, ... }: { - - imports = []; - - environment.systemPackages = with pkgs; [ - curl - wget - git - killall - vim - eza - ripgrep - fzf - ncdu - btop - nil - ]; - - programs.neovim = { - enable = true; - defaultEditor = true; - }; - - programs.fish.enable = true; - -} diff --git a/features/gaming.nix b/features/gaming.nix deleted file mode 100644 index 684017d..0000000 --- a/features/gaming.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, pkgs, localPackages, ... }: { - environment.systemPackages = with pkgs; with localPackages.x86_64-linux; [ - protonup-qt - vesktop - lutris - gamescope-old - wine - ]; - - programs.steam = { - enable = true; - }; -} diff --git a/features/gui.nix b/features/gui.nix deleted file mode 100644 index d064709..0000000 --- a/features/gui.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib, pkgs, localPackages, ... }: { - - environment.systemPackages = with pkgs; with localPackages.x86_64-linux; [ - wl-clipboard - grim - slurp - swaybg - waybar - alacritty - kickoff - kickoff-dot-desktop - wayland-pipewire-idle-inhibit - firefox - mpv - cinny-desktop - thunderbird - protonmail-bridge - libsecret - ]; - - programs.sway.enable = true; - programs.thunar.enable = true; - programs.dconf.enable = true; - - services.gnome.gnome-keyring.enable = true; - services.dbus.packages = [ pkgs.gnome.seahorse ]; - - xdg.portal.wlr.enable = true; - - fonts.packages = with pkgs; [ - font-awesome - ]; -} diff --git a/features/laptop.nix b/features/laptop.nix deleted file mode 100644 index 441067d..0000000 --- a/features/laptop.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ lib, pkgs, localPackages, ... }: - -{ - programs.light.enable = true; -} diff --git a/features/networking.nix b/features/networking.nix deleted file mode 100644 index 881148d..0000000 --- a/features/networking.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ lib, pkgs, localPackages, ... }: { - - environment.systemPackages = with pkgs; [ - ldns - wireguard-tools - ]; - -} diff --git a/flake.lock b/flake.lock index ce2ac42..8e254eb 100644 --- a/flake.lock +++ b/flake.lock @@ -2,8 +2,8 @@ "nodes": { "currentSystem": { "locked": { - "lastModified": 1717720375, - "narHash": "sha256-nbltg3gor6ZPWg1zQXGAgIHqJ05lfvJmwaJRjI+HYws=", + "lastModified": 1717721450, + "narHash": "sha256-V2OISNdFOCaFrUjA6fLVe3HsZC9nn7vMjGfhKSHTRIk=", "path": "/etc/nixos/hostname", "type": "path" }, @@ -12,6 +12,24 @@ "type": "path" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -51,9 +69,25 @@ "root": { "inputs": { "currentSystem": "currentSystem", + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 23af982..f071b9f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,15 +3,21 @@ inputs = { currentSystem.url = "path:/etc/nixos/hostname"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = inputs@{ self, currentSystem, nixpkgs, home-manager, ... }: let + outputs = inputs@{ self, currentSystem, nixpkgs, home-manager, flake-utils, ... }: let inherit (self) outputs; + inherit (currentSystem) hostname; - hostname = currentSystem.hostname; + overlays = import ./overlays; + utils = import ./utils; configs."ankaa" = { system = "x86_64-linux"; @@ -79,7 +85,10 @@ common.nil.enable = true; - networking.wireguard.enable = true; + networking = { + wireguard.enable = true; + nameservers = [ "192.168.0.100" ]; + }; }; @@ -90,10 +99,8 @@ audio = { pipewire.enable = true; music.enable = true; - }; - gui = { enable = true; protonmail = true; @@ -114,22 +121,28 @@ common.nil.enable = true; - networking.wireguard.enable = true; + networking = { + wireguard.enable = true; + nameservers = [ "192.168.0.100" ]; + }; }; - configs."default-hostname" = { - }; + configs."default-hostname" = {}; - utils = import ./utils; system = configs."${hostname}".system; - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import nixpkgs { + inherit system; + overlays = with overlays; [ gamescope ]; + config.allowUnfree = true; + }; in { nixosConfigurations = { "${hostname}" = nixpkgs.lib.nixosSystem { specialArgs = { inherit (outputs) localPackages; + inherit pkgs; }; modules = [ { @@ -153,7 +166,7 @@ ]; }; }; - localPackages = nixpkgs.lib.genAttrs [ "x86_64-linux" ] (system: + localPackages = pkgs.lib.genAttrs flake-utils.lib.defaultSystems (system: { kickoff-dot-desktop = pkgs.callPackage ./pkgs/kickoff-dot-desktop.nix {}; gamescope-old = pkgs.callPackage ./pkgs/gamescope-old {}; diff --git a/hosts/ankaa/system.nix b/hosts/ankaa/system.nix index 3ce38aa..3ed07ad 100644 --- a/hosts/ankaa/system.nix +++ b/hosts/ankaa/system.nix @@ -10,19 +10,16 @@ ... }: { - nixpkgs = { - overlays = []; - config = { - allowUnfree = true; - }; - }; - nix = { settings = { experimental-features = "nix-command flakes"; }; }; + hardware.opengl.extraPackages = with pkgs; [ + rocmPackages.clr.icd + ]; + # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/modules/home/sway.nix b/modules/home/sway.nix index d5b383f..851349f 100644 --- a/modules/home/sway.nix +++ b/modules/home/sway.nix @@ -12,6 +12,17 @@ with lib; let in { config = mkIf gui.sway.enable { + services.swayidle = { + enable = true; + timeouts = [ + { + timeout = 600; + command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'"; + resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'"; + } + ]; + + }; wayland.windowManager.sway = { enable = true; checkConfig = false; @@ -26,6 +37,7 @@ in "XF86AudioPause" = "exec playerctl play-pause"; "XF86AudioNext" = "exec playerctl next"; "XF86AudioPrev" = "exec playerctl previous"; + "${modifier}+space" = "exec \"kickoff-dot-desktop | ${pkgs.kickoff}/bin/kickoff --from-stdin --stdout | xargs -d '\\n' ${pkgs.sway}/bin/swaymsg exec\""; "${modifier}+Return" = "exec alacritty "; "${modifier}+Control+f" = "exec MOZ_ENABLE_WAYLAND=1 firefox"; "${modifier}+Control+s" = "exec steam"; @@ -54,11 +66,12 @@ in "${modifier}+Shift+Right" = "move right"; "${modifier}+b" = "split h"; "${modifier}+v" = "split v"; + "${modifier}+r" = "mode 'resize'"; "${modifier}+f" = "fullscreen toggle"; + "${modifier}+Shift+space" = "floating toggle"; "${modifier}+s" = "layout stacking"; "${modifier}+w" = "layout tabbed"; "${modifier}+e" = "layout toggle split"; - "${modifier}+Shift+space" = "floating toggle"; "${modifier}+a" = "focus parent"; "${modifier}+1" = "workspace 1 "; "${modifier}+2" = "workspace 2"; @@ -82,12 +95,9 @@ in "${modifier}+Shift+0" = "move container to workspace 10"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+Shift+c" = "reload"; - "${modifier}+r" = "mode 'resize'"; }; - startup = [ - { command = "--no-startup-id swayidle -w timeout 600 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"'"; } - ] + startup = [] ++ optionals gui.sway.desktop [ { command = "vorta"; } { command = "MOZ_ENABLE_WAYLAND=1 firefox"; } @@ -154,7 +164,7 @@ in input."type:keyboard" = { xkb_layout = "us,de"; - xkb_options = "caps:escape,grp:shifts_toggle"; + xkb_options = "grp:shifts_toggle"; }; output = gui.monitors; @@ -184,14 +194,14 @@ in }; bars = [ - { command = "\${pkgs.waybar}/bin/waybar"; } + { command = "${pkgs.waybar}/bin/waybar"; } ]; + }; extraConfig = '' - bindsym ${modifier}+space exec kickoff-dot-desktop | kickoff --from-stdin --stdout | xargs -d '\n' swaymsg exec set $bg-color #58536d set $inactive-bg-color #2f343f @@ -207,6 +217,7 @@ in client.urgent $urgent-bg-color $urgent-bg-color $text-color #4B5177 smart_gaps inverse_outer + ''; }; }; diff --git a/modules/nix/common.nix b/modules/nix/common.nix index d585e66..c75bb1f 100644 --- a/modules/nix/common.nix +++ b/modules/nix/common.nix @@ -28,6 +28,12 @@ in type = types.enum [ "fish" ]; default = "fish"; }; + + caps = mkOption { + description = "What key to bind caps lock to"; + type = types.enum [ "ctrl-esc" "esc" "caps" ]; + default = "ctrl-esc"; + }; }; @@ -42,6 +48,7 @@ in eza ripgrep fzf + yazi ncdu btop ] @@ -52,6 +59,19 @@ in defaultEditor = true; }; + services.keyd = mkIf (cfg.caps != "caps") { + enable = true; + keyboards.default = { + ids = [ "*" ]; + settings = { + main = mkMerge [ + (mkIf (cfg.caps == "ctrl-esc") { capslock = "overload(control, esc)"; }) + (mkIf (cfg.caps == "esc") { capslock = "esc"; }) + ]; + }; + }; + }; + programs.fish.enable = mkIf (cfg.shell == "fish") true; }; diff --git a/modules/nix/games.nix b/modules/nix/games.nix index 9fbc51e..ca2e7da 100644 --- a/modules/nix/games.nix +++ b/modules/nix/games.nix @@ -49,7 +49,7 @@ in config = mkIf cfg.enable { environment.systemPackages = with pkgs; with localPackages.x86_64-linux; [] ++ optional cfg.protonup.enable protonup-qt - ++ optional cfg.gamescope.enable gamescope-old + ++ optional cfg.gamescope.enable gamescope ++ optional cfg.discord.enable vesktop ++ optionals cfg.lutris.enable [ lutris wine ]; diff --git a/modules/nix/networking.nix b/modules/nix/networking.nix index f9103bc..9e50e0b 100644 --- a/modules/nix/networking.nix +++ b/modules/nix/networking.nix @@ -21,8 +21,7 @@ in allowedTCPPorts = mkOption { description = "Which tcp ports to allow through firewall"; type = types.listOf types.int; - default = [] - ++ optional openssh.enable openssh.port; + default = []; }; allowedUDPPorts = mkOption { @@ -66,7 +65,9 @@ in networking.nameservers = cfg.nameservers; networking.firewall = { enable = cfg.firewall.enable; - allowedTCPPorts = cfg.firewall.allowedTCPPorts; + allowedTCPPorts = cfg.firewall.allowedTCPPorts + ++ optional openssh.enable openssh.port; + allowedUDPPorts = cfg.firewall.allowedUDPPorts; }; }; diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..52652c3 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,3 @@ +{ + gamescope = import ./gamescope-last-working.nix; +} diff --git a/overlays/gamescope-last-working.nix b/overlays/gamescope-last-working.nix new file mode 100644 index 0000000..9190ea0 --- /dev/null +++ b/overlays/gamescope-last-working.nix @@ -0,0 +1,11 @@ +final: prev: { + gamescope = prev.gamescope.overrideAttrs ( old: { + src = prev.fetchFromGitHub { + owner = "ValveSoftware"; + repo = "gamescope"; + rev = "d0d23c4c3010c81add1bd90cbe478ce4a386e28d"; + fetchSubmodules = true; + hash = "sha256-Ym1kl9naAm1MGlxCk32ssvfiOlstHiZPy7Ga8EZegus="; + }; + }); +}