This commit is contained in:
2024-08-28 15:04:53 +03:00
parent 83e94f9051
commit 0b756f3af0
13 changed files with 210 additions and 30 deletions
-13
View File
@@ -1,13 +0,0 @@
#https://xeiaso.net/talks/asg-2023-nixos/ example
{ lib, config, pkgs, ... }:{
imports = [./gpg-agent.nix
./name.nix];
#Global suite options
options.azos.name = lib.mkOption{
default = "YOUR NAME HERE";
type = lib.types.str;
description = "Your full name.";
};
}
-13
View File
@@ -1,13 +0,0 @@
#https://xeiaso.net/talks/asg-2023-nixos/ example
{ lib, config, pkgs, ... }:
let
cfg = config.azos.gpgagent;
in
{
options.azos.gpgagent.enable = lib.mkEnableOption "Enables AZOS GPG agent";
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.gnupg ];
home.file.".gnupg/gpg-agent.conf".source = ./gpg-agent.conf;
};
}
+4 -3
View File
@@ -8,8 +8,10 @@
pkgs,
...
}: {
_module.args.azos-utils = import ./utils.nix { lib = lib; };
imports = [
./base
./suites
];
nixpkgs = {
@@ -25,7 +27,7 @@
};
};
azos.gpgagent.enable = true;
azos.suites.base.enable = true;
azos.name = "Aner Zakobar";
# TODO: Set your username
@@ -36,7 +38,6 @@
home.packages = with pkgs; [
# steam
emacs
pandoc
offlineimap #emailing
liberation_ttf #fonts
+33
View File
@@ -0,0 +1,33 @@
#https://xeiaso.net/talks/asg-2023-nixos/ example
{ lib, config, pkgs, options, azos-utils, ... }:
{
options.azos.suites.base.enable = (azos-utils.mkSuiteEnableOption {});
options.azos.suites.face.enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
imports = [
./emacs
./gpg-agent
./name.nix
];
options.azos.python.pkgs = lib.mkOption{
default = [];
type = lib.types.list;
description = "List of packages for python.";
};
options.azos.name = lib.mkOption{
default = "YOUR NAME HERE";
type = lib.types.str;
description = "Your full name.";
};
# config = lib.mkIf cfg.enable {
# # Global suite options
# };
}
@@ -0,0 +1,40 @@
{ lib, config, pkgs, azos-utils, ... }:
let
isEnabled =
config.azos.emacs.enable && config.azos.suites.base.enable;
emacspkgs = config.azos.emacs.emacspkg.pkgs;
in
{
options.azos.emacs.enable = (azos-utils.mkFeatureEnableOption {});
options.azos.emacs.emacspkg = lib.mkOption{
type = lib.types.package;
default = pkgs.emacs;
};
options.azos.emacs.pkgs = lib.mkOption{
default = [];
description = "List of packages for emacs.";
};
config = lib.mkIf isEnabled {
azos.emacs.pkgs = [(emacspkgs.trivialBuild (azos-utils.trivialFromOrg {
pname = "azos-emacs-base";
version = "0.1.6";
src = ./el/azos-emacs-base.org;
packageRequires = [
emacspkgs.evil
emacspkgs.magit
emacspkgs.vterm
];
}))];
home.packages = with pkgs;
[((emacsPackagesFor config.azos.emacs.emacspkg).emacsWithPackages (
config.azos.emacs.pkgs
)) ];
};
imports = [
];
}
@@ -0,0 +1,12 @@
Hello!
#+begin_src emacs-lisp
(use-package evil
:init
:ensure t
:config
(setq evil-want-C-i-jump nil)
(evil-mode 1))
(provide 'azos-emacs-base)
#+end_src
@@ -0,0 +1,14 @@
{ lib, config, pkgs, azos-utils, ... }:
let
isEnabled =
config.azos.gpgagent.enable &&
config.azos.suites.base.enable;
in
{
options.azos.gpgagent.enable = (azos-utils.mkFeatureEnableOption {});
config = lib.mkIf isEnabled {
home.packages = [ pkgs.gnupg ];
home.file.".gnupg/gpg-agent.conf".source = ./gpg-agent.conf;
};
}
+16
View File
@@ -0,0 +1,16 @@
#https://xeiaso.net/talks/asg-2023-nixos/ example
{ lib, config, pkgs, options, azos-utils, ... }:
{
# options.azos.suites.base.enable = azos-utils.mkSuiteEnableOption {
# suiteDependents = ["station"];
# };
# options.azos.suites.station.enable = azos-utils.mkSuiteEnableOption {
# suiteDependents = [];
# };
imports = [
./base
./station
];
}
+10
View File
@@ -0,0 +1,10 @@
{ lib, config, pkgs, options, azos-utils, ... }:
let
cfg = config.azos.suites.base;
in
{
options.azos.suites.station.enable = azos-utils.mkSuiteEnableOption {};
config = lib.mkIf cfg.enable {
};
}
+73
View File
@@ -0,0 +1,73 @@
{ lib, ... }:
{
# mkFeatureEnableOption = { suiteEnable, ...} @ attrs :
# lib.mkOption (builtins.removeAttrs (lib.mergeAttrs attrs {
# default = true;
# example = true;
# type = lib.types.bool;
# apply = old: suiteEnable && old;
# }) ["suiteEnable"]);
# mkDependentFeatureEnableOption = { suiteEnable, otherOption, ...} @ attrs :
# lib.mkOption (builtins.removeAttrs (lib.mergeAttrs attrs {
# default = true;
# example = true;
# type = lib.types.bool;
# apply = old: suiteEnable && otherOption && old;
# }) ["suiteEnable" "otherOption"]);
# mkSuiteEnableOption = { suiteDependents, ... } @ attrs :
# lib.mkOption lib.mergeAttrs attrs {
# default = [];
# example = [];
# type = lib.types.list;
# apply = old: old || lib.lists.any suiteEnabledPred suiteDependents;
# };
mkFeatureEnableOption = { ... } @ attrs :
lib.mkOption (lib.mergeAttrs attrs {
default = true;
example = true;
type = lib.types.bool;
});
mkSuiteEnableOption = { ... } @ attrs :
lib.mkOption (lib.mergeAttrs attrs {
default = false;
example = true;
type = lib.types.bool;
});
trivialFromOrg = { ... } @ attrs : (
lib.mergeAttrs attrs {
preBuild = ''
for file in ./*.org
do
emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$file\" (concat (file-name-sans-extension \"$file\") \".el\") \"emacs-lisp\")"
done
'';
unpackCmd = ''
case "$curSrc" in
*.el)
# keep original source filename without the hash
local filename=$(basename "$curSrc")
filename="''${filename:33}"
cp $curSrc $filename
chmod +w $filename
sourceRoot="."
;;
*.org)
# keep original source filename without the hash
local filename=$(basename "$curSrc")
filename="''${filename:33}"
cp $curSrc $filename
chmod +w $filename
sourceRoot="."
;;
*)
_defaultUnpack "$curSrc"
;;
esac
'';
});
}