diff --git a/nix/configurations.nix b/nix/configurations.nix index ecc9c2f..9164647 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -28,10 +28,7 @@ let name: value: if class == "nixos" then nixosSystem { - specialArgs = { - inherit (config.flake) self; - hostName = name; - }; + specialArgs.hostName = name; modules = [ cfg.modules.nixos.default inputs.home-manager.nixosModules.home-manager @@ -41,15 +38,11 @@ let } else if class == "darwin" then darwinSystem { - specialArgs = { - inherit (config.flake) self; - hostName = name; - }; + specialArgs = { inherit (config.flake) self; }; modules = [ cfg.modules.darwin.default inputs.home-manager.darwinModules.home-manager { home-manager = globalCfg name value; } - (value.extraCfg or { }) ] ++ optional value.graphical cfg.modules.darwin.graphical; } else diff --git a/nix/homes/rafiq/_nvf/languages.nix b/nix/homes/rafiq/_nvf/languages.nix index 6378a42..cc3dd8c 100644 --- a/nix/homes/rafiq/_nvf/languages.nix +++ b/nix/homes/rafiq/_nvf/languages.nix @@ -4,8 +4,7 @@ enableTreesitter = true; bash.enable = true; clang.enable = true; - # broken on macos - # csharp.enable = true; + csharp.enable = true; css.enable = true; go.enable = true; html.enable = true; diff --git a/nix/manifest.nix b/nix/manifest.nix index 18d9474..6d4698d 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -7,95 +7,84 @@ shell = "fish"; pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; }; - hosts = { - darwin = { - venus = { - graphical = true; - machine.platform = "intel"; + hosts.darwin.venus.graphical = true; + hosts.nixos = { + nemesis = { + graphical = true; + machine = { + platform = "amd"; + gpu = "nvidia"; + root.drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; + monitors.main = { + id = "desc:OOO AN-270W04K"; + resolution = "3840x2160"; + refresh-rate = "60"; + scale = "2"; + }; }; - hephaestus = { - graphical = true; - machine.platform = "apple-silicon"; + extraCfg = { + services.fwupd.enable = true; # FIXME: remove + machine = { + bluetooth.enable = true; + usb.automount = true; + virtualisation = { + podman.enable = true; + podman.distrobox.enable = true; + }; + }; + server.web-apps = { + comfy-ui.enable = true; + sd-webui-forge.enable = true; + }; }; }; - nixos = { - nemesis = { - graphical = true; - machine = { - platform = "amd"; - gpu = "nvidia"; - root.drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; - monitors.main = { - id = "desc:OOO AN-270W04K"; - resolution = "3840x2160"; - refresh-rate = "60"; - scale = "2"; - }; - }; - extraCfg = { - services.fwupd.enable = true; # FIXME: remove - machine = { - bluetooth.enable = true; - usb.automount = true; - virtualisation = { - podman.enable = true; - podman.distrobox.enable = true; - }; - }; - server.web-apps = { - comfy-ui.enable = true; - sd-webui-forge.enable = true; - }; - }; + apollo = { + graphical = false; + machine = { + platform = "intel"; + root.drive = "/dev/disk/by-id/nvme-eui.002538d221b47b01"; }; - apollo = { - graphical = false; - machine = { - platform = "intel"; - root.drive = "/dev/disk/by-id/nvme-eui.002538d221b47b01"; + extraCfg.server = { + ddns = { + enable = true; + domains = [ + "aenyrathia.wiki" + "slayment.com" + ]; }; - extraCfg.server = { - ddns = { + web-servers = { + enableSSL = true; + nginx = { enable = true; - domains = [ - "aenyrathia.wiki" - "slayment.com" + proxies = [ + { + source = "aenyrathia.wiki"; + target = "http://helios:5896"; + } + { + source = "il.bwfiq.com"; + target = "http://helios:2283"; + } ]; }; - web-servers = { - enableSSL = true; - nginx = { - enable = true; - proxies = [ - { - source = "aenyrathia.wiki"; - target = "http://helios:5896"; - } - { - source = "il.bwfiq.com"; - target = "http://helios:2283"; - } - ]; - }; + }; + databases = { + mongodb.enable = true; + mysql.enable = true; + postgresql.enable = true; + }; + web-apps = { + librechat = { + enable = true; + domain = "chat.bwfiq.com"; }; - databases = { - mongodb.enable = true; - mysql.enable = true; - postgresql.enable = true; - }; - web-apps = { - librechat = { - enable = true; - domain = "chat.bwfiq.com"; - }; - forgejo = { - enable = true; - domain = "git.rrv.sh"; - openFirewall = true; - }; - rrv-sh.enable = true; - rrv-sh.domain = "rrv.sh"; + forgejo = { + enable = true; + domain = "git.rrv.sh"; + openFirewall = true; }; + rrv-sh.enable = true; + rrv-sh.domain = "rrv.sh"; }; }; }; diff --git a/nix/modules/cli/shell.nix b/nix/modules/cli/shell.nix index 0e081a1..c28f00b 100644 --- a/nix/modules/cli/shell.nix +++ b/nix/modules/cli/shell.nix @@ -5,31 +5,19 @@ let inherit (lib.attrsets) mapAttrs'; in { - flake.modules = { - nixos.default = - { pkgs, ... }: - { - programs = mapAttrs' (name: value: { - name = value.shell; - value.enable = true; - }) cfg.manifest.users; - users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; }); - }; - darwin.default = - { pkgs, ... }: - { - programs = mapAttrs' (name: value: { - name = value.shell; - value.enable = true; - }) cfg.manifest.users; - users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; }); - environment.shells = [ pkgs.fish ]; - }; - homeManager.default = - { config, ... }: - { - programs.${cfg.manifest.users.${config.home.username}.shell}.enable = true; - home.shell.enableShellIntegration = true; - }; - }; + flake.modules.nixos.default = + { pkgs, ... }: + { + programs = mapAttrs' (name: value: { + name = value.shell; + value.enable = true; + }) cfg.manifest.users; + users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; }); + }; + flake.modules.homeManager.default = + { config, ... }: + { + programs.${cfg.manifest.users.${config.home.username}.shell}.enable = true; + home.shell.enableShellIntegration = true; + }; } diff --git a/nix/modules/machine/platform.nix b/nix/modules/machine/platform.nix index 19b2fdf..e60d4bf 100644 --- a/nix/modules/machine/platform.nix +++ b/nix/modules/machine/platform.nix @@ -12,13 +12,9 @@ nixpkgs.hostPlatform = "${arch}-linux"; }; - flake.modules.darwin.default = - { hostName, ... }: - let - inherit (config.flake.manifest.hosts.darwin.${hostName}.machine) platform; - arch = if platform == "intel" then "x86_64" else "aarch64"; - in - { - nixpkgs.hostPlatform = "${arch}-darwin"; - }; + flake.modules.darwin.default.nixpkgs = { + hostPlatform = "x86_64-darwin"; + # config.allowUnsupportedSystem = true; + }; + } diff --git a/nix/modules/networking/tailscale.nix b/nix/modules/networking/tailscale.nix index e1ad04c..8f2a000 100644 --- a/nix/modules/networking/tailscale.nix +++ b/nix/modules/networking/tailscale.nix @@ -14,12 +14,7 @@ in persistDirs = [ "/var/lib/tailscale" ]; sops.secrets."tailscale/client-secret".sopsFile = secrets + "/tailscale.yaml"; }; - flake.modules.darwin.default = - { pkgs, ... }: - { - services.tailscale = { - enable = true; - package = pkgs.tailscale.overrideAttrs { doCheck = false; }; - }; - }; + flake.modules.darwin.default = { + services.tailscale.enable = true; + }; } diff --git a/nix/modules/system/users.nix b/nix/modules/system/users.nix index 85fceb3..28c5f94 100644 --- a/nix/modules/system/users.nix +++ b/nix/modules/system/users.nix @@ -1,9 +1,7 @@ -{ config, lib, ... }: +{ config, ... }: let cfg = config.flake; inherit (cfg.lib.modules) userListToAttrs forAllUsers'; - inherit (lib.lists) findFirstIndex; - inherit (builtins) attrNames; in { flake.modules.nixos.default = @@ -36,13 +34,7 @@ in flake.modules.darwin.default = { config, ... }: { - users.knownUsers = attrNames cfg.manifest.users; - users.users = forAllUsers' ( - name: _: { - home = "/Users/${name}"; - uid = 501 + (findFirstIndex (x: x == name) null (attrNames cfg.manifest.users)); - } - ); + users.users = forAllUsers' (name: _: { home = "/Users/${name}"; }); home-manager.users = forAllUsers' ( name: _: { home.username = name;