nixos-config/modules/local-dev.nix
Florian Schmitt 1b49cdba2c wip local dev
2024-01-30 23:01:47 +03:00

95 lines
2.4 KiB
Nix

# Local developpement
{ pkgs, config, lib, ... }: {
virtualisation = {
docker.enable = true;
docker.rootless = {
enable = true;
setSocketVariable = true;
};
libvirtd.enable = true;
lxd.enable = true;
#waydroid.enable = true;
};
systemd.services.yeswikidev = {
enable = true;
script = ''
${pkgs.systemd}/bin/systemctl start mysql
# etc
'';
serviceConfig = let
startstop = command:
(pkgs.writeShellApplication {
name = "yeswikidev";
runtimeInputs = with pkgs; [ systemd ];
text = ''
systemctl ${command} mysql.service
'';
});
#startstopFullShell = pkgs.writeShellApplication {
# name = "yeswikidev";
# runtimeInputs = with pkgs; [ systemd ];
# text = ''
# systemctl "$1" mysql.service
# '';
#});
#commands = [ "start" "stop" ];
#scripts = map (command: (pkgs.writeShellApplication {
# name = "yeswikidev";
# runtimeInputs = with pkgs; [ systemd ];
# text = ''
# systemctl ${command} mysql.service
# '';
#})) commands;
#execs = {
# ExecStart = "start";
# ExecStop = "stop";
#};
# https://nixos.org/manual/nix/stable/language/builtins
# https://nixos.org/manual/nix/stable/language/builtins#builtins-mapAttrs
#execAttrs = attrNames execs; # ["Start" "Stop"];
#execs2 = mapAttrs (k: v: ()) execs;
in {
# pkgs.writeScript, pkgs.writeScriptBin
#ExecStart = startstop "start";
#ExecStop = startstop "stop";
# OR
# ExecStart = "${startstopFullShell} start";
# ExecStop = "${startstopFullShell} stop";
# OR
# ExecStart = "${scripts[0]}";
# ExecStop = "${scripts[1]}";
};
};
services.mysql = {
package = pkgs.mariadb;
ensureDatabases = [ "yeswiki-db" ];
ensureUsers = [{
name = "yeswiki-db-user";
ensurePermissions = { "yeswiki-db" = "ALL PRIVILEGES"; };
}];
};
systemd.services.mysql.wantedBy = lib.mkForce [];
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
clang
docker-compose
gcc
gitkraken
nixfmt
nodejs
php83
php83Packages.composer
php83Packages.php-cs-fixer
python311Packages.virtualenv
rpi-imager
symfony-cli
virt-manager
yarn
zig
];
}