mirror of
https://github.com/nmasur/dotfiles
synced 2025-03-14 21:37:04 +00:00
still working on consolidating
This commit is contained in:
parent
1eae89b8ab
commit
bf273925ad
@ -1,20 +0,0 @@
|
|||||||
# Return an atrset of all colorschemes
|
|
||||||
|
|
||||||
nixpkgs:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (nixpkgs) lib;
|
|
||||||
in
|
|
||||||
|
|
||||||
lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
|
||||||
# Get only files ending in default.nix
|
|
||||||
(builtins.filter (name: lib.hasSuffix "default.nix" name))
|
|
||||||
# Import each colorscheme function
|
|
||||||
(map (file: {
|
|
||||||
name = builtins.baseNameOf (builtins.dirOf file);
|
|
||||||
value = import file;
|
|
||||||
}))
|
|
||||||
# Convert to an attrset of colorscheme -> colors
|
|
||||||
(builtins.listToAttrs)
|
|
||||||
|
|
||||||
]
|
|
187
flake.nix
187
flake.nix
@ -211,6 +211,7 @@
|
|||||||
{ nixpkgs, ... }@inputs:
|
{ nixpkgs, ... }@inputs:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
lib = import ./lib inputs;
|
||||||
|
|
||||||
# Global configuration for my systems
|
# Global configuration for my systems
|
||||||
globals =
|
globals =
|
||||||
@ -250,136 +251,53 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
colorscheme = import ./colorscheme;
|
|
||||||
|
|
||||||
# Common overlays to always use
|
|
||||||
overlays = [
|
|
||||||
inputs.nur.overlays.default
|
|
||||||
inputs.nix2vim.overlay
|
|
||||||
] ++ (import ./overlays inputs);
|
|
||||||
|
|
||||||
# System types to support.
|
|
||||||
supportedSystems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
"x86_64-darwin"
|
|
||||||
"aarch64-linux"
|
|
||||||
"aarch64-darwin"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
||||||
|
|
||||||
# { system -> pkgs }
|
|
||||||
pkgsBySystem = forAllSystems (
|
|
||||||
system:
|
|
||||||
import nixpkgs {
|
|
||||||
inherit system overlays;
|
|
||||||
config.permittedInsecurePackages = [ "litestream-0.3.13" ];
|
|
||||||
config.allowUnfree = true;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
# stablePkgsBySystem = forAllSystems (system: import nixpkgs { inherit system overlays; });
|
|
||||||
|
|
||||||
buildHome =
|
|
||||||
{ pkgs, modules }:
|
|
||||||
inputs.home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = modules ++ [
|
|
||||||
./platforms/home-manager
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
buildNixos =
|
|
||||||
{ pkgs, modules }:
|
|
||||||
nixpkgs.lib.nixosSystem {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = modules ++ [
|
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
inputs.disko.nixosModules.disko
|
|
||||||
inputs.wsl.nixosModules.wsl
|
|
||||||
./platforms/nixos
|
|
||||||
{
|
|
||||||
home-manager.extraSpecialArgs = {
|
|
||||||
hostnames = globals.hostnames;
|
|
||||||
inherit colorscheme;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
hostnames = globals.hostnames;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
buildDarwin =
|
|
||||||
{ pkgs, modules }:
|
|
||||||
inputs.darwin.lib.darwinSystem {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = modules ++ [
|
|
||||||
inputs.home-manager.darwinModules.home-manager
|
|
||||||
inputs.mac-app-util.darwinModules.default
|
|
||||||
./platforms/nix-darwin
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
x86_64-linux-hosts = (import ./hosts nixpkgs).x86_64-linux-hosts;
|
|
||||||
aarch64-linux-hosts = (import ./hosts nixpkgs).aarch64-linux-hosts;
|
|
||||||
aarch64-darwin-hosts = (import ./hosts nixpkgs).aarch64-darwin-hosts;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
# The plan
|
inherit lib;
|
||||||
# Import all the host configurations as modules
|
# inherit buildDarwin pkgsBySystem;
|
||||||
# Setup the modules as nixosModules, homeModules, darwinModules
|
#
|
||||||
# Create nixosConfigurations using the different pkgs for each system
|
# # Contains my full system builds, including home-manager
|
||||||
# What to do with home config?
|
# # nixos-rebuild switch --flake .#tempest
|
||||||
|
# nixosConfigurations =
|
||||||
nixosModules = x86_64-linux-hosts // aarch64-linux-hosts;
|
# (builtins.mapAttrs (
|
||||||
darwinModules = aarch64-darwin-hosts;
|
# name: module:
|
||||||
|
# buildNixos {
|
||||||
inherit buildDarwin pkgsBySystem;
|
# pkgs = pkgsBySystem.x86_64-linux;
|
||||||
|
# modules = [ module ];
|
||||||
# Contains my full system builds, including home-manager
|
# }
|
||||||
# nixos-rebuild switch --flake .#tempest
|
# ) x86_64-linux-hosts)
|
||||||
nixosConfigurations =
|
# // (builtins.mapAttrs (
|
||||||
(builtins.mapAttrs (
|
# name: module:
|
||||||
name: module:
|
# buildNixos {
|
||||||
buildNixos {
|
# pkgs = pkgsBySystem.aarch64-linux;
|
||||||
pkgs = pkgsBySystem.x86_64-linux;
|
# modules = [ module ];
|
||||||
modules = [ module ];
|
# }
|
||||||
}
|
# ) aarch64-linux-hosts);
|
||||||
) x86_64-linux-hosts)
|
#
|
||||||
// (builtins.mapAttrs (
|
# # Contains my full Mac system builds, including home-manager
|
||||||
name: module:
|
# # darwin-rebuild switch --flake .#lookingglass
|
||||||
buildNixos {
|
# darwinConfigurations = builtins.mapAttrs (
|
||||||
pkgs = pkgsBySystem.aarch64-linux;
|
# name: module:
|
||||||
modules = [ module ];
|
# buildDarwin {
|
||||||
}
|
# pkgs = pkgsBySystem.aarch64-darwin;
|
||||||
) aarch64-linux-hosts);
|
# modules = [ module ];
|
||||||
|
# }
|
||||||
# Contains my full Mac system builds, including home-manager
|
# ) aarch64-darwin-hosts;
|
||||||
# darwin-rebuild switch --flake .#lookingglass
|
#
|
||||||
darwinConfigurations = builtins.mapAttrs (
|
# # For quickly applying home-manager settings with:
|
||||||
name: module:
|
# # home-manager switch --flake .#tempest
|
||||||
buildDarwin {
|
# homeConfigurations = builtins.mapAttrs (
|
||||||
pkgs = pkgsBySystem.aarch64-darwin;
|
# name: module:
|
||||||
modules = [ module ];
|
# buildHome {
|
||||||
}
|
# pkgs = pkgsBySystem.x86_64-linux;
|
||||||
) aarch64-darwin-hosts;
|
# module = [ module ];
|
||||||
|
# }
|
||||||
# For quickly applying home-manager settings with:
|
# ) nixosModules;
|
||||||
# home-manager switch --flake .#tempest
|
|
||||||
homeConfigurations = builtins.mapAttrs (
|
|
||||||
name: module:
|
|
||||||
buildHome {
|
|
||||||
pkgs = pkgsBySystem.x86_64-linux;
|
|
||||||
module = [ module ];
|
|
||||||
}
|
|
||||||
) nixosModules;
|
|
||||||
|
|
||||||
# Disk formatting, only used once
|
# Disk formatting, only used once
|
||||||
diskoConfigurations = {
|
diskoConfigurations = {
|
||||||
root = import ./disks/root.nix;
|
root = import ./hosts/x86_64-linux/swan/root.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
# packages =
|
# packages =
|
||||||
@ -437,17 +355,21 @@
|
|||||||
# aarch64-darwin.neovim = neovim "aarch64-darwin";
|
# aarch64-darwin.neovim = neovim "aarch64-darwin";
|
||||||
# };
|
# };
|
||||||
|
|
||||||
packages = forAllSystems (system: pkgsBySystem.${system}.nmasur);
|
# Get the custom packages that I have placed under the nmasur namespace
|
||||||
|
packages = lib.forAllSystems (system: lib.pkgsBySystem.${system}.nmasur);
|
||||||
|
|
||||||
# Development environments
|
# Development environments
|
||||||
devShells = forAllSystems (system: {
|
devShells = lib.forAllSystems (system: {
|
||||||
default = pkgsBySystem.${system}.nmasur.dotfiles-devshell;
|
default = lib.pkgsBySystem.${system}.nmasur.dotfiles-devshell;
|
||||||
});
|
});
|
||||||
|
|
||||||
checks = forAllSystems (
|
checks = lib.forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = lib.overlays;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
neovim =
|
neovim =
|
||||||
@ -466,10 +388,13 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
formatter = forAllSystems (
|
formatter = lib.forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
inherit (lib) overlays;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
pkgs.nixfmt-rfc-style
|
pkgs.nixfmt-rfc-style
|
||||||
);
|
);
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
# Return a list of all NixOS hosts
|
|
||||||
|
|
||||||
{ nixpkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (nixpkgs) lib;
|
|
||||||
in
|
|
||||||
|
|
||||||
lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
|
||||||
# Get only files ending in default.nix
|
|
||||||
(builtins.filter (name: lib.hasSuffix "default.nix" name))
|
|
||||||
# Remove this file
|
|
||||||
(builtins.filter (name: name != ./default.nix))
|
|
||||||
# Import each host function
|
|
||||||
map
|
|
||||||
(file: {
|
|
||||||
name = builtins.baseNameOf (builtins.dirOf file);
|
|
||||||
value = import file;
|
|
||||||
})
|
|
||||||
# Convert to an attrset of hostname -> host function
|
|
||||||
(builtins.listToAttrs)
|
|
||||||
]
|
|
@ -61,4 +61,92 @@ lib
|
|||||||
))
|
))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Common overlays to always use
|
||||||
|
overlays = [
|
||||||
|
inputs.nur.overlays.default
|
||||||
|
inputs.nix2vim.overlay
|
||||||
|
] ++ (importOverlays ../overlays);
|
||||||
|
|
||||||
|
# System types to support.
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Split system types by operating system
|
||||||
|
linuxSystems = builtins.filter (lib.hasSuffix "linux") supportedSystems;
|
||||||
|
darwinSystems = builtins.filter (lib.hasSuffix "darwin") supportedSystems;
|
||||||
|
|
||||||
|
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
||||||
|
forSystems = systems: lib.genAttrs systems;
|
||||||
|
forAllSystems = lib.genAttrs supportedSystems;
|
||||||
|
|
||||||
|
# { x86_64-linux = { tempest = { settings = ...; }; }; };
|
||||||
|
hosts = forAllSystems (system: defaultFilesToAttrset ../hosts/${system});
|
||||||
|
|
||||||
|
linuxHosts = lib.filterAttrs (name: value: builtins.elem name linuxSystems) hosts;
|
||||||
|
darwinHosts = lib.filterAttrs (name: value: builtins.elem name darwinSystems) hosts;
|
||||||
|
|
||||||
|
# { system -> pkgs }
|
||||||
|
pkgsBySystem = forAllSystems (
|
||||||
|
system:
|
||||||
|
import inputs.nixpkgs {
|
||||||
|
inherit system overlays;
|
||||||
|
config.permittedInsecurePackages = [ "litestream-0.3.13" ];
|
||||||
|
config.allowUnfree = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
colorscheme = defaultFilesToAttrset ../colorscheme;
|
||||||
|
|
||||||
|
buildHome =
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
modules,
|
||||||
|
}:
|
||||||
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
|
modules = modules ++ [
|
||||||
|
../platforms/home-manager
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
buildNixos =
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
modules,
|
||||||
|
specialArgs,
|
||||||
|
}:
|
||||||
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
inherit pkgs;
|
||||||
|
modules = modules ++ [
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
inputs.wsl.nixosModules.wsl
|
||||||
|
../platforms/nixos
|
||||||
|
{
|
||||||
|
home-manager.extraSpecialArgs = {
|
||||||
|
hostnames = globals.hostnames;
|
||||||
|
inherit colorscheme;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
specialArgs = {
|
||||||
|
hostnames = globals.hostnames;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
buildDarwin =
|
||||||
|
{ pkgs, modules }:
|
||||||
|
inputs.darwin.lib.darwinSystem {
|
||||||
|
inherit pkgs;
|
||||||
|
modules = modules ++ [
|
||||||
|
inputs.home-manager.darwinModules.home-manager
|
||||||
|
inputs.mac-app-util.darwinModules.default
|
||||||
|
./platforms/nix-darwin
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
# Return a list of all overlays
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
|
|
||||||
let
|
|
||||||
lib = inputs.nixpkgs.lib;
|
|
||||||
in
|
|
||||||
|
|
||||||
lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
|
||||||
# Get only files ending in .nix
|
|
||||||
(builtins.filter (name: lib.hasSuffix ".nix" name))
|
|
||||||
# Remove this file
|
|
||||||
(builtins.filter (name: name != ./default.nix))
|
|
||||||
# Import each overlay file
|
|
||||||
(map (file: (import file) inputs))
|
|
||||||
]
|
|
Loading…
x
Reference in New Issue
Block a user