Browse Source

Rewrite modules using options

main
parent
commit
e0b4c7d479
Signed by: chris GPG Key ID: 3025DCBD46F81C0F
  1. 254
      README.org
  2. 13
      flake.nix
  3. 11
      hosts/nixos/default.nix
  4. 18
      modules/cachix.nix
  5. 16
      modules/docker.nix
  6. 15
      modules/emacs.nix
  7. 14
      modules/firefox.nix
  8. 16
      modules/flakes.nix
  9. 36
      modules/git.nix
  10. 18
      modules/godot.nix
  11. 17
      modules/gpg.nix
  12. 16
      modules/gtk.nix
  13. 14
      modules/hugo.nix
  14. 16
      modules/ssh.nix
  15. 16
      modules/vim.nix
  16. 16
      modules/x11.nix

254
README.org

@ -605,13 +605,22 @@ Deploy this configuration with ~nixos-rebuild switch --flake /etc/dotfiles/#nixo
#+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/default.nix #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/default.nix
# <<file-warning>> # <<file-warning>>
{ ... }:
{ config, ... }:
{ {
imports = [ imports = [
./configuration.nix ./configuration.nix
./hardware.nix ./hardware.nix
]; ];
modules.x11.enable = true;
modules.ssh.enable = true;
modules.hugo.enable = true;
modules.godot.enable = true;
modules.flakes.enable = true;
modules.cachix.enable = true;
modules.docker.enable = true;
modules.firefox.enable = true;
} }
#+END_SRC #+END_SRC
@ -695,9 +704,20 @@ Modules are files combined by [[https://nixos.org/][NixOS]] to produce the full
#+BEGIN_SRC nix :noweb yes :tangle modules/x11.nix #+BEGIN_SRC nix :noweb yes :tangle modules/x11.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.x11;
in {
options.modules.x11 = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.layout = "us"; services.xserver.layout = "us";
services.xserver.libinput.enable = true; services.xserver.libinput.enable = true;
@ -733,6 +753,7 @@ Modules are files combined by [[https://nixos.org/][NixOS]] to produce the full
fira-code-symbols fira-code-symbols
emacs-all-the-icons-fonts emacs-all-the-icons-fonts
]; ];
};
} }
#+END_SRC #+END_SRC
@ -752,9 +773,20 @@ Apply some configuration to the default settings:
#+BEGIN_SRC nix :noweb yes :tangle modules/ssh.nix #+BEGIN_SRC nix :noweb yes :tangle modules/ssh.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.ssh;
in {
options.modules.ssh = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
services.openssh = { services.openssh = {
enable = true; enable = true;
settings = { settings = {
@ -762,6 +794,7 @@ Apply some configuration to the default settings:
PasswordAuthentication = false; PasswordAuthentication = false;
}; };
}; };
};
} }
#+END_SRC #+END_SRC
@ -776,9 +809,12 @@ Apply some configuration to the default settings:
#+BEGIN_SRC nix :noweb yes :tangle modules/hugo.nix #+BEGIN_SRC nix :noweb yes :tangle modules/hugo.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.hugo;
mySiteDir = "/etc/dotfiles/docs/public/"; mySiteDir = "/etc/dotfiles/docs/public/";
mySiteTgt = "ubuntu@chrishayward.xyz:/var/www/chrishayward"; mySiteTgt = "ubuntu@chrishayward.xyz:/var/www/chrishayward";
mySiteBuild = pkgs.writeShellScriptBin "site-build" '' mySiteBuild = pkgs.writeShellScriptBin "site-build" ''
@ -791,11 +827,20 @@ let
''; '';
in { in {
options.modules.hugo = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
pkgs.hugo pkgs.hugo
mySiteBuild mySiteBuild
mySiteUpdate mySiteUpdate
]; ];
};
} }
#+END_SRC #+END_SRC
@ -810,9 +855,22 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/godot.nix #+BEGIN_SRC nix :noweb yes :tangle modules/godot.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let
cfg = config.modules.godot;
in {
options.modules.godot = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
pkgs.tiled pkgs.tiled
pkgs.godot pkgs.godot
@ -820,6 +878,7 @@ in {
pkgs.godot-headless pkgs.godot-headless
pkgs.gdtoolkit pkgs.gdtoolkit
]; ];
};
} }
#+END_SRC #+END_SRC
@ -834,9 +893,20 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/flakes.nix #+BEGIN_SRC nix :noweb yes :tangle modules/flakes.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, inputs, ... }:
{ config, options, lib, pkgs, inputs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.flakes;
in {
options.modules.flakes = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
nix = { nix = {
package = pkgs.nixUnstable; package = pkgs.nixUnstable;
extraOptions = '' extraOptions = ''
@ -848,6 +918,7 @@ in {
config = { allowUnfree = true; }; config = { allowUnfree = true; };
overlays = [ inputs.emacs-overlay.overlay ]; overlays = [ inputs.emacs-overlay.overlay ];
}; };
};
} }
#+END_SRC #+END_SRC
@ -862,9 +933,22 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/cachix.nix #+BEGIN_SRC nix :noweb yes :tangle modules/cachix.nix
# <<file-warning>> # <<file-warning>>
{ config, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let
cfg = config.modules.cachix;
in {
options.modules.cachix = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
nix = { nix = {
settings = { settings = {
substituters = [ substituters = [
@ -875,6 +959,7 @@ in {
]; ];
}; };
}; };
};
} }
#+END_SRC #+END_SRC
@ -889,9 +974,20 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/docker.nix #+BEGIN_SRC nix :noweb yes :tangle modules/docker.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.docker;
in {
options.modules.docker = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
# Enable the docker virutalization platform. # Enable the docker virutalization platform.
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;
@ -907,6 +1003,7 @@ in {
pkgs.docker-compose pkgs.docker-compose
pkgs.docker-machine pkgs.docker-machine
]; ];
};
} }
#+END_SRC #+END_SRC
@ -921,18 +1018,30 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/firefox.nix #+BEGIN_SRC nix :noweb yes :tangle modules/firefox.nix
# <<file-warning>> # <<file-warning>>
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.firefox;
myFirefox = pkgs.writeShellScriptBin "firefox" '' myFirefox = pkgs.writeShellScriptBin "firefox" ''
HOME=~/.local/share/mozilla ${pkgs.firefox-bin}/bin/firefox HOME=~/.local/share/mozilla ${pkgs.firefox-bin}/bin/firefox
''; '';
in { in {
options.modules.firefox = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
# NOTE: Use the binary until module is developed. # NOTE: Use the binary until module is developed.
environment.systemPackages = [ environment.systemPackages = [
myFirefox myFirefox
]; ];
};
} }
#+END_SRC #+END_SRC
@ -947,6 +1056,7 @@ inputs.home-manager.nixosModules.home-manager {
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.chris = { home-manager.users.chris = {
home.stateVersion = "23.05"; home.stateVersion = "23.05";
imports = [ imports = [
<<module-git>> <<module-git>>
<<module-gpg>> <<module-gpg>>
@ -954,6 +1064,18 @@ inputs.home-manager.nixosModules.home-manager {
<<module-gtk>> <<module-gtk>>
<<module-emacs>> <<module-emacs>>
]; ];
modules.git = {
enable = true;
name = "Christopher James Hayward";
email = "chris@chrishayward.xyz";
key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F";
};
modules.gpg.enable = true;
modules.vim.enable = true;
modules.gtk.enable = true;
modules.emacs.enable = true;
}; };
} }
#+END_SRC #+END_SRC
@ -977,9 +1099,13 @@ This module MUST be included within home manager
#+BEGIN_SRC nix :noweb yes :tangle modules/git.nix #+BEGIN_SRC nix :noweb yes :tangle modules/git.nix
# <<file-warning>> # <<file-warning>>
# <<home-manager-warning>> # <<home-manager-warning>>
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.git;
# Fix any corruptions in the local copy. # Fix any corruptions in the local copy.
myGitFix = pkgs.writeShellScriptBin "git-fix" '' myGitFix = pkgs.writeShellScriptBin "git-fix" ''
if [ -d .git/objects/ ]; then if [ -d .git/objects/ ]; then
@ -991,18 +1117,42 @@ let
''; '';
in { in {
options.modules.git = {
enable = mkOption {
type = bool;
default = false;
};
name = mkOption {
type = str;
default = "Anon";
};
email = mkOption {
type = str;
default = "anon@devnull.com";
};
key = mkOption {
type = str;
default = "ABCD1234";
};
};
config = mkIf cfg.enable {
home.packages = [ myGitFix ]; home.packages = [ myGitFix ];
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Christopher James Hayward";
userEmail = "chris@chrishayward.xyz";
userName = cfg.name;
userEmail = cfg.email;
signing = { signing = {
key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F";
key = cfg.key;
signByDefault = true; signByDefault = true;
}; };
}; };
};
} }
#+END_SRC #+END_SRC
@ -1018,15 +1168,28 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/gpg.nix #+BEGIN_SRC nix :noweb yes :tangle modules/gpg.nix
# <<file-warning>> # <<file-warning>>
# <<home-manager-warning>> # <<home-manager-warning>>
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let
cfg = config.modules.gpg;
in {
options.modules.gpg = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
defaultCacheTtl = 1800; defaultCacheTtl = 1800;
enableSshSupport = true; enableSshSupport = true;
pinentryFlavor = "gtk2"; pinentryFlavor = "gtk2";
}; };
};
} }
#+END_SRC #+END_SRC
@ -1047,9 +1210,20 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/vim.nix #+BEGIN_SRC nix :noweb yes :tangle modules/vim.nix
# <<file-warning>> # <<file-warning>>
# <<home-manager-warning>> # <<home-manager-warning>>
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.vim;
in {
options.modules.vim = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
viAlias = true; viAlias = true;
@ -1068,6 +1242,7 @@ in {
vim-polyglot vim-polyglot
]; ];
}; };
};
} }
#+END_SRC #+END_SRC
@ -1083,9 +1258,20 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/gtk.nix #+BEGIN_SRC nix :noweb yes :tangle modules/gtk.nix
# <<file-warning>> # <<file-warning>>
# <<home-manager-warning>> # <<home-manager-warning>>
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.gtk;
in {
options.modules.gtk = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
home.packages = [ home.packages = [
pkgs.nordic pkgs.nordic
pkgs.arc-icon-theme pkgs.arc-icon-theme
@ -1144,6 +1330,7 @@ in {
gtk-xft-hintstyle=hintmedium gtk-xft-hintstyle=hintmedium
''; '';
}; };
};
} }
#+END_SRC #+END_SRC
@ -1170,9 +1357,13 @@ in {
#+BEGIN_SRC nix :noweb yes :tangle modules/emacs.nix #+BEGIN_SRC nix :noweb yes :tangle modules/emacs.nix
# <<file-warning>> # <<file-warning>>
# <<home-manager-warning>> # <<home-manager-warning>>
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.emacs;
myEmacs = pkgs.emacsWithPackagesFromUsePackage { myEmacs = pkgs.emacsWithPackagesFromUsePackage {
config = ../README.org; config = ../README.org;
package = <<emacs-native-comp-package>> package = <<emacs-native-comp-package>>
@ -1231,6 +1422,14 @@ let
}; };
in { in {
options.modules.emacs = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
home.packages = [ home.packages = [
<<emacs-exwm-extras>> <<emacs-exwm-extras>>
<<emacs-pass-extras>> <<emacs-pass-extras>>
@ -1251,6 +1450,7 @@ in {
<<emacs-exwm-config>> <<emacs-exwm-config>>
<<emacs-exwm-xinitrc>> <<emacs-exwm-xinitrc>>
<<emacs-mu4e-config>> <<emacs-mu4e-config>>
};
} }
#+END_SRC #+END_SRC
@ -1809,7 +2009,7 @@ epkgs.hydra
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; Configure the font when running as `emacs-server'. ;; Configure the font when running as `emacs-server'.
(custom-set-faces (custom-set-faces
'(default ((t (:inherit nil :height 120 :family "Iosevka")))))
'(default ((t (:inherit nil :height 120 :family "Iosevka Term")))))
;; Define a `hydra' function for scaling the text interactively. ;; Define a `hydra' function for scaling the text interactively.
(defhydra hydra-text-scale (:timeout 4) (defhydra hydra-text-scale (:timeout 4)

13
flake.nix

@ -32,6 +32,7 @@
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.chris = { home-manager.users.chris = {
home.stateVersion = "23.05"; home.stateVersion = "23.05";
imports = [ imports = [
./modules/git.nix ./modules/git.nix
./modules/gpg.nix ./modules/gpg.nix
@ -39,6 +40,18 @@
./modules/gtk.nix ./modules/gtk.nix
./modules/emacs.nix ./modules/emacs.nix
]; ];
modules.git = {
enable = true;
name = "Christopher James Hayward";
email = "chris@chrishayward.xyz";
key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F";
};
modules.gpg.enable = true;
modules.vim.enable = true;
modules.gtk.enable = true;
modules.emacs.enable = true;
}; };
} }
]; ];

11
hosts/nixos/default.nix

@ -1,9 +1,18 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ ... }:
{ config, ... }:
{ {
imports = [ imports = [
./configuration.nix ./configuration.nix
./hardware.nix ./hardware.nix
]; ];
modules.x11.enable = true;
modules.ssh.enable = true;
modules.hugo.enable = true;
modules.godot.enable = true;
modules.flakes.enable = true;
modules.cachix.enable = true;
modules.docker.enable = true;
modules.firefox.enable = true;
} }

18
modules/cachix.nix

@ -1,7 +1,20 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let
cfg = config.modules.cachix;
in {
options.modules.cachix = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
nix = { nix = {
settings = { settings = {
substituters = [ substituters = [
@ -12,4 +25,5 @@
]; ];
}; };
}; };
};
} }

16
modules/docker.nix

@ -1,7 +1,18 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.docker;
in {
options.modules.docker = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
# Enable the docker virutalization platform. # Enable the docker virutalization platform.
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;
@ -17,4 +28,5 @@
pkgs.docker-compose pkgs.docker-compose
pkgs.docker-machine pkgs.docker-machine
]; ];
};
} }

15
modules/emacs.nix

@ -1,8 +1,12 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
# This module MUST be included within home manager # This module MUST be included within home manager
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.emacs;
myEmacs = pkgs.emacsWithPackagesFromUsePackage { myEmacs = pkgs.emacsWithPackagesFromUsePackage {
config = ../README.org; config = ../README.org;
package = pkgs.emacs-unstable; package = pkgs.emacs-unstable;
@ -78,6 +82,14 @@ let
}; };
in { in {
options.modules.emacs = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
home.packages = [ home.packages = [
pkgs.arandr pkgs.arandr
pkgs.nitrogen pkgs.nitrogen
@ -154,4 +166,5 @@ in {
SyncState * SyncState *
''; '';
}; };
};
} }

14
modules/firefox.nix

@ -1,14 +1,26 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.firefox;
myFirefox = pkgs.writeShellScriptBin "firefox" '' myFirefox = pkgs.writeShellScriptBin "firefox" ''
HOME=~/.local/share/mozilla ${pkgs.firefox-bin}/bin/firefox HOME=~/.local/share/mozilla ${pkgs.firefox-bin}/bin/firefox
''; '';
in { in {
options.modules.firefox = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
# NOTE: Use the binary until module is developed. # NOTE: Use the binary until module is developed.
environment.systemPackages = [ environment.systemPackages = [
myFirefox myFirefox
]; ];
};
} }

16
modules/flakes.nix

@ -1,7 +1,18 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, inputs, ... }:
{ config, options, lib, pkgs, inputs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.flakes;
in {
options.modules.flakes = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
nix = { nix = {
package = pkgs.nixUnstable; package = pkgs.nixUnstable;
extraOptions = '' extraOptions = ''
@ -13,4 +24,5 @@
config = { allowUnfree = true; }; config = { allowUnfree = true; };
overlays = [ inputs.emacs-overlay.overlay ]; overlays = [ inputs.emacs-overlay.overlay ];
}; };
};
} }

36
modules/git.nix

@ -1,8 +1,12 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
# This module MUST be included within home manager # This module MUST be included within home manager
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.git;
# Fix any corruptions in the local copy. # Fix any corruptions in the local copy.
myGitFix = pkgs.writeShellScriptBin "git-fix" '' myGitFix = pkgs.writeShellScriptBin "git-fix" ''
if [ -d .git/objects/ ]; then if [ -d .git/objects/ ]; then
@ -14,16 +18,40 @@ let
''; '';
in { in {
options.modules.git = {
enable = mkOption {
type = bool;
default = false;
};
name = mkOption {
type = str;
default = "Anon";
};
email = mkOption {
type = str;
default = "anon@devnull.com";
};
key = mkOption {
type = str;
default = "ABCD1234";
};
};
config = mkIf cfg.enable {
home.packages = [ myGitFix ]; home.packages = [ myGitFix ];
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Christopher James Hayward";
userEmail = "chris@chrishayward.xyz";
userName = cfg.name;
userEmail = cfg.email;
signing = { signing = {
key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F";
key = cfg.key;
signByDefault = true; signByDefault = true;
}; };
}; };
};
} }

18
modules/godot.nix

@ -1,7 +1,20 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let
cfg = config.modules.godot;
in {
options.modules.godot = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
pkgs.tiled pkgs.tiled
pkgs.godot pkgs.godot
@ -9,4 +22,5 @@
pkgs.godot-headless pkgs.godot-headless
pkgs.gdtoolkit pkgs.gdtoolkit
]; ];
};
} }

17
modules/gpg.nix

@ -1,12 +1,25 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
# This module MUST be included within home manager # This module MUST be included within home manager
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let
cfg = config.modules.gpg;
in {
options.modules.gpg = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
defaultCacheTtl = 1800; defaultCacheTtl = 1800;
enableSshSupport = true; enableSshSupport = true;
pinentryFlavor = "gtk2"; pinentryFlavor = "gtk2";
}; };
};
} }

16
modules/gtk.nix

@ -1,8 +1,19 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
# This module MUST be included within home manager # This module MUST be included within home manager
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.gtk;
in {
options.modules.gtk = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
home.packages = [ home.packages = [
pkgs.nordic pkgs.nordic
pkgs.arc-icon-theme pkgs.arc-icon-theme
@ -61,4 +72,5 @@
gtk-xft-hintstyle=hintmedium gtk-xft-hintstyle=hintmedium
''; '';
}; };
};
} }

14
modules/hugo.nix

@ -1,7 +1,10 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let let
cfg = config.modules.hugo;
mySiteDir = "/etc/dotfiles/docs/public/"; mySiteDir = "/etc/dotfiles/docs/public/";
mySiteTgt = "ubuntu@chrishayward.xyz:/var/www/chrishayward"; mySiteTgt = "ubuntu@chrishayward.xyz:/var/www/chrishayward";
mySiteBuild = pkgs.writeShellScriptBin "site-build" '' mySiteBuild = pkgs.writeShellScriptBin "site-build" ''
@ -14,9 +17,18 @@ let
''; '';
in { in {
options.modules.hugo = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
pkgs.hugo pkgs.hugo
mySiteBuild mySiteBuild
mySiteUpdate mySiteUpdate
]; ];
};
} }

16
modules/ssh.nix

@ -1,7 +1,18 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.ssh;
in {
options.modules.ssh = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
services.openssh = { services.openssh = {
enable = true; enable = true;
settings = { settings = {
@ -9,4 +20,5 @@
PasswordAuthentication = false; PasswordAuthentication = false;
}; };
}; };
};
} }

16
modules/vim.nix

@ -1,8 +1,19 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
# This module MUST be included within home manager # This module MUST be included within home manager
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.vim;
in {
options.modules.vim = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
viAlias = true; viAlias = true;
@ -21,4 +32,5 @@
vim-polyglot vim-polyglot
]; ];
}; };
};
} }

16
modules/x11.nix

@ -1,7 +1,18 @@
# This file is controlled by /etc/dotfiles/README.org # This file is controlled by /etc/dotfiles/README.org
{ config, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
with lib;
with lib.types;
let cfg = config.modules.x11;
in {
options.modules.x11 = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.layout = "us"; services.xserver.layout = "us";
services.xserver.libinput.enable = true; services.xserver.libinput.enable = true;
@ -37,4 +48,5 @@
fira-code-symbols fira-code-symbols
emacs-all-the-icons-fonts emacs-all-the-icons-fonts
]; ];
};
} }
Loading…
Cancel
Save