nix: modify nix configurations
This commit is contained in:
parent
92ca867f76
commit
f7d4878472
8 changed files with 76 additions and 24 deletions
|
@ -6,5 +6,6 @@
|
||||||
./packages
|
./packages
|
||||||
./main.nix
|
./main.nix
|
||||||
./input.nix
|
./input.nix
|
||||||
|
./nix
|
||||||
];
|
];
|
||||||
}
|
}
|
|
@ -14,18 +14,10 @@
|
||||||
|
|
||||||
# List packages installed in system profile. To search by name, run:
|
# List packages installed in system profile. To search by name, run:
|
||||||
# $ nix-env -qaP | grep wget
|
# $ nix-env -qaP | grep wget
|
||||||
environment.systemPackages = with pkgs; [
|
#environment.systemPackages = with pkgs; [
|
||||||
#neovim
|
# neovim
|
||||||
#vscode
|
# vscode
|
||||||
];
|
#];
|
||||||
|
|
||||||
# Auto upgrade nix package and the daemon service.
|
|
||||||
services.nix-daemon.enable = true;
|
|
||||||
nix.package = pkgs.nix;
|
|
||||||
|
|
||||||
# Necessary for using flakes on this system.
|
|
||||||
#nix.settings.experimental-features = "nix-command flakes";
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
|
|
||||||
# Create /etc/zshrc that loads the nix-darwin environment.
|
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||||
programs.zsh.enable = true; # default shell on catalina
|
programs.zsh.enable = true; # default shell on catalina
|
||||||
|
@ -154,8 +146,4 @@
|
||||||
|
|
||||||
# Set Git commit hash for darwin-version.
|
# Set Git commit hash for darwin-version.
|
||||||
#system.configurationRevision = self.rev or self.dirtyRev or null;
|
#system.configurationRevision = self.rev or self.dirtyRev or null;
|
||||||
|
|
||||||
# Used for backwards compatibility, please read the changelog before changing.
|
|
||||||
# $ darwin-rebuild changelog
|
|
||||||
system.stateVersion = 4;
|
|
||||||
}
|
}
|
9
darwin/nix/default.nix
Normal file
9
darwin/nix/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./flake.nix
|
||||||
|
./nix.nix
|
||||||
|
./gc.nix
|
||||||
|
];
|
||||||
|
}
|
5
darwin/nix/flake.nix
Executable file
5
darwin/nix/flake.nix
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ]; # enable flakes
|
||||||
|
}
|
16
darwin/nix/gc.nix
Executable file
16
darwin/nix/gc.nix
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
nix = {
|
||||||
|
### optimiser
|
||||||
|
settings = {
|
||||||
|
auto-optimise-store = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
### auto delete older NixOS builds
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
29
darwin/nix/nix.nix
Executable file
29
darwin/nix/nix.nix
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
nix.settings = {
|
||||||
|
trusted-users = [ "@admin" ];
|
||||||
|
substituters = [
|
||||||
|
"https://mirrors.ustc.edu.cn/nix-channels/store" # USTC - 中国科学技术大学 Mirror
|
||||||
|
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # TUNA - 清华大学 Mirror
|
||||||
|
"https://mirrors.bfsu.edu.cn/nix-channels/store" # BFSU - 北京外国语大学 Mirror
|
||||||
|
"https://mirror.sjtu.edu.cn/nix-channels/store" # SJTU - 上海交通大学 Mirror
|
||||||
|
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
"https://cache.garnix.io"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
|
||||||
|
];
|
||||||
|
use-xdg-base-directories = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Auto upgrade nix package and the daemon service.
|
||||||
|
services.nix-daemon.enable = true;
|
||||||
|
nix.package = pkgs.nix;
|
||||||
|
|
||||||
|
# Used for backwards compatibility, please read the changelog before changing.
|
||||||
|
# $ darwin-rebuild changelog
|
||||||
|
system.stateVersion = 4;
|
||||||
|
}
|
|
@ -2,15 +2,19 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
nix = {
|
nix = {
|
||||||
# hard linking
|
### optimiser
|
||||||
settings.auto-optimise-store = true;
|
settings = {
|
||||||
|
auto-optimise-store = true;
|
||||||
|
};
|
||||||
|
|
||||||
# auto delete older NixOS builds
|
### auto delete older NixOS builds
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = "weekly";
|
dates = "weekly";
|
||||||
options = "--delete-older-than 7d";
|
options = "--delete-older-than 7d";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
### optimiser
|
||||||
optimise = {
|
optimise = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = [ "03:45" ];
|
dates = [ "03:45" ];
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
allowed-users = [ "@wheel" ];
|
trusted-users = [ "@wheel" ];
|
||||||
substituters = [
|
substituters = [
|
||||||
"https://mirrors.ustc.edu.cn/nix-channels/store"
|
"https://mirrors.ustc.edu.cn/nix-channels/store" # USTC - 中国科学技术大学 Mirror
|
||||||
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"
|
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # TUNA - 清华大学 Mirror
|
||||||
"https://mirror.sjtu.edu.cn/nix-channels/store"
|
"https://mirrors.bfsu.edu.cn/nix-channels/store" # BFSU - 北京外国语大学 Mirror
|
||||||
|
"https://mirror.sjtu.edu.cn/nix-channels/store" # SJTU - 上海交通大学 Mirror
|
||||||
|
|
||||||
# TODO: actually figure out what is Cachix
|
|
||||||
"https://nix-community.cachix.org"
|
"https://nix-community.cachix.org"
|
||||||
"https://berberman.cachix.org"
|
"https://berberman.cachix.org"
|
||||||
"https://hyprland.cachix.org"
|
"https://hyprland.cachix.org"
|
||||||
|
|
Loading…
Reference in a new issue