apply format

This commit is contained in:
Fabian Montero 2024-09-08 14:50:36 -06:00
parent 34e3cdaf81
commit 3044c426fd
Signed by: fabian
GPG key ID: 1FFAC35E1798174F
7 changed files with 1442 additions and 90 deletions

1295
flake.lock Normal file

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,6 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
vpsadminos.url = "github:vpsfreecz/vpsadminos"; vpsadminos.url = "github:vpsfreecz/vpsadminos";
homepage.url = "git+https://git.posixlycorrect.com/fabian/homepage.git?ref=master"; homepage.url = "git+https://git.posixlycorrect.com/fabian/homepage.git?ref=master";
conduwuit = { conduwuit = {
@ -53,11 +52,12 @@
}: let }: let
system = "x86_64-linux"; system = "x86_64-linux";
importPkgs = flake: import flake { importPkgs = flake:
import flake {
inherit system; inherit system;
config = import ./pkgs/config nixpkgs.lib; config = import ./pkgs/config nixpkgs.lib;
overlays = [ nur.overlay self.overlays.default ]; overlays = [nur.overlay self.overlays.default];
}; };
pkgs = importPkgs nixpkgs; pkgs = importPkgs nixpkgs;
@ -65,24 +65,23 @@
inherit (pkgs.local.lib) importAll; inherit (pkgs.local.lib) importAll;
local = import ./pkgs; local = import ./pkgs;
in in
with pkgs.lib; { with pkgs.lib; {
formatter.${system} = pkgs.alejandra; formatter.${system} = pkgs.alejandra;
packages.${system} = pkgs.local; packages.${system} = pkgs.local;
overlays.default = final: prev: overlays.default = final: prev: let
let
locals = local final prev; locals = local final prev;
in in
locals.override // { locals.override
// {
local = locals; local = locals;
unstable = importPkgs unstable; unstable = importPkgs unstable;
}; };
nixosConfigurations = nixosConfigurations = let
let nixosSystem = {modules}:
nixosSystem = { modules }: makeOverridable nixpkgs.lib.nixosSystem { makeOverridable nixpkgs.lib.nixosSystem {
inherit modules pkgs system; inherit modules pkgs system;
specialArgs = { specialArgs = {
@ -90,28 +89,27 @@
}; };
}; };
hostConfig = host: nixosSystem { hostConfig = host:
nixosSystem {
modules = [ modules = [
./sys ./sys
host host
]; ];
}; };
in in
mapAttrs (_: hostConfig) (importAll { root = ./sys/platforms; }); mapAttrs (_: hostConfig) (importAll {root = ./sys/platforms;});
homeConfigurations = let
homeConfigurations = registry = {...}: {
let config.nix.registry = mapAttrs (_:
registry = { ... }: { value {
config.nix.registry = mapAttrs (
_: value {
flake = value; flake = value;
} })
) flakes; flakes;
}; };
home = platform: home-manager.lib.homeManagerConfiguration { home = platform:
home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
@ -122,40 +120,13 @@
]; ];
}; };
platformHome = platform: platformHome = platform: let
let
value = home platform; value = home platform;
in in {
{
inherit value; inherit value;
name = "${value.config.home.username}@${value.config.local.hostname}"; name = "${value.config.home.username}@${value.config.local.hostname}";
}; };
in in
mapAttrs' (_: platformHome) (importAll { root = ./home/platforms; }); mapAttrs' (_: platformHome) (importAll {root = ./home/platforms;});
}; };
} }

5
pkgs/config/default.nix Normal file
View file

@ -0,0 +1,5 @@
lib:
with lib; {
android_sdk.accept_license = true;
allowUnfreePredicate = pkg: import ./unfree.nix lib (getName pkg);
}

13
pkgs/config/unfree.nix Normal file
View file

@ -0,0 +1,13 @@
lib: name:
with lib;
elem name [
"discord"
"rar"
"spotify"
"spotify-unwrapped"
"steam"
"steam-original"
"steam-run"
"teams"
"zoom"
]

45
pkgs/default.nix Normal file
View file

@ -0,0 +1,45 @@
final: prev:
with prev.lib; let
inherit (final) callPackage fetchpatch;
in {
lib = callPackage ./lib {};
st = prev.st.override {
conf = import ./st.nix {};
patches = [
(fetchpatch {
url = "https://st.suckless.org/patches/clipboard/st-clipboard-0.8.3.diff";
sha256 = "cbb37675e9b4986836c19aadacc616a006df81c9bf394e9e3573e164fa1867cf";
})
];
};
override =
{
}
// (
let
makePyOverrides = version: let
name = "python3${toString version}";
in {
inherit name;
value = prev.${name}.override {
packageOverrides = nextPy: prevPy: {
};
};
};
pyVersionRange' = start: end: let
next = end + 1;
in
if prev ? "python3${toString next}"
then pyVersionRange' start next
else range start end;
pyVersionRange = start: pyVersionRange' start start;
in
listToAttrs (map makePyOverrides (pyVersionRange 9))
);
}

3
pkgs/lib/default.nix Normal file
View file

@ -0,0 +1,3 @@
{callPackage}: {
importAll = callPackage ./importAll.nix {};
}

20
pkgs/lib/importAll.nix Normal file
View file

@ -0,0 +1,20 @@
{lib}: {
root,
exclude ? [],
}:
with builtins;
with lib;
# http://chriswarbo.net/projects/nixos/useful_hacks.html
let
basename = removeSuffix ".nix";
isMatch = name: type:
(hasSuffix ".nix" name || type == "directory")
&& ! elem name (map basename exclude);
entry = name: _: {
name = basename name;
value = import (root + "/${name}");
};
in
mapAttrs' entry (filterAttrs isMatch (readDir root))