Remove custom lib usage

This commit is contained in:
Jordan Holt 2023-12-10 23:53:54 +00:00
parent 0d015ac418
commit 3f8c817418
Signed by: jordan
GPG Key ID: B8CFFF61F1CCF520
42 changed files with 265 additions and 388 deletions

View File

@ -20,66 +20,47 @@
outputs = inputs @ { self, nixpkgs, agenix, home-manager, ... }:
let
inherit (lib) attrValues;
inherit (lib.my) mapModules mapModulesRec;
system = "x86_64-linux";
mkPkgs = pkgs: extraOverlays:
import pkgs {
inherit system;
config.allowUnfree = true;
overlays = extraOverlays ++ (lib.attrValues self.overlays);
nixpkgsForSystem = system: inputs.nixpkgs;
overlays = [
agenix.overlays.default
(import ./overlays/gnome.nix)
];
commonModules = [
agenix.nixosModules.age
home-manager.nixosModule
./modules
];
nixosSystem = system: name:
let
nixpkgs = nixpkgsForSystem system;
lib = (import nixpkgs { inherit overlays system; }).lib;
in
inputs.nixpkgs.lib.nixosSystem {
inherit lib system;
specialArgs = { modulesPath = toString (nixpkgs + "/nixos/modules"); inherit inputs; };
baseModules = import (nixpkgs + "/nixos/modules/module-list.nix");
modules = commonModules ++ [
({ config, ... }:
{
nixpkgs.pkgs = import nixpkgs {
inherit overlays system;
config.allowUnfree = true;
};
networking.hostName = name;
nix = {
extraOptions = "experimental-features = nix-command flakes";
};
})
./hosts/${name}
];
};
pkgs = mkPkgs nixpkgs [];
lib = nixpkgs.lib.extend (self: super: {
my = import ./lib {
inherit pkgs inputs;
lib = self;
};
});
in {
lib = lib.my;
nixosConfigurations = {
atlas = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
{ nixpkgs.overlays = [ (import ./overlays/gnome.nix) ]; }
(import ./modules)
./hosts/atlas
];
specialArgs = { inherit lib inputs; };
};
eos = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
{ nixpkgs.overlays = [ (import ./overlays/gnome.nix) ]; }
(import ./modules)
./hosts/eos
];
specialArgs = { inherit lib inputs; };
};
helios = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
{ nixpkgs.overlays = [ (import ./overlays/gnome.nix) ]; }
(import ./modules)
./hosts/helios
];
specialArgs = { inherit lib inputs; };
};
odyssey = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default
{ nixpkgs.overlays = [ (import ./overlays/gnome.nix) ]; }
(import ./modules)
./hosts/odyssey
];
specialArgs = { inherit lib inputs; };
};
atlas = nixosSystem "x86_64-linux" "atlas";
eos = nixosSystem "x86_64-linux" "eos";
helios = nixosSystem "x86_64-linux" "helios";
odyssey = nixosSystem "x86_64-linux" "odyssey";
};
};
in
{ inherit nixosConfigurations; };
}

View File

@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
with lib.my;
{
imports = [
./hardware-configuration.nix

View File

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
{
time.timeZone = "Europe/London";

View File

@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
with lib.my;
{
imports = [
./hardware-configuration.nix

View File

@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
with lib.my;
{
imports = [
./hardware-configuration.nix

View File

@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
with lib.my;
{
imports = [
./hardware-configuration.nix

View File

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
{
time.timeZone = "Europe/London";

View File

@ -1,26 +0,0 @@
{ lib, ... }:
with builtins;
with lib;
rec {
# attrsToList
attrsToList = attrs:
mapAttrsToList (name: value: { inherit name value; }) attrs;
# mapFilterAttrs ::
# (name -> value -> bool)
# (name -> value -> { name = any; value = any; })
# attrs
mapFilterAttrs = pred: f: attrs: filterAttrs pred (mapAttrs' f attrs);
# Generate an attribute set by mapping a function over a list of values.
genAttrs' = values: f: listToAttrs (map f values);
# anyAttrs :: (name -> value -> bool) attrs
anyAttrs = pred: attrs:
any (attr: pred attr.name attr.value) (attrsToList attrs);
# countAttrs :: (name -> value -> bool) attrs
countAttrs = pred: attrs:
count (attr: pred attr.name attr.value) (attrsToList attrs);
}

View File

@ -1,19 +0,0 @@
{ inputs, lib, pkgs, ... }:
let
inherit (lib) makeExtensible attrValues foldr;
inherit (modules) mapModules;
modules = import ./modules.nix {
inherit lib;
self.attrs = import ./attrs.nix { inherit lib; self = {}; };
};
mylib = makeExtensible (self:
with self; mapModules ./.
(file: import file { inherit self lib pkgs inputs; }));
in
mylib.extend
(self: super:
foldr (a: b: a // b) {} (attrValues super))

View File

@ -1,53 +0,0 @@
{ self, lib, ... }:
let
inherit (builtins) attrValues readDir pathExists concatLists;
inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix;
inherit (self.attrs) mapFilterAttrs;
in
rec {
mapModules = dir: fn:
mapFilterAttrs
(n: v:
v != null &&
!(hasPrefix "_" n))
(n: v:
let path = "${toString dir}/${n}"; in
if v == "directory" && pathExists "${path}/default.nix"
then nameValuePair n (fn path)
else if v == "regular" &&
n != "default.nix" &&
hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null)
(readDir dir);
mapModules' = dir: fn:
attrValues (mapModules dir fn);
mapModulesRec = dir: fn:
mapFilterAttrs
(n: v:
v != null &&
!(hasPrefix "_" n))
(n: v:
let path = "${toString dir}/${n}"; in
if v == "directory"
then nameValuePair n (mapModulesRec path fn)
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null)
(readDir dir);
mapModulesRec' = dir: fn:
let
dirs =
mapAttrsToList
(k: _: "${dir}/${k}")
(filterAttrs
(n: v: v == "directory" && !(hasPrefix "_" n))
(readDir dir));
files = attrValues (mapModules dir id);
paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs);
in map fn paths;
}

View File

@ -1,25 +0,0 @@
{ inputs, lib, pkgs, ... }:
with lib;
with lib.my;
let sys = "x86_64-linux";
in {
mkHost = path: attrs @ { system ? sys, ... }:
nixosSystem {
inherit system;
specialArgs = { inherit lib inputs system; };
modules = [
{
nixpkgs.pkgs = pkgs;
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path));
}
(filterAttrs (n: v: !elem n [ "system" ]) attrs)
../. # /default.nix
(import path)
];
};
mapHosts = dir: attrs @ { system ? system, ... }:
mapModules dir
(hostPath: mkHost hostPath attrs);
}

View File

@ -1,35 +0,0 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
rec {
mkOpt = type: default:
mkOption { inherit type default; };
mkOpt' = type: default: description:
mkOption { inherit type default description; };
mkBoolOpt = default: mkOption {
inherit default;
type = types.bool;
example = true;
};
mkStringOpt = default: mkOption {
inherit default;
type = types.lines;
example = "";
};
mkListOfStringOpt = default: mkOption {
inherit default;
type = types.listOf types.lines;
example = [ "a" "b" "c" ];
};
mkPath = path:
if path != null
then toString path
else "";
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.apps.qbittorrent;
in {
options.modules.desktop.apps.qbittorrent = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
qbittorrent
];
};
}
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.apps.slack;
in {
options.modules.desktop.apps.slack = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
slack
];

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.apps.thunderbird;
in {
options.modules.desktop.apps.thunderbird = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.file.".thunderbird/Default/chrome/thunderbird-gnome-theme".source = inputs.thunderbird-gnome-theme;
home.programs.thunderbird = {

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.apps.zoom;
in {
options.modules.desktop.apps.zoom = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
zoom-us
];

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.browsers.firefox;
in {
options.modules.desktop.browsers.firefox = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.file.".mozilla/firefox/Default/chrome/firefox-gnome-theme".source = inputs.firefox-gnome-theme;
home.programs.firefox = {

View File

@ -1,34 +1,59 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.gaming.emulators;
in {
options.modules.desktop.gaming.emulators = {
ds.enable = mkBoolOpt false;
gb.enable = mkBoolOpt false;
gba.enable = mkBoolOpt false;
gamecube.enable = mkBoolOpt false;
ps2.enable = mkBoolOpt false;
ps3.enable = mkBoolOpt false;
psp.enable = mkBoolOpt false;
snes.enable = mkBoolOpt false;
wii.enable = mkBoolOpt false;
ds.enable = lib.mkOption {
default = false;
example = true;
};
gb.enable = lib.mkOption {
default = false;
example = true;
};
gba.enable = lib.mkOption {
default = false;
example = true;
};
gamecube.enable = lib.mkOption {
default = false;
example = true;
};
ps2.enable = lib.mkOption {
default = false;
example = true;
};
ps3.enable = lib.mkOption {
default = false;
example = true;
};
psp.enable = lib.mkOption {
default = false;
example = true;
};
snes.enable = lib.mkOption {
default = false;
example = true;
};
wii.enable = lib.mkOption {
default = false;
example = true;
};
};
config = {
user.packages = with pkgs; [
(mkIf cfg.ps2.enable pcsx2)
(mkIf cfg.ps3.enable rpcs3)
(mkIf cfg.psp.enable ppsspp)
(mkIf cfg.ds.enable desmume)
(mkIf (cfg.gba.enable ||
(lib.mkIf cfg.ps2.enable pcsx2)
(lib.mkIf cfg.ps3.enable rpcs3)
(lib.mkIf cfg.psp.enable ppsspp)
(lib.mkIf cfg.ds.enable desmume)
(lib.mkIf (cfg.gba.enable ||
cfg.gb.enable ||
cfg.snes.enable)
higan)
(mkIf (cfg.wii.enable ||
(lib.mkIf (cfg.wii.enable ||
cfg.gamecube.enable)
dolphin-emu)
];
};
}
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.gaming.lutris;
in {
options.modules.desktop.gaming.lutris = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
lutris
vulkan-loader

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.gaming.steam;
in {
options.modules.desktop.gaming.steam = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
programs.steam.enable = true;
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
};
}
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.gnome;
in {
options.modules.desktop.gnome = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
services.xserver = {
enable = true;
displayManager.gdm.enable = true;

View File

@ -1,21 +1,28 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.media.graphics;
in {
options.modules.desktop.media.graphics = {
modeling.enable = mkBoolOpt false;
raster.enable = mkBoolOpt false;
vector.enable = mkBoolOpt false;
modeling.enable = lib.mkOption {
default = false;
example = true;
};
raster.enable = lib.mkOption {
default = false;
example = true;
};
vector.enable = lib.mkOption {
default = false;
example = true;
};
};
config = {
user.packages = with pkgs; [
(mkIf cfg.modeling.enable blender)
(mkIf cfg.raster.enable gimp)
(mkIf cfg.raster.enable krita)
(mkIf cfg.vector.enable inkscape)
(lib.mkIf cfg.modeling.enable blender)
(lib.mkIf cfg.raster.enable gimp)
(lib.mkIf cfg.raster.enable krita)
(lib.mkIf cfg.vector.enable inkscape)
];
};
}
}

View File

@ -1,12 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.media.recording;
in {
options.modules.desktop.media.recording = {
audio.enable = mkBoolOpt false;
video.enable = mkBoolOpt false;
audio.enable = lib.mkOption {
default = false;
example = true;
};
video.enable = lib.mkOption {
default = false;
example = true;
};
};
config = {
@ -21,4 +25,4 @@ in {
obs-studio
] else []);
};
}
}

View File

@ -1,17 +1,18 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let
cfg = config.modules.desktop.mimeapps;
avApp = "io.github.celluloid_player.Celluloid.desktop";
imageApp = "org.gnome.eog.desktop";
in {
options.modules.desktop.mimeapps = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
xdg.mime.defaultApplications = {
# Audio/video
"audio/x-vorbis+ogg" = avApp;

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.office.libreoffice;
in {
options.modules.desktop.office.libreoffice = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
libreoffice
];

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.cc;
in {
options.modules.dev.cc = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
clang
gcc
@ -17,4 +18,4 @@ in {
llvmPackages.libcxx
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.java;
in {
options.modules.dev.java = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
jdk
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.lua;
in {
options.modules.dev.lua = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
lua
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.node;
in {
options.modules.dev.node = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
nodejs_latest
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.python;
in {
options.modules.dev.python = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
python310
];
};
}
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.rust;
in {
options.modules.dev.rust = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
rustc
rustup
@ -16,4 +17,4 @@ in {
rust-bindgen
];
};
}
}

View File

@ -1,18 +1,19 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.scala;
in {
options.modules.dev.scala = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
jdk
sbt
scala
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.shell;
in {
options.modules.dev.shell = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
shellcheck
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.dev.zig;
in {
options.modules.dev.zig = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
zig
];
};
}
}

View File

@ -1,16 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let
cfg = config.modules.editors.neovim;
dev = config.modules.dev;
in {
options.modules.editors.neovim = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
user.packages = with pkgs; [
(neovim.override {
configure = {

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.editors.vscode;
in {
options.modules.editors.vscode = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
environment.sessionVariables.NIXOS_OZONE_WL = "1";
home.programs.vscode = {

View File

@ -1,15 +1,19 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.networking.tailscale;
in {
options.modules.networking.tailscale = {
enable = mkBoolOpt false;
restrictSSH = mkBoolOpt true;
enable = lib.mkOption {
default = false;
example = true;
};
restrictSSH = lib.mkOption {
default = true;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
services.tailscale.enable = true;
services.openssh.openFirewall = !cfg.restrictSSH;
networking.firewall = {

View File

@ -1,21 +1,20 @@
{ config, options, lib, home-manager, ... }:
with lib;
with lib.my;
{
options = with types; {
user = mkOpt attrs { };
user = mkOption { type = attrs; default = { }; };
home = {
configFile = mkOpt' attrs { } "Files to place in $XDG_CONFIG_HOME";
dataFile = mkOpt' attrs { } "Files to place in $XDG_DATA_HOME";
file = mkOpt' attrs { } "Files to place directly in $HOME";
packages = mkOpt' attrs { } "User-level installed packages";
programs = mkOpt' attrs { } "Programs managed directly from home-manager";
services = mkOpt' attrs { } "Services managed directly from home-manager";
configFile = mkOption { type = attrs; default = { }; description = "Files to place in $XDG_CONFIG_HOME"; };
dataFile = mkOption { type = attrs; default = { }; description = "Files to place in $XDG_DATA_HOME"; };
file = mkOption { type = attrs; default = { }; description = "Files to place directly in $HOME"; };
packages = mkOption { type = attrs; default = { }; description = "User-level installed packages"; };
programs = mkOption { type = attrs; default = { }; description = "Programs managed directly from home-manager"; };
services = mkOption { type = attrs; default = { }; description = "Services managed directly from home-manager"; };
};
dconf.settings = mkOpt' attrs { } "dconf settings to enable";
dconf.settings = mkOption { type = attrs; default = { }; description = "dconf settings to enable"; };
env = mkOption {
type = attrsOf (oneOf [ str path (listOf (either str path)) ]);
@ -69,8 +68,6 @@ with lib.my;
users.users.${config.user.name} = mkAliasDefinitions options.user;
nixpkgs.config.allowUnfree = true;
environment.extraInit =
concatStringsSep "\n"
(mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.env);

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.security.gpg;
in {
options.modules.security.gpg = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.programs.gpg = {
enable = true;
};
@ -18,4 +19,4 @@ in {
enableSshSupport = true;
};
};
}
}

View File

@ -1,17 +1,18 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.security.pass;
in {
options.modules.security.pass = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.programs.password-store = {
enable = true;
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
};
};
}
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.shell.git;
in {
options.modules.shell.git = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.programs.git = {
enable = true;
aliases = {
@ -35,4 +36,4 @@ in {
"git/ignore".source = ./ignore;
};
};
}
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.shell.zsh;
in {
options.modules.shell.zsh = {
enable = mkBoolOpt false;
enable = lib.mkOption {
default = false;
example = true;
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
users.defaultUserShell = pkgs.zsh;
programs.zsh = {