-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad5be68
commit 8438ed5
Showing
40 changed files
with
450 additions
and
569 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
parts = import ./parts; | ||
in | ||
{ | ||
debug = true; | ||
|
||
imports = [ (import "${flake-parts}/all-modules.nix") ] ++ builtins.attrValues parts; | ||
|
||
systems = [ | ||
|
@@ -57,15 +59,13 @@ | |
# Dependencies | ||
#======================================================== | ||
|
||
disko.url = "github:nix-community/disko"; | ||
fenix.url = "github:nix-community/fenix"; | ||
fonts.url = "git+ssh://[email protected]/remi-gelinas/fonts"; | ||
ghostty.url = "git+ssh://[email protected]/ghostty-org/ghostty"; | ||
lix-module.url = "git+https://git.lix.systems/lix-project/nixos-module?ref=refs/tags/2.91.0"; | ||
neovim.url = "github:nix-community/neovim-nightly-overlay"; | ||
nixd.url = "github:nix-community/nixd/2.2.3"; | ||
nixpkgs-master.url = "github:NixOS/nixpkgs"; | ||
nixpkgs-unfree.inputs.nixpkgs.follows = "nixpkgs"; | ||
nixpkgs-unfree.url = "github:numtide/nixpkgs-unfree"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; | ||
stylix.url = "github:danth/stylix"; | ||
zls.url = "github:zigtools/zls/0.13.0"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ lib }: | ||
let | ||
inherit (builtins) readDir listToAttrs; | ||
inherit (lib) | ||
pipe | ||
attrNames | ||
concatMap | ||
filter | ||
filterAttrs | ||
; | ||
|
||
inherit (import ./sharding.nix { inherit lib; }) isValidShard; | ||
|
||
self = { | ||
# Aggregates all valid sharded modules under a base path | ||
getShardedModulesInPath = | ||
base: | ||
let | ||
childPaths = filter: path: attrNames (filterAttrs filter (readDir path)); | ||
childDirs = childPaths (_: type: type == "directory"); | ||
childFiles = childPaths (_: type: type == "regular"); | ||
|
||
modulesInShard = | ||
{ base, shard }: | ||
let | ||
modules = childDirs (base + "/${shard}"); | ||
in | ||
map (module: { inherit base module shard; }) modules; | ||
|
||
filesInModule = | ||
{ | ||
base, | ||
module, | ||
shard, | ||
}: | ||
let | ||
moduleBase = base + "/${shard}/${module}"; | ||
files = childFiles moduleBase; | ||
in | ||
assert isValidShard shard module; | ||
map (file: { | ||
inherit | ||
base | ||
module | ||
shard | ||
file | ||
; | ||
}) files; | ||
|
||
shards = map (shard: { inherit base shard; }) (childDirs base); | ||
in | ||
pipe shards [ | ||
(concatMap modulesInShard) | ||
(concatMap filesInModule) | ||
]; | ||
|
||
# Applies a filter to all sharded module files | ||
# Meant to be used in a pipeline with the result of getShardedModulesInPath | ||
filterShardedModuleFiles = | ||
modules: f: | ||
pipe modules [ | ||
(filter f) | ||
(map ( | ||
{ | ||
base, | ||
module, | ||
shard, | ||
file, | ||
}: | ||
{ | ||
name = module; | ||
value = base + "/${shard}/${module}/${file}"; | ||
} | ||
)) | ||
listToAttrs | ||
]; | ||
|
||
# Convenience method to get dependency modules according to my standard | ||
# For home-manager, NixOS, and nix-darwin module trees | ||
getSystemModulesInPath = | ||
base: | ||
let | ||
inherit (lib) hasPrefix; | ||
moduleFiles = self.getShardedModulesInPath base; | ||
in | ||
{ | ||
darwin = self.filterShardedModuleFiles moduleFiles ({ file, ... }: hasPrefix "darwin-" file); | ||
home = self.filterShardedModuleFiles moduleFiles ({ file, ... }: hasPrefix "home-" file); | ||
nixos = self.filterShardedModuleFiles moduleFiles ({ file, ... }: hasPrefix "nixos-" file); | ||
}; | ||
}; | ||
in | ||
self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ lib }: | ||
{ lib, ... }: | ||
let | ||
inherit (lib) toLower substring; | ||
in | ||
{ | ||
# Used for package and module by-name assertions | ||
isShardedCorrectly = shard: obj: shard == toLower (substring 0 2 obj); | ||
isValidShard = shard: obj: shard == toLower (substring 0 2 obj); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1 @@ | ||
{ lib }: | ||
let | ||
utils = import ../../utils.nix { inherit lib; }; | ||
|
||
inherit (builtins) readDir listToAttrs; | ||
inherit (utils) isShardedCorrectly; | ||
inherit (lib) | ||
pipe | ||
attrNames | ||
concatMap | ||
filter | ||
filterAttrs | ||
hasPrefix | ||
; | ||
|
||
getShardedModulesInPath = | ||
base: | ||
let | ||
childPaths = filter: path: attrNames (filterAttrs filter (readDir path)); | ||
childDirs = childPaths (_: type: type == "directory"); | ||
childFiles = childPaths (_: type: type == "regular"); | ||
|
||
modulesInShard = | ||
{ base, shard }: | ||
let | ||
modules = childDirs (base + "/${shard}"); | ||
in | ||
map (module: { inherit base module shard; }) modules; | ||
|
||
filesInModule = | ||
{ | ||
base, | ||
module, | ||
shard, | ||
}: | ||
let | ||
moduleBase = base + "/${shard}/${module}"; | ||
files = childFiles moduleBase; | ||
in | ||
assert isShardedCorrectly shard module; | ||
map (file: { | ||
inherit | ||
base | ||
module | ||
shard | ||
file | ||
; | ||
}) files; | ||
|
||
shards = map (shard: { inherit base shard; }) (childDirs base); | ||
in | ||
pipe shards [ | ||
(concatMap modulesInShard) | ||
(concatMap filesInModule) | ||
]; | ||
|
||
getShardedModuleFiles = getShardedModulesInPath ../by-name; | ||
|
||
filterShardedModuleFiles = | ||
f: | ||
pipe getShardedModuleFiles [ | ||
(filter f) | ||
(map ( | ||
{ | ||
base, | ||
module, | ||
shard, | ||
file, | ||
}: | ||
{ | ||
name = module; | ||
value = base + "/${shard}/${module}/${file}"; | ||
} | ||
)) | ||
listToAttrs | ||
]; | ||
in | ||
{ | ||
darwin = filterShardedModuleFiles ({ file, ... }: hasPrefix "darwin-" file); | ||
home = filterShardedModuleFiles ({ file, ... }: hasPrefix "home-" file); | ||
} | ||
{ lib }: (import ../../lib/modules.nix { inherit lib; }).getSystemModulesInPath ../by-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.