diff --git a/flake.lock b/flake.lock index 2ce882a..94f5538 100644 --- a/flake.lock +++ b/flake.lock @@ -304,6 +304,26 @@ "type": "github" } }, + "haumea": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708375098, + "narHash": "sha256-DaFJp3wDHgOqx98U0SF57bXaH2Orp106c+jSdPCVu1E=", + "owner": "nix-community", + "repo": "haumea", + "rev": "ec6350fd9353e7f27ce0e85d31f82e3ed73e4d70", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "haumea", + "type": "github" + } + }, "hercules-ci-effects": { "inputs": { "flake-parts": "flake-parts_3", @@ -549,6 +569,7 @@ "inputs": { "flake-parts": "flake-parts", "hardware": "hardware", + "haumea": "haumea", "home-manager": "home-manager", "microvm": "microvm", "nix-index-database": "nix-index-database", diff --git a/flake.nix b/flake.nix index 434a096..1a6cb62 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,10 @@ url = "github:Open-Wine-Components/umu-launcher/?dir=packaging\/nix&submodules=1"; inputs.nixpkgs.follows = "nixpkgs"; }; + haumea = { + url = "github:nix-community/haumea"; + inputs.nixpkgs.follows = "nixpkgs"; + }; ## deduplication flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; diff --git a/hosts/default.nix b/hosts/default.nix index f188567..560c297 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -4,6 +4,7 @@ homeImports, lib, pkgs, + config, ... }: let specialArgs = { @@ -13,7 +14,10 @@ rootPaths = prependAll "${self}/"; modulePaths = prependAll "${self}/system/"; - inherit (import "${self}/system") desktop; + profiles = inputs.haumea.lib.load { + inputs = {inherit inputs lib;}; + src = "${self}/profiles"; + }; in { flake.colmena = { meta = { @@ -40,21 +44,21 @@ in { }; imports = lib.flatten [ ./kidney - (modulePaths [ - "core/tools.nix" - "core/users.nix" - "core/locale.nix" + (with profiles; [ + core.tools + core.users + core.locale - "programs/tools.nix" - "programs/zsh.nix" - "programs/home-manager.nix" - "hardware/graphics.nix" + programs.tools + programs.zsh + programs.home-manager + hardware.graphics - "services/flatpak.nix" - "services/xdg-portals.nix" + services.flatpak + services.xdg-portals - "nix" - "nix/gc.nix" + nix.default + nix.gc ]) { home-manager = { @@ -70,37 +74,67 @@ in { targetUser = "xun"; targetHost = "nixdesk.local"; }; - imports = - desktop - ++ lib.flatten [ - ./nixdesk + imports = lib.flatten [ + ./nixdesk - (rootPaths [ - "secrets" - "secrets/nixdesk" - ]) + (rootPaths [ + "secrets" + "secrets/nixdesk" + ]) - (modulePaths [ - "services/syncthing.nix" - "services/virt/waydroid.nix" - #"services/virt/virt-manager.nix" - #"network/wifi.nix" - #"services/ollama.nix" - "desktop/x11/nosleep.nix" + (with profiles; [ + core.default + core.tools + core.compat + core.boot + core.docs + core.gvfs - # "programs/gamemode.nix" # TEMP: TODO - # "programs/gamescope.nix" # TEMP: TODO - # "programs/steam.nix" # TEMP: TODO - "programs/RE" - ]) + nix.gc - { - home-manager = { - users.xun.imports = homeImports."xun@nixdesk"; - extraSpecialArgs = specialArgs; - }; - } - ]; + hardware.graphics + hardware.steam-hardware + hardware.bluetooth + hardware.qmk + + network.networkd + network.avahi + network.localsend + network.tailscale + network.goldberg + + desktop.default + desktop.awesome + desktop.sway + #..desktop.hyprland + + programs.default + programs.tools + + services.default + services.pipewire + services.flatpak + + services.syncthing + services.virt.waydroid + #services.virt.virt-manager + #network.wifi + #services.ollama + desktop.x11.nosleep + + # programs.gamemode # TEMP: TODO + # programs.gamescope # TEMP: TODO + # programs.steam # TEMP: TODO + programs.RE.default + ]) + + { + home-manager = { + users.xun.imports = homeImports."xun@nixdesk"; + extraSpecialArgs = specialArgs; + }; + } + ]; }; hopper = { deployment = { diff --git a/system/core/compat.nix b/system/core/compat.nix index 47980ae..066c7bb 100644 --- a/system/core/compat.nix +++ b/system/core/compat.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: let +{ + self, + super, + root, +}: {pkgs, ...}: let list-of-libraries = with pkgs; [ alsa-lib at-spi2-atk diff --git a/system/core/default.nix b/system/core/default.nix index ffa87ad..e6101a5 100644 --- a/system/core/default.nix +++ b/system/core/default.nix @@ -1,10 +1,14 @@ -{lib, ...}: { +{ + self, + super, + root, +}: { imports = [ - ./security.nix - ./users.nix - ./ssh.nix - ./locale.nix - ../nix - ../programs/zsh.nix + super.security + super.users + super.ssh + super.locale + root.nix.default + root.programs.zsh ]; } diff --git a/system/core/docs.nix b/system/core/docs.nix index 576e099..57bbfaa 100644 --- a/system/core/docs.nix +++ b/system/core/docs.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + self, + super, + root, +}: {pkgs, ...}: { documentation = { dev.enable = true; # man.generateCaches = true; # this does slow down builds by quite a lot diff --git a/system/core/locale.nix b/system/core/locale.nix index ec028eb..694afed 100644 --- a/system/core/locale.nix +++ b/system/core/locale.nix @@ -1,4 +1,4 @@ -{lib, ...}: { +{...}: {lib, ...}: { i18n = { defaultLocale = "en_US.UTF-8"; supportedLocales = [ diff --git a/system/core/tools.nix b/system/core/tools.nix index acac8c4..d713348 100644 --- a/system/core/tools.nix +++ b/system/core/tools.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: {pkgs, ...}: { environment.systemPackages = with pkgs; [ htop btop diff --git a/system/core/users.nix b/system/core/users.nix index cc33c70..d4e87db 100644 --- a/system/core/users.nix +++ b/system/core/users.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: {pkgs, ...}: { users.users.xun = { isNormalUser = true; initialPassword = "nixos"; diff --git a/system/default.nix b/system/default.nix deleted file mode 100644 index ba2f041..0000000 --- a/system/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -let - desktop = [ - ./core - ./core/tools.nix - ./core/compat.nix - ./core/boot.nix - ./core/docs.nix - ./core/gvfs.nix - - ./nix/gc.nix - - ./hardware/graphics.nix - ./hardware/steam-hardware.nix - ./hardware/bluetooth.nix - ./hardware/qmk.nix - - ./network/networkd.nix - ./network/avahi.nix - ./network/localsend.nix - ./network/tailscale.nix - ./network/goldberg.nix - - ./desktop - ./desktop/awesome.nix - ./desktop/sway.nix - #./desktop/hyprland.nix - - ./programs - ./programs/tools.nix - - ./services - ./services/pipewire.nix - ./services/flatpak.nix - ]; -in { - inherit desktop; -} diff --git a/system/network/localsend.nix b/system/network/localsend.nix index d28c474..3f2066f 100644 --- a/system/network/localsend.nix +++ b/system/network/localsend.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + self, + super, + root, +}: {pkgs, ...}: { environment.systemPackages = with pkgs; [ localsend ]; diff --git a/system/nix/default.nix b/system/nix/default.nix index 30ca511..5874f81 100644 --- a/system/nix/default.nix +++ b/system/nix/default.nix @@ -1,4 +1,8 @@ { + self, + super, + root, +}: { config, pkgs, inputs, @@ -6,8 +10,8 @@ ... }: { imports = [ - ./nixpkgs.nix - ./substituters.nix + super.nixpkgs + super.substituters ]; # git is needed for flakes diff --git a/system/nix/nixpkgs.nix b/system/nix/nixpkgs.nix index 8620e5b..d554375 100644 --- a/system/nix/nixpkgs.nix +++ b/system/nix/nixpkgs.nix @@ -1,4 +1,8 @@ { + self, + super, + root, +}: { nixpkgs = { config.allowUnfree = true; config.permittedInsecurePackages = []; diff --git a/system/nix/substituters.nix b/system/nix/substituters.nix index bb2d804..cd271f6 100644 --- a/system/nix/substituters.nix +++ b/system/nix/substituters.nix @@ -1,4 +1,8 @@ { + self, + super, + root, +}: { nix.settings = { substituters = [ # high priority since it's almost always used diff --git a/system/programs/RE/default.nix b/system/programs/RE/default.nix index 37e9937..30c6dba 100644 --- a/system/programs/RE/default.nix +++ b/system/programs/RE/default.nix @@ -1,5 +1,9 @@ # patchelf --replace-needed libbinaryninjacore.so.1 ${symlinkJoin} $out/opt/binaryninja { + self, + super, + root, +}: { pkgs, self, ... diff --git a/system/programs/default.nix b/system/programs/default.nix index 3a445a2..ab99e81 100644 --- a/system/programs/default.nix +++ b/system/programs/default.nix @@ -1,9 +1,13 @@ { - imports = [ - ./fonts.nix - ./home-manager.nix - ./qt.nix - ./adb.nix + self, + super, + root, +}: { + imports = with super; [ + fonts + home-manager + qt + adb ]; programs = { diff --git a/system/programs/fonts.nix b/system/programs/fonts.nix index adf3bb8..0ea8cfa 100644 --- a/system/programs/fonts.nix +++ b/system/programs/fonts.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + self, + super, + root, +}: {pkgs, ...}: { fonts = { packages = with pkgs; [ powerline-fonts diff --git a/system/programs/home-manager.nix b/system/programs/home-manager.nix index 99f9df1..925a30f 100644 --- a/system/programs/home-manager.nix +++ b/system/programs/home-manager.nix @@ -1,4 +1,4 @@ -{inputs, ...}: { +{...}: {inputs, ...}: { imports = [ inputs.home-manager.nixosModules.default ]; diff --git a/system/programs/tools.nix b/system/programs/tools.nix index 4d7611c..d478e9e 100644 --- a/system/programs/tools.nix +++ b/system/programs/tools.nix @@ -1,4 +1,4 @@ -{ +{...}: { pkgs, config, ... diff --git a/system/services/syncthing.nix b/system/services/syncthing.nix index 6636d44..8693ebd 100644 --- a/system/services/syncthing.nix +++ b/system/services/syncthing.nix @@ -1,4 +1,27 @@ -{config, ...}: { +{ + self, + super, + root, +}: {config, ...}: let + devices = { + "nixdesk" = { + id = "XXABQZC-CO6OM2E-EMB3QIJ-NF5I3WU-CCQPPRY-7BX4ZSS-WIU4WW2-WXFWVQR"; + autoAcceptFolders = true; + }; + "redmi-note-10-pro" = { + id = "WJPE56U-56LPOYB-IAENGSW-IFQ4A6J-66JX73I-ONXX4PY-QXJK6IF-UZHVWA7"; + autoAcceptFolders = true; + }; + "hopper" = { + id = "DK3RPET-ACMULD2-TLQS6YM-XWUMS3N-JRNDNME-YTM3H4X-P7QVUKB-N3PL5QF"; + autoAcceptFolders = true; + }; + "school-probook" = { + id = "ZYNRRWE-SIJLPMQ-5LJDWCY-BF5VMRM-FQRFEW4-L7PKA23-HVJADTV-FZYRSQM"; + autoAcceptFolders = true; + }; + }; +in { services.syncthing = { enable = true; openDefaultPorts = true; @@ -9,27 +32,10 @@ overrideDevices = true; settings = { - devices = { - "nixdesk" = { - id = "XXABQZC-CO6OM2E-EMB3QIJ-NF5I3WU-CCQPPRY-7BX4ZSS-WIU4WW2-WXFWVQR"; - autoAcceptFolders = true; - }; - "redmi-note-10-pro" = { - id = "WJPE56U-56LPOYB-IAENGSW-IFQ4A6J-66JX73I-ONXX4PY-QXJK6IF-UZHVWA7"; - autoAcceptFolders = true; - }; - "hopper" = { - id = "DK3RPET-ACMULD2-TLQS6YM-XWUMS3N-JRNDNME-YTM3H4X-P7QVUKB-N3PL5QF"; - autoAcceptFolders = true; - }; - "school-probook" = { - id = "ZYNRRWE-SIJLPMQ-5LJDWCY-BF5VMRM-FQRFEW4-L7PKA23-HVJADTV-FZYRSQM"; - autoAcceptFolders = true; - }; - }; + inherit devices; folders = { "~/secrets" = { - devices = builtins.attrNames config.services.syncthing.settings.devices; + devices = builtins.attrNames devices; versioning = { type = "trashcan"; params.cleanoutDays = "180"; @@ -37,7 +43,7 @@ id = "sfw9y-yusup"; }; "~/docs/xun-megavault" = { - devices = builtins.attrNames config.services.syncthing.settings.devices; + devices = builtins.attrNames devices; id = "1zkf-wf5r"; versioning = { type = "simple"; diff --git a/system/services/xdg-portals.nix b/system/services/xdg-portals.nix index faff144..33571ba 100644 --- a/system/services/xdg-portals.nix +++ b/system/services/xdg-portals.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: {pkgs, ...}: { xdg.portal = { enable = true; extraPortals = with pkgs; [