Compare commits

...

9 commits

7 changed files with 145 additions and 97 deletions

View file

@ -28,7 +28,10 @@ let
name: value:
if class == "nixos" then
nixosSystem {
specialArgs.hostName = name;
specialArgs = {
inherit (config.flake) self;
hostName = name;
};
modules = [
cfg.modules.nixos.default
inputs.home-manager.nixosModules.home-manager
@ -38,11 +41,15 @@ let
}
else if class == "darwin" then
darwinSystem {
specialArgs = { inherit (config.flake) self; };
specialArgs = {
inherit (config.flake) self;
hostName = name;
};
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

View file

@ -4,7 +4,8 @@
enableTreesitter = true;
bash.enable = true;
clang.enable = true;
csharp.enable = true;
# broken on macos
# csharp.enable = true;
css.enable = true;
go.enable = true;
html.enable = true;

View file

@ -7,8 +7,18 @@
shell = "fish";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq";
};
hosts.darwin.venus.graphical = true;
hosts.nixos = {
hosts = {
darwin = {
venus = {
graphical = true;
machine.platform = "intel";
};
hephaestus = {
graphical = true;
machine.platform = "apple-silicon";
};
};
nixos = {
nemesis = {
graphical = true;
machine = {
@ -90,4 +100,5 @@
};
};
};
};
}

View file

@ -5,7 +5,8 @@ let
inherit (lib.attrsets) mapAttrs';
in
{
flake.modules.nixos.default =
flake.modules = {
nixos.default =
{ pkgs, ... }:
{
programs = mapAttrs' (name: value: {
@ -14,10 +15,21 @@ in
}) cfg.manifest.users;
users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; });
};
flake.modules.homeManager.default =
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;
};
};
}

View file

@ -12,9 +12,13 @@
nixpkgs.hostPlatform = "${arch}-linux";
};
flake.modules.darwin.default.nixpkgs = {
hostPlatform = "x86_64-darwin";
# config.allowUnsupportedSystem = true;
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";
};
}

View file

@ -14,7 +14,12 @@ in
persistDirs = [ "/var/lib/tailscale" ];
sops.secrets."tailscale/client-secret".sopsFile = secrets + "/tailscale.yaml";
};
flake.modules.darwin.default = {
services.tailscale.enable = true;
flake.modules.darwin.default =
{ pkgs, ... }:
{
services.tailscale = {
enable = true;
package = pkgs.tailscale.overrideAttrs { doCheck = false; };
};
};
}

View file

@ -1,7 +1,9 @@
{ config, ... }:
{ config, lib, ... }:
let
cfg = config.flake;
inherit (cfg.lib.modules) userListToAttrs forAllUsers';
inherit (lib.lists) findFirstIndex;
inherit (builtins) attrNames;
in
{
flake.modules.nixos.default =
@ -34,7 +36,13 @@ in
flake.modules.darwin.default =
{ config, ... }:
{
users.users = forAllUsers' (name: _: { home = "/Users/${name}"; });
users.knownUsers = attrNames cfg.manifest.users;
users.users = forAllUsers' (
name: _: {
home = "/Users/${name}";
uid = 501 + (findFirstIndex (x: x == name) null (attrNames cfg.manifest.users));
}
);
home-manager.users = forAllUsers' (
name: _: {
home.username = name;