feat: nix settings

This commit is contained in:
punkfairie 2025-05-25 16:48:59 -07:00
parent 2c4c938b1f
commit b30f617f44
Signed by: punkfairie
GPG key ID: B3C5488E9A1A7CA6
8 changed files with 79 additions and 92 deletions

View file

@ -3,6 +3,7 @@
../options
#
./nix.nix
../home
];

62
modules/base/nix.nix Normal file
View file

@ -0,0 +1,62 @@
{
pkgs,
inputs,
...
}: {
nix = {
package = pkgs.lix;
# Pin system <nixpkgs> to flake nixpkgs version.
# i.e. for use in pkgs = import <nixpkgs> {}.
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
# Pin flake registry nixpkgs to flake nixpkgs version.
# i.e. for use in nix search nixpkgs.
registry = {
nixpkgs.flake = inputs.nixpkgs;
};
settings = {
experimental-features = ["nix-command" "flakes"];
trusted-users = [
"root"
# @wheel/@admin are added in OS specific modules.
];
# Set up caches.
extra-substituters = [
"https://marleyos.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"marleyos.cachix.org-1:q2kEtqvS5CoQ8BmKlWOfOnN+fi4gUoSuL6HRKy37eCA="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
# Disable that annoying "git tree is dirty" warning.
warn-dirty = false;
auto-optimise-store = true;
use-xdg-base-directories = true;
};
# Garbage collection.
gc.automatic = true;
# More useful repl.
environment.systemPackages = let
nrepl =
pkgs.writeShellScriptBin "nrepl"
# sh
''
nix repl "${toString ./.}/repl.nix" "$@"
'';
in [
nrepl
];
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./nix.nix
];
}

View file

@ -0,0 +1,9 @@
{
nix = {
settings = {
trusted-users = [
"@darwin"
];
};
};
}

View file

@ -1,5 +1,6 @@
{
imports = [
../base
./base
];
}

View file

@ -1,12 +1,7 @@
{pkgs, ...}: {
{
nix = {
package = pkgs.lix;
settings = {
experimental-features = ["nix-command" "flakes"];
trusted-users = [
"root"
"@wheel"
];
};

View file

@ -1,9 +0,0 @@
{
pkgs,
...
}:
{
config.nix = {
package = pkgs.lix;
};
}

View file

@ -1,77 +0,0 @@
{
pkgs,
inputs,
config,
lib,
...
}: {
config = {
nix = {
package = lib.mkForce pkgs.lix;
# Pin system <nixpkgs> to flake nixpkgs version.
# i.e. for use in pkgs = import <nixpkgs> {}.
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
# Pin flake registry nixpkgs to flake nixpkgs version.
# i.e. for use in nix search nixpkgs.
registry = {
nixpkgs.flake = inputs.nixpkgs;
};
settings = {
trusted-users = [
"root"
"@wheel"
];
# Enable flakes.
experimental-features = [
"nix-command"
"flakes"
];
# Set up caches.
extra-substituters = [
"https://marleyos.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"marleyos.cachix.org-1:q2kEtqvS5CoQ8BmKlWOfOnN+fi4gUoSuL6HRKy37eCA="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
# Disable that annoying "git tree is dirty" warning.
warn-dirty = false;
auto-optimise-store = true;
};
# Garbage collection.
gc.automatic = true;
};
nixpkgs.config.import = "${config.xdg.configHome}/nixpkgs/config.nix";
xdg.configFile."nixpkgs/config.nix".text =
# nix
''
{
allowUnfree = true;
}
'';
home.packages = let
nrepl =
pkgs.writeShellScriptBin "nrepl"
# sh
''
nix repl "${toString ./.}/repl.nix" "$@"
'';
in [
nrepl
];
};
}