lib: initial commit, start of custom lib
This commit is contained in:
parent
a83fe448d9
commit
f4373bac52
9 changed files with 102 additions and 71 deletions
10
flake.nix
10
flake.nix
|
@ -1,16 +1,13 @@
|
||||||
{
|
{
|
||||||
description = "My NixOS config flake";
|
description = "My NixOS config flake";
|
||||||
outputs = inputs:
|
outputs = inputs:
|
||||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} ({withSystem, ...}: {
|
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
systems = ["x86_64-linux"];
|
systems = ["x86_64-linux"];
|
||||||
imports = [
|
imports = [
|
||||||
./parts
|
./parts
|
||||||
|
./hosts
|
||||||
];
|
];
|
||||||
|
};
|
||||||
flake = {
|
|
||||||
nixosConfigurations = import ./hosts {inherit inputs withSystem;};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# what am I doing to this config help
|
# what am I doing to this config help
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
@ -58,6 +55,7 @@
|
||||||
|
|
||||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||||
|
|
||||||
|
# I use schizofox as my personal browser. This is because I am schizophrenic.
|
||||||
schizofox = {
|
schizofox = {
|
||||||
url = "github:schizofox/schizofox";
|
url = "github:schizofox/schizofox";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
|
|
@ -3,49 +3,51 @@
|
||||||
withSystem,
|
withSystem,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (inputs) self;
|
# inherit (inputs) self;
|
||||||
inherit (inputs.nixpkgs) lib;
|
inherit (inputs.nixpkgs) lib;
|
||||||
|
inherit (lib.builders) mkSystem;
|
||||||
mkSystem = {
|
# mkSystem = {
|
||||||
withSystem,
|
# withSystem,
|
||||||
system,
|
# system,
|
||||||
...
|
# ...
|
||||||
} @ args:
|
# } @ args:
|
||||||
withSystem system (
|
# withSystem system (
|
||||||
{
|
# {
|
||||||
inputs',
|
# inputs',
|
||||||
self',
|
# self',
|
||||||
...
|
# ...
|
||||||
}:
|
# }:
|
||||||
lib.nixosSystem {
|
# lib.nixosSystem {
|
||||||
inherit system;
|
# inherit system;
|
||||||
specialArgs =
|
# specialArgs =
|
||||||
lib.recursiveUpdate
|
# lib.recursiveUpdate
|
||||||
{
|
# {
|
||||||
inherit lib;
|
# inherit lib;
|
||||||
inherit inputs inputs';
|
# inherit inputs inputs';
|
||||||
inherit self self';
|
# inherit self self';
|
||||||
}
|
# }
|
||||||
(args.specialArgs or {});
|
# (args.specialArgs or {});
|
||||||
inherit (args) modules;
|
# inherit (args) modules;
|
||||||
}
|
# }
|
||||||
);
|
# );
|
||||||
in {
|
in {
|
||||||
temperance = mkSystem {
|
flake.nixosConfigurations = {
|
||||||
inherit withSystem;
|
temperance = mkSystem {
|
||||||
system = "x86_64-linux";
|
inherit withSystem;
|
||||||
modules = [
|
system = "x86_64-linux";
|
||||||
./vali/temperance
|
modules = [
|
||||||
../modules
|
./vali/temperance
|
||||||
];
|
../modules
|
||||||
};
|
];
|
||||||
|
};
|
||||||
|
|
||||||
hermit = mkSystem {
|
hermit = mkSystem {
|
||||||
inherit withSystem;
|
inherit withSystem;
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
./vali/hermit
|
./vali/hermit
|
||||||
../modules
|
../modules
|
||||||
];
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
_: {
|
_: {
|
||||||
imports = [
|
imports = [
|
||||||
# ./fmt.nix
|
./fmt.nix
|
||||||
./shell.nix
|
./shell.nix
|
||||||
./templates
|
./templates
|
||||||
|
./lib
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{inputs, ...}: {
|
||||||
|
imports = [inputs.treefmt-nix.flakeModule];
|
||||||
perSystem = {
|
perSystem = {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
programs = {
|
programs = {
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
|
|
||||||
shellcheck.enable = true; # cannot be configured, errors on basic bash convention
|
shellcheck.enable = true;
|
||||||
|
|
||||||
prettier = {
|
prettier = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
31
parts/lib/builders.nix
Normal file
31
parts/lib/builders.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
mkSystem = {
|
||||||
|
withSystem,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
withSystem system (
|
||||||
|
{
|
||||||
|
inputs',
|
||||||
|
self',
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs =
|
||||||
|
lib.recursiveUpdate
|
||||||
|
{
|
||||||
|
inherit lib;
|
||||||
|
inherit inputs inputs';
|
||||||
|
inherit self self';
|
||||||
|
}
|
||||||
|
(args.specialArgs or {});
|
||||||
|
inherit (args) modules;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
17
parts/lib/default.nix
Normal file
17
parts/lib/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
callLibs = path: import path {inherit inputs lib self;};
|
||||||
|
sussyLib = inputs.nixpkgs.lib.extend (final: prev: {
|
||||||
|
builders = callLibs ./builders.nix;
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
flake = {
|
||||||
|
lib = sussyLib;
|
||||||
|
# raf what the hell does this do you made me set it
|
||||||
|
_module.args.lib = sussyLib;
|
||||||
|
};
|
||||||
|
}
|
0
parts/lib/systemd.nix
Normal file
0
parts/lib/systemd.nix
Normal file
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
perSystem = _: {
|
|
||||||
pre-commit = {
|
|
||||||
settings = {
|
|
||||||
excludes = ["flake.lock"];
|
|
||||||
hooks = {
|
|
||||||
alejandra.enable = true;
|
|
||||||
prettier.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
DIRENV_LOG_FORMAT = "";
|
DIRENV_LOG_FORMAT = "";
|
||||||
|
|
||||||
# inputsFrom = [config.treefmt.build.devShell];
|
inputsFrom = [config.treefmt.build.devShell];
|
||||||
packages = [
|
packages = [
|
||||||
# config.treefmt.build.wrapper # treewide formatter
|
config.treefmt.build.wrapper # treewide formatter
|
||||||
pkgs.git # take a guess
|
pkgs.git # take a guess
|
||||||
|
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
|
@ -20,12 +20,6 @@
|
||||||
nix flake update && git commit flake.lock -m "flake: bump inputs"
|
nix flake update && git commit flake.lock -m "flake: bump inputs"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
(pkgs.writeShellApplication {
|
|
||||||
name = "rebuild";
|
|
||||||
text = ''
|
|
||||||
nh os switch
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue