initial commit

This commit is contained in:
NotAShelf 2024-02-04 02:10:17 +03:00
commit 0caff84048
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
5 changed files with 122 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

64
flake.lock Normal file
View file

@ -0,0 +1,64 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1706830856,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1706732774,
"narHash": "sha256-hqJlyJk4MRpcItGYMF+3uHe8HvxNETWvlGtLuVpqLU0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b8b232ae7b8b144397fdb12d20f592e5e7c1a64d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1706550542,
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

27
flake.nix Normal file
View file

@ -0,0 +1,27 @@
{
description = "Hyprland Infrastructure";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux"];
perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShell {
buildInputs = [pkgs.alejandra];
};
};
flake = {
nixosConfigurations = import ./hosts {inherit self;};
};
};
}

1
hosts/caesar/default.nix Normal file
View file

@ -0,0 +1 @@
{}

29
hosts/default.nix Normal file
View file

@ -0,0 +1,29 @@
{self, ...}: let
inherit (self) inputs;
# TODO: move to standalone lib directory
mkSystem = inputs.nixpkgs.lib.nixosSystem;
# mkNixosSystem wraps mkSystem (a.k.a lib.nixosSystem) with flake-parts' withSystem to provide inputs' and self' from flake-parts
# it also acts as a template for my nixos hosts with system type and modules being imported beforehand
# specialArgs is also defined here to avoid defining them for each host and lazily merged if the host defines any other args
mkNixosSystem = {
modules,
system,
hostname,
...
} @ args:
mkSystem {
inherit system;
modules = {networking.hostName = hostname;} // args.modules or {};
specialArgs = {inherit inputs self;} // args.specialArgs or {};
};
in {
"caesar" = mkNixosSystem {
hostname = "caesar";
system = "x86_64-linux";
modules = [
./caesar
];
};
}