huge refactor
This commit is contained in:
parent
03e5a47910
commit
1d4c8455ee
30 changed files with 972 additions and 697 deletions
245
moduler/programs/base/default.nix
Normal file
245
moduler/programs/base/default.nix
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
fhsEnv =
|
||||
let
|
||||
base = pkgs.appimageTools.defaultFhsEnvArgs;
|
||||
in
|
||||
pkgs.buildFHSEnv (
|
||||
base
|
||||
// {
|
||||
name = "fhs";
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
(base.targetPkgs pkgs)
|
||||
++ (with pkgs; [
|
||||
pkg-config
|
||||
ncurses
|
||||
icu
|
||||
]);
|
||||
profile = "export FHS=1";
|
||||
runScript = "bash";
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
options.features.base = {
|
||||
enable = mkEnableOption "enable shared base programs";
|
||||
preset = mkOption {
|
||||
type = types.enum [
|
||||
"minimal"
|
||||
"standard"
|
||||
"full"
|
||||
];
|
||||
default = "standard";
|
||||
description = "Preset for desktop package groups.";
|
||||
};
|
||||
udevEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable custom udev rules and device packages.";
|
||||
};
|
||||
mimeEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable Home Manager MIME defaults.";
|
||||
};
|
||||
packages = {
|
||||
communicationEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install communication desktop apps.";
|
||||
};
|
||||
mediaEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install media apps.";
|
||||
};
|
||||
browsersEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install browsers.";
|
||||
};
|
||||
captureEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install screen capture tools.";
|
||||
};
|
||||
creativeEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install conversion/creative tools.";
|
||||
};
|
||||
devDesktopEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install desktop dev helper tools and VMs.";
|
||||
};
|
||||
dbeaverEnable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Install dbeaver and FHS shell.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf (config.features.base.preset == "minimal") {
|
||||
features.base.packages.communicationEnable = mkDefault false;
|
||||
features.base.packages.mediaEnable = mkDefault false;
|
||||
features.base.packages.browsersEnable = mkDefault true;
|
||||
features.base.packages.captureEnable = mkDefault false;
|
||||
features.base.packages.creativeEnable = mkDefault false;
|
||||
features.base.packages.devDesktopEnable = mkDefault false;
|
||||
features.base.packages.dbeaverEnable = mkDefault false;
|
||||
})
|
||||
|
||||
(mkIf (config.features.base.preset == "full") {
|
||||
features.base.packages.communicationEnable = mkDefault true;
|
||||
features.base.packages.mediaEnable = mkDefault true;
|
||||
features.base.packages.browsersEnable = mkDefault true;
|
||||
features.base.packages.captureEnable = mkDefault true;
|
||||
features.base.packages.creativeEnable = mkDefault true;
|
||||
features.base.packages.devDesktopEnable = mkDefault true;
|
||||
features.base.packages.dbeaverEnable = mkDefault true;
|
||||
})
|
||||
|
||||
(mkIf config.features.base.enable {
|
||||
services.udev = mkIf config.features.base.udevEnable {
|
||||
extraRules = ''
|
||||
KERNEL=="ttyACM0", MODE:="666"
|
||||
ACTION=="add", KERNEL=="sd[a-e][0-9]", ENV{ID_FS_UUID}=="3039-3932", RUN+="${pkgs.systemd}/bin/systemd-mount --no-block -A -G -o gid=users,fmask=113,dmask=002 /dev/%k /mnt/sdcard"
|
||||
ACTION=="add", KERNEL=="sd[a-e]", ENV{ID_FS_UUID}=="66BA-4EBA", RUN+="${pkgs.systemd}/bin/systemd-mount --no-block -A -G -o gid=users,fmask=113,dmask=002 /dev/%k /mnt/kobo"
|
||||
KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
|
||||
'';
|
||||
packages = with pkgs; [
|
||||
vial
|
||||
via
|
||||
];
|
||||
};
|
||||
|
||||
home-manager.users.fw = mkIf config.features.base.mimeEnable {
|
||||
xdg.mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"text/html" = "librewolf.desktop";
|
||||
"x-scheme-handler/http" = "librewolf.desktop";
|
||||
"x-scheme-handler/https" = "librewolf.desktop";
|
||||
"x-scheme-handler/about" = "librewolf.desktop";
|
||||
"x-scheme-handler/unknown" = "librewolf.desktop";
|
||||
"text/plain" = "nvim.desktop";
|
||||
"text/markdown" = "nvim.desktop";
|
||||
"text/x-markdown" = "nvim.desktop";
|
||||
"application/json" = "nvim.desktop";
|
||||
"application/x-ndjson" = "nvim.desktop";
|
||||
"application/x-yaml" = "nvim.desktop";
|
||||
"text/yaml" = "nvim.desktop";
|
||||
"text/x-shellscript" = "nvim.desktop";
|
||||
"text/x-python" = "nvim.desktop";
|
||||
"text/x-csrc" = "nvim.desktop";
|
||||
"text/x-c++src" = "nvim.desktop";
|
||||
"application/x-sql" = "nvim.desktop";
|
||||
"text/xml" = "nvim.desktop";
|
||||
"application/xml" = "nvim.desktop";
|
||||
"application/pdf" = "org.gnome.Evince.desktop";
|
||||
"image/jpeg" = "feh.desktop";
|
||||
"image/png" = "feh.desktop";
|
||||
"image/gif" = "feh.desktop";
|
||||
"image/webp" = "feh.desktop";
|
||||
"image/tiff" = "feh.desktop";
|
||||
"image/bmp" = "feh.desktop";
|
||||
"image/svg+xml" = "feh.desktop";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.sessionVariables.DEFAULT_BROWSER = "${pkgs.librewolf}/bin/librewolf";
|
||||
|
||||
environment.systemPackages =
|
||||
(with pkgs; [
|
||||
codex
|
||||
ipcalc
|
||||
remmina
|
||||
brightnessctl
|
||||
speedcrunch
|
||||
lagrange
|
||||
jujutsu
|
||||
rclone
|
||||
zathura
|
||||
feh
|
||||
pavucontrol
|
||||
pulseaudio
|
||||
devour
|
||||
caligula
|
||||
ptouch-print
|
||||
])
|
||||
++ optionals config.features.base.packages.communicationEnable (
|
||||
with pkgs;
|
||||
[
|
||||
signal-desktop
|
||||
thunderbird
|
||||
discord
|
||||
slack
|
||||
]
|
||||
)
|
||||
++ optionals config.features.base.packages.mediaEnable (
|
||||
with pkgs;
|
||||
[
|
||||
feishin
|
||||
spotify
|
||||
mpv
|
||||
]
|
||||
)
|
||||
++ optionals config.features.base.packages.browsersEnable (
|
||||
with pkgs;
|
||||
[
|
||||
librewolf
|
||||
firefox
|
||||
]
|
||||
)
|
||||
++ optionals config.features.base.packages.captureEnable (
|
||||
with pkgs;
|
||||
[
|
||||
wf-recorder
|
||||
slurp
|
||||
]
|
||||
)
|
||||
++ optionals config.features.base.packages.creativeEnable (
|
||||
with pkgs;
|
||||
[
|
||||
yt-dlp
|
||||
imagemagick
|
||||
pandoc
|
||||
pinta
|
||||
pastel
|
||||
ffmpeg
|
||||
]
|
||||
)
|
||||
++ optionals config.features.base.packages.devDesktopEnable (
|
||||
with pkgs;
|
||||
[
|
||||
vscode
|
||||
opencode
|
||||
quickemu
|
||||
virt-viewer
|
||||
go-passbolt-cli
|
||||
bitwarden-desktop
|
||||
bitwarden-cli
|
||||
]
|
||||
)
|
||||
++ optionals config.features.base.packages.dbeaverEnable (
|
||||
with pkgs;
|
||||
[
|
||||
dbeaver-bin
|
||||
fhsEnv
|
||||
]
|
||||
);
|
||||
})
|
||||
];
|
||||
}
|
||||
109
moduler/programs/dev/default.nix
Normal file
109
moduler/programs/dev/default.nix
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
azPkgs = inputs.nixpkgs-azure-cli.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.features.dev = {
|
||||
enable = mkEnableOption "enable development toolchain";
|
||||
preset = mkOption {
|
||||
type = types.enum [
|
||||
"minimal"
|
||||
"standard"
|
||||
"full"
|
||||
];
|
||||
default = "standard";
|
||||
description = "Preset for development package groups.";
|
||||
};
|
||||
cloud = {
|
||||
aws.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable AWS CLI tools.";
|
||||
};
|
||||
azure.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable Azure CLI tools.";
|
||||
};
|
||||
minio.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable MinIO client.";
|
||||
};
|
||||
};
|
||||
tools = {
|
||||
docker.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable lazydocker.";
|
||||
};
|
||||
python.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable Python runtime package.";
|
||||
};
|
||||
opentofu.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable OpenTofu package.";
|
||||
};
|
||||
git.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable git package in dev toolchain.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf config.features.dev.enable {
|
||||
environment.systemPackages =
|
||||
(with pkgs; [
|
||||
nixfmt-rfc-style
|
||||
gh
|
||||
yq
|
||||
jq
|
||||
])
|
||||
++ optionals config.features.dev.tools.docker.enable (with pkgs; [ lazydocker ])
|
||||
++ optionals config.features.dev.cloud.aws.enable (with pkgs; [ awscli ])
|
||||
++ optionals config.features.dev.cloud.minio.enable (with pkgs; [ minio-client ])
|
||||
++ optionals config.features.dev.tools.opentofu.enable (with pkgs; [ opentofu ])
|
||||
++ optionals config.features.dev.tools.python.enable (with pkgs; [ python3 ])
|
||||
++ optionals config.features.dev.cloud.azure.enable [
|
||||
(azPkgs.azure-cli.withExtensions (
|
||||
with azPkgs.azure-cli.extensions;
|
||||
[
|
||||
fzf
|
||||
]
|
||||
))
|
||||
]
|
||||
++ optionals config.features.dev.tools.git.enable (with pkgs; [ git ]);
|
||||
})
|
||||
|
||||
(mkIf (config.features.dev.preset == "minimal") {
|
||||
features.dev.cloud.aws.enable = mkDefault false;
|
||||
features.dev.cloud.azure.enable = mkDefault false;
|
||||
features.dev.cloud.minio.enable = mkDefault false;
|
||||
features.dev.tools.docker.enable = mkDefault false;
|
||||
features.dev.tools.opentofu.enable = mkDefault false;
|
||||
features.dev.tools.python.enable = mkDefault false;
|
||||
})
|
||||
|
||||
(mkIf (config.features.dev.preset == "full") {
|
||||
features.dev.cloud.aws.enable = mkDefault true;
|
||||
features.dev.cloud.azure.enable = mkDefault true;
|
||||
features.dev.cloud.minio.enable = mkDefault true;
|
||||
features.dev.tools.docker.enable = mkDefault true;
|
||||
features.dev.tools.opentofu.enable = mkDefault true;
|
||||
features.dev.tools.python.enable = mkDefault true;
|
||||
features.dev.tools.git.enable = mkDefault true;
|
||||
})
|
||||
];
|
||||
}
|
||||
45
moduler/programs/git/default.nix
Normal file
45
moduler/programs/git/default.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ lib, config, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.features.git = {
|
||||
enable = mkEnableOption "enable git defaults";
|
||||
userName = mkOption {
|
||||
type = types.str;
|
||||
default = "fwastring";
|
||||
description = "Default git user.name.";
|
||||
};
|
||||
userEmail = mkOption {
|
||||
type = types.str;
|
||||
default = "fredrik@wastring.com";
|
||||
description = "Default git user.email.";
|
||||
};
|
||||
pullRebase = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable pull.rebase by default.";
|
||||
};
|
||||
githubSshInsteadOfHttps = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use SSH for GitHub remotes when cloning with HTTPS URLs.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.features.git.enable {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
config = {
|
||||
user = {
|
||||
name = config.features.git.userName;
|
||||
email = config.features.git.userEmail;
|
||||
};
|
||||
pull = {
|
||||
rebase = config.features.git.pullRebase;
|
||||
};
|
||||
}
|
||||
// optionalAttrs config.features.git.githubSshInsteadOfHttps {
|
||||
url."git@github.com:".insteadOf = "https://github.com/";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue