-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hosts/defiant): streamline host definitions, skip library approach
In the previous configuration I used a library approach to generate host configurations. This approach makes it more complicated to handle different kind of host configurations and adds an unnecessary abstraction layer. Streamline the config defining darwin and nixos configurations directly in the flake.
- Loading branch information
Showing
3 changed files
with
105 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
pkgs, | ||
flake, | ||
system, | ||
inputs, | ||
... | ||
}: { | ||
imports = [ | ||
inputs.home-manager.darwinModules.home-manager | ||
]; | ||
|
||
# List packages installed in system profile. To search by name, run: | ||
# $ nix-env -qaP | grep wget | ||
environment = { | ||
systemPackages = [ | ||
pkgs.coreutils | ||
pkgs.vim | ||
pkgs.git | ||
]; | ||
|
||
shells = [ | ||
pkgs.bash | ||
pkgs.zsh | ||
]; | ||
|
||
loginShell = pkgs.zsh; | ||
}; | ||
|
||
fonts = { | ||
packages = [ | ||
(pkgs.nerdfonts.override { | ||
fonts = [ | ||
"JetBrainsMono" | ||
"Meslo" | ||
]; | ||
}) | ||
]; | ||
}; | ||
|
||
# Auto upgrade nix package and the daemon service. | ||
services.nix-daemon.enable = true; | ||
|
||
nix = { | ||
# package = pkgs.nixVersions.nix_2_16; | ||
checkConfig = true; | ||
configureBuildUsers = true; | ||
settings = { | ||
# Necessary for using flakes on this system. | ||
experimental-features = "nix-command flakes"; | ||
allowed-users = [ | ||
"@admin" | ||
]; | ||
# disable it, enabling leads to some symlink problems | ||
# on macOS | ||
auto-optimise-store = false; | ||
cores = 6; | ||
extra-sandbox-paths = []; | ||
max-jobs = "auto"; | ||
require-sigs = true; | ||
sandbox = false; | ||
# substituters = []; | ||
# trusted-public-keys = []; | ||
trusted-users = [ | ||
"@admin" | ||
]; | ||
}; | ||
}; | ||
|
||
programs.zsh.enable = true; | ||
|
||
# TODO https://discourse.nixos.org/t/give-name-label-comment-to-generations/45355 | ||
system.configurationRevision = flake.rev or flake.dirtyRev or null; | ||
|
||
# Used for backwards compatibility, | ||
# please read the changelog before changing. | ||
# $ darwin-rebuild changelog | ||
system.stateVersion = 4; | ||
|
||
# The platform the configuration will be used on. | ||
nixpkgs.hostPlatform = system; | ||
|
||
networking = { | ||
computerName = "defiant"; | ||
hostName = "defiant"; | ||
localHostName = "defiant"; | ||
}; | ||
|
||
home-manager = { | ||
useGlobalPkgs = true; | ||
useUserPackages = true; | ||
extraSpecialArgs = {inherit pkgs;}; | ||
users.refnode = import ../../users/refnode; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,2 @@ | ||
{ | ||
pkgs, | ||
nix-darwin, | ||
home-manager, | ||
system, | ||
user, | ||
flake, | ||
inputs, | ||
... | ||
}: let | ||
osConfig = ../hosts/darwin-base.nix; | ||
userHomeConfig = ../users/${user}; | ||
systemFn = nix-darwin.lib.darwinSystem; | ||
home-manager = inputs.home-manager.darwinModules.home-manager; | ||
in | ||
systemFn { | ||
modules = [ | ||
osConfig | ||
{_module.args = {inherit flake;};} | ||
home-manager | ||
{ | ||
home-manager.useGlobalPkgs = true; | ||
home-manager.useUserPackages = true; | ||
home-manager.users.${user} = import userHomeConfig { | ||
inherit pkgs user; | ||
}; | ||
# Optionally, use home-manager.extraSpecialArgs to pass | ||
# arguments to home.nix | ||
# home-manager.extraSpecialArgs = { inherit lib; }; | ||
} | ||
]; | ||
} | ||
{...}: { | ||
} |