summaryrefslogtreecommitdiff
path: root/modules/base
diff options
context:
space:
mode:
authorseth <[email protected]>2023-04-17 12:00:55 -0400
committerseth <[email protected]>2023-04-17 12:01:21 -0400
commit92ca826539092f33c8e19a19c7a9ea0def2aece0 (patch)
treec6ff98c3f645f189b559bc1a69904fec217a946c /modules/base
parent98921a299be9f22bde9204e1fd05d0ea0fb0c6ed (diff)
move most configurations to modules
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/default.nix56
-rw-r--r--modules/base/documentation.nix19
-rw-r--r--modules/base/packages.nix34
3 files changed, 109 insertions, 0 deletions
diff --git a/modules/base/default.nix b/modules/base/default.nix
new file mode 100644
index 0000000..0523d0e
--- /dev/null
+++ b/modules/base/default.nix
@@ -0,0 +1,56 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ cfg = config.base;
+ inherit (lib) mkDefault mkEnableOption mkIf;
+in {
+ options.base.enable = mkEnableOption "base module";
+
+ imports = [
+ ./documentation.nix
+ ./packages.nix
+ ];
+
+ config = let
+ channelPath = "/etc/nix/channels/nixpkgs";
+ in
+ mkIf cfg.enable {
+ base = {
+ documentation.enable = mkDefault true;
+ defaultPackages.enable = mkDefault true;
+ };
+
+ nix = {
+ package = pkgs.nixFlakes;
+
+ gc = {
+ automatic = true;
+ dates = "weekly";
+ options = "--delete-older-than 7d";
+ };
+
+ settings = {
+ auto-optimise-store = true;
+ warn-dirty = false;
+ experimental-features = ["nix-command" "flakes"];
+ trusted-substituters = [
+ "https://nix-community.cachix.org"
+ ];
+ trusted-public-keys = [
+ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
+ ];
+ };
+
+ nixPath = [
+ "nixpkgs=${channelPath}"
+ ];
+ };
+
+ systemd.tmpfiles.rules = [
+ "L+ ${channelPath} - - - - ${pkgs.path}"
+ ];
+ };
+}
diff --git a/modules/base/documentation.nix b/modules/base/documentation.nix
new file mode 100644
index 0000000..0f3b9d3
--- /dev/null
+++ b/modules/base/documentation.nix
@@ -0,0 +1,19 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ cfg = config.base.documentation;
+ inherit (lib) mkEnableOption mkIf;
+in {
+ options.base.documentation.enable = mkEnableOption "base module documentation";
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [man-pages man-pages-posix];
+ documentation = {
+ dev.enable = true;
+ man.enable = true;
+ };
+ };
+}
diff --git a/modules/base/packages.nix b/modules/base/packages.nix
new file mode 100644
index 0000000..68f56aa
--- /dev/null
+++ b/modules/base/packages.nix
@@ -0,0 +1,34 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ cfg = config.base.defaultPackages;
+ inherit (lib) mkEnableOption mkIf;
+in {
+ options.base.defaultPackages.enable = mkEnableOption "base module default packages";
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ cachix
+ hyfetch
+ neofetch
+ pinentry-curses
+ python311
+ ];
+
+ programs = {
+ git.enable = true;
+
+ gnupg = {
+ agent = {
+ enable = true;
+ pinentryFlavor = lib.mkDefault "curses";
+ };
+ };
+
+ vim.defaultEditor = true;
+ };
+ };
+}