feat(flake): move to withSystem & implement defaults system input

This commit is contained in:
ooks-io 2024-06-16 15:40:41 +12:00
parent 2152c91101
commit f9a2e83e74
4 changed files with 64 additions and 72 deletions

View file

@ -3,23 +3,20 @@
description = "a nix configuration written by an orangutan";
outputs = { flake-parts, nixpkgs, self, ... } @ inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
flake-parts.lib.mkFlake { inherit inputs; } ({withSystem, ... }: {
systems = [
"x86_64-linux"
"aarch64-linux"
];
systems = import inputs.systems;
imports = [
./outputs/pkgs
./outputs/nixos.nix
./outputs/sshKeys.nix
];
# flake = {
# nixosConfigurations = import ./flake/nixos.nix {inherit self inputs nixpkgs;};
# };
flake = {
nixosConfigurations = import ./outputs/nixos.nix {inherit self inputs withSystem;};
};
};
});
# External inputs we depend on
inputs = {
@ -34,6 +31,8 @@
# contains more up-to-date wayland related packages. no need enabling atm
# nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# default system see <https://github.com/nix-systems/nix-systems>
systems.url = "github:nix-systems/default-linux";
# split your flake into... parts?
flake-parts = {
url = "github:hercules-ci/flake-parts";
@ -73,6 +72,8 @@
# colorschemes library
nix-colors.url = "github:misterio77/nix-colors";
# secret management
agenix.url = "github:ryantm/agenix";
# hyprland "ecosystem". hyprDE perhaps?
# hyprland = {

View file

@ -1,8 +1,4 @@
{ lib, pkgs, ... }:
let
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
in
{ lib, pkgs, keys, ... }:
{
imports = [
@ -17,7 +13,7 @@ in
admin = {
name = "ooks";
shell = "fish";
sshKey = key;
sshKey = "${keys.users.ooks}";
homeManager = true;
};
networking = {

View file

@ -1,64 +1,66 @@
{ inputs, self, ... }:
{ inputs, self, withSystem, ... }:
let
inherit (inputs.nixpkgs.lib) nixosSystem;
inherit (self) keys;
hm = inputs.home-manager.nixosModules.home-manager;
nixarr = inputs.nixarr.nixosModules.default;
agenix = inputs.agenix.nixosModules.default;
nixosModules = "${self}/nixos";
hosts = "${self}/hosts";
specialArgs = {inherit inputs self;};
specialArgs = {inherit withSystem keys inputs self;};
in
{
flake.nixosConfigurations = {
ooksdesk = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksdesk"
hm
nixosModules
];
};
ookst480s = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ookst480s"
hm
nixosModules
];
};
ooksmedia = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksmedia"
hm
nixosModules
nixarr
];
};
ooksmicro = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksmicro"
hm
nixosModules
];
};
ooksx1 = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksx1"
hm
nixosModules
];
};
ooksdesk = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksdesk"
hm
agenix
nixosModules
];
};
ookst480s = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ookst480s"
hm
nixosModules
];
};
ooksmedia = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksmedia"
hm
nixosModules
nixarr
];
};
ooksmicro = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksmicro"
hm
nixosModules
];
};
ooksx1 = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
"${hosts}/ooksx1"
hm
nixosModules
];
};
}

View file

@ -1,7 +0,0 @@
{ pkgs ? (import ./nixpkgs.nix) { } }: {
default = pkgs.mkShell {
# Enable experimental features without having to specify the argument
NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [ nix home-manager git neovim ];
};
}