Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
Harald Hoyer 2024-11-19 10:31:29 +01:00
parent a3187e163d
commit 900f95169f
83 changed files with 1134 additions and 705 deletions

View file

@ -1,4 +1,11 @@
{ options, config, pkgs, lib, inputs, ... }:
{
options,
config,
pkgs,
lib,
inputs,
...
}:
with lib;
with lib.metacfg;
@ -11,10 +18,10 @@ in
# ];
options.metacfg.home = with types; {
file = mkOpt attrs { }
"A set of files to be managed by home-manager's <option>home.file</option>.";
configFile = mkOpt attrs { }
"A set of files to be managed by home-manager's <option>xdg.configFile</option>.";
file = mkOpt attrs { } "A set of files to be managed by home-manager's <option>home.file</option>.";
configFile =
mkOpt attrs { }
"A set of files to be managed by home-manager's <option>xdg.configFile</option>.";
extraOptions = mkOpt attrs { } "Options to pass directly to home-manager.";
homeConfig = mkOpt attrs { } "Final config for home-manager.";
};

View file

@ -1,11 +1,13 @@
{ options
, config
, pkgs
, lib
, ...
{
options,
config,
pkgs,
lib,
...
}:
with lib;
with lib.metacfg; let
with lib.metacfg;
let
cfg = config.metacfg.nix;
in
{
@ -24,7 +26,10 @@ in
nix =
let
users = [ "root" config.metacfg.user.name ];
users = [
"root"
config.metacfg.user.name
];
in
{
package = cfg.package;
@ -60,7 +65,9 @@ in
gc = {
automatic = true;
interval = { Day = 7; };
interval = {
Day = 7;
};
options = "--delete-older-than 30d";
user = config.metacfg.user.name;
};

View file

@ -1,4 +1,10 @@
{ lib, config, pkgs, inputs, ... }:
{
lib,
config,
pkgs,
inputs,
...
}:
let
inherit (lib) types mkEnableOption mkIf;
@ -21,9 +27,7 @@ in
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
gnupg
];
environment.systemPackages = with pkgs; [ gnupg ];
environment.shellInit = ''
export GPG_TTY="$(tty)"

View file

@ -1,8 +1,9 @@
{ options
, config
, lib
, pkgs
, ...
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.metacfg;
@ -37,7 +38,10 @@ in
wget
starship
];
shells = [ pkgs.fish pkgs.bash ];
shells = [
pkgs.fish
pkgs.bash
];
};
programs = {

View file

@ -11,7 +11,5 @@ in
enable = mkOpt types.bool true "Whether to enable the Nix daemon.";
};
config = mkIf cfg.enable {
services.nix-daemon = enabled;
};
config = mkIf cfg.enable { services.nix-daemon = enabled; };
}

View file

@ -1,4 +1,10 @@
{ options, config, lib, pkgs, ... }:
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.metacfg;

View file

@ -1,8 +1,15 @@
{ options, config, pkgs, lib, ... }:
{
options,
config,
pkgs,
lib,
...
}:
with lib;
with lib.metacfg;
let cfg = config.metacfg.system.fonts;
let
cfg = config.metacfg.system.fonts;
in
{
options.metacfg.system.fonts = with types; {
@ -17,14 +24,16 @@ in
};
fonts = {
packages = with pkgs;
packages =
with pkgs;
[
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
(nerdfonts.override { fonts = [ "Hack" ]; })
] ++ cfg.fonts;
]
++ cfg.fonts;
};
};
}

View file

@ -1,8 +1,15 @@
{ options, config, pkgs, lib, ... }:
{
options,
config,
pkgs,
lib,
...
}:
with lib;
with lib.metacfg;
let cfg = config.metacfg.system.interface;
let
cfg = config.metacfg.system.interface;
in
{
options.metacfg.system.interface = with types; {
@ -10,25 +17,26 @@ in
};
config = mkIf cfg.enable {
system.activationScripts.applications.text = let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
in
system.activationScripts.applications.text =
let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
in
lib.mkForce ''
# Set up applications.
echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
# Set up applications.
echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
system.defaults = {
dock.autohide = true;

View file

@ -1,7 +1,8 @@
{ lib
, config
, pkgs
, ...
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) types mkIf mkDefault;