diff --git a/base/darwin.nix b/base/darwin.nix index 06dd361..eed68b0 100644 --- a/base/darwin.nix +++ b/base/darwin.nix @@ -35,9 +35,12 @@ in linux-builder = { enable = false; # TODO fix bootstrap ephemeral = true; - systems = ["aarch64-linux" "x86_64-linux"]; + systems = [ + "aarch64-linux" + "x86_64-linux" + ]; config = { - boot.binfmt.emulatedSystems = ["x86_64-linux"]; + boot.binfmt.emulatedSystems = [ "x86_64-linux" ]; virtualisation = { cores = 4; darwin-builder = { diff --git a/base/default.nix b/base/default.nix index 35980bd..8a336c2 100644 --- a/base/default.nix +++ b/base/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, platform, ... }: +{ + lib, + pkgs, + platform, + ... +}: { imports = [ @@ -12,7 +17,7 @@ }; authorizedKeys = lib.mkOption { type = lib.types.listOf lib.types.str; - default = []; + default = [ ]; description = "SSH public keys authorized for the primary user on this host."; }; }; diff --git a/flake.nix b/flake.nix index 718e5ab..dc59282 100644 --- a/flake.nix +++ b/flake.nix @@ -17,78 +17,97 @@ }; }; - outputs = { nixpkgs, nixpkgs-unstable, darwin, disko, nixos-hardware, home-manager, ... }: - let - baseModules = [ - ./base - { - nixpkgs.overlays = [ - (final: prev: { - unstable = import nixpkgs-unstable { - inherit (prev.stdenv.hostPlatform) system; - config = prev.config; - }; - }) - ]; - } - ]; - - mkHost = { - host, - system, - extraModules ? [], + outputs = + { + nixpkgs, + nixpkgs-unstable, + darwin, + disko, + nixos-hardware, + home-manager, + ... }: - let - platform = nixpkgs.lib.systems.elaborate system; - builder = if platform.isDarwin then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; - systemModules = if platform.isDarwin then [ - home-manager.darwinModules.home-manager - ] else [ - disko.nixosModules.disko - home-manager.nixosModules.home-manager - ]; - in - builder { - inherit system; - specialArgs = { - inherit platform; + let + baseModules = [ + ./base + { + nixpkgs.overlays = [ + (final: prev: { + unstable = import nixpkgs-unstable { + inherit (prev.stdenv.hostPlatform) system; + config = prev.config; + }; + }) + ]; + } + ]; + + mkHost = + { + host, + system, + extraModules ? [ ], + }: + let + platform = nixpkgs.lib.systems.elaborate system; + builder = if platform.isDarwin then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; + systemModules = + if platform.isDarwin then + [ + home-manager.darwinModules.home-manager + ] + else + [ + disko.nixosModules.disko + home-manager.nixosModules.home-manager + ]; + in + builder { + inherit system; + specialArgs = { + inherit platform; + }; + modules = + baseModules + ++ systemModules + ++ extraModules + ++ [ + ./hosts/${host}.nix + ]; + }; + in + { + nixosConfigurations = { + ryzentower = mkHost { + host = "ryzentower"; + system = "x86_64-linux"; + }; + thinkpadz13 = mkHost { + host = "thinkpadz13"; + system = "x86_64-linux"; + extraModules = [ + nixos-hardware.nixosModules.lenovo-thinkpad-z13-gen1 + ]; + }; + codeserver = mkHost { + host = "codeserver"; + system = "x86_64-linux"; }; - modules = baseModules ++ systemModules ++ extraModules ++ [ - ./hosts/${host}.nix - ]; - }; - in { - nixosConfigurations = { - ryzentower = mkHost { - host = "ryzentower"; - system = "x86_64-linux"; - }; - thinkpadz13 = mkHost { - host = "thinkpadz13"; - system = "x86_64-linux"; - extraModules = [ - nixos-hardware.nixosModules.lenovo-thinkpad-z13-gen1 - ]; - }; - codeserver = mkHost { - host = "codeserver"; - system = "x86_64-linux"; }; - }; - darwinConfigurations = { - "MacBookPro" = mkHost { - host = "MacBookPro"; - system = "aarch64-darwin"; - }; - "AS-GXL19NXYYQ" = mkHost { - host = "AS-GXL19NXYYQ"; - system = "aarch64-darwin"; - }; - macos-test = mkHost { - host = "macos-test"; - system = "aarch64-darwin"; + darwinConfigurations = { + "MacBookPro" = mkHost { + host = "MacBookPro"; + system = "aarch64-darwin"; + }; + "AS-GXL19NXYYQ" = mkHost { + host = "AS-GXL19NXYYQ"; + system = "aarch64-darwin"; + }; + macos-test = mkHost { + host = "macos-test"; + system = "aarch64-darwin"; + }; }; }; - }; } diff --git a/hosts/macos-test.nix b/hosts/macos-test.nix index 7b91c32..142e607 100644 --- a/hosts/macos-test.nix +++ b/hosts/macos-test.nix @@ -8,7 +8,7 @@ ]; primaryUser.username = "runner"; - primaryUser.authorizedKeys = []; + primaryUser.authorizedKeys = [ ]; networking.hostName = "macos-test"; diff --git a/hosts/ryzentower.nix b/hosts/ryzentower.nix index 38b33e4..b37ad1d 100644 --- a/hosts/ryzentower.nix +++ b/hosts/ryzentower.nix @@ -29,10 +29,12 @@ hostPlatform = "x86_64-linux"; config = { rocmSupport = true; - allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "steam" - "steam-unwrapped" - ]; + allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "steam" + "steam-unwrapped" + ]; }; }; @@ -101,9 +103,10 @@ }; }; - home-manager.users.${config.primaryUser.username}.home.file.".config/sway/config.d/hardware".text = '' - output "DP-3" { - mode 2560x1440@180Hz - } - ''; + home-manager.users.${config.primaryUser.username}.home.file.".config/sway/config.d/hardware".text = + '' + output "DP-3" { + mode 2560x1440@180Hz + } + ''; } diff --git a/hosts/thinkpadz13.nix b/hosts/thinkpadz13.nix index ce62af6..7344f93 100644 --- a/hosts/thinkpadz13.nix +++ b/hosts/thinkpadz13.nix @@ -96,12 +96,13 @@ }; }; - home-manager.users.${config.primaryUser.username}.home.file.".config/sway/config.d/hardware".text = '' - output "eDP-1" { - scale 1.333 - } + home-manager.users.${config.primaryUser.username}.home.file.".config/sway/config.d/hardware".text = + '' + output "eDP-1" { + scale 1.333 + } - bindswitch --reload --locked lid:on output eDP-1 disable - bindswitch --reload --locked lid:off output eDP-1 enable - ''; + bindswitch --reload --locked lid:on output eDP-1 disable + bindswitch --reload --locked lid:off output eDP-1 enable + ''; } diff --git a/modules/cli/default.nix b/modules/cli/default.nix index 3ab4b33..97989eb 100644 --- a/modules/cli/default.nix +++ b/modules/cli/default.nix @@ -1,4 +1,9 @@ -{ config, pkgs, platform, ... }: +{ + config, + pkgs, + platform, + ... +}: { imports = [ @@ -43,10 +48,12 @@ zk zoxide - (pass.withExtensions (ext: with ext; [ - # pass-import # TODO fix build on darwin - pass-otp - ])) + (pass.withExtensions ( + ext: with ext; [ + # pass-import # TODO fix build on darwin + pass-otp + ] + )) # Language servers gopls diff --git a/modules/gui/darwin.nix b/modules/gui/darwin.nix index d0cf7ef..ff21bda 100644 --- a/modules/gui/darwin.nix +++ b/modules/gui/darwin.nix @@ -57,7 +57,10 @@ enable = true; config = { KeepAlive = true; - ProgramArguments = [ "${pkgs.unstable.ollama}/bin/ollama" "serve" ]; + ProgramArguments = [ + "${pkgs.unstable.ollama}/bin/ollama" + "serve" + ]; RunAtLoad = true; StandardErrorPath = "/tmp/ollama.log"; StandardOutPath = "/tmp/ollama.log"; diff --git a/modules/gui/linux.nix b/modules/gui/linux.nix index 214d323..9fc3bb5 100644 --- a/modules/gui/linux.nix +++ b/modules/gui/linux.nix @@ -34,7 +34,7 @@ "Behavior" = { "ShowInputMethodInformation" = "False"; }; - "Hotkey/TriggerKeys" = {}; + "Hotkey/TriggerKeys" = { }; "Hotkey/EnumerateForwardKeys" = { "0" = "Control+Shift+space"; }; diff --git a/modules/work/default.nix b/modules/work/default.nix index e8d0030..c47cf4e 100644 --- a/modules/work/default.nix +++ b/modules/work/default.nix @@ -1,4 +1,9 @@ -{ config, pkgs, platform, ... }: +{ + config, + pkgs, + platform, + ... +}: { imports = [