Apply nixpkgs-fmt
This commit is contained in:
parent
0f2c3b1f36
commit
7627395222
14
flake.nix
14
flake.nix
@ -55,13 +55,18 @@
|
|||||||
lib = pkgsFlakes.unstable.lib;
|
lib = pkgsFlakes.unstable.lib;
|
||||||
|
|
||||||
pkgs' = mapAttrs (_: path: lib.my.mkPkgs path { overlays = [ libOverlay ]; }) pkgsFlakes;
|
pkgs' = mapAttrs (_: path: lib.my.mkPkgs path { overlays = [ libOverlay ]; }) pkgsFlakes;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
inherit lib;
|
inherit lib;
|
||||||
|
|
||||||
nixosModules = mapAttrs (_: path: let path' = ./. + "/modules/${path}"; in {
|
nixosModules = mapAttrs
|
||||||
|
(_: path:
|
||||||
|
let path' = ./. + "/modules/${path}"; in
|
||||||
|
{
|
||||||
_file = path';
|
_file = path';
|
||||||
imports = [ (import path') ];
|
imports = [ (import path') ];
|
||||||
}) {
|
})
|
||||||
|
{
|
||||||
common = "common.nix";
|
common = "common.nix";
|
||||||
build = "build.nix";
|
build = "build.nix";
|
||||||
dynamic-motd = "dynamic-motd.nix";
|
dynamic-motd = "dynamic-motd.nix";
|
||||||
@ -83,7 +88,8 @@
|
|||||||
let
|
let
|
||||||
pkgs = pkgs'.unstable.${system};
|
pkgs = pkgs'.unstable.${system};
|
||||||
flakePkg = f: f.defaultPackage.${system};
|
flakePkg = f: f.defaultPackage.${system};
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
packages = map flakePkg [
|
packages = map flakePkg [
|
||||||
agenix
|
agenix
|
||||||
deploy-rs
|
deploy-rs
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.my = with lib.types; {
|
options.my = with lib.types; {
|
||||||
boot.isDevVM = mkBoolOpt false;
|
boot.isDevVM = mkBoolOpt false;
|
||||||
build = options.system.build;
|
build = options.system.build;
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) mkIf mkDefault mkAliasDefinitions;
|
inherit (lib) mkIf mkDefault mkAliasDefinitions;
|
||||||
inherit (lib.my) mkOpt;
|
inherit (lib.my) mkOpt;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.my = with lib.types; {
|
options.my = with lib.types; {
|
||||||
user = mkOpt (attrsOf anything) { };
|
user = mkOpt (attrsOf anything) { };
|
||||||
};
|
};
|
||||||
@ -11,7 +12,8 @@
|
|||||||
let
|
let
|
||||||
defaultUsername = "dev";
|
defaultUsername = "dev";
|
||||||
uname = config.my.user.name;
|
uname = config.my.user.name;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
my = {
|
my = {
|
||||||
user = {
|
user = {
|
||||||
name = mkDefault defaultUsername;
|
name = mkDefault defaultUsername;
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
cfg = config.my.dynamic-motd;
|
cfg = config.my.dynamic-motd;
|
||||||
|
|
||||||
scriptBin = pkgs.writeShellScript "dynamic-motd-script" cfg.script;
|
scriptBin = pkgs.writeShellScript "dynamic-motd-script" cfg.script;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.my.dynamic-motd = with lib.types; {
|
options.my.dynamic-motd = with lib.types; {
|
||||||
enable = mkBoolOpt true;
|
enable = mkBoolOpt true;
|
||||||
services = mkOpt (listOf str) [ "login" "ssh" ];
|
services = mkOpt (listOf str) [ "login" "ssh" ];
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
inherit (lib.my) parseIPPort mkOpt mkBoolOpt dummyOption;
|
inherit (lib.my) parseIPPort mkOpt mkBoolOpt dummyOption;
|
||||||
|
|
||||||
cfg = config.my.firewall;
|
cfg = config.my.firewall;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.my.firewall = with lib.types; {
|
options.my.firewall = with lib.types; {
|
||||||
enable = mkBoolOpt true;
|
enable = mkBoolOpt true;
|
||||||
trustedInterfaces = options.networking.firewall.trustedInterfaces;
|
trustedInterfaces = options.networking.firewall.trustedInterfaces;
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
inherit (lib.my) mkBoolOpt;
|
inherit (lib.my) mkBoolOpt;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.my.server.enable = mkBoolOpt false;
|
options.my.server.enable = mkBoolOpt false;
|
||||||
config = mkIf config.my.server.enable {
|
config = mkIf config.my.server.enable {
|
||||||
services.getty.autologinUser = config.my.user.name;
|
services.getty.autologinUser = config.my.user.name;
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
fsType = "tmpfs";
|
fsType = "tmpfs";
|
||||||
options = [ "size=${cfg.size}" ];
|
options = [ "size=${cfg.size}" ];
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [ inputs.impermanence.nixosModule ];
|
imports = [ inputs.impermanence.nixosModule ];
|
||||||
|
|
||||||
options = with lib.types; {
|
options = with lib.types; {
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
inherit (builtins) attrValues mapAttrs;
|
inherit (builtins) attrValues mapAttrs;
|
||||||
inherit (lib) mkDefault;
|
inherit (lib) mkDefault;
|
||||||
|
|
||||||
mkSystem = name: {
|
mkSystem =
|
||||||
|
name: {
|
||||||
system,
|
system,
|
||||||
nixpkgs ? "unstable",
|
nixpkgs ? "unstable",
|
||||||
config,
|
config,
|
||||||
@ -21,12 +22,14 @@
|
|||||||
system.nixos.revision = pkgsFlake.rev;
|
system.nixos.revision = pkgsFlake.rev;
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
in nixosSystem' {
|
in
|
||||||
|
nixosSystem' {
|
||||||
inherit lib system;
|
inherit lib system;
|
||||||
specialArgs = { inherit inputs system; };
|
specialArgs = { inherit inputs system; };
|
||||||
modules = attrValues modules ++ [ { networking.hostName = mkDefault name; } config ];
|
modules = attrValues modules ++ [ { networking.hostName = mkDefault name; } config ];
|
||||||
};
|
};
|
||||||
in mapAttrs mkSystem {
|
in
|
||||||
|
mapAttrs mkSystem {
|
||||||
colony = {
|
colony = {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
nixpkgs = "stable";
|
nixpkgs = "stable";
|
||||||
|
6
util.nix
6
util.nix
@ -3,7 +3,8 @@
|
|||||||
inherit (builtins) replaceStrings elemAt;
|
inherit (builtins) replaceStrings elemAt;
|
||||||
inherit (lib) genAttrs mapAttrs' types mkOption mkOverride;
|
inherit (lib) genAttrs mapAttrs' types mkOption mkOverride;
|
||||||
inherit (lib.flake) defaultSystems;
|
inherit (lib.flake) defaultSystems;
|
||||||
in rec {
|
in
|
||||||
|
rec {
|
||||||
addPrefix = prefix: mapAttrs' (n: v: { name = "${prefix}${n}"; value = v; });
|
addPrefix = prefix: mapAttrs' (n: v: { name = "${prefix}${n}"; value = v; });
|
||||||
# Yoinked from nixpkgs/nixos/modules/services/networking/nat.nix
|
# Yoinked from nixpkgs/nixos/modules/services/networking/nat.nix
|
||||||
isIPv6 = ip: builtins.length (lib.splitString ":" ip) > 2;
|
isIPv6 = ip: builtins.length (lib.splitString ":" ip) > 2;
|
||||||
@ -13,7 +14,8 @@
|
|||||||
matchIP = if v6 then "[[]([0-9a-fA-F:]+)[]]" else "([0-9.]+)";
|
matchIP = if v6 then "[[]([0-9a-fA-F:]+)[]]" else "([0-9.]+)";
|
||||||
m = builtins.match "${matchIP}:([0-9-]+)" ipp;
|
m = builtins.match "${matchIP}:([0-9-]+)" ipp;
|
||||||
checked = v: if m == null then throw "bad ip:ports `${ipp}'" else v;
|
checked = v: if m == null then throw "bad ip:ports `${ipp}'" else v;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
inherit v6;
|
inherit v6;
|
||||||
ip = checked (elemAt m 0);
|
ip = checked (elemAt m 0);
|
||||||
ports = checked (replaceStrings ["-"] [":"] (elemAt m 1));
|
ports = checked (replaceStrings ["-"] [":"] (elemAt m 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user