diff --git a/flake.lock b/flake.lock index 2a3abbc2..e165ab74 100644 --- a/flake.lock +++ b/flake.lock @@ -40,11 +40,11 @@ ] }, "locked": { - "lastModified": 1739757849, - "narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=", + "lastModified": 1742655702, + "narHash": "sha256-jbqlw4sPArFtNtA1s3kLg7/A4fzP4GLk9bGbtUJg0JQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe", + "rev": "0948aeedc296f964140d9429223c7e4a0702a1ff", "type": "github" }, "original": { @@ -128,13 +128,29 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1742631601, + "narHash": "sha256-yJ3OOAmsGAxSl0bTmKUp3+cEYtSS+V6hUPK2rYhIPr8=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "380ed15bcd6440606c6856db44a99140d422b46f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1741862977, - "narHash": "sha256-prZ0M8vE/ghRGGZcflvxCu40ObKaB+ikn74/xQoNrGQ=", + "lastModified": 1742512142, + "narHash": "sha256-8XfURTDxOm6+33swQJu/hx6xw1Tznl8vJJN5HwVqckg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cdd2ef009676ac92b715ff26630164bb88fec4e0", + "rev": "7105ae3957700a9646cc4b766f5815b23ed0c682", "type": "github" }, "original": { @@ -146,11 +162,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1742049485, - "narHash": "sha256-M7oK+JK7qH1wW103KOPeY/VX8ZTnCM+BGF5kojzdY2g=", + "lastModified": 1742738698, + "narHash": "sha256-KCtAXWwQs03JmEhP4ss59QVzT+rHZkhQO85KjNy8Crc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7c5d41a85cd9050bcd071856d0d17ab6e1fd79e9", + "rev": "f3a2a0601e9669a6e38af25b46ce6c4563bcb6da", "type": "github" }, "original": { @@ -160,28 +176,13 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "home-manager": "home-manager", "kmonad": "kmonad", "lix-module": "lix-module", "nix-flatpak": "nix-flatpak", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-master": "nixpkgs-master", "zen-browser": "zen-browser" @@ -204,14 +205,16 @@ }, "zen-browser": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1742044866, - "narHash": "sha256-h6bj9ieT8EohsVgHL/vkhy5H5SB+1k3J/kZ2jx6sIl8=", + "lastModified": 1742736106, + "narHash": "sha256-wzdYoYASPlITYBiw2xDyE56DnOcLNsO6QHRGUDj6kq4=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "0cac41e1916436fc8734caacb8843f93e336212b", + "rev": "7c3008fcc5a436c885d3faaf6d058afc41ae3762", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2b84a97d..dd6be1aa 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ nix-flatpak.url = "github:gmodena/nix-flatpak?ref=latest"; home-manager.url = "github:nix-community/home-manager/release-24.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; # software lix-module = { @@ -14,6 +15,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; zen-browser.url = "github:0xc000022070/zen-browser-flake"; + zen-browser.inputs.nixpkgs.follows = "nixpkgs"; kmonad = { url = "git+https://github.com/jokesper/kmonad?dir=nix&ref=feat-tap-overlap"; inputs.nixpkgs.follows = "nixpkgs"; @@ -52,11 +54,13 @@ config.allowUnfree = true; }; }; - nixosConfigurations = lib.xyno.loadInstances ./instances [ - inputs.lix-module.nixosModules.default - inputs.kmonad.nixosModules.default - inputs.home-manager.nixosModules.default - ]; + nixosConfigurations = + lib.xyno.loadInstances ./instances ([ + inputs.lix-module.nixosModules.default + inputs.kmonad.nixosModules.default + inputs.home-manager.nixosModules.default + ] + ++ (import ./modules/module-list.nix)); devShell."x86_64-linux" = let pkgs = genPkgs "x86_64-linux"; diff --git a/hm-modules/alacritty.nix b/hm-modules/alacritty.nix new file mode 100644 index 00000000..30b0d830 --- /dev/null +++ b/hm-modules/alacritty.nix @@ -0,0 +1,51 @@ +{ + pkgs, + config, + lib, + inputs, + ... +}: +let + cfg = config.xyno.alacritty; +in +{ + options.xyno.alacritty.enable = lib.mkOption { default = false; }; + config = lib.mkIf cfg.enable { + programs.alacritty = { + enable = true; + settings = { + font.normal.family = "JetBrainsMono NerdFont"; + colors = { + primary = { + # hard contrast + background = "#1d2021"; + # normal background = "#282828"; + # soft contrast background = = "#32302f" + foreground = "#ebdbb2"; + }; + normal = { + black = "#282828"; + red = "#cc241d"; + green = "#98971a"; + yellow = "#d79921"; + blue = "#458588"; + magenta = "#b16286"; + cyan = "#689d6a"; + white = "#a89984"; + }; + bright = { + black = "#928374"; + red = "#fb4934"; + green = "#b8bb26"; + yellow = "#fabd2f"; + blue = "#83a598"; + magenta = "#d3869b"; + cyan = "#8ec07c"; + white = "#ebdbb2"; + }; + }; + }; + }; + + }; +} diff --git a/hm-modules/borgmatic.nix b/hm-modules/borgmatic.nix new file mode 100644 index 00000000..c221d71f --- /dev/null +++ b/hm-modules/borgmatic.nix @@ -0,0 +1,48 @@ +{ + pkgs, + config, + lib, + osConfig, + ... +}: +let + cfg = config.xyno.borgmatic; +in +{ + options.xyno.borgmatic.enable = lib.mkOption { default = false; }; + config = lib.mkIf cfg.enable { + programs.borgmatic = { + enable = true; + backups.system = + let + notify = "${pkgs.libnotify}/bin/notify-send"; + in + { + location.sourceDirectories = [ "/home" "/var" ]; + location.repositories = [ { path = "ssh://ragon@ds9//backups/${osConfig.networking.hostName}"; } ]; + location.extraConfig.exclude_if_present = [ ".nobackup" ]; + storage.encryptionPasscommand = "${pkgs.libsecret}/bin/secret-tool lookup borg-repository system"; + location.extraConfig.before_backup = [ + "${notify} -u low -a borgmatic borgmatic \"starting backup\" -t 10000" + ]; + location.extraConfig.after_backup = [ + "${notify} -u low -a borgmatic borgmatic \"finished backup\" -t 10000" + ]; + location.extraConfig.on_error = [ + "${notify} -u critical -a borgmatic borgmatic \"backup failed
maybe unlock keepass\"" + ]; + location.extraConfig.ssh_command = "ssh -o IdentityAgent=/run/user/1000/ssh-agent"; + location.extraConfig.one_file_system = true; + retention = { + keepHourly = 24; + keepDaily = 7; + keepWeekly = 4; + keepMonthly = 12; + keepYearly = 2; + }; + }; + }; + services.borgmatic.enable = true; + + }; +} diff --git a/hm-modules/dark-theme.nix b/hm-modules/dark-theme.nix new file mode 100644 index 00000000..4d97fe4a --- /dev/null +++ b/hm-modules/dark-theme.nix @@ -0,0 +1,28 @@ +{ + pkgs, + config, + lib, + inputs, + ... +}: +let + cfg = config.xyno.dark-theme; +in +{ + options.xyno.dark-theme.enable = lib.mkOption { default = false; }; + config = lib.mkIf cfg.enable { + dconf = { + settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; + }; + gtk = { + enable = true; + gtk4.extraConfig.gtk-application-prefer-dark-theme = 1; + gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; + }; + + }; +} diff --git a/hm-modules/git.nix b/hm-modules/git.nix new file mode 100644 index 00000000..7b88dc12 --- /dev/null +++ b/hm-modules/git.nix @@ -0,0 +1,35 @@ +{ + pkgs, + config, + lib, + inputs, + ... +}: +let + cfg = config.xyno.git; +in +{ + options.xyno.git.enable = lib.mkEnableOption "xynos git config"; + config = lib.mkIf cfg.enable { + git = { + enable = true; + lfs.enable = true; + + # Default configs + extraConfig = { + commit.gpgSign = true; + gpg.format = "ssh"; + + user.name = "Lucy Hochkamp"; + user.email = "git@xyno.systems"; + user.signingKey = # TODO: don't hardcode a computer + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID/oMAi5jyQsNohfhcSH2ItisTpBGB0WtYTVxJYKKqhj"; # theseus + + # Set default "git pull" behaviour so it doesn't try to default to + # either "git fetch; git merge" (default) or "git fetch; git rebase". + pull.ff = "only"; + }; + }; + + }; +} diff --git a/hm-modules/helix.nix b/hm-modules/helix.nix index 607c8f7e..f4f630c9 100644 --- a/hm-modules/helix.nix +++ b/hm-modules/helix.nix @@ -3,7 +3,7 @@ let cfg = config.xyno.helix; in { - options.ragon.xyno.enable = lib.mkOption { default = false; }; + options.xyno.helix.enable = lib.mkOption { default = false; }; config = lib.mkIf cfg.enable { home.packages = with pkgs; [ jsonnet-language-server diff --git a/hm-modules/module-list.nix b/hm-modules/module-list.nix index 13aac8ec..c3e1826e 100644 --- a/hm-modules/module-list.nix +++ b/hm-modules/module-list.nix @@ -1,3 +1,7 @@ [ + ./alacritty.nix + ./borgmatic.nix + # ./git.nix ./helix.nix + ./dark-theme.nix ] diff --git a/instances/theseus/configuration.nix b/instances/theseus/configuration.nix index e69de29b..d3303e31 100644 --- a/instances/theseus/configuration.nix +++ b/instances/theseus/configuration.nix @@ -0,0 +1,54 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + imports = [ ./hardware-configuration.nix ]; + hardware.keyboard.zsa.enable = true; + home-manager.users.${config.xyno.system.user.name} = ( + { ... }: + { + home.packages = [ # work + pkgs.unstable.jetbrains.rider + (pkgs.unstable.firefox-devedition.overrideAttrs (super: self: { meta.priority = 1; })) + ]; + services.flatpak.update.auto.enable = true; + services.flatpak = { + enable = true; + packages = [ + "com.unicornsonlsd.finamp" + "io.github.softfever.OrcaSlicer" + "io.anytype.anytype" + "org.bionus.Grabber" + "org.getmonero.Monero" + { + appId = "org.gimp.GIMP"; + origin = "flathub-beta"; + } + "org.kicad.KiCad" + "org.pencil2d.Pencil2D" + ]; + }; + } + ); + + xyno.desktop.common-programs.enable = true; + xyno.hardware.kmonad.enable = true; + xyno.presets.cli.enable = true; + xyno.presets.gui.enable = true; + xyno.presets.home-manager.enable = true; + xyno.system.user.enable = true; + xyno.networking.networkd = { + enable = true; + enableWifi = true; + }; + hardware.bluetooth.enable = true; + services.blueman.enable = true; + services.power-profiles-daemon.enable = true; + programs.kdeconnect.enable = true; + services.flatpak.enable = true; + + system.stateVersion = "24.11"; +} diff --git a/instances/theseus/default.nix b/instances/theseus/default.nix index 7e036ee8..e44b9dd4 100644 --- a/instances/theseus/default.nix +++ b/instances/theseus/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: { +{ modules = [ ./configuration.nix ]; system = "x86_64-linux"; hostName = "theseus"; diff --git a/instances/theseus/hardware-configuration.nix b/instances/theseus/hardware-configuration.nix index e69de29b..1f1b35d1 100644 --- a/instances/theseus/hardware-configuration.nix +++ b/instances/theseus/hardware-configuration.nix @@ -0,0 +1,68 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + inputs, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + "${inputs.nixos-hardware}/framework/13-inch/7040-amd" + ]; + + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usb_storage" + "usbhid" + "sd_mod" + ]; + boot.loader.systemd-boot.enable = true; + boot.initrd.luks.devices.cryptroot.device = + "/dev/disk/by-uuid/4cd8dbb3-8eea-48ff-87b1-92945be291ac"; + + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + boot.supportedFilesystems = { + xfs = true; + }; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/ca79f433-163a-4c5c-b176-8e694a674dda"; + fsType = "xfs"; + neededForBoot = true; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/DA11-68A6"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + "noauto" + "x-systemd.automount" + ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/96c380b3-4498-4eb8-8a18-5eebe2a41428"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + # networking.interfaces.enp195s0f3u1u3.useDHCP = lib.mkDefault true; + # networking.interfaces.eth0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/lib/default.nix b/lib/default.nix index dde4bd68..318af80a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,18 +1,31 @@ -{ lib, nixpkgs, inputs, self, ... }: rec { - getDirs = parentDir: lib.mapAttrs (n: v: import v) (lib.filterAttrs (n: v: v == "directory") (builtins.readDir parentDir)); - loadInstances = dir: extraModules: lib.mapAttrs - (n: v: loadInstance v extraModules) - (getDirs dir); - loadInstance = extraModules: instance: +{ + lib, + nixpkgs, + inputs, + self, + ... +}: +rec { + getDirs = + parentDir: + lib.mapAttrs (n: v: (import "${parentDir}/${n}")) ( + lib.filterAttrs (n: v: v == "directory") (builtins.readDir parentDir) + ); + loadInstances = dir: extraModules: lib.mapAttrs (n: v: loadInstance extraModules v) (getDirs dir); + loadInstance = + extraModules: instance: nixpkgs.lib.nixosSystem { system = instance.system; specialArgs = { inherit inputs; }; - modules = instance.modules ++ extraModules ++ [ - { - nixpkgs.overlays = [ self.overlays.default ]; - nixpkgs.config.allowUnfree = true; - networking.hostName = instance.hostName; - } - ]; + modules = + instance.modules + ++ extraModules + ++ [ + { + nixpkgs.overlays = [ self.overlays.default ]; + nixpkgs.config.allowUnfree = true; + networking.hostName = instance.hostName; + } + ]; }; } diff --git a/modules/desktop/audio.nix b/modules/desktop/audio.nix new file mode 100644 index 00000000..7a2523c4 --- /dev/null +++ b/modules/desktop/audio.nix @@ -0,0 +1,35 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.xyno.desktop.audio; +in +{ + options.xyno.desktop.audio.enable = lib.mkEnableOption "enable pipewire and stuff"; + config = lib.mkIf cfg.enable { + services.pipewire = { + enable = true; + # raopOpenFirewall = true; # airplay + pulse.enable = true; + extraConfig.pipewire = { + "9-clock-allow-higher" = { + "context.properties" = { + "default.clock.allowed-rates" = [ "44100" "48000" "96000" "192000" ]; + }; + }; + # "10-raop-discover" = { + # "context.modules" = [ + # { + # name = "libpipewire-module-raop-discover"; + # args = { }; + # } + # ]; + # }; + }; + }; + + }; +} diff --git a/modules/desktop/common-programs.nix b/modules/desktop/common-programs.nix new file mode 100644 index 00000000..8bb5b595 --- /dev/null +++ b/modules/desktop/common-programs.nix @@ -0,0 +1,53 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.xyno.desktop.common-programs; +in +{ + options.xyno.desktop.common-programs.enable = + lib.mkEnableOption "install some commonly used programs"; + config = lib.mkIf cfg.enable { + home-manager.users.${config.xyno.system.user.name} = lib.mkIf config.xyno.presets.home-manager.enable ({...}: { + xyno.alacritty.enable = true; + xyno.helix.enable = true; + }); + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + # dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers + }; + programs.evolution.enable = true; + services.gnome.evolution-data-server.enable = true; + services.flatpak.enable = true; + programs.fuse.userAllowOther = true; + programs.sway.enable = true; + programs.nix-ld.enable = true; + programs.gamescope.enable = true; + programs.wireshark.enable = true; + programs.kdeconnect.enable = true; + + environment.systemPackages = with pkgs; [ + element-desktop # this is not a place of honor + discord # shitcord + unstable.signal-desktop + obsidian + diebahn + vlc + lutris + libreoffice-qt6-fresh + inkscape + easyeffects + dune3d + appimage-run + unstable.keepassxc + inputs.zen-browser.packages."${pkgs.system}".default + + ]; + + }; +} diff --git a/modules/desktop/mako.nix b/modules/desktop/mako.nix index bfdf6b52..68aac5cc 100644 --- a/modules/desktop/mako.nix +++ b/modules/desktop/mako.nix @@ -26,9 +26,13 @@ in }; config = lib.mkIf cfg.enable { systemd.user.services.mako = { + unitConfig.PartOf = "graphical-session.target"; + unitConfig.After = "graphical-session.target"; + unitConfig.Requisite = "graphical-session.target"; + serviceConfig.Restart = "on-failure"; wantedBy = [ cfg.wantedBy ]; script = "${cfg.package}/bin/mako -c ${makoConf}"; - restartTrigers = makoConf; + restartTriggers = [makoConf]; }; }; } diff --git a/modules/desktop/niri.nix b/modules/desktop/niri.nix index 2e11079b..5c7ca0c8 100644 --- a/modules/desktop/niri.nix +++ b/modules/desktop/niri.nix @@ -12,7 +12,7 @@ let "KeePassXC" "org.gnome.NautilusPreviewer" ]; - matchFloat = lib.concatStringSep "\n" ( + matchFloat = lib.concatStringsSep "\n" ( map (x: '' window-rule { match app-id="${x}" @@ -29,12 +29,55 @@ in waybar.enable = lib.mkDefault true; mako.enable = lib.mkDefault true; }; + home-manager.users.${config.xyno.system.user.name} = lib.mkIf config.xyno.presets.home-manager.enable ({...}: { + xyno.dark-theme.enable = true; + }); + + # xdg.portal = { + # enable = true; + # wlr.enable = true; + # }; programs.niri.enable = true; environment.etc."niri/config.kdl".text = '' // xwayland - spawn-at-startup "${pkgs.xwayland-sattelite}/bin/xwayland-sattelite" - + spawn-at-startup "${pkgs.xwayland-satellite}/bin/xwayland-satellite" + screenshot-path "~/Pictures/screenshots/screenshot-%Y-%m-%d %H-%M-%S.png" + // Indicate screencasted windows with red colors. + window-rule { + match is-window-cast-target=true + + focus-ring { + active-color "#f38ba8" + inactive-color "#7d0d2d" + } + + border { + inactive-color "#7d0d2d" + } + + shadow { + color "#7d0d2d70" + } + + tab-indicator { + active-color "#f38ba8" + inactive-color "#7d0d2d" + } + } + // Block out password managers from screencasts. + window-rule { + match app-id=r#"^org\.keepassxc\.KeePassXC$"# + match app-id=r#"^org\.gnome\.World\.Secrets$"# + + block-out-from "screencast" + } + // Block out mako notifications from screencasts. + layer-rule { + match namespace="^notifications$" + + block-out-from "screencast" + } input { workspace-auto-back-and-forth focus-follows-mouse max-scroll-amount="10%" diff --git a/modules/desktop/swayidle.nix b/modules/desktop/swayidle.nix new file mode 100644 index 00000000..d24b9dfa --- /dev/null +++ b/modules/desktop/swayidle.nix @@ -0,0 +1,48 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.xyno.desktop.swayidle; + makoConf = pkgs.writeText "mako.conf" '' + font=Source Sans Pro Nerd Font 11 + background-color=#1d2021ff + border-color=#3c3836FF + text-color=#ebdbb2ff + progress-color=over #928374FF + ''; +in +{ + options.xyno.desktop.swayidle.enable = lib.mkEnableOption "enable swayidle and swaylock and stuff"; + options.xyno.desktop.swayidle.wantedBy = lib.mkOption { + type = lib.types.str; + default = "niri.service"; + }; + options.xyno.desktop.swayidle.package = lib.mkOption { + type = lib.types.package; + default = pkgs.swayidle; + }; + options.xyno.desktop.swayidle.swaylockPackage = lib.mkOption { + type = lib.types.package; + default = pkgs.swaylock-effects; + }; + options.xyno.desktop.swayidle.swaylockArgs = lib.mkOption { + type = lib.types.str; + default = "--fade-in 2 --clock --timestr %T%z --datestr %F"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with cfg; [ package swaylockPackage ]; + systemd.user.services.mako = { + unitConfig.PartOf = "graphical-session.target"; + unitConfig.After = "graphical-session.target"; + unitConfig.Requisite = "graphical-session.target"; + serviceConfig.Restart = "on-failure"; + wantedBy = [ cfg.wantedBy ]; + script = "${cfg.package}/bin/mako -c ${makoConf}"; + restartTrigers = makoConf; + }; + }; +} diff --git a/modules/desktop/waybar.nix b/modules/desktop/waybar.nix index baef9b29..d0c863fd 100644 --- a/modules/desktop/waybar.nix +++ b/modules/desktop/waybar.nix @@ -15,7 +15,7 @@ in }; options.xyno.desktop.waybar.package = lib.mkOption { type = lib.types.package; - default = pkgs.waybar; + default = pkgs.unstable.waybar; }; options.xyno.desktop.waybar.mode = lib.mkOption { type = lib.types.str; @@ -23,24 +23,27 @@ in }; config = lib.mkIf cfg.enable { programs.waybar.enable = true; + programs.light.enable = true; + + systemd.user.services.waybar.wantedBy = lib.mkForce [ cfg.wantedBy ]; environment.etc."xdg/waybar/config".text = builtins.toJSON { mainBar = { layer = "top"; position = "top"; height = 15; modules-left = - (lib.mkIf (cfg.mode == "river") [ + (lib.optional (cfg.mode == "river") [ "river/tags" "river/layout" "river/window" ]) - ++ (lib.mkIf (cfg.mode == "niri") [ + ++ (lib.optional (cfg.mode == "niri") [ "niri/workspaces" "niri/window" ]); modules-right = [ "tray" - "power_profiles_daemon" + "power-profiles-daemon" "idle_inhibitor" "wireplumber" "battery" diff --git a/modules/hardware/kmonad.nix b/modules/hardware/kmonad.nix new file mode 100644 index 00000000..c4489472 --- /dev/null +++ b/modules/hardware/kmonad.nix @@ -0,0 +1,29 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.xyno.hardware.kmonad; +in +{ + options.xyno.hardware.kmonad.enable = lib.mkEnableOption "kmonad with xynos brain damage"; + config = lib.mkIf cfg.enable { + services.kmonad = { + enable = true; + keyboards = { + builtin = { + device = "/dev/input/by-path/platform-i8042-serio-0-event-kbd"; + config = builtins.readFile ./kmonad/builtin.kbd; + }; + k70-office = { + device = "/dev/input/by-id/usb-Corsair_CORSAIR_K70_CORE_RGB_TKL_Mechanical_Gaming_Keyboard_599A4D472DCAC05584072AFB922E3BFB-event-kbd"; + config = builtins.readFile ./kmonad/k70.kbd; + + }; + }; + }; + }; + +} diff --git a/modules/hardware/kmonad/builtin.kbd b/modules/hardware/kmonad/builtin.kbd new file mode 100644 index 00000000..3e8fec05 --- /dev/null +++ b/modules/hardware/kmonad/builtin.kbd @@ -0,0 +1,89 @@ +(defcfg + ;; ** For Linux ** + input (device-file "/dev/input/by-id/usb-04d9_USB-HID_Keyboard-event-kbd") + ;; input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") + output (uinput-sink "KMonad output") + + ;; ** For Windows ** + ;; input (low-level-hook) + ;; output (send-event-sink) + + ;; ** For MacOS ** + ;; input (iokit-name "my-keyboard-product-string") + ;; output (kext) + + fallthrough true +) + +(defsrc + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] + caps a s d f g h j k l ; ' \ ret + lsft 102d z x c v b n m , . / rsft + lctl lmet lalt spc ralt rmet cmp rctl +) + +(defalias + ext (layer-toggle extend) ;; Bind 'ext' to the Extend Layer +) + +(defalias + cpy C-c + pst C-v + cut C-x + udo C-z + all C-a + fnd C-f + bk Back + fw Forward +) +(defalias + num (layer-toggle num) +) + +(deflayer colemak-dh + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w f p b j l u y ; [ ] + esc (tap-hold-next-release 200 a lctrl) (tap-hold-next-release 200 r ralt) (tap-hold-next-release 200 s lmet) t g m n (tap-hold-next-release 200 e rmet) (tap-hold-next-release 200 i lalt) (tap-hold-next-release 200 o rctrl) ' \\ ret + lsft z x c d v 102d k h , . / rsft + lctl lmet lalt spc ralt rmet _ _ +) +(deflayer num + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w f p b j l u y ; [ ] + esc 1 2 3 4 5 6 7 8 9 0 ' \\ ret + lsft z x c d v 102d k h , . / rsft + lctl lmet lalt spc ralt rmet _ _ +) + +(deflayer colemak-dhk + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w f p b j l u y ; [ ] + @ext a r s t g k n e i o ' \\ ret + lsft z x c d v 102d m h , . / rsft + lctl lmet lalt spc ralt rmet _ _ +) + +(deflayer extend + _ play rewind previoussong nextsong ejectcd refresh brdn brup www mail prog1 prog2 + _ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 _ + _ esc @bk @fnd @fw ins pgup home up end menu prnt slck + _ lalt lmet lsft lctl ralt pgdn lft down rght del caps _ _ + _ @udo @cut @cpy tab @pst _ pgdn bks lsft lctl comp _ + _ _ _ ret _ _ _ _ +) + + +(deflayer empty + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ +) + diff --git a/modules/hardware/kmonad/k70.kbd b/modules/hardware/kmonad/k70.kbd new file mode 100644 index 00000000..5f54e3ea --- /dev/null +++ b/modules/hardware/kmonad/k70.kbd @@ -0,0 +1,89 @@ +(defcfg + ;; ** For Linux ** + input (device-file "/dev/input/by-id/usb-Corsair_CORSAIR_K70_CORE_RGB_TKL_Mechanical_Gaming_Keyboard_599A4D472DCAC05584072AFB922E3BFB-event-kbd") + ;; input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") + output (uinput-sink "KMonad output razer") + + ;; ** For Windows ** + ;; input (low-level-hook) + ;; output (send-event-sink) + + ;; ** For MacOS ** + ;; input (iokit-name "my-keyboard-product-string") + ;; output (kext) + + fallthrough true +) + +(defsrc + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] + caps a s d f g h j k l ; ' \ ret + lsft 102d z x c v b n m , . / rsft + lctl lmet lalt spc ralt rmet cmp rctl +) + +(defalias + ext (layer-toggle extend) ;; Bind 'ext' to the Extend Layer +) + +(defalias + cpy C-c + pst C-v + cut C-x + udo C-z + all C-a + fnd C-f + bk Back + fw Forward +) +(defalias + num (layer-toggle num) +) + +(deflayer colemak-dh + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + z 1 2 3 4 5 6 7 8 9 0 - = bspc + tab (tap-hold-next-release 200 q @num) w f p b j l u y (tap-hold-next-release 200 ; @num) [ ] + esc (tap-hold-next-release 200 a lctrl) (tap-hold-next-release 200 r ralt) (tap-hold-next-release 200 s lmet) t g m n (tap-hold-next-release 200 e rmet) (tap-hold-next-release 200 i lalt) (tap-hold-next-release 200 o rctrl) ' \\ ret + lsft z x c d v 102d k h , . / rsft + lctl lmet lalt spc ralt rmet _ _ +) +(deflayer num + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w f p b j l u y ; [ ] + esc 1 2 3 4 5 6 7 8 9 0 ' \\ ret + lsft z x c d v 102d k h , . / rsft + lctl lmet lalt spc ralt rmet _ _ +) + +(deflayer colemak-dhk + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w f p b j l u y ; [ ] + @ext a r s t g k n e i o ' \\ ret + lsft z x c d v 102d m h , . / rsft + lctl lmet lalt spc ralt rmet _ _ +) + +(deflayer extend + _ play rewind previoussong nextsong ejectcd refresh brdn brup www mail prog1 prog2 + _ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 _ + _ esc @bk @fnd @fw ins pgup home up end menu prnt slck + _ lalt lmet lsft lctl ralt pgdn lft down rght del caps _ _ + _ @udo @cut @cpy tab @pst _ pgdn bks lsft lctl comp _ + _ _ _ ret _ _ _ _ +) + + +(deflayer empty + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ +) + diff --git a/modules/module-list.nix b/modules/module-list.nix index b4d7885c..d6ac3160 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -1,8 +1,16 @@ [ - ./desktop/niri.nix - ./desktop/waybar.nix - ./desktop/mako.nix ./cli/fish.nix ./cli/starship.nix + ./desktop/audio.nix + ./desktop/common-programs.nix + ./desktop/mako.nix + ./desktop/niri.nix + ./desktop/waybar.nix + ./hardware/kmonad.nix + ./networking/networkd.nix + ./presets/cli.nix + ./presets/gui.nix + ./presets/home-manager.nix + ./system/user.nix ] diff --git a/modules/networking/networkd.nix b/modules/networking/networkd.nix new file mode 100644 index 00000000..b5b8d1ec --- /dev/null +++ b/modules/networking/networkd.nix @@ -0,0 +1,18 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.xyno.networking.networkd; +in +{ + options.xyno.networking.networkd.enable = lib.mkEnableOption "enable systemd networkd"; + options.xyno.networking.networkd.enableWifi = lib.mkEnableOption "enable iwd"; + config = lib.mkIf cfg.enable { + systemd.network.enable = true; + networking.useNetworkd = true; + networking.wireless.iwd.enable = cfg.enableWifi; + }; +} diff --git a/modules/presets/cli.nix b/modules/presets/cli.nix index 36f6b324..346a5737 100644 --- a/modules/presets/cli.nix +++ b/modules/presets/cli.nix @@ -13,6 +13,7 @@ in config = lib.mkIf cfg.enable { xyno.cli.fish.enable = true; xyno.cli.starship.enable = true; + security.sudo.enable = false; environment.systemPackages = with pkgs; [ jq bottom @@ -27,6 +28,7 @@ in yt-dlp helix ]; + programs.mosh.enable = true; environment.variables.EDITOR = "hx"; environment.variables.VISUAL = "hx"; @@ -42,6 +44,7 @@ in gl = "git log --graph"; p = "cd ~/proj"; ytl = ''yt-dlp -f "bv*+mergeall[vcodec=none]" --audio-multistreams''; + sudo = "run0"; }; }; } diff --git a/modules/presets/gui.nix b/modules/presets/gui.nix index d17f34f4..68e4e828 100644 --- a/modules/presets/gui.nix +++ b/modules/presets/gui.nix @@ -9,14 +9,47 @@ let in { options.xyno.presets.gui.enable = lib.mkEnableOption "enables xynos gui config"; - config = cfg.enable { + config = lib.mkIf cfg.enable { xyno.desktop.niri.enable = true; + xyno.desktop.audio.enable = lib.mkDefault true; + xyno.hardware.kmonad.enable = true; + # wayland on electron environment.sessionVariables.NIXOS_OZONE_WL = "1"; services.displayManager.defaultSession = "niri"; - services.displayManager.sddm = { - settings.General.DisplayServer = "wayland"; + # gdm + services.xserver.displayManager.gdm.enable = true; + services.xserver.enable = true; + services.xserver.displayManager.gdm.wayland = true; + # ssh agent + programs.ssh.startAgent = true; + + # setup printing + services.avahi = { enable = true; - wayland.enable = true; + nssmdns4 = true; + nssmdns6 = true; + openFirewall = true; }; + services.printing.enable = true; + + # enable the gnome shit + services.gnome.gnome-keyring.enable = true; + services.gnome.gnome-online-accounts.enable = true; + services.gnome.core-utilities.enable = true; + services.gnome.sushi.enable = true; + services.gnome.gnome-settings-daemon.enable = true; + services.gvfs.enable = true; + + # fonts + fonts.packages = with pkgs; [ + nerdfonts + cantarell-fonts + dejavu_fonts + source-code-pro # Default monospace font in 3.32 + source-sans + b612 + + ]; + }; } diff --git a/modules/presets/home-manager.nix b/modules/presets/home-manager.nix new file mode 100644 index 00000000..f12ae723 --- /dev/null +++ b/modules/presets/home-manager.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + inputs, + ... +}: +let + cfg = config.xyno.presets.home-manager; +in +{ + options.xyno.presets.home-manager.enable = + lib.mkEnableOption "enables home manager on the default user"; + config = lib.mkIf cfg.enable { + home-manager.useGlobalPkgs = true; + home-manager.sharedModules = (import ../../hm-modules/module-list.nix) ++ [ + inputs.nix-flatpak.homeManagerModules.nix-flatpak + ]; + home-manager.users.${config.xyno.system.user.name} = {pkgs, ... }: { + home.stateVersion = lib.mkDefault "24.11"; + }; + }; +} diff --git a/modules/system/user.nix b/modules/system/user.nix new file mode 100644 index 00000000..9f12778f --- /dev/null +++ b/modules/system/user.nix @@ -0,0 +1,38 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.xyno.system.user; +in +{ + options.xyno.system.user.enable = lib.mkEnableOption "enable a user with xynos config"; + options.xyno.system.user.name = lib.mkOption { + type = lib.types.str; + default = "xyno"; + }; + + config = lib.mkIf cfg.enable { + environment.homeBinInPath = true; + users.users.${cfg.name} = { + isNormalUser = true; + uid = 1000; + extraGroups = [ + "wheel" + "cdrom" + "networkmanager" + "video" + "netdev" + "plugdev" + "dialout" + "tape" + "uucp" + "wireshark" + ]; + + }; + + }; +}