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";
|
||||
outputs = inputs:
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} ({withSystem, ...}: {
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = ["x86_64-linux"];
|
||||
imports = [
|
||||
./parts
|
||||
./hosts
|
||||
];
|
||||
|
||||
flake = {
|
||||
nixosConfigurations = import ./hosts {inherit inputs withSystem;};
|
||||
};
|
||||
});
|
||||
};
|
||||
inputs = {
|
||||
# what am I doing to this config help
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
@ -58,6 +55,7 @@
|
|||
|
||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||
|
||||
# I use schizofox as my personal browser. This is because I am schizophrenic.
|
||||
schizofox = {
|
||||
url = "github:schizofox/schizofox";
|
||||
inputs = {
|
||||
|
|
|
@ -3,49 +3,51 @@
|
|||
withSystem,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs) self;
|
||||
# inherit (inputs) self;
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
|
||||
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;
|
||||
}
|
||||
);
|
||||
inherit (lib.builders) mkSystem;
|
||||
# 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;
|
||||
# }
|
||||
# );
|
||||
in {
|
||||
temperance = mkSystem {
|
||||
inherit withSystem;
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./vali/temperance
|
||||
../modules
|
||||
];
|
||||
};
|
||||
flake.nixosConfigurations = {
|
||||
temperance = mkSystem {
|
||||
inherit withSystem;
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./vali/temperance
|
||||
../modules
|
||||
];
|
||||
};
|
||||
|
||||
hermit = mkSystem {
|
||||
inherit withSystem;
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./vali/hermit
|
||||
../modules
|
||||
];
|
||||
hermit = mkSystem {
|
||||
inherit withSystem;
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./vali/hermit
|
||||
../modules
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
_: {
|
||||
imports = [
|
||||
# ./fmt.nix
|
||||
./fmt.nix
|
||||
./shell.nix
|
||||
./templates
|
||||
./lib
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
{inputs, ...}: {
|
||||
imports = [inputs.treefmt-nix.flakeModule];
|
||||
perSystem = {
|
||||
config,
|
||||
pkgs,
|
||||
|
@ -15,7 +16,7 @@
|
|||
programs = {
|
||||
alejandra.enable = true;
|
||||
|
||||
shellcheck.enable = true; # cannot be configured, errors on basic bash convention
|
||||
shellcheck.enable = true;
|
||||
|
||||
prettier = {
|
||||
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 = "";
|
||||
|
||||
# inputsFrom = [config.treefmt.build.devShell];
|
||||
inputsFrom = [config.treefmt.build.devShell];
|
||||
packages = [
|
||||
# config.treefmt.build.wrapper # treewide formatter
|
||||
config.treefmt.build.wrapper # treewide formatter
|
||||
pkgs.git # take a guess
|
||||
|
||||
(pkgs.writeShellApplication {
|
||||
|
@ -20,12 +20,6 @@
|
|||
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