feat: introduce treefmt and fmt all

This commit is contained in:
steveej 2024-11-15 10:17:56 +01:00
parent 80250b0179
commit 27c6c4f9fa
237 changed files with 5440 additions and 5214 deletions

View file

@ -5,12 +5,12 @@
lib,
config,
nodeName,
localDomainName,
system,
packages',
...
}: {
nixpkgs.overlays = [nodeFlake.overlays.default];
}:
{
nixpkgs.overlays = [ nodeFlake.overlays.default ];
nixos-x13s = {
enable = true;
@ -23,7 +23,7 @@
# printint and autodiscovery of printers
services.printing.enable = true;
services.printing.drivers = [pkgs.hplip];
services.printing.drivers = [ pkgs.hplip ];
services.avahi = {
enable = true;
nssmdns4 = true;
@ -57,8 +57,8 @@
echo $?
)
'';
requiredBy = ["bluetooth.service"];
before = ["bluetooth.service"];
requiredBy = [ "bluetooth.service" ];
before = [ "bluetooth.service" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
@ -98,7 +98,7 @@
enableNonRoot = true;
};
sops.secrets.builder-private-key = {};
sops.secrets.builder-private-key = { };
nix.distributedBuilds = true;
nix.buildMachines = [
# test these with: sudo nix store ping --store 'ssh-ng://nix-remote-builder@<fqdn>?ssh-key=/run/secrets/builder-private-key'
@ -107,9 +107,7 @@
sshUser = "nix-remote-builder";
sshKey = config.sops.secrets.builder-private-key.path;
protocol = "ssh-ng";
systems = [
"x86_64-linux"
];
systems = [ "x86_64-linux" ];
supportedFeatures = [
"big-parallel"
"kvm"
@ -123,9 +121,7 @@
sshUser = "nix-remote-builder";
sshKey = config.sops.secrets.builder-private-key.path;
protocol = "ssh-ng";
systems = [
"aarch64-linux"
];
systems = [ "aarch64-linux" ];
supportedFeatures = [
"big-parallel"
"kvm"
@ -154,24 +150,27 @@
}
# TODO: create syncthing os snippet
(let
tcp = [22000];
udp = [
22000
21027
];
in {
# TODO: upstream feature for inverse rule to work: `! --in-interface zt+`
networking.firewall.interfaces."en+".allowedTCPPorts = tcp;
networking.firewall.interfaces."en+".allowedUDPPorts = udp;
networking.firewall.interfaces."wl+".allowedTCPPorts = tcp;
networking.firewall.interfaces."wl+".allowedUDPPorts = udp;
(
let
tcp = [ 22000 ];
udp = [
22000
21027
];
in
{
# TODO: upstream feature for inverse rule to work: `! --in-interface zt+`
networking.firewall.interfaces."en+".allowedTCPPorts = tcp;
networking.firewall.interfaces."en+".allowedUDPPorts = udp;
networking.firewall.interfaces."wl+".allowedTCPPorts = tcp;
networking.firewall.interfaces."wl+".allowedUDPPorts = udp;
networking.firewall.allowedTCPPorts = [
# iperf3
5201
];
})
networking.firewall.allowedTCPPorts = [
# iperf3
5201
];
}
)
../../snippets/home-manager-with-zsh.nix
../../snippets/sway-desktop.nix
@ -201,22 +200,17 @@
];
system.stateVersion = "23.11";
home-manager.users.root = _: {
home.stateVersion = "23.11";
};
home-manager.users.root = _: { home.stateVersion = "23.11"; };
home-manager.users.steveej = _: {
home.stateVersion = "23.11";
imports = [
../../../home-manager/configuration/graphical-fullblown.nix
];
imports = [ ../../../home-manager/configuration/graphical-fullblown.nix ];
nixpkgs.overlays = [nodeFlake.overlays.default];
nixpkgs.overlays = [ nodeFlake.overlays.default ];
home.sessionVariables = {};
home.sessionVariables = { };
home.packages = with pkgs; [
];
home.packages = with pkgs; [ ];
# TODO(upstream): currently unsupported on x13s
services.gammastep.enable = true;
@ -228,7 +222,7 @@
loader.efi.canTouchEfiVariables = lib.mkForce false;
loader.efi.efiSysMountPoint = "/boot";
blacklistedKernelModules = ["wwan"];
blacklistedKernelModules = [ "wwan" ];
};
hardware.firmware = lib.mkBefore [
@ -258,9 +252,7 @@
autostart = false;
};
services.udev.packages = [
pkgs.android-udev-rules
];
services.udev.packages = [ pkgs.android-udev-rules ];
programs.adb.enable = true;
nix.settings.sandbox = lib.mkForce "relaxed";

View file

@ -6,21 +6,23 @@
nodeFlake,
localDomainName ? "internal",
...
}: {
}:
{
meta.nodeSpecialArgs.${nodeName} = {
inherit repoFlake nodeName nodeFlake system;
inherit
repoFlake
nodeName
nodeFlake
system
;
packages' = repoFlake.packages.${system};
nodePackages' = nodeFlake.packages.${system};
repoFlakeInputs' = repoFlakeWithSystem system ({inputs', ...}: inputs');
repoFlakeInputs' = repoFlakeWithSystem system ({ inputs', ... }: inputs');
inherit localDomainName;
};
meta.nodeNixpkgs.${nodeName} =
import nodeFlake.inputs.nixpkgs.outPath
{
inherit system;
};
meta.nodeNixpkgs.${nodeName} = import nodeFlake.inputs.nixpkgs.outPath { inherit system; };
${nodeName} = {
deployment.targetHost = "${nodeName}.${localDomainName}";
@ -29,8 +31,6 @@
# nixpkgs.pkgs = nodeFlake.inputs.nixpkgs.legacyPackages.${system};
imports = [
./configuration.nix
];
imports = [ ./configuration.nix ];
};
}

View file

@ -15,9 +15,7 @@
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
mountOptions = [ "defaults" ];
};
};
luks = {
@ -25,7 +23,7 @@
content = {
type = "luks";
name = "x13s-nvme-crypt";
extraOpenArgs = [];
extraOpenArgs = [ ];
# disable settings.keyFile if you want to use interactive password entry
#passwordFile = "/tmp/secret.key"; # Interactive
settings = {
@ -37,19 +35,28 @@
# additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
content = {
type = "btrfs";
extraArgs = ["-f"];
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = ["compress=zstd" "noatime"];
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/home" = {
mountpoint = "/home";
mountOptions = ["compress=zstd" "noatime"];
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/swap" = {
mountpoint = "/.swapvol";

View file

@ -14,16 +14,15 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-x13s.url =
"git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?ref=bump"
# 6.11.0
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=6b9efe77ca80653354981c720af3c4241ac71490"
# 6.12.0-rc6
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=bd580ee9c35fcb8a720122d5bb2f903f1b7395ee"
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=1286d20be2321a1a2d27f5d09257ebaf54ce0630"
#"/home/steveej/src/others/nixos-x13s"
#
;
nixos-x13s.url = "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?ref=bump"
# 6.11.0
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=6b9efe77ca80653354981c720af3c4241ac71490"
# 6.12.0-rc6
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=bd580ee9c35fcb8a720122d5bb2f903f1b7395ee"
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=1286d20be2321a1a2d27f5d09257ebaf54ce0630"
#"/home/steveej/src/others/nixos-x13s"
#
;
# nixos-x13s.url = "git+https://codeberg.org/adamcstephens/nixos-x13s?ref=refs/tags/2024-02-28";
# nixos-x13s.url = "path:/home/steveej/src/others/nixos-x13s";
@ -39,127 +38,125 @@
};
};
outputs = {
self,
get-flake,
nixpkgs,
...
}: let
nativeSystem = "aarch64-linux";
nodeName = "steveej-x13s";
outputs =
{
self,
get-flake,
nixpkgs,
...
}:
let
nativeSystem = "aarch64-linux";
nodeName = "steveej-x13s";
repoFlake = get-flake ../../../..;
repoFlake = get-flake ../../../..;
mkNixosConfiguration = {extraModules ? [], ...} @ attrs:
nixpkgs.lib.nixosSystem (
nixpkgs.lib.attrsets.recursiveUpdate
attrs
mkNixosConfiguration =
{
specialArgs =
(import ./default.nix {
system = nativeSystem;
inherit nodeName;
extraModules ? [ ],
...
}@attrs:
nixpkgs.lib.nixosSystem (
nixpkgs.lib.attrsets.recursiveUpdate attrs {
specialArgs =
(import ./default.nix {
system = nativeSystem;
inherit nodeName;
inherit repoFlake;
repoFlakeWithSystem = repoFlake.lib.withSystem;
nodeFlake = self;
})
.meta
.nodeSpecialArgs
.${nodeName};
inherit repoFlake;
repoFlakeWithSystem = repoFlake.lib.withSystem;
nodeFlake = self;
}).meta.nodeSpecialArgs.${nodeName};
modules =
[
modules = [
./configuration.nix
# flake registry
{
nix.registry.nixpkgs.flake = nixpkgs;
}
]
++ extraModules;
}
);
in {
lib = {
inherit mkNixosConfiguration;
};
overlays.libcamera = final: previous: let
webkitgtkPreConfigure = ''
export NIX_BUILD_CORES="$((NIX_BUILD_CORES > 2 ? 2 : NIX_BUILD_CORES))"
export NUMBER_OF_PROCESSORS="$NIX_BUILD_CORES"
'';
in {
wireplumber = previous.wireplumber.overrideAttrs (_: {
version = "git";
src = previous.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "wireplumber";
rev = "71f868233792f10848644319dbdc97a4f147d554";
hash = "sha256-VX3OFsBK9AbISm/XTx8p05ak+z/VcKXfUXhB9aI9ev8=";
};
});
libcamera = previous.libcamera.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
libcamera-qcam = previous.libcamera-qcam.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
webkitgtk = previous.webkitgtk.overrideAttrs (attrs: {
preConfigure =
attrs.preConfigure + webkitgtkPreConfigure;
});
webkitgtk_4_1 = previous.webkitgtk_4_1.overrideAttrs (attrs: {
preConfigure =
attrs.preConfigure + webkitgtkPreConfigure;
});
webkitgtk_6_0 = previous.webkitgtk_6_0.overrideAttrs (attrs: {
preConfigure =
attrs.preConfigure + webkitgtkPreConfigure;
});
};
overlays.default = final: previous: let
inherit (previous.stdenv) system;
pkgsUnstable = import self.inputs.nixpkgs-unstable.outPath {
inherit system;
overlays = [self.overlays.libcamera];
};
in {
inherit pkgsUnstable;
inherit
(pkgsUnstable)
libcamera
webkitgtk
webkitgtk_4_1
webkitgtk_6_0
;
};
nixosConfigurations = {
native = mkNixosConfiguration {
system = nativeSystem;
};
cross = mkNixosConfiguration {
extraModules = [
{
nixpkgs.buildPlatform.system = "x86_64-linux";
nixpkgs.hostPlatform.system = nativeSystem;
{ nix.registry.nixpkgs.flake = nixpkgs; }
] ++ extraModules;
}
];
);
in
{
lib = {
inherit mkNixosConfiguration;
};
overlays.libcamera =
_final: previous:
let
webkitgtkPreConfigure = ''
export NIX_BUILD_CORES="$((NIX_BUILD_CORES > 2 ? 2 : NIX_BUILD_CORES))"
export NUMBER_OF_PROCESSORS="$NIX_BUILD_CORES"
'';
in
{
wireplumber = previous.wireplumber.overrideAttrs (_: {
version = "git";
src = previous.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "wireplumber";
rev = "71f868233792f10848644319dbdc97a4f147d554";
hash = "sha256-VX3OFsBK9AbISm/XTx8p05ak+z/VcKXfUXhB9aI9ev8=";
};
});
libcamera = previous.libcamera.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
libcamera-qcam = previous.libcamera-qcam.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
webkitgtk = previous.webkitgtk.overrideAttrs (attrs: {
preConfigure = attrs.preConfigure + webkitgtkPreConfigure;
});
webkitgtk_4_1 = previous.webkitgtk_4_1.overrideAttrs (attrs: {
preConfigure = attrs.preConfigure + webkitgtkPreConfigure;
});
webkitgtk_6_0 = previous.webkitgtk_6_0.overrideAttrs (attrs: {
preConfigure = attrs.preConfigure + webkitgtkPreConfigure;
});
};
overlays.default =
_final: previous:
let
inherit (previous.stdenv) system;
pkgsUnstable = import self.inputs.nixpkgs-unstable.outPath {
inherit system;
overlays = [ self.overlays.libcamera ];
};
in
{
inherit pkgsUnstable;
inherit (pkgsUnstable)
libcamera
webkitgtk
webkitgtk_4_1
webkitgtk_6_0
;
};
nixosConfigurations = {
native = mkNixosConfiguration { system = nativeSystem; };
cross = mkNixosConfiguration {
extraModules = [
{
nixpkgs.buildPlatform.system = "x86_64-linux";
nixpkgs.hostPlatform.system = nativeSystem;
}
];
};
};
};
};
}