From 7fa104b72245cc37519b6a778efaceb7d97bf274 Mon Sep 17 00:00:00 2001 From: Lilith Date: Wed, 12 Mar 2025 15:43:41 +0100 Subject: [PATCH] refactor2 --- flake.lock | 114 ++++++++++++++++++++++-------- home/default.nix | 3 +- home/matshell.nix | 4 +- hosts/lilith-pc/default.nix | 12 +++- system/{ => core}/audio.nix | 0 system/{ => core}/bluetooth.nix | 0 system/{ => core}/boot.nix | 0 system/{ => core}/btrfs.nix | 0 system/core/default.nix | 14 ++++ system/{ => core}/env.nix | 0 system/{ => core}/fonts.nix | 0 system/{ => core}/networking.nix | 0 system/{ => core}/nix.nix | 0 system/{ => core}/packages.nix | 0 system/{ => core}/persistence.nix | 0 system/{ => core}/sops.nix | 0 system/{ => core}/ssh.nix | 0 system/{ => core}/syncthing.nix | 0 system/{ => core}/users.nix | 0 system/{ => core}/wayland.nix | 0 system/{ => core}/zsh.nix | 0 system/default.nix | 28 +------- system/nfs.nix | 13 ---- system/optional/default.nix | 7 ++ system/optional/desktop.nix | 28 ++++++++ system/optional/nfs.nix | 23 ++++++ system/optional/steam.nix | 27 +++++++ system/optional/stylix.nix | 39 ++++++++++ system/steam.nix | 5 -- system/stylix.nix | 34 --------- 30 files changed, 240 insertions(+), 111 deletions(-) rename system/{ => core}/audio.nix (100%) rename system/{ => core}/bluetooth.nix (100%) rename system/{ => core}/boot.nix (100%) rename system/{ => core}/btrfs.nix (100%) create mode 100644 system/core/default.nix rename system/{ => core}/env.nix (100%) rename system/{ => core}/fonts.nix (100%) rename system/{ => core}/networking.nix (100%) rename system/{ => core}/nix.nix (100%) rename system/{ => core}/packages.nix (100%) rename system/{ => core}/persistence.nix (100%) rename system/{ => core}/sops.nix (100%) rename system/{ => core}/ssh.nix (100%) rename system/{ => core}/syncthing.nix (100%) rename system/{ => core}/users.nix (100%) rename system/{ => core}/wayland.nix (100%) rename system/{ => core}/zsh.nix (100%) delete mode 100644 system/nfs.nix create mode 100644 system/optional/default.nix create mode 100644 system/optional/desktop.nix create mode 100644 system/optional/nfs.nix create mode 100644 system/optional/steam.nix create mode 100644 system/optional/stylix.nix delete mode 100644 system/steam.nix delete mode 100644 system/stylix.nix diff --git a/flake.lock b/flake.lock index 5a5c873f..f7bd5f60 100644 --- a/flake.lock +++ b/flake.lock @@ -3,18 +3,20 @@ "ags": { "inputs": { "astal": "astal", - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1738087375, "narHash": "sha256-GLyNtU9A2VN22jNRHZ2OXuFfTJLh8uEVVt+ftsKUX0c=", - "owner": "Aylur", + "owner": "aylur", "repo": "ags", "rev": "a6a7a0adb17740f4c34a59902701870d46fbb6a4", "type": "github" }, "original": { - "owner": "Aylur", + "owner": "aylur", "repo": "ags", "type": "github" } @@ -139,6 +141,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1740872218, + "narHash": "sha256-ZaMw0pdoUKigLpv9HiNDH2Pjnosg7NBYMJlHTIsHEUo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3876f6b87db82f33775b1ef5ea343986105db764", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -273,22 +293,59 @@ "type": "github" } }, - "nixpkgs": { + "matshell": { + "inputs": { + "ags": [ + "ags" + ], + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2" + }, "locked": { - "lastModified": 1737469691, - "narHash": "sha256-nmKOgAU48S41dTPIXAq0AHZSehWUn6ZPrUKijHAMmIk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "9e4d5190a9482a1fb9d18adf0bdb83c6e506eaab", + "lastModified": 1741777612, + "narHash": "sha256-uU3yN8Ee5nDzlFebSgIgjCMpZvClBXv7JZiUxMQp0CU=", + "owner": "Neurarian", + "repo": "matshell", + "rev": "29e6a903a96988d8423430006b1dc3d541dacc28", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", + "owner": "Neurarian", + "repo": "matshell", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739834344, + "narHash": "sha256-PUAcU3YlKNFYrBBHkqshO4wRfMunzhMTEIH1dyhjTtk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f0295845e58ada369322524631821b01c0db13a7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1740872140, + "narHash": "sha256-3wHafybyRfpUCLoE8M+uPVZinImg3xX+Nm6gEfN3G8I=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1735651292, @@ -305,29 +362,14 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1739834344, - "narHash": "sha256-PUAcU3YlKNFYrBBHkqshO4wRfMunzhMTEIH1dyhjTtk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "f0295845e58ada369322524631821b01c0db13a7", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "ags": "ags", "flake-utils": "flake-utils", "home-manager": "home-manager", "impermanence": "impermanence", - "nixpkgs": "nixpkgs_2", + "matshell": "matshell", + "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", "sops-nix": "sops-nix", "stylix": "stylix" @@ -372,7 +414,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2", + "systems": "systems_3", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", @@ -409,6 +451,20 @@ } }, "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/home/default.nix b/home/default.nix index 8b6aedd0..efcd1025 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,4 +1,4 @@ -{ home-manager, ags, sops-nix, ... } @ inputs: { +{ home-manager, ags, sops-nix, matshell, ... } @ inputs: { imports = [ home-manager.nixosModules.home-manager ]; @@ -7,6 +7,7 @@ home-manager.users."lilith" = { imports = [ # ags.homeManagerModules.default + matshell.homeManagerModules.default sops-nix.homeManagerModules.sops # ./ags # ToDo: get codin :3 ./hyprland diff --git a/home/matshell.nix b/home/matshell.nix index a61ae358..79473351 100644 --- a/home/matshell.nix +++ b/home/matshell.nix @@ -1,6 +1,4 @@ -{ matshell, ...}: { - imports = [ matshell.homeManagerModules.default ]; - +{...} @ inputs: { programs.ags = { matshell.enable = true; }; diff --git a/hosts/lilith-pc/default.nix b/hosts/lilith-pc/default.nix index 38427439..b518c993 100644 --- a/hosts/lilith-pc/default.nix +++ b/hosts/lilith-pc/default.nix @@ -1,4 +1,14 @@ -{ lib, ...}: { +{ config, lib, ...}: { + + system.stateVersion = "24.11"; + + desktop.enable = true; + gaming.enable = true; + nfs.client.enable = true; + stylix.enable = true; + + + home-manager.users."lilith".wayland.windowManager.hyprland.settings = { input.kb_layout = lib.mkForce "en"; diff --git a/system/audio.nix b/system/core/audio.nix similarity index 100% rename from system/audio.nix rename to system/core/audio.nix diff --git a/system/bluetooth.nix b/system/core/bluetooth.nix similarity index 100% rename from system/bluetooth.nix rename to system/core/bluetooth.nix diff --git a/system/boot.nix b/system/core/boot.nix similarity index 100% rename from system/boot.nix rename to system/core/boot.nix diff --git a/system/btrfs.nix b/system/core/btrfs.nix similarity index 100% rename from system/btrfs.nix rename to system/core/btrfs.nix diff --git a/system/core/default.nix b/system/core/default.nix new file mode 100644 index 00000000..24c34874 --- /dev/null +++ b/system/core/default.nix @@ -0,0 +1,14 @@ +{...}: { + imports = [ + ./audio.nix + ./bluetooth.nix + ./boot.nix + ./btrfs.nix + ./env.nix + ./fonts.nix + ./networking.nix + ./nix.nix + ./packages.nix + ./persistence.nix + ]; +} diff --git a/system/env.nix b/system/core/env.nix similarity index 100% rename from system/env.nix rename to system/core/env.nix diff --git a/system/fonts.nix b/system/core/fonts.nix similarity index 100% rename from system/fonts.nix rename to system/core/fonts.nix diff --git a/system/networking.nix b/system/core/networking.nix similarity index 100% rename from system/networking.nix rename to system/core/networking.nix diff --git a/system/nix.nix b/system/core/nix.nix similarity index 100% rename from system/nix.nix rename to system/core/nix.nix diff --git a/system/packages.nix b/system/core/packages.nix similarity index 100% rename from system/packages.nix rename to system/core/packages.nix diff --git a/system/persistence.nix b/system/core/persistence.nix similarity index 100% rename from system/persistence.nix rename to system/core/persistence.nix diff --git a/system/sops.nix b/system/core/sops.nix similarity index 100% rename from system/sops.nix rename to system/core/sops.nix diff --git a/system/ssh.nix b/system/core/ssh.nix similarity index 100% rename from system/ssh.nix rename to system/core/ssh.nix diff --git a/system/syncthing.nix b/system/core/syncthing.nix similarity index 100% rename from system/syncthing.nix rename to system/core/syncthing.nix diff --git a/system/users.nix b/system/core/users.nix similarity index 100% rename from system/users.nix rename to system/core/users.nix diff --git a/system/wayland.nix b/system/core/wayland.nix similarity index 100% rename from system/wayland.nix rename to system/core/wayland.nix diff --git a/system/zsh.nix b/system/core/zsh.nix similarity index 100% rename from system/zsh.nix rename to system/core/zsh.nix diff --git a/system/default.nix b/system/default.nix index bf460633..d843dc98 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,29 +1,7 @@ {...}: { imports = [ - ./boot.nix - ./packages.nix - ./env.nix - ./btrfs.nix - ./users.nix - - ./networking.nix - ./persistence.nix - ./nix.nix - ./audio.nix - ./ssh.nix - - ./syncthing.nix - ./wayland.nix - ./steam.nix - - ./nfs.nix - ./fonts.nix - ./bluetooth.nix - ./zsh.nix - - ./sops.nix - ./stylix.nix + ./core + ./optional ]; - - system.stateVersion = "24.11"; + # system.stateVersion = "24.11"; } diff --git a/system/nfs.nix b/system/nfs.nix deleted file mode 100644 index 03f7b533..00000000 --- a/system/nfs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: { - fileSystems."/mnt/nas" = { - device = "nixserver:/share"; - fsType = "nfs"; - options = [ - "nfsvers=4.2" - "noauto" - "x-systemd.automount" - "x-systemd.idle-timeout=600" - "_netdev" - ]; - }; -} diff --git a/system/optional/default.nix b/system/optional/default.nix new file mode 100644 index 00000000..218b4e91 --- /dev/null +++ b/system/optional/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [ + ./nfs.nix + ./desktop.nix + ./steam.nix + ]; +} diff --git a/system/optional/desktop.nix b/system/optional/desktop.nix new file mode 100644 index 00000000..1d634829 --- /dev/null +++ b/system/optional/desktop.nix @@ -0,0 +1,28 @@ +{ config, lib, ...}: { + options.desktop.enable = lib.mkEnableOption "Enable Wayland compositor with hyprland login"; + + config = lib.mkIf config.desktop.enable { + hardware.graphics.enable = true; + + security.polkit.enable = true; + security.pam.services.hyprlock = {}; + + services.dbus.enable = true; + + programs.hyprland.enable = true; + + services.greetd = { + enable = true; + settings = { + default_session = { + user = "lilith"; + command = "Hyprland"; + }; + initial_session = { + user = "lilith"; + command = "Hyprland"; + }; + }; + }; + }; +} diff --git a/system/optional/nfs.nix b/system/optional/nfs.nix new file mode 100644 index 00000000..47e71ad4 --- /dev/null +++ b/system/optional/nfs.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: { + + options.nfs.client.enable = lib.mkEnableOption "Enable Nas (via NFS) as a client"; + options.nfs.server.enable = lib.mkEnableOption "Enable Nas (via NFS) as the server"; + + config = lib.mkIf config.nfs.client.enable { + fileSystems."/mnt/nas" = { + device = "nixserver:/share"; + fsType = "nfs"; + options = [ + "nfsvers=4.2" + "noauto" + "x-systemd.automount" + "x-systemd.idle-timeout=600" + "_netdev" + ]; + }; + }; + + config = lib.mkIf config.nfs.server.enable { + + }; +} diff --git a/system/optional/steam.nix b/system/optional/steam.nix new file mode 100644 index 00000000..56b70276 --- /dev/null +++ b/system/optional/steam.nix @@ -0,0 +1,27 @@ +{ config, lib, ...}: { + + options.gaming.enable = lib.mkEnableOption "Enable steam and related software"; + + config = lib.mkIf config.gaming.enable { + programs = { + gamescope = { + enable = true; + capSysNice = true; + }; + + steam = { + enable = true; + gamescopeSession.enable = true; + }; + + gamemode.enable = true; + }; + + environment = { + systemPackages = with pkgs; [ + mangohud + protonup + ]; + }; + }; +} diff --git a/system/optional/stylix.nix b/system/optional/stylix.nix new file mode 100644 index 00000000..03eb0193 --- /dev/null +++ b/system/optional/stylix.nix @@ -0,0 +1,39 @@ +{stylix, pkgs, config, lib, ...}: { + options.stylix.enable = lib.mkEnableOption "Enable Stylix"; + + config = lib.mkIf config.stylix.enable { + imports = [stylix.nixosModules.stylix]; + + stylix = { + enable = true; + + image = ../wallpapers/default.png; + polarity = "dark"; + + opacity = { + terminal = 0.8; + popups = 0.8; + }; + + fonts = { + monospace = { + package = pkgs.nerd-fonts.jetbrains-mono; + name = "JetBrainsMono Nerd Font"; + }; + + emoji = { + package = pkgs.twemoji-color-font; + name = "Twemoji"; + }; + + sizes = { applications = 14; desktop = 12; popups = 12; terminal = 14; }; + }; + + cursor = { + package = pkgs.rose-pine-cursor; + name = "Rosé Pine"; + }; + }; + + }; +} diff --git a/system/steam.nix b/system/steam.nix deleted file mode 100644 index d2df690f..00000000 --- a/system/steam.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - programs.steam.enable = true; - - programs.steam.remotePlay.openFirewall = true; -} diff --git a/system/stylix.nix b/system/stylix.nix deleted file mode 100644 index 61674659..00000000 --- a/system/stylix.nix +++ /dev/null @@ -1,34 +0,0 @@ -{stylix, pkgs, ...}: { - imports = [stylix.nixosModules.stylix]; - - stylix = { - enable = true; - - image = ../wallpapers/default.png; - polarity = "dark"; - - opacity = { - terminal = 0.8; - popups = 0.8; - }; - - fonts = { - monospace = { - package = pkgs.nerd-fonts.jetbrains-mono; - name = "JetBrainsMono Nerd Font"; - }; - - emoji = { - package = pkgs.twemoji-color-font; - name = "Twemoji"; - }; - - sizes = { applications = 14; desktop = 12; popups = 12; terminal = 14; }; - }; - - cursor = { - package = pkgs.rose-pine-cursor; - name = "Rosé Pine"; - }; - }; -}