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 = {
|
2023-06-03 11:39:55 +00:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
2023-04-18 23:09:20 +00:00
|
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
2023-04-04 18:28:28 +00:00
|
|
|
# nixpkgs-unstable.follows = "nixos-m1/nixpkgs";
|
2021-10-26 18:25:19 +00:00
|
|
|
darwin.url = "github:lnl7/nix-darwin/master";
|
|
|
|
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2023-06-03 11:39:55 +00:00
|
|
|
home-manager.url = "github:nix-community/home-manager/release-23.05";
|
2021-12-01 18:52:13 +00:00
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-27 12:59:32 +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
|
|
|
|
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;
|
2022-05-31 16:45:33 +00:00
|
|
|
|
2021-10-29 04:25:58 +00:00
|
|
|
# ---
|
|
|
|
# Imported apps
|
|
|
|
rnix-lsp.url = "github:nix-community/rnix-lsp";
|
2021-11-03 19:01:23 +00:00
|
|
|
youmubot.url = "github:natsukagami/youmubot";
|
2021-12-09 20:54:26 +00:00
|
|
|
nix-gaming.url = github:fufexan/nix-gaming;
|
2023-04-18 23:09:20 +00:00
|
|
|
nix-gaming.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2023-03-23 10:17:12 +00:00
|
|
|
swayfx = {
|
|
|
|
url = github:WillPower3309/swayfx;
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
|
|
};
|
2023-03-31 08:26:13 +00:00
|
|
|
mpd-mpris = {
|
|
|
|
url = github:natsukagami/mpd-mpris/nix;
|
2023-04-18 23:09:20 +00:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2023-03-31 08:26:13 +00:00
|
|
|
};
|
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;
|
2023-04-29 23:47:01 +00:00
|
|
|
kak-lsp.url = github:kak-lsp/kak-lsp;
|
2022-07-06 20:26:50 +00:00
|
|
|
kak-lsp.flake = false;
|
2023-02-25 20:43:29 +00:00
|
|
|
nixos-m1.url = github:tpwrules/nixos-apple-silicon;
|
2023-05-07 13:44:02 +00:00
|
|
|
nixos-m1.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
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;
|
2022-07-04 19:41:04 +00:00
|
|
|
nix.registry.nixpkgs.flake = stable;
|
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;
|
2021-12-09 20:54:26 +00:00
|
|
|
nix.nixPath = [
|
|
|
|
"nixpkgs=${nixpkgs}"
|
|
|
|
"nixpkgs-unstable=${nixpkgs-unstable}"
|
|
|
|
"/nix/var/nix/profiles/per-user/root/channels"
|
|
|
|
];
|
2022-07-04 19:41:04 +00:00
|
|
|
# Binary Cache for Haskell.nix
|
2022-09-02 21:07:53 +00:00
|
|
|
nix.settings.trusted-public-keys = [
|
2022-07-04 19:41:04 +00:00
|
|
|
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
|
|
|
];
|
2022-09-02 21:07:53 +00:00
|
|
|
nix.settings.substituters = [
|
2022-07-04 19:41:04 +00:00
|
|
|
"https://cache.iog.io"
|
|
|
|
];
|
|
|
|
};
|
2023-04-18 11:03:19 +00:00
|
|
|
nixpkgsAsRegistry = nixpkgsAsRegistry_ nixpkgs;
|
|
|
|
|
|
|
|
# Common Nix modules
|
|
|
|
common-nix = stable: { ... }: {
|
|
|
|
imports = [
|
|
|
|
(nixpkgsAsRegistry_ stable)
|
|
|
|
./common.nix
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
];
|
|
|
|
};
|
|
|
|
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
|
|
|
|
];
|
|
|
|
};
|
2021-12-09 20:54:26 +00:00
|
|
|
|
|
|
|
enableOsuStable = { lib, ... }: {
|
|
|
|
imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ];
|
|
|
|
|
|
|
|
services.pipewire = {
|
|
|
|
enable = true;
|
|
|
|
# alsa is optional
|
|
|
|
alsa.enable = true;
|
|
|
|
alsa.support32Bit = true;
|
|
|
|
# needed for osu
|
|
|
|
pulse.enable = true;
|
|
|
|
lowLatency.enable = true;
|
|
|
|
};
|
|
|
|
hardware.pulseaudio.enable = lib.mkOverride 0 false;
|
|
|
|
|
2022-09-02 21:07:53 +00:00
|
|
|
nix.settings.substituters = [ "https://nix-gaming.cachix.org" ];
|
|
|
|
nix.settings.trusted-public-keys = [ "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ];
|
2021-12-09 20:54:26 +00:00
|
|
|
|
|
|
|
environment.systemPackages = [ inputs.nix-gaming.packages.x86_64-linux.osu-stable ];
|
|
|
|
};
|
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-03-27 12:59:32 +00:00
|
|
|
inputs.home-manager-unstable.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
|
2023-06-03 11:39:55 +00:00
|
|
|
nixosConfigurations."nki-home" = nixpkgs.lib.nixosSystem rec {
|
2021-10-29 17:31:16 +00:00
|
|
|
system = "x86_64-linux";
|
|
|
|
modules = [
|
2023-06-03 11:39:55 +00:00
|
|
|
(common-nixos nixpkgs)
|
2021-10-29 17:31:16 +00:00
|
|
|
./nki-home/configuration.nix
|
2021-12-09 20:54:26 +00:00
|
|
|
enableOsuStable
|
2023-04-18 23:09:20 +00:00
|
|
|
inputs.home-manager-unstable.nixosModules.home-manager
|
2021-10-29 17:31:16 +00:00
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
2023-03-31 08:26:13 +00:00
|
|
|
home-manager.users.nki = { ... }: {
|
|
|
|
imports = [
|
2023-04-18 23:09:20 +00:00
|
|
|
# inputs.mpd-mpris.homeManagerModules.default
|
2023-03-31 08:26:13 +00:00
|
|
|
./home/kagami-pc-home.nix
|
|
|
|
];
|
|
|
|
};
|
2021-10-29 17:31:16 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2022-04-19 20:46:33 +00:00
|
|
|
# x1c1 configuration
|
2023-04-19 16:54:26 +00:00
|
|
|
# nixosConfigurations."nki-x1c1" = nixpkgs.lib.nixosSystem rec {
|
|
|
|
# system = "x86_64-linux";
|
|
|
|
# modules = [
|
|
|
|
# (common-nixos nixpkgs)
|
|
|
|
# ./nki-x1c1/configuration.nix
|
|
|
|
# home-manager.nixosModules.home-manager
|
|
|
|
# {
|
|
|
|
# home-manager.useGlobalPkgs = true;
|
|
|
|
# home-manager.useUserPackages = true;
|
|
|
|
# home-manager.users.nki = import ./home/nki-x1c1.nix;
|
|
|
|
# }
|
|
|
|
# ];
|
|
|
|
# };
|
2022-10-16 21:55:37 +00:00
|
|
|
# macbook nixos
|
2023-05-07 13:44:02 +00:00
|
|
|
nixosConfigurations."kagami-air-m1" = inputs.nixpkgs-unstable.lib.nixosSystem rec {
|
2022-10-16 21:55:37 +00:00
|
|
|
system = "aarch64-linux";
|
|
|
|
modules = [
|
2023-05-07 13:44:02 +00:00
|
|
|
(common-nixos inputs.nixpkgs-unstable)
|
2023-02-25 20:43:29 +00:00
|
|
|
inputs.nixos-m1.nixosModules.apple-silicon-support
|
2022-10-16 21:55:37 +00:00
|
|
|
./kagami-air-m1/configuration.nix
|
2023-04-04 18:28:28 +00:00
|
|
|
inputs.home-manager-unstable.nixosModules.home-manager
|
2022-10-16 21:55:37 +00:00
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
home-manager.users.nki = import ./home/macbook-nixos.nix;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2021-10-31 19:06:44 +00:00
|
|
|
|
|
|
|
# DigitalOcean node
|
2022-12-05 09:59:59 +00:00
|
|
|
nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem rec {
|
2021-10-31 19:06:44 +00:00
|
|
|
system = "x86_64-linux";
|
|
|
|
modules = [
|
2023-04-18 11:03:19 +00:00
|
|
|
(common-nixos nixpkgs)
|
2023-04-26 21:23:28 +00:00
|
|
|
inputs.arion.nixosModules.arion
|
2021-10-31 19:06:44 +00:00
|
|
|
./modules/my-tinc
|
2021-11-03 17:22:27 +00:00
|
|
|
inputs.youmubot.nixosModule.x86_64-linux
|
2021-10-31 19:06:44 +00:00
|
|
|
./nki-personal-do/configuration.nix
|
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" = {
|
|
|
|
hostname = "nki-personal-do";
|
|
|
|
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
|
|
|
}
|