Compare commits

..

No commits in common. "6dfed69ac42913ea99e36e9b1e0ef3a255964e6d" and "5d36a9f019e85bd40b44e63f9221c870a2f60e76" have entirely different histories.

64 changed files with 328 additions and 592 deletions

View file

@ -1,30 +0,0 @@
{ inputs', ... }:
let
inherit (inputs'.unstable) lib;
pkgs = inputs'.unstable.legacyPackages;
in
lib.pipe ./. [
builtins.readDir
builtins.attrNames
(builtins.filter (x: x != "_default.nix"))
(map (
x:
let
fullPath = ./. + "/${x}";
in
{
${lib.removeSuffix ".nix" x} = lib.callPackageWith (
pkgs
// pkgs.xorg
// {
inherit inputs';
self' = inputs'.self;
# npins sources if i ever use them
# sources = lib.mapAttrs (_: pkgs.npins.mkSource) (lib.importJSON "${self}/packages/sources.json").pins;
}
) fullPath { };
}
))
lib.mergeAttrsList
]

View file

@ -1 +0,0 @@
{ mkShellNoCC, sops }: mkShellNoCC { packages = [ sops ]; }

View file

@ -1,18 +0,0 @@
inputs:
let
inherit (inputs.unstable) lib;
in
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: v: v == "regular" && lib.hasSuffix ".nix" n && n != "_default.nix"))
builtins.attrNames
(map (x: {
name = lib.pipe x [
(lib.removeSuffix (toString ./.))
(lib.removeSuffix ".nix")
(x: "disko-${x}")
];
value.disko.devices = import "${./.}/${x}" lib;
}))
builtins.listToAttrs
]

271
flake.lock generated
View file

@ -104,38 +104,6 @@
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_6": {
"flake": false,
"locked": {
"lastModified": 1733328505,
@ -193,79 +161,6 @@
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"nvim-flake",
"neovim-nightly",
"nixpkgs"
]
},
"locked": {
"lastModified": 1730504689,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": [
"nvim-flake",
"neovim-nightly",
"hercules-ci-effects",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_5",
"gitignore": "gitignore_2",
"nixpkgs": [
"nvim-flake",
"neovim-nightly",
"nixpkgs"
],
"nixpkgs-stable": [
"nvim-flake",
"neovim-nightly",
"nixpkgs"
]
},
"locked": {
"lastModified": 1731363552,
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"git-hooks-nix": {
"inputs": {
"flake-compat": [
@ -319,52 +214,6 @@
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"nvim-flake",
"neovim-nightly",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hercules-ci-effects": {
"inputs": {
"flake-parts": "flake-parts_4",
"nixpkgs": [
"nvim-flake",
"neovim-nightly",
"nixpkgs"
]
},
"locked": {
"lastModified": 1730903510,
"narHash": "sha256-mnynlrPeiW0nUQ8KGZHb3WyxAxA3Ye/BH8gMjdoKP6E=",
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"rev": "b89ac4d66d618b915b1f0a408e2775fe3821d141",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"type": "github"
}
},
"lanzaboote": {
"inputs": {
"crane": "crane",
@ -392,11 +241,11 @@
},
"master": {
"locked": {
"lastModified": 1737176745,
"narHash": "sha256-fnOivdJWuL99CPTTRx4lFRSXTro5f+G2wpKOpbiFjBY=",
"lastModified": 1737083351,
"narHash": "sha256-hCddtSuk6m6XROmdOC0te0j2sLeUr28QIzNRk0qF1as=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6e0876c53ae460ac162a8931a537f951cbc0a0d5",
"rev": "0993fc268872148cebcd1fac8660a8b8ced49542",
"type": "github"
},
"original": {
@ -422,42 +271,18 @@
}
},
"neovim-nightly": {
"inputs": {
"flake-compat": "flake-compat_4",
"flake-parts": "flake-parts_3",
"git-hooks": "git-hooks",
"hercules-ci-effects": "hercules-ci-effects",
"neovim-src": "neovim-src",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1731500640,
"narHash": "sha256-bxtcbR33ftcSA+7+E52i+cqWAdoCQNFpxR1180HRX48=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "1329ddcc318e77e4629eb629d39f7f7c9b2632f6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "1329ddcc318e77e4629eb629d39f7f7c9b2632f6",
"type": "github"
}
},
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1731454739,
"narHash": "sha256-ihuASDo2BVZpUpsW6Z8Ll/xvczRPgGT/EGrrNt7NnwU=",
"owner": "neovim",
"repo": "neovim",
"rev": "1128d75550fa0b481b8953a194bae890d733a166",
"lastModified": 1737011565,
"narHash": "sha256-XMC2JCQzykiV9CtFh6YmPeoiRk065oExTB55Q0sBvCk=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "83062e5db634ba7a6a937f72e59b2c2224475a65",
"type": "github"
},
"original": {
"owner": "neovim",
"repo": "neovim",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"type": "github"
}
},
@ -641,22 +466,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1731245184,
"narHash": "sha256-vmLS8+x+gHRv1yzj3n+GTAEObwmhxmkkukB2DwtJRdU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "aebe249544837ce42588aa4b2e7972222ba12e8f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nvim-flake": {
"inputs": {
"flake-compat": "flake-compat_3",
@ -664,15 +473,14 @@
"neovim-nightly": "neovim-nightly",
"nixpkgs": [
"unstable"
],
"systems": "systems"
]
},
"locked": {
"lastModified": 1737175973,
"narHash": "sha256-QWohIcALchkFJmMnVGKr9x7pLieYv/LO+sgXm4BRW4E=",
"lastModified": 1737087635,
"narHash": "sha256-tOo1OerWaVGcqtNQCFGBiI0646YevrKR9JoK/YzYSLI=",
"owner": "Gerg-L",
"repo": "nvim-flake",
"rev": "f3397fe34ac9b99f97f9e4f905098308f48dae95",
"rev": "88bdc350255f56e04218a13261f5c53b7a78b2bc",
"type": "github"
},
"original": {
@ -762,7 +570,6 @@
"spicetify-nix": "spicetify-nix",
"stable": "stable",
"suckless": "suckless",
"systems": "systems_2",
"unstable": "unstable"
}
},
@ -812,11 +619,11 @@
]
},
"locked": {
"lastModified": 1737107480,
"narHash": "sha256-GXUE9+FgxoZU8v0p6ilBJ8NH7k8nKmZjp/7dmMrCv3o=",
"lastModified": 1736808430,
"narHash": "sha256-wlgdf/n7bJMLBheqt1jmPoxJFrUP6FByKQFXuM9YvIk=",
"owner": "mic92",
"repo": "sops-nix",
"rev": "4c4fb93f18b9072c6fa1986221f9a3d7bf1fe4b6",
"rev": "553c7cb22fed19fd60eb310423fdc93045c51ba8",
"type": "github"
},
"original": {
@ -827,17 +634,17 @@
},
"spicetify-nix": {
"inputs": {
"flake-compat": "flake-compat_6",
"flake-compat": "flake-compat_4",
"nixpkgs": [
"unstable"
]
},
"locked": {
"lastModified": 1737173687,
"narHash": "sha256-+WxaXc30KhTuCa9U8Nv2mJApIBq85CfA5fbcVsvdfxo=",
"lastModified": 1737087380,
"narHash": "sha256-T3WB7rwWDT8cWrwLR7fRRZ1gkgbk3A3dzefEfuGdMxk=",
"owner": "Gerg-L",
"repo": "spicetify-nix",
"rev": "c68c2ac0814ab386d2cbd3b9178e729b4fc805f0",
"rev": "6510ffbf4e3f9116923632da1e63e9a959d8aa94",
"type": "github"
},
"original": {
@ -882,43 +689,13 @@
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1737062831,
"narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=",
"lastModified": 1736883708,
"narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c",
"rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8",
"type": "github"
},
"original": {

View file

@ -94,41 +94,8 @@
repo = "reboot-bot";
inputs.nixpkgs.follows = "unstable";
};
systems = {
type = "github";
owner = "nix-systems";
repo = "default";
};
};
outputs =
inputs:
let
inherit (inputs.unstable) lib;
myLib = import (./. + /lib/_default.nix) inputs;
in
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: v: v == "directory" && !lib.hasPrefix "." n))
(lib.flip (
system:
(builtins.mapAttrs (
n: _:
let
imported = import (./. + "/${n}/_default.nix");
in
if myLib.needsSystem n then
{
${system} = imported {
inputs' = myLib.constructInputs' system inputs;
inherit system;
};
}
else
imported inputs
))
))
(lib.flip map (import inputs.systems))
(lib.foldAttrs (l: r: if myLib.needsSystem l then l else l // r) { })
];
outputs = x: import ./outputs.nix x;
}

View file

@ -1 +0,0 @@
{ inputs', ... }: inputs'.self.packages.lint

View file

@ -5326,7 +5326,7 @@ CONFIG_AUTOFS_FS=m
CONFIG_FUSE_FS=m
# CONFIG_CUSE is not set
# CONFIG_VIRTIO_FS is not set
CONFIG_OVERLAY_FS=m
# CONFIG_OVERLAY_FS is not set
#
# Caches

View file

@ -1,139 +0,0 @@
{
unstable,
self,
...
}@inputs:
let
inherit (unstable) lib;
in
lib.fix (myLib: {
wrench = lib.flip lib.pipe;
needsSystem = lib.flip builtins.elem [
"defaultPackage"
"devShell"
"devShells"
"formatter"
"legacyPackages"
"packages"
];
constructInputs' =
system:
myLib.wrench [
(lib.filterAttrs (_: lib.isType "flake"))
(lib.mapAttrs (
_: lib.mapAttrs (name: value: if myLib.needsSystem name then value.${system} else value)
))
];
listNixFilesRecursive = myLib.wrench [
builtins.unsafeDiscardStringContext
lib.filesystem.listFilesRecursive
(builtins.filter (x: !lib.hasPrefix "_" (builtins.baseNameOf x) && lib.hasSuffix ".nix" x))
];
addSchizophreniaToModule =
x:
let
# the imported module
imported = import x;
in
/*
If the module isn't a function then
it doesn't need arguments and error
message locations will function correctly
*/
if !lib.isFunction imported then
x
else
let
# all arguments defined in the module
funcArgs = lib.functionArgs imported;
/*
The names of all arguments which will be
available to be inserted into the module arguments
*/
argNames = builtins.attrNames inputs ++ [
"inputs"
"inputs'"
"self'"
"_dir"
];
/*
arguments to be passed minus
per system attributes
for example flake-parts-esque inputs'
*/
argsPre = {
inherit inputs self;
/*
_dir is the "self" derived
path to the directory containing the module
*/
_dir = builtins.dirOf x;
};
/*
arguments which will be inserted
set to the before per-system values
*/
providedArgs = lib.pipe funcArgs [
(lib.filterAttrs (n: _: builtins.elem n argNames))
(lib.mapAttrs (n: _: argsPre.${n} or { }))
];
/*
arguments which the module system
not provided here. either to be
provided by the module system or invalid
*/
neededArgs = lib.filterAttrs (n: _: !builtins.elem n argNames) funcArgs;
in
{
__functionArgs = neededArgs // {
/*
always require pkgs to be passed
to derive system from pkgs.stdenv.system
*/
pkgs = false;
};
__functor =
/*
args is specialArgs + _module.args which are needed
and always pkgs
*/
_: args:
imported (
/*
take module system provided arguments
filter them so only the required ones are passed
*/
(lib.filterAttrs (n: _: neededArgs ? ${n}) args)
# add needed arguments
// (
providedArgs
# add system dependent arguments
// (
let
inputs' = myLib.constructInputs' args.pkgs.stdenv.system inputs;
actuallyAllArgs = inputs' // {
inherit inputs';
self' = inputs'.self;
inherit (inputs) self;
};
in
lib.filterAttrs (n: _: providedArgs ? ${n}) actuallyAllArgs
)
)
)
# add _file to the final module attribute set
// {
_file = x;
};
};
})

282
lib/default.nix Normal file
View file

@ -0,0 +1,282 @@
inputs@{
unstable,
self,
disko,
...
}:
let
inherit (unstable) lib;
in
# Only good use case for rec
rec {
wrench = lib.flip lib.pipe;
needsSystem = lib.flip builtins.elem [
"defaultPackage"
"devShell"
"devShells"
"formatter"
"legacyPackages"
"packages"
];
constructInputs' =
system:
wrench [
(lib.filterAttrs (_: lib.isType "flake"))
(lib.mapAttrs (_: lib.mapAttrs (name: value: if needsSystem name then value.${system} else value)))
];
listNixFilesRecursive = wrench [
builtins.unsafeDiscardStringContext
lib.filesystem.listFilesRecursive
(builtins.filter (x: !lib.hasPrefix "_" (builtins.baseNameOf x) && lib.hasSuffix ".nix" x))
];
mkModules =
path:
lib.pipe path [
listNixFilesRecursive
(map (name: {
name = lib.pipe name [
(lib.removeSuffix ".nix")
(lib.removePrefix "${path}/")
];
value = addSchizophreniaToModule name;
}))
builtins.listToAttrs
];
addSchizophreniaToModule =
x:
let
# the imported module
imported = import x;
in
/*
If the module isn't a function then
it doesn't need arguments and error
message locations will function correctly
*/
if !lib.isFunction imported then
x
else
let
# all arguments defined in the module
funcArgs = lib.functionArgs imported;
/*
The names of all arguments which will be
available to be inserted into the module arguments
*/
argNames = builtins.attrNames inputs ++ [
"inputs"
"inputs'"
"self'"
"_dir"
];
/*
arguments to be passed minus
per system attributes
for example flake-parts-esque inputs'
*/
argsPre = {
inherit inputs self;
/*
_dir is the "self" derived
path to the directory containing the module
*/
_dir = builtins.dirOf x;
};
/*
arguments which will be inserted
set to the before per-system values
*/
providedArgs = lib.pipe funcArgs [
(lib.filterAttrs (n: _: builtins.elem n argNames))
(lib.mapAttrs (n: _: argsPre.${n} or { }))
];
/*
arguments which the module system
not provided here. either to be
provided by the module system or invalid
*/
neededArgs = lib.filterAttrs (n: _: !builtins.elem n argNames) funcArgs;
in
{
__functionArgs = neededArgs // {
/*
always require pkgs to be passed
to derive system from pkgs.stdenv.system
*/
pkgs = false;
};
__functor =
/*
args is specialArgs + _module.args which are needed
and always pkgs
*/
_: args:
imported (
/*
take module system provided arguments
filter them so only the required ones are passed
*/
(lib.filterAttrs (n: _: neededArgs ? ${n}) args)
# add needed arguments
// (
providedArgs
# add system dependent arguments
// (
let
inputs' = constructInputs' args.pkgs.stdenv.system inputs;
actuallyAllArgs = inputs' // {
inherit inputs';
self' = inputs'.self;
inherit (inputs) self;
};
in
lib.filterAttrs (n: _: providedArgs ? ${n}) actuallyAllArgs
)
)
)
# add _file to the final module attribute set
// {
_file = x;
};
};
gerg-utils =
pkgsf: outputs:
lib.pipe
[
"x86_64-linux"
"aarch64-linux"
]
[
(map (
system:
builtins.mapAttrs (
name: value: if needsSystem name then { ${system} = value (pkgsf system); } else value
) outputs
))
(lib.foldAttrs lib.mergeAttrs { })
];
mkHosts = wrench [
builtins.readDir
(lib.filterAttrs (_: v: v == "directory"))
builtins.attrNames
(map (x: {
name = x;
value = lib.evalModules {
specialArgs.modulesPath = "${unstable}/nixos/modules";
modules = builtins.concatLists [
(builtins.attrValues self.nixosModules)
(map addSchizophreniaToModule (listNixFilesRecursive "${self}/hosts/${x}"))
(import "${unstable}/nixos/modules/module-list.nix")
(lib.optionals (self.diskoConfigurations ? "disko-${x}") [
self.diskoConfigurations."disko-${x}"
disko.nixosModules.default
])
];
};
}))
builtins.listToAttrs
];
mkDisko =
path:
lib.pipe path [
builtins.readDir
(lib.filterAttrs (n: v: v == "regular" && lib.hasSuffix ".nix" n))
builtins.attrNames
(map (x: {
name = lib.pipe x [
(lib.removeSuffix path)
(lib.removeSuffix ".nix")
(x: "disko-${x}")
];
value.disko.devices = import "${path}/${x}" lib;
}))
builtins.listToAttrs
];
/*
/<name> -> packages named by directory
/<name>/call.nix -> callPackage override imported via import <file> pkgs
call.nix example
{python3Packages}: {
inherit (python3Packages) callPackage;
args = {};
}
/<name>/package.nix -> the package itself
/<name>/wrapper.nix:
a optional wrapper for the package
which is callPackage'd with the original package
as an argument named <name>-unwrapped
*/
mkPackages =
path: pkgs:
lib.pipe path [
builtins.readDir
(lib.filterAttrs (_: v: v == "directory"))
builtins.attrNames
(map (
n:
let
p = "${path}/${n}";
callPackage =
file: args:
let
defaultArgs =
pkgs
// pkgs.xorg
// (
let
inputs' = constructInputs' pkgs.stdenv.system inputs;
in
{
inherit inputs' inputs;
self' = inputs'.self;
inherit (inputs) self;
# npins sources if i ever use them
# sources = lib.mapAttrs (_: pkgs.npins.mkSource) (lib.importJSON "${self}/packages/sources.json").pins;
}
);
_callPackage = lib.callPackageWith defaultArgs;
fullPath = "${p}/${file}.nix";
callPath = "${p}/call.nix";
in
assert lib.assertMsg (builtins.pathExists fullPath)
"File attempting to be callPackage'd '${fullPath}' does not exist";
if builtins.pathExists callPath then
let
x = _callPackage callPath { };
in
x.callPackage or _callPackage fullPath (x.args or defaultArgs // args)
else
_callPackage fullPath args;
in
if builtins.pathExists "${p}/wrapper.nix" then
# My distaste for rec grows ever stronger
let
set."${n}-unwrapped" = callPackage "package" { };
in
{ ${n} = callPackage "wrapper" set; } // set
else
{ ${n} = callPackage "package" { }; }
))
lib.mergeAttrsList
];
}

View file

@ -9,7 +9,7 @@
options.local.sops.disable = lib.mkEnableOption "";
config = lib.mkIf (!config.local.sops.disable) {
sops = {
defaultSopsFile = "${self'}/nixosConfigurations/${config.networking.hostName}/secrets.yaml";
defaultSopsFile = "${self'}/hosts/${config.networking.hostName}/secrets.yaml";
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
};
};

View file

@ -1,29 +0,0 @@
{
self,
unstable,
disko,
...
}:
let
myLib = self.lib;
inherit (unstable) lib;
in
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (_: v: v == "directory"))
(builtins.mapAttrs (
x: _:
lib.evalModules {
specialArgs.modulesPath = "${unstable}/nixos/modules";
modules = builtins.concatLists [
(builtins.attrValues self.nixosModules)
(map myLib.addSchizophreniaToModule (myLib.listNixFilesRecursive (./. + "/${x}")))
(import "${unstable}/nixos/modules/module-list.nix")
(lib.optionals (self.diskoConfigurations ? "disko-${x}") [
self.diskoConfigurations."disko-${x}"
disko.nixosModules.default
])
];
}
))
]

View file

@ -1,20 +0,0 @@
{
self,
unstable,
...
}:
let
myLib = self.lib;
inherit (unstable) lib;
in
lib.pipe ./. [
myLib.listNixFilesRecursive
(map (name: {
name = lib.pipe name [
(lib.removeSuffix ".nix")
(lib.removePrefix "${./.}/")
];
value = myLib.addSchizophreniaToModule name;
}))
builtins.listToAttrs
]

18
outputs.nix Normal file
View file

@ -0,0 +1,18 @@
inputs@{ self, unstable, ... }:
let
lib = import ./lib inputs;
in
lib.gerg-utils (s: unstable.legacyPackages.${s}) {
inherit lib;
nixosConfigurations = lib.mkHosts "${self}/hosts";
nixosModules = lib.mkModules "${self}/modules";
diskoConfigurations = lib.mkDisko "${self}/disko";
formatter = pkgs: inputs.self.packages.${pkgs.stdenv.system}.lint;
devShells = pkgs: { default = pkgs.mkShellNoCC { packages = [ pkgs.sops ]; }; };
packages = lib.mkPackages "${self}/packages";
}

View file

@ -1,70 +0,0 @@
/*
/<name> -> packages named by directory
/<name>/call.nix -> callPackage override imported via import <file> pkgs
call.nix example
{python3Packages}: {
inherit (python3Packages) callPackage;
args = {};
}
/<name>/package.nix -> the package itself
/<name>/wrapper.nix:
a optional wrapper for the package
which is callPackage'd with the original package
as an argument named <name>-unwrapped
*/
{ inputs', ... }:
let
inherit (inputs'.unstable) lib;
pkgs = inputs'.unstable.legacyPackages;
in
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (_: v: v == "directory"))
builtins.attrNames
(map (
n:
let
p = ./. + "/${n}";
callPackage =
file: args:
let
defaultArgs =
pkgs
// pkgs.xorg
// {
inherit inputs';
self' = inputs'.self;
# npins sources if i ever use them
# sources = lib.mapAttrs (_: pkgs.npins.mkSource) (lib.importJSON "${self}/packages/sources.json").pins;
};
_callPackage = lib.callPackageWith defaultArgs;
fullPath = p + "/${file}.nix";
callPath = p + /call.nix;
in
assert lib.assertMsg (builtins.pathExists fullPath)
"File attempting to be callPackage'd '${fullPath}' does not exist";
if builtins.pathExists callPath then
let
x = _callPackage callPath { };
in
x.callPackage or _callPackage fullPath (x.args or defaultArgs // args)
else
_callPackage fullPath args;
in
if builtins.pathExists (p + /wrapper.nix) then
# My distaste for rec grows ever stronger
let
set."${n}-unwrapped" = callPackage "package" { };
in
{ ${n} = callPackage "wrapper" set; } // set
else
{ ${n} = callPackage "package" { }; }
))
lib.mergeAttrsList
]