From f317b141f7fde81eee513fe7326339c717474dc2 Mon Sep 17 00:00:00 2001 From: DACHXY Date: Sun, 29 Dec 2024 14:14:12 +0800 Subject: [PATCH] new stable --- flake.lock | 50 +++++++++---------------- flake.nix | 14 ++++--- home/config/hypr/hyprland.conf | 2 + home/config/hypr/window.conf | 2 +- home/config/hypr/windowrule.conf | 2 + home/config/waybar/modules.json | 2 +- home/default.nix | 1 + home/user/hyprland.nix | 4 +- system/modules/auto-upgrade.nix | 16 ++++++++ system/modules/default.nix | 5 ++- system/modules/display-manager.nix | 25 +++++++++++++ system/modules/environment.nix | 2 - system/modules/fonts.nix | 1 + system/modules/gc.nix | 16 ++++++++ system/modules/hyprland.nix | 16 ++++++-- system/modules/internationalisation.nix | 5 ++- system/modules/programs.nix | 2 +- system/modules/rust-toolchain.toml | 19 ++++++++++ system/modules/rust.nix | 30 +++++++++++++++ system/modules/security.nix | 21 +++++++++-- system/modules/services.nix | 5 --- 21 files changed, 179 insertions(+), 61 deletions(-) create mode 100644 system/modules/auto-upgrade.nix create mode 100644 system/modules/display-manager.nix create mode 100644 system/modules/gc.nix create mode 100644 system/modules/rust-toolchain.toml create mode 100644 system/modules/rust.nix diff --git a/flake.lock b/flake.lock index 3c56582..b5594da 100644 --- a/flake.lock +++ b/flake.lock @@ -151,11 +151,11 @@ ] }, "locked": { - "lastModified": 1733951536, - "narHash": "sha256-Zb5ZCa7Xj+0gy5XVXINTSr71fCfAv+IKtmIXNrykT54=", + "lastModified": 1735344290, + "narHash": "sha256-oJDtWPH1oJT34RJK1FSWjwX4qcGOBRkcNQPD0EbSfNM=", "owner": "nix-community", "repo": "home-manager", - "rev": "1318c3f3b068cdcea922fa7c1a0a1f0c96c22f5f", + "rev": "613691f285dad87694c2ba1c9e6298d04736292d", "type": "github" }, "original": { @@ -259,18 +259,19 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1735209119, - "narHash": "sha256-zarY0tzIHyWcaImbIJOYRbBbHdLRdNDkRfOmzPVapRk=", - "owner": "hyprwm", - "repo": "Hyprland", - "rev": "e75e2cdac79417ffdbbbe903f72668953483a4e7", - "type": "github" + "lastModified": 1735394862, + "narHash": "sha256-34vW0z18FAZajpAU2bFmGjiepnu+9Nm769blbbp679g=", + "ref": "refs/heads/main", + "rev": "2b01a5bcf62956a5d641a3367edcd35e103edfcd", + "revCount": 5597, + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" }, "original": { - "owner": "hyprwm", - "ref": "main", - "repo": "Hyprland", - "type": "github" + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" } }, "hyprland-plugins": { @@ -520,29 +521,13 @@ "type": "github" } }, - "nixpkgs-unstable_2": { - "locked": { - "lastModified": 1733749988, - "narHash": "sha256-+5qdtgXceqhK5ZR1YbP1fAUsweBIrhL38726oIEAtDs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "bc27f0fde01ce4e1bfec1ab122d72b7380278e68", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { - "lastModified": 1734991663, - "narHash": "sha256-8T660guvdaOD+2/Cj970bWlQwAyZLKrrbkhYOFcY1YE=", + "lastModified": 1735264675, + "narHash": "sha256-MgdXpeX2GuJbtlBrH9EdsUeWl/yXEubyvxM1G+yO4Ak=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6c90912761c43e22b6fb000025ab96dd31c971ff", + "rev": "d49da4c08359e3c39c4e27c74ac7ac9b70085966", "type": "github" }, "original": { @@ -601,7 +586,6 @@ "hyprland-plugins": "hyprland-plugins", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable_2", "yazi": "yazi" } }, diff --git a/flake.nix b/flake.nix index a0277c1..a1d0b58 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + # nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; home-manager.url = "github:nix-community/home-manager/release-24.11"; + # home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; nix-index-database.url = "github:nix-community/nix-index-database"; @@ -20,7 +21,11 @@ }; # Not used yet due to some skill issue - hyprland.url = "github:hyprwm/Hyprland/main"; + hyprland = { + type = "git"; + url = "https://github.com/hyprwm/Hyprland"; + submodules = true; + }; hyprland-plugins = { url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; @@ -32,11 +37,10 @@ }; outputs = - { self, nixpkgs-unstable, nixpkgs, nix-index-database, ... }@inputs: + { self, nixpkgs, nix-index-database, ... }@inputs: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; - pkgsUnstable = nixpkgs-unstable.legacyPackages.${system}; in { formatter.x86_64-linux = @@ -49,7 +53,6 @@ ]; specialArgs = { inherit inputs; - inherit pkgsUnstable; inherit system; }; }; @@ -61,7 +64,6 @@ ]; specialArgs = { inherit inputs; - inherit pkgsUnstable; inherit system; }; }; diff --git a/home/config/hypr/hyprland.conf b/home/config/hypr/hyprland.conf index b5a2417..7c31c78 100755 --- a/home/config/hypr/hyprland.conf +++ b/home/config/hypr/hyprland.conf @@ -1,3 +1,5 @@ +debug:disable_logs = false + source = ~/.config/hypr/monitor.conf source = ~/.config/hypr/exec.conf source = ~/.config/hypr/bind.conf diff --git a/home/config/hypr/window.conf b/home/config/hypr/window.conf index 7cd4f8b..fe156a7 100755 --- a/home/config/hypr/window.conf +++ b/home/config/hypr/window.conf @@ -62,7 +62,7 @@ master { } gestures { - workspace_swipe = off + workspace_swipe = true } misc { diff --git a/home/config/hypr/windowrule.conf b/home/config/hypr/windowrule.conf index 1b07a98..e5f0a09 100755 --- a/home/config/hypr/windowrule.conf +++ b/home/config/hypr/windowrule.conf @@ -47,6 +47,8 @@ layerrule = blur, logout_dialog layerrule = unset, rofi layerrule = blur, rofi layerrule = ignorezero, rofi +layerrule = unset, swaync-control-center +layerrule = unset, swaync-notification-window layerrule = blur, swaync-control-center layerrule = blur, swaync-notification-window layerrule = ignorezero, swaync-control-center diff --git a/home/config/waybar/modules.json b/home/config/waybar/modules.json index 0503d09..f0b082b 100644 --- a/home/config/waybar/modules.json +++ b/home/config/waybar/modules.json @@ -120,7 +120,7 @@ "format-critical": "{temperatureC}°C {icon}", "format": " {temperatureC}°C {icon} ", "format-icons": ["🔥"], - "on-click-right": "kitty -c ~/.config/kitty/kitty.conf --title nvtop sh -c 'nvtop'" + "on-click-right": "kitty -c ~/.config/kitty/kitty.conf --title btop sh -c 'btop'" }, "custom/swaync": { diff --git a/home/default.nix b/home/default.nix index 9ece32e..7a3ec24 100644 --- a/home/default.nix +++ b/home/default.nix @@ -6,6 +6,7 @@ home.homeDirectory = "/home/danny"; home.stateVersion = "24.11"; + # home.stateVersion = "25.05"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/user/hyprland.nix b/home/user/hyprland.nix index 362720b..f3cd1df 100644 --- a/home/user/hyprland.nix +++ b/home/user/hyprland.nix @@ -6,7 +6,7 @@ enable = true; package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; xwayland.enable = true; - systemd.enable = false; + systemd.enable = true; plugins = [ inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprbars @@ -17,7 +17,7 @@ "$mod" = "SUPER"; bind = [ "$mod, F, exec, firefox" - "$mod, enter, exec, kitty" + "$mod, enter, exec, ghostty" ] ++ ( # workspaces diff --git a/system/modules/auto-upgrade.nix b/system/modules/auto-upgrade.nix new file mode 100644 index 0000000..f23cd1d --- /dev/null +++ b/system/modules/auto-upgrade.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + # Scheduled auto upgrade system (this is only for system upgrades, + # if you want to upgrade cargo\npm\pip global packages, docker containers or different part of the system + # or get really full system upgrade, use `topgrade` CLI utility manually instead. + # I recommend running `topgrade` once a week or at least once a month) + system.autoUpgrade = { + enable = true; + operation = "switch"; # If you don't want to apply updates immediately, only after rebooting, use `boot` option in this case + flake = "/etc/nixos"; + flags = [ "--update-input" "nixpkgs" "--update-input" "rust-overlay" "--commit-lock-file" ]; + dates = "weekly"; + # channel = "https://nixos.org/channels/nixos-unstable"; + }; +} diff --git a/system/modules/default.nix b/system/modules/default.nix index fe19f25..be87c33 100644 --- a/system/modules/default.nix +++ b/system/modules/default.nix @@ -12,7 +12,6 @@ ./networking.nix ./nixsettings.nix ./packages.nix - ./polkit.nix ./programs.nix ./security.nix ./services.nix @@ -24,5 +23,9 @@ ./dn-ca.nix ./environment.nix ./virtualization.nix + ./display-manager.nix + ./gc.nix + ./polkit.nix + # ./auto-upgrade.nix ]; } diff --git a/system/modules/display-manager.nix b/system/modules/display-manager.nix new file mode 100644 index 0000000..bbc5825 --- /dev/null +++ b/system/modules/display-manager.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + services = { + greetd = { + enable = false; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --time-format '%I:%M %p | %a • %h | %F' --cmd Hyprland"; + user = "danny"; + }; + }; + }; + + displayManager = { + sddm.wayland.enable = true; + sddm.enable = true; + sddm.theme = "${import ./sddm-theme.nix { inherit pkgs; }}"; + }; + }; + + environment.systemPackages = with pkgs; [ + greetd.tuigreet + ]; +} diff --git a/system/modules/environment.nix b/system/modules/environment.nix index 2b7f67e..d4140bc 100644 --- a/system/modules/environment.nix +++ b/system/modules/environment.nix @@ -14,9 +14,7 @@ in { environment.systemPackages = [ offload ]; environment.variables = { - NIXOS_OZONE_WL = "1"; ELECTRON_OZONE_PLATFORM_HINT = "auto"; GSETTINGS_SCHEMA_DIR = "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas"; - XCURSOR_SIZE = "24"; }; } diff --git a/system/modules/fonts.nix b/system/modules/fonts.nix index 51d0898..784ac65 100644 --- a/system/modules/fonts.nix +++ b/system/modules/fonts.nix @@ -8,6 +8,7 @@ noto-fonts-cjk-serif noto-fonts-emoji + # nerd-fonts.caskaydia-cove (nerdfonts.override { fonts = [ "CascadiaCode" ]; }) ]; diff --git a/system/modules/gc.nix b/system/modules/gc.nix new file mode 100644 index 0000000..683602b --- /dev/null +++ b/system/modules/gc.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + # Optimize storage and automatic scheduled GC running + # If you want to run GC manually, use commands: + # `nix-store --optimize` for finding and eliminating redundant copies of identical store paths + # `nix-store --gc` for optimizing the nix store and removing unreferenced and obsolete store paths + # `nix-collect-garbage -d` for deleting old generations of user profiles + nix.settings.auto-optimise-store = true; + nix.optimise.automatic = true; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; + }; +} diff --git a/system/modules/hyprland.nix b/system/modules/hyprland.nix index 129c2fe..db5678c 100644 --- a/system/modules/hyprland.nix +++ b/system/modules/hyprland.nix @@ -1,14 +1,24 @@ -{ pkgs, inputs, ... }: +{ pkgs, inputs, system, ... }: { programs.hyprland = { enable = true; + package = inputs.hyprland.packages.${system}.hyprland; withUWSM = true; - xwayland = { enable = true; }; - portalPackage = pkgs.xdg-desktop-portal-hyprland; + xwayland.enable = true; + portalPackage = inputs.hyprland.packages.${system}.xdg-desktop-portal-hyprland; + # portalPackage = pkgs.xdg-desktop-portal-hyprland; + }; + + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + WLR_NO_HARDWARE_CURSORS = "1"; }; environment.systemPackages = with pkgs; [ + pyprland + # hyprlock + hyprcursor hyprsunset hyprpaper hyprpicker diff --git a/system/modules/internationalisation.nix b/system/modules/internationalisation.nix index 5133141..d1c3c8a 100644 --- a/system/modules/internationalisation.nix +++ b/system/modules/internationalisation.nix @@ -21,10 +21,11 @@ enable = true; type = "fcitx5"; fcitx5.addons = with pkgs; [ - rime-data fcitx5-gtk - fcitx5-rime + fcitx5-mozc # Japanese fcitx5-chinese-addons + fcitx5-rime # Bopomofo + rime-data ]; }; diff --git a/system/modules/programs.nix b/system/modules/programs.nix index 4f8855b..09e51d8 100644 --- a/system/modules/programs.nix +++ b/system/modules/programs.nix @@ -5,7 +5,7 @@ enable = true; wlr.enable = false; xdgOpenUsePortal = false; - extraPortals = [ pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; + extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; }; programs = { diff --git a/system/modules/rust-toolchain.toml b/system/modules/rust-toolchain.toml new file mode 100644 index 0000000..a81f07e --- /dev/null +++ b/system/modules/rust-toolchain.toml @@ -0,0 +1,19 @@ +[toolchain] +channel = "nightly" +components = [ + "rust-src", + "rust-analyzer", + "rustc-codegen-cranelift", + "miri", + "llvm-tools", + "rust-docs-json", +] +targets = [ + "wasm32-unknown-unknown", + "wasm32-wasi", + "x86_64-pc-windows-gnu", + "x86_64-unknown-linux-gnu", + "aarch64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", +] +profile = "default" diff --git a/system/modules/rust.nix b/system/modules/rust.nix new file mode 100644 index 0000000..322d961 --- /dev/null +++ b/system/modules/rust.nix @@ -0,0 +1,30 @@ +{ inputs, pkgs, ... }: + +{ + # Apply the overlay to the package set + # nixpkgs.overlays = [ + # inputs.rust-overlay.overlays.default + # ]; + + environment.systemPackages = with pkgs; [ + # (rust-bin.fromRustupToolchainFile ./rust-toolchain.toml) + taplo #toml formatter & lsp + cargo-watch + cargo-deny + cargo-audit + cargo-update + cargo-edit + cargo-outdated + cargo-license + cargo-tarpaulin + cargo-cross + cargo-zigbuild + cargo-nextest + cargo-spellcheck + cargo-modules + cargo-bloat + cargo-unused-features + bacon + evcxr #rust repl + ]; +} diff --git a/system/modules/security.nix b/system/modules/security.nix index af9f469..365b24e 100644 --- a/system/modules/security.nix +++ b/system/modules/security.nix @@ -1,8 +1,21 @@ { pkgs, ... }: { - security.polkit.enable = true; - security.pam.services.swaylock = { }; - security.pam.services.swaylock.fprintAuth = false; - security.pam.services.sddm.enableGnomeKeyring = true; + services.udev.packages = [ pkgs.yubikey-personalization ]; + + security.pam.u2f = { + enable = true; + settings.cue = true; + control = "sufficient"; + }; + + security.pam.services = { + greetd.u2fAuth = true; + sudo.u2fAuth = true; + # hyprlock.u2fAuth = true; + }; + + environment.systemPackages = with pkgs; [ + yubikey-manager + ]; } diff --git a/system/modules/services.nix b/system/modules/services.nix index 4abedaf..38d168f 100644 --- a/system/modules/services.nix +++ b/system/modules/services.nix @@ -31,11 +31,6 @@ xkb.layout = "us"; }; - displayManager = { - sddm.wayland.enable = true; - sddm.enable = true; - sddm.theme = "${import ./sddm-theme.nix { inherit pkgs; }}"; - }; # USB auto mount gvfs.enable = true;