add: system modules and options

This commit is contained in:
ooks-io 2024-01-15 23:58:37 +13:00
parent 9bfc70318d
commit 47eb3e0691
21 changed files with 269 additions and 158 deletions

View file

@ -1,3 +1,5 @@
{ lib, ... }:
{
imports = [
./nh.nix
@ -5,4 +7,8 @@
./nixpkgs
./subs.nix
];
options.systemModules.nixOptions = {
enable = lib.mkEnableOption "Enable nix related configuration modules";
};
}

View file

@ -1,16 +1,23 @@
{ inputs, ... }: {
{ inputs, lib, config, ... }:
let
cfg = config.systemModules.nixOptions;
in
{
imports = [
inputs.nh.nixosModules.default
];
config = lib.mkIf cfg.enable {
environment.variables.FLAKE = "/home/ooks/Coding/nix/ooks-io/nix";
environment.variables.FLAKE = "/home/ooks/Coding/nix/ooks-io/nix";
nh = {
enable = true;
clean = {
nh = {
enable = true;
extraArgs = "--keep-since 30d";
clean = {
enable = true;
extraArgs = "--keep-since 30d";
};
};
};
}

View file

@ -1,15 +1,22 @@
{ config, lib, pkgs, inputs, ... }: {
{ config, lib, pkgs, inputs, ... }:
nix = {
settings = {
trusted-users = [ "root" "@wheel" ];
auto-optimise-store = lib.mkDefault true;
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
warn-dirty = false;
system-features = [ "kvm" "big-parallel" "nixos-test" ];
flake-registry = "";
};
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ];
};
let
cfg = config.systemModules.nixOptions;
in
{
config = lib.mkIf cfg.enable {
nix = {
settings = {
trusted-users = [ "root" "@wheel" ];
auto-optimise-store = lib.mkDefault true;
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
warn-dirty = false;
system-features = [ "kvm" "big-parallel" "nixos-test" ];
flake-registry = "";
};
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ];
};
};
}

View file

@ -1,13 +1,20 @@
{ outputs, ... }: {
{ outputs, lib, config, ... }:
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssl-1.1.1u"
"electron-25.9.0"
];
let
cfg = config.systemModules.nixOptions;
in
{
config = lib.mkIf cfg.enable {
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssl-1.1.1u"
"electron-25.9.0"
];
};
};
};
}

View file

@ -1,18 +1,26 @@
{
nix.settings = {
substituters = [
"https://cache.nixos.org?priority=10"
"https://fufexan.cachix.org"
"https://helix.cachix.org"
"https://hyprland.cachix.org"
"https://nix-community.cachix.org"
];
{ lib, config, ... }:
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
let
cfg = config.systemModules.nixOptions;
in
{
config = lib.mkIf cfg.enable {
nix.settings = {
substituters = [
"https://cache.nixos.org?priority=10"
"https://fufexan.cachix.org"
"https://helix.cachix.org"
"https://hyprland.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}