From 8ff2fc46aaf2e13c262136230f6cb2578dbee480 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Mon, 16 Oct 2023 16:26:06 +0800 Subject: [PATCH] nixos: add presets --- flake.nix | 17 +++++++---------- .../81fw-lenovo-legion-y7000/default.nix | 1 - nixos/default.nix | 14 -------------- nixos/packages/graphical/graphical.nix | 7 ------- nixos/presets/core.nix | 11 +++++++++++ nixos/presets/gaming.nix | 14 ++++++++++++++ .../presets/desktop.nix} | 4 ++-- users/guanranwang/darwin/presets/gaming.nix | 9 +++++++++ .../home-manager/darwin/default.nix | 9 --------- .../guanranwang/home-manager/darwin/home.nix | 1 - .../home-manager/darwin/presets/desktop.nix | 9 +++++++++ .../home-manager/darwin/presets/gaming.nix | 11 +++++++++++ .../home-manager/nixos/default.nix | 15 --------------- users/guanranwang/home-manager/nixos/home.nix | 11 ----------- .../home-manager/nixos/presets/desktop.nix | 15 +++++++++++++++ .../home-manager/nixos/presets/gaming.nix | 19 +++++++++++++++++++ .../{nixos.nix => nixos/presets/desktop.nix} | 12 ++++++------ users/guanranwang/nixos/presets/gaming.nix | 9 +++++++++ 18 files changed, 112 insertions(+), 76 deletions(-) delete mode 100755 nixos/default.nix create mode 100644 nixos/presets/gaming.nix rename users/guanranwang/{darwin.nix => darwin/presets/desktop.nix} (65%) create mode 100644 users/guanranwang/darwin/presets/gaming.nix delete mode 100644 users/guanranwang/home-manager/darwin/default.nix create mode 100644 users/guanranwang/home-manager/darwin/presets/desktop.nix create mode 100644 users/guanranwang/home-manager/darwin/presets/gaming.nix delete mode 100644 users/guanranwang/home-manager/nixos/default.nix create mode 100644 users/guanranwang/home-manager/nixos/presets/desktop.nix create mode 100644 users/guanranwang/home-manager/nixos/presets/gaming.nix rename users/guanranwang/{nixos.nix => nixos/presets/desktop.nix} (80%) create mode 100644 users/guanranwang/nixos/presets/gaming.nix diff --git a/flake.nix b/flake.nix index 9a4e1fa..604d45c 100755 --- a/flake.nix +++ b/flake.nix @@ -86,11 +86,10 @@ system = "x86_64-linux"; specialArgs = { inherit inputs; }; modules = [ - ./nixos # Entrypoint - ./machines/nixos/81fw-lenovo-legion-y7000 # Hardware-specific configurations - ./machines/nixos/81fw-lenovo-legion-y7000/machine-1 # Machine-specific configurations - - ./users/guanranwang/nixos.nix # Home Manager entrypoint (user-specific) + ./nixos/presets/gaming.nix # OS-specific (with presets) + ./users/guanranwang/nixos/presets/gaming.nix # User-specific (with presets) + ./machines/nixos/81fw-lenovo-legion-y7000 # Hardware-specific + ./machines/nixos/81fw-lenovo-legion-y7000/machine-1 # Machine-specific { networking.hostName = "81FW-NixOS"; } # Hostname ]; @@ -101,12 +100,11 @@ system = "x86_64-linux"; specialArgs = { inherit inputs; }; modules = [ - ./nixos + ./nixos/presets/desktop.nix + ./users/guanranwang/nixos/presets/desktop.nix ./machines/nixos/imac-2017 ./machines/nixos/imac-2017/machine-1 - ./users/guanranwang/nixos.nix - { networking.hostName = "iMac-NixOS"; } ]; }; @@ -120,10 +118,9 @@ specialArgs = { inherit inputs; }; modules = [ ./darwin + ./users/guanranwang/darwin/presets/desktop.nix ./machines/darwin/imac-2017 - ./users/guanranwang/darwin.nix - { networking.hostName = "iMac-macOS"; } ]; }; diff --git a/machines/nixos/81fw-lenovo-legion-y7000/default.nix b/machines/nixos/81fw-lenovo-legion-y7000/default.nix index 64abac4..08c9b06 100644 --- a/machines/nixos/81fw-lenovo-legion-y7000/default.nix +++ b/machines/nixos/81fw-lenovo-legion-y7000/default.nix @@ -3,6 +3,5 @@ { imports = [ ./hardware.nix - ../../../nixos/presets/desktop.nix ]; } \ No newline at end of file diff --git a/nixos/default.nix b/nixos/default.nix deleted file mode 100755 index cd33a53..0000000 --- a/nixos/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: - -{ - imports = [ - ./boot - ./i18n - ./networking - ./nix - ./packages - ./power-management - #./specialisation # dont actually use this - ./users - ]; -} diff --git a/nixos/packages/graphical/graphical.nix b/nixos/packages/graphical/graphical.nix index bffa889..2e5aaee 100644 --- a/nixos/packages/graphical/graphical.nix +++ b/nixos/packages/graphical/graphical.nix @@ -16,12 +16,5 @@ enable = true; package = pkgs.gnomeExtensions.gsconnect; }; - gamemode = { - enable = true; - settings.custom = { - start = "${pkgs.libnotify}/bin/notify-send 'GameMode Activated' 'GameMode Activated! Enjoy enhanced performance. 🚀'"; - end = "${pkgs.libnotify}/bin/notify-send 'GameMode Deactivated' 'GameMode Deactivated. Back to normal mode. ⏚ī¸'"; - }; - }; }; } \ No newline at end of file diff --git a/nixos/presets/core.nix b/nixos/presets/core.nix index f4a06cc..b5c30dc 100755 --- a/nixos/presets/core.nix +++ b/nixos/presets/core.nix @@ -2,6 +2,17 @@ # Imported by default, check out ./desktop.nix or ./server.nix { + imports = [ + ../boot + ../i18n + ../networking + ../nix + ../packages + ../power-management + #../specialisation # dont actually use this + ../users + ]; + # Installed packages (System wide) environment = { #defaultPackages = []; diff --git a/nixos/presets/gaming.nix b/nixos/presets/gaming.nix new file mode 100644 index 0000000..fffeeff --- /dev/null +++ b/nixos/presets/gaming.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +{ + imports = [ + ./desktop.nix + ]; + programs.gamemode = { + enable = true; + settings.custom = { + start = "${pkgs.libnotify}/bin/notify-send 'GameMode Activated' 'GameMode Activated! Enjoy enhanced performance. 🚀'"; + end = "${pkgs.libnotify}/bin/notify-send 'GameMode Deactivated' 'GameMode Deactivated. Back to normal mode. ⏚ī¸'"; + }; + }; +} \ No newline at end of file diff --git a/users/guanranwang/darwin.nix b/users/guanranwang/darwin/presets/desktop.nix similarity index 65% rename from users/guanranwang/darwin.nix rename to users/guanranwang/darwin/presets/desktop.nix index 05d54c5..f17169b 100644 --- a/users/guanranwang/darwin.nix +++ b/users/guanranwang/darwin/presets/desktop.nix @@ -14,8 +14,8 @@ # Flakes imports = [ - ../../flakes/darwin/home-manager.nix + ../../../../flakes/darwin/home-manager.nix ]; ### home-manager - home-manager.users.guanranwang = import ./home-manager/darwin; # NOTE: using flakes + home-manager.users.guanranwang = import ../../home-manager/darwin/presets/desktop.nix; # NOTE: using flakes } \ No newline at end of file diff --git a/users/guanranwang/darwin/presets/gaming.nix b/users/guanranwang/darwin/presets/gaming.nix new file mode 100644 index 0000000..425f609 --- /dev/null +++ b/users/guanranwang/darwin/presets/gaming.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./desktop.nix + ]; + ### home-manager + home-manager.users.guanranwang = import ../../home-manager/darwin/presets/gaming.nix; # NOTE: using flakes +} \ No newline at end of file diff --git a/users/guanranwang/home-manager/darwin/default.nix b/users/guanranwang/home-manager/darwin/default.nix deleted file mode 100644 index 97e6931..0000000 --- a/users/guanranwang/home-manager/darwin/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - imports = [ - ../common/home.nix - ./home.nix - ./dotfiles.nix - ]; -} \ No newline at end of file diff --git a/users/guanranwang/home-manager/darwin/home.nix b/users/guanranwang/home-manager/darwin/home.nix index 225c8a9..5d58db4 100644 --- a/users/guanranwang/home-manager/darwin/home.nix +++ b/users/guanranwang/home-manager/darwin/home.nix @@ -66,7 +66,6 @@ keka # un-archive-r iterm2 ### Misc - prismlauncher element-desktop diff --git a/users/guanranwang/home-manager/darwin/presets/desktop.nix b/users/guanranwang/home-manager/darwin/presets/desktop.nix new file mode 100644 index 0000000..7f7fb58 --- /dev/null +++ b/users/guanranwang/home-manager/darwin/presets/desktop.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ../../common/home.nix + ../home.nix + ../dotfiles.nix + ]; +} \ No newline at end of file diff --git a/users/guanranwang/home-manager/darwin/presets/gaming.nix b/users/guanranwang/home-manager/darwin/presets/gaming.nix new file mode 100644 index 0000000..5968c16 --- /dev/null +++ b/users/guanranwang/home-manager/darwin/presets/gaming.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + imports = [ + ./desktop.nix + ]; + + home.packages = with pkgs; [ + prismlauncher + ]; +} \ No newline at end of file diff --git a/users/guanranwang/home-manager/nixos/default.nix b/users/guanranwang/home-manager/nixos/default.nix deleted file mode 100644 index 77d7cc9..0000000 --- a/users/guanranwang/home-manager/nixos/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: - -{ - imports = [ - ../common/home.nix - ./home.nix - - ./dotfiles.nix - ./i18n.nix - ./sway.nix - ./waybar.nix - - ./xdg - ]; -} \ No newline at end of file diff --git a/users/guanranwang/home-manager/nixos/home.nix b/users/guanranwang/home-manager/nixos/home.nix index 9979e46..590eba8 100644 --- a/users/guanranwang/home-manager/nixos/home.nix +++ b/users/guanranwang/home-manager/nixos/home.nix @@ -106,10 +106,6 @@ amberol netease-cloud-music-gtk - # game - steam - #lunar-client - bitwarden #discord #qq @@ -117,9 +113,7 @@ mousai protonup-qt piper - prismlauncher telegram-desktop - osu-lazer-bin qbittorrent gradience dippi @@ -283,11 +277,6 @@ terminal = "${pkgs.alacritty}/bin/alacritty"; }; - mangohud = { - enable = true; - # TODO: add configuration, i have no idea how to display stuff with nix syntax - }; - #boxxy = { # enable = true; # #rules = { diff --git a/users/guanranwang/home-manager/nixos/presets/desktop.nix b/users/guanranwang/home-manager/nixos/presets/desktop.nix new file mode 100644 index 0000000..e0e5dd0 --- /dev/null +++ b/users/guanranwang/home-manager/nixos/presets/desktop.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + imports = [ + ../../common/home.nix + ../home.nix + + ../dotfiles.nix + ../i18n.nix + ../sway.nix + ../waybar.nix + + ../xdg + ]; +} \ No newline at end of file diff --git a/users/guanranwang/home-manager/nixos/presets/gaming.nix b/users/guanranwang/home-manager/nixos/presets/gaming.nix new file mode 100644 index 0000000..8cbf30f --- /dev/null +++ b/users/guanranwang/home-manager/nixos/presets/gaming.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: + +{ + imports = [ + ./desktop.nix + ]; + + home.packages = with pkgs; [ + steam + #lunar-client + prismlauncher + osu-lazer-bin + ]; + + programs.mangohud = { + enable = true; + # TODO: add configuration, i have no idea how to display stuff with nix syntax + }; +} \ No newline at end of file diff --git a/users/guanranwang/nixos.nix b/users/guanranwang/nixos/presets/desktop.nix similarity index 80% rename from users/guanranwang/nixos.nix rename to users/guanranwang/nixos/presets/desktop.nix index 032d115..1e4c042 100644 --- a/users/guanranwang/nixos.nix +++ b/users/guanranwang/nixos/presets/desktop.nix @@ -14,18 +14,18 @@ # Flakes imports = [ - ../../flakes/nixos/home-manager.nix - ../../flakes/nixos/sops-nix.nix - ../../flakes/nixos/hosts.nix - ../../flakes/nixos/berberman.nix + ../../../../flakes/nixos/home-manager.nix + ../../../../flakes/nixos/sops-nix.nix + ../../../../flakes/nixos/hosts.nix + ../../../../flakes/nixos/berberman.nix ]; ### home-manager - home-manager.users.guanranwang = import ./home-manager/nixos; + home-manager.users.guanranwang = import ../../home-manager/nixos/presets/desktop.nix; ### sops-nix nix.extraOptions = "!include ${config.sops.secrets.nix-access-tokens.path}"; users.groups."nix-access-tokens" = {}; sops = { - defaultSopsFile = ./secrets/secrets.yaml; + defaultSopsFile = ../../secrets/secrets.yaml; age.sshKeyPaths = [ "/nix/persist/system/etc/ssh/ssh_host_ed25519_key" ]; gnupg.sshKeyPaths = []; secrets = { diff --git a/users/guanranwang/nixos/presets/gaming.nix b/users/guanranwang/nixos/presets/gaming.nix new file mode 100644 index 0000000..a6a4cba --- /dev/null +++ b/users/guanranwang/nixos/presets/gaming.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./desktop.nix + ]; + + home-manager.users.guanranwang = import ../../home-manager/nixos/presets/gaming.nix; +} \ No newline at end of file