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

View file

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

View file

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