flake/flake.nix

228 lines
6.7 KiB
Nix
Raw Normal View History

2023-09-19 00:17:43 +00:00
{
2023-11-03 15:16:07 +00:00
description = "Guanran928's Flake";
2023-09-19 00:17:43 +00:00
inputs = {
# INFO: `nixos-unstable` and `nixpkgs-unstable` contains the same set of packages,
# the difference between those channels is their jobsets,
# `nixpkgs-unstable` contains less(?) jobs, and usually updates faster.
#
# REFERENCE: https://discourse.nixos.org/t/differences-between-nix-channels/13998/5
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2023-12-27 07:04:14 +00:00
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
2023-10-14 07:53:25 +00:00
aagl = {
url = "github:ezKEa/aagl-gtk-on-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-compat.follows = "flake-compat";
};
2023-10-15 00:51:56 +00:00
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-12-17 12:06:05 +00:00
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
2023-09-19 00:17:43 +00:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-12-16 08:32:13 +00:00
impermanence = {
url = "github:nix-community/impermanence";
};
2023-09-19 00:17:43 +00:00
lanzaboote = {
url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs";
2023-11-03 15:18:31 +00:00
inputs.crane.follows = "crane";
inputs.flake-compat.follows = "flake-compat";
inputs.flake-parts.follows = "flake-parts";
inputs.flake-utils.follows = "flake-utils";
inputs.pre-commit-hooks-nix.follows = "pre-commit-hooks-nix";
inputs.rust-overlay.follows = "rust-overlay";
2023-09-19 00:17:43 +00:00
};
2024-02-26 18:03:00 +00:00
neovim = {
2024-07-04 05:29:18 +00:00
url = "git+https://git.ny4.dev/nyancat/nvim";
2024-02-26 18:03:00 +00:00
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
2024-03-23 06:17:09 +00:00
inputs.treefmt-nix.follows = "treefmt-nix";
inputs.systems.follows = "systems";
2024-02-26 18:03:00 +00:00
};
2023-09-19 00:17:43 +00:00
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-12-16 08:32:13 +00:00
nixos-hardware = {
2024-07-23 16:14:27 +00:00
url = "github:Guanran928/nixos-hardware/lenovo-thinkpad-x1-12th-gen";
2023-12-16 08:32:13 +00:00
};
2024-03-26 14:24:51 +00:00
nixos-sensible = {
url = "github:Guanran928/nixos-sensible";
};
nix-on-droid = {
url = "github:nix-community/nix-on-droid/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-for-bootstrap.follows = "nixpkgs";
inputs.nixpkgs-docs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
inputs.nix-formatter-pack.follows = "nix-formatter-pack";
inputs.nmd.follows = "nmd";
};
2024-02-27 07:38:36 +00:00
nur = {
url = "github:nix-community/NUR";
};
2023-10-15 00:51:56 +00:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
2023-11-03 15:18:31 +00:00
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
2024-04-22 18:35:50 +00:00
srvos = {
url = "github:nix-community/srvos";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-12-03 08:41:22 +00:00
systems.url = "github:nix-systems/default";
2024-03-09 01:44:41 +00:00
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-11-03 15:18:31 +00:00
### De-dupe flake dependencies
2023-11-03 15:18:31 +00:00
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-formatter-pack = {
url = "github:Gerschtli/nix-formatter-pack";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nmd.follows = "nmd";
inputs.nmt.follows = "nmt";
};
nmd = {
url = "sourcehut:~rycee/nmd";
inputs.nixpkgs.follows = "nixpkgs";
inputs.scss-reset.follows = "scss-reset";
};
nmt = {
url = "sourcehut:~rycee/nmt";
flake = false;
};
2023-11-03 15:18:31 +00:00
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
inputs.flake-compat.follows = "flake-compat";
inputs.gitignore.follows = "gitignore";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
scss-reset = {
url = "github:andreymatin/scss-reset";
flake = false;
};
2023-09-19 00:17:43 +00:00
};
2024-03-09 04:06:08 +00:00
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = inputs.nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
2024-03-09 04:25:06 +00:00
in {
### nix fmt
formatter = treefmtEval.config.build.wrapper;
### nix flake check
checks = {formatting = treefmtEval.config.build.check inputs.self;};
2023-12-17 14:00:56 +00:00
2024-03-09 04:25:06 +00:00
### nix {run,shell,build}
2024-07-11 23:59:21 +00:00
legacyPackages = import ./pkgs pkgs;
2024-06-20 14:04:34 +00:00
### nix develop
devShells.default = pkgs.mkShell {
packages = with pkgs; [
alejandra
colmena
git
sops
];
};
2024-03-09 04:25:06 +00:00
})
// (let
2024-03-09 04:06:08 +00:00
mkNixOS = system: modules:
inputs.nixpkgs.lib.nixosSystem {
2024-07-09 23:12:02 +00:00
inherit system;
modules = [./nixos/profiles/core] ++ modules;
2024-03-09 04:06:08 +00:00
specialArgs = {inherit inputs;};
};
2023-12-17 14:00:56 +00:00
2024-03-09 04:06:08 +00:00
mkDarwin = system: modules:
inputs.nix-darwin.lib.darwinSystem {
inherit system modules;
specialArgs = {inherit inputs;};
};
mkDroid = modules:
inputs.nix-on-droid.lib.nixOnDroidConfiguration {
inherit modules;
extraSpecialArgs = {inherit inputs;};
};
2024-03-09 04:06:08 +00:00
in {
### imports = [];
nixosModules.default = ./nixos/modules;
darwinModules.default = ./darwin/modules;
homeManagerModules.default = ./home/modules;
2024-03-09 04:25:06 +00:00
### nixpkgs.overlays = [];
overlays = import ./overlays;
2024-03-09 04:06:08 +00:00
### NixOS
nixosConfigurations = {
"aristotle" = mkNixOS "x86_64-linux" [./hosts/aristotle];
"blacksteel" = mkNixOS "x86_64-linux" [./hosts/blacksteel];
2024-07-23 16:14:27 +00:00
"dust" = mkNixOS "x86_64-linux" [./hosts/dust];
2024-03-09 04:06:08 +00:00
};
### Darwin
darwinConfigurations = {
"plato" = mkDarwin "x86_64-darwin" [./hosts/plato];
"whitesteel" = mkDarwin "x86_64-darwin" [./hosts/whitesteel];
};
nixOnDroidConfigurations = {
2024-07-10 00:10:27 +00:00
"enchilada" = mkDroid [./hosts/enchilada];
};
2024-04-22 18:35:50 +00:00
colmena = {
meta = {
specialArgs = {inherit inputs;};
nixpkgs = import inputs.nixpkgs {
system = "x86_64-linux"; # How does this work?
};
};
2024-07-10 09:57:01 +00:00
defaults.imports = [
./nixos/profiles/core
];
2024-04-22 18:35:50 +00:00
"lightsail-tokyo" = {
2024-07-10 09:57:01 +00:00
imports = [./hosts/lightsail-tokyo];
2024-06-05 09:50:46 +00:00
deployment.targetHost = "tyo0.ny4.dev";
};
"blacksteel" = {
2024-07-10 09:57:01 +00:00
imports = [./hosts/blacksteel];
2024-06-05 09:50:46 +00:00
deployment.targetHost = "blacksteel"; # thru tailscale
2024-04-22 18:35:50 +00:00
};
};
2024-03-09 04:06:08 +00:00
});
2023-09-19 00:17:43 +00:00
}