setup repo structure (& test system config)
This commit is contained in:
commit
67c2250833
12 changed files with 573 additions and 0 deletions
90
flake.nix
Normal file
90
flake.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
description = "lillinfra - lillys infrastructure configuration";
|
||||
|
||||
inputs = {
|
||||
# nixpkgs
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";
|
||||
|
||||
# some helpers for writing flakes with less repitition
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
|
||||
# dotfile (and user package) manager
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager?ref=release-24.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# secret management
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# lix package manager
|
||||
# https://lix.systems
|
||||
lix = {
|
||||
url = "git+https://git.lix.systems/lix-project/nixos-module.git?ref=release-2.91";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# treeformat for specifying how to properly format files in this repo
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
systems,
|
||||
treefmt-nix,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# instantiate nixpkgs for the given system, configuring this flake's overlay (and therefor packages) too
|
||||
mkPkgs =
|
||||
system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
# helper to iterate over all supported systems, passing the corresponding instantiated nixpkgs
|
||||
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f (mkPkgs system));
|
||||
# evaluate the treefmt.nix module given an instantiated nixpkgs
|
||||
treefmtEval = pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||
in
|
||||
{
|
||||
nixosConfigurations = import ./systems { flake = self; };
|
||||
overlays.default =
|
||||
final: prev:
|
||||
import ./packages {
|
||||
flake = self;
|
||||
pkgs = prev;
|
||||
};
|
||||
packages = eachSystem (
|
||||
pkgs:
|
||||
import ./packages {
|
||||
inherit pkgs;
|
||||
flake = self;
|
||||
}
|
||||
);
|
||||
|
||||
devShells = eachSystem (pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
age
|
||||
ssh-to-age
|
||||
pre-commit
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
# maintenance
|
||||
formatter = eachSystem (pkgs: (treefmtEval pkgs).config.build.wrapper);
|
||||
checks = eachSystem (pkgs: {
|
||||
formatting = (treefmtEval pkgs).config.build.check self;
|
||||
});
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue