summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devenv.nix3
-rw-r--r--flake.nix143
-rw-r--r--lib/mkDevenv.nix9
-rw-r--r--modules/devenv/default.nix6
-rw-r--r--modules/devenv/dotfiles.nix84
-rw-r--r--modules/devenv/integrations/default.nix5
-rw-r--r--modules/devenv/integrations/emacs.nix38
-rw-r--r--modules/devenv/integrations/gitignore.nix65
-rw-r--r--modules/devenv/languages/default.nix5
-rw-r--r--modules/devenv/languages/latex.nix147
-rw-r--r--modules/flake-parts/devenv.nix30
-rw-r--r--modules/flake-parts/personal.nix8
-rw-r--r--modules/home-manager/default.nix7
-rw-r--r--modules/home-manager/dotfiles.nix5
-rw-r--r--modules/home-manager/lockscreen.nix15
-rw-r--r--modules/home-manager/personal/environment.nix27
-rw-r--r--modules/home-manager/personal/gui/default.nix25
-rw-r--r--modules/home-manager/personal/gui/redshift.nix6
-rw-r--r--modules/home-manager/personal/gui/safeeyes.nix5
-rw-r--r--modules/home-manager/personal/gui/x/default.nix20
-rw-r--r--modules/home-manager/personal/gui/x/i3/bar/default.nix25
-rw-r--r--modules/home-manager/personal/gui/x/i3/default.nix70
-rw-r--r--modules/home-manager/personal/gui/x/i3/keybindings.nix36
-rw-r--r--modules/home-manager/personal/gui/x/i3/startup.nix35
-rw-r--r--modules/home-manager/personal/gui/x/idlehook.nix10
-rw-r--r--modules/home-manager/personal/identities.nix176
-rw-r--r--modules/home-manager/personal/profiles.nix44
-rw-r--r--modules/home-manager/personal/programs/alacritty.nix21
-rw-r--r--modules/home-manager/personal/programs/devenv.nix8
-rw-r--r--modules/home-manager/personal/programs/direnv.nix20
-rw-r--r--modules/home-manager/personal/programs/emacs.nix75
-rw-r--r--modules/home-manager/personal/programs/firefox/default.nix305
-rw-r--r--modules/home-manager/personal/programs/firefox/engines.nix87
-rw-r--r--modules/home-manager/personal/programs/firefox/userjs.nix15
-rw-r--r--modules/home-manager/personal/programs/git.nix81
-rw-r--r--modules/home-manager/personal/programs/rofi.nix22
-rw-r--r--modules/home-manager/personal/programs/thunderbird.nix10
-rw-r--r--modules/home-manager/wallpaper.nix9
-rw-r--r--modules/nixos/default.nix6
-rw-r--r--modules/nixos/filtron.nix23
-rw-r--r--modules/nixos/personal/boot.nix15
-rw-r--r--modules/nixos/personal/default.nix3
-rw-r--r--modules/nixos/personal/environment.nix69
-rw-r--r--modules/nixos/personal/gui.nix176
-rw-r--r--modules/nixos/personal/hardware.nix44
-rw-r--r--modules/nixos/personal/monitoring.nix57
-rw-r--r--modules/nixos/personal/networking/default.nix50
-rw-r--r--modules/nixos/personal/networking/wifi.nix101
-rw-r--r--modules/nixos/personal/nix.nix142
-rw-r--r--modules/nixos/personal/system.nix275
-rw-r--r--modules/nixos/personal/user.nix53
-rw-r--r--modules/nixos/rss-bridge.nix91
-rw-r--r--pkgs/barista/default.nix48
-rw-r--r--pkgs/default.nix35
-rw-r--r--pkgs/firefoxAddons/default.nix20
-rw-r--r--pkgs/lib/default.nix19
-rw-r--r--pkgs/lib/home-manager/default.nix16
-rw-r--r--pkgs/lockscreen/default.nix69
-rw-r--r--pkgs/rftg/default.nix9
-rw-r--r--pkgs/static/css/lineAwesome/default.nix9
-rw-r--r--pkgs/static/gitignore/default.nix16
-rw-r--r--pkgs/static/icons/default.nix24
-rw-r--r--pkgs/static/userjs/arkenfox/default.nix11
-rw-r--r--pkgs/static/userjs/thunderbird/default.nix11
-rw-r--r--pkgs/static/wallpapers/default.nix39
-rw-r--r--pkgs/watermark/default.nix6
-rw-r--r--templates/devenv/devenv.local.nix3
-rw-r--r--templates/devenv/devenv.nix5
68 files changed, 1795 insertions, 1352 deletions
diff --git a/devenv.nix b/devenv.nix
index 0694f11..593f598 100644
--- a/devenv.nix
+++ b/devenv.nix
@@ -1,3 +1,4 @@
-{...}: {
+{ ... }:
+{
languages.nix.enable = true;
}
diff --git a/flake.nix b/flake.nix
index dfbab14..ee0e6a3 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,78 +1,93 @@
{
- outputs = {
- self,
- nur,
- nixpkgs,
- flake-parts,
- ...
- } @ inputs: let
- devenvModules.personal = ./modules/devenv;
- flakeModules = {
- personal = ./modules/flake-parts/personal.nix;
- devenv = import ./modules/flake-parts/devenv.nix devenvModules;
- };
- in
- flake-parts.lib.mkFlake {inherit inputs;} {
- imports = [flakeModules.personal];
+ outputs =
+ {
+ self,
+ nur,
+ nixpkgs,
+ flake-parts,
+ ...
+ }@inputs:
+ let
+ devenvModules.personal = ./modules/devenv;
+ flakeModules = {
+ personal = ./modules/flake-parts/personal.nix;
+ devenv = import ./modules/flake-parts/devenv.nix devenvModules;
+ };
+ in
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ imports = [ flakeModules.personal ];
flake = {
inherit devenvModules flakeModules;
nixosModules.personal = ./modules/nixos;
homeModules.personal = ./modules/home-manager;
- overlays.personal = _: super: let
- my-packages = import ./pkgs (super.extend nur.overlays.default);
- in {
- inherit
- (super.lib.recursiveUpdate super {
- personal = my-packages;
- lib.personal = my-packages.lib;
- })
- personal
- lib
- ;
- };
+ overlays.personal =
+ _: super:
+ let
+ my-packages = import ./pkgs (super.extend nur.overlays.default);
+ in
+ {
+ inherit
+ (super.lib.recursiveUpdate super {
+ personal = my-packages;
+ lib.personal = my-packages.lib;
+ })
+ personal
+ lib
+ ;
+ };
lib = import ./lib;
- templates = let
- devenv = {path = ./templates/devenv;};
- in {
- inherit devenv;
- default = devenv;
- };
+ templates =
+ let
+ devenv = {
+ path = ./templates/devenv;
+ };
+ in
+ {
+ inherit devenv;
+ default = devenv;
+ };
};
- perSystem = {
- config,
- system,
- pkgs,
- lib,
- ...
- }: let
- flatten = let
- aux = path: attrs:
- if lib.isAttrs attrs && !lib.isDerivation attrs
- then
- lib.foldlAttrs
- (prev: name: value: prev // aux (path ++ [name]) value) {}
- attrs
- else
- (
- if lib.isDerivation attrs
- then {
- "${lib.concatStringsSep "_" path}" = attrs;
- }
- else {}
- );
+ perSystem =
+ {
+ config,
+ system,
+ pkgs,
+ lib,
+ ...
+ }:
+ let
+ flatten =
+ let
+ aux =
+ path: attrs:
+ if lib.isAttrs attrs && !lib.isDerivation attrs then
+ lib.foldlAttrs (
+ prev: name: value:
+ prev // aux (path ++ [ name ]) value
+ ) { } attrs
+ else
+ (
+ if lib.isDerivation attrs then
+ {
+ "${lib.concatStringsSep "_" path}" = attrs;
+ }
+ else
+ { }
+ );
+ in
+ aux [ ];
in
- aux [];
- in {
- _module.args.pkgs = import nixpkgs {
- inherit system;
- overlays = [self.overlays.personal];
- config = {};
- };
+ {
+ _module.args.pkgs = import nixpkgs {
+ inherit system;
+ overlays = [ self.overlays.personal ];
+ config = { };
+ };
- packages = flatten pkgs.personal;
- };
+ packages = flatten pkgs.personal;
+ };
};
}
diff --git a/lib/mkDevenv.nix b/lib/mkDevenv.nix
index 3a86b14..f0c8322 100644
--- a/lib/mkDevenv.nix
+++ b/lib/mkDevenv.nix
@@ -3,12 +3,13 @@
flake-parts,
my-nixpkgs,
...
-} @ inputs: config:
-flake-parts.lib.mkFlake {inherit inputs;} {
- imports = builtins.attrValues {inherit (my-nixpkgs.flakeModules) personal devenv;};
+}@inputs:
+config:
+flake-parts.lib.mkFlake { inherit inputs; } {
+ imports = builtins.attrValues { inherit (my-nixpkgs.flakeModules) personal devenv; };
perSystem = _: {
devenv.shells.default = {
- imports = [config];
+ imports = [ config ];
};
};
}
diff --git a/modules/devenv/default.nix b/modules/devenv/default.nix
index 8aedcf6..42d9593 100644
--- a/modules/devenv/default.nix
+++ b/modules/devenv/default.nix
@@ -1,3 +1,7 @@
{
- imports = [./dotfiles.nix ./integrations ./languages];
+ imports = [
+ ./dotfiles.nix
+ ./integrations
+ ./languages
+ ];
}
diff --git a/modules/devenv/dotfiles.nix b/modules/devenv/dotfiles.nix
index ca3108c..994b50f 100644
--- a/modules/devenv/dotfiles.nix
+++ b/modules/devenv/dotfiles.nix
@@ -2,24 +2,25 @@
config,
lib,
...
-}: let
+}:
+let
cfg = config.dotfiles;
- dotfilesToIgnore = lib.attrNames (lib.filterAttrs (_: {gitignore, ...}: gitignore) cfg);
-in {
+ dotfilesToIgnore = lib.attrNames (lib.filterAttrs (_: { gitignore, ... }: gitignore) cfg);
+in
+{
options.dotfiles = lib.mkOption {
- type = with lib.types;
- # this cannot be a lazyAttrsOf, see https://nixos.org/manual/nixos/unstable/#sec-option-types-composed
+ type =
+ with lib.types;
+ # this cannot be a lazyAttrsOf, see https://nixos.org/manual/nixos/unstable/#sec-option-types-composed
attrsOf (submodule {
options = {
- gitignore =
- lib.mkEnableOption ""
- // {
- description = ''
- Whether git should ignore this dotfile, typically if it is
- generated to contain absolute paths and is specific to this
- project (and may not be ignored system-wide by the user).
- '';
- };
+ gitignore = lib.mkEnableOption "" // {
+ description = ''
+ Whether git should ignore this dotfile, typically if it is
+ generated to contain absolute paths and is specific to this
+ project (and may not be ignored system-wide by the user).
+ '';
+ };
text = lib.mkOption {
type = lib.types.lines;
default = "";
@@ -29,31 +30,32 @@ in {
});
};
- config.enterShell =
- lib.mkIf (cfg != {})
- (''
- echo Installing dotfiles...
- ''
- + lib.concatStringsSep "\n" (lib.mapAttrsToList (
- name: {
- text,
- gitignore,
- }:
- # this has to be done here to avoid infinite recursion
- let
- content =
- text
- + lib.optionalString (name == ".gitignore" && dotfilesToIgnore != []) ''
- ### dotfiles
- ${lib.concatStringsSep "\n" dotfilesToIgnore}
- '';
- in ''
- ${
- if gitignore
- then "ln --symbolic --force"
- else "install --mode=644"
- } "${builtins.toFile name content}" "${name}"
- ''
- )
- cfg));
+ config.enterShell = lib.mkIf (cfg != { }) (
+ ''
+ echo Installing dotfiles...
+ ''
+ + lib.concatStringsSep "\n" (
+ lib.mapAttrsToList (
+ name:
+ {
+ text,
+ gitignore,
+ }:
+ # this has to be done here to avoid infinite recursion
+ let
+ content =
+ text
+ + lib.optionalString (name == ".gitignore" && dotfilesToIgnore != [ ]) ''
+ ### dotfiles
+ ${lib.concatStringsSep "\n" dotfilesToIgnore}
+ '';
+ in
+ ''
+ ${
+ if gitignore then "ln --symbolic --force" else "install --mode=644"
+ } "${builtins.toFile name content}" "${name}"
+ ''
+ ) cfg
+ )
+ );
}
diff --git a/modules/devenv/integrations/default.nix b/modules/devenv/integrations/default.nix
index 7fa74bd..79c104d 100644
--- a/modules/devenv/integrations/default.nix
+++ b/modules/devenv/integrations/default.nix
@@ -1,3 +1,6 @@
{
- imports = [./emacs.nix ./gitignore.nix];
+ imports = [
+ ./emacs.nix
+ ./gitignore.nix
+ ];
}
diff --git a/modules/devenv/integrations/emacs.nix b/modules/devenv/integrations/emacs.nix
index 347132f..ed20734 100644
--- a/modules/devenv/integrations/emacs.nix
+++ b/modules/devenv/integrations/emacs.nix
@@ -2,33 +2,31 @@
config,
lib,
...
-}: let
+}:
+let
cfg = config.emacs;
- attrs2alist = value:
- if lib.isAttrs value
- then "(${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "(${name} . ${attrs2alist value})") value)})"
+ attrs2alist =
+ value:
+ if lib.isAttrs value then
+ "(${
+ lib.concatStringsSep "\n" (
+ lib.mapAttrsToList (name: value: "(${name} . ${attrs2alist value})") value
+ )
+ })"
else
(
- if lib.isList value
- then "(${lib.concatStringsSep " " value})"
+ if lib.isList value then
+ "(${lib.concatStringsSep " " value})"
else
- (
- if lib.isBool value
- then
- (
- if value
- then "t"
- else "nil"
- )
- else builtins.toString value
- )
+ (if lib.isBool value then (if value then "t" else "nil") else builtins.toString value)
);
-in {
+in
+{
options.emacs = {
enable = lib.mkEnableOption "emacs integration";
dirLocals = lib.mkOption {
type = with lib.types; attrsOf (attrsOf anything);
- default = {};
+ default = { };
example =
# the first example from https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
{
@@ -46,7 +44,5 @@ in {
};
};
- config.dotfiles.".dir-locals.el".text =
- lib.mkIf (cfg.dirLocals != {})
- (attrs2alist cfg.dirLocals);
+ config.dotfiles.".dir-locals.el".text = lib.mkIf (cfg.dirLocals != { }) (attrs2alist cfg.dirLocals);
}
diff --git a/modules/devenv/integrations/gitignore.nix b/modules/devenv/integrations/gitignore.nix
index bb216a7..3db8dfe 100644
--- a/modules/devenv/integrations/gitignore.nix
+++ b/modules/devenv/integrations/gitignore.nix
@@ -4,41 +4,56 @@
pkgs,
inputs,
...
-}: let
+}:
+let
cfg = config.gitignore;
ignoreDevenv = cfg.devenv.enable or false;
- templates = lib.attrNames (lib.filterAttrs (name: value: (value.enable or false) && name != "devenv") cfg);
+ templates = lib.attrNames (
+ lib.filterAttrs (name: value: (value.enable or false) && name != "devenv") cfg
+ );
toUncomment = builtins.concatLists (lib.collect lib.isList cfg);
-in {
+in
+{
options.gitignore = lib.mkOption {
- type = with lib.types; (submodule {
- freeformType = with lib.types;
- attrsOf (submodule {
- options = {
- enable = lib.mkEnableOption "";
- uncomment = lib.mkOption {
- type = with lib.types; listOf str;
- default = [];
- description = "Lines that should be uncommented and thus enabled in the template file.";
+ type =
+ with lib.types;
+ (submodule {
+ freeformType =
+ with lib.types;
+ attrsOf (submodule {
+ options = {
+ enable = lib.mkEnableOption "";
+ uncomment = lib.mkOption {
+ type = with lib.types; listOf str;
+ default = [ ];
+ description = "Lines that should be uncommented and thus enabled in the template file.";
+ };
};
- };
- });
- options.extra = lib.mkOption {
- type = lib.types.lines;
- default = "";
- example = ''
- *.my-file-extension
- '';
- };
- });
- default = {extra = "";};
+ });
+ options.extra = lib.mkOption {
+ type = lib.types.lines;
+ default = "";
+ example = ''
+ *.my-file-extension
+ '';
+ };
+ });
+ default = {
+ extra = "";
+ };
};
config = {
- dotfiles.".gitignore" = lib.mkIf (templates != {} || cfg.extra != "") {
+ dotfiles.".gitignore" = lib.mkIf (templates != { } || cfg.extra != "") {
gitignore = lib.mkDefault false;
text =
- lib.optionalString (templates != []) (builtins.readFile ((pkgs.extend inputs.my-nixpkgs.overlays.personal).personal.static.gitignore.override {inherit templates toUncomment;}))
+ lib.optionalString (templates != [ ]) (
+ builtins.readFile (
+ (pkgs.extend inputs.my-nixpkgs.overlays.personal).personal.static.gitignore.override {
+ inherit templates toUncomment;
+ }
+ )
+ )
+ lib.optionalString ignoreDevenv ''
### devenv
.devenv/
diff --git a/modules/devenv/languages/default.nix b/modules/devenv/languages/default.nix
index a97402c..c415dfc 100644
--- a/modules/devenv/languages/default.nix
+++ b/modules/devenv/languages/default.nix
@@ -1,3 +1,6 @@
{
- imports = [./latex.nix ./nix.nix];
+ imports = [
+ ./latex.nix
+ ./nix.nix
+ ];
}
diff --git a/modules/devenv/languages/latex.nix b/modules/devenv/languages/latex.nix
index 6e23d4b..40dcc7a 100644
--- a/modules/devenv/languages/latex.nix
+++ b/modules/devenv/languages/latex.nix
@@ -4,7 +4,8 @@
pkgs,
devenv,
...
-}: let
+}:
+let
cfg = config.languages.texlive;
pdfModes = {
"pdflatex" = "1";
@@ -17,21 +18,14 @@
"latex" = "1";
"lualatex" = "2";
};
- latexmkrc = with cfg.latexmk; let
- pdfMode = with output.pdf;
- if enable
- then pdfModes."${mode}"
- else "0";
- dviMode = with output.dvi;
- if enable
- then dviModes."${mode}"
- else "0";
- psMode =
- if output.ps.enable
- then "1"
- else "0";
- in
- lib.optionalString (extraFlags != []) ''
+ latexmkrc =
+ with cfg.latexmk;
+ let
+ pdfMode = with output.pdf; if enable then pdfModes."${mode}" else "0";
+ dviMode = with output.dvi; if enable then dviModes."${mode}" else "0";
+ psMode = if output.ps.enable then "1" else "0";
+ in
+ lib.optionalString (extraFlags != [ ]) ''
set_tex_cmds('${lib.concatStringsSep " " extraFlags}');
''
+ ''
@@ -47,8 +41,9 @@
packages = cfg.packages cfg.base;
packagesRequireShellEscape = packages ? minted;
texlive = cfg.base.combine packages;
-in {
- disabledModules = [(devenv.modules + "/languages/texlive.nix")];
+in
+{
+ disabledModules = [ (devenv.modules + "/languages/texlive.nix") ];
options.languages.texlive = {
enable = lib.mkEnableOption "TeX Live";
@@ -57,13 +52,16 @@ in {
description = "TeX Live package set to use";
};
packages = lib.mkOption {
- type = with lib.types;
- functionTo (attrsOf (submodule {
- options.pkgs = lib.mkOption {
- type = listOf (either package (attrsOf anything));
- };
- }));
- default = tl: {inherit (tl) scheme-medium;};
+ type =
+ with lib.types;
+ functionTo (
+ attrsOf (submodule {
+ options.pkgs = lib.mkOption {
+ type = listOf (either package (attrsOf anything));
+ };
+ })
+ );
+ default = tl: { inherit (tl) scheme-medium; };
description = "Packages available to TeX Live.";
};
@@ -71,27 +69,40 @@ in {
enable = lib.mkEnableOption "latexmk";
cleanExt = lib.mkOption {
type = with lib.types; listOf str;
- default = ["fdb_latexmk" "nav" "prv_%R.fmt" "prv_%R.log" "prv/*/*" "prv/*" "prv" "-SAVE-ERROR" "snm" "vrb"];
+ default = [
+ "fdb_latexmk"
+ "nav"
+ "prv_%R.fmt"
+ "prv_%R.log"
+ "prv/*/*"
+ "prv/*"
+ "prv"
+ "-SAVE-ERROR"
+ "snm"
+ "vrb"
+ ];
};
cleanFullExt = lib.mkOption {
type = with lib.types; listOf str;
- default = ["bbl"];
+ default = [ "bbl" ];
};
shellEscape.enable = lib.mkEnableOption "shell escaping";
extraFlags = lib.mkOption {
type = with lib.types; listOf str;
- default = [];
- example = ["--interaction=nonstopmode"];
+ default = [ ];
+ example = [ "--interaction=nonstopmode" ];
};
- output = let
- mkOutputOptions = formats:
- lib.mapAttrs (format: extra:
- lib.recursiveUpdate {
- enable = lib.mkEnableOption "${format} output";
- }
- extra)
- formats;
- in
+ output =
+ let
+ mkOutputOptions =
+ formats:
+ lib.mapAttrs (
+ format: extra:
+ lib.recursiveUpdate {
+ enable = lib.mkEnableOption "${format} output";
+ } extra
+ ) formats;
+ in
mkOutputOptions {
pdf = {
enable.default = true;
@@ -108,7 +119,7 @@ in {
description = "How to generate the dvi file.";
};
};
- ps = {};
+ ps = { };
};
extraConfig = lib.mkOption {
type = lib.types.lines;
@@ -118,35 +129,39 @@ in {
};
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- packages = [texlive];
- gitignore = {
- TeX.enable = true;
- extra = ''
- *-SAVE-ERROR
- '';
- };
- }
- (lib.mkIf cfg.latexmk.enable {
- languages.texlive = {
- packages = tl: {inherit (tl) latexmk;};
- latexmk = {
- shellEscape.enable = lib.mkDefault packagesRequireShellEscape;
- extraFlags = lib.optional cfg.latexmk.shellEscape.enable "-shell-escape";
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ packages = [ texlive ];
+ gitignore = {
+ TeX.enable = true;
+ extra = ''
+ *-SAVE-ERROR
+ '';
+ };
+ }
+ (lib.mkIf cfg.latexmk.enable {
+ languages.texlive = {
+ packages = tl: { inherit (tl) latexmk; };
+ latexmk = {
+ shellEscape.enable = lib.mkDefault packagesRequireShellEscape;
+ extraFlags = lib.optional cfg.latexmk.shellEscape.enable "-shell-escape";
+ };
};
- };
- scripts.latexmk.exec = ''
- ${texlive}/bin/latexmk -r ${config.devenv.root}/.latexmkrc $@
- '';
+ scripts.latexmk.exec = ''
+ ${texlive}/bin/latexmk -r ${config.devenv.root}/.latexmkrc $@
+ '';
- gitignore.LaTeX.uncomment = with cfg.latexmk.output; lib.optional pdf.enable "*.pdf" ++ lib.optional dvi.enable "*.dvi" ++ lib.optional ps.enable "*.ps";
+ gitignore.LaTeX.uncomment =
+ with cfg.latexmk.output;
+ lib.optional pdf.enable "*.pdf" ++ lib.optional dvi.enable "*.dvi" ++ lib.optional ps.enable "*.ps";
- dotfiles.".latexmkrc" = {
- gitignore = lib.mkDefault false;
- text = latexmkrc;
- };
- })
- ]);
+ dotfiles.".latexmkrc" = {
+ gitignore = lib.mkDefault false;
+ text = latexmkrc;
+ };
+ })
+ ]
+ );
}
diff --git a/modules/flake-parts/devenv.nix b/modules/flake-parts/devenv.nix
index 9e01a56..d63290c 100644
--- a/modules/flake-parts/devenv.nix
+++ b/modules/flake-parts/devenv.nix
@@ -1,19 +1,25 @@
-devenvModules: {
+devenvModules:
+{
flake-parts-lib,
inputs,
...
-}: {
- imports = [inputs.devenv.flakeModule];
+}:
+{
+ imports = [ inputs.devenv.flakeModule ];
- options.perSystem = flake-parts-lib.mkPerSystemOption ({lib, ...}: {
- options.devenv.shells = lib.mkOption {
- type = with lib.types;
- lazyAttrsOf (submoduleWith {
- modules = builtins.attrValues devenvModules;
- shorthandOnlyDefinesConfig = null;
- });
- };
- });
+ options.perSystem = flake-parts-lib.mkPerSystemOption (
+ { lib, ... }:
+ {
+ options.devenv.shells = lib.mkOption {
+ type =
+ with lib.types;
+ lazyAttrsOf (submoduleWith {
+ modules = builtins.attrValues devenvModules;
+ shorthandOnlyDefinesConfig = null;
+ });
+ };
+ }
+ );
# the extra parameter before the module make this module behave like an
# anonymous module, so we need to manually identify the file, for better
diff --git a/modules/flake-parts/personal.nix b/modules/flake-parts/personal.nix
index 370e176..b259c29 100644
--- a/modules/flake-parts/personal.nix
+++ b/modules/flake-parts/personal.nix
@@ -1,3 +1,9 @@
{
- systems = ["x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
+ systems = [
+ "x86_64-linux"
+ "i686-linux"
+ "x86_64-darwin"
+ "aarch64-linux"
+ "aarch64-darwin"
+ ];
}
diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix
index f9cee08..99c7ee5 100644
--- a/modules/home-manager/default.nix
+++ b/modules/home-manager/default.nix
@@ -1,5 +1,10 @@
{ ... }:
{
- imports = [ ./dotfiles.nix ./lockscreen.nix ./personal ./wallpaper.nix ];
+ imports = [
+ ./dotfiles.nix
+ ./lockscreen.nix
+ ./personal
+ ./wallpaper.nix
+ ];
}
diff --git a/modules/home-manager/dotfiles.nix b/modules/home-manager/dotfiles.nix
index 6d28f39..0a58589 100644
--- a/modules/home-manager/dotfiles.nix
+++ b/modules/home-manager/dotfiles.nix
@@ -3,11 +3,10 @@
{
options.personal.home.dotfiles = lib.mkOption {
type = with lib.types; attrsOf path;
- default = {};
+ default = { };
description = ''
Paths to dotfiles.
'';
- example =
- lib.literalExample "{ \"init.el\" = ./dotfiles/init.el; }";
+ example = lib.literalExample "{ \"init.el\" = ./dotfiles/init.el; }";
};
}
diff --git a/modules/home-manager/lockscreen.nix b/modules/home-manager/lockscreen.nix
index e5c36ed..da3bfd1 100644
--- a/modules/home-manager/lockscreen.nix
+++ b/modules/home-manager/lockscreen.nix
@@ -1,13 +1,18 @@
-{ config, lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
{
options.personal.home.lockscreen = lib.mkOption {
type = lib.types.str;
default = "${
- pkgs.personal.lockscreen.override {
- backgroundImage = config.personal.home.wallpaper;
- }
- }/bin/lockscreen.sh";
+ pkgs.personal.lockscreen.override {
+ backgroundImage = config.personal.home.wallpaper;
+ }
+ }/bin/lockscreen.sh";
description = ''
Command to run for locking the screen.
'';
diff --git a/modules/home-manager/personal/environment.nix b/modules/home-manager/personal/environment.nix
index 03bebf3..86d9884 100644
--- a/modules/home-manager/personal/environment.nix
+++ b/modules/home-manager/personal/environment.nix
@@ -3,12 +3,20 @@
lib,
pkgs,
...
-} @ inputs: {
- home.packages = with pkgs; [coreutils moreutils];
- personal.home.wallpaper =
- lib.mkDefault (inputs.osConfig.stylix.image or (pkgs.personal.static.wallpapers.nga-1973-68-1.override {gravity = "north";}));
+}@inputs:
+{
+ home.packages = with pkgs; [
+ coreutils
+ moreutils
+ ];
+ personal.home.wallpaper = lib.mkDefault (
+ inputs.osConfig.stylix.image
+ or (pkgs.personal.static.wallpapers.nga-1973-68-1.override { gravity = "north"; })
+ );
- programs.bash = {enable = lib.mkDefault true;};
+ programs.bash = {
+ enable = lib.mkDefault true;
+ };
home = {
shellAliases = {
@@ -32,12 +40,7 @@
services.gpg-agent = {
enableBashIntegration = lib.mkDefault config.programs.bash.enable;
- pinentry.package = lib.mkDefault (
- if config.personal.gui.enable
- then pkgs.pinentry-qt
- else null
- );
- grabKeyboardAndMouse =
- lib.mkDefault false; # insecure, but necessary with keepass auto-type
+ pinentry.package = lib.mkDefault (if config.personal.gui.enable then pkgs.pinentry-qt else null);
+ grabKeyboardAndMouse = lib.mkDefault false; # insecure, but necessary with keepass auto-type
};
}
diff --git a/modules/home-manager/personal/gui/default.nix b/modules/home-manager/personal/gui/default.nix
index c0d63ce..6c023da 100644
--- a/modules/home-manager/personal/gui/default.nix
+++ b/modules/home-manager/personal/gui/default.nix
@@ -3,17 +3,21 @@
lib,
pkgs,
...
-} @ extraArgs: let
+}@extraArgs:
+let
cfg = config.personal.gui;
-in {
- imports = [./redshift.nix ./safeeyes.nix ./x];
+in
+{
+ imports = [
+ ./redshift.nix
+ ./safeeyes.nix
+ ./x
+ ];
options.personal.gui = {
- enable =
- lib.mkEnableOption "GUI"
- // {
- default = extraArgs.osConfig.personal.gui.enable or false;
- };
+ enable = lib.mkEnableOption "GUI" // {
+ default = extraArgs.osConfig.personal.gui.enable or false;
+ };
};
config = lib.mkIf cfg.enable {
@@ -43,7 +47,10 @@ in {
home.packages =
lib.optional config.dconf.enable pkgs.dconf
- ++ (with pkgs; [keepassxc pavucontrol]);
+ ++ (with pkgs; [
+ keepassxc
+ pavucontrol
+ ]);
programs.firefox.enable = true;
};
}
diff --git a/modules/home-manager/personal/gui/redshift.nix b/modules/home-manager/personal/gui/redshift.nix
index 2242ad2..cdd8ba0 100644
--- a/modules/home-manager/personal/gui/redshift.nix
+++ b/modules/home-manager/personal/gui/redshift.nix
@@ -8,10 +8,8 @@
day = lib.mkDefault 2500;
night = lib.mkDefault 2500;
};
- latitude =
- extraArgs.osConfig.location.latitude or (lib.mkDefault "48.856614");
- longitude =
- extraArgs.osConfig.location.longitude or (lib.mkDefault "2.3522219");
+ latitude = extraArgs.osConfig.location.latitude or (lib.mkDefault "48.856614");
+ longitude = extraArgs.osConfig.location.longitude or (lib.mkDefault "2.3522219");
settings.redshift.transition = lib.mkDefault 0;
};
}
diff --git a/modules/home-manager/personal/gui/safeeyes.nix b/modules/home-manager/personal/gui/safeeyes.nix
index 17a3bd6..a7ea874 100644
--- a/modules/home-manager/personal/gui/safeeyes.nix
+++ b/modules/home-manager/personal/gui/safeeyes.nix
@@ -1,9 +1,10 @@
-{...}: {
+{ ... }:
+{
services = {
safeeyes.enable = true;
snixembed = {
enable = true;
- beforeUnits = ["safeeyes.service"];
+ beforeUnits = [ "safeeyes.service" ];
};
};
}
diff --git a/modules/home-manager/personal/gui/x/default.nix b/modules/home-manager/personal/gui/x/default.nix
index bb1c4bb..2331258 100644
--- a/modules/home-manager/personal/gui/x/default.nix
+++ b/modules/home-manager/personal/gui/x/default.nix
@@ -2,17 +2,21 @@
config,
lib,
...
-} @ extraArgs: let
+}@extraArgs:
+let
cfg = config.personal.x;
-in {
- imports = [./i3 ./idlehook.nix ./picom.nix];
+in
+{
+ imports = [
+ ./i3
+ ./idlehook.nix
+ ./picom.nix
+ ];
options.personal.x = {
- enable =
- lib.mkEnableOption "X"
- // {
- default = extraArgs.osConfig.services.xserver.enable or false;
- };
+ enable = lib.mkEnableOption "X" // {
+ default = extraArgs.osConfig.services.xserver.enable or false;
+ };
};
config = lib.mkIf (cfg.enable && config.personal.gui.enable) {
diff --git a/modules/home-manager/personal/gui/x/i3/bar/default.nix b/modules/home-manager/personal/gui/x/i3/bar/default.nix
index a6d910f..132e850 100644
--- a/modules/home-manager/personal/gui/x/i3/bar/default.nix
+++ b/modules/home-manager/personal/gui/x/i3/bar/default.nix
@@ -3,26 +3,29 @@
lib,
pkgs,
...
-}: let
- statusPackage =
- pkgs.personal.barista.override {i3statusGo = ./i3status.go;};
-in {
+}:
+let
+ statusPackage = pkgs.personal.barista.override { i3statusGo = ./i3status.go; };
+in
+{
xsession.windowManager.i3.config.bars = [
- ({
+ (
+ {
statusCommand = "${statusPackage}/bin/i3status";
}
- // (config.lib.stylix.i3.targets.i3.exportedBarConfig or {colors.background = "#111111";})
+ // (config.lib.stylix.i3.targets.i3.exportedBarConfig or { colors.background = "#111111"; })
// {
fonts = {
- names = ["roboto"];
+ names = [ "roboto" ];
size = 11.0;
};
- })
+ }
+ )
];
- home.packages = with pkgs;
- lib.optionals
- (config.xsession.enable && config.xsession.windowManager.i3.enable) [
+ home.packages =
+ with pkgs;
+ lib.optionals (config.xsession.enable && config.xsession.windowManager.i3.enable) [
material-design-icons
roboto
];
diff --git a/modules/home-manager/personal/gui/x/i3/default.nix b/modules/home-manager/personal/gui/x/i3/default.nix
index 17019cb..483a0d4 100644
--- a/modules/home-manager/personal/gui/x/i3/default.nix
+++ b/modules/home-manager/personal/gui/x/i3/default.nix
@@ -3,18 +3,21 @@
lib,
pkgs,
...
-} @ extraArgs: let
+}@extraArgs:
+let
cfg = config.personal.x.i3;
-in {
- imports = [./bar ./keybindings.nix ./startup.nix];
+in
+{
+ imports = [
+ ./bar
+ ./keybindings.nix
+ ./startup.nix
+ ];
options.personal.x.i3 = {
- enable =
- lib.mkEnableOption "i3"
- // {
- default =
- extraArgs.osConfig.services.xserver.windowManager.i3.enable or false;
- };
+ enable = lib.mkEnableOption "i3" // {
+ default = extraArgs.osConfig.services.xserver.windowManager.i3.enable or false;
+ };
};
config = lib.mkIf cfg.enable {
@@ -24,27 +27,30 @@ in {
config = {
assigns =
- lib.optionalAttrs (config.personal.profiles.multimedia
- && (extraArgs.osConfig.programs.steam.enable or true)) {
- "8: multimedia" = [
- {class = "^Steam$";}
- {title = "Netflix";}
- {title = "MUBI";}
- {title = "Deezer";}
- ];
- }
- // lib.optionalAttrs config.personal.profiles.social {
- "9: social" =
- [{class = "^Mail$";} {class = "^thunderbird$";}]
- ++ lib.optionals config.personal.identities.personal [
- {class = "^signal$";}
- {class = "^Signal$";}
- {title = "^Signal";}
- ]
- ++ lib.optionals config.personal.identities.work [
- {class = "^zulip";}
- {class = "^Zulip";}
+ lib.optionalAttrs
+ (config.personal.profiles.multimedia && (extraArgs.osConfig.programs.steam.enable or true))
+ {
+ "8: multimedia" = [
+ { class = "^Steam$"; }
+ { title = "Netflix"; }
+ { title = "MUBI"; }
+ { title = "Deezer"; }
];
+ }
+ // lib.optionalAttrs config.personal.profiles.social {
+ "9: social" = [
+ { class = "^Mail$"; }
+ { class = "^thunderbird$"; }
+ ]
+ ++ lib.optionals config.personal.identities.personal [
+ { class = "^signal$"; }
+ { class = "^Signal$"; }
+ { title = "^Signal"; }
+ ]
+ ++ lib.optionals config.personal.identities.work [
+ { class = "^zulip"; }
+ { class = "^Zulip"; }
+ ];
}
// {
"10: passwords" = [
@@ -64,11 +70,7 @@ in {
floating = {
titlebar = lib.mkDefault false;
border = lib.mkDefault (
- if
- config.services.picom.enable
- && config.services.picom.shadow
- then 0
- else lib.mkOptionDefault
+ if config.services.picom.enable && config.services.picom.shadow then 0 else lib.mkOptionDefault
);
};
gaps = {
diff --git a/modules/home-manager/personal/gui/x/i3/keybindings.nix b/modules/home-manager/personal/gui/x/i3/keybindings.nix
index c15075f..d28e9fb 100644
--- a/modules/home-manager/personal/gui/x/i3/keybindings.nix
+++ b/modules/home-manager/personal/gui/x/i3/keybindings.nix
@@ -3,7 +3,8 @@
lib,
pkgs,
...
-}: let
+}:
+let
# i3 pretty-printing
exec = script: ''exec "${script}";'';
execRofiShow = modi: exec "${rofiShow} ${modi}";
@@ -19,13 +20,15 @@
rofiPulseSelect = "${pkgs.rofi-pulse-select}/bin/rofi-pulse-select";
rofiBluetooth = "${pkgs.rofi-bluetooth}/bin/rofi-bluetooth";
rofiPowerMenu = "${pkgs.rofi-power-menu}/bin/rofi-power-menu";
-in {
+in
+{
xsession.windowManager.i3.config = {
inherit modifier;
modes = lib.mkOptionDefault {
# launching apps
- launch = mkTempMode ({
+ launch = mkTempMode (
+ {
"e" = exec "emacsclient --create-frame";
"b" = exec "$BROWSER";
}
@@ -38,18 +41,19 @@ in {
"t" = execRofiShow "top";
"w" = execRofiShow "window";
"Escape" = "";
- });
+ }
+ );
};
- keybindings = lib.mkOptionDefault ({
+ keybindings = lib.mkOptionDefault (
+ {
"${modifier}+space" = "mode launch";
}
// lib.optionalAttrs config.programs.rofi.enable {
"${modifier}+F1" = exec "${rofiPulseSelect} sink";
"${modifier}+F4" = exec "${rofiPulseSelect} source";
"${modifier}+Print" = exec rofiBluetooth;
- "${modifier}+Delete" =
- exec "${rofiShow} menu -modi menu:${rofiPowerMenu}";
+ "${modifier}+Delete" = exec "${rofiShow} menu -modi menu:${rofiPowerMenu}";
"${modifier}+p" = "move workspace to output right";
}
// {
@@ -60,22 +64,18 @@ in {
# media keys
"XF86MonBrightnessUp" = exec "${brightnessctl} set 5%+";
"XF86MonBrightnessDown" = exec "${brightnessctl} set 5%-";
- "XF86AudioRaiseVolume" =
- exec "${volumectl} set-sink-volume @DEFAULT_SINK@ +5%";
- "XF86AudioLowerVolume" =
- exec "${volumectl} set-sink-volume @DEFAULT_SINK@ -5%";
+ "XF86AudioRaiseVolume" = exec "${volumectl} set-sink-volume @DEFAULT_SINK@ +5%";
+ "XF86AudioLowerVolume" = exec "${volumectl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec ${volumectl} set-sink-mute @DEFAULT_SINK@ toggle";
- "Shift+XF86AudioRaiseVolume" =
- exec "${volumectl} set-source-volume @DEFAULT_SOURCE@ +5%";
- "Shift+XF86AudioLowerVolume" =
- exec "${volumectl} set-source-volume @DEFAULT_SOURCE@ -5%";
- "XF86AudioMicMute" =
- exec "${volumectl} set-source-mute @DEFAULT_SOURCE@ toggle";
+ "Shift+XF86AudioRaiseVolume" = exec "${volumectl} set-source-volume @DEFAULT_SOURCE@ +5%";
+ "Shift+XF86AudioLowerVolume" = exec "${volumectl} set-source-volume @DEFAULT_SOURCE@ -5%";
+ "XF86AudioMicMute" = exec "${volumectl} set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86KbdBrightnessUp" = ''
exec {brightnessctlKbd} set \
$(( $(${brightnessctlKbd} max) - $(${brightnessctlKbd} get) ))
'';
"Print" = exec screenshot;
- });
+ }
+ );
};
}
diff --git a/modules/home-manager/personal/gui/x/i3/startup.nix b/modules/home-manager/personal/gui/x/i3/startup.nix
index c42a542..223660a 100644
--- a/modules/home-manager/personal/gui/x/i3/startup.nix
+++ b/modules/home-manager/personal/gui/x/i3/startup.nix
@@ -2,24 +2,27 @@
config,
lib,
...
-}: {
- xsession.windowManager.i3.config.startup = let
- autostart = {
- command,
- always ? false,
- notification ? false,
- }: {
- inherit command always notification;
- };
- autostartIf = cond: args: lib.optional cond (autostart args);
- in
+}:
+{
+ xsession.windowManager.i3.config.startup =
+ let
+ autostart =
+ {
+ command,
+ always ? false,
+ notification ? false,
+ }:
+ {
+ inherit command always notification;
+ };
+ autostartIf = cond: args: lib.optional cond (autostart args);
+ in
[
- (autostart {command = "rfkill block bluetooth";})
- (autostart {command = "keepassxc";})
+ (autostart { command = "rfkill block bluetooth"; })
+ (autostart { command = "keepassxc"; })
]
- ++ autostartIf config.programs.thunderbird.enable {command = "thunderbird";}
- ++ autostartIf
- (config.personal.profiles.social && config.personal.identities.personal) {
+ ++ autostartIf config.programs.thunderbird.enable { command = "thunderbird"; }
+ ++ autostartIf (config.personal.profiles.social && config.personal.identities.personal) {
command = "signal-desktop";
}
++ autostartIf (with config.personal.identities; work && !personal) {
diff --git a/modules/home-manager/personal/gui/x/idlehook.nix b/modules/home-manager/personal/gui/x/idlehook.nix
index 129a9f8..9915a3c 100644
--- a/modules/home-manager/personal/gui/x/idlehook.nix
+++ b/modules/home-manager/personal/gui/x/idlehook.nix
@@ -1,8 +1,14 @@
-{ config, lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
let
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
-in {
+in
+{
config.services.xidlehook = {
enable = lib.mkDefault config.personal.x.enable;
not-when-fullscreen = lib.mkDefault true;
diff --git a/modules/home-manager/personal/identities.nix b/modules/home-manager/personal/identities.nix
index e8007d8..23f3ac1 100644
--- a/modules/home-manager/personal/identities.nix
+++ b/modules/home-manager/personal/identities.nix
@@ -3,10 +3,12 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.identities;
mkEnableIdentityOption = name: lib.mkEnableOption "${name} identity";
-in {
+in
+{
options.personal.identities = {
personal = mkEnableIdentityOption "personal";
work = mkEnableIdentityOption "work";
@@ -14,95 +16,107 @@ in {
config = lib.mkMerge [
{
- accounts.email.accounts = let
- gpg = {
- key = "DFC1660846EEA97C059F18534EF515441E635D36";
- signByDefault = true;
- };
- thunderbirdSettings = id: {
- "mail.identity.id_${id}.fcc_folder_picker_mode" = 1;
- };
- in {
- personal = lib.mkIf cfg.personal {
- inherit gpg;
- address = "quentin@aristote.fr";
- userName = "quentin@aristote.fr";
- realName = "Quentin Aristote";
- folders = {
- drafts = "INBOX/Brouillons";
- inbox = "INBOX";
- sent = "INBOX/Envoyés";
- trash = "INBOX/Corbeille";
+ accounts.email.accounts =
+ let
+ gpg = {
+ key = "DFC1660846EEA97C059F18534EF515441E635D36";
+ signByDefault = true;
};
- imap = {
- host = "ssl0.ovh.net";
- port = 993;
+ thunderbirdSettings = id: {
+ "mail.identity.id_${id}.fcc_folder_picker_mode" = 1;
};
- smtp = {
- host = "ssl0.ovh.net";
- port = 465;
+ in
+ {
+ personal = lib.mkIf cfg.personal {
+ inherit gpg;
+ address = "quentin@aristote.fr";
+ userName = "quentin@aristote.fr";
+ realName = "Quentin Aristote";
+ folders = {
+ drafts = "INBOX/Brouillons";
+ inbox = "INBOX";
+ sent = "INBOX/Envoyés";
+ trash = "INBOX/Corbeille";
+ };
+ imap = {
+ host = "ssl0.ovh.net";
+ port = 993;
+ };
+ smtp = {
+ host = "ssl0.ovh.net";
+ port = 465;
+ };
+ thunderbird = {
+ enable = true;
+ profiles = [ "default" ];
+ settings =
+ id:
+ thunderbirdSettings id
+ // {
+ "mail.identity.id_${id}.draft_folder" =
+ "imap://quentin%40aristote.fr@ssl0.ovh.net/INBOX/Brouillons";
+ "mail.identity.id_${id}.fcc_folder" = "imap://quentin%40aristote.fr@ssl0.ovh.net/INBOX/Envoy&AOk-s";
+ "mail.identity.id_${id}.archive_folder" = "imap://quentin%40aristote.fr@ssl0.ovh.net/INBOX/Archive";
+ "mail.server.server_${id}.trash_folder_name" = "INBOX/Corbeille";
+ };
+ };
};
- thunderbird = {
- enable = true;
- profiles = ["default"];
- settings = id:
- thunderbirdSettings id
- // {
- "mail.identity.id_${id}.draft_folder" = "imap://quentin%40aristote.fr@ssl0.ovh.net/INBOX/Brouillons";
- "mail.identity.id_${id}.fcc_folder" = "imap://quentin%40aristote.fr@ssl0.ovh.net/INBOX/Envoy&AOk-s";
- "mail.identity.id_${id}.archive_folder" = "imap://quentin%40aristote.fr@ssl0.ovh.net/INBOX/Archive";
- "mail.server.server_${id}.trash_folder_name" = "INBOX/Corbeille";
- };
+ work = lib.mkIf cfg.work {
+ inherit gpg;
+ address = "quentin.aristote@irif.fr";
+ userName = "aristote";
+ realName = "Quentin Aristote";
+ aliases = [ "aristote@irif.fr" ];
+ folders = {
+ drafts = "Drafts";
+ inbox = "Inbox";
+ sent = "Sent";
+ trash = "Trash";
+ };
+ imap = {
+ host = "imap.irif.fr";
+ port = 993;
+ };
+ smtp = {
+ host = "smtp.irif.fr";
+ port = 465;
+ };
+ thunderbird = {
+ enable = true;
+ profiles = [ "default" ];
+ settings =
+ id:
+ thunderbirdSettings id
+ // {
+ "mail.identity.id_${id}.archive_folder" = "imap://aristote@imap.irif.fr/Archive";
+ "mail.server.server_${id}.trash_folder_name" = "Trash";
+ };
+ };
};
};
- work = lib.mkIf cfg.work {
- inherit gpg;
- address = "quentin.aristote@irif.fr";
- userName = "aristote";
- realName = "Quentin Aristote";
- aliases = ["aristote@irif.fr"];
- folders = {
- drafts = "Drafts";
- inbox = "Inbox";
- sent = "Sent";
- trash = "Trash";
- };
- imap = {
- host = "imap.irif.fr";
- port = 993;
- };
- smtp = {
- host = "smtp.irif.fr";
- port = 465;
- };
- thunderbird = {
- enable = true;
- profiles = ["default"];
- settings = id:
- thunderbirdSettings id
- // {
- "mail.identity.id_${id}.archive_folder" = "imap://aristote@imap.irif.fr/Archive";
- "mail.server.server_${id}.trash_folder_name" = "Trash";
- };
- };
- };
- };
}
(lib.mkIf cfg.work {
home = {
- packages = with pkgs; [zotero evince] ++ lib.optional (!cfg.personal) zulip;
- file.".latexmkrc".source =
- lib.mkDefault config.personal.home.dotfiles.latexmkrc;
+ packages =
+ with pkgs;
+ [
+ zotero
+ evince
+ ]
+ ++ lib.optional (!cfg.personal) zulip;
+ file.".latexmkrc".source = lib.mkDefault config.personal.home.dotfiles.latexmkrc;
};
- xdg.mimeApps.defaultApplications."application/pdf" = ["org.gnome.Evince.desktop"];
- programs.firefox.profiles = let
- addFloccus = {
- extensions.packages = [pkgs.personal.firefoxAddons.floccus];
+ xdg.mimeApps.defaultApplications."application/pdf" = [ "org.gnome.Evince.desktop" ];
+ programs.firefox.profiles =
+ let
+ addFloccus = {
+ extensions.packages = [ pkgs.personal.firefoxAddons.floccus ];
+ };
+ in
+ {
+ default = addFloccus;
+ videoconferencing = addFloccus;
};
- in {
- default = addFloccus;
- videoconferencing = addFloccus;
- };
})
];
}
diff --git a/modules/home-manager/personal/profiles.nix b/modules/home-manager/personal/profiles.nix
index baf9219..48491ad 100644
--- a/modules/home-manager/personal/profiles.nix
+++ b/modules/home-manager/personal/profiles.nix
@@ -3,10 +3,12 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.profiles;
mkEnableProfileOption = name: lib.mkEnableOption "${name} profile";
-in {
+in
+{
options.personal.profiles = {
dev = mkEnableProfileOption "development";
social = mkEnableProfileOption "social";
@@ -16,7 +18,7 @@ in {
config = lib.mkMerge [
(lib.mkIf cfg.dev {
- home.packages = with pkgs; [python3];
+ home.packages = with pkgs; [ python3 ];
programs = {
alacritty.enable = lib.mkDefault config.personal.gui.enable;
direnv.enable = lib.mkDefault true;
@@ -25,14 +27,16 @@ in {
};
personal.programs.devenv.enable = true;
- home.file.".config/latexmkrc".text =
- builtins.readFile config.personal.home.dotfiles.latexmkrc;
+ home.file.".config/latexmkrc".text = builtins.readFile config.personal.home.dotfiles.latexmkrc;
services.gpg-agent.enableSshSupport = true;
})
(lib.mkIf cfg.multimedia {
- home.packages = with pkgs; [transmission_4-gtk vlc];
+ home.packages = with pkgs; [
+ transmission_4-gtk
+ vlc
+ ];
personal = {
gui.enable = lib.mkForce true;
firefox.webapps = [
@@ -42,7 +46,11 @@ in {
icon = "${pkgs.personal.static.icons.netflix}";
comment = "Unlimited movies, TV shows, and more.";
url = "https://www.netflix.com/fr-en/login";
- categories = ["AudioVideo" "Video" "Player"];
+ categories = [
+ "AudioVideo"
+ "Video"
+ "Player"
+ ];
}
{
name = "MUBI";
@@ -50,7 +58,11 @@ in {
icon = "${pkgs.personal.static.icons.mubi}";
comment = "Watch hand-picked cinema.";
url = "https://mubi.com";
- categories = ["AudioVideo" "Video" "Player"];
+ categories = [
+ "AudioVideo"
+ "Video"
+ "Player"
+ ];
}
{
name = "Deezer";
@@ -58,17 +70,23 @@ in {
icon = "${pkgs.personal.static.icons.deezer}";
comment = "Listen to music online";
url = "https://deezer.com/login";
- categories = ["AudioVideo" "Audio" "Player" "Music"];
+ categories = [
+ "AudioVideo"
+ "Audio"
+ "Player"
+ "Music"
+ ];
}
];
};
})
(lib.mkIf cfg.social {
- home.packages = with pkgs;
- lib.optionals
- (config.personal.gui.enable && config.personal.identities.personal)
- [signal-desktop-bin];
+ home.packages =
+ with pkgs;
+ lib.optionals (config.personal.gui.enable && config.personal.identities.personal) [
+ signal-desktop-bin
+ ];
programs.thunderbird.enable = lib.mkDefault config.personal.gui.enable;
programs.gpg.enable = true;
services.gpg-agent.enable = true;
diff --git a/modules/home-manager/personal/programs/alacritty.nix b/modules/home-manager/personal/programs/alacritty.nix
index 94193e8..201fe29 100644
--- a/modules/home-manager/personal/programs/alacritty.nix
+++ b/modules/home-manager/personal/programs/alacritty.nix
@@ -2,20 +2,19 @@
{
programs.alacritty.settings = {
- window = {
- padding = {
- x = 10;
- y = 10;
- };
- dimensions = {
- lines = 75;
- columns = 100;
- };
+ window = {
+ padding = {
+ x = 10;
+ y = 10;
};
+ dimensions = {
+ lines = 75;
+ columns = 100;
+ };
+ };
- font = lib.mkForce { size = 8.0; };
+ font = lib.mkForce { size = 8.0; };
};
xsession.windowManager.i3.config.terminal = lib.mkIf config.programs.alacritty.enable "alacritty";
}
-
diff --git a/modules/home-manager/personal/programs/devenv.nix b/modules/home-manager/personal/programs/devenv.nix
index b41d0cb..dbe5aab 100644
--- a/modules/home-manager/personal/programs/devenv.nix
+++ b/modules/home-manager/personal/programs/devenv.nix
@@ -3,10 +3,12 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.programs.devenv;
- importedDevenv = pkgs ? devenv; #
-in {
+ importedDevenv = pkgs ? devenv;
+in
+{
options.personal.programs.devenv.enable = lib.mkEnableOption "devenv";
config = lib.mkIf cfg.enable {
diff --git a/modules/home-manager/personal/programs/direnv.nix b/modules/home-manager/personal/programs/direnv.nix
index fe1662d..1cb4ea9 100644
--- a/modules/home-manager/personal/programs/direnv.nix
+++ b/modules/home-manager/personal/programs/direnv.nix
@@ -3,17 +3,18 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.programs.direnv;
-in {
+in
+{
programs.direnv.nix-direnv.enable = true;
- systemd.user =
- lib.mkIf cfg.enable
- (pkgs.personal.lib.homeManager.serviceWithTimer "direnv-clean-update" {
+ systemd.user = lib.mkIf cfg.enable (
+ pkgs.personal.lib.homeManager.serviceWithTimer "direnv-clean-update" {
Unit = {
Description = "Remove old virtual environments and update the current ones";
- After = ["network-online.target"];
+ After = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
@@ -30,6 +31,9 @@ in {
Persistent = true;
OnCalendar = "daily";
};
- Install = {WantedBy = ["default.target "];};
- });
+ Install = {
+ WantedBy = [ "default.target " ];
+ };
+ }
+ );
}
diff --git a/modules/home-manager/personal/programs/emacs.nix b/modules/home-manager/personal/programs/emacs.nix
index da0c07f..da30cd2 100644
--- a/modules/home-manager/personal/programs/emacs.nix
+++ b/modules/home-manager/personal/programs/emacs.nix
@@ -1,12 +1,21 @@
-{ config, lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
let
cfg = config.programs.emacs;
- spacemacs-update-script = pkgs.callPackage ({ emacs, git }:
+ spacemacs-update-script = pkgs.callPackage (
+ { emacs, git }:
pkgs.writeShellApplication {
name = "spacemacs-update";
- runtimeInputs = [ emacs git ];
+ runtimeInputs = [
+ emacs
+ git
+ ];
text = ''
git checkout develop
@@ -18,40 +27,57 @@ let
(configuration-layer/update-packages "no-confirmation")
(spacemacs/kill-emacs))'
'';
- }) { emacs = cfg.package; };
-in {
+ }
+ ) { emacs = cfg.package; };
+in
+{
config = lib.mkIf cfg.enable {
services.emacs = {
enable = lib.mkDefault true;
client.enable = lib.mkDefault true;
startWithUserSession = lib.mkDefault true;
- package = let emacs = config.programs.emacs.finalPackage; in
- pkgs.runCommand "emacsWrapped" {
- nativeBuildInputs = with pkgs; [ makeWrapper ];
- } ''
- mkdir "$out"
- ln -s ${emacs}/share "$out"
- for binary in ${emacs}/bin/*
- do
- makeWrapper "$binary" "$out"/bin/$(basename "$binary")\
- --prefix PATH : ${lib.makeBinPath (with pkgs; [ gnutar gcc ])}
- done
+ package =
+ let
+ emacs = config.programs.emacs.finalPackage;
+ in
+ pkgs.runCommand "emacsWrapped"
+ {
+ nativeBuildInputs = with pkgs; [ makeWrapper ];
+ }
+ ''
+ mkdir "$out"
+ ln -s ${emacs}/share "$out"
+ for binary in ${emacs}/bin/*
+ do
+ makeWrapper "$binary" "$out"/bin/$(basename "$binary")\
+ --prefix PATH : ${
+ lib.makeBinPath (
+ with pkgs;
+ [
+ gnutar
+ gcc
+ ]
+ )
+ }
+ done
'';
};
home.sessionVariables.EDITOR = "emacsclient --tty";
home.shellAliases.editor = "emacsclient --create-frame";
# spacemacs dotfile
- home.file.".spacemacs.d/init.el".source =
- lib.mkDefault config.personal.home.dotfiles.spacemacs;
+ home.file.".spacemacs.d/init.el".source = lib.mkDefault config.personal.home.dotfiles.spacemacs;
# service to update spacemacs
- systemd.user =
- (pkgs.personal.lib.homeManager.serviceWithTimer "spacemacs-update" {
+ systemd.user = (
+ pkgs.personal.lib.homeManager.serviceWithTimer "spacemacs-update" {
Unit = {
Description = "Update Spacemacs by pulling the develop branch";
- After = [ "network-online.target" "emacs.service" ];
+ After = [
+ "network-online.target"
+ "emacs.service"
+ ];
};
Service = {
Type = "oneshot";
@@ -62,7 +88,10 @@ in {
Persistent = true;
OnCalendar = "daily";
};
- Install = { WantedBy = [ "default.target" ]; };
- });
+ Install = {
+ WantedBy = [ "default.target" ];
+ };
+ }
+ );
};
}
diff --git a/modules/home-manager/personal/programs/firefox/default.nix b/modules/home-manager/personal/programs/firefox/default.nix
index d103c3d..3f1963d 100644
--- a/modules/home-manager/personal/programs/firefox/default.nix
+++ b/modules/home-manager/personal/programs/firefox/default.nix
@@ -4,178 +4,221 @@
pkgs,
...
}:
-with lib; let
+with lib;
+let
cfg = config.personal.firefox;
userjs = pkgs.callPackage ./userjs.nix {
inherit (pkgs.personal.static.userjs) arkenfox;
inherit (pkgs.lib.personal) toUserJS;
};
- engines = import ./engines.nix {inherit lib pkgs;};
+ engines = import ./engines.nix { inherit lib pkgs; };
webappsWithIds =
- (builtins.foldl' ({
- counter,
- value,
- }: {name, ...} @ next: {
- counter = counter + 1;
- value =
- value
- ++ [
- (next
+ (builtins.foldl'
+ (
+ {
+ counter,
+ value,
+ }:
+ { name, ... }@next:
+ {
+ counter = counter + 1;
+ value = value ++ [
+ (
+ next
// {
id = counter;
profileName = lib.toLower name;
- })
+ }
+ )
];
- }) {
+ }
+ )
+ {
counter = 0;
- value = [];
+ value = [ ];
}
- cfg.webapps)
- .value;
-in {
+ cfg.webapps
+ ).value;
+in
+{
options.personal.firefox = {
webapps = lib.mkOption {
- type = with lib.types;
+ type =
+ with lib.types;
listOf (submodule {
- options = let
- mkTypedOption = type: lib.mkOption {inherit type;};
- in {
- name = mkTypedOption str;
- genericName = mkTypedOption str // {default = "";};
- url = mkTypedOption str;
- comment = mkTypedOption str // {default = "";};
- extraUserJS = mkTypedOption lines // {default = "";};
- categories = mkTypedOption (listOf str) // {default = [];};
- icon = mkTypedOption path;
- };
+ options =
+ let
+ mkTypedOption = type: lib.mkOption { inherit type; };
+ in
+ {
+ name = mkTypedOption str;
+ genericName = mkTypedOption str // {
+ default = "";
+ };
+ url = mkTypedOption str;
+ comment = mkTypedOption str // {
+ default = "";
+ };
+ extraUserJS = mkTypedOption lines // {
+ default = "";
+ };
+ categories = mkTypedOption (listOf str) // {
+ default = [ ];
+ };
+ icon = mkTypedOption path;
+ };
});
- default = [];
+ default = [ ];
};
};
config = lib.mkMerge [
{
programs.firefox.profiles =
- builtins.foldl' (prev: {
- id,
- profileName,
- extraUserJS,
- ...
- }:
- prev
- // {
- "${profileName}" = {
- id = id + 2;
+ builtins.foldl'
+ (
+ prev:
+ {
+ id,
+ profileName,
+ extraUserJS,
+ ...
+ }:
+ prev
+ // {
+ "${profileName}" = {
+ id = id + 2;
+ extensions.packages = with pkgs.personal.firefoxAddons; [
+ clearurls
+ neat-url
+ redirector
+ smart-referer
+ ublock-origin
+ unpaywall
+ url-in-title
+ ];
+ search = {
+ force = true;
+ engines = with engines; disableDefault // { inherit Searx; };
+ default = "Searx";
+ privateDefault = "Searx";
+ };
+ extraConfig = userjs.streaming + extraUserJS;
+ };
+ }
+ )
+ {
+ default = {
+ id = 0; # isDefault = true
+
extensions.packages = with pkgs.personal.firefoxAddons; [
+ canvasblocker
clearurls
+ darkreader
neat-url
redirector
smart-referer
+ temporary-containers
+ tree-style-tab
ublock-origin
unpaywall
url-in-title
];
search = {
- force = true;
- engines = with engines; disableDefault // {inherit Searx;};
+ force = lib.mkDefault true;
+ engines =
+ with engines;
+ disableDefault
+ // {
+ inherit Searx;
+ }
+ // lib.optionalAttrs config.personal.identities.personal personal
+ // lib.optionalAttrs config.personal.identities.work work
+ // lib.optionalAttrs config.personal.profiles.dev dev;
default = "Searx";
- privateDefault = "Searx";
+ order = [
+ "Searx"
+ "Wikipedia"
+ ];
};
- extraConfig = userjs.streaming + extraUserJS;
+ extraConfig = userjs.default;
+ userChrome = ./userchrome/treestyletabs-outer.css;
};
- }) {
- default = {
- id = 0; # isDefault = true
- extensions.packages = with pkgs.personal.firefoxAddons; [
- canvasblocker
- clearurls
- darkreader
- neat-url
- redirector
- smart-referer
- temporary-containers
- tree-style-tab
- ublock-origin
- unpaywall
- url-in-title
- ];
- search = {
- force = lib.mkDefault true;
- engines = with engines;
- disableDefault
- // {
- inherit Searx;
- }
- // lib.optionalAttrs config.personal.identities.personal
- personal
- // lib.optionalAttrs config.personal.identities.work work
- // lib.optionalAttrs config.personal.profiles.dev dev;
- default = "Searx";
- order = ["Searx" "Wikipedia"];
- };
- extraConfig = userjs.default;
- userChrome = ./userchrome/treestyletabs-outer.css;
- };
-
- videoconferencing = {
- id = 1;
- extensions.packages = with pkgs.personal.firefoxAddons; [
- clearurls
- darkreader
- neat-url
- redirector
- smart-referer
- multi-account-containers
- tree-style-tab
- ublock-origin
- unpaywall
- url-in-title
- ];
- search = {
- force = true;
- engines = with engines; disableDefault // {inherit Searx;};
- default = "Searx";
+ videoconferencing = {
+ id = 1;
+ extensions.packages = with pkgs.personal.firefoxAddons; [
+ clearurls
+ darkreader
+ neat-url
+ redirector
+ smart-referer
+ multi-account-containers
+ tree-style-tab
+ ublock-origin
+ unpaywall
+ url-in-title
+ ];
+ search = {
+ force = true;
+ engines = with engines; disableDefault // { inherit Searx; };
+ default = "Searx";
+ };
+ extraConfig = userjs.videoconferencing;
+ userChrome = ./userchrome/treestyletabs-outer.css;
};
- extraConfig = userjs.videoconferencing;
- userChrome = ./userchrome/treestyletabs-outer.css;
- };
- }
- webappsWithIds;
+ }
+ webappsWithIds;
}
(lib.mkIf config.programs.firefox.enable {
- xdg.desktopEntries = let
- firefoxProfilesDir = "${config.home.homeDirectory}/.mozilla/firefox";
- firefoxInProfile = profile: ''
- ${config.programs.firefox.package}/bin/firefox --profile "${firefoxProfilesDir}/${profile}"'';
- in
- builtins.foldl' (prev: {
- name,
- profileName,
- url,
- genericName,
- icon,
- comment,
- categories,
- ...
- }:
- prev
- // {
- "${profileName}" = {
- inherit name genericName icon comment categories;
- exec = "${firefoxInProfile profileName} ${url}";
+ xdg.desktopEntries =
+ let
+ firefoxProfilesDir = "${config.home.homeDirectory}/.mozilla/firefox";
+ firefoxInProfile =
+ profile:
+ ''${config.programs.firefox.package}/bin/firefox --profile "${firefoxProfilesDir}/${profile}"'';
+ in
+ builtins.foldl'
+ (
+ prev:
+ {
+ name,
+ profileName,
+ url,
+ genericName,
+ icon,
+ comment,
+ categories,
+ ...
+ }:
+ prev
+ // {
+ "${profileName}" = {
+ inherit
+ name
+ genericName
+ icon
+ comment
+ categories
+ ;
+ exec = "${firefoxInProfile profileName} ${url}";
+ };
+ }
+ )
+ {
+ videoconferences = {
+ name = "Video Conferences";
+ genericName = "Video conference";
+ comment = "Use video conferencing software in a browser.";
+ exec = "${firefoxInProfile "videoconferencing"}";
+ categories = [
+ "Network"
+ "VideoConference"
+ ];
};
- }) {
- videoconferences = {
- name = "Video Conferences";
- genericName = "Video conference";
- comment = "Use video conferencing software in a browser.";
- exec = "${firefoxInProfile "videoconferencing"}";
- categories = ["Network" "VideoConference"];
- };
- }
- webappsWithIds;
+ }
+ webappsWithIds;
home.shellAliases.fftmp = "firefox --profile $(mktemp -d)";
home.sessionVariables.BROWSER = "firefox";
diff --git a/modules/home-manager/personal/programs/firefox/engines.nix b/modules/home-manager/personal/programs/firefox/engines.nix
index cc6a318..ddd5f3b 100644
--- a/modules/home-manager/personal/programs/firefox/engines.nix
+++ b/modules/home-manager/personal/programs/firefox/engines.nix
@@ -1,44 +1,67 @@
{
lib,
pkgs,
-}: let
+}:
+let
everyday = 24 * 60 * 60 * 1000;
searchTerms = "{searchTerms}";
nixosIcon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
self = {
- disable = engines: lib.genAttrs engines (_: {metaData.hidden = true;});
- disableDefault = self.disable ["google" "Amazon.fr" "bing"];
+ disable =
+ engines:
+ lib.genAttrs engines (_: {
+ metaData.hidden = true;
+ });
+ disableDefault = self.disable [
+ "google"
+ "Amazon.fr"
+ "bing"
+ ];
nix = {
- inherit (self) "Home Manager Options" "NixOS Options" "NixOS Wiki" "Nix Packages";
+ inherit (self)
+ "Home Manager Options"
+ "NixOS Options"
+ "NixOS Wiki"
+ "Nix Packages"
+ ;
};
- dev = self.nix // {inherit (self) AlternativeTo Phind;};
- personal = {inherit (self) Emojipedia;};
- work = {inherit (self) nLab;};
- all = self.dev // self.personal // self.work // {inherit (self) Searx;};
+ dev = self.nix // {
+ inherit (self) AlternativeTo Phind;
+ };
+ personal = { inherit (self) Emojipedia; };
+ work = { inherit (self) nLab; };
+ all = self.dev // self.personal // self.work // { inherit (self) Searx; };
Emojipedia = {
urls = [
{
template = "https://emojipedia.org/search/";
- params = [(lib.nameValuePair "q" searchTerms)];
+ params = [ (lib.nameValuePair "q" searchTerms) ];
}
];
icon = "https://emojipedia.org/static/img/favicons/favicon-16x16.png";
updateInterval = everyday;
- definedAliases = ["@emojipedia" "@emoji" "@em"];
+ definedAliases = [
+ "@emojipedia"
+ "@emoji"
+ "@em"
+ ];
};
AlternativeTo = {
urls = [
{
template = "https://alternativeto.net/browse/search/";
- params = [(lib.nameValuePair "q" searchTerms)];
+ params = [ (lib.nameValuePair "q" searchTerms) ];
}
];
icon = "https://alternativeto.net/static/icons/a2/favicon-16x16.png";
updateInterval = everyday;
- definedAliases = ["@alternativeto" "@a2"];
+ definedAliases = [
+ "@alternativeto"
+ "@a2"
+ ];
};
"Home Manager Options" = {
@@ -48,7 +71,10 @@
}
];
icon = nixosIcon;
- definedAliases = ["@homemanager" "@hm"];
+ definedAliases = [
+ "@homemanager"
+ "@hm"
+ ];
};
"NixOS Options" = {
@@ -62,18 +88,24 @@
}
];
icon = nixosIcon;
- definedAliases = ["@nixos" "@no"];
+ definedAliases = [
+ "@nixos"
+ "@no"
+ ];
};
"NixOS Wiki" = {
urls = [
{
template = "https://wiki.nixos.org/w/index.php";
- params = [(lib.nameValuePair "search" searchTerms)];
+ params = [ (lib.nameValuePair "search" searchTerms) ];
}
];
icon = nixosIcon;
- definedAliases = ["@nixoswiki" "@nw"];
+ definedAliases = [
+ "@nixoswiki"
+ "@nw"
+ ];
};
"Nix Packages" = {
@@ -87,26 +119,32 @@
}
];
icon = nixosIcon;
- definedAliases = ["@nixpkgs" "@np"];
+ definedAliases = [
+ "@nixpkgs"
+ "@np"
+ ];
};
nLab = {
urls = [
{
template = "https://ncatlab.org/nlab/search";
- params = [(lib.nameValuePair "query" searchTerms)];
+ params = [ (lib.nameValuePair "query" searchTerms) ];
}
];
icon = "https://ncatlab.org/favicon.ico";
updateInterval = everyday;
- definedAliases = ["@ncatlab" "@nlab"];
+ definedAliases = [
+ "@ncatlab"
+ "@nlab"
+ ];
};
Searx = {
urls = [
{
template = "https://searx.aristote.fr/search";
- params = [(lib.nameValuePair "q" searchTerms)];
+ params = [ (lib.nameValuePair "q" searchTerms) ];
}
];
icon = "https://searx.aristote.fr/static/themes/simple/img/favicon.svg";
@@ -117,13 +155,16 @@
urls = [
{
template = "https://phind.com/search";
- params = [(lib.nameValuePair "q" searchTerms)];
+ params = [ (lib.nameValuePair "q" searchTerms) ];
}
];
icon = "https://www.phind.com/images/favicon.png";
updateInterval = everyday;
- definedAliases = ["@phind" "@ph"];
+ definedAliases = [
+ "@phind"
+ "@ph"
+ ];
};
};
in
- self
+self
diff --git a/modules/home-manager/personal/programs/firefox/userjs.nix b/modules/home-manager/personal/programs/firefox/userjs.nix
index 8c17fa6..3f2b6bd 100644
--- a/modules/home-manager/personal/programs/firefox/userjs.nix
+++ b/modules/home-manager/personal/programs/firefox/userjs.nix
@@ -1,7 +1,8 @@
{
arkenfox,
toUserJS,
-}: let
+}:
+let
self = {
arkenfox = builtins.readFile "${arkenfox}";
default =
@@ -14,8 +15,8 @@
"dom.allow_cut_copy" = true; # 2404
"dom.battery.enabled" = false; # 2502
"permissions.default.xr" = 2; # 2521
- "browser.search.separatePrivateDefault" = false; #0830
- "browser.search.separatePrivateDefault.ui.enabled" = false; #0830
+ "browser.search.separatePrivateDefault" = false; # 0830
+ "browser.search.separatePrivateDefault.ui.enabled" = false; # 0830
# Personal
## Warnings
@@ -57,12 +58,10 @@
"media.peerconnection.enabled" = true;
"media.peerconnection.ice.no_host" = false; # may or may not be required
"webgl.min_capability_mode" = true;
- "media.autoplay.blocking_policy" =
- 0; # optional (otherwise add site exceptions)
- "javascript.options.wasm" =
- true; # optional (some platforms may require this)
+ "media.autoplay.blocking_policy" = 0; # optional (otherwise add site exceptions)
+ "javascript.options.wasm" = true; # optional (some platforms may require this)
"dom.webaudio.enabled" = true;
};
};
in
- self
+self
diff --git a/modules/home-manager/personal/programs/git.nix b/modules/home-manager/personal/programs/git.nix
index 56078a8..488295e 100644
--- a/modules/home-manager/personal/programs/git.nix
+++ b/modules/home-manager/personal/programs/git.nix
@@ -3,19 +3,23 @@
lib,
pkgs,
...
-} @ extraArgs: let
- primaryEmail = let
- primaryEmailList =
- builtins.filter (account: account.primary)
- (lib.attrValues config.accounts.email.accounts);
- in
- if primaryEmailList == []
- then {
- userName = lib.mkDefault "Quentin Aristote";
- address = lib.mkDefault "quentin@aristote.fr";
- }
- else builtins.head primaryEmailList;
-in {
+}@extraArgs:
+let
+ primaryEmail =
+ let
+ primaryEmailList = builtins.filter (account: account.primary) (
+ lib.attrValues config.accounts.email.accounts
+ );
+ in
+ if primaryEmailList == [ ] then
+ {
+ userName = lib.mkDefault "Quentin Aristote";
+ address = lib.mkDefault "quentin@aristote.fr";
+ }
+ else
+ builtins.head primaryEmailList;
+in
+{
programs.git = {
userName = primaryEmail.userName;
userEmail = primaryEmail.address;
@@ -23,30 +27,35 @@ in {
inherit (primaryEmail.gpg) key signByDefault;
};
- ignores =
- [
- (builtins.readFile
- (pkgs.personal.static.gitignore.override {templates = ["Emacs" "Linux"];}))
- ]
- ++ [
- # Personal rules
- ''
- # direnv
- .direnv
- .envrc
+ ignores = [
+ (builtins.readFile (
+ pkgs.personal.static.gitignore.override {
+ templates = [
+ "Emacs"
+ "Linux"
+ ];
+ }
+ ))
+ ]
+ ++ [
+ # Personal rules
+ ''
+ # direnv
+ .direnv
+ .envrc
- # devenv
- .devenv.flake.nix
- .devenv/
- devenv.local.nix
+ # devenv
+ .devenv.flake.nix
+ .devenv/
+ devenv.local.nix
- # Nix
- shell.nix
- .nix-gc-roots
- .tmp
- result
- ''
- ];
+ # Nix
+ shell.nix
+ .nix-gc-roots
+ .tmp
+ result
+ ''
+ ];
extraConfig = {
safe.directory = lib.mkIf (extraArgs ? osConfig) (
@@ -55,7 +64,7 @@ in {
flakeIsValid = flake != null && lib.hasPrefix "git+file://" flake;
flakePath = lib.removePrefix "git+file://" flake;
in
- lib.optional flakeIsValid flakePath
+ lib.optional flakeIsValid flakePath
);
init.defaultBranch = "master";
pull.rebase = true;
diff --git a/modules/home-manager/personal/programs/rofi.nix b/modules/home-manager/personal/programs/rofi.nix
index a3fdad3..10c284c 100644
--- a/modules/home-manager/personal/programs/rofi.nix
+++ b/modules/home-manager/personal/programs/rofi.nix
@@ -3,19 +3,23 @@
lib,
pkgs,
...
-}: {
+}:
+{
programs.rofi = {
cycle = lib.mkDefault true;
- theme =
- lib.mkIf (config.lib ? stylix)
- (
- lib.mkForce
- (config.lib.stylix.colors {
+ theme = lib.mkIf (config.lib ? stylix) (
+ lib.mkForce (
+ config.lib.stylix.colors {
template = builtins.readFile config.personal.home.dotfiles.rofi;
extension = ".rasi";
- })
- );
- plugins = with pkgs; [rofi-top rofi-calc rofi-emoji];
+ }
+ )
+ );
+ plugins = with pkgs; [
+ rofi-top
+ rofi-calc
+ rofi-emoji
+ ];
};
xdg.dataFile."rofi/themes/custom.rasi" = lib.mkForce {
source = config.programs.rofi.theme;
diff --git a/modules/home-manager/personal/programs/thunderbird.nix b/modules/home-manager/personal/programs/thunderbird.nix
index c904dd5..d68a5df 100644
--- a/modules/home-manager/personal/programs/thunderbird.nix
+++ b/modules/home-manager/personal/programs/thunderbird.nix
@@ -3,7 +3,8 @@
lib,
pkgs,
...
-}: let
+}:
+let
configDefault =
builtins.readFile "${pkgs.personal.static.userjs.thunderbird}"
+ pkgs.lib.personal.toUserJS {
@@ -37,7 +38,8 @@
## Spam
"mail.spam.manualMark" = true; # move manually marked-as-junk to junk folder
};
-in {
+in
+{
config = lib.mkMerge [
{
programs.thunderbird = {
@@ -50,8 +52,8 @@ in {
(lib.mkIf config.programs.thunderbird.enable {
home.file.".thunderbird/default/user.js".text = configDefault;
xdg.mimeApps.defaultApplications = {
- "x-scheme-handler/mailto" = ["thunderbird.desktop"];
- "application/x-xpinstall" = ["thunderbird.desktop"];
+ "x-scheme-handler/mailto" = [ "thunderbird.desktop" ];
+ "application/x-xpinstall" = [ "thunderbird.desktop" ];
};
})
];
diff --git a/modules/home-manager/wallpaper.nix b/modules/home-manager/wallpaper.nix
index 2a8bdae..d4c162d 100644
--- a/modules/home-manager/wallpaper.nix
+++ b/modules/home-manager/wallpaper.nix
@@ -1,14 +1,15 @@
{ config, lib, ... }@extraArgs:
-let wallpaper = config.personal.home.wallpaper;
-in {
+let
+ wallpaper = config.personal.home.wallpaper;
+in
+{
options.personal.home.wallpaper = lib.mkOption {
type = with lib.types; nullOr path;
default = extraArgs.osConfig.stylix.image or null;
description = ''
Path to the desktop wallpaper.
'';
- example =
- lib.literalExample "${config.home.homeDirectory}/images/wallpaper.jpg";
+ example = lib.literalExample "${config.home.homeDirectory}/images/wallpaper.jpg";
};
}
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
index d5f15a2..e1ae9dd 100644
--- a/modules/nixos/default.nix
+++ b/modules/nixos/default.nix
@@ -1,5 +1,9 @@
{ ... }:
{
- imports = [ ./filtron.nix ./personal ./rss-bridge.nix ];
+ imports = [
+ ./filtron.nix
+ ./personal
+ ./rss-bridge.nix
+ ];
}
diff --git a/modules/nixos/filtron.nix b/modules/nixos/filtron.nix
index 6d75558..cb681f2 100644
--- a/modules/nixos/filtron.nix
+++ b/modules/nixos/filtron.nix
@@ -1,4 +1,9 @@
-{ config, lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
let
cfg = config.services.filtron;
@@ -11,7 +16,8 @@ let
port = lib.mkOption { type = lib.types.port; };
};
};
-in {
+in
+{
options.services.filtron = {
enable = lib.mkEnableOption "filtron";
package = lib.mkOption {
@@ -23,21 +29,28 @@ in {
};
api = lib.mkOption {
type = addressType;
- default = { address = "localhost"; port = 4005; };
+ default = {
+ address = "localhost";
+ port = 4005;
+ };
description = ''
API listen address and port.
'';
};
listen = lib.mkOption {
type = addressType;
- default = { port = 4004; };
+ default = {
+ port = 4004;
+ };
description = ''
Proxy listen address and port.
'';
};
target = lib.mkOption {
type = addressType;
- default = { port = 8888; };
+ default = {
+ port = 8888;
+ };
description = ''
Target address and port for reverse proxy.
'';
diff --git a/modules/nixos/personal/boot.nix b/modules/nixos/personal/boot.nix
index 149d9b9..bde1ab0 100644
--- a/modules/nixos/personal/boot.nix
+++ b/modules/nixos/personal/boot.nix
@@ -2,9 +2,11 @@
config,
lib,
...
-}: let
+}:
+let
cfg = config.personal.boot;
-in {
+in
+{
options.personal.boot = {
grub.enable = lib.mkEnableOption "grub";
efi.enable = lib.mkEnableOption "EFI";
@@ -16,7 +18,7 @@ in {
(lib.mkIf cfg.grub.enable {
grub = {
enable = true;
- enableCryptodisk = config.boot.initrd.luks.devices != {};
+ enableCryptodisk = config.boot.initrd.luks.devices != { };
device = lib.mkDefault "nodev";
};
})
@@ -26,9 +28,10 @@ in {
})
];
- initrd = let
- crypt = config.personal.hardware.disks.crypted;
- in
+ initrd =
+ let
+ crypt = config.personal.hardware.disks.crypted;
+ in
lib.mkIf (cfg.unattendedReboot && crypt != null) {
secrets."/keyfile.luks" = /etc/luks/keys/tmp;
luks.devices.crypt = {
diff --git a/modules/nixos/personal/default.nix b/modules/nixos/personal/default.nix
index dfc7291..cab4a97 100644
--- a/modules/nixos/personal/default.nix
+++ b/modules/nixos/personal/default.nix
@@ -1,4 +1,5 @@
-{...}: {
+{ ... }:
+{
imports = [
./boot.nix
./environment.nix
diff --git a/modules/nixos/personal/environment.nix b/modules/nixos/personal/environment.nix
index d69f087..5014f14 100644
--- a/modules/nixos/personal/environment.nix
+++ b/modules/nixos/personal/environment.nix
@@ -3,42 +3,51 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.environment;
-in {
+in
+{
options.personal.environment = {
enable = lib.mkEnableOption "basic environment";
locale.enable = lib.mkEnableOption "French locale";
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- environment = {
- systemPackages = with pkgs; [vim gitMinimal busybox coreutils];
- variables = {
- EDITOR = "vim";
- DO_NOT_TRACK = "1";
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ environment = {
+ systemPackages = with pkgs; [
+ vim
+ gitMinimal
+ busybox
+ coreutils
+ ];
+ variables = {
+ EDITOR = "vim";
+ DO_NOT_TRACK = "1";
+ };
};
- };
- programs.starship.enable = true;
- programs.bash.shellInit = ''
- function set_win_title(){
- echo -ne "\033]0;$(whoami)@$(hostname --long):$(dirs)\a"
- }
- starship_precmd_user_func="set_win_title"
- '';
- }
- (lib.mkIf cfg.locale.enable {
- time.timeZone = "Europe/Paris";
- i18n = {
- defaultLocale = "fr_FR.UTF-8";
- extraLocaleSettings.LANG = "en_US.UTF-8";
- };
- console = {
- font = "Lat2-Terminus16";
- keyMap = config.personal.hardware.keyboard.keyMap;
- };
- })
- ]);
+ programs.starship.enable = true;
+ programs.bash.shellInit = ''
+ function set_win_title(){
+ echo -ne "\033]0;$(whoami)@$(hostname --long):$(dirs)\a"
+ }
+ starship_precmd_user_func="set_win_title"
+ '';
+ }
+ (lib.mkIf cfg.locale.enable {
+ time.timeZone = "Europe/Paris";
+ i18n = {
+ defaultLocale = "fr_FR.UTF-8";
+ extraLocaleSettings.LANG = "en_US.UTF-8";
+ };
+ console = {
+ font = "Lat2-Terminus16";
+ keyMap = config.personal.hardware.keyboard.keyMap;
+ };
+ })
+ ]
+ );
}
diff --git a/modules/nixos/personal/gui.nix b/modules/nixos/personal/gui.nix
index 0ca7e3a..b339110 100644
--- a/modules/nixos/personal/gui.nix
+++ b/modules/nixos/personal/gui.nix
@@ -3,11 +3,13 @@
lib,
pkgs,
...
-} @ extraArgs: let
+}@extraArgs:
+let
cfg = config.personal.gui;
- wallpaper = pkgs.personal.static.wallpapers.nga-1973-68-1.override {gravity = "north";};
+ wallpaper = pkgs.personal.static.wallpapers.nga-1973-68-1.override { gravity = "north"; };
importedStylix = extraArgs ? stylix;
-in {
+in
+{
imports = lib.optional importedStylix extraArgs.stylix.nixosModules.stylix;
options.personal.gui = {
@@ -17,93 +19,99 @@ in {
stylix.enable = lib.mkEnableOption "stylix";
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- services.xserver = lib.mkIf cfg.xserver.enable {
- enable = true;
- desktopManager.xfce.enable = true;
- displayManager = {
- lightdm = {
- enable = true;
- background = config.stylix.image or wallpaper;
- greeters.gtk = {
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ services.xserver = lib.mkIf cfg.xserver.enable {
+ enable = true;
+ desktopManager.xfce.enable = true;
+ displayManager = {
+ lightdm = {
enable = true;
- extraConfig = ''
- user-background = false
- '';
- theme = lib.mkDefault {
- name = "Arc-Dark";
- package = pkgs.arc-theme;
- };
- iconTheme = lib.mkDefault {
- name = "Breeze-dark";
- package = pkgs.kdePackages.breeze-icons;
+ background = config.stylix.image or wallpaper;
+ greeters.gtk = {
+ enable = true;
+ extraConfig = ''
+ user-background = false
+ '';
+ theme = lib.mkDefault {
+ name = "Arc-Dark";
+ package = pkgs.arc-theme;
+ };
+ iconTheme = lib.mkDefault {
+ name = "Breeze-dark";
+ package = pkgs.kdePackages.breeze-icons;
+ };
};
};
};
+ # Hardware
+ xkb.layout = config.personal.hardware.keyboard.keyMap;
+ autoRepeatDelay = 200;
};
- # Hardware
- xkb.layout = config.personal.hardware.keyboard.keyMap;
- autoRepeatDelay = 200;
- };
- }
- # fragile conf
- (lib.mkIf cfg.i3.enable {
- services = {
- displayManager.defaultSession = "xfce+i3";
- libinput.enable = true;
- xserver = {
- desktopManager.xfce = {
- noDesktop = true;
- enableXfwm = false;
- };
- windowManager.i3.enable = true;
- };
- };
- security.pam.services = {
- i3lock.enable = true;
- i3lock-color.enable = true;
- };
- })
- (lib.mkIf cfg.stylix.enable ({
- assertions = let
- missingArgAssertion = name: {
- assertion = lib.hasAttr name extraArgs;
- message = "attribute ${name} missing: add it in lib.nixosSystem's specialArgs, or set config.personal.gui.stylix.enable to false";
- };
- in [(missingArgAssertion "stylix")];
}
- // lib.optionalAttrs importedStylix {
- stylix = {
- enable = true;
- image = lib.mkDefault wallpaper;
- base16Scheme = lib.mkDefault {
- author = "Stylix";
- base00 = "212a27";
- base01 = "3a4a47";
- base02 = "596e73";
- base03 = "8ba0b5";
- base04 = "b0bbb7";
- base05 = "efe1be";
- base06 = "efefe5";
- base07 = "f1f1e5";
- base08 = "7e93a8";
- base09 = "92917f";
- base0A = "5d9c81";
- base0B = "859394";
- base0C = "8d9657";
- base0D = "b38861";
- base0E = "80977a";
- base0F = "a19052";
- scheme = "Stylix";
- slug = "stylix";
- };
- polarity = lib.mkDefault "dark";
- fonts.sizes = {
- applications = 10;
- desktop = 12;
+ # fragile conf
+ (lib.mkIf cfg.i3.enable {
+ services = {
+ displayManager.defaultSession = "xfce+i3";
+ libinput.enable = true;
+ xserver = {
+ desktopManager.xfce = {
+ noDesktop = true;
+ enableXfwm = false;
+ };
+ windowManager.i3.enable = true;
};
};
- }))
- ]);
+ security.pam.services = {
+ i3lock.enable = true;
+ i3lock-color.enable = true;
+ };
+ })
+ (lib.mkIf cfg.stylix.enable (
+ {
+ assertions =
+ let
+ missingArgAssertion = name: {
+ assertion = lib.hasAttr name extraArgs;
+ message = "attribute ${name} missing: add it in lib.nixosSystem's specialArgs, or set config.personal.gui.stylix.enable to false";
+ };
+ in
+ [ (missingArgAssertion "stylix") ];
+ }
+ // lib.optionalAttrs importedStylix {
+ stylix = {
+ enable = true;
+ image = lib.mkDefault wallpaper;
+ base16Scheme = lib.mkDefault {
+ author = "Stylix";
+ base00 = "212a27";
+ base01 = "3a4a47";
+ base02 = "596e73";
+ base03 = "8ba0b5";
+ base04 = "b0bbb7";
+ base05 = "efe1be";
+ base06 = "efefe5";
+ base07 = "f1f1e5";
+ base08 = "7e93a8";
+ base09 = "92917f";
+ base0A = "5d9c81";
+ base0B = "859394";
+ base0C = "8d9657";
+ base0D = "b38861";
+ base0E = "80977a";
+ base0F = "a19052";
+ scheme = "Stylix";
+ slug = "stylix";
+ };
+ polarity = lib.mkDefault "dark";
+ fonts.sizes = {
+ applications = 10;
+ desktop = 12;
+ };
+ };
+ }
+ ))
+ ]
+ );
}
diff --git a/modules/nixos/personal/hardware.nix b/modules/nixos/personal/hardware.nix
index 6f1183d..dfab964 100644
--- a/modules/nixos/personal/hardware.nix
+++ b/modules/nixos/personal/hardware.nix
@@ -3,9 +3,11 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.hardware;
-in {
+in
+{
options.personal.hardware = {
usb.enable = lib.mkEnableOption "usb";
disks.crypted = lib.mkOption {
@@ -20,24 +22,26 @@ in {
default = "fr";
};
};
- backlights = let
- mkBacklightOption = name:
- lib.mkOption {
- type = with lib.types; nullOr str;
- default = null;
- description = "Whether to allow all users to change hardware the ${name} brightness.";
- };
- in {
- screen = mkBacklightOption "screen";
- keyboard = mkBacklightOption "keyboard";
- };
+ backlights =
+ let
+ mkBacklightOption =
+ name:
+ lib.mkOption {
+ type = with lib.types; nullOr str;
+ default = null;
+ description = "Whether to allow all users to change hardware the ${name} brightness.";
+ };
+ in
+ {
+ screen = mkBacklightOption "screen";
+ keyboard = mkBacklightOption "keyboard";
+ };
sound.enable = lib.mkEnableOption "sound";
};
config = lib.mkMerge [
{
- hardware.firmware =
- lib.optional cfg.firmwareNonFree.enable pkgs.firmwareLinuxNonfree;
+ hardware.firmware = lib.optional cfg.firmwareNonFree.enable pkgs.firmwareLinuxNonfree;
boot.initrd.availableKernelModules = lib.optional cfg.usb.enable "usb_storage";
services.udev.extraRules =
@@ -49,15 +53,17 @@ in {
'';
}
- (let
- crypt = cfg.disks.crypted;
- in
+ (
+ let
+ crypt = cfg.disks.crypted;
+ in
lib.mkIf (crypt != null) {
boot.initrd.luks.devices.crypt = {
device = crypt;
preLVM = true;
};
- })
+ }
+ )
(lib.mkIf cfg.sound.enable {
security.rtkit.enable = true;
diff --git a/modules/nixos/personal/monitoring.nix b/modules/nixos/personal/monitoring.nix
index 01fe201..e5797fb 100644
--- a/modules/nixos/personal/monitoring.nix
+++ b/modules/nixos/personal/monitoring.nix
@@ -3,23 +3,30 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.monitoring;
-in {
+in
+{
options = {
personal.monitoring.enable = lib.mkEnableOption "e-mail monitoring of systemd services";
systemd.services = lib.mkOption {
- type = with lib.types;
- attrsOf (submodule ({
- name,
- config,
- lib,
- ...
- }: {
- options.personal.monitor =
- lib.mkEnableOption "e-mail monitoring for the ${name} seervice";
- config.onFailure = lib.optional config.personal.monitor "notify@%i.service";
- }));
+ type =
+ with lib.types;
+ attrsOf (
+ submodule (
+ {
+ name,
+ config,
+ lib,
+ ...
+ }:
+ {
+ options.personal.monitor = lib.mkEnableOption "e-mail monitoring for the ${name} seervice";
+ config.onFailure = lib.optional config.personal.monitor "notify@%i.service";
+ }
+ )
+ );
};
};
@@ -42,18 +49,20 @@ in {
description = "Send the status of the %i service as an e-mail.";
serviceConfig.type = "oneshot";
scriptArgs = "%i";
- script = let
- netCfg = config.networking;
- host = "${builtins.toString netCfg.hostName}.${builtins.toString netCfg.domain}";
- in ''
- service="$1"
- echo \
- "Subject: ${host}: service $service failed
- Service $soervice failed on ${host}, with the following log:
+ script =
+ let
+ netCfg = config.networking;
+ host = "${builtins.toString netCfg.hostName}.${builtins.toString netCfg.domain}";
+ in
+ ''
+ service="$1"
+ echo \
+ "Subject: ${host}: service $service failed
+ Service $soervice failed on ${host}, with the following log:
- $(journalctl --no-pager --unit $service --since -1h)
- " | ${pkgs.msmtp}/bin/msmtp quentin@aristote.fr
- '';
+ $(journalctl --no-pager --unit $service --since -1h)
+ " | ${pkgs.msmtp}/bin/msmtp quentin@aristote.fr
+ '';
};
};
}
diff --git a/modules/nixos/personal/networking/default.nix b/modules/nixos/personal/networking/default.nix
index 3caddb1..cef72eb 100644
--- a/modules/nixos/personal/networking/default.nix
+++ b/modules/nixos/personal/networking/default.nix
@@ -4,16 +4,19 @@
pkgs,
options,
...
-}: let
+}:
+let
cfg = config.personal.networking;
- mkFirewallEnableOption = name:
+ mkFirewallEnableOption =
+ name:
lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to open ports for ${name}.";
};
-in {
- imports = [./wifi.nix];
+in
+{
+ imports = [ ./wifi.nix ];
options.personal.networking = {
enable = lib.mkEnableOption "networking";
@@ -28,19 +31,24 @@ in {
};
config = lib.mkIf cfg.enable {
- environment.systemPackages =
- lib.optional cfg.networkmanager.enable pkgs.networkmanager;
+ environment.systemPackages = lib.optional cfg.networkmanager.enable pkgs.networkmanager;
networking = {
networkmanager = lib.mkIf cfg.networkmanager.enable {
enable = true;
- unmanaged = ["interface-name:ve-*"];
+ unmanaged = [ "interface-name:ve-*" ];
};
firewall = {
enable = true;
allowedTCPPorts =
lib.optional cfg.firewall.syncthing 22000
- ++ lib.optionals cfg.firewall.http [80 443];
- allowedUDPPorts = lib.optionals cfg.firewall.syncthing [22000 21027];
+ ++ lib.optionals cfg.firewall.http [
+ 80
+ 443
+ ];
+ allowedUDPPorts = lib.optionals cfg.firewall.syncthing [
+ 22000
+ 21027
+ ];
allowedTCPPortRanges = lib.optional cfg.firewall.kdeconnect {
from = 1714;
to = 1764;
@@ -52,26 +60,26 @@ in {
};
};
services = lib.mkIf cfg.ssh.enable {
- openssh =
- {
- enable = true;
- extraConfig = ''
- AcceptEnv PS1
- '';
- }
- // (
- if options.services.openssh ? settings
- then {
+ openssh = {
+ enable = true;
+ extraConfig = ''
+ AcceptEnv PS1
+ '';
+ }
+ // (
+ if options.services.openssh ? settings then
+ {
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
}
- else {
+ else
+ {
permitRootLogin = "no";
passwordAuthentication = false;
}
- );
+ );
fail2ban = {
enable = true;
maxretry = 16;
diff --git a/modules/nixos/personal/networking/wifi.nix b/modules/nixos/personal/networking/wifi.nix
index d7415a8..2e23349 100644
--- a/modules/nixos/personal/networking/wifi.nix
+++ b/modules/nixos/personal/networking/wifi.nix
@@ -2,39 +2,42 @@
config,
lib,
...
-}: let
+}:
+let
cfg = config.personal.networking.wifi;
- mkWifiProfile = {
- id,
- ssid,
- }: {
- "${id}" = {
- connection = {
- id = "${id}";
- type = "wifi";
- };
- wifi = {
- inherit ssid;
- mode = "infrastructure";
- };
- wifi-security = {
- key-mgmt = "wpa-psk";
- # fill-in password on first connection
- # this will create a new connection
- # disable the personal.networking.wifi.enable option
- # to keep it for next rebuild
- };
- ipv4 = {
- method = "auto";
- };
- ipv6 = {
- addr-gen-mode = "stable-privacy";
- method = "auto";
- };
- proxy = {
+ mkWifiProfile =
+ {
+ id,
+ ssid,
+ }:
+ {
+ "${id}" = {
+ connection = {
+ id = "${id}";
+ type = "wifi";
+ };
+ wifi = {
+ inherit ssid;
+ mode = "infrastructure";
+ };
+ wifi-security = {
+ key-mgmt = "wpa-psk";
+ # fill-in password on first connection
+ # this will create a new connection
+ # disable the personal.networking.wifi.enable option
+ # to keep it for next rebuild
+ };
+ ipv4 = {
+ method = "auto";
+ };
+ ipv6 = {
+ addr-gen-mode = "stable-privacy";
+ method = "auto";
+ };
+ proxy = {
+ };
};
};
- };
knownSSIDs = {
home = "Quentintranet";
home-iot = "Quentinternet of Things";
@@ -46,16 +49,20 @@
montlaur = "Nordnet_E080";
montlaur-5g = "Nordnet_E080_5G";
};
-in {
+in
+{
options.personal.networking.wifi = {
enable = lib.mkEnableOption "personal WiFi networks";
networks = lib.mkOption {
type = with lib.types; listOf str;
- default = ["home-private" "hotspot"];
+ default = [
+ "home-private"
+ "hotspot"
+ ];
};
extraNetworks = lib.mkOption {
type = with lib.types; listOf (attrsOf str);
- default = [];
+ default = [ ];
example = [
{
id = "my-wifi";
@@ -65,20 +72,16 @@ in {
};
};
- config.networking.networkmanager.ensureProfiles.profiles = let
- networks =
- builtins.map (id: {
- inherit id;
- ssid =
- if lib.hasAttr id knownSSIDs
- then lib.getAttr id knownSSIDs
- else throw "Unknown WiFi ID: ${id}";
- })
- cfg.networks
- ++ cfg.extraNetworks;
- profiles = lib.mergeAttrsList (builtins.map mkWifiProfile networks);
- in
- lib.mkIf
- cfg.enable
- profiles;
+ config.networking.networkmanager.ensureProfiles.profiles =
+ let
+ networks =
+ builtins.map (id: {
+ inherit id;
+ ssid =
+ if lib.hasAttr id knownSSIDs then lib.getAttr id knownSSIDs else throw "Unknown WiFi ID: ${id}";
+ }) cfg.networks
+ ++ cfg.extraNetworks;
+ profiles = lib.mergeAttrsList (builtins.map mkWifiProfile networks);
+ in
+ lib.mkIf cfg.enable profiles;
}
diff --git a/modules/nixos/personal/nix.nix b/modules/nixos/personal/nix.nix
index 1eedd1b..f918391 100644
--- a/modules/nixos/personal/nix.nix
+++ b/modules/nixos/personal/nix.nix
@@ -3,80 +3,96 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.nix;
-in {
+in
+{
options.personal.nix = {
enable = lib.mkEnableOption "nix configuration";
gc.enable = lib.mkEnableOption "garbage collection";
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- nixpkgs = {
- config.allowUnfree = true;
- flake = lib.mkDefault {
- setNixPath = false;
- setFlakeRegistry = false;
- };
- };
- nix = {
- package = pkgs.lix;
- settings = {
- auto-optimise-store = true;
- experimental-features = ["nix-command" "flakes" "recursive-nix"];
- substituters = ["https://devenv.cachix.org/" "https://nix-community.cachix.org/"];
- trusted-public-keys = ["devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="];
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ nixpkgs = {
+ config.allowUnfree = true;
+ flake = lib.mkDefault {
+ setNixPath = false;
+ setFlakeRegistry = false;
+ };
};
- extraOptions = ''
- !include secrets.conf
- '';
- registry.my-nixpkgs = {
- from = {
- type = "indirect";
- id = "my-nixpkgs";
+ nix = {
+ package = pkgs.lix;
+ settings = {
+ auto-optimise-store = true;
+ experimental-features = [
+ "nix-command"
+ "flakes"
+ "recursive-nix"
+ ];
+ substituters = [
+ "https://devenv.cachix.org/"
+ "https://nix-community.cachix.org/"
+ ];
+ trusted-public-keys = [
+ "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
+ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
+ ];
};
- to = {
- type = "github";
- owner = "qaristote";
- repo = "my-nixpkgs";
+ extraOptions = ''
+ !include secrets.conf
+ '';
+ registry.my-nixpkgs = {
+ from = {
+ type = "indirect";
+ id = "my-nixpkgs";
+ };
+ to = {
+ type = "github";
+ owner = "qaristote";
+ repo = "my-nixpkgs";
+ };
};
};
- };
- }
+ }
- (lib.mkIf cfg.gc.enable {
- nix.gc = {
- automatic = true;
- dates = "daily";
- options = "--delete-old";
- };
- systemd.services = {
- nix-gc = {
- after = ["nixos-upgrade.service"];
- personal.monitor = true;
+ (lib.mkIf cfg.gc.enable {
+ nix.gc = {
+ automatic = true;
+ dates = "daily";
+ options = "--delete-old";
};
- nix-gc-remove-dead-roots = {
- enable = cfg.gc.enable;
- description = "Remove dead symlinks in /nix/var/nix/gcroots";
- serviceConfig.Type = "oneshot";
- script = "find /nix/var/nix/gcroots -xtype l -delete";
- before = ["nix-gc.service"];
- wantedBy = ["nix-gc.service"];
- personal.monitor = true;
- };
- nix-gc-remove-old-hm-gens = let
- user = config.personal.user;
- in {
- enable = user.enable && user.homeManager.enable;
- description = "Remove old Home Manager generations for user ${user.name}";
- serviceConfig.Type = "oneshot";
- script = "${pkgs.nix}/bin/nix-env --profile /home/${user.name}/.local/state/nix/profiles/home-manager --delete-generations old";
- before = ["nix-gc.service"];
- wantedBy = ["nix-gc.service"];
- personal.monitor = true;
+ systemd.services = {
+ nix-gc = {
+ after = [ "nixos-upgrade.service" ];
+ personal.monitor = true;
+ };
+ nix-gc-remove-dead-roots = {
+ enable = cfg.gc.enable;
+ description = "Remove dead symlinks in /nix/var/nix/gcroots";
+ serviceConfig.Type = "oneshot";
+ script = "find /nix/var/nix/gcroots -xtype l -delete";
+ before = [ "nix-gc.service" ];
+ wantedBy = [ "nix-gc.service" ];
+ personal.monitor = true;
+ };
+ nix-gc-remove-old-hm-gens =
+ let
+ user = config.personal.user;
+ in
+ {
+ enable = user.enable && user.homeManager.enable;
+ description = "Remove old Home Manager generations for user ${user.name}";
+ serviceConfig.Type = "oneshot";
+ script = "${pkgs.nix}/bin/nix-env --profile /home/${user.name}/.local/state/nix/profiles/home-manager --delete-generations old";
+ before = [ "nix-gc.service" ];
+ wantedBy = [ "nix-gc.service" ];
+ personal.monitor = true;
+ };
};
- };
- })
- ]);
+ })
+ ]
+ );
}
diff --git a/modules/nixos/personal/system.nix b/modules/nixos/personal/system.nix
index 332384a..3337b96 100644
--- a/modules/nixos/personal/system.nix
+++ b/modules/nixos/personal/system.nix
@@ -3,14 +3,16 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.personal.system;
cfgRemote = cfg.autoUpgrade.remoteBuilding;
cfgNix = config.nix;
cfgLuks = config.boot.initrd.luks.devices;
name = config.networking.hostName;
-in {
+in
+{
options.personal.system = {
flake = lib.mkOption {
type = with lib.types; nullOr str;
@@ -20,7 +22,11 @@ in {
enable = lib.mkEnableOption "automatic system and nixpkgs upgrade";
autoUpdateInputs = lib.mkOption {
type = with lib.types; listOf str;
- default = ["nixpkgs" "my-nixpkgs/nur" "nixos-hardware"];
+ default = [
+ "nixpkgs"
+ "my-nixpkgs/nur"
+ "nixos-hardware"
+ ];
};
checkHosts = lib.mkOption {
type = with lib.types; listOf str;
@@ -33,7 +39,7 @@ in {
type = lib.types.str;
default = "hephaistos";
};
- domain = lib.mkOption {type = lib.types.str;};
+ domain = lib.mkOption { type = lib.types.str; };
user = lib.mkOption {
type = lib.types.str;
default = name;
@@ -44,8 +50,7 @@ in {
default = "ssh-ng";
};
speedFactor = lib.mkOption {
- type =
- lib.types.int;
+ type = lib.types.int;
default = 8;
};
};
@@ -53,45 +58,55 @@ in {
};
};
- config = let
- hasFlake = cfg.flake != null;
- hasFlakeInputs = cfg.autoUpgrade.autoUpdateInputs != [];
+ config =
+ let
+ hasFlake = cfg.flake != null;
+ hasFlakeInputs = cfg.autoUpgrade.autoUpdateInputs != [ ];
- reboot = config.system.autoUpgrade.allowReboot;
- nixosRebuild = "nixos-rebuild ${toString config.system.autoUpgrade.flags}";
+ reboot = config.system.autoUpgrade.allowReboot;
+ nixosRebuild = "nixos-rebuild ${toString config.system.autoUpgrade.flags}";
- remoteBuilder = with cfgRemote.builder; "${hostName}.${domain}";
+ remoteBuilder = with cfgRemote.builder; "${hostName}.${domain}";
- checkNetwork = {
- path = [pkgs.unixtools.ping];
- # Check network connectivity
- preStart = "(${lib.concatMapStringsSep " && " (host: "ping -c 1 ${host}") cfg.autoUpgrade.checkHosts}) || kill -s SIGUSR1 $$";
- unitConfig = {
- StartLimitIntervalSec = 300;
- StartLimitBurst = 5;
- };
- serviceConfig = lib.mkIf (!config.personal.monitoring.enable) {
- Restart = "on-abort";
- RestartSec = 30;
- RestartMode = "direct"; # dependent units will not fail
+ checkNetwork = {
+ path = [ pkgs.unixtools.ping ];
+ # Check network connectivity
+ preStart = "(${
+ lib.concatMapStringsSep " && " (host: "ping -c 1 ${host}") cfg.autoUpgrade.checkHosts
+ }) || kill -s SIGUSR1 $$";
+ unitConfig = {
+ StartLimitIntervalSec = 300;
+ StartLimitBurst = 5;
+ };
+ serviceConfig = lib.mkIf (!config.personal.monitoring.enable) {
+ Restart = "on-abort";
+ RestartSec = 30;
+ RestartMode = "direct"; # dependent units will not fail
+ };
};
- };
- in
+ in
lib.mkMerge [
(lib.mkIf hasFlake {
system.autoUpgrade.flake = cfg.flake;
- systemd.services.flake-update = lib.mkIf hasFlakeInputs (lib.mkMerge [
- checkNetwork
- {
- description = "Update flake inputs";
- serviceConfig.Type = "oneshot";
- script = "nix flake update --commit-lock-file --flake ${cfg.flake} " + lib.concatStringsSep " " cfg.autoUpgrade.autoUpdateInputs;
- before = ["nixos-upgrade.service"];
- requiredBy = ["nixos-upgrade.service"];
- path = [pkgs.git cfgNix.package];
- personal.monitor = true;
- }
- ]);
+ systemd.services.flake-update = lib.mkIf hasFlakeInputs (
+ lib.mkMerge [
+ checkNetwork
+ {
+ description = "Update flake inputs";
+ serviceConfig.Type = "oneshot";
+ script =
+ "nix flake update --commit-lock-file --flake ${cfg.flake} "
+ + lib.concatStringsSep " " cfg.autoUpgrade.autoUpdateInputs;
+ before = [ "nixos-upgrade.service" ];
+ requiredBy = [ "nixos-upgrade.service" ];
+ path = [
+ pkgs.git
+ cfgNix.package
+ ];
+ personal.monitor = true;
+ }
+ ]
+ );
programs.git = lib.mkIf (lib.hasPrefix "git+file" cfg.flake) {
enable = true;
@@ -102,28 +117,27 @@ in {
};
})
- (
- lib.mkIf (cfg.autoUpgrade.enable && cfgRemote.enable) {
- assertions = [
- {
- assertion = hasFlake && lib.hasPrefix "git+file://" cfg.flake;
- message = "Auto remote upgrade is only supported when the system is specified by a flake with path of the shape 'git+file://...'";
- }
- ];
+ (lib.mkIf (cfg.autoUpgrade.enable && cfgRemote.enable) {
+ assertions = [
+ {
+ assertion = hasFlake && lib.hasPrefix "git+file://" cfg.flake;
+ message = "Auto remote upgrade is only supported when the system is specified by a flake with path of the shape 'git+file://...'";
+ }
+ ];
- personal.system.autoUpgrade.checkHosts = lib.mkOptionDefault [remoteBuilder];
+ personal.system.autoUpgrade.checkHosts = lib.mkOptionDefault [ remoteBuilder ];
- programs.ssh = {
- extraConfig = ''
- Host ${remoteBuilder}
- IdentitiesOnly yes
- IdentityFile /etc/ssh/remoteBuilder
- User ${cfgRemote.builder.user}
- '';
- knownHosts."${remoteBuilder}".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHvtqi8tziBuviUV8LDK2ddQQUbHdJYB02dgWTK5Olxq";
- };
- }
- )
+ programs.ssh = {
+ extraConfig = ''
+ Host ${remoteBuilder}
+ IdentitiesOnly yes
+ IdentityFile /etc/ssh/remoteBuilder
+ User ${cfgRemote.builder.user}
+ '';
+ knownHosts."${remoteBuilder}".publicKey =
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHvtqi8tziBuviUV8LDK2ddQQUbHdJYB02dgWTK5Olxq";
+ };
+ })
(lib.mkIf cfg.autoUpgrade.enable {
personal.boot.unattendedReboot = lib.mkIf reboot true;
@@ -137,83 +151,86 @@ in {
path =
lib.optional reboot pkgs.coreutils
++ [
- (
- if cfgRemote.enable
- then cfgNix.package
- else pkgs.nixos-rebuild
- )
+ (if cfgRemote.enable then cfgNix.package else pkgs.nixos-rebuild)
]
++ lib.optional (reboot && cfgLuks ? crypt) pkgs.cryptsetup;
personal.monitor = true;
- script = lib.mkForce (lib.concatStrings [
- ''
- ## build configuration
- ''
- (
- let
- in
- if cfgRemote.enable
- then ''
- # update remote flake
- pushd ${lib.removePrefix "git+file://" cfg.flake}
- git push --force ${cfgRemote.builder.hostName} local:master
- popd
- # build remotely
- config=$(ssh ${remoteBuilder} -- \
- 'nix build --refresh --print-out-paths \
- git+file://$(pwd)/nixos-configuration#nixosConfigurations.${name}.config.system.build.toplevel')
- # copy result locally
- nix-copy-closure --from ${remoteBuilder} "$config"
- # create new generation
- nix-env --profile /nix/var/nix/profiles/system \
- --set "$config"
+ script = lib.mkForce (
+ lib.concatStrings [
+ ''
+ ## build configuration
+ ''
+ (
+ let
+ in
+ if cfgRemote.enable then
+ ''
+ # update remote flake
+ pushd ${lib.removePrefix "git+file://" cfg.flake}
+ git push --force ${cfgRemote.builder.hostName} local:master
+ popd
+ # build remotely
+ config=$(ssh ${remoteBuilder} -- \
+ 'nix build --refresh --print-out-paths \
+ git+file://$(pwd)/nixos-configuration#nixosConfigurations.${name}.config.system.build.toplevel')
+ # copy result locally
+ nix-copy-closure --from ${remoteBuilder} "$config"
+ # create new generation
+ nix-env --profile /nix/var/nix/profiles/system \
+ --set "$config"
- switch="$config/bin/switch-to-configuration"
- ''
- else ''
- switch="${nixosRebuild}"
- ''
- )
- ''
- ## check whether a reboot is necessary"
- ''
- (
- if reboot
- then ''
- $switch boot
- booted="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
- built="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
- reboot="$([ "$booted" = "$built" ] || echo true)"
+ switch="$config/bin/switch-to-configuration"
+ ''
+ else
+ ''
+ switch="${nixosRebuild}"
+ ''
+ )
''
- else ''
- reboot=""
+ ## check whether a reboot is necessary"
''
- )
- ''
- ## switch to new configuration
- ''
- (let
- ifcrypt = lib.optionalString (cfgLuks ? crypt);
- crypt = cfgLuks.crypt.device;
- luksKey = x: "/etc/luks/keys/" + x;
- in ''
- if [ "$reboot" ]
- then
- ${ifcrypt ''
- cryptsetup luksAddKey ${crypt} ${luksKey "tmp"} \
- --key-file ${luksKey "master"} \
- --verbose
- ''}
- shutdown -r now ${ifcrypt ''
- || cryptsetup luksRemoveKey ${crypt} \
- --key-file ${luksKey "tmp"} \
- --verbose
- ''}
- else
- $switch switch
- fi
- '')
- ]);
+ (
+ if reboot then
+ ''
+ $switch boot
+ booted="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
+ built="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
+ reboot="$([ "$booted" = "$built" ] || echo true)"
+ ''
+ else
+ ''
+ reboot=""
+ ''
+ )
+ ''
+ ## switch to new configuration
+ ''
+ (
+ let
+ ifcrypt = lib.optionalString (cfgLuks ? crypt);
+ crypt = cfgLuks.crypt.device;
+ luksKey = x: "/etc/luks/keys/" + x;
+ in
+ ''
+ if [ "$reboot" ]
+ then
+ ${ifcrypt ''
+ cryptsetup luksAddKey ${crypt} ${luksKey "tmp"} \
+ --key-file ${luksKey "master"} \
+ --verbose
+ ''}
+ shutdown -r now ${ifcrypt ''
+ || cryptsetup luksRemoveKey ${crypt} \
+ --key-file ${luksKey "tmp"} \
+ --verbose
+ ''}
+ else
+ $switch switch
+ fi
+ ''
+ )
+ ]
+ );
}
];
})
diff --git a/modules/nixos/personal/user.nix b/modules/nixos/personal/user.nix
index 938e8f7..29a35cb 100644
--- a/modules/nixos/personal/user.nix
+++ b/modules/nixos/personal/user.nix
@@ -2,13 +2,13 @@
config,
lib,
...
-} @ extraArgs: let
+}@extraArgs:
+let
cfg = config.personal.user;
importedHomeManager = extraArgs ? home-manager;
-in {
- imports =
- lib.optional importedHomeManager
- extraArgs.home-manager.nixosModules.home-manager;
+in
+{
+ imports = lib.optional importedHomeManager extraArgs.home-manager.nixosModules.home-manager;
options.personal.user = {
enable = lib.mkEnableOption "main user";
@@ -16,31 +16,33 @@ in {
type = lib.types.str;
default = "qaristote";
};
- homeManager = {enable = lib.mkEnableOption "home-manager";};
+ homeManager = {
+ enable = lib.mkEnableOption "home-manager";
+ };
};
- config = lib.mkIf cfg.enable ({
+ config = lib.mkIf cfg.enable (
+ {
users.users."${cfg.name}" = {
isNormalUser = true;
- extraGroups =
- ["wheel"]
- ++ lib.optional config.networking.networkmanager.enable
- "networkmanager";
+ extraGroups = [ "wheel" ] ++ lib.optional config.networking.networkmanager.enable "networkmanager";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK4wGbl3++lqCjLUhoRyABBrVEeNhIXYO4371srkRoyq qaristote@latitude-7490"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvPsKWQXX/QsFQjJU0CjG4LllvUVZme45d9JeS/yhLt qaristote@precision-3571"
];
};
- assertions = let
- missingArgAssertion = name: {
- assertion = lib.hasAttr name extraArgs || !cfg.homeManager.enable;
- message = "attribute ${name} missing: add it in lib.nixosSystem's specialArgs, or set config.personal.user.homeManager.enable to false";
- };
- in [
- (missingArgAssertion "homeModules")
- (missingArgAssertion "home-manager")
- ];
+ assertions =
+ let
+ missingArgAssertion = name: {
+ assertion = lib.hasAttr name extraArgs || !cfg.homeManager.enable;
+ message = "attribute ${name} missing: add it in lib.nixosSystem's specialArgs, or set config.personal.user.homeManager.enable to false";
+ };
+ in
+ [
+ (missingArgAssertion "homeModules")
+ (missingArgAssertion "home-manager")
+ ];
}
// lib.optionalAttrs (importedHomeManager && extraArgs ? homeModules) {
home-manager = lib.mkIf cfg.homeManager.enable {
@@ -51,11 +53,10 @@ in {
useGlobalPkgs = lib.mkDefault true;
useUserPackages = lib.mkDefault true;
# TODO fix this: only config.personal options seem to be passed (or not ?)
- extraSpecialArgs =
- (extraArgs.homeSpecialArgs or {})
- // {
- osConfig = lib.mkDefault config;
- };
+ extraSpecialArgs = (extraArgs.homeSpecialArgs or { }) // {
+ osConfig = lib.mkDefault config;
+ };
};
- });
+ }
+ );
}
diff --git a/modules/nixos/rss-bridge.nix b/modules/nixos/rss-bridge.nix
index 5a938d8..2f90af7 100644
--- a/modules/nixos/rss-bridge.nix
+++ b/modules/nixos/rss-bridge.nix
@@ -3,58 +3,67 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.services.rss-bridge;
-in {
+in
+{
options.services.rss-bridge = {
debug = lib.mkEnableOption "debug mode";
extraBridges = lib.mkOption {
- type = lib.types.listOf (lib.types.submodule {
- options = {
- name = lib.mkOption {
- type = lib.types.strMatching "[a-zA-Z0-9]*";
- description = ''
- The name of the bridge.
- It need not include 'Bridge' at the end, unlike required in RSS-Bridge.
- '';
- example = "SomeAppWithANewsletter";
- };
- source = lib.mkOption {
- type = lib.types.path;
- description = ''
- The path to a file whose contents is the PHP sourcecode of the bridge.
- See also the RSS-Bridge documentation: https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html.
- '';
+ type = lib.types.listOf (
+ lib.types.submodule {
+ options = {
+ name = lib.mkOption {
+ type = lib.types.strMatching "[a-zA-Z0-9]*";
+ description = ''
+ The name of the bridge.
+ It need not include 'Bridge' at the end, unlike required in RSS-Bridge.
+ '';
+ example = "SomeAppWithANewsletter";
+ };
+ source = lib.mkOption {
+ type = lib.types.path;
+ description = ''
+ The path to a file whose contents is the PHP sourcecode of the bridge.
+ See also the RSS-Bridge documentation: https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html.
+ '';
+ };
};
- };
- });
- default = [];
+ }
+ );
+ default = [ ];
description = ''
A list of additional bridges that aren't already included in RSS-Bridge.
These bridges are automatically whitelisted'';
};
};
- config.services.rss-bridge.config.system.enabled_bridges =
- lib.mkIf cfg.enable
- (map (bridge: bridge.name) cfg.extraBridges);
+ config.services.rss-bridge.config.system.enabled_bridges = lib.mkIf cfg.enable (
+ map (bridge: bridge.name) cfg.extraBridges
+ );
config.services.nginx = lib.mkIf (cfg.virtualHost != null) {
- virtualHosts.${cfg.virtualHost}.root =
- lib.mkIf (cfg.extraBridges != [])
- (lib.mkForce (pkgs.runCommand "rss-bridge" {} (''
- mkdir -p $out/bridges
- cp -r ${cfg.package}/* $out/
- pushd $out/bridges
- ''
- + lib.concatStrings (map (bridge: ''
- ln -sf ${bridge.source} "${bridge.name}Bridge.php"
- '')
- cfg.extraBridges)
- + ''
- popd
- ''
- + lib.optionalString cfg.debug ''
- touch $out/DEBUG
- '')));
+ virtualHosts.${cfg.virtualHost}.root = lib.mkIf (cfg.extraBridges != [ ]) (
+ lib.mkForce (
+ pkgs.runCommand "rss-bridge" { } (
+ ''
+ mkdir -p $out/bridges
+ cp -r ${cfg.package}/* $out/
+ pushd $out/bridges
+ ''
+ + lib.concatStrings (
+ map (bridge: ''
+ ln -sf ${bridge.source} "${bridge.name}Bridge.php"
+ '') cfg.extraBridges
+ )
+ + ''
+ popd
+ ''
+ + lib.optionalString cfg.debug ''
+ touch $out/DEBUG
+ ''
+ )
+ )
+ );
};
}
diff --git a/pkgs/barista/default.nix b/pkgs/barista/default.nix
index 30f370a..d097996 100644
--- a/pkgs/barista/default.nix
+++ b/pkgs/barista/default.nix
@@ -1,7 +1,16 @@
-{ buildGoModule, fetchFromGitHub, wirelesstools, fontawesomeMetadata, materialDesignIconsMetadata, i3statusGo ? null }:
+{
+ buildGoModule,
+ fetchFromGitHub,
+ wirelesstools,
+ fontawesomeMetadata,
+ materialDesignIconsMetadata,
+ i3statusGo ? null,
+}:
-let useDefaultConfig = i3statusGo == null;
-in buildGoModule {
+let
+ useDefaultConfig = i3statusGo == null;
+in
+buildGoModule {
name = "barista";
version = "autorelease";
@@ -14,23 +23,28 @@ in buildGoModule {
patchPhase = ''
mkdir main
- '' + (if useDefaultConfig then # use samples/i3status/i3status.go as config
''
- mv samples/i3status/i3status.go main/i3status.go
- '' else # import config and patch font loading
- ''
- cp ${i3statusGo} main/i3status.go
- substituteInPlace main/i3status.go \
- --replace 'fontawesome.Load()' 'fontawesome.Load("${fontawesomeMetadata}")' \
- --replace 'mdi.Load()' 'mdi.Load("${materialDesignIconsMetadata}")'
- '') + # patch call to iwgetid
- ''
- substituteInPlace modules/wlan/wlan.go \
- --replace '/sbin/iwgetid' '${wirelesstools}/bin/iwgetid'
- '';
+ + (
+ if useDefaultConfig then # use samples/i3status/i3status.go as config
+ ''
+ mv samples/i3status/i3status.go main/i3status.go
+ ''
+ # import config and patch font loading
+ else
+ ''
+ cp ${i3statusGo} main/i3status.go
+ substituteInPlace main/i3status.go \
+ --replace 'fontawesome.Load()' 'fontawesome.Load("${fontawesomeMetadata}")' \
+ --replace 'mdi.Load()' 'mdi.Load("${materialDesignIconsMetadata}")'
+ ''
+ )
+ # patch call to iwgetid
+ + ''
+ substituteInPlace modules/wlan/wlan.go \
+ --replace '/sbin/iwgetid' '${wirelesstools}/bin/iwgetid'
+ '';
subPackages = [ "main/i3status.go" ];
vendorHash = "sha256-gpzxwtGxHcidRYY8o1Lz0iboU5aNnwsWfOoGo6Lvefo=";
}
-
diff --git a/pkgs/default.nix b/pkgs/default.nix
index f4712ce..9fd96e5 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -1,38 +1,39 @@
-super: let
+super:
+let
self = {
barista = super.callPackage ./barista {
fontawesomeMetadata = self.static.fontMetadata.fontawesome;
- materialDesignIconsMetadata =
- self.static.fontMetadata.materialDesignIcons;
+ materialDesignIconsMetadata = self.static.fontMetadata.materialDesignIcons;
};
- lib = import ./lib {inherit (super) lib;};
+ lib = import ./lib { inherit (super) lib; };
- lockscreen = super.callPackage ./lockscreen {};
+ lockscreen = super.callPackage ./lockscreen { };
firefoxAddons = super.callPackage ./firefoxAddons {
inherit (super.nur.repos.rycee.firefox-addons) buildFirefoxXpiAddon;
};
- rftg = super.callPackage ./rftg {};
+ rftg = super.callPackage ./rftg { };
static = {
- css = {lineAwesome = super.callPackage ./static/css/lineAwesome {};};
+ css = {
+ lineAwesome = super.callPackage ./static/css/lineAwesome { };
+ };
fontMetadata = {
- fontawesome = super.callPackage ./static/fontMetadata/fontawesome {};
- materialDesignIcons =
- super.callPackage ./static/fontMetadata/materialDesignIcons {};
+ fontawesome = super.callPackage ./static/fontMetadata/fontawesome { };
+ materialDesignIcons = super.callPackage ./static/fontMetadata/materialDesignIcons { };
};
- icons = super.callPackage ./static/icons {};
- gitignore = super.callPackage ./static/gitignore {};
+ icons = super.callPackage ./static/icons { };
+ gitignore = super.callPackage ./static/gitignore { };
userjs = {
- arkenfox = super.callPackage ./static/userjs/arkenfox {};
- thunderbird = super.callPackage ./static/userjs/thunderbird {};
+ arkenfox = super.callPackage ./static/userjs/arkenfox { };
+ thunderbird = super.callPackage ./static/userjs/thunderbird { };
};
- wallpapers = super.callPackage ./static/wallpapers {};
+ wallpapers = super.callPackage ./static/wallpapers { };
};
- watermark = super.callPackage ./watermark {};
+ watermark = super.callPackage ./watermark { };
};
in
- self
+self
diff --git a/pkgs/firefoxAddons/default.nix b/pkgs/firefoxAddons/default.nix
index 413b6da..f593305 100644
--- a/pkgs/firefoxAddons/default.nix
+++ b/pkgs/firefoxAddons/default.nix
@@ -2,7 +2,8 @@
buildFirefoxXpiAddon,
lib,
...
-}: {
+}:
+{
"add-custom-search-engine" = buildFirefoxXpiAddon {
pname = "add-custom-search-engine";
version = "4.2";
@@ -12,7 +13,10 @@
meta = with lib; {
description = "Add a custom search engine to the list of available search engines in the search bar and URL bar.";
license = licenses.mpl20;
- mozPermissions = ["https://paste.mozilla.org/api/" "search"];
+ mozPermissions = [
+ "https://paste.mozilla.org/api/"
+ "search"
+ ];
platforms = platforms.all;
};
};
@@ -492,7 +496,11 @@
homepage = "https://unpaywall.org/products/extension";
description = "Get free text of research papers as you browse, using Unpaywall's index of ten million legal, open-access articles.";
license = licenses.mit;
- mozPermissions = ["*://*.oadoi.org/*" "storage" "<all_urls>"];
+ mozPermissions = [
+ "*://*.oadoi.org/*"
+ "storage"
+ "<all_urls>"
+ ];
platforms = platforms.all;
};
};
@@ -506,7 +514,11 @@
homepage = "https://github.com/cloutierjo/titleUrl";
description = "Add the current host name to the windows title bar. It adds the possibility to recognize the window from other application that work based on windows titles like KeePass's autotype.";
license = licenses.gpl3;
- mozPermissions = ["<all_urls>" "tabs" "storage"];
+ mozPermissions = [
+ "<all_urls>"
+ "tabs"
+ "storage"
+ ];
platforms = platforms.all;
};
};
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix
index 6ba56ef..22c9e07 100644
--- a/pkgs/lib/default.nix
+++ b/pkgs/lib/default.nix
@@ -4,12 +4,17 @@ let
self = {
homeManager = import ./home-manager { };
toUserJS = prefs: ''
- ${lib.concatStrings (lib.mapAttrsToList (name: value: ''
- user_pref("${name}", ${builtins.toJSON value});
- '') prefs)}
+ ${lib.concatStrings (
+ lib.mapAttrsToList (name: value: ''
+ user_pref("${name}", ${builtins.toJSON value});
+ '') prefs
+ )}
'';
- updateInputFlag = input: [ "--update-input" input ];
- updateInputFlags = inputs:
- builtins.concatLists (builtins.map self.updateInputFlag inputs);
+ updateInputFlag = input: [
+ "--update-input"
+ input
+ ];
+ updateInputFlags = inputs: builtins.concatLists (builtins.map self.updateInputFlag inputs);
};
-in self
+in
+self
diff --git a/pkgs/lib/home-manager/default.nix b/pkgs/lib/home-manager/default.nix
index ad3878f..e07e0b8 100644
--- a/pkgs/lib/home-manager/default.nix
+++ b/pkgs/lib/home-manager/default.nix
@@ -1,12 +1,22 @@
{ }:
{
- serviceWithTimer = name:
- { Unit, Service, Timer, Install, ... }@config: {
+ serviceWithTimer =
+ name:
+ {
+ Unit,
+ Service,
+ Timer,
+ Install,
+ ...
+ }@config:
+ {
services.${name} = { inherit (config) Unit Install Service; };
timers.${name} = {
inherit (config) Unit Install;
- Timer = config.Timer // { Unit = "${name}.service"; };
+ Timer = config.Timer // {
+ Unit = "${name}.service";
+ };
};
};
}
diff --git a/pkgs/lockscreen/default.nix b/pkgs/lockscreen/default.nix
index 500e856..2b6bbdc 100644
--- a/pkgs/lockscreen/default.nix
+++ b/pkgs/lockscreen/default.nix
@@ -5,38 +5,41 @@
lib,
backgroundImage ? null,
resolution ? "1920x1080",
-}: let
+}:
+let
useBackgroundImage = backgroundImage != null;
in
- runCommand "lockscreen" {envVariable = true;} (''
- mkdir -p $out/{bin,share}
- ''
- + (lib.optionalString useBackgroundImage ''
- ${imagemagick}/bin/convert ${backgroundImage} -resize ${resolution} -blur 0x5 RGB:$out/share/lockscreen.png
- '')
- + ''
- echo > $out/bin/lockscreen.sh \
- "export PATH=$PATH
- ${i3lock-color}/bin/i3lock-color \\
- ''
- + (lib.optionalString useBackgroundImage ''
- --raw ${resolution}:rgb \\
- --image $out/share/lockscreen.png \\
- --tiling \\
- '')
- + ''
- --no-unlock-indicator \\
- --composite \\
- --clock \\
- --ignore-empty-password \\
- --time-color=FFFFFFFF \\
- --date-color=00000000 \\
- --time-size=100"
- ''
- + (lib.optionalString useBackgroundImage ''
- chmod 444 $out/share/lockscreen.png
- '')
- + ''
- chmod 555 $out/bin/lockscreen.sh
- chmod 555 $out/{bin,share}
- '')
+runCommand "lockscreen" { envVariable = true; } (
+ ''
+ mkdir -p $out/{bin,share}
+ ''
+ + (lib.optionalString useBackgroundImage ''
+ ${imagemagick}/bin/convert ${backgroundImage} -resize ${resolution} -blur 0x5 RGB:$out/share/lockscreen.png
+ '')
+ + ''
+ echo > $out/bin/lockscreen.sh \
+ "export PATH=$PATH
+ ${i3lock-color}/bin/i3lock-color \\
+ ''
+ + (lib.optionalString useBackgroundImage ''
+ --raw ${resolution}:rgb \\
+ --image $out/share/lockscreen.png \\
+ --tiling \\
+ '')
+ + ''
+ --no-unlock-indicator \\
+ --composite \\
+ --clock \\
+ --ignore-empty-password \\
+ --time-color=FFFFFFFF \\
+ --date-color=00000000 \\
+ --time-size=100"
+ ''
+ + (lib.optionalString useBackgroundImage ''
+ chmod 444 $out/share/lockscreen.png
+ '')
+ + ''
+ chmod 555 $out/bin/lockscreen.sh
+ chmod 555 $out/{bin,share}
+ ''
+)
diff --git a/pkgs/rftg/default.nix b/pkgs/rftg/default.nix
index 67c41cd..d2ed791 100644
--- a/pkgs/rftg/default.nix
+++ b/pkgs/rftg/default.nix
@@ -15,14 +15,17 @@ stdenv.mkDerivation rec {
sha256 = "sha256-y/LluUDpNr5Umxc/XPO2mMQWhZ50NxoDkZ7VYt0Sd18=";
};
- nativeBuildInputs = [pkg-config];
- buildInputs = [gtk2.dev hostname];
+ nativeBuildInputs = [ pkg-config ];
+ buildInputs = [
+ gtk2.dev
+ hostname
+ ];
preConfigure = ''
cd src/
'';
- installFlags = ["prefix=$(out)"];
+ installFlags = [ "prefix=$(out)" ];
meta = {
homepage = "http://keldon.net/rftg/";
diff --git a/pkgs/static/css/lineAwesome/default.nix b/pkgs/static/css/lineAwesome/default.nix
index b1376fe..7769e46 100644
--- a/pkgs/static/css/lineAwesome/default.nix
+++ b/pkgs/static/css/lineAwesome/default.nix
@@ -1,12 +1,15 @@
-{ stdenv, fetchurl, fontsRelativeDirectory ? "./webfonts", fontDisplay ? "auto"
+{
+ stdenv,
+ fetchurl,
+ fontsRelativeDirectory ? "./webfonts",
+ fontDisplay ? "auto",
}:
stdenv.mkDerivation rec {
name = "line-awesome.css";
version = "v1.2.1";
src = fetchurl {
- url =
- "https://raw.githubusercontent.com/icons8/line-awesome/${version}/dist/line-awesome/css/line-awesome.css";
+ url = "https://raw.githubusercontent.com/icons8/line-awesome/${version}/dist/line-awesome/css/line-awesome.css";
sha256 = "sha256:GU24Xz6l3Ww4ZCcL2ByssTe04fHBRz9k2aZVRdj0xm4=";
};
diff --git a/pkgs/static/gitignore/default.nix b/pkgs/static/gitignore/default.nix
index d97dec5..6ee8649 100644
--- a/pkgs/static/gitignore/default.nix
+++ b/pkgs/static/gitignore/default.nix
@@ -1,6 +1,6 @@
{
- templates ? [],
- toUncomment ? [],
+ templates ? [ ],
+ toUncomment ? [ ],
stdenvNoCC,
fetchFromGitHub,
lib,
@@ -18,12 +18,20 @@ stdenvNoCC.mkDerivation {
buildPhase = ''
mv {Global,community}/*.gitignore .
- for file in ${lib.concatStringsSep " " (builtins.map (name: lib.escapeShellArg "${name}.gitignore") templates)}
+ for file in ${
+ lib.concatStringsSep " " (builtins.map (name: lib.escapeShellArg "${name}.gitignore") templates)
+ }
do
echo "### $(basename "$file" .gitignore)" >> $out
cat "$file" >> $out
echo >> $out
done
- substituteInPlace $out ${lib.concatStringsSep " " (builtins.map (line: "--replace ${lib.escapeShellArg "# ${line}"} ${lib.escapeShellArg line}") toUncomment)}
+ substituteInPlace $out ${
+ lib.concatStringsSep " " (
+ builtins.map (
+ line: "--replace ${lib.escapeShellArg "# ${line}"} ${lib.escapeShellArg line}"
+ ) toUncomment
+ )
+ }
'';
}
diff --git a/pkgs/static/icons/default.nix b/pkgs/static/icons/default.nix
index 81acde6..0df7c12 100644
--- a/pkgs/static/icons/default.nix
+++ b/pkgs/static/icons/default.nix
@@ -1,15 +1,15 @@
{ fetchurl }:
{
- netflix = fetchurl {
- url = "https://www.vectorlogo.zone/logos/netflix/netflix-icon.svg";
- sha256 = "0i9211dsc8lrq8bvs9r217nwhfjcg84ja8b7lgqnza9ypv5lrqgs";
- };
- mubi = fetchurl {
- url = "https://mubi.com/MUBI-logo.png";
- sha256 = "0fc53c8j6dvphykabqiy146hjmpnczm5rvlf92fycyiqgrg260c4";
- };
- deezer = fetchurl {
- url = "https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/deezer.svg";
- sha256 = "0gjh30082jc1yapkccp4fb9y2sr1q26gbqdjh0dkp9ldr00vy0q6";
- };
+ netflix = fetchurl {
+ url = "https://www.vectorlogo.zone/logos/netflix/netflix-icon.svg";
+ sha256 = "0i9211dsc8lrq8bvs9r217nwhfjcg84ja8b7lgqnza9ypv5lrqgs";
+ };
+ mubi = fetchurl {
+ url = "https://mubi.com/MUBI-logo.png";
+ sha256 = "0fc53c8j6dvphykabqiy146hjmpnczm5rvlf92fycyiqgrg260c4";
+ };
+ deezer = fetchurl {
+ url = "https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/deezer.svg";
+ sha256 = "0gjh30082jc1yapkccp4fb9y2sr1q26gbqdjh0dkp9ldr00vy0q6";
+ };
}
diff --git a/pkgs/static/userjs/arkenfox/default.nix b/pkgs/static/userjs/arkenfox/default.nix
index 67dc77b..7650a34 100644
--- a/pkgs/static/userjs/arkenfox/default.nix
+++ b/pkgs/static/userjs/arkenfox/default.nix
@@ -1,7 +1,8 @@
-{fetchurl}: let
+{ fetchurl }:
+let
version = "135.0";
in
- fetchurl {
- url = "https://raw.githubusercontent.com/arkenfox/user.js/${version}/user.js";
- sha256 = "sha256-rPcH24YqEBOzoPB9yxMlke/3tqpi9L7GVMsZ3MUP8WY=";
- }
+fetchurl {
+ url = "https://raw.githubusercontent.com/arkenfox/user.js/${version}/user.js";
+ sha256 = "sha256-rPcH24YqEBOzoPB9yxMlke/3tqpi9L7GVMsZ3MUP8WY=";
+}
diff --git a/pkgs/static/userjs/thunderbird/default.nix b/pkgs/static/userjs/thunderbird/default.nix
index fada9dd..f08fa79 100644
--- a/pkgs/static/userjs/thunderbird/default.nix
+++ b/pkgs/static/userjs/thunderbird/default.nix
@@ -1,7 +1,8 @@
-{fetchurl}: let
+{ fetchurl }:
+let
version = "128.0";
in
- fetchurl {
- url = "https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/v${version}/user.js";
- sha256 = "sha256-V1cTcG52o24bF/0tki/c9+uOdpWaCxqZtIBoSqoQLYk=";
- }
+fetchurl {
+ url = "https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/v${version}/user.js";
+ sha256 = "sha256-V1cTcG52o24bF/0tki/c9+uOdpWaCxqZtIBoSqoQLYk=";
+}
diff --git a/pkgs/static/wallpapers/default.nix b/pkgs/static/wallpapers/default.nix
index a0efda3..7f228b9 100644
--- a/pkgs/static/wallpapers/default.nix
+++ b/pkgs/static/wallpapers/default.nix
@@ -3,7 +3,8 @@
fetchurl,
imagemagick,
lib,
-}: let
+}:
+let
fetchWallpaper = lib.makeOverridable (
{
name,
@@ -13,24 +14,24 @@
ratio ? "16:9",
gravity ? "center",
}:
- stdenv.mkDerivation {
- inherit name;
- src = fetchurl {
- inherit url sha256;
- };
- buildInputs = [imagemagick];
- phases = ["unpackPhase"];
- unpackPhase = ''
- convert "$src" -gravity '${gravity}' \
- -extent '${ratio}' \
- -resize '${resolution}!' \
- "$out"
- '';
- }
+ stdenv.mkDerivation {
+ inherit name;
+ src = fetchurl {
+ inherit url sha256;
+ };
+ buildInputs = [ imagemagick ];
+ phases = [ "unpackPhase" ];
+ unpackPhase = ''
+ convert "$src" -gravity '${gravity}' \
+ -extent '${ratio}' \
+ -resize '${resolution}!' \
+ "$out"
+ '';
+ }
);
sources = lib.importJSON ./sources.json;
in
- {
- fetcher = fetchWallpaper;
- }
- // builtins.mapAttrs (_: fetchWallpaper) sources
+{
+ fetcher = fetchWallpaper;
+}
+// builtins.mapAttrs (_: fetchWallpaper) sources
diff --git a/pkgs/watermark/default.nix b/pkgs/watermark/default.nix
index 6188ddb..5723516 100644
--- a/pkgs/watermark/default.nix
+++ b/pkgs/watermark/default.nix
@@ -6,7 +6,11 @@
}:
writeShellApplication {
name = "watermark";
- runtimeInputs = [coreutils imagemagick pdftk];
+ runtimeInputs = [
+ coreutils
+ imagemagick
+ pdftk
+ ];
text = ''
if [[ $1 == --help || $1 == -h ]]
then
diff --git a/templates/devenv/devenv.local.nix b/templates/devenv/devenv.local.nix
index 964692c..bfbad02 100644
--- a/templates/devenv/devenv.local.nix
+++ b/templates/devenv/devenv.local.nix
@@ -1,3 +1,4 @@
-{...}: {
+{ ... }:
+{
cachix.enable = false;
}
diff --git a/templates/devenv/devenv.nix b/templates/devenv/devenv.nix
index 3734b1c..e97b6f5 100644
--- a/templates/devenv/devenv.nix
+++ b/templates/devenv/devenv.nix
@@ -1,4 +1,5 @@
-{inputs, ...}: {
- imports = [inputs.my-nixpkgs.devenvModules.personal];
+{ inputs, ... }:
+{
+ imports = [ inputs.my-nixpkgs.devenvModules.personal ];
languages.nix.enable = true;
}