Skip to content

Commit

Permalink
new struct
Browse files Browse the repository at this point in the history
Signed-off-by: Bendik Dyrli <[email protected]>
  • Loading branch information
Bendik Dyrli committed Sep 6, 2024
1 parent 516262e commit 0c1b714
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 43 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ swt:
val:
nix flake check .

macos:
nix run nix-darwin -- switch --flake .

install-os:
# format disks then run this!
nixos-install --flake github:skandix/.dotfiles-nix
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@
inherit unstable;
};
modules = [
./hosts/SpaceCruiser/configuration.nix
#./hosts/SpaceCruiser/configuration.nix
./hosts/SpaceCruiser/modules/apps.nix
./hosts/SpaceCruiser/modules/host-users.nix
./hosts/SpaceCruiser/modules/nix-core.nix
./hosts/SpaceCruiser/modules/system.nix

inputs.home-manager.darwinModules.home-manager
];
};
Expand Down
78 changes: 39 additions & 39 deletions hosts/SpaceCruiser/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,44 @@
backupFileExtension = "bak";
useUserPackages = true;
};
nix = {
settings = {
max-jobs = "auto";
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
};
useDaemon = true;
};
# nix = {
# settings = {
# max-jobs = "auto";
# auto-optimise-store = true;
# experimental-features = [ "nix-command" "flakes" ];
# };
# useDaemon = true;
# };

homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "zap";
upgrade = true;
};
brewPrefix = "/opt/homebrew/bin";
caskArgs = {
no_quarantine = true;
};
brews = [
"ansible"
"ansible-lint"
"pulumi"
];
casks = [
# "notion"
"telegram"
"libreoffice"
"signal"
# "karabiner-elements"
# "grid"
# "monitorcontrol"
# "google-chrome"
# "handbrake"
"tailscale"
# "bambu-studio"
# "element"
];
};
# homebrew = {
# enable = true;
# onActivation = {
# autoUpdate = true;
# cleanup = "zap";
# upgrade = true;
# };
# brewPrefix = "/opt/homebrew/bin";
# caskArgs = {
# no_quarantine = true;
# };
# brews = [
# "ansible"
# "ansible-lint"
# "pulumi"
# ];
# casks = [
# # "notion"
# "telegram"
# "libreoffice"
# "signal"
# # "karabiner-elements"
# # "grid"
# # "monitorcontrol"
# # "google-chrome"
# # "handbrake"
# "tailscale"
# # "bambu-studio"
# # "element"
# ];
# };
}
38 changes: 38 additions & 0 deletions hosts/SpaceCruiser/modules/apps.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ pkgs, unstable, ...}: {
#options: https://daiderd.com/nix-darwin/manual/index.html

environment.systemPackages = with pkgs; [
git
];

# TODO To make this work, homebrew need to be installed manually, see https://brew.sh
homebrew = {
enable = true;
onActivation = {
autoUpdate = false;
# cleanup = "zap";
upgrade = false;
};
brewPrefix = "/opt/homebrew/bin";
caskArgs = {
no_quarantine = true;
};

taps = [
"homebrew/services"
];

# `brew install`
brews = [
# "aria2" # download tool
];

# `brew install --cask`
casks = [
telegram
libreoffice
signal
tailscale
];
};
}
14 changes: 14 additions & 0 deletions hosts/SpaceCruiser/modules/host-users.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

{ ... }:
{
networking.hostName = SpaceCruiser;
networking.computerName = SpaceCruiser;
system.defaults.smb.NetBIOSName = SpaceCruiser;

users.users."hx"= {
home = "/Users/hx";
description = hx;
};

nix.settings.trusted-users = [ "hx" ];
}
25 changes: 25 additions & 0 deletions hosts/SpaceCruiser/modules/nix-core.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

{ pkgs, ... }:

{
nix.settings = {
# enable flakes globally
experimental-features = ["nix-command" "flakes"];
max-jobs = "auto";
auto-optimise-store = true;

# substituers that will be considered before the official ones(https://cache.nixos.org)
substituters = [
"https://mirror.sjtu.edu.cn/nix-channels/store"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
builders-use-substitutes = true;
};

# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
}
25 changes: 25 additions & 0 deletions hosts/SpaceCruiser/modules/system.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ pkgs, ... }:

# options: https://daiderd.com/nix-darwin/manual/index.html#sec-options
{

system = {
# activationScripts are executed every time you boot the system or run `nixos-rebuild` / `darwin-rebuild`.
activationScripts.postUserActivation.text = ''
# activateSettings -u will reload the settings from the database and apply them to the current session,
# so we do not need to logout and login again to make the changes take effect.
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';

defaults = {
menuExtraClock.Show24Hour = true; # show 24 hour clock
};
};

security.pam.enableSudoTouchIdAuth = true;

# Create /etc/zshrc that loads the nix-darwin environment.
# this is required if you want to use darwin's default shell - zsh
programs.zsh.enable = true;

}

0 comments on commit 0c1b714

Please sign in to comment.