nixpkgs-fmt for no particular reason

This commit is contained in:
kat witch 2021-08-19 17:42:50 +01:00
parent 6c74d503fd
commit c5e4be592c
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
57 changed files with 1211 additions and 1118 deletions

View file

@ -8,12 +8,15 @@ with lib; {
gh-actions.env.CACHIX_SIGNING_KEY = "\${{ secrets.CACHIX_SIGNING_KEY }}";
gh-actions = {
on = let
on =
let
paths = [
"default.nix" # sourceCache
"ci/niv-cron.nix" config.ci.gh-actions.path
"ci/niv-cron.nix"
config.ci.gh-actions.path
];
in {
in
{
push = {
inherit paths;
};
@ -46,13 +49,16 @@ with lib; {
};
displayName = "niv update build";
environment = [ "OPENSSH_PRIVATE_KEY" "CACHIX_SIGNING_KEY" "GITHUB_REF" ];
command = let main = (import ../.);
command =
let
main = (import ../.);
hosts = main.network.nodes;
targets = main.deploy.targets;
enabledTargets = filterAttrs (_: v: v.enable) main.deploy.targets;
enabledHosts = concatLists (mapAttrsToList (targetName: target: target.nodeNames) enabledTargets);
hostBuildString = concatMapStringsSep " && " (host: "nix build -Lf . network.nodes.${host}.deploy.system -o result-${host} && nix-collect-garbage -d") enabledHosts;
in ''
in
''
# ${toString builtins.currentTime}
if [[ -n $OPENSSH_PRIVATE_KEY ]]; then
mkdir ~/.ssh

View file

@ -6,7 +6,8 @@
# ensure sources are fetched and available in the local store before evaluating host configs
environment.bootstrap = {
sourceCache = channels.cipkgs.runCommand "sources" {
sourceCache = channels.cipkgs.runCommand "sources"
{
srcs = attrNames channels.nixfiles.sourceCache.local;
} ''
mkdir -p $out/share/sources
@ -14,12 +15,15 @@
'';
};
jobs = let main = (import ../.);
jobs =
let
main = (import ../.);
hosts = main.network.nodes;
targets = main.deploy.targets;
enabledTargets = filterAttrs (_: v: v.enable) main.deploy.targets;
enabledHosts = concatLists (mapAttrsToList (targetName: target: target.nodeNames) enabledTargets);
in mapAttrs' (k: nameValuePair "${k}") (genAttrs enabledHosts (host: {
in
mapAttrs' (k: nameValuePair "${k}") (genAttrs enabledHosts (host: {
tasks.${host}.inputs = channels.nixfiles.network.nodes.${host}.deploy.system;
}));

View file

@ -5,7 +5,8 @@ with lib;
{
wayland.windowManager.sway = {
config = {
output = let
output =
let
left = {
res = "1920x1080";
pos = "0 0";

View file

@ -6,7 +6,8 @@ let
hexchen = (import sources.hexchen) { };
hexYgg = filterAttrs (_: c: c.enable)
(mapAttrs (_: host: host.config.network.yggdrasil) hexchen.hosts);
in {
in
{
# Imports
imports = with meta; [
@ -72,13 +73,16 @@ in {
environment.systemPackages = [ pkgs.razergenie ];
boot.modprobe.modules = {
vfio-pci = let
vfio-pci =
let
vfio-pci-ids = [
"1002:67df" "1002:aaf0" # RX 580
"1002:67df"
"1002:aaf0" # RX 580
"1912:0014" # Renesas USB 3
"1022:149c" # CPU USB 3
];
in mkIf (vfio-pci-ids != [ ]) {
in
mkIf (vfio-pci-ids != [ ]) {
options.ids = concatStringsSep "," vfio-pci-ids;
};
};

View file

@ -4,7 +4,8 @@ with lib;
{
wayland.windowManager.sway.config = {
output = let
output =
let
laptop = {
res = "1920x1080";
pos = "0 0";

View file

@ -7,7 +7,8 @@ This module:
with lib;
let cfg = config.kw; in {
let cfg = config.kw; in
{
options.kw = {
hexColors = mkOption {
type = types.attrsOf types.str;

View file

@ -25,7 +25,8 @@ let
./secrets.nix
];
};
in {
in
{
imports = [
(toString (sources.tf-nix + "/modules/run.nix"))
] ++ (optional (builtins.pathExists ../../trusted/tf/tf.nix) (../../trusted/tf/tf.nix));
@ -41,12 +42,15 @@ in {
};
hostName = mkOption {
type = types.nullOr types.str;
default = let
default =
let
hostName = builtins.getEnv "HOME_HOSTNAME";
in if hostName == "" then null else hostName;
in
if hostName == "" then null else hostName;
};
};
targets = let
targets =
let
type = types.submodule ({ config, name, ... }: {
options = {
enable = mkEnableOption "Enable the target" // { default = true; };
@ -63,7 +67,8 @@ in {
default = { };
};
};
config.tf = mkMerge (singleton {
config.tf = mkMerge (singleton
{
imports = [
../../targets/common
];
@ -94,29 +99,40 @@ in {
continue.envVar = "TF_NIX_CONTINUE_${replaceStrings [ "-" ] [ "_" ] config.name}";
} ++ map (nodeName: mapAttrs (_: mkMerge) meta.network.nodes.${nodeName}.deploy.tf.out.set) config.nodeNames);
});
in mkOption {
in
mkOption {
type = types.attrsOf type;
default = { };
};
};
};
config = {
deploy.targets = let
deploy.targets =
let
nodeNames = attrNames config.network.nodes;
targets = config.deploy.targets;
explicitlyDefinedHosts = concatLists (mapAttrsToList (targetName: target: remove targetName target.nodeNames) config.deploy.targets);
in genAttrs nodeNames ( nodeName: {
in
genAttrs nodeNames (nodeName: {
enable = mkDefault (! elem nodeName explicitlyDefinedHosts);
nodeNames = singleton nodeName;
});
runners = {
run = mkMerge (mapAttrsToList (targetName: target: mapAttrs' (k: run:
run = mkMerge (mapAttrsToList
(targetName: target: mapAttrs'
(k: run:
nameValuePair run.name run.set
) target.tf.runners.run) (filterAttrs (_: v: v.enable) cfg.targets));
lazy.run = mkMerge (mapAttrsToList (targetName: target: mapAttrs' (k: run:
)
target.tf.runners.run)
(filterAttrs (_: v: v.enable) cfg.targets));
lazy.run = mkMerge (mapAttrsToList
(targetName: target: mapAttrs'
(k: run:
nameValuePair run.name run.set
) target.tf.runners.lazy.run) (filterAttrs (_: v: v.enable) cfg.targets));
)
target.tf.runners.lazy.run)
(filterAttrs (_: v: v.enable) cfg.targets));
};
};
}

View file

@ -25,7 +25,8 @@ with lib;
default = toString (pkgs.path + "/nixos/modules");
};
};
nodes = let
nodes =
let
nixosModule = { name, config, meta, modulesPath, lib, ... }: with lib; {
config = {
nixpkgs = {
@ -34,9 +35,11 @@ with lib;
};
};
};
nixosType = let
nixosType =
let
baseModules = import (config.network.nixos.modulesPath + "/module-list.nix");
in types.submoduleWith {
in
types.submoduleWith {
modules = baseModules
++ singleton nixosModule
++ config.network.nixos.extraModules;
@ -46,7 +49,8 @@ with lib;
inherit (config.network.nixos) modulesPath;
} // config.network.nixos.specialArgs;
};
in mkOption {
in
mkOption {
type = types.attrsOf nixosType;
default = { };
};

View file

@ -3,7 +3,8 @@
with lib;
{
options = let tf = config; in {
options = let tf = config; in
{
variables = mkOption {
type = types.attrsOf (types.submodule ({ name, config, ... }: {
options.externalSecret = mkEnableOption "Is ths secret to be templated into a command provided?";

View file

@ -57,7 +57,8 @@ in
if (builtins.length targetsList == 0) then null
else lib.warnIf (builtins.length targetsList > 1) "The host ${name} is assigned to several targets: ${concatMapStrings (x: "${x},") targetsList}." (head targetsList);
};
deploy.tf = mkMerge (singleton (lib.mkIf (config.deploy.targetName != null) {
deploy.tf = mkMerge (singleton
(lib.mkIf (config.deploy.targetName != null) {
attrs = [ "import" "imports" "out" "attrs" ];
import = genAttrs cfg.tf.imports (target: meta.deploy.targets.${target}.tf);
out.set = removeAttrs cfg.tf cfg.tf.attrs;

View file

@ -34,7 +34,8 @@ with lib;
${pkgs.curl}/bin/curl -u ''${user}:''${pass} --data-urlencode "hostname=''${hostname}" --data-urlencode "myip=''${ip4}" "https://dns.glauca.digital/nic/update"
echo ""
${pkgs.curl}/bin/curl -u ''${user}:''${pass} --data-urlencode "hostname=''${hostname}" --data-urlencode "myip=''${ip6}" "https://dns.glauca.digital/nic/update"
''; in {
''; in
{
serviceConfig = {
ExecStart = "${updater}/bin/glauca-dyndns";
};

View file

@ -1,5 +1,6 @@
let hardwareProfiles = { lib }:
let profiles = with profiles; lib.domainMerge {
let profiles = with profiles; lib.domainMerge
{
folder = ""; # not used in this usage
folderPaths = [
./.

View file

@ -9,7 +9,8 @@ let
win10-diskmapper = pkgs.writeShellScriptBin "win10-diskmapper" ''
sudo ${pkgs.disk-mapper}/bin/disk-mapper /dev/disk/by-id/ata-ST2000DM008-2FR102_WK301C3H-part2
'';
in {
in
{
deploy.profile.vfio = true;
environment.systemPackages = with pkgs; [
@ -29,14 +30,16 @@ in {
kernelPatches = with pkgs.kernelPatches; [
(mkIf config.deploy.profile.hardware.acs-override acs-override)
];
} (mkIf (config.deploy.profile.hardware.amdgpu) {
}
(mkIf (config.deploy.profile.hardware.amdgpu) {
kernelParams = [
"video=efifb:off"
];
extraModulePackages = [
(pkgs.linuxPackagesFor config.boot.kernelPackages.kernel).vendor-reset
];
}) ( mkIf (config.deploy.profile.hardware.acs-override) {
})
(mkIf (config.deploy.profile.hardware.acs-override) {
kernelParams = [
"pci=noats"
"pcie_acs_override=downstream,multifunction"

View file

@ -1,6 +1,7 @@
{ config, pkgs, kw, ... }:
let splashy = pkgs.host-splash-site config.networking.hostName; in {
let splashy = pkgs.host-splash-site config.networking.hostName; in
{
services.nginx.virtualHosts = kw.virtualHostGen {
networkFilter = [ "private" ];
block.locations."/" = { root = splashy; };

View file

@ -94,7 +94,8 @@ let
rtmpsink
];
in {
in
{
services.nginx.appendConfig = ''
rtmp {
server {

View file

@ -41,7 +41,8 @@ let
};
}
];
in {
in
{
services.udev.extraRules = ''
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTR{index}=="0", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0779", SYMLINK+="videomew", TAG+="systemd"
'';

View file

@ -5,7 +5,8 @@ with lib;
let
cfg = config.services.murmur;
forking = (cfg.logFile != null);
in {
in
{
network.firewall = {
public = {
tcp.ports = singleton 64738;

View file

@ -17,7 +17,8 @@
port = 62954;
};
in
(lib.foldAttrList (map (network:
(lib.foldAttrList (map
(network:
lib.mapAttrs (_: v: { hostname = v.address; } // common) (lib.filterAttrs (_: v: v.enable) (lib.mapAttrs (_: v: v.network.addresses.${network}.ipv4) meta.network.nodes))
) [ "private" "public" ]));
};

View file

@ -11,7 +11,8 @@ let
fi
'';
shellFunAliases = mapAttrs shellFunAlias;
in {
in
{
home.shell.functions = {
genmac = ''
nix run nixpkgs.openssl -c openssl rand -hex 6 | sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)/\1:\2:\3:\4:\5:\6/'
@ -29,13 +30,31 @@ in {
programs.zsh = {
enable = true;
enableAutosuggestions = true;
initExtra = let
initExtra =
let
zshOpts = [
"auto_pushd" "pushd_ignore_dups" "pushdminus"
"rmstarsilent" "nonomatch" "long_list_jobs" "interactivecomments"
"append_history" "hist_ignore_space" "hist_verify" "inc_append_history" "nosharehistory"
"nomenu_complete" "auto_menu" "no_auto_remove_slash" "complete_in_word" "always_to_end" "nolistbeep" "autolist" "listrowsfirst"
]; in ''
"auto_pushd"
"pushd_ignore_dups"
"pushdminus"
"rmstarsilent"
"nonomatch"
"long_list_jobs"
"interactivecomments"
"append_history"
"hist_ignore_space"
"hist_verify"
"inc_append_history"
"nosharehistory"
"nomenu_complete"
"auto_menu"
"no_auto_remove_slash"
"complete_in_word"
"always_to_end"
"nolistbeep"
"autolist"
"listrowsfirst"
]; in
''
zmodload -i zsh/complist
zstyle ':completion:*' list-colors ""
zstyle ':completion:*:*:*:*:*' menu select

View file

@ -1,21 +1,25 @@
let katUser = { lib }: let
let katUser = { lib }:
let
trustedImport = {
config.home-manager.users.kat = {
imports = lib.optional (builtins.pathExists ../../trusted/users/kat) (import ../../trusted/users/kat/home.nix);
};
}; userImport = profile: { config, ... }: {
};
userImport = profile: { config, ... }: {
config.home-manager.users.kat = {
imports = [
(./. + "/${profile}")
];
};
}; serviceImport = profile: { config, ... }: {
};
serviceImport = profile: { config, ... }: {
config.home-manager.users.kat = {
imports = [
(./services + "/${profile}")
];
};
}; profileNames = lib.folderList ./. ["base" "services"];
};
profileNames = lib.folderList ./. [ "base" "services" ];
serviceNames = lib.folderList ./services [ ];
userProfiles = with userProfiles;
lib.genAttrs profileNames userImport // {
@ -23,5 +27,7 @@ userProfiles = with userProfiles;
base = { imports = [ ./nixos.nix (userImport "base") trustedImport ]; };
server = { imports = [ personal ]; };
guiFull = { imports = [ gui sway dev media personal ]; };
}; in userProfiles;
};
in
userProfiles;
in { __functor = self: katUser; isModule = false; }

View file

@ -1,7 +1,8 @@
{ config, ... }:
{
home.file.".mozilla/tst.css".text = let base16 = config.kw.hexColors; in ''
home.file.".mozilla/tst.css".text = let base16 = config.kw.hexColors; in
''
/* Hide border on tab bar, force its state to 'scroll', adjust margin-left for width of scrollbar. */
#tabbar { border: 0; overflow-y: scroll !important; }

View file

@ -77,7 +77,9 @@
"m" = vim."`";
"WHEEL_UP" = vim."L";
"WHEEL_DOWN" = vim."H";
}; in vim // other;
};
in
vim // other;
config = {
no-input-default-bindings = "";
profile = "gpu-hq";

View file

@ -39,7 +39,8 @@
services.weechat.enable = true;
systemd.user.services.weechat-tmux = let scfg = config.services.weechat; in lib.mkForce {
systemd.user.services.weechat-tmux = let scfg = config.services.weechat; in
lib.mkForce {
Unit = {
Description = "Weechat tmux session";
After = [ "network.target" ];

View file

@ -5,7 +5,8 @@ let
exec foot "$2"
'';
lockCommand = "${pkgs.swaylock-fancy}/bin/swaylock-fancy -d -t ''";
in {
in
{
home.sessionVariables = {
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
@ -55,7 +56,8 @@ in {
fi
'';
wayland.windowManager.sway = let
wayland.windowManager.sway =
let
cfg = config.wayland.windowManager.sway.config;
bindsym = k: v: "bindsym ${k} ${v}";
bindWorkspace = key: workspace: {
@ -90,12 +92,15 @@ in {
];
workspaceBindings' = map (lib.mapAttrsToList bindsym) workspaceBindings;
workspaceBindingsStr = lib.concatStringsSep "\n" (lib.flatten workspaceBindings');
in {
in
{
enable = true;
config = let
config =
let
pactl = "${config.home.nixosConfig.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl";
dmenu = "${pkgs.wofi}/bin/wofi -idbt ${footwrap}/bin/footwrap -s ~/.config/wofi/wofi.css -p '' -W 25%";
in {
in
{
modes = {
"System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown" =
@ -281,7 +286,8 @@ in {
"${cfg.modifier}+Delete" = ''mode "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"'';
};
colors = let base16 = config.kw.hexColors; in {
colors = let base16 = config.kw.hexColors; in
{
focused = {
border = base16.base01;
background = base16.base0D;

View file

@ -5,7 +5,8 @@ let
color: ${color};
border-color: ${color};
'';
in ''
in
''
* {
border: none;
border-radius: 0;

View file

@ -1,7 +1,8 @@
{ config, lib, ... }:
{
xdg.configFile."wofi/wofi.css".text = let base16 = config.kw.hexColors; in ''
xdg.configFile."wofi/wofi.css".text = let base16 = config.kw.hexColors; in
''
#scroll, #input {
background: ${base16.base01};
}

View file

@ -10,7 +10,8 @@ let
getSources = sources: removeAttrs sources [ "__functor" "dorkfiles" ];
source2drv = value: if isDerivation value.outPath then value.outPath else value;
sources2drvs = sources: mapAttrs (_: source2drv) (getSources sources);
in recurseIntoAttrs rec {
in
recurseIntoAttrs rec {
local = sources2drvs sources;
hexchen = sources2drvs (import sources.hexchen { }).sources;
all = attrValues local ++ attrValues hexchen;
@ -27,10 +28,12 @@ let
Otherwise a module is generated which contains both import paths.
*/
xargNames = lib.unique (lib.folderList ./config [ "trusted" ] ++ lib.folderList ./config/trusted [ "pkgs" "tf" ]);
xarg = lib.mapListToAttrs (folder: lib.nameValuePair folder (lib.domainMerge {
xarg = lib.mapListToAttrs
(folder: lib.nameValuePair folder (lib.domainMerge {
inherit folder;
folderPaths = [ (./config + "/${folder}") (./config/trusted + "/${folder}") ];
})) xargNames;
}))
xargNames;
/*
We provide the runners with this file this way. We also provide our nix args here.
@ -80,4 +83,5 @@ let
* services -> the specialArg generated from services/
*/
self = config // { inherit pkgs lib sourceCache sources; } // xarg;
in self
in
self

View file

@ -23,4 +23,5 @@ let
];
};
};
in pkgs
in
pkgs

View file

@ -1,4 +1,5 @@
{ }: let
{}:
let
meta = import ./default.nix;
config = meta;
inherit (meta) pkgs;
@ -58,7 +59,8 @@
done
cd $START_DIR
'';
in pkgs.mkShell {
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
inetutils
nf-update