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