🎨 nixpkgs-fmt

This commit is contained in:
James Walker 2022-05-06 20:01:04 -04:00
parent be14e0698c
commit ea5ba53e3c
Signed by: walkah
GPG Key ID: 3C127179D6086E93
9 changed files with 187 additions and 164 deletions

View File

@ -14,9 +14,18 @@
};
};
outputs = { self, nixpkgs, deploy-rs, flake-utils, home-manager, dotfiles, ... }@attrs:
outputs =
{ self
, nixpkgs
, deploy-rs
, flake-utils
, home-manager
, dotfiles
, ...
}@attrs:
let
mkSystem = hostName: system: modules:
nixpkgs.lib.nixosSystem {
system = system;
modules = [
@ -26,14 +35,12 @@
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
})
]
++ modules;
] ++ modules;
};
in
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
let pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
@ -42,13 +49,19 @@
}) // {
nixosConfigurations = {
# Aristotle
agent = mkSystem "agent" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
form = mkSystem "form" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
matter = mkSystem "matter" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
purpose = mkSystem "purpose" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
agent = mkSystem "agent" "aarch64-linux"
[ ./hosts/aristotle/configuration.nix ];
form = mkSystem "form" "aarch64-linux"
[ ./hosts/aristotle/configuration.nix ];
matter = mkSystem "matter" "aarch64-linux"
[ ./hosts/aristotle/configuration.nix ];
purpose = mkSystem "purpose" "aarch64-linux"
[ ./hosts/aristotle/configuration.nix ];
plato = mkSystem "plato" "x86_64-linux" [ ./hosts/plato/configuration.nix ];
socrates = mkSystem "socrates" "x86_64-linux" [ ./hosts/socrates/configuration.nix ];
plato =
mkSystem "plato" "x86_64-linux" [ ./hosts/plato/configuration.nix ];
socrates = mkSystem "socrates" "x86_64-linux"
[ ./hosts/socrates/configuration.nix ];
};
deploy.nodes = {

View File

@ -2,7 +2,8 @@
with lib;
let cfg = config.walkah.coredns;
in {
in
{
options.walkah.coredns = {
enable = mkEnableOption "";
addr = mkOption {

View File

@ -1,7 +1,8 @@
{ config, lib, pkgs, ... }:
let cfg = config.services.gitea;
in {
in
{
users.users.git = {
description = "Gitea Service";
home = cfg.stateDir;

View File

@ -22,7 +22,8 @@ let
}
];
in {
in
{
imports = [ ./default.nix ];
environment.systemPackages = with pkgs; [ ipfs-migrator ];

View File

@ -15,16 +15,19 @@
enableACME = true;
locations."= /.well-known/matrix/server".extraConfig =
let server = { "m.server" = "matrix.walkah.chat:443"; };
in ''
in
''
default_type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON server}';
'';
locations."= /.well-known/matrix/client".extraConfig = let
locations."= /.well-known/matrix/client".extraConfig =
let
client = {
"m.homeserver" = { "base_url" = "https://matrix.walkah.chat"; };
};
in ''
in
''
default_type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';

View File

@ -34,7 +34,7 @@ let
submodules = if spec ? submodules then spec.submodules else false;
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }
// (if builtins.compareVersions builtins.nixVersion "2.4" >= 0 then { inherit submodules; } else {});
// (if builtins.compareVersions builtins.nixVersion "2.4" >= 0 then { inherit submodules; } else { });
fetch_local = spec: spec.path;
@ -71,7 +71,7 @@ let
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
import <nixpkgs> { }
else
abort
''
@ -114,7 +114,7 @@ let
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -125,7 +125,7 @@ let
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {};
optionalAttrs = cond: as: if cond then as else { };
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
@ -149,19 +149,22 @@ let
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then abort
then
abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
)
config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, sources ? if isNull sourcesFile then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
@ -173,4 +176,4 @@ let
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View File

@ -10,7 +10,8 @@ let
(optionalString (cfg.initPeers != [ ]) "--peers")
(lib.strings.concatStringsSep "," cfg.initPeers)
];
in {
in
{
###### interface