[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,62 +168,63 @@
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"; hash = "sha256-8GRhLYva7+uXNIvobLFPyeQwJ2zhBrH4WCFN6B0BAJg=";
hash = "sha256-8GRhLYva7+uXNIvobLFPyeQwJ2zhBrH4WCFN6B0BAJg="; }
} # 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-zjzjmC1XJmwfHr/YXFyYsqUFR5MHSoxWWyxIR35YNbM=";
hash = "sha256-Tiz2ydzlWbxx7jW32afN0RBvmXnsbt7lUvj/RUkpNbc="; }
} {
{ 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="; }
} # claude-code: 1.0.126 -> 1.0.128
# { # {
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/462960.patch"; # url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/446609.patch";
# hash = "sha256-QZbucsuBtMfN5tYUnWT3CJTEv7hh3rqvY1tEW9VXdUs="; # hash = "sha256-3Ndad1nvxM2K4J2cbZBC+bo13ESpOGnaCCGeMWG/eq8=";
# } # }
# claude-code: 1.0.126 -> 1.0.128 # claude-code: switch to binary releases and update to 2.0.0
# { # {
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/446609.patch"; # url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/447265.patch";
# hash = "sha256-3Ndad1nvxM2K4J2cbZBC+bo13ESpOGnaCCGeMWG/eq8="; # hash = "sha256-f7G2Ukr0N3S+au4F6KmFHxQWr6rXrlguqh+KK0Ffbfw=";
# } # }
# claude-code: switch to binary releases and update to 2.0.0 ];
# { prePatch = ''
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/447265.patch"; mkdir -p pkgs/by-name/an/antigravity
# hash = "sha256-f7G2Ukr0N3S+au4F6KmFHxQWr6rXrlguqh+KK0Ffbfw="; '';
# }
];
}; };
# 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";
in in
evalConfig { evalConfig {
inherit system; inherit system;
modules = baseModules ++ modules; modules = baseModules ++ modules;
specialArgs = rec { specialArgs =
inherit inputs machineNames; rec {
makeEnable = (import ./make-enable.nix) nixpkgs.lib; inherit inputs machineNames;
keys = (import ./keys.nix); makeEnable = (import ./make-enable.nix) nixpkgs.lib;
usersInfo = (import ./users.nix) { keys = import ./keys.nix;
pkgs = { zsh = "zsh"; }; usersInfo = (import ./users.nix) {
inherit keys inputs system; pkgs = {zsh = "zsh";};
}; inherit keys inputs system;
realUsers = (builtins.attrNames };
(nixpkgs.lib.filterAttrs realUsers = (
(_: value: (builtins.elem "isNormalUser" (builtins.attrNames value)) && value.isNormalUser) usersInfo.users.users) builtins.attrNames
); (nixpkgs.lib.filterAttrs
mapAllKeysToValue = keys: value: builtins.listToAttrs (map (name: { inherit name value; }) keys); (_: value: (builtins.elem "isNormalUser" (builtins.attrNames value)) && value.isNormalUser)
forEachUser = mapAllKeysToValue realUsers; usersInfo.users.users)
} // specialArgs; );
}; mapAllKeysToValue = keys: value: builtins.listToAttrs (map (name: {inherit name value;}) keys);
in forEachUser = mapAllKeysToValue realUsers;
{ }
// specialArgs;
};
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 (
if builtins.hasAttr machineName customParams machineName: params: let
then (builtins.getAttr machineName customParams) machineParams =
else {}; if builtins.hasAttr machineName customParams
in mkConfig (params // machineParams) then (builtins.getAttr machineName customParams)
) defaultConfigurationParams; else {};
in
mkConfig (params // machineParams)
)
defaultConfigurationParams;
}; };
} }