Skip to content

Commit

Permalink
feat(home): add 'graphical' option
Browse files Browse the repository at this point in the history
  • Loading branch information
tiborpilz committed Jul 6, 2024
1 parent 92b148b commit ac21963
Show file tree
Hide file tree
Showing 35 changed files with 643 additions and 599 deletions.
9 changes: 5 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
inherit lib inputs;
pkgs = channels.nixpkgs;
}))) // {
default = packages.bw2pass;
};
default = packages.bw2pass;
};


apps = (lib.mapAttrs' (name: value: { inherit name; value = lib.my.mkApp value; }) packages) // {
Expand Down Expand Up @@ -147,8 +147,9 @@
}
];
};
aliasConfigurations = lib.foldr (curr: prev: prev // { "${curr}" = homeConfiguration; }) {} aliases;
in { "${user}" = homeConfiguration; } // aliasConfigurations
aliasConfigurations = lib.foldr (curr: prev: prev // { "${curr}" = homeConfiguration; }) { } aliases;
in
{ "${user}" = homeConfiguration; } // aliasConfigurations
));

nixosModules = lib.my.mapModulesRec (toString ./modules) import;
Expand Down
2 changes: 1 addition & 1 deletion home/config/doom/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stdenv.mkDerivation {
inherit version;
src = lib.sourceByRegex ./. [ "config.org" "init.el" ];

buildInputs = [emacs];
buildInputs = [ emacs ];

buildPhase = ''
cp $src/* .
Expand Down
245 changes: 126 additions & 119 deletions home/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, pkgs, lib, ... }:
{ inputs, pkgs, lib, config, ... }:

with lib;

Expand All @@ -9,147 +9,154 @@ with mylib;
{
imports = mylib.mapModulesRec' (toString ./modules) import;

home.stateVersion = "23.11";
options.graphical = mkBoolOpt true;

fonts = {
fontconfig.enable = true;
};
config = {
home.stateVersion = "23.11";

home.packages = with pkgs; [
# TODO: move fonts to own module
(nerdfonts.override { fonts = [ "FiraCode" ]; })
etBook
dejavu_fonts
fonts = {
fontconfig.enable = true;
};

# Need later version of bash for nix-shell to work correctly on macos
bash
home.packages = with pkgs; [
# TODO: move fonts to own module
(nerdfonts.override { fonts = [ "FiraCode" ]; })
etBook
dejavu_fonts

# Setuptools is missing from python
python3Packages.setuptools
# Need later version of bash for nix-shell to work correctly on macos
bash

# GNU Parallel my beloved
parallel
# Setuptools is missing from python
python3Packages.setuptools

# C stuff
gnumake
gcc
# GNU Parallel my beloved
parallel

# Task runner
just
# C stuff
gnumake
gcc

# bat is a better cat (as a program, at least)
bat
# Task runner
just

# mob.sh - git-powered pair/mob programming tool
mob
# bat is a better cat (as a program, at least)
bat

htop
# mob.sh - git-powered pair/mob programming tool
mob

pandoc
htop

# PHP & composer
php82
php82Packages.composer
pandoc

# Bun is a Node alternative
unstable.bun
# PHP & composer
php82
php82Packages.composer

esbuild
# Bun is a Node alternative
unstable.bun

# Latex stuff TODO: move to a module
# texlive.combined.scheme-full
# GNU roff - typesetting, pdf converting stuff
groff
esbuild

# Haskell
cabal-install
ghc
];
# Latex stuff TODO: move to a module
# texlive.combined.scheme-full
# GNU roff - typesetting, pdf converting stuff
groff

# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Haskell
cabal-install
ghc
];

# Regardlass of whether I'm using Bash (I'm not),
# I need an up-to-date binary for nix-shell and some other settings in ".profile" that
# are only there when `bash` is enabled.
# programs.bash.enable = true;
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;

programs.man.enable = true;
home.file.test-graphical = {
text =
if config.graphical
then "Graphical :D"
else "Not Graphical :(";
};

modules.scripts.enable = true;
# Regardlass of whether I'm using Bash (I'm not),
# I need an up-to-date binary for nix-shell and some other settings in ".profile" that
# are only there when `bash` is enabled.
# programs.bash.enable = true;

modules.shell.zsh.enable = true;
modules.shell.zsh.aliases.ungron = "gron --ungron";
programs.man.enable = true;

modules.shell.tmux.enable = true;
modules.shell.gnupg = {
enable = true;
public_key = "03746612698994281D322B09923BC5E9B4E9509B";
keygrip = "1050A7CD50EAFCD36E696470775BC39D6FFA47A4";
};
modules.scripts.enable = true;

modules.shell.git.enable = true;
modules.shell.direnv.enable = true;

modules.editors.neovim.enable = true;
modules.editors.emacs.enable = true;
modules.editors.emacs.useNix = false;

modules.dev.rust.enable = true;
modules.dev.web.enable = true;
modules.dev.jsonnet.enable = true;
modules.dev.dhall.enable = true;
modules.dev.cloud.enable = true;

modules.dev.colima.enable = pkgs.stdenv.isDarwin; # I only need a docker runtime on MacOs

# Bit of a catch-all for LSP stuff until I find a better spot
# without having to create a new module for every one
modules.editors.lsp.enable = true;

modules.tools.vagrant.enable = false;
modules.tools.podman.enable = true;

modules.syncthing.enable = true;

modules.bitwarden.enable = false;
modules.password-store.enable = true;

modules.colorschemes.enable = false;

modules.tools.container.enable = true;
modules.tools.aws.enable = true;

modules.terminal.kitty.enable = true;

modules.shell.manix.enable = true;

nix = {
registry.nixpkgs.flake = inputs.nixpkgs;
settings = {
build-users-group = "nixbld";
experimental-features = [ "nix-command flakes" ];
cores = 0;
max-jobs = "32";
trusted-users = [ "root" "tibor" "tibor.pilz" ];
trusted-substituters = [ "https://cache.nixos.org/" "https://tiborpilz.cachix.org/" ];
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org/"
"https://tiborpilz.cachix.org/"
"https://cache.garnix.io"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"tiborpilz.cachix.org-1:KyBjAXY8eblxntQ+OG13IjT+M222VxT+25yw1lqnQS4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
system-features = [ "big-parallel" "kvm" "recursive-nix" ];
modules.shell.zsh.enable = true;
modules.shell.zsh.aliases.ungron = "gron --ungron";

modules.shell.tmux.enable = true;
modules.shell.gnupg = {
enable = true;
public_key = "03746612698994281D322B09923BC5E9B4E9509B";
keygrip = "1050A7CD50EAFCD36E696470775BC39D6FFA47A4";
};
};

# Copy Nix-installed MacOS applications to the home application folder, while resolving symlinks
# This is due to spotlight not resolving symlinks for some reason
# TODO: check if this will still work with a nix-managed doom config
modules.shell.git.enable = true;
modules.shell.direnv.enable = true;

modules.editors.neovim.enable = true;
modules.editors.emacs.enable = true;
modules.editors.emacs.useNix = false;

modules.dev.rust.enable = true;
modules.dev.web.enable = true;
modules.dev.jsonnet.enable = true;
modules.dev.dhall.enable = true;
modules.dev.cloud.enable = true;

modules.dev.colima.enable = pkgs.stdenv.isDarwin; # I only need a docker runtime on MacOs

# Bit of a catch-all for LSP stuff until I find a better spot
# without having to create a new module for every one
modules.editors.lsp.enable = true;

modules.tools.vagrant.enable = false;
modules.tools.podman.enable = true;

modules.syncthing.enable = true;

modules.bitwarden.enable = false;
modules.password-store.enable = true;

modules.colorschemes.enable = false;

modules.tools.container.enable = true;
modules.tools.aws.enable = true;

modules.terminal.kitty.enable = true;

modules.shell.manix.enable = true;

nix = {
registry.nixpkgs.flake = inputs.nixpkgs;
settings = {
build-users-group = "nixbld";
experimental-features = [ "nix-command flakes" ];
cores = 0;
max-jobs = "32";
trusted-users = [ "root" "tibor" "tibor.pilz" ];
trusted-substituters = [ "https://cache.nixos.org/" "https://tiborpilz.cachix.org/" ];
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org/"
"https://tiborpilz.cachix.org/"
"https://cache.garnix.io"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"tiborpilz.cachix.org-1:KyBjAXY8eblxntQ+OG13IjT+M222VxT+25yw1lqnQS4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
system-features = [ "big-parallel" "kvm" "recursive-nix" ];
};
};
};
}
3 changes: 2 additions & 1 deletion home/modules/bitwarden.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ with lib;
let
cfg = config.modules.bitwarden;
mylib = import ../../lib { inherit inputs pkgs lib; };
in {
in
{
options.modules.bitwarden = {
enable = mylib.mkBoolOpt false;
};
Expand Down
6 changes: 4 additions & 2 deletions home/modules/editors/emacs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ in
# home.sessionVariables.DOOMDIR = (if !cfg.useNix then "${config.home.homeDirectory}/.config/nixos/home/config/doom" else "");

home.activation.installDoomEmacs =
let activationScript = ''
let
activationScript = ''
if [ ! -d ".config/emacs" ]; then
${pkgs.git}/bin/git clone --depth=1 --single-branch https://github.com/doomemacs/doomemacs ".config/emacs"
fi
Expand All @@ -128,6 +129,7 @@ in
# fi
# .config/emacs/bin/doom sync
'';
in (lib.hm.dag.entryAfter ["WriteBoundary"] (if cfg.useNix then "" else activationScript ));
in
(lib.hm.dag.entryAfter [ "WriteBoundary" ] (if cfg.useNix then "" else activationScript));
};
}
2 changes: 1 addition & 1 deletion home/modules/editors/lsp.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, pkgs, inputs, config, ...}:
{ lib, pkgs, inputs, config, ... }:
with lib;
let
cfg = config.modules.editors.lsp;
Expand Down
2 changes: 1 addition & 1 deletion home/modules/gui/terminal/alacritty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

let
cfg = config.modules.alacritty;
in
in
with lib;
{
# options.modules.gui.alacritty = {
Expand Down
3 changes: 2 additions & 1 deletion home/modules/password-store.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ with lib;
let
cfg = config.modules.password-store;
mylib = import ../../lib { inherit inputs lib pkgs; };
in {
in
{
options.modules.password-store = {
enable = mylib.mkBoolOpt false;
enable-sync = mylib.mkBoolOpt false;
Expand Down
18 changes: 10 additions & 8 deletions home/modules/shell/gnupg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ in

# Automatically import public key from keyserver and, if connected, yubikey
home.activation = {
importGpgKeys = let
gpg = "${pkgs.gnupg}/bin/gpg";
keyid = cfg.public_key;
in mkIf (cfg.public_key != "")
(lib.hm.dag.entryAfter [ "linkGeneration"] ''
${gpg} --list-keys ${keyid} > /dev/null 2>&1 || ${gpg} --recv-keys ${keyid} > /dev/null 2>&1 || echo "Error during gpg import: No key!"
${gpg} --list-secret-keys ${keyid} > /dev/null 2>&1 || ${gpg} --card-status > /dev/null 2>&1 || echo "Error during gpg import: No card!"
'');
importGpgKeys =
let
gpg = "${pkgs.gnupg}/bin/gpg";
keyid = cfg.public_key;
in
mkIf (cfg.public_key != "")
(lib.hm.dag.entryAfter [ "linkGeneration" ] ''
${gpg} --list-keys ${keyid} > /dev/null 2>&1 || ${gpg} --recv-keys ${keyid} > /dev/null 2>&1 || echo "Error during gpg import: No key!"
${gpg} --list-secret-keys ${keyid} > /dev/null 2>&1 || ${gpg} --card-status > /dev/null 2>&1 || echo "Error during gpg import: No card!"
'');
};

home.file.".gnupg/gpg-agent.conf" = {
Expand Down
Loading

0 comments on commit ac21963

Please sign in to comment.