nixdirfmt + getAlias function

This commit is contained in:
kat witch 2021-08-30 03:31:55 +01:00
parent 589bef29fa
commit 5da38c626d
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
7 changed files with 89 additions and 83 deletions

View file

@ -1,57 +1,59 @@
{ config, tf, meta, kw, pkgs, lib, sources, ... }: with lib; let
oci-root = meta.deploy.targets.oci-root.tf;
addr_ipv6_nix = let
prefix = head (splitString "/" (oci-root.resources.oci_kw_subnet.importAttr "ipv6cidr_block"));
in assert hasSuffix "::" prefix; prefix + "7";
addr_ipv6_nix =
let
prefix = head (splitString "/" (oci-root.resources.oci_kw_subnet.importAttr "ipv6cidr_block"));
in
assert hasSuffix "::" prefix; prefix + "7";
in
{
imports = (with (import (sources.tf-nix + "/modules")); [
nixos.ubuntu-linux
nixos.oracle
./oracle.nix
]) ++ (with meta; [
services.knot
services.nginx
]);
{
imports = (with (import (sources.tf-nix + "/modules")); [
nixos.ubuntu-linux
nixos.oracle
./oracle.nix
]) ++ (with meta; [
services.knot
services.nginx
]);
services.nginx.virtualHosts =
let
splashy = pkgs.host-splash-site config.networking.hostName;
in
kw.virtualHostGen {
networkFilter = [ "public" ];
block.locations."/" = { root = splashy; };
};
services.nginx.virtualHosts =
let
splashy = pkgs.host-splash-site config.networking.hostName;
in
kw.virtualHostGen {
networkFilter = [ "public" ];
block.locations."/" = { root = splashy; };
};
networking = {
useDHCP = false;
hostName = "rinnosuke";
interfaces.ens3 = {
useDHCP = true;
ipv6 = {
addresses = mkIf (config.network.addresses.public.ipv6.enable) [{
address = config.network.addresses.public.ipv6.address;
prefixLength = 64;
}];
routes = [{
address = "::";
prefixLength = 0;
}];
};
};
networking = {
useDHCP = false;
hostName = "rinnosuke";
interfaces.ens3 = {
useDHCP = true;
ipv6 = {
addresses = mkIf (config.network.addresses.public.ipv6.enable) [{
address = config.network.addresses.public.ipv6.address;
prefixLength = 64;
}];
routes = [{
address = "::";
prefixLength = 0;
}];
};
};
};
network = {
addresses = {
public = {
enable = true;
ipv6.address = mkIf (tf.state.resources ? ${tf.resources.${config.networking.hostName}.out.reference}) addr_ipv6_nix;
};
};
firewall.public.interfaces = singleton "ens3";
tf = {
enable = true;
ipv4_attr = "public_ip";
};
network = {
addresses = {
public = {
enable = true;
ipv6.address = mkIf (tf.state.resources ? ${tf.resources.${config.networking.hostName}.out.reference}) addr_ipv6_nix;
};
}
};
firewall.public.interfaces = singleton "ens3";
tf = {
enable = true;
ipv4_attr = "public_ip";
};
};
}

View file

@ -14,9 +14,9 @@
group = "knot";
};
/* environment.etc."katdns/zones/kittywit.ch.zone".text = let
/* environment.etc."katdns/zones/kittywit.ch.zone".text = let
dns = pkgs.dns;
in dns.lib.toString "kittywit.ch." (import ./kittywit.ch.nix {inherit dns; }); */
in dns.lib.toString "kittywit.ch." (import ./kittywit.ch.nix {inherit dns; }); */
services.knot = {
enable = true;

View file

@ -20,6 +20,9 @@ in
nano = ''
${pkgs.kitty}/bin/kitty +kitten icat ${./nano.png}
'';
getAlias = ''
printf '%s\n' $aliases[$1]
'';
} // shellFunAliases {
sed = "sd";
find = "fd";
@ -55,7 +58,7 @@ in
"autolist"
"listrowsfirst"
]; in
''
''
${if config.anicca.enabled then ''
HISTFILE=/persist/home/.zsh_history
'' else ''

View file

@ -1,34 +1,35 @@
{ config, pkgs, ... }:
let initvim = pkgs.callPackage
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
name = "init.vim";
src = ./init.vim;
inherit nodejs elinks;
buildInputs = [
elinks
nodejs
];
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src $out
'';
})
{ };
let
initvim = pkgs.callPackage
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
name = "init.vim";
src = ./init.vim;
inherit nodejs elinks;
buildInputs = [
elinks
nodejs
];
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src $out
'';
})
{ };
cocvim = pkgs.callPackage
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
name = "coc.vim";
src = ./coc.vim;
inherit nodejs;
buildInputs = [
nodejs
];
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src $out
'';
})
{ };
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
name = "coc.vim";
src = ./coc.vim;
inherit nodejs;
buildInputs = [
nodejs
];
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src $out
'';
})
{ };
in
{
programs.neovim = {

View file

@ -2,7 +2,7 @@
{
wayland.windowManager.sway.extraSessionCommands = ''
export KITTY_CACHE_DIRECTORY="/tmp/kitty";
export KITTY_CACHE_DIRECTORY="/tmp/kitty";
'';
programs.kitty = {
enable = true;

View file

@ -1,6 +1,6 @@
let
# we don't have lib without sources, so we need optionalAttrs
optionalAttrs = cond: as: if cond then as else {};
optionalAttrs = cond: as: if cond then as else { };
# Sources are from niv.
sources = import ./nix/sources.nix // optionalAttrs (builtins.pathExists ./overlays/exprs/default.nix) {
katexprs = ./overlays/exprs;

View file

@ -1,3 +1,3 @@
{ sources, ... }: final: prev: {
dns = import ( sources.kirelagin + "/dns") { pkgs = final; };
dns = import (sources.kirelagin + "/dns") { pkgs = final; };
}