summaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-07-01 15:48:24 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-07-01 15:48:24 +0100
commit36a2b1aeace22517b396d9ff502fa532d173cac0 (patch)
treea46f23d2b8ee2df6d8cfcec75679bfadf16a2d6e /nixos
parentc85e24ea2b59871ca3b0c2df75cb37163172205a (diff)
move overlays module to a general nix one
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix2
-rw-r--r--nixos/modules/nix.nix54
-rw-r--r--nixos/modules/overlays.nix22
3 files changed, 55 insertions, 23 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 001f376..b0d788c 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -2,7 +2,7 @@
./hardware/keyboard.nix
./hardware/linode.nix
./hardware/yubikey.nix
- ./overlays.nix
+ ./nix.nix
./programs/dwm.nix
./services/ambience.nix
./services/catbus-lgtv.nix
diff --git a/nixos/modules/nix.nix b/nixos/modules/nix.nix
new file mode 100644
index 0000000..635a96b
--- /dev/null
+++ b/nixos/modules/nix.nix
@@ -0,0 +1,54 @@
+{ config, lib, pkgs, ... }:
+with lib;
+
+let
+ cfg = config.eth.nix;
+
+ mozilla = import (builtins.fetchTarball
+ "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz");
+
+ eth = import ../../pkgs;
+
+in {
+ options.eth.nix = {
+ allowUnfree = mkOption {
+ type = types.bool;
+ description = "Allow non-free software.";
+ default = false;
+ };
+
+ gc = {
+ enable = mkEnableOption "Enable the garbage collector.";
+ schedule = mkOption {
+ type = types.str;
+ default = config.nix.gc.dates;
+ description = "A systemd.time(7) timespec";
+ };
+ olderThan = mkOption {
+ type = types.str;
+ default = "30d";
+ description = "Garbage-collect NixOS configurations older than this.";
+ };
+ };
+
+ overlays = {
+ eth = mkEnableOption "Eth (yours truly)";
+ mozilla = mkEnableOption "Mozilla (Rust, Firefox, etc)";
+ };
+ };
+
+ config = {
+ nixpkgs.config.allowUnfree = cfg.allowUnfree;
+
+ nix.gc = {
+ automatic = cfg.gc.enable;
+ dates = cfg.gc.schedule;
+ options = "--delete-older-than ${cfg.gc.olderThan}";
+ };
+
+ nixpkgs.overlays = builtins.concatLists [
+ ( if cfg.overlays.eth then [ eth ] else [] )
+ ( if cfg.overlays.mozilla then [ mozilla ] else [] )
+ ];
+ };
+}
diff --git a/nixos/modules/overlays.nix b/nixos/modules/overlays.nix
deleted file mode 100644
index 7820e96..0000000
--- a/nixos/modules/overlays.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ config, lib, pkgs, ... }:
-with lib;
-
-let
- cfg = config.eth.overlays;
-
- mozilla = import (builtins.fetchTarball
- "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz");
-
- eth = import ../../pkgs;
-
-in {
- options.eth.overlays = {
- eth = mkEnableOption "Eth (yours truly)";
- mozilla = mkEnableOption "Mozilla (Rust, Firefox, etc)";
- };
-
- config.nixpkgs.overlays = builtins.concatLists [
- ( if cfg.eth then [ eth ] else [] )
- ( if cfg.mozilla then [ mozilla ] else [] )
- ];
-}