From 1b49cdba2c68d3147b73b3019da56701595c3386 Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Tue, 23 Jan 2024 22:52:57 +0300 Subject: [PATCH] wip local dev --- modules/desktop.nix | 1 + modules/local-dev.nix | 66 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/modules/desktop.nix b/modules/desktop.nix index 1543fde..5f4f701 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -144,6 +144,7 @@ in (chromium.override { enableWideVine = true; # DRM support }) + appimage-run audacious calibre digikam diff --git a/modules/local-dev.nix b/modules/local-dev.nix index 72d94c3..bc5eafd 100644 --- a/modules/local-dev.nix +++ b/modules/local-dev.nix @@ -1,6 +1,5 @@ # Local developpement -{ pkgs, config, lib, ... }: -{ +{ pkgs, config, lib, ... }: { virtualisation = { docker.enable = true; docker.rootless = { @@ -12,6 +11,68 @@ #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; [ @@ -19,6 +80,7 @@ docker-compose gcc gitkraken + nixfmt nodejs php83 php83Packages.composer