2021-10-26 18:25:19 +00:00
|
|
|
{
|
2021-10-28 22:15:24 +00:00
|
|
|
description = "nki's systems";
|
2021-10-26 18:25:19 +00:00
|
|
|
|
|
|
|
inputs = {
|
2024-06-01 15:29:45 +00:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
2023-04-18 23:09:20 +00:00
|
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
2024-06-20 01:36:47 +00:00
|
|
|
nixos-hardware.url = "github:nixos/nixos-hardware";
|
2021-10-26 18:25:19 +00:00
|
|
|
darwin.url = "github:lnl7/nix-darwin/master";
|
|
|
|
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2024-05-27 09:03:15 +00:00
|
|
|
home-manager.url = "github:nix-community/home-manager/release-24.05";
|
2021-12-01 18:52:13 +00:00
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
2024-06-22 14:53:58 +00:00
|
|
|
home-manager-unstable.url = "github:nix-community/home-manager";
|
|
|
|
home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2021-10-28 22:15:24 +00:00
|
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
2022-11-14 14:25:54 +00:00
|
|
|
sops-nix.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-12-05 09:59:59 +00:00
|
|
|
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
|
2021-10-31 19:06:44 +00:00
|
|
|
deploy-rs.url = "github:Serokell/deploy-rs";
|
2021-10-28 22:15:24 +00:00
|
|
|
nur.url = "github:nix-community/NUR";
|
2021-10-29 04:25:58 +00:00
|
|
|
|
2023-08-30 21:53:14 +00:00
|
|
|
# --- Secure boot
|
|
|
|
lanzaboote = {
|
|
|
|
url = github:nix-community/lanzaboote/v0.3.0;
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
2022-09-02 21:07:53 +00:00
|
|
|
# --- Build tools
|
2022-05-31 16:45:33 +00:00
|
|
|
flake-utils.url = github:numtide/flake-utils;
|
2022-09-02 21:07:53 +00:00
|
|
|
crane.url = github:ipetkov/crane;
|
2023-04-26 21:23:28 +00:00
|
|
|
arion.url = github:hercules-ci/arion;
|
2024-07-11 14:35:11 +00:00
|
|
|
lix-module = {
|
|
|
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2022-05-31 16:45:33 +00:00
|
|
|
|
2021-10-29 04:25:58 +00:00
|
|
|
# ---
|
|
|
|
# Imported apps
|
2024-02-29 13:27:12 +00:00
|
|
|
youmubot.url = "github:natsukagami/youmubot";
|
2023-03-23 10:17:12 +00:00
|
|
|
swayfx = {
|
|
|
|
url = github:WillPower3309/swayfx;
|
2023-06-06 20:36:45 +00:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-23 10:17:12 +00:00
|
|
|
};
|
2023-03-31 08:26:13 +00:00
|
|
|
mpd-mpris = {
|
2023-09-17 10:56:21 +00:00
|
|
|
url = github:natsukagami/mpd-mpris;
|
2023-06-06 20:36:45 +00:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-31 08:26:13 +00:00
|
|
|
};
|
2024-01-30 17:35:53 +00:00
|
|
|
dtth-phanpy.url = "git+ssh://gitea@git.dtth.ch/nki/phanpy?branch=dtth-fork";
|
2024-06-16 20:32:25 +00:00
|
|
|
conduit.url = "gitlab:famedly/conduit/v0.8.0";
|
2024-05-27 09:06:04 +00:00
|
|
|
nix-gaming.url = github:fufexan/nix-gaming;
|
2021-11-03 22:42:02 +00:00
|
|
|
|
2022-07-06 20:26:50 +00:00
|
|
|
# --- Sources
|
2023-01-26 09:59:28 +00:00
|
|
|
kakoune.url = github:mawww/kakoune;
|
2022-07-06 20:26:50 +00:00
|
|
|
kakoune.flake = false;
|
2024-05-17 14:27:10 +00:00
|
|
|
kak-lsp.url = github:kakoune-lsp/kakoune-lsp;
|
2022-07-06 20:26:50 +00:00
|
|
|
kak-lsp.flake = false;
|
2023-06-16 11:08:01 +00:00
|
|
|
nixos-m1.url = github:tpwrules/nixos-apple-silicon;
|
2023-06-06 20:36:45 +00:00
|
|
|
nixos-m1.inputs.nixpkgs.follows = "nixpkgs";
|
2022-07-06 20:26:50 +00:00
|
|
|
|
2021-11-03 22:42:02 +00:00
|
|
|
# ---
|
|
|
|
# DEPLOYMENT ONLY! secrets
|
2022-06-10 02:41:37 +00:00
|
|
|
secrets.url = "git+ssh://git@github.com/natsukagami/nix-deploy-secrets";
|
2021-10-26 18:25:19 +00:00
|
|
|
};
|
|
|
|
|
2021-12-01 18:52:13 +00:00
|
|
|
outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager, deploy-rs, sops-nix, nur, ... }@inputs:
|
2021-10-29 17:31:16 +00:00
|
|
|
let
|
2022-07-04 19:41:04 +00:00
|
|
|
overlays = import ./overlay.nix inputs;
|
2023-04-18 11:03:19 +00:00
|
|
|
lib = nixpkgs.lib;
|
2021-12-09 20:54:26 +00:00
|
|
|
|
2023-04-18 11:03:19 +00:00
|
|
|
applyOverlays = { ... }: {
|
|
|
|
nixpkgs.overlays = lib.mkBefore overlays;
|
|
|
|
};
|
2022-07-04 19:41:04 +00:00
|
|
|
|
2023-04-18 11:03:19 +00:00
|
|
|
nixpkgsAsRegistry_ = stable: { lib, ... }: {
|
|
|
|
imports = [ applyOverlays ];
|
|
|
|
nix.registry.current-system.flake = self;
|
2021-12-09 20:54:26 +00:00
|
|
|
nix.registry.nixpkgs-unstable.flake = nixpkgs-unstable;
|
2023-04-18 22:13:43 +00:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
2024-06-07 11:50:38 +00:00
|
|
|
nix.nixPath = lib.mkDefault [
|
2021-12-09 20:54:26 +00:00
|
|
|
"nixpkgs-unstable=${nixpkgs-unstable}"
|
|
|
|
];
|
2022-07-04 19:41:04 +00:00
|
|
|
};
|
2023-04-18 11:03:19 +00:00
|
|
|
|
2023-09-26 20:31:25 +00:00
|
|
|
osuStable = { pkgs, ... }: {
|
|
|
|
nix.settings = {
|
|
|
|
substituters = [ "https://nix-gaming.cachix.org" ];
|
|
|
|
trusted-public-keys = [ "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ];
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ inputs.nix-gaming.packages.${pkgs.hostPlatform.system}.osu-stable ];
|
|
|
|
};
|
|
|
|
|
2023-04-18 11:03:19 +00:00
|
|
|
# Common Nix modules
|
|
|
|
common-nix = stable: { ... }: {
|
|
|
|
imports = [
|
|
|
|
(nixpkgsAsRegistry_ stable)
|
|
|
|
./common.nix
|
|
|
|
sops-nix.nixosModules.sops
|
2024-07-11 14:35:11 +00:00
|
|
|
inputs.lix-module.nixosModules.default
|
2023-04-18 11:03:19 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
common-nixos = stable: { ... }: {
|
|
|
|
imports = [
|
2023-04-23 09:28:35 +00:00
|
|
|
./modules/my-tinc
|
|
|
|
./modules/common/linux
|
2023-04-18 11:03:19 +00:00
|
|
|
(common-nix stable)
|
|
|
|
inputs.secrets.nixosModules.common
|
2023-12-08 00:14:08 +00:00
|
|
|
inputs.nix-gaming.nixosModules.pipewireLowLatency
|
2023-04-18 11:03:19 +00:00
|
|
|
];
|
|
|
|
};
|
2021-12-09 20:54:26 +00:00
|
|
|
|
2024-07-11 14:26:10 +00:00
|
|
|
mkPersonalSystem = nixpkgs-module: system: { configuration
|
|
|
|
, homeManagerUsers ? { }
|
|
|
|
, extraModules ? [ ]
|
|
|
|
, includeCommonModules ? true
|
|
|
|
,
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
home-manager-module =
|
|
|
|
if nixpkgs-module == inputs.nixpkgs then inputs.home-manager
|
|
|
|
else if nixpkgs-module == inputs.nixpkgs-unstable then inputs.home-manager-unstable
|
|
|
|
else builtins.abort "Unknown nixpkgs module, use `nixpkgs` or `nixpkgs-unstable`";
|
|
|
|
in
|
|
|
|
nixpkgs-module.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules =
|
|
|
|
(if includeCommonModules then [
|
|
|
|
(common-nixos nixpkgs-module)
|
|
|
|
] else [ ]) ++ [
|
|
|
|
configuration
|
|
|
|
# Home Manager
|
|
|
|
home-manager-module.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
home-manager.users = homeManagerUsers;
|
|
|
|
}
|
|
|
|
] ++ extraModules;
|
|
|
|
};
|
|
|
|
|
2021-10-29 17:31:16 +00:00
|
|
|
in
|
|
|
|
{
|
2023-04-18 11:03:19 +00:00
|
|
|
overlays.default = lib.composeManyExtensions overlays;
|
|
|
|
|
2023-06-03 11:47:20 +00:00
|
|
|
packages.x86_64-linux.deploy-rs = deploy-rs.packages.x86_64-linux.default;
|
|
|
|
apps.x86_64-linux.deploy-rs = deploy-rs.apps.x86_64-linux.default;
|
|
|
|
|
2021-10-29 17:31:16 +00:00
|
|
|
# MacBook configuration: nix-darwin + home-manager
|
2022-07-04 19:41:04 +00:00
|
|
|
darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem rec {
|
2021-10-29 17:31:16 +00:00
|
|
|
system = "aarch64-darwin";
|
|
|
|
modules = [
|
2023-04-18 11:03:19 +00:00
|
|
|
(common-nix nixpkgs-unstable)
|
2021-10-29 17:31:16 +00:00
|
|
|
./darwin/configuration.nix
|
2023-06-06 20:36:45 +00:00
|
|
|
inputs.home-manager.darwinModules.home-manager
|
2021-10-26 18:25:19 +00:00
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
2021-10-27 16:35:53 +00:00
|
|
|
home-manager.users.nki = import ./home/macbook-home.nix;
|
2021-10-29 17:31:16 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2021-10-28 22:15:24 +00:00
|
|
|
|
2021-10-29 17:31:16 +00:00
|
|
|
# Home configuration
|
2024-07-11 14:26:10 +00:00
|
|
|
nixosConfigurations."kagamiPC" = mkPersonalSystem nixpkgs-unstable "x86_64-linux" {
|
|
|
|
configuration = ./nki-home/configuration.nix;
|
|
|
|
homeManagerUsers.nki = import ./home/kagami-pc-home.nix;
|
|
|
|
extraModules = [ osuStable ];
|
2021-10-29 17:31:16 +00:00
|
|
|
};
|
2023-08-30 21:53:14 +00:00
|
|
|
# yoga g8 configuration
|
2024-07-11 14:26:10 +00:00
|
|
|
nixosConfigurations."nki-yoga-g8" = mkPersonalSystem nixpkgs "x86_64-linux" {
|
|
|
|
configuration = ./nki-yoga-g8/configuration.nix;
|
|
|
|
homeManagerUsers.nki = import ./home/nki-x1c1.nix;
|
|
|
|
extraModules = [
|
2023-08-30 21:53:14 +00:00
|
|
|
inputs.lanzaboote.nixosModules.lanzaboote
|
|
|
|
({ ... }: {
|
|
|
|
# Sets up secure boot
|
|
|
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
|
|
|
boot.lanzaboote = {
|
|
|
|
enable = true;
|
|
|
|
pkiBundle = "/etc/secureboot";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2024-01-19 10:36:36 +00:00
|
|
|
# framework configuration
|
2024-07-11 14:26:10 +00:00
|
|
|
nixosConfigurations."nki-framework" = mkPersonalSystem nixpkgs-unstable "x86_64-linux" {
|
|
|
|
configuration = ./nki-framework/configuration.nix;
|
|
|
|
homeManagerUsers.nki = import ./home/nki-framework.nix;
|
|
|
|
extraModules = [
|
2024-01-19 12:13:47 +00:00
|
|
|
inputs.lanzaboote.nixosModules.lanzaboote
|
2024-06-20 01:36:47 +00:00
|
|
|
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
|
2024-01-19 10:36:36 +00:00
|
|
|
({ ... }: {
|
|
|
|
# Sets up secure boot
|
2024-01-19 12:13:47 +00:00
|
|
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
|
|
|
boot.lanzaboote = {
|
|
|
|
enable = true;
|
|
|
|
pkiBundle = "/etc/secureboot";
|
|
|
|
};
|
2024-01-19 10:36:36 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2022-10-16 21:55:37 +00:00
|
|
|
# macbook nixos
|
2024-07-11 14:26:10 +00:00
|
|
|
nixosConfigurations."kagami-air-m1" = mkPersonalSystem nixpkgs "aarch64-linux" {
|
|
|
|
configuration = ./kagami-air-m1/configuration.nix;
|
|
|
|
homeManagerUsers.nki = import ./home/macbook-nixos.nix;
|
|
|
|
extraModules = [ inputs.nixos-m1.nixosModules.apple-silicon-support ];
|
2022-10-16 21:55:37 +00:00
|
|
|
};
|
2021-10-31 19:06:44 +00:00
|
|
|
|
|
|
|
# DigitalOcean node
|
2024-07-11 14:26:10 +00:00
|
|
|
nixosConfigurations."nki-personal-do" = mkPersonalSystem nixpkgs "x86_64-linux" {
|
|
|
|
configuration = ./nki-personal-do/configuration.nix;
|
2024-07-14 03:36:53 +00:00
|
|
|
extraModules = [
|
2023-04-26 21:23:28 +00:00
|
|
|
inputs.arion.nixosModules.arion
|
2023-06-19 23:27:51 +00:00
|
|
|
inputs.youmubot.nixosModules.default
|
2023-04-19 12:23:10 +00:00
|
|
|
inputs.secrets.nixosModules.nki-personal-do
|
2021-10-31 19:06:44 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
deploy.nodes."nki-personal-do" = {
|
2023-08-31 08:40:42 +00:00
|
|
|
hostname = "nki.personal";
|
2021-10-31 19:06:44 +00:00
|
|
|
sshUser = "root";
|
|
|
|
profiles.system = {
|
|
|
|
user = "root";
|
|
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."nki-personal-do";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# This is highly advised, and will prevent many possible mistakes
|
|
|
|
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
|
2022-05-31 16:45:33 +00:00
|
|
|
} // (inputs.flake-utils.lib.eachDefaultSystem (system: {
|
|
|
|
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
|
|
|
|
}));
|
2021-10-26 18:25:19 +00:00
|
|
|
}
|
2024-07-11 14:26:10 +00:00
|
|
|
|