[NixOS] Run alejandra on flake.nix

This commit is contained in:
2025-11-25 19:45:56 -08:00
parent 493bd42966
commit 8799310710

View File

@@ -9,7 +9,7 @@
inputs.systems.follows = "systems"; inputs.systems.follows = "systems";
}; };
systems = { url = "github:nix-systems/default"; }; systems = {url = "github:nix-systems/default";};
git-ignore-nix = { git-ignore-nix = {
url = "github:hercules-ci/gitignore.nix"; url = "github:hercules-ci/gitignore.nix";
@@ -21,15 +21,18 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixos-hardware = { url = "github:colonelpanic8/nixos-hardware/my-master"; }; nixos-hardware = {url = "github:colonelpanic8/nixos-hardware/my-master";};
nixos-wsl = { url = "github:nix-community/NixOS-WSL"; }; nixos-wsl = {url = "github:nix-community/NixOS-WSL";};
agenix = { url = "github:ryantm/agenix"; }; agenix = {url = "github:ryantm/agenix";};
railbird-secrets = { railbird-secrets = {
url = "git+ssh://gitea@dev.railbird.ai:1123/railbird/secrets-flake.git"; url = "git+ssh://gitea@dev.railbird.ai:1123/railbird/secrets-flake.git";
}; };
# railbird-secrets = {
# url = "git+ssh://gitea@dev.railbird.ai:1123/railbird/secrets-flake.git";
# };
xmonad = { xmonad = {
url = "github:xmonad/xmonad"; url = "github:xmonad/xmonad";
@@ -104,16 +107,26 @@
vscode-server.url = "github:nix-community/nixos-vscode-server"; vscode-server.url = "github:nix-community/nixos-vscode-server";
nixified-ai = { url = "github:nixified-ai/flake"; }; nixified-ai = {url = "github:nixified-ai/flake";};
nixtheplanet.url = "github:matthewcroughan/nixtheplanet"; nixtheplanet.url = "github:matthewcroughan/nixtheplanet";
}; };
outputs = inputs@{ outputs = inputs @ {
self, nixpkgs, nixos-hardware, home-manager, taffybar, xmonad, nixtheplanet, self,
xmonad-contrib, notifications-tray-icon, nix, agenix, imalison-taffybar, ... nixpkgs,
}: nixos-hardware,
let home-manager,
taffybar,
xmonad,
nixtheplanet,
xmonad-contrib,
notifications-tray-icon,
nix,
agenix,
imalison-taffybar,
...
}: let
machinesFilepath = ./machines; machinesFilepath = ./machines;
machineFilenames = builtins.attrNames (builtins.readDir machinesFilepath); machineFilenames = builtins.attrNames (builtins.readDir machinesFilepath);
machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename); machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename);
@@ -122,7 +135,9 @@
name = machineNameFromFilename filename; name = machineNameFromFilename filename;
value = { value = {
modules = [ modules = [
(machinesFilepath + ("/" + filename)) agenix.nixosModules.default nixtheplanet.nixosModules.macos-ventura (machinesFilepath + ("/" + filename))
agenix.nixosModules.default
nixtheplanet.nixosModules.macos-ventura
]; ];
}; };
}; };
@@ -136,14 +151,13 @@
system = "aarch64-linux"; system = "aarch64-linux";
}; };
}; };
mkConfig = mkConfig = {
{ system ? "x86_64-linux" system ? "x86_64-linux",
, baseModules ? [] baseModules ? [],
, modules ? [] modules ? [],
, specialArgs ? {} specialArgs ? {},
, ... ...
}: }: let
let
# Bootstrap nixpkgs for this specific system # Bootstrap nixpkgs for this specific system
bootstrapPkgs = import nixpkgs { bootstrapPkgs = import nixpkgs {
inherit system; inherit system;
@@ -154,8 +168,7 @@
patchedSource = bootstrapPkgs.applyPatches { patchedSource = bootstrapPkgs.applyPatches {
name = "nixpkgs-patched"; name = "nixpkgs-patched";
src = nixpkgs; src = nixpkgs;
patches = patches = map bootstrapPkgs.fetchpatch [
map bootstrapPkgs.fetchpatch [
# Rumno service PR # Rumno service PR
{ {
url = "https://github.com/NixOS/nixpkgs/pull/433540.patch"; url = "https://github.com/NixOS/nixpkgs/pull/433540.patch";
@@ -164,16 +177,12 @@
# git-sync-rs package # git-sync-rs package
{ {
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/434160.patch"; url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/434160.patch";
hash = "sha256-Tiz2ydzlWbxx7jW32afN0RBvmXnsbt7lUvj/RUkpNbc="; hash = "sha256-zjzjmC1XJmwfHr/YXFyYsqUFR5MHSoxWWyxIR35YNbM=";
} }
{ {
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/436061.patch"; url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/436061.patch";
hash = "sha256-HZquaNBB+w5Hm5kdzvaGg7QAOgAf/EPBO7o7pKkIrMY="; hash = "sha256-HZquaNBB+w5Hm5kdzvaGg7QAOgAf/EPBO7o7pKkIrMY=";
} }
# {
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/462960.patch";
# hash = "sha256-QZbucsuBtMfN5tYUnWT3CJTEv7hh3rqvY1tEW9VXdUs=";
# }
# claude-code: 1.0.126 -> 1.0.128 # claude-code: 1.0.126 -> 1.0.128
# { # {
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/446609.patch"; # url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/446609.patch";
@@ -185,6 +194,9 @@
# hash = "sha256-f7G2Ukr0N3S+au4F6KmFHxQWr6rXrlguqh+KK0Ffbfw="; # hash = "sha256-f7G2Ukr0N3S+au4F6KmFHxQWr6rXrlguqh+KK0Ffbfw=";
# } # }
]; ];
prePatch = ''
mkdir -p pkgs/by-name/an/antigravity
'';
}; };
# Get eval-config from patched source # Get eval-config from patched source
evalConfig = import "${patchedSource}/nixos/lib/eval-config.nix"; evalConfig = import "${patchedSource}/nixos/lib/eval-config.nix";
@@ -192,24 +204,27 @@
evalConfig { evalConfig {
inherit system; inherit system;
modules = baseModules ++ modules; modules = baseModules ++ modules;
specialArgs = rec { specialArgs =
rec {
inherit inputs machineNames; inherit inputs machineNames;
makeEnable = (import ./make-enable.nix) nixpkgs.lib; makeEnable = (import ./make-enable.nix) nixpkgs.lib;
keys = (import ./keys.nix); keys = import ./keys.nix;
usersInfo = (import ./users.nix) { usersInfo = (import ./users.nix) {
pkgs = { zsh = "zsh"; }; pkgs = {zsh = "zsh";};
inherit keys inputs system; inherit keys inputs system;
}; };
realUsers = (builtins.attrNames realUsers = (
builtins.attrNames
(nixpkgs.lib.filterAttrs (nixpkgs.lib.filterAttrs
(_: value: (builtins.elem "isNormalUser" (builtins.attrNames value)) && value.isNormalUser) usersInfo.users.users) (_: value: (builtins.elem "isNormalUser" (builtins.attrNames value)) && value.isNormalUser)
usersInfo.users.users)
); );
mapAllKeysToValue = keys: value: builtins.listToAttrs (map (name: { inherit name value; }) keys); mapAllKeysToValue = keys: value: builtins.listToAttrs (map (name: {inherit name value;}) keys);
forEachUser = mapAllKeysToValue realUsers; forEachUser = mapAllKeysToValue realUsers;
} // specialArgs; }
// specialArgs;
}; };
in in {
{
nixConfig = { nixConfig = {
substituters = [ substituters = [
"https://cache.nixos.org/" "https://cache.nixos.org/"
@@ -226,12 +241,16 @@
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
]; ];
}; };
nixosConfigurations = builtins.mapAttrs (machineName: params: nixosConfigurations =
let machineParams = builtins.mapAttrs (
machineName: params: let
machineParams =
if builtins.hasAttr machineName customParams if builtins.hasAttr machineName customParams
then (builtins.getAttr machineName customParams) then (builtins.getAttr machineName customParams)
else {}; else {};
in mkConfig (params // machineParams) in
) defaultConfigurationParams; mkConfig (params // machineParams)
)
defaultConfigurationParams;
}; };
} }