module overhaul
module
This commit is contained in:
parent
8fe3ddc38e
commit
ae78cb7026
12 changed files with 1127 additions and 164 deletions
|
@ -1,9 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
pkg = pkgs.caddy;
|
||||
args = "run -c %CFG% --adapter caddyfile";
|
||||
config = ''
|
||||
http://*:8080 {
|
||||
respond "hello"
|
||||
}
|
||||
'';
|
||||
# simplest possible concrete service definition
|
||||
serviceDefs.caddy = {
|
||||
pkg = pkgs.caddy;
|
||||
args = "run -c %CFG% --adapter caddyfile";
|
||||
config.text = ''
|
||||
http://*:8888 {
|
||||
respond "hello"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,20 +1,53 @@
|
|||
{
|
||||
|
||||
inputs = {
|
||||
ides.url = "git+https://git.atagen.co/atagen/ides";
|
||||
};
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
ides,
|
||||
...
|
||||
}: let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
mkShell = ides.lib.use pkgs;
|
||||
in {
|
||||
devShells.x86_64-linux.default = mkShell {
|
||||
noCC = true;
|
||||
services = {
|
||||
caddy = import ./caddy.nix;
|
||||
|
||||
outputs =
|
||||
{
|
||||
nixpkgs,
|
||||
ides,
|
||||
...
|
||||
}:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
||||
# create an instance of ides to spawn shells from
|
||||
mkIdes = import ides {
|
||||
# ides needs a pkgs instance to work with in flake mode
|
||||
inherit pkgs;
|
||||
|
||||
# all other args here are optional
|
||||
|
||||
# shell function to wrap -
|
||||
# could also use pkgs.mkShellNoCC, but override demonstrates
|
||||
# more clearly how to change any aspect of the shell
|
||||
shell = pkgs.mkShell.override {
|
||||
stdenv = pkgs.stdenvNoCC;
|
||||
};
|
||||
|
||||
# input for extra modules that provide service options
|
||||
# see modules/redis.nix in ides source for example
|
||||
modules = [ ];
|
||||
# if you want to include a premade service def,
|
||||
# use `imports` in the shell instead
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.x86_64-linux.default = mkIdes {
|
||||
# import a concrete service definition
|
||||
imports = [ ./caddy.nix ];
|
||||
# use the options provided by a module
|
||||
services.redis = {
|
||||
enable = true;
|
||||
port = 6889;
|
||||
logLevel = "verbose";
|
||||
};
|
||||
# use normal mkShell options
|
||||
nativeBuildInputs = [ pkgs.hello ];
|
||||
someEnv = "this";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,41 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
ides = import (fetchGit {
|
||||
pkgs = import <nixpkgs> { };
|
||||
|
||||
ides = fetchGit {
|
||||
url = "https://git.atagen.co/atagen/ides";
|
||||
});
|
||||
mkShell = ides.use pkgs;
|
||||
};
|
||||
|
||||
# create an instance of ides to spawn shells from
|
||||
mkIdes = import ides {
|
||||
# all args here are optional
|
||||
|
||||
# define the pkgs instance to work with
|
||||
inherit pkgs;
|
||||
|
||||
# shell function to wrap -
|
||||
# could also use pkgs.mkShellNoCC, but override demonstrates
|
||||
# more clearly how to change any aspect of the shell
|
||||
shell = pkgs.mkShell.override {
|
||||
stdenv = pkgs.stdenvNoCC;
|
||||
};
|
||||
|
||||
# input for extra modules that provide service options
|
||||
# see modules/redis.nix in ides source for example
|
||||
modules = [ ];
|
||||
# if you want to include a premade service def,
|
||||
# use `imports` in the shell instead
|
||||
};
|
||||
in
|
||||
mkShell {
|
||||
noCC = true;
|
||||
services.caddy = import ./caddy.nix;
|
||||
}
|
||||
mkIdes {
|
||||
# import a concrete service definition
|
||||
imports = [ ./caddy.nix ];
|
||||
# use the options provided by a module
|
||||
services.redis = {
|
||||
enable = true;
|
||||
port = 6889;
|
||||
logLevel = "verbose";
|
||||
};
|
||||
# use normal mkShell options
|
||||
nativeBuildInputs = [ pkgs.hello ];
|
||||
someEnv = "this";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue