refact(modules) : better modules organisation + wip local-dev setup
This commit is contained in:
parent
3d092d8dd9
commit
0f6f08997d
4 changed files with 131 additions and 40 deletions
|
@ -1,11 +1,9 @@
|
||||||
|
# NixOS config entry point
|
||||||
# Generic NixOS config entry point
|
# import the hardware and configuration files specific to your machine
|
||||||
# point to the hardware and configuration files specific to your machine
|
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
./machines/MacBookPro12.1-hardware-configuration.nix
|
./machines/MacBookPro12.1-hardware-configuration.nix
|
||||||
./machines/MacBookPro12.1-configuration.nix
|
./machines/MacBookPro12.1-configuration.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Configure the Chromium browser with various useful things.
|
|
||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
environment.systemPackages = [
|
|
||||||
(pkgs.chromium.override {
|
|
||||||
enableWideVine = true; # DRM support (for Кинопоиск)
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.chromium = {
|
|
||||||
enable = true;
|
|
||||||
homepageLocation = "about:blank";
|
|
||||||
|
|
||||||
extensions = [
|
|
||||||
"pejkokffkapolfffcgbmdmhdelanoaih" # Unsplash instant
|
|
||||||
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
|
|
||||||
"gfapcejdoghpoidkfodoiiffaaibpaem" # Dracula theme
|
|
||||||
];
|
|
||||||
|
|
||||||
extraOpts = {
|
|
||||||
SpellcheckEnabled = true;
|
|
||||||
SpellcheckLanguage = [
|
|
||||||
"fr-FR"
|
|
||||||
"en-GB"
|
|
||||||
"ru"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -45,11 +45,26 @@ in
|
||||||
programs = {
|
programs = {
|
||||||
dconf.enable = true;
|
dconf.enable = true;
|
||||||
firefox.enable = true;
|
firefox.enable = true;
|
||||||
};
|
chromium = {
|
||||||
|
enable = true;
|
||||||
|
homepageLocation = "about:blank";
|
||||||
|
|
||||||
imports = [
|
extensions = [
|
||||||
./desktop-chromium.nix
|
"pejkokffkapolfffcgbmdmhdelanoaih" # Unsplash instant
|
||||||
];
|
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
|
||||||
|
"gfapcejdoghpoidkfodoiiffaaibpaem" # Dracula theme
|
||||||
|
];
|
||||||
|
|
||||||
|
extraOpts = {
|
||||||
|
SpellcheckEnabled = true;
|
||||||
|
SpellcheckLanguage = [
|
||||||
|
"fr-FR"
|
||||||
|
"en-GB"
|
||||||
|
"ru"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
@ -60,6 +75,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
# List packages installed in system profile. To search, run:
|
||||||
# $ nix search wget
|
# $ nix search wget
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
@ -79,6 +95,9 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
(chromium.override {
|
||||||
|
enableWideVine = true; # DRM support
|
||||||
|
})
|
||||||
bitwarden
|
bitwarden
|
||||||
chromium
|
chromium
|
||||||
element-desktop
|
element-desktop
|
||||||
|
|
|
@ -1,5 +1,108 @@
|
||||||
# Local developpement
|
# Local developpement
|
||||||
{ lib, pkgs, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
|
# let
|
||||||
|
# # # using pkgs2 to avoid recursive loop with fetchFromGitHub
|
||||||
|
# # # see https://stackoverflow.com/questions/73097604/nixos-how-to-import-some-configuration-from-gitlab-infinite-recursion-encounte
|
||||||
|
# # pkgs2 = (import <nixpkgs> { });
|
||||||
|
# # nix-phps = pkgs2.fetchFromGitHub {
|
||||||
|
# # owner = "fossar";
|
||||||
|
# # repo = "nix-phps";
|
||||||
|
# # rev = "ac2bb3d416a10fc66d0148dddc63a19c6c5a907c";
|
||||||
|
# # hash = "sha256-74kQIFf3Cu1aeOsohCiLuA1aXNGYt2U9tTUP0yvm4EA=";
|
||||||
|
# # };
|
||||||
|
# # phps = import nix-phps;
|
||||||
|
|
||||||
|
# # phpfpm pools with php version from nix-phps
|
||||||
|
# mkPhpFpm = phpXX:
|
||||||
|
# {
|
||||||
|
# name = phpXX;
|
||||||
|
# value = {
|
||||||
|
# user = config.services.caddy.user;
|
||||||
|
# group = config.services.caddy.group;
|
||||||
|
# phpPackage = phps.packages.${builtins.currentSystem}.${phpXX}.buildEnv {
|
||||||
|
# extensions = ({ enabled, all }: enabled ++ (with all; [
|
||||||
|
# xdebug
|
||||||
|
# ]));
|
||||||
|
# extraConfig = ''
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# settings = {
|
||||||
|
# "listen.owner" = config.services.caddy.user;
|
||||||
|
# "pm" = "dynamic";
|
||||||
|
# "pm.max_children" = 75;
|
||||||
|
# "pm.start_servers" = 10;
|
||||||
|
# "pm.min_spare_servers" = 5;
|
||||||
|
# "pm.max_spare_servers" = 20;
|
||||||
|
# "pm.max_requests" = 500;
|
||||||
|
# };
|
||||||
|
# phpOptions = ''
|
||||||
|
# display_errors = on
|
||||||
|
# error_reporting = E_ALL
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# phpfpmPools = builtins.listToAttrs (builtins.map mkPhpFpm [ "php73" "php74" "php80" "php81" ]);
|
||||||
|
|
||||||
|
# # caddy virtual hosts
|
||||||
|
# mkDot = list: (builtins.concatStringsSep "." list);
|
||||||
|
# mkVhost = { phpXX, root, sub }: rec {
|
||||||
|
# name = (mkDot [ sub phpXX "localhost" ]);
|
||||||
|
# value = {
|
||||||
|
# extraConfig =
|
||||||
|
# ''
|
||||||
|
# root * /var/www/${root}
|
||||||
|
# file_server browse
|
||||||
|
# php_fastcgi unix/${config.services.phpfpm.pools.${phpXX}.socket}
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# caddyLocalRootCert = builtins.readFile ./../_local/caddy.root.cert.pem;
|
||||||
|
# localDevConfig = builtins.fromJSON (builtins.readFile ./../_local/devconfig.json);
|
||||||
|
# caddyVhosts = builtins.listToAttrs (builtins.map mkVhost localDevConfig.hosts);
|
||||||
|
# # hosts.json example
|
||||||
|
# # {
|
||||||
|
# # "hosts":
|
||||||
|
# # [
|
||||||
|
# # { "sub": "project1", "phpXX": "php73", "root": "/project1/public" },
|
||||||
|
# # { "sub": "project2", "phpXX": "php81", "root": "/project2/www" }
|
||||||
|
# # ],
|
||||||
|
# # "databases": [ "db1", "db2"]
|
||||||
|
# # }
|
||||||
|
# in
|
||||||
|
{
|
||||||
|
# mailhog
|
||||||
|
services.mailhog = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# databases
|
||||||
|
services.mysql = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.mariadb;
|
||||||
|
ensureDatabases = ["yeswiki"];
|
||||||
|
initialScript = pkgs.writeText "mysql-init.sql" ''
|
||||||
|
CREATE USER 'root'@'localhost' IDENTIFIED BY 'secret';
|
||||||
|
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# services.postgresql = {
|
||||||
|
# enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# # phpfpm
|
||||||
|
# services.phpfpm.pools = phpfpmPools;
|
||||||
|
|
||||||
|
# # caddy webserver
|
||||||
|
# networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||||
|
# services.caddy = {
|
||||||
|
# enable = true;
|
||||||
|
# virtualHosts = caddyVhosts;
|
||||||
|
# };
|
||||||
|
# # caddy localhost root certificate
|
||||||
|
# security.pki.certificates = [ caddyLocalRootCert ];
|
||||||
|
|
||||||
|
}
|
||||||
{
|
{
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
docker.enable = true;
|
docker.enable = true;
|
||||||
|
@ -16,6 +119,7 @@
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(import (fetchTarball https://github.com/cachix/devenv/archive/v0.6.2.tar.gz)).default
|
(import (fetchTarball https://github.com/cachix/devenv/archive/v0.6.2.tar.gz)).default
|
||||||
direnv
|
direnv
|
||||||
|
docker_compose
|
||||||
virt-manager
|
virt-manager
|
||||||
zola
|
zola
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue