mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
Compare commits
4 commits
5d36a9f019
...
6dfed69ac4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6dfed69ac4 | ||
| 6eee3e80ee | |||
| 1b62d16ddc | |||
| c6a9144ffe |
64 changed files with 589 additions and 325 deletions
30
devShells/_default.nix
Normal file
30
devShells/_default.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ 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
|
||||
]
|
||||
1
devShells/default.nix
Normal file
1
devShells/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ mkShellNoCC, sops }: mkShellNoCC { packages = [ sops ]; }
|
||||
18
diskoConfigurations/_default.nix
Normal file
18
diskoConfigurations/_default.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
]
|
||||
265
flake.lock
generated
265
flake.lock
generated
|
|
@ -104,6 +104,38 @@
|
|||
}
|
||||
},
|
||||
"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,
|
||||
|
|
@ -161,6 +193,79 @@
|
|||
"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": [
|
||||
|
|
@ -214,6 +319,52 @@
|
|||
"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",
|
||||
|
|
@ -241,11 +392,11 @@
|
|||
},
|
||||
"master": {
|
||||
"locked": {
|
||||
"lastModified": 1737083351,
|
||||
"narHash": "sha256-hCddtSuk6m6XROmdOC0te0j2sLeUr28QIzNRk0qF1as=",
|
||||
"lastModified": 1737176745,
|
||||
"narHash": "sha256-fnOivdJWuL99CPTTRx4lFRSXTro5f+G2wpKOpbiFjBY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0993fc268872148cebcd1fac8660a8b8ced49542",
|
||||
"rev": "6e0876c53ae460ac162a8931a537f951cbc0a0d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -271,18 +422,42 @@
|
|||
}
|
||||
},
|
||||
"neovim-nightly": {
|
||||
"flake": false,
|
||||
"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": 1737011565,
|
||||
"narHash": "sha256-XMC2JCQzykiV9CtFh6YmPeoiRk065oExTB55Q0sBvCk=",
|
||||
"lastModified": 1731500640,
|
||||
"narHash": "sha256-bxtcbR33ftcSA+7+E52i+cqWAdoCQNFpxR1180HRX48=",
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"rev": "83062e5db634ba7a6a937f72e59b2c2224475a65",
|
||||
"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",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
|
@ -466,6 +641,22 @@
|
|||
"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",
|
||||
|
|
@ -473,14 +664,15 @@
|
|||
"neovim-nightly": "neovim-nightly",
|
||||
"nixpkgs": [
|
||||
"unstable"
|
||||
]
|
||||
],
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737087635,
|
||||
"narHash": "sha256-tOo1OerWaVGcqtNQCFGBiI0646YevrKR9JoK/YzYSLI=",
|
||||
"lastModified": 1737175973,
|
||||
"narHash": "sha256-QWohIcALchkFJmMnVGKr9x7pLieYv/LO+sgXm4BRW4E=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "nvim-flake",
|
||||
"rev": "88bdc350255f56e04218a13261f5c53b7a78b2bc",
|
||||
"rev": "f3397fe34ac9b99f97f9e4f905098308f48dae95",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -570,6 +762,7 @@
|
|||
"spicetify-nix": "spicetify-nix",
|
||||
"stable": "stable",
|
||||
"suckless": "suckless",
|
||||
"systems": "systems_2",
|
||||
"unstable": "unstable"
|
||||
}
|
||||
},
|
||||
|
|
@ -619,11 +812,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736808430,
|
||||
"narHash": "sha256-wlgdf/n7bJMLBheqt1jmPoxJFrUP6FByKQFXuM9YvIk=",
|
||||
"lastModified": 1737107480,
|
||||
"narHash": "sha256-GXUE9+FgxoZU8v0p6ilBJ8NH7k8nKmZjp/7dmMrCv3o=",
|
||||
"owner": "mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "553c7cb22fed19fd60eb310423fdc93045c51ba8",
|
||||
"rev": "4c4fb93f18b9072c6fa1986221f9a3d7bf1fe4b6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -634,17 +827,17 @@
|
|||
},
|
||||
"spicetify-nix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_4",
|
||||
"flake-compat": "flake-compat_6",
|
||||
"nixpkgs": [
|
||||
"unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737087380,
|
||||
"narHash": "sha256-T3WB7rwWDT8cWrwLR7fRRZ1gkgbk3A3dzefEfuGdMxk=",
|
||||
"lastModified": 1737173687,
|
||||
"narHash": "sha256-+WxaXc30KhTuCa9U8Nv2mJApIBq85CfA5fbcVsvdfxo=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "spicetify-nix",
|
||||
"rev": "6510ffbf4e3f9116923632da1e63e9a959d8aa94",
|
||||
"rev": "c68c2ac0814ab386d2cbd3b9178e729b4fc805f0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -689,13 +882,43 @@
|
|||
"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": 1736883708,
|
||||
"narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=",
|
||||
"lastModified": 1737062831,
|
||||
"narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8",
|
||||
"rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
37
flake.nix
37
flake.nix
|
|
@ -94,8 +94,41 @@
|
|||
repo = "reboot-bot";
|
||||
inputs.nixpkgs.follows = "unstable";
|
||||
};
|
||||
|
||||
systems = {
|
||||
type = "github";
|
||||
owner = "nix-systems";
|
||||
repo = "default";
|
||||
};
|
||||
|
||||
outputs = x: import ./outputs.nix x;
|
||||
};
|
||||
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) { })
|
||||
];
|
||||
}
|
||||
|
|
|
|||
1
formatter/_default.nix
Normal file
1
formatter/_default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ inputs', ... }: inputs'.self.packages.lint
|
||||
139
lib/_default.nix
Normal file
139
lib/_default.nix
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
{
|
||||
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
282
lib/default.nix
|
|
@ -1,282 +0,0 @@
|
|||
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
|
||||
];
|
||||
}
|
||||
29
nixosConfigurations/_default.nix
Normal file
29
nixosConfigurations/_default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
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
|
||||
])
|
||||
];
|
||||
}
|
||||
))
|
||||
]
|
||||
|
|
@ -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 is not set
|
||||
CONFIG_OVERLAY_FS=m
|
||||
|
||||
#
|
||||
# Caches
|
||||
20
nixosModules/_default.nix
Normal file
20
nixosModules/_default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
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
|
||||
]
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
options.local.sops.disable = lib.mkEnableOption "";
|
||||
config = lib.mkIf (!config.local.sops.disable) {
|
||||
sops = {
|
||||
defaultSopsFile = "${self'}/hosts/${config.networking.hostName}/secrets.yaml";
|
||||
defaultSopsFile = "${self'}/nixosConfigurations/${config.networking.hostName}/secrets.yaml";
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
};
|
||||
};
|
||||
18
outputs.nix
18
outputs.nix
|
|
@ -1,18 +0,0 @@
|
|||
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";
|
||||
}
|
||||
70
packages/_default.nix
Normal file
70
packages/_default.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
/<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
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue