From 33cbd9dfc73a641b5fcf4009666dd593589648db Mon Sep 17 00:00:00 2001 From: ooks-io Date: Fri, 24 May 2024 17:50:32 +1200 Subject: [PATCH] refactor(system): flatten --- flake.lock | 257 ++---------------- .../modules/base/boot/loader/default.nix | 2 +- inputs/system/modules/base/boot/plymouth.nix | 2 +- inputs/system/modules/base/default.nix | 5 +- .../modules/base/displayManager/default.nix | 2 +- .../base/displayManager/tuigreet/default.nix | 30 -- inputs/system/modules/base/locale/default.nix | 17 -- .../modules/base/networking/default.nix | 12 +- inputs/system/modules/base/nix/default.nix | 49 +++- inputs/system/modules/base/nix/nh.nix | 4 - inputs/system/modules/base/nix/nixpkgs.nix | 1 - .../modules/base/nix/{sub.nix => subs.nix} | 0 12 files changed, 72 insertions(+), 309 deletions(-) delete mode 100644 inputs/system/modules/base/displayManager/tuigreet/default.nix delete mode 100644 inputs/system/modules/base/locale/default.nix rename inputs/system/modules/base/nix/{sub.nix => subs.nix} (100%) diff --git a/flake.lock b/flake.lock index bc53598..9dc3ab4 100644 --- a/flake.lock +++ b/flake.lock @@ -103,21 +103,6 @@ "type": "gitlab" } }, - "flake-compat": { - "locked": { - "lastModified": 1688025799, - "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", - "owner": "nix-community", - "repo": "flake-compat", - "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -159,28 +144,6 @@ "type": "github" } }, - "flake-parts_3": { - "inputs": { - "nixpkgs-lib": [ - "nixpkgs-wayland", - "nix-eval-jobs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-root": { "locked": { "lastModified": 1713493429, @@ -267,25 +230,7 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_11" - }, - "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" - } - }, - "flake-utils_6": { - "inputs": { - "systems": "systems_14" + "systems": "systems_13" }, "locked": { "lastModified": 1710146030, @@ -607,7 +552,7 @@ "xdg-portal-hyprland", "nixpkgs" ], - "systems": "systems_12" + "systems": "systems_11" }, "locked": { "lastModified": 1713121246, @@ -688,25 +633,6 @@ "type": "github" } }, - "lib-aggregate": { - "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs-lib": "nixpkgs-lib_2" - }, - "locked": { - "lastModified": 1716120557, - "narHash": "sha256-rvNq9YolMY1DRMgwdAti8qwNDjkhTsotSWa15/Ch7+A=", - "owner": "nix-community", - "repo": "lib-aggregate", - "rev": "5fa64b174daa22fe0d20ebbcc0ec2c7905b503f1", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "lib-aggregate", - "type": "github" - } - }, "nh": { "inputs": { "nixpkgs": [ @@ -768,27 +694,6 @@ "type": "github" } }, - "nix-eval-jobs": { - "inputs": { - "flake-parts": "flake-parts_3", - "nix-github-actions": "nix-github-actions", - "nixpkgs": "nixpkgs_9", - "treefmt-nix": "treefmt-nix_2" - }, - "locked": { - "lastModified": 1715804156, - "narHash": "sha256-GtIHP86Cz1kD9xZO/cKbNQACHKdoT9WFbLJAq6W2EDY=", - "owner": "nix-community", - "repo": "nix-eval-jobs", - "rev": "bb95091f6c6f38f6cfc215a1797a2dd466312c8b", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-eval-jobs", - "type": "github" - } - }, "nix-formatter-pack": { "inputs": { "nixpkgs": [ @@ -812,28 +717,6 @@ "type": "github" } }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "nixpkgs-wayland", - "nix-eval-jobs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1703863825, - "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, "nix-on-droid": { "inputs": { "home-manager": [ @@ -948,21 +831,6 @@ "type": "github" } }, - "nixpkgs-lib_2": { - "locked": { - "lastModified": 1716079763, - "narHash": "sha256-DGRfb7fO7c3XDS3twmuaV5NAGPPdU3W7Q35fjIZc8iY=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "0df131b5ee4d928a4b664b6d0cd99cf134d6ab6b", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nixpkgs-small": { "locked": { "lastModified": 1716323205, @@ -979,60 +847,7 @@ "type": "github" } }, - "nixpkgs-wayland": { - "inputs": { - "flake-compat": "flake-compat", - "lib-aggregate": "lib-aggregate", - "nix-eval-jobs": "nix-eval-jobs", - "nixpkgs": "nixpkgs_10" - }, - "locked": { - "lastModified": 1716366111, - "narHash": "sha256-1i1YJjeGBiIzBjZir1pQBwueHjRkpcPEsSrNbiyqMg4=", - "owner": "nix-community", - "repo": "nixpkgs-wayland", - "rev": "088d7d9e7278f38cd9d01a4099e47fad5b1da66d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs-wayland", - "type": "github" - } - }, "nixpkgs_10": { - "locked": { - "lastModified": 1716293225, - "narHash": "sha256-pU9ViBVE3XYb70xZx+jK6SEVphvt7xMTbm6yDIF4xPs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "3eaeaeb6b1e08a016380c279f8846e0bd8808916", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_11": { - "locked": { - "lastModified": 1710451336, - "narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d691274a972b3165335d261cc4671335f5c67de9", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_12": { "locked": { "lastModified": 1712963716, "narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=", @@ -1048,7 +863,7 @@ "type": "github" } }, - "nixpkgs_13": { + "nixpkgs_11": { "locked": { "lastModified": 1716097317, "narHash": "sha256-1UMrLtgzielG/Sop6gl6oTSM4pDt7rF9j9VuxhDWDlY=", @@ -1178,16 +993,16 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1715037484, - "narHash": "sha256-OUt8xQFmBU96Hmm4T9tOWTu4oCswCzoVl+pxSq/kiFc=", + "lastModified": 1710451336, + "narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ad7efee13e0d216bf29992311536fce1d3eefbef", + "rev": "d691274a972b3165335d261cc4671335f5c67de9", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -1248,7 +1063,7 @@ }, "ooks-scripts": { "inputs": { - "nixpkgs": "nixpkgs_11" + "nixpkgs": "nixpkgs_9" }, "locked": { "lastModified": 1712473070, @@ -1283,7 +1098,6 @@ "nixarr": "nixarr", "nixpkgs": "nixpkgs_8", "nixpkgs-small": "nixpkgs-small", - "nixpkgs-wayland": "nixpkgs-wayland", "ooks-scripts": "ooks-scripts", "xdg-portal-hyprland": "xdg-portal-hyprland", "zjstatus": "zjstatus" @@ -1412,16 +1226,16 @@ }, "systems_11": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -1441,21 +1255,6 @@ } }, "systems_13": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_14": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1611,28 +1410,6 @@ "type": "github" } }, - "treefmt-nix_2": { - "inputs": { - "nixpkgs": [ - "nixpkgs-wayland", - "nix-eval-jobs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1711963903, - "narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, "vpnconfinement": { "inputs": { "nixpkgs": [ @@ -1658,8 +1435,8 @@ "inputs": { "hyprland-protocols": "hyprland-protocols_2", "hyprlang": "hyprlang_5", - "nixpkgs": "nixpkgs_12", - "systems": "systems_13" + "nixpkgs": "nixpkgs_10", + "systems": "systems_12" }, "locked": { "lastModified": 1716290197, @@ -1708,8 +1485,8 @@ "zjstatus": { "inputs": { "crane": "crane_2", - "flake-utils": "flake-utils_6", - "nixpkgs": "nixpkgs_13", + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_11", "rust-overlay": "rust-overlay_3" }, "locked": { diff --git a/inputs/system/modules/base/boot/loader/default.nix b/inputs/system/modules/base/boot/loader/default.nix index 02d8604..931ca7a 100644 --- a/inputs/system/modules/base/boot/loader/default.nix +++ b/inputs/system/modules/base/boot/loader/default.nix @@ -6,7 +6,7 @@ in { imports = [ - ./systemd + ./systemd.nix # ./grub ]; diff --git a/inputs/system/modules/base/boot/plymouth.nix b/inputs/system/modules/base/boot/plymouth.nix index c70170f..ba0860b 100644 --- a/inputs/system/modules/base/boot/plymouth.nix +++ b/inputs/system/modules/base/boot/plymouth.nix @@ -2,7 +2,7 @@ let inherit (lib) mkIf mkEnableOption; - cfg = config.systemModules.plymouth; + cfg = config.systemModules.boot.plymouth; in { diff --git a/inputs/system/modules/base/default.nix b/inputs/system/modules/base/default.nix index bf80828..17a6e72 100644 --- a/inputs/system/modules/base/default.nix +++ b/inputs/system/modules/base/default.nix @@ -2,14 +2,13 @@ { imports = [ - ./gaming ./shell - ./bootloader + ./boot ./nix ./programs ./displayManager ./networking - ./locale + ./locale.nix ./virtualization ./security ./services diff --git a/inputs/system/modules/base/displayManager/default.nix b/inputs/system/modules/base/displayManager/default.nix index 9f5db68..339daf1 100644 --- a/inputs/system/modules/base/displayManager/default.nix +++ b/inputs/system/modules/base/displayManager/default.nix @@ -1,5 +1,5 @@ { imports = [ - ./tuigreet + ./tuigreet.nix ]; } diff --git a/inputs/system/modules/base/displayManager/tuigreet/default.nix b/inputs/system/modules/base/displayManager/tuigreet/default.nix deleted file mode 100644 index e2b6adf..0000000 --- a/inputs/system/modules/base/displayManager/tuigreet/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, lib, config, ... }: -let - inherit (lib) mkIf; - tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet"; - host = config.systemModules.host; -in -{ - config = mkIf (host.type != "phone") { - services.greetd = { - enable = true; - settings = { - default_session = { - command = "${tuigreet} --time --remember --cmd Hyprland"; # TODO: dont hardcode this - user = "greeter"; - }; - }; - }; - - systemd.services.greetd.serviceConfig = { - Type = "idle"; - StandardInput = "tty"; - StandardOutput = "tty"; - StandardError = "journal"; # Without this errors will spam on screen - # Without these bootlogs will spam on screen - TTYReset = true; - TTYVHangup = true; - TTYVTDisallocate = true; - }; - }; -} diff --git a/inputs/system/modules/base/locale/default.nix b/inputs/system/modules/base/locale/default.nix deleted file mode 100644 index 71838bc..0000000 --- a/inputs/system/modules/base/locale/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ lib, ... }: - -let - inherit (lib) mkDefault; -in - -{ - i18n = { - defaultLocale = mkDefault "en_US.UTF-8"; - supportedLocales = mkDefault [ - "en_US.UTF-8/UTF-8" - ]; - }; - time.timeZone = mkDefault "Pacific/Auckland"; - location.provider = "geoclue2"; - services.geoclue2.enable = true; -} diff --git a/inputs/system/modules/base/networking/default.nix b/inputs/system/modules/base/networking/default.nix index 7ec92f8..93f89f9 100644 --- a/inputs/system/modules/base/networking/default.nix +++ b/inputs/system/modules/base/networking/default.nix @@ -7,12 +7,12 @@ in { imports = [ - ./firewall - ./tools - ./ssh - ./tcp - ./resolved - ./tailscale + ./firewall.nix + ./tools.nix + ./ssh.nix + ./tcp.nix + ./resolved.nix + ./tailscale.nix ]; config = mkIf (host.type != "phone") { diff --git a/inputs/system/modules/base/nix/default.nix b/inputs/system/modules/base/nix/default.nix index 2ff9461..b8b8582 100644 --- a/inputs/system/modules/base/nix/default.nix +++ b/inputs/system/modules/base/nix/default.nix @@ -1,10 +1,49 @@ -{ lib, ... }: +{ lib, config, pkgs, inputs, ... }: + +let + inherit (lib) mkIf mapAttrs mapAttrsToList; + host = config.systemModules.host; +in { imports = [ - ./nh - ./nix - ./nixpkgs - ./subs + ./nh.nix + ./nixpkgs.nix + ./subs.nix ]; + + config = mkIf (host.type != "phone") { + environment = { + systemPackages = with pkgs; [ + git + deadnix + statix + ]; + defaultPackages = []; + etc = { + "nix/flake-channels/nixpkgs".source = inputs.nixpkgs; + "nix/flake-channels/home-manager".source = inputs.nixpkgs; + }; + }; + nix = { + registry = mapAttrs (_: v: {flake = v;}) inputs; + nixPath = mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + optimise = { + automatic = true; + dates = [ "18:00" ]; + }; + gc = { + automatic = true; + dates = "Sun *-*-* 17:00"; + options = "--delete-older-than 30d"; + }; + settings = { + flake-registry = "etc/nix/registry.json"; + allowed-users = [ "root" "@wheel" ]; + trusted-users = [ "root" "@wheel" ]; + experimental-features = [ "nix-command" "flakes" ]; + builders-use-substitutes = true; + }; + }; + }; } diff --git a/inputs/system/modules/base/nix/nh.nix b/inputs/system/modules/base/nix/nh.nix index 7e052e1..5094bf0 100644 --- a/inputs/system/modules/base/nix/nh.nix +++ b/inputs/system/modules/base/nix/nh.nix @@ -13,10 +13,6 @@ in programs.nh = { enable = true; package = pkgs.nh; - clean = { - enable = true; - extraArgs = "--keep-since 30d"; - }; }; }; } diff --git a/inputs/system/modules/base/nix/nixpkgs.nix b/inputs/system/modules/base/nix/nixpkgs.nix index 7cb5a22..3241932 100644 --- a/inputs/system/modules/base/nix/nixpkgs.nix +++ b/inputs/system/modules/base/nix/nixpkgs.nix @@ -17,7 +17,6 @@ in }; overlays = [ (final: prev: { - waybar = inputs.nixpkgs-wayland.packages.${prev.system}.waybar; zjstatus = inputs.zjstatus.packages.${prev.system}.default; }) ]; diff --git a/inputs/system/modules/base/nix/sub.nix b/inputs/system/modules/base/nix/subs.nix similarity index 100% rename from inputs/system/modules/base/nix/sub.nix rename to inputs/system/modules/base/nix/subs.nix