I tried adding mariadb
to devShell buildInputs
, and when I tried to run the binary, it failed to create the necessary files, which is understandable.
So I googled on how to install mariadb
on nixos, and it turned out that adding
services.mysql.package = pkgs.mariadb;
services.mysql.enable = true;
is supposed to resolve the issue. Which it did, when I used it in my ./configuration.nix
So, I tried putting it into the flake I was creating
{
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
packages = with pkgs; [ mariadb ];
in {
devShell = pkgs.mkShell { buildInputs = packages; };
services.mysql.package = pkgs.mariadb;
services.mysql.enable = true;
});
}
But, that didn’t do anything, so I tried following the same “pattern” that I have in my systems flake.nix
, which has the configuration.nix
as a module
, which resulted in this ?
{
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
packages = with pkgs; [ mariadb ];
user = "albert";
system = "x86_64-linux";
in {
devShell = pkgs.mkShell { buildInputs = packages; };
nixosConfigurations = {
${user} = nixpkgs.lib.nixosSystem {
inherit system;
modules = [{
services.mysql.package = pkgs.mariadb;
services.mysql.enable = true;
}];
};
};
});
}
At the end of the day, that didn’t work, and I am confused to why. Could anyone help me ?
I am sorry, I am relatively new to nix, and it appears some basic concepts are escaping me