Extract shared NixOS/Darwin base config into roles/common.nix
Create roles/common.nix containing shared configuration between NixOS and Darwin: timezone, base packages (git, glances, pciutils, tree, usbutils, vim), nix settings (experimental-features, max-jobs, trusted-users), gc config, and allowUnfree setting. Both roles/default.nix and roles/darwin.nix now import common.nix and only contain platform-specific configuration.
This commit was merged in pull request #8.
This commit is contained in:
35
roles/common.nix
Normal file
35
roles/common.nix
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Common configuration shared between NixOS and Darwin
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
time.timeZone = "America/Los_Angeles";
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
git
|
||||||
|
glances
|
||||||
|
pciutils
|
||||||
|
tree
|
||||||
|
usbutils
|
||||||
|
vim
|
||||||
|
];
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
package = pkgs.nix;
|
||||||
|
settings = {
|
||||||
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
max-jobs = "auto";
|
||||||
|
trusted-users = [ "johno" ];
|
||||||
|
substituters = [
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
options = "--delete-older-than 10d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -7,6 +7,10 @@ let
|
|||||||
setEnvironmentPath = "${config.system.build.setEnvironment}";
|
setEnvironmentPath = "${config.system.build.setEnvironment}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
# Salt manages /etc/bashrc, /etc/zshrc, /etc/zshenv
|
# Salt manages /etc/bashrc, /etc/zshrc, /etc/zshenv
|
||||||
# nix-darwin writes to .local variants for nix-specific configuration
|
# nix-darwin writes to .local variants for nix-specific configuration
|
||||||
@@ -43,8 +47,6 @@ in
|
|||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
time.timeZone = "America/Los_Angeles";
|
|
||||||
|
|
||||||
# System preferences
|
# System preferences
|
||||||
system.defaults = {
|
system.defaults = {
|
||||||
# Custom keyboard shortcuts
|
# Custom keyboard shortcuts
|
||||||
@@ -79,42 +81,5 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
git
|
|
||||||
glances
|
|
||||||
pciutils
|
|
||||||
tree
|
|
||||||
usbutils
|
|
||||||
vim
|
|
||||||
];
|
|
||||||
|
|
||||||
nix = {
|
|
||||||
package = pkgs.nix;
|
|
||||||
# distributedBuilds = true;
|
|
||||||
# buildMachines = [{
|
|
||||||
# hostName = "z790prors.oglehome";
|
|
||||||
# system = "x86_64-linux";
|
|
||||||
# protocol = "ssh-ng";
|
|
||||||
# sshUser = "johno";
|
|
||||||
# sshKey = "/root/.ssh/id_ed25519";
|
|
||||||
# maxJobs = 3;
|
|
||||||
# speedFactor = 2;
|
|
||||||
# }];
|
|
||||||
settings = {
|
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
max-jobs = "auto";
|
|
||||||
trusted-users = [ "johno" ];
|
|
||||||
substituters = [
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
gc = {
|
|
||||||
automatic = true;
|
|
||||||
options = "--delete-older-than 10d";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ with lib;
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./common.nix
|
||||||
./audio
|
./audio
|
||||||
./bluetooth
|
./bluetooth
|
||||||
./btrfs
|
./btrfs
|
||||||
@@ -31,7 +32,6 @@ with lib;
|
|||||||
LC_TELEPHONE = "en_US.UTF-8";
|
LC_TELEPHONE = "en_US.UTF-8";
|
||||||
LC_TIME = "en_US.UTF-8";
|
LC_TIME = "en_US.UTF-8";
|
||||||
};
|
};
|
||||||
time.timeZone = "America/Los_Angeles";
|
|
||||||
|
|
||||||
services.xserver.xkb = {
|
services.xserver.xkb = {
|
||||||
layout = "us";
|
layout = "us";
|
||||||
@@ -49,42 +49,7 @@ with lib;
|
|||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
# NixOS-specific gc option (not available on Darwin)
|
||||||
git
|
nix.gc.randomizedDelaySec = "14m";
|
||||||
glances
|
|
||||||
pciutils
|
|
||||||
tree
|
|
||||||
usbutils
|
|
||||||
vim
|
|
||||||
];
|
|
||||||
|
|
||||||
nix = {
|
|
||||||
package = pkgs.nix;
|
|
||||||
# distributedBuilds = true;
|
|
||||||
# buildMachines = [{
|
|
||||||
# hostName = "z790prors.oglehome";
|
|
||||||
# system = "x86_64-linux";
|
|
||||||
# protocol = "ssh-ng";
|
|
||||||
# sshUser = "johno";
|
|
||||||
# sshKey = "/root/.ssh/id_ed25519";
|
|
||||||
# maxJobs = 3;
|
|
||||||
# speedFactor = 2;
|
|
||||||
# }];
|
|
||||||
settings = {
|
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
max-jobs = "auto";
|
|
||||||
trusted-users = [ "johno" ];
|
|
||||||
substituters = [
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
gc = {
|
|
||||||
automatic = true;
|
|
||||||
randomizedDelaySec = "14m";
|
|
||||||
options = "--delete-older-than 10d";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user